diff dwtest.c @ 1102:cfe7d2b6bc16

Added DW_INT_TO_POINTER/DW_UINT_TO_POINTER/DW_POINTER_TO_INT/DW_POINTER_TO_UINT macros. These are used to cast between pointer and integers without generate warnings on 64bit systems. Converted Mac source and dwtest source to use them. Not sure if limits.h is available on all target platforms, will commit fixes as necessary.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 26 Jul 2011 03:09:41 +0000
parents b905fd8e7fd1
children 404b639f096b
line wrap: on
line diff
--- a/dwtest.c	Tue Jul 26 00:25:57 2011 +0000
+++ b/dwtest.c	Tue Jul 26 03:09:41 2011 +0000
@@ -648,7 +648,7 @@
     char buf[200];
     HWND statline = (HWND)data;
 
-    sprintf(buf,"DW_SIGNAL_ITEM_ENTER: Window: %x Text: %s", (unsigned int)window, text );
+    sprintf(buf,"DW_SIGNAL_ITEM_ENTER: Window: %x Text: %s", DW_POINTER_TO_UINT(window), text );
     dw_window_set_text( statline, buf);
     return 0;
 }
@@ -658,7 +658,7 @@
     char buf[200];
     HWND statline = (HWND)data;
 
-    sprintf(buf,"DW_SIGNAL_ITEM_CONTEXT: Window: %x Text: %s x: %d y: %d Itemdata: %x", (unsigned int)window, text, x, y, (unsigned int)itemdata );
+    sprintf(buf,"DW_SIGNAL_ITEM_CONTEXT: Window: %x Text: %s x: %d y: %d Itemdata: %x", DW_POINTER_TO_UINT(window), text, x, y, DW_POINTER_TO_UINT(itemdata) );
     dw_window_set_text( statline, buf);
     return 0;
 }
@@ -668,7 +668,7 @@
     char buf[200];
     HWND statline = (HWND)data;
 
-    sprintf(buf,"DW_SIGNAL_LIST_SELECT: Window: %d Item: %d", (unsigned int)window, item );
+    sprintf(buf,"DW_SIGNAL_LIST_SELECT: Window: %d Item: %d", DW_POINTER_TO_UINT(window), item );
     dw_window_set_text( statline, buf);
     return 0;
 }
@@ -678,7 +678,8 @@
     char buf[200];
     HWND statline = (HWND)data;
 
-    sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata );
+    sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", DW_POINTER_TO_UINT(window), 
+            DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) );
     dw_window_set_text( statline, buf);
     return 0;
 }
@@ -690,9 +691,11 @@
     HWND statline = (HWND)data;
     unsigned long size;
 
-    sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata );
+    sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", DW_POINTER_TO_UINT(window), 
+            DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) );
     dw_window_set_text( statline, buf);
-    sprintf(buf,"\r\nDW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x\r\n", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata );
+    sprintf(buf,"\r\nDW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x\r\n", DW_POINTER_TO_UINT(window), 
+            DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) );
     mle_point = dw_mle_import( container_mle, buf, mle_point);
     str = dw_container_query_start(container, DW_CRA_SELECTED);
     while(str)
@@ -704,10 +707,12 @@
     /* Make the last inserted point the cursor location */
     dw_mle_set_cursor(container_mle, mle_point);
     /* set the details of item 0 to new data */
-    fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon);
+    fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container), 
+            DW_POINTER_TO_INT(containerinfo), DW_POINTER_TO_INT(fileicon));
     dw_filesystem_change_file(container, 0, "new data", fileicon);
     size = 999;
-    fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon);
+    fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container), 
+            DW_POINTER_TO_INT(containerinfo), DW_POINTER_TO_INT(fileicon));
     dw_filesystem_change_item(container, 1, 0, &size);
     return 0;
 }
@@ -717,7 +722,8 @@
     FILE *fp=fopen("log","a");
     if ( fp )
     {
-       fprintf(fp,"DW_SIGNAL_SWITCH_PAGE: Window: %x PageNum: %u Itemdata: %x\n", (unsigned int)window, (unsigned int)page_num, (unsigned int)itemdata );
+       fprintf(fp,"DW_SIGNAL_SWITCH_PAGE: Window: %x PageNum: %u Itemdata: %x\n", DW_POINTER_TO_UINT(window), 
+               DW_POINTER_TO_UINT(page_num), DW_POINTER_TO_UINT(itemdata) );
        fclose(fp);
     }
     return 0;
@@ -747,7 +753,8 @@
         else
             strcpy(buf1,"Unknown");
     }
-    sprintf(buf,"DW_SIGNAL_COLUMN_CLICK: Window: %x Column: %d Type: %s Itemdata: %x", (unsigned int)window, column_num, buf1, (unsigned int)data );
+    sprintf(buf,"DW_SIGNAL_COLUMN_CLICK: Window: %x Column: %d Type: %s Itemdata: %x", DW_POINTER_TO_UINT(window), 
+            column_num, buf1, DW_POINTER_TO_UINT(data) );
     dw_window_set_text( statline, buf);
     return 0;
 }
@@ -1018,7 +1025,8 @@
         sprintf(buffer, "Filename %d",z+1);
         if (z == 0 ) thisicon = foldericon;
         else thisicon = fileicon;
-        fprintf(stderr,"Initial: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)thisicon);
+        fprintf(stderr,"Initial: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container),
+                DW_POINTER_TO_INT(containerinfo), DW_POINTER_TO_INT(thisicon));
         dw_filesystem_set_file(container, containerinfo, z, buffer, thisicon);
         dw_filesystem_set_item(container, containerinfo, 0, z, &thisicon);
         dw_filesystem_set_item(container, containerinfo, 1, z, &size);