Here's a few fixes for some instances of (void *) arithmetic and assorted C++-style comment fixes.

--
Bardur Arantsson
<[EMAIL PROTECTED]>

- But what about my poem?
- Three monkeys, ten minutes.
                                   Dilbert and Dogbert, 'Dilbert'
Index: src/kdb/kdb.c
===================================================================
--- src/kdb/kdb.c       (revision 860)
+++ src/kdb/kdb.c       (working copy)
@@ -508,7 +508,6 @@
  */
 void listAllKeysForShell(KeySet *ks) {
        Key *walker=0;
-       int isParent=0;
        size_t parentNameSize=strlen(argKeyName);
        char *keyName=0;
        void *keyValue=0;
@@ -517,9 +516,9 @@
        ksRewind(ks);
        while ((walker=ksNext(ks))) {
                keyName=keyStealName(walker);
-               isParent=(int)strstr(keyName,argKeyName);
                
-               if (isParent) {
+                /* Parent? */
+                if (strstr(keyName,argKeyName)) {
                        keyName+=parentNameSize;
                        while (*keyName && *keyName == '/') keyName++;
                } else {
@@ -972,7 +971,7 @@
 int commandGet(KDBHandle handle) {
        int ret;
        Key *key = 0;
-       char *buffer = 0; // used two times
+        char *buffer = 0; /* used two times */
        char *p;
        size_t size,cs=0;
        uint8_t keyType;
Index: src/backends/berkeleydb/berkeleydb.c
===================================================================
--- src/backends/berkeleydb/berkeleydb.c        (revision 860)
+++ src/backends/berkeleydb/berkeleydb.c        (working copy)
@@ -163,7 +163,7 @@
  *
  */
 int keyToBDB(const Key *key, DBT *dbkey, DBT *dbdata) {
-       void *serialized;
+        char *serialized;
        size_t metaInfoSize;
        int utf8Conversion=0, utf8CommentConverted=0, utf8ValueConverted = 0;
        char *convertedName=key->key;
@@ -274,14 +274,14 @@
 
        /* Set comment */
        if (key->commentSize)
-               keySetComment(key,dbdata->data+metaInfoSize);
+                keySetComment(key,((char *) dbdata->data)+metaInfoSize);
        
        /* userDomain must be set outside this function,
         * someplace more aware of the context */
        keySetName(key,dbkey->data);
 
        /* Set value. Key type came from the metaInfo importing above. */
-       keySetRaw(key,dbdata->data+metaInfoSize+key->commentSize,key->dataSize);
+        keySetRaw(key,((char *) 
dbdata->data)+metaInfoSize+key->commentSize,key->dataSize);
        
        if (kdbNeedsUTF8Conversion()) {
                size_t size=strblen(key->key);
Index: src/backends/filesys/filesys.c
===================================================================
Index: tests/test_key.c
===================================================================
--- tests/test_key.c    (revision 860)
+++ tests/test_key.c    (working copy)
@@ -65,7 +65,7 @@
                perror("my_malloc");
                exit(-1);
        }
-       memset(buf, '@', size); // Fill with '@' since '\0' mean end of string
+        memset(buf, '@', size); /* Fill with '@' since '\0' mean end of string 
*/
 
        return buf;
 }
@@ -76,20 +76,20 @@
 
        printf("Test key creation\n");
        
-       // Empty key
+        /* Empty key */
        key = keyNew(KEY_SWITCH_END);
        succeed_if(key != NULL, "keyNew: Unable to create a new empty key");
        succeed_if(keyIsInitialized(key), "keyNew: Doesn't set key as 
initialized");
        succeed_if(keyDel(key) == 0, "keyDel: Unable to delete empty key");
                
-       // Key with name
+        /* Key with name */
        key = keyNew("system/sw/test", KEY_SWITCH_END);
        succeed_if(key != NULL, "keyNew: Unable to create a key with name");
        succeed_if(strcmp(keyStealName(key), "system/sw/test") == 0, "keyNew: 
Key's name setted incorrectly");
        succeed_if(keyDel(key) == 0, "keyDel: Unable to delete key with name");
        
        
-       // Key with name + value (default type must be KEY_TYPE_STRING)
+        /* Key with name + value (default type must be KEY_TYPE_STRING) */
        key = keyNew("system/sw/test",
                        KEY_SWITCH_VALUE, "test",
                        KEY_SWITCH_END);
@@ -98,7 +98,7 @@
        succeed_if( strcmp(keyStealValue(key), "test") == 0, "keyNew: Value not 
set correctly");
        succeed_if(keyDel(key) == 0, "keyDel: Unable to delete key with name + 
value");
        
-       // Key with name + UID/GID
+        /* Key with name + UID/GID */
        key = keyNew("system/sw/test",
                        KEY_SWITCH_UID, 123,
                        KEY_SWITCH_GID, 456,
@@ -108,7 +108,7 @@
        succeed_if(keyGetGID(key) == 456, "keyNew: GID not set correctly");
        succeed_if(keyDel(key) == 0, "keyDel: Unable to delete key with name + 
UID + GID");
 
-       // Key with name + MODE
+        /* Key with name + MODE */
        key = keyNew("system/sw/test",
                        KEY_SWITCH_MODE, 0644,
                        KEY_SWITCH_END);
@@ -116,7 +116,7 @@
        succeed_if(keyGetAccess(key) == 0644, "keyNew: access no set 
correctly");
        succeed_if(keyDel(key) == 0, "keyDel: Unable to delete key with name + 
access");
        
-       // Key with name + owner
+        /* Key with name + owner */
        key = keyNew("user/test/test",
                        KEY_SWITCH_OWNER, "yl",
                        KEY_SWITCH_END);
@@ -197,7 +197,7 @@
 
        printf("Test key duplication\n");
        
-       // Create test key
+        /* Create test key */
        orig = keyNew("user:yl/foo/bar",
                        KEY_SWITCH_VALUE, "foobar",
                        KEY_SWITCH_UID, 123,
@@ -206,13 +206,13 @@
                        KEY_SWITCH_TYPE, KEY_TYPE_STRING,
                        KEY_SWITCH_END);
 
-       // Create target
+        /* Create target */
        copy = keyNew(KEY_SWITCH_END);
        
-       // Copy the key
+        /* Copy the key */
        succeed_if( keyDup(orig, copy) == 0, "keyDup failed");
        
-       // Check the copy
+        /* Check the copy */
        succeed_if( strcmp(keyStealName(copy), "user/foo/bar") == 0, "keyDup: 
key name copy error");
        succeed_if( strcmp(keyStealOwner(copy), "yl") == 0, "keyDup: key name 
owner copy error");
        succeed_if( strcmp(keyStealValue(copy), "foobar") == 0, "keyDup: key 
value copy error");
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Registry-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/registry-list

Reply via email to