[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] wmaker: Fix compiler warnings about pointer <--> integer conversion



This is version 2 of the patch, where I fixed _all_ the pointer <--> integer
warnings I see in my 64-bit machine. Now there is only one warning left,
which I will think about later.

I am also sending the patch in hg format :-)

The combination of my patch to beautify the compilation together with
these warning fixes results in a professional-looking (IMHO) compilation
process, as you can check here:

http://www.aei.mpg.de/~crmafra/almost_warning-free.txt

I think this patch is not controversial (except if it breaks compilation
in 32-bit :-). 

My other patch about the Automake warning is a safe cleanup patch too,
regardeless of which Automake version is the officially supported one.

So I propose the inclusion of them both into 0.92.1, and the "beauty"
patch for later (but if it is included now I don't mind too).

I would of course appreciate to hear what people have to say about
my patches, if they are welcomed or not etc. I do it for fun and to
learn new things :-)

I guess that is it for now, I have to finish some computations now :-)


# HG changeset patch
# User Carlos R. Mafra <crmafra@aei.mpg.de>
# Date 1225932989 -3600
# Node ID 0d85bfb8bea48e31fb1d1ad09b44fa215dff518d
# Parent  d9069b88dd69db472fc644fbbc3016918c0dc5e2
wmaker: Fix compiler warnings about pointer <--> integer conversion

There may be issues with running applications in 64-bit mode when
they were written with tacit assumptions about 32-bit platforms.
For example,

    * Assuming that a pointer can be cast back and forth to an integer

The reason is that the size of the integer and pointer may be different.
See the description of "[PATCH] Warn when casting a pointer (constant)
to an integer of different size." in the gcc mailing list

http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01881.html

where it was also suggested the use of casts to uintptr_t. This is
what this patch does.

As a result the following warnings are fixed, leaving us with an
almost warning-free compilation in 64-bits:

defaults.c:1446: warning: cast to pointer from integer of different size
defaults.c:1457: warning: cast to pointer from integer of different size
defaults.c:1471: warning: cast to pointer from integer of different size
defaults.c:1486: warning: cast to pointer from integer of different size
icon.c:67: warning: cast from pointer to integer of different size
menu.c:112: warning: cast from pointer to integer of different size
switchmenu.c:452: warning: cast from pointer to integer of different size
window.c:140: warning: cast from pointer to integer of different size
window.c:2217: warning: cast to pointer from integer of different size
workspace.c:135: warning: cast to pointer from integer of different size
workspace.c:214: warning: cast to pointer from integer of different size
workspace.c:634: warning: cast to pointer from integer of different size
workspace.c:1330: warning: cast to pointer from integer of different size
workspace.c:1514: warning: cast to pointer from integer of different size
wfilepanel.c:135: warning: cast from pointer to integer of different size
wfilepanel.c:171: warning: cast from pointer to integer of different size
wfontpanel.c:499: warning: cast to pointer from integer of different size
wfontpanel.c:500: warning: cast to pointer from integer of different size
wfontpanel.c:505: warning: cast to pointer from integer of different size
wfontpanel.c:506: warning: cast to pointer from integer of different size
wfontpanel.c:776: warning: cast from pointer to integer of different size
wfontpanel.c:777: warning: cast from pointer to integer of different size
wfontpanel.c:877: warning: cast from pointer to integer of different size
wfontpanel.c:878: warning: cast from pointer to integer of different size
wpanel.c:363: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:90: warning: cast to pointer from integer of different size
puzzle.c:138: warning: cast from pointer to integer of different size
puzzle.c:225: warning: cast to pointer from integer of different size
wtableview.c:1031: warning: cast to pointer from integer of different size
wtableview.c:1067: warning: cast to pointer from integer of different size
wtableview.c:1069: warning: cast to pointer from integer of different size
wtableview.c:1074: warning: cast to pointer from integer of different size
wtabledelegates.c:234: warning: cast from pointer to integer of different size
wtabledelegates.c:250: warning: cast from pointer to integer of different size
wtabledelegates.c:265: warning: cast from pointer to integer of different size
wtabledelegates.c:287: warning: cast to pointer from integer of different size
wtabledelegates.c:351: warning: cast from pointer to integer of different size
wtabledelegates.c:372: warning: cast from pointer to integer of different size
wtabledelegates.c:393: warning: cast from pointer to integer of different size
wtabledelegates.c:410: warning: cast to pointer from integer of different size
test.c:44: warning: cast from pointer to integer of different size
test.c:47: warning: cast to pointer from integer of different size
test.c:55: warning: cast from pointer to integer of different size
test.c:58: warning: cast from pointer to integer of different size

diff -r d9069b88dd69 -r 0d85bfb8bea4 WINGs/Examples/fontl.c
--- a/WINGs/Examples/fontl.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/WINGs/Examples/fontl.c	Thu Nov 06 01:56:29 2008 +0100
@@ -24,6 +24,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <WINGs/WINGs.h>
 #include <WINGs/WUtil.h>
 
@@ -39,7 +40,8 @@
     void *d;
     WMLabel *l = (WMLabel*)data;
     d = WMGetHangedData(self);
-    sprintf(buf, "%i -  0x%x - 0%o", (int)d, (int)d, (int)d);
+    sprintf(buf, "%i -  0x%x - 0%o", (int)(uintptr_t)d, (int)(uintptr_t)d, 
+	    (int)(uintptr_t)d);
     WMSetLabelText(l, buf);
 }
 
@@ -87,7 +89,7 @@
             sprintf(buf, "%c", c);
             WMSetButtonText(lab, buf);
             WMSetButtonAction(lab, show, pos);
-            WMHangData(lab, (void*)c);
+            WMHangData(lab, (void*)(uintptr_t)c);
             if (c>0) {
                 WMGroupButtons(l0, lab);
             } else {
diff -r d9069b88dd69 -r 0d85bfb8bea4 WINGs/Examples/puzzle.c
--- a/WINGs/Examples/puzzle.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/WINGs/Examples/puzzle.c	Thu Nov 06 01:56:29 2008 +0100
@@ -4,7 +4,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <WINGs/WINGs.h>
-
+#include <stdint.h>
 
 
 #define MAX_SIZE 	10*10
@@ -135,7 +135,7 @@
 {
     char buffer[300];
 
-    if (SlideButton((int)ptr)) {
+    if (SlideButton((int)(uintptr_t)ptr)) {
         MoveCount++;
 
         if (CheckWin()) {
@@ -222,7 +222,7 @@
             Button[i] = WMCreateButton(win, WBTMomentaryLight);
             WMSetWidgetBackgroundColor(Button[i], color);
             WMReleaseColor(color);
-            WMSetButtonAction(Button[i], buttonClick, (void*)i);
+            WMSetButtonAction(Button[i], buttonClick, (void*)(uintptr_t)i);
             WMResizeWidget(Button[i], WinSize/Size, WinSize/Size);
             WMMoveWidget(Button[i], x*(WinSize/Size), y*(WinSize/Size));
             sprintf(buf, "%i", i+1);
diff -r d9069b88dd69 -r 0d85bfb8bea4 WINGs/Extras/test.c
--- a/WINGs/Extras/test.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/WINGs/Extras/test.c	Thu Nov 06 01:56:29 2008 +0100
@@ -2,6 +2,7 @@
 
 #include <WINGs/WINGs.h>
 #include <stdio.h>
+#include <stdint.h>
 #include "wtableview.h"
 #include "wtabledelegates.h"
 
@@ -41,10 +42,10 @@
             col2[i] = 0;
         }
     }
-    if ((int)WMGetTableColumnId(column) == 1)
+    if ((int)(uintptr_t)WMGetTableColumnId(column) == 1)
         return col1[row];
     else
-        return (void*)col2[row];
+        return (void*)(uintptr_t)col2[row];
 }
 
 
@@ -52,10 +53,10 @@
 setValueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row,
                 void *data)
 {
-    if ((int)WMGetTableColumnId(column) == 1)
+    if ((int)(uintptr_t)WMGetTableColumnId(column) == 1)
         col1[row] = data;
     else
-        col2[row] = (int)data;
+        col2[row] = (int)(uintptr_t)data;
 }
 
 
diff -r d9069b88dd69 -r 0d85bfb8bea4 WINGs/Extras/wtabledelegates.c
--- a/WINGs/Extras/wtabledelegates.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/WINGs/Extras/wtabledelegates.c	Thu Nov 06 01:56:29 2008 +0100
@@ -1,5 +1,5 @@
 
-
+#include <stdint.h>
 #include <WINGs/WINGsP.h>
 
 #include "wtableview.h"
@@ -231,7 +231,7 @@
 {
     EnumSelectorData *strdata = (EnumSelectorData*)self->data;
     WMTableView *table = WMGetTableColumnTableView(column);
-    int i = (int)WMTableViewDataForCell(table, column, row);
+    int i = (int)(uintptr_t)WMTableViewDataForCell(table, column, row);
 
     stringDraw(WMWidgetScreen(table), d,
                strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
@@ -247,7 +247,7 @@
 {
     EnumSelectorData *strdata = (EnumSelectorData*)self->data;
     WMTableView *table = WMGetTableColumnTableView(column);
-    int i = (int)WMTableViewDataForCell(table, column, row);
+    int i = (int)(uintptr_t)WMTableViewDataForCell(table, column, row);
 
     stringDraw(WMWidgetScreen(table), d,
                strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
@@ -262,7 +262,7 @@
 {
     EnumSelectorData *strdata = (EnumSelectorData*)self->data;
     WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
-    int data = (int)WMTableViewDataForCell(strdata->table, column, row);
+    int data = (int)(uintptr_t)WMTableViewDataForCell(strdata->table, column, row);
 
     wassertr(data < strdata->count);
 
@@ -284,7 +284,7 @@
     WMUnmapWidget(strdata->widget);
 
     option = WMGetPopUpButtonSelectedItem(strdata->widget);
-    WMSetTableViewDataForCell(strdata->table, column, row, (void*)option);
+    WMSetTableViewDataForCell(strdata->table, column, row, (void*)(uintptr_t)option);
 }
 
 
@@ -348,7 +348,7 @@
 {
     BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
     WMTableView *table = WMGetTableColumnTableView(column);
-    int i = (int)WMTableViewDataForCell(table, column, row);
+    int i = (int)(uintptr_t)WMTableViewDataForCell(table, column, row);
     WMScreen *scr = WMWidgetScreen(table);
 
     if (i) {
@@ -369,7 +369,7 @@
 {
     BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
     WMTableView *table = WMGetTableColumnTableView(column);
-    int i = (int)WMTableViewDataForCell(table, column, row);
+    int i = (int)(uintptr_t)WMTableViewDataForCell(table, column, row);
     WMScreen *scr = WMWidgetScreen(table);
 
     if (i) {
@@ -390,7 +390,7 @@
 {
     BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
     WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
-    int data = (int)WMTableViewDataForCell(strdata->table, column, row);
+    int data = (int)(uintptr_t)WMTableViewDataForCell(strdata->table, column, row);
 
     WMSetButtonSelected(strdata->widget, data);
     WMMoveWidget(strdata->widget, rect.pos.x+1, rect.pos.y+1);
@@ -407,7 +407,7 @@
     int value;
 
     value = WMGetButtonSelected(strdata->widget);
-    WMSetTableViewDataForCell(strdata->table, column, row, (void*)value);
+    WMSetTableViewDataForCell(strdata->table, column, row, (void*)(uintptr_t)value);
     WMUnmapWidget(strdata->widget);
 }
 
diff -r d9069b88dd69 -r 0d85bfb8bea4 WINGs/Extras/wtableview.c
--- a/WINGs/Extras/wtableview.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/WINGs/Extras/wtableview.c	Thu Nov 06 01:56:29 2008 +0100
@@ -2,6 +2,7 @@
 
 #include <WINGs/WINGsP.h>
 #include <X11/cursorfont.h>
+#include <stdint.h>
 
 #include "wtableview.h"
 
@@ -1028,7 +1029,7 @@
         if (!column->delegate || !column->delegate->drawCell)
             continue;
 
-        if (WMFindInArray(table->selectedRows, NULL, (void*)row) != WANotFound)
+        if (WMFindInArray(table->selectedRows, NULL, (void*)(uintptr_t)row) != WANotFound)
             (*column->delegate->drawSelectedCell)(column->delegate, column, row, d);
         else
             (*column->delegate->drawCell)(column->delegate, column, row, d);
@@ -1064,14 +1065,14 @@
 {
     int repaint = 0;
 
-    if (WMFindInArray(table->selectedRows, NULL, (void*)row) != WANotFound) {
+    if (WMFindInArray(table->selectedRows, NULL, (void*)(uintptr_t)row) != WANotFound) {
         if (!flag) {
-            WMRemoveFromArray(table->selectedRows, (void*)row);
+            WMRemoveFromArray(table->selectedRows, (void*)(uintptr_t)row);
             repaint = 1;
         }
     } else {
         if (flag) {
-            WMAddToArray(table->selectedRows, (void*)row);
+            WMAddToArray(table->selectedRows, (void*)(uintptr_t)row);
             repaint = 1;
         }
     }
diff -r d9069b88dd69 -r 0d85bfb8bea4 WINGs/wfilepanel.c
--- a/WINGs/wfilepanel.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/WINGs/wfilepanel.c	Thu Nov 06 01:56:29 2008 +0100
@@ -8,6 +8,7 @@
 #include <dirent.h>
 #include <limits.h>
 #include <errno.h>
+#include <stdint.h>
 
 #ifndef PATH_MAX
 #define PATH_MAX 1024
@@ -132,7 +133,7 @@
         return;
 
     text = WMGetTextFieldText(panel->fileField);
-    textEvent = (int)WMGetNotificationClientData(notification);
+    textEvent = (int)(uintptr_t)WMGetNotificationClientData(notification);
 
     if (panel->flags.autoCompletion && textEvent!=WMDeleteTextEvent)
         i = closestListItem(list, text, False);
@@ -168,7 +169,7 @@
 {
     W_FilePanel *panel = (W_FilePanel*)observerData;
 
-    if ((int)WMGetNotificationClientData(notification)==WMReturnTextMovement) {
+    if ((int)(uintptr_t)WMGetNotificationClientData(notification)==WMReturnTextMovement) {
         WMPerformButtonClick(panel->okButton);
     }
 }
diff -r d9069b88dd69 -r 0d85bfb8bea4 WINGs/wfontpanel.c
--- a/WINGs/wfontpanel.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/WINGs/wfontpanel.c	Thu Nov 06 01:56:29 2008 +0100
@@ -8,6 +8,7 @@
 
 #include <ctype.h>
 #include <string.h>
+#include <stdint.h>
 
 #include <X11/Xft/Xft.h>
 #include <fontconfig/fontconfig.h>
@@ -496,14 +497,14 @@
         for (j = 0; j < sizeof(scalableFontSizes)/sizeof(int); j++) {
             size = scalableFontSizes[j];
 
-            if (!WMCountInArray(face->sizes, (void*)size)) {
-                WMAddToArray(face->sizes, (void*)size);
+            if (!WMCountInArray(face->sizes, (void*)(uintptr_t)size)) {
+                WMAddToArray(face->sizes, (void*)(uintptr_t)size);
             }
         }
         WMSortArray(face->sizes, compare_int);
     } else {
-        if (!WMCountInArray(face->sizes, (void*)size)) {
-            WMAddToArray(face->sizes, (void*)size);
+        if (!WMCountInArray(face->sizes, (void*)(uintptr_t)size)) {
+            WMAddToArray(face->sizes, (void*)(uintptr_t)size);
             WMSortArray(face->sizes, compare_int);
         }
     }
@@ -773,8 +774,8 @@
     WMClearList(panel->sizLs);
 
     WM_ITERATE_ARRAY(face->sizes, size, i) {
-        if ((int)size != 0) {
-            sprintf(buffer, "%i", (int)size);
+        if ((int)(uintptr_t)size != 0) {
+            sprintf(buffer, "%i", (int)(uintptr_t)size);
 
             WMAddListItem(panel->sizLs, buffer);
         }
@@ -874,8 +875,8 @@
 
     WM_ITERATE_ARRAY(face->sizes, vsize, i) {
         char buffer[32];
-        if ((int)vsize != 0) {
-            sprintf(buffer, "%i", (int)vsize);
+        if ((int)(uintptr_t)vsize != 0) {
+            sprintf(buffer, "%i", (int)(uintptr_t)vsize);
 
             WMAddListItem(panel->sizLs, buffer);
         }
diff -r d9069b88dd69 -r 0d85bfb8bea4 WINGs/wpanel.c
--- a/WINGs/wpanel.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/WINGs/wpanel.c	Thu Nov 06 01:56:29 2008 +0100
@@ -3,6 +3,7 @@
 #include "WINGsP.h"
 
 #include <X11/keysym.h>
+#include <stdint.h>
 
 
 
@@ -360,7 +361,7 @@
 {
     WMInputPanel *panel = (WMInputPanel*)observerData;
 
-    switch ((int)WMGetNotificationClientData(notification)) {
+    switch ((int)(uintptr_t)WMGetNotificationClientData(notification)) {
     case WMReturnTextMovement:
         if (panel->defBtn)
             WMPerformButtonClick(panel->defBtn);
diff -r d9069b88dd69 -r 0d85bfb8bea4 WPrefs.app/editmenu.c
--- a/WPrefs.app/editmenu.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/WPrefs.app/editmenu.c	Thu Nov 06 01:56:29 2008 +0100
@@ -24,6 +24,7 @@
 #include <WINGs/WINGsP.h>
 #include <WINGs/WUtil.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <assert.h>
 #include <ctype.h>
 
@@ -969,7 +970,7 @@
     if (!menu->flags.isEditing)
         return;
 
-    reason = (int)WMGetNotificationClientData(notif);
+    reason = (int)(uintptr_t)WMGetNotificationClientData(notif);
 
     switch (reason) {
     case WMEscapeTextMovement:
diff -r d9069b88dd69 -r 0d85bfb8bea4 src/defaults.c
--- a/src/defaults.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/src/defaults.c	Thu Nov 06 01:56:29 2008 +0100
@@ -24,6 +24,7 @@
 #include "wconfig.h"
 
 #include <stdio.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
@@ -1445,7 +1446,7 @@
             foo |= WColorSettings;
         if (foo)
             WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged, NULL,
-                                   (void*)foo);
+                                   (void*)(uintptr_t)foo);
 
         foo = 0;
         if (needs_refresh & REFRESH_MENU_TEXTURE)
@@ -1456,7 +1457,7 @@
             foo |= WColorSettings;
         if (foo)
             WMPostNotificationName(WNMenuAppearanceSettingsChanged, NULL,
-                                   (void*)foo);
+                                   (void*)(uintptr_t)foo);
 
         foo = 0;
         if (needs_refresh & REFRESH_WINDOW_FONT) {
@@ -1470,7 +1471,7 @@
         }
         if (foo)
             WMPostNotificationName(WNWindowAppearanceSettingsChanged, NULL,
-                                   (void*)foo);
+                                   (void*)(uintptr_t)foo);
 
         if (!(needs_refresh & REFRESH_ICON_TILE)) {
             foo = 0;
@@ -1485,7 +1486,7 @@
             }
             if (foo)
                 WMPostNotificationName(WNIconAppearanceSettingsChanged, NULL,
-                                       (void*)foo);
+                                       (void*)(uintptr_t)foo);
         }
         if (needs_refresh & REFRESH_ICON_TILE)
             WMPostNotificationName(WNIconTileSettingsChanged, NULL,  NULL);
diff -r d9069b88dd69 -r 0d85bfb8bea4 src/icon.c
--- a/src/icon.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/src/icon.c	Thu Nov 06 01:56:29 2008 +0100
@@ -26,6 +26,7 @@
 #include <X11/Xutil.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <string.h>
 #include <unistd.h>
 #include <ctype.h>
@@ -64,7 +65,7 @@
 appearanceObserver(void *self, WMNotification *notif)
 {
     WIcon *icon = (WIcon*)self;
-    int flags = (int)WMGetNotificationClientData(notif);
+    int flags = (int)(uintptr_t)WMGetNotificationClientData(notif);
 
     if (flags & WTextureSettings) {
         icon->force_paint = 1;
diff -r d9069b88dd69 -r 0d85bfb8bea4 src/menu.c
--- a/src/menu.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/src/menu.c	Thu Nov 06 01:56:29 2008 +0100
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <unistd.h>
 #include <ctype.h>
 #if 0
@@ -109,7 +110,7 @@
 appearanceObserver(void *self, WMNotification *notif)
 {
     WMenu *menu = (WMenu*)self;
-    int flags = (int)WMGetNotificationClientData(notif);
+    int flags = (int)(uintptr_t)WMGetNotificationClientData(notif);
 
     if (!menu->flags.realized)
         return;
diff -r d9069b88dd69 -r 0d85bfb8bea4 src/switchmenu.c
--- a/src/switchmenu.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/src/switchmenu.c	Thu Nov 06 01:56:29 2008 +0100
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdint.h>
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
@@ -449,7 +450,7 @@
     void *data = WMGetNotificationClientData(notif);
 
     if (strcmp(name, WMNWorkspaceNameChanged) == 0) {
-        UpdateSwitchMenuWorkspace(scr, (int)data);
+        UpdateSwitchMenuWorkspace(scr, (int)(uintptr_t)data);
     } else if (strcmp(name, WMNWorkspaceChanged) == 0) {
 
     }
diff -r d9069b88dd69 -r 0d85bfb8bea4 src/window.c
--- a/src/window.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/src/window.c	Thu Nov 06 01:56:29 2008 +0100
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <stdint.h>
 
 /* For getting mouse wheel mappings from WINGs */
 #include <WINGs/WINGsP.h>
@@ -137,7 +138,7 @@
 appearanceObserver(void *self, WMNotification *notif)
 {
     WWindow *wwin = (WWindow*)self;
-    int flags = (int)WMGetNotificationClientData(notif);
+    int flags = (int)(uintptr_t)WMGetNotificationClientData(notif);
 
     if (!wwin->frame || (!wwin->frame->titlebar && !wwin->frame->resizebar))
         return;
@@ -2214,7 +2215,7 @@
 
         wwin->frame->workspace = workspace;
 
-        WMPostNotificationName(WMNChangedWorkspace, wwin, (void*)oldWorkspace);
+        WMPostNotificationName(WMNChangedWorkspace, wwin, (void*)(uintptr_t)oldWorkspace);
     }
 
     if (unmap) {
diff -r d9069b88dd69 -r 0d85bfb8bea4 src/workspace.c
--- a/src/workspace.c	Sat Nov 01 08:02:03 2008 +0100
+++ b/src/workspace.c	Thu Nov 06 01:56:29 2008 +0100
@@ -29,6 +29,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <unistd.h>
 #include <ctype.h>
 #include <string.h>
@@ -132,7 +133,7 @@
 #endif
 
         WMPostNotificationName(WMNWorkspaceCreated, scr,
-                               (void*)(scr->workspace_count-1));
+                               (void*)(uintptr_t)(scr->workspace_count-1));
         XFlush(dpy);
 
         return scr->workspace_count-1;
@@ -211,7 +212,7 @@
 #endif
 
     WMPostNotificationName(WMNWorkspaceDestroyed, scr,
-                           (void*)(scr->workspace_count-1));
+                           (void*)(uintptr_t)(scr->workspace_count-1));
 
     if (scr->current_workspace >= scr->workspace_count)
         wWorkspaceChange(scr, scr->workspace_count-1);
@@ -631,7 +632,7 @@
 
     showWorkspaceName(scr, workspace);
 
-    WMPostNotificationName(WMNWorkspaceChanged, scr, (void*)workspace);
+    WMPostNotificationName(WMNWorkspaceChanged, scr, (void*)(uintptr_t)workspace);
 
     /*   XSync(dpy, False); */
 }
@@ -1327,7 +1328,7 @@
     if (scr->clip_icon)
         wClipIconPaint(scr->clip_icon);
 
-    WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void*)workspace);
+    WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void*)(uintptr_t)workspace);
 }
 
 
@@ -1511,7 +1512,7 @@
             }
         }
 
-        WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void*)i);
+        WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void*)(uintptr_t)i);
     }
 }
 


-- 
To unsubscribe, send mail to wmaker-dev-unsubscribe@lists.windowmaker.info.