diff mac/dw.m @ 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 d7eafaa054ab
children 404b639f096b
line wrap: on
line diff
--- a/mac/dw.m	Tue Jul 26 00:25:57 2011 +0000
+++ b/mac/dw.m	Tue Jul 26 03:09:41 2011 +0000
@@ -357,7 +357,7 @@
             case 14:
             {
                 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))handler->signalfunction;
-                int selected = (int)event;
+                int selected = DW_POINTER_TO_INT(event);
 
                 return valuechangedfunc(handler->window, selected, handler->data);;
             }
@@ -409,7 +409,7 @@
             case 15:
             {
                 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))handler->signalfunction;
-                int pageid = (int)event;
+                int pageid = DW_POINTER_TO_INT(event);
 
                 return switchpagefunc(handler->window, pageid, handler->data);
             }
@@ -422,7 +422,7 @@
             case 17:
             {
                 int (*clickcolumnfunc)(HWND, int, void *) = handler->signalfunction;
-                int column_num = (int)event;
+                int column_num = DW_POINTER_TO_INT(event);
 
                 return clickcolumnfunc(handler->window, column_num, handler->data);
             }
@@ -1104,7 +1104,7 @@
         _do_resize(box, size.width, size.height);
         _handle_resize_events(box);
     }
-    _event_handler(self, (void *)[page pageid], 15);
+    _event_handler(self, DW_INT_TO_POINTER([page pageid]), 15);
 }
 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; }
 @end
@@ -1287,7 +1287,7 @@
     {
         [self setDoubleValue:(newpos/max)];
     }
-    _event_handler(self, (void *)(int)newpos, 14);
+    _event_handler(self, DW_INT_TO_POINTER((int)newpos), 14);
 }
 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; }
 @end
@@ -1608,7 +1608,7 @@
     /* Handler for container class */
     _event_handler(self, (NSEvent *)[self getRowTitle:(int)[self selectedRow]], 12);
     /* Handler for listbox class */
-    _event_handler(self, (NSEvent *)(int)[self selectedRow], 11);
+    _event_handler(self, DW_INT_TO_POINTER((int)[self selectedRow]), 11);
 }
 -(NSMenu *)menuForEvent:(NSEvent *)event
 {