Fix warnings on x86_64
authorteodor <teodor>
Thu, 19 Oct 2006 11:55:54 +0000 (11:55 +0000)
committerteodor <teodor>
Thu, 19 Oct 2006 11:55:54 +0000 (11:55 +0000)
expected/mem
flatdbtest.c
memtest.c
shmem.c
tbtree.c

index c3578c6..3291825 100644 (file)
@@ -6,7 +6,7 @@ mixed:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz free:1048380
 mixed:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz free:1048320
 mixed:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz free:1048320 freenew:0
 mixed:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz free:1048320 freechild:1048508
-Child: 0
+Child: IS NULL
 lc:abcdefghijklmnopqrstuvwxyz uc:ABCDEFGHIJKLMNOPQRSTUVWXYZ free:1048500
 lc:abcdefghijklmnopqrstuvwxyz free:1048536
 uc:ABCDEFGHIJKLMNOPQRSTUVWXYZ free:1048500
@@ -15,4 +15,4 @@ mixed:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz free:1048396
 mixed:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz free:1048336
 mixed:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz free:1048336 freenew:0
 mixed:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz free:1048336 freechild:1048512
-Child: 0
+Child: IS NULL
index ec6fb69..383d81e 100644 (file)
@@ -89,7 +89,7 @@ main(int argn, char *argv[]) {
                                        tlog(TL_CRIT|TL_EXIT, "FDBPut failed: %d", rc);
                                }
                                tfree(record);
-                               printf("Put: off:%d len:%d '%s'\n", (int)offset, len-RECHDRSZ, optarg);
+                               printf("Put: off:%d len:%d '%s'\n", (int)offset, (int)(len-RECHDRSZ), optarg);
                                break;
                        case 'g': 
                                if (!isopened) {usage();}
@@ -98,7 +98,7 @@ main(int argn, char *argv[]) {
                                        FDBClose(&db);
                                        tlog(TL_CRIT|TL_EXIT, "FDBGet failed: %d", rc);
                                }
-                               printf("Get: off:%d len:%d '", (int)offset, record->length - RECHDRSZ);
+                               printf("Get: off:%d len:%d '", (int)offset, (int)(record->length - RECHDRSZ));
                                fwrite(record->data, record->length - RECHDRSZ, 1, stdout);
                                puts("'");
                                tfree(record);
@@ -117,7 +117,7 @@ main(int argn, char *argv[]) {
                                if ( db.listcur ) { 
                                puts("List of free space:");
                                        for(i=0;i<db.listcur;i++)
-                                               printf("\toff: %d\t len: %d\n", (int)(db.space[i].offset), db.space[i].length);
+                                               printf("\toff: %d\t len: %d\n", (int)(db.space[i].offset), (int)(db.space[i].length));
                                } else
                                         puts("List of free space is void");
                                break;
index 9abf087..e5bf088 100644 (file)
--- a/memtest.c
+++ b/memtest.c
@@ -97,39 +97,39 @@ main(int argn, char *argv[]) {
                
                ptr1 = mcstrdup(base, ptr);
                strupper(ptr1); 
-               printf("lc:%s uc:%s free:%d\n", ptr, ptr1, base->chunk->freesize);
+               printf("lc:%s uc:%s free:%d\n", ptr, ptr1, (int)base->chunk->freesize);
 
                mcfree(ptr1);
-               printf("lc:%s free:%d\n", ptr, base->chunk->freesize);
+               printf("lc:%s free:%d\n", ptr, (int)base->chunk->freesize);
 
                ptr1 = mcstrdup(base, ptr);
                mcfree(ptr);
                strupper(ptr1); 
-               printf("uc:%s free:%d\n", ptr1, base->chunk->freesize);
+               printf("uc:%s free:%d\n", ptr1, (int)base->chunk->freesize);
 
                ptr= mcstrdup(base, ptr1);
                strlower(ptr);
                ptr1 =mcrealloc(ptr1, 60);
                strcat(ptr1, ptr);  
-               printf("mixed:%s free:%d\n", ptr1, base->chunk->freesize);
+               printf("mixed:%s free:%d\n", ptr1, (int)base->chunk->freesize);
 
                ptr = mcrealloc(ptr1, 59);
                tassert( ptr==ptr1 );
-               printf("mixed:%s free:%d\n", ptr, base->chunk->freesize);
+               printf("mixed:%s free:%d\n", ptr, (int)base->chunk->freesize);
 
                ptr = mcrealloc(ptr1, 120); 
                tassert( ptr==ptr1 );
-               printf("mixed:%s free:%d\n", ptr, base->chunk->freesize);
+               printf("mixed:%s free:%d\n", ptr, (int)base->chunk->freesize);
        
                ptr1 = mcalloc(base, CNTXCHUNK);
                strcpy(ptr1, ptr);
-               printf("mixed:%s free:%d freenew:%d\n", ptr1, base->chunk->freesize, base->chunk->next->freesize);
+               printf("mixed:%s free:%d freenew:%d\n", ptr1, (int)base->chunk->freesize, (int)base->chunk->next->freesize);
 
                ptr1= mcstrdup(child, ptr);
-               printf("mixed:%s free:%d freechild:%d\n", ptr1, base->chunk->freesize, child->chunk->freesize);
+               printf("mixed:%s free:%d freechild:%d\n", ptr1, (int)base->chunk->freesize, (int)child->chunk->freesize);
 
                freeMemoryContext(child);
-               printf("Child: %d\n", (int)(base->child));
+               printf("Child: IS %sNULL\n", (base->child == NULL) ? "" : "NOT ");
 
                child = allocMemoryContext(base, flags);
                freeMemoryContext(base);
diff --git a/shmem.c b/shmem.c
index 933dc4b..696db8d 100644 (file)
--- a/shmem.c
+++ b/shmem.c
@@ -68,7 +68,7 @@ attachSharedMemory(int key, char *path, int size, int rdonly) {
        flags = ( rdonly ) ? SHM_RDONLY : 0;
 
        shm = shmat(shm_id, 0, flags);      /* Attach SHM segment */
-       if ( (int)shm == -1 )
+       if ( shm == (void*)-1 )
                tlog(TL_CRIT|TL_EXIT, "shmat error: %s", strerror(errno));
  
        return shm;
index af12db5..416cabc 100644 (file)
--- a/tbtree.c
+++ b/tbtree.c
@@ -420,8 +420,8 @@ dumpPage(TBTree *db, TBTPage *page, int follow) {
                TBTPointer *ptr= (TBTPointer*)(page->data+db->pointersize*i);
                for(j=0;j<follow+2;j++)
                        putchar(' ');
-               printf("i:%d(%d) kl:%d ko:%d ",
-                       i, (int)ptr, 
+               printf("i:%d(%p) kl:%d ko:%d ",
+                       i, (void*)ptr, 
                        (db->keylen) ? db->keylen : ptr->key.varlen.length,
                        (db->keylen) ? 0 : ptr->key.varlen.offset
                );