[Tcladdressbook-commits] Source TclAddressBookUtils.c,1.3,1.4
Status: Alpha
Brought to you by:
bdesgraupes
|
From: <bde...@us...> - 2003-12-09 08:08:23
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv7644/Source
Modified Files:
TclAddressBookUtils.c
Log Message:
Improved objc checks
Index: TclAddressBookUtils.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- TclAddressBookUtils.c 7 Dec 2003 16:43:15 -0000 1.3
+++ TclAddressBookUtils.c 9 Dec 2003 08:08:20 -0000 1.4
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBookUtils.c"
* Created: 2003-12-05 10:08:03
- * Last modification: 2003-12-07 16:58:34
+ * Last modification: 2003-12-09 08:50:24
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -919,12 +919,12 @@
*
* TclAB_PropertyAdd --
*
- * This function is invoked to process the [addressbook add property]
+ * This function is invoked to process the [addressbook property add]
* Tcl command.
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook add property (-groups|-persons) propName propType
+ * addressbook property add (-groups|-persons) propName propType
*
* Results:
* A standard Tcl result.
@@ -948,7 +948,6 @@
CFMutableDictionaryRef theDict;
int index, length, result;
int theInt;
- SInt32 theSInt32;
TextEncoding theEncoding = GetApplicationTextEncoding();
static CONST char *typeSwitches[] = {
@@ -983,7 +982,7 @@
Tcl_IncrRefCount(objv[4]);
- if (Tcl_GetIndexFromObj(interp, objv[5], typeSwitches, "property", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[5], typeSwitches, "type", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -1000,8 +999,9 @@
// Add the property to the Address Book
if ( !ABAddPropertiesAndTypes(ab, inRecordType ? kABPersonRecordType : kABGroupRecordType, theDict) ) {
- Tcl_AppendStringsToObj(resultPtr, "Couldn't add new property for ",
- inRecordType ? "Person":"Group" , " records", (char *) NULL);
+ Tcl_AppendStringsToObj(resultPtr, "Couldn't add property '",
+ Tcl_GetStringFromObj(objv[4], &length), "' to ",
+ inRecordType ? "Person":"Group" , " records", (char *) NULL);
result = TCL_ERROR;
} else {
result = TCL_OK;
@@ -1053,6 +1053,11 @@
int i, result;
ABAddressBookRef ab;
+ if (objc > 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "names (-groups|-persons)");
+ return TCL_ERROR;
+ }
+
// Get the address book
ab = ABGetSharedAddressBook();
@@ -1091,12 +1096,12 @@
*
* TclAB_PropertyRemove --
*
- * This function is invoked to process the [addressbook remove property]
+ * This function is invoked to process the [addressbook property remove]
* Tcl command.
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook remove property (-groups|-persons) propName
+ * addressbook property remove (-groups|-persons) propName
*
* Results:
* A standard Tcl result.
@@ -1118,9 +1123,7 @@
ABAddressBookRef ab;
CFStringRef theProp;
CFMutableArrayRef theArray;
- int index, length, result;
- int theInt;
- SInt32 theSInt32;
+ int length, result;
char * propName;
Tcl_ResetResult(interp);
|