"cast from pointer to integer of different size" warnings

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

3 posts / 0 new
Last post
"cast from pointer to integer of different size" warnings

Submitted by jhowarth on Sat, 08/29/2009 - 18:54.

I noticed while building the openmotif4-2.3.2 package for x86_64 fink that there are a large number of warnings of the form....

cast from pointer to integer of different size

when compiling on x86_64-apple-darwn9/10. My understanding is that these are very serious warnings since it could result in pointers being corrupted. I've patched off of the warnings on x86_64 darwin with the changes below...

--- openmotif-2.3.2/lib/Xm/DragBS.c.org 2009-08-29 10:27:40.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/DragBS.c 2009-08-29 10:31:34.000000000 -0400
@@ -217,9 +217,9 @@
static unsigned long firstProtectRequest;
static Window errorWindow;

-static XContext displayToMotifWindowContext = (XContext) NULL;
-static XContext displayToTargetsContext = (XContext) NULL;
-static XContext displayToAtomsContext = (XContext) NULL;
+static XContext displayToMotifWindowContext = (XContext)(uintptr_t) NULL;
+static XContext displayToTargetsContext = (XContext)(uintptr_t) NULL;
+static XContext displayToAtomsContext = (XContext)(uintptr_t) NULL;

/*****************************************************************************
@@ -304,7 +304,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToMotifWindowContext == (XContext) NULL) {
+ if (displayToMotifWindowContext == (XContext)(uintptr_t) NULL) {
displayToMotifWindowContext = XUniqueContext();
}
loc_context = displayToMotifWindowContext;
@@ -335,7 +335,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToMotifWindowContext == (XContext) NULL) {
+ if (displayToMotifWindowContext == (XContext)(uintptr_t) NULL) {
displayToMotifWindowContext = XUniqueContext();
}
loc_context = displayToMotifWindowContext;
@@ -378,7 +378,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToTargetsContext == (XContext) NULL) {
+ if (displayToTargetsContext == (XContext)(uintptr_t) NULL) {
displayToTargetsContext = XUniqueContext();
}
loc_context = displayToTargetsContext;
@@ -409,7 +409,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToTargetsContext == (XContext) NULL) {
+ if (displayToTargetsContext == (XContext)(uintptr_t) NULL) {
displayToTargetsContext = XUniqueContext();
}
loc_context = displayToTargetsContext;
@@ -464,7 +464,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToAtomsContext == (XContext) NULL) {
+ if (displayToAtomsContext == (XContext)(uintptr_t) NULL) {
displayToAtomsContext = XUniqueContext();
}
loc_context = displayToAtomsContext;
@@ -495,7 +495,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToAtomsContext == (XContext) NULL) {
+ if (displayToAtomsContext == (XContext)(uintptr_t) NULL) {
displayToAtomsContext = XUniqueContext();
}
loc_context = displayToAtomsContext;
--- openmotif-2.3.2/lib/Xm/DragIcon.c.org 2009-08-29 10:39:24.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/DragIcon.c 2009-08-29 10:40:12.000000000 -0400
@@ -760,7 +760,7 @@
#undef Offset
#define Offset(x) (XtOffsetOf( struct _XmDragIconRec, drag.x))

-static XContext _XmTextualDragIconContext = (XContext) NULL;
+static XContext _XmTextualDragIconContext = (XContext)(uintptr_t) NULL;

static XtResource resources[]=
{
@@ -1240,7 +1240,7 @@
use_alt = dpy -> display.enable_drag_icon;

_XmProcessLock();
- if (_XmTextualDragIconContext == (XContext) NULL)
+ if (_XmTextualDragIconContext == (XContext)(uintptr_t) NULL)
_XmTextualDragIconContext = XUniqueContext();
loc_context = _XmTextualDragIconContext;
_XmProcessUnlock();
--- openmotif-2.3.2/lib/Xm/Text.c.org 2009-08-29 10:42:10.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/Text.c 2009-08-29 10:43:15.000000000 -0400
@@ -654,14 +654,14 @@
static void
_XmCreateCutBuffers(Widget w)
{
- static XContext context = (XContext)NULL;
+ static XContext context = (XContext)(uintptr_t)NULL;
char * tmp = NULL;
Display *dpy = XtDisplay(w);
Screen *screen = XtScreen(w);
XContext local_context;

_XmProcessLock();
- if (context == (XContext)NULL) context = XUniqueContext();
+ if (context == (XContext)(uintptr_t)NULL) context = XUniqueContext();

local_context = context;
_XmProcessUnlock();
@@ -3023,7 +3023,7 @@
if (!tw->text.editable && editable) {
OutputData o_data = tw->text.output->data;

- XmImRegister(widget, (unsigned int) NULL);
+ XmImRegister(widget, (unsigned int)(uintptr_t) NULL);

(*tw->text.output->PosToXY)(tw, tw->text.cursor_position,
&xmim_point.x, &xmim_point.y);
--- openmotif-2.3.2/lib/Xm/TextF.c.org 2009-08-29 10:46:06.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/TextF.c 2009-08-29 10:47:10.000000000 -0400
@@ -7306,7 +7306,7 @@
XmTextFieldSetEditable((Widget)tf, TextF_Editable(tf));

if (TextF_Editable(tf)) {
- XmImRegister((Widget)tf, (unsigned int) NULL);
+ XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);
GetXYFromPos(tf, TextF_CursorPosition(tf), &xmim_point.x, &xmim_point.y);
(void)TextFieldGetDisplayRect((Widget)tf, &xmim_area);
n = 0;
@@ -8178,7 +8178,7 @@
diff_values = True;
if (TextF_WcValue(new_tf) == NULL) {
TextF_WcValue(new_tf) = (wchar_t*) XtMalloc(sizeof(wchar_t));
- *TextF_WcValue(new_tf) = (wchar_t)NULL;
+ *TextF_WcValue(new_tf) = (wchar_t)(uintptr_t)NULL;
}
ValidateString(new_tf, (char*)TextF_WcValue(new_tf), True);
} else if (TextF_Value(new_tf) != TextF_Value(old_tf)) {
@@ -10091,7 +10091,7 @@
* give the IM the relevent values. */

if (!TextF_Editable(tf) && editable) {
- XmImRegister((Widget)tf, (unsigned int) NULL);
+ XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);

GetXYFromPos(tf, TextF_CursorPosition(tf), &xmim_point.x,
&xmim_point.y);
--- openmotif-2.3.2/lib/Xm/Protocols.c.org 2009-08-29 10:48:46.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/Protocols.c 2009-08-29 10:49:20.000000000 -0400
@@ -136,7 +136,7 @@
*
***************************************************************************/

-static XContext allProtocolsMgrContext = (XContext) NULL;
+static XContext allProtocolsMgrContext = (XContext)(uintptr_t) NULL;

#define Offset(field) XtOffsetOf( struct _XmProtocolRec, protocol.field)
@@ -374,7 +374,7 @@
display = XtDisplay(shell);

_XmProcessLock();
- if (allProtocolsMgrContext == (XContext) NULL)
+ if (allProtocolsMgrContext == (XContext)(uintptr_t) NULL)
allProtocolsMgrContext = XUniqueContext();
_XmProcessUnlock();

--- openmotif-2.3.2/lib/Xm/VendorS.c.org 2009-08-29 10:50:33.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/VendorS.c 2009-08-29 10:51:00.000000000 -0400
@@ -1576,8 +1576,8 @@
ttp->post_delay = 5000;
ttp->post_duration = 5000;
ttp->enable = False;
- ttp->timer = (int) NULL;
- ttp->duration_timer = (int) NULL;
+ ttp->timer = (int)(uintptr_t) NULL;
+ ttp->duration_timer = (int)(uintptr_t) NULL;
ttp->leave_time = 0;
ttp->slider = ttp->label = NULL;

--- openmotif-2.3.2/lib/Xm/Synthetic.c.org 2009-08-29 10:52:02.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/Synthetic.c 2009-08-29 10:54:51.000000000 -0400
@@ -197,7 +197,7 @@

for (i = 0; i < num_resources; i++)
resources[i].resource_name =
- (String) XrmPermStringToQuark (resources[i].resource_name);
+ (String)(uintptr_t) XrmPermStringToQuark (resources[i].resource_name);
}
^L
/**********************************************************************
@@ -241,7 +241,7 @@
for (j = 0; j < num_resources; j++)
{
if ((resources[j].export_proc) &&
- (XrmQuark)(resources[j].resource_name) == quark)
+ (XrmQuark)(uintptr_t)(resources[j].resource_name) == quark)
{
value_size = resources[j].resource_size;

@@ -512,7 +512,7 @@
for (j = 0; j < num_resources; j++)
{
if ((resources[j].import_proc) &&
- (XrmQuark)(resources[j].resource_name) == quark)
+ (XrmQuark)(uintptr_t)(resources[j].resource_name) == quark)
{
value = args[i].value;

--- openmotif-2.3.2/lib/Xm/Obso2_0.c.org 2009-08-29 10:56:29.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/Obso2_0.c 2009-08-29 10:57:39.000000000 -0400
@@ -1584,7 +1584,7 @@
Stuff from Desktop.c
**********************/

-static XContext actualClassContext = (XContext) NULL;
+static XContext actualClassContext = (XContext)(uintptr_t) NULL;

/*ARGSUSED*/
@@ -1611,7 +1611,7 @@
{
WidgetClass actualClass;

- if (actualClassContext == (XContext) NULL)
+ if (actualClassContext == (XContext)(uintptr_t) NULL)
actualClassContext = XUniqueContext();

/*
@@ -1645,7 +1645,7 @@
WidgetClass previous;
WidgetClass oldActualClass;

- if (actualClassContext == (XContext) NULL)
+ if (actualClassContext == (XContext)(uintptr_t) NULL)
actualClassContext = XUniqueContext();

/*
@@ -1692,7 +1692,7 @@
Cardinal *num_args )
{
XmDesktopObject worldObject;
- static XContext worldObjectContext = (XContext) NULL;
+ static XContext worldObjectContext = (XContext)(uintptr_t) NULL;
XmWidgetExtData ext;
Display *display;

@@ -1701,7 +1701,7 @@
** the display is closed, so that we don't get bad data if a second
** display with the same id is opened.
*/
- if (worldObjectContext == (XContext) NULL)
+ if (worldObjectContext == (XContext)(uintptr_t) NULL)
worldObjectContext = XUniqueContext();

display = XtDisplayOfObject(shell);
--- openmotif-2.3.2/lib/Xm/Xpmparse.c.org 2009-08-29 10:58:47.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/Xpmparse.c 2009-08-29 11:28:56.000000000 -0400
@@ -387,7 +387,7 @@
*/
if (USE_HASHTABLE) {
ErrorStatus =
- xpmHashIntern(hashtable, color->string, HashAtomData(a));
+ xpmHashIntern(hashtable, color->string, HashAtomData((uintptr_t)a));
if (ErrorStatus != XpmSuccess) {
xpmFreeColorTable(colorTable, ncolors);
return (ErrorStatus);
@@ -475,7 +475,7 @@
*/
if (USE_HASHTABLE) {
ErrorStatus =
- xpmHashIntern(hashtable, color->string, HashAtomData(a));
+ xpmHashIntern(hashtable, color->string, HashAtomData((uintptr_t)a));
if (ErrorStatus != XpmSuccess) {
xpmFreeColorTable(colorTable, ncolors);
return (ErrorStatus);
--- openmotif-2.3.2/lib/Xm/SlideC.c.org 2009-08-29 11:52:10.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/SlideC.c 2009-08-29 11:52:48.000000000 -0400
@@ -94,14 +94,14 @@
/* notify that initialize called XtArgsProc */ NULL,
/* NULL XtProc */ NULL,
/* NULL XtPointer */ NULL,
-/* NULL Cardinal */ (Cardinal)NULL,
+/* NULL Cardinal */ (Cardinal)(uintptr_t)NULL,
/* resources for subclass fields XtResourceList */ resources,
/* number of entries in resources Cardinal */ XtNumber(resources),
/* resource class quarkified XrmClass */ NULLQUARK,
-/* NULL Boolean */ (Boolean)NULL,
-/* NULL XtEnum */ (XtEnum)NULL,
-/* NULL Boolean */ (Boolean)NULL,
-/* NULL Boolean */ (Boolean)NULL,
+/* NULL Boolean */ (Boolean)(uintptr_t)NULL,
+/* NULL XtEnum */ (XtEnum)(uintptr_t)NULL,
+/* NULL Boolean */ (Boolean)(uintptr_t)NULL,
+/* NULL Boolean */ (Boolean)(uintptr_t)NULL,
/* free data for subclass pointers XtWidgetProc */ destroy,
/* NULL XtProc */ NULL,
/* NULL XtProc */ NULL,
--- openmotif-2.3.2/lib/Xm/DataF.c.org 2009-08-29 11:54:23.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/DataF.c 2009-08-29 11:57:32.000000000 -0400
@@ -9121,7 +9121,7 @@
/* CR03685 */
SGI_hack_XmImRegister((Widget)tf);
#else
- XmImRegister((Widget)tf, (unsigned int) NULL);
+ XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);
#endif
df_GetXYFromPos(tf, XmTextF_cursor_position(tf), &xmim_point.x, &xmim_point.y);
n = 0;
@@ -10631,7 +10631,7 @@
diff_values = True;
if (XmTextF_wc_value(new_tf) == NULL) {
XmTextF_wc_value(new_tf) = (wchar_t*) XtMalloc(sizeof(wchar_t));
- *XmTextF_wc_value(new_tf) = (wchar_t)NULL;
+ *XmTextF_wc_value(new_tf) = (wchar_t)(uintptr_t)NULL;
}
df_ValidateString(new_tf, (char*)XmTextF_wc_value(new_tf), True);
} else if (XmTextF_value(new_tf) != XmTextF_value(old_tf)) {
@@ -11777,7 +11777,7 @@
/* CR03685 */
SGI_hack_XmImRegister((Widget)tf);
#else
- XmImRegister((Widget)tf, (unsigned int) NULL);
+ XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);
#endif
df_GetXYFromPos(tf, XmTextF_cursor_position(tf), &xmim_point.x,
&xmim_point.y);
--- openmotif-2.3.2/lib/Xm/FontS.c.org 2009-08-29 11:59:14.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/FontS.c 2009-08-29 12:04:10.000000000 -0400
@@ -2748,7 +2748,7 @@
XmStringFree(label);

XtAddCallback(button,
- XmNactivateCallback, ChangeEncoding, (XtPointer) i);
+ XmNactivateCallback, ChangeEncoding, (XtPointer)(uintptr_t) i);

if (streq(*encodings, ENCODING_STRING(fsw)))
{
@@ -2910,7 +2910,7 @@
fsw = (XmFontSelectorWidget) w;
cf = XmFontS_font_info(fsw)->current_font;

- if ((int) data == 0)
+ if ((int)(uintptr_t) data == 0)
{
XtFree(ENCODING_STRING(fsw));
ENCODING_STRING(fsw) = XtNewString(ANY_ENCODING);
@@ -2918,7 +2918,7 @@
else
{
XtFree(ENCODING_STRING(fsw));
- ENCODING_STRING(fsw) = XtNewString(ENCODING_LIST(fsw)[(int) data - 1]);
+ ENCODING_STRING(fsw) = XtNewString(ENCODING_LIST(fsw)[(int)(uintptr_t) data - 1]);
}

UpdateFamilies(fsw);
@@ -3676,7 +3676,7 @@
num_largs = 0;
XtSetArg(largs[num_largs], XmNmenuHistory, button); num_largs++;
XtSetValues(XmFontS_option_menu(set_fsw), largs, num_largs);
- ChangeEncoding((Widget) set_fsw, (XtPointer) current, NULL);
+ ChangeEncoding((Widget) set_fsw, (XtPointer)(uintptr_t) current, NULL);
}
else
{
--- openmotif-2.3.2/clients/mwm/WmResParse.c.org 2009-08-29 12:07:12.000000000 -0400
+++ openmotif-2.3.2/clients/mwm/WmResParse.c 2009-08-29 12:10:22.000000000 -0400
@@ -188,7 +188,7 @@
{"mod3", Mod3Mask},
{"mod4", Mod4Mask},
{"mod5", Mod5Mask},
- {NULL, (unsigned int)NULL},
+ {NULL, (unsigned int)(uintptr_t)NULL},
};

#define ALT_INDEX 3
@@ -351,14 +351,14 @@
{"btn5up", ButtonRelease, ParseImmed, Button5, FALSE},
{"btn5click", ButtonRelease, ParseImmed, Button5, TRUE},
{"btn5click2", ButtonPress, ParseImmed, Button5, TRUE},
- { NULL, (unsigned int)NULL, (Boolean(*)())NULL, (unsigned int)NULL, (Boolean)NULL}
+ { NULL, (unsigned int)(uintptr_t)NULL, (Boolean(*)())NULL, (unsigned int)(uintptr_t)NULL, (Boolean)(uintptr_t)NULL}
};

static EventTableEntry keyEvents[] = {

{"key", KeyPress, ParseKeySym, 0, FALSE},
- { NULL, (unsigned int)NULL, (Boolean(*)())NULL, (unsigned int)NULL, (Boolean)NULL}
+ { NULL, (unsigned int)(uintptr_t)NULL, (Boolean(*)())NULL, (unsigned int)(uintptr_t)NULL, (Boolean)(uintptr_t)NULL}
};

#ifdef PANELIST
--- openmotif-2.3.2/lib/Xm/IconG.c.org 2009-08-29 12:26:45.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/IconG.c 2009-08-29 12:27:15.000000000 -0400
@@ -279,8 +279,8 @@

/* those are created in ClassInitialize and filled by the
IconConverter. */
-static XContext largeIconContext = (XContext) NULL;
-static XContext smallIconContext = (XContext) NULL;
+static XContext largeIconContext = (XContext)(uintptr_t) NULL;
+static XContext smallIconContext = (XContext)(uintptr_t) NULL;

static XPointer dummy;
#define OwnLargeMask(widget) \
--- openmotif-2.3.2/clients/mwm/WmMenu.c.org 2009-08-29 12:45:19.000000000 -0400
+++ openmotif-2.3.2/clients/mwm/WmMenu.c 2009-08-29 12:47:09.000000000 -0400
@@ -861,8 +861,8 @@
static MenuItem *MakeClientCommandMenuItem (String label, String funcArgs)
{
return(MakeMenuItem(label, F_InvokeCommand, funcArgs,
- (KeySym) NULL, (unsigned int)0,
- (KeyCode) NULL, (String)NULL));
+ (KeySym)(uintptr_t) NULL, (unsigned int)0,
+ (KeyCode)(uintptr_t) NULL, (String)(uintptr_t)NULL));
}

^L
@@ -2216,7 +2216,7 @@
if (newMenuSpec == (MenuSpec *) NULL)
{
newMenuSpec = MakeMenuSpec(funcarg_buf,
- tree == NULL ? (CARD32)NULL
+ tree == NULL ? (CARD32)(uintptr_t)NULL
: tree->commandID);
if (duplicate_globals) newMenuSpec->clientLocal = TRUE;
else newMenuSpec->clientLocal = FALSE;
--- openmotif-2.3.2/lib/Xm/XpmI.h.org 2009-08-29 13:19:19.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/XpmI.h 2009-08-29 13:20:13.000000000 -0400
@@ -291,7 +291,7 @@
FUNC(xpmHashIntern, int, (xpmHashTable *table, char *tag, void *data));

#define HashAtomData(i) ((void *)i)
-#define HashColorIndex(slot) ((unsigned int)((*slot)->data))
+#define HashColorIndex(slot) ((unsigned int)(uintptr_t)((*slot)->data))
#define USE_HASHTABLE (cpp > 2 && ncolors > 4)

/* I/O utility */
--- openmotif-2.3.2/lib/Xm/BaseClass.c.org 2009-08-29 13:31:43.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/BaseClass.c 2009-08-29 13:32:05.000000000 -0400
@@ -577,7 +577,7 @@
static ExtToContextRec extToContextMap[16];
Cardinal i;
ExtToContext curr;
- XContext context = (XContext) NULL;
+ XContext context = (XContext)(uintptr_t) NULL;

_XmProcessLock();
for (i = 0, curr = &extToContextMap[0];
--- openmotif-2.3.2/lib/Xm/XmIm.c.org 2009-08-29 13:33:41.000000000 -0400
+++ openmotif-2.3.2/lib/Xm/XmIm.c 2009-08-29 13:33:59.000000000 -0400
@@ -2499,7 +2499,7 @@
(void) add_ref(&xic_info->widget_refs, widget);

/* Set the current XIC for this widget. */
- if (xim_info->current_xics == (XContext) NULL)
+ if (xim_info->current_xics == (XContext)(uintptr_t) NULL)
xim_info->current_xics = XUniqueContext();
(void) XSaveContext(XtDisplay(widget), (XID) widget,
xim_info->current_xics, (XPointer) xic_info);

Sat, 08/29/2009 - 20:37#1

Sat, 08/29/2009 - 20:37#1

jhowarth

Same fix for openmotif-2.2.4

Same fix for openmotif-2.2.4 is...

--- openmotif-2.2.4/lib/Xm/DragBS.c.org 2009-08-29 15:30:40.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/DragBS.c 2009-08-29 15:32:53.000000000 -0400
@@ -217,9 +217,9 @@
static unsigned long firstProtectRequest;
static Window errorWindow;

-static XContext displayToMotifWindowContext = (XContext) NULL;
-static XContext displayToTargetsContext = (XContext) NULL;
-static XContext displayToAtomsContext = (XContext) NULL;
+static XContext displayToMotifWindowContext = (XContext)(uintptr_t) NULL;
+static XContext displayToTargetsContext = (XContext)(uintptr_t) NULL;
+static XContext displayToAtomsContext = (XContext)(uintptr_t) NULL;

/*****************************************************************************
@@ -304,7 +304,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToMotifWindowContext == (XContext) NULL) {
+ if (displayToMotifWindowContext == (XContext)(uintptr_t) NULL) {
displayToMotifWindowContext = XUniqueContext();
}
loc_context = displayToMotifWindowContext;
@@ -335,7 +335,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToMotifWindowContext == (XContext) NULL) {
+ if (displayToMotifWindowContext == (XContext)(uintptr_t) NULL) {
displayToMotifWindowContext = XUniqueContext();
}
loc_context = displayToMotifWindowContext;
@@ -378,7 +378,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToTargetsContext == (XContext) NULL) {
+ if (displayToTargetsContext == (XContext)(uintptr_t) NULL) {
displayToTargetsContext = XUniqueContext();
}
loc_context = displayToTargetsContext;
@@ -409,7 +409,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToTargetsContext == (XContext) NULL) {
+ if (displayToTargetsContext == (XContext)(uintptr_t) NULL) {
displayToTargetsContext = XUniqueContext();
}
loc_context = displayToTargetsContext;
@@ -464,7 +464,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToAtomsContext == (XContext) NULL) {
+ if (displayToAtomsContext == (XContext)(uintptr_t) NULL) {
displayToAtomsContext = XUniqueContext();
}
loc_context = displayToAtomsContext;
@@ -495,7 +495,7 @@
XContext loc_context;

_XmProcessLock();
- if (displayToAtomsContext == (XContext) NULL) {
+ if (displayToAtomsContext == (XContext)(uintptr_t) NULL) {
displayToAtomsContext = XUniqueContext();
}
loc_context = displayToAtomsContext;
--- openmotif-2.2.4/lib/Xm/DragIcon.c.org 2009-08-29 15:34:29.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/DragIcon.c 2009-08-29 15:35:37.000000000 -0400
@@ -760,7 +760,7 @@
#undef Offset
#define Offset(x) (XtOffsetOf( struct _XmDragIconRec, drag.x))

-static XContext _XmTextualDragIconContext = (XContext) NULL;
+static XContext _XmTextualDragIconContext = (XContext)(uintptr_t) NULL;

static XtResource resources[]=
{
@@ -1240,7 +1240,7 @@
use_alt = dpy -> display.enable_drag_icon;

_XmProcessLock();
- if (_XmTextualDragIconContext == (XContext) NULL)
+ if (_XmTextualDragIconContext == (XContext)(uintptr_t) NULL)
_XmTextualDragIconContext = XUniqueContext();
loc_context = _XmTextualDragIconContext;
_XmProcessUnlock();
--- openmotif-2.2.4/lib/Xm/Text.c.org 2009-08-29 15:37:21.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/Text.c 2009-08-29 15:38:30.000000000 -0400
@@ -652,14 +652,14 @@
static void
_XmCreateCutBuffers(Widget w)
{
- static XContext context = (XContext)NULL;
+ static XContext context = (XContext)(uintptr_t)NULL;
char * tmp = NULL;
Display *dpy = XtDisplay(w);
Screen *screen = XtScreen(w);
XContext local_context;

_XmProcessLock();
- if (context == (XContext)NULL) context = XUniqueContext();
+ if (context == (XContext)(uintptr_t)NULL) context = XUniqueContext();

local_context = context;
_XmProcessUnlock();
@@ -2992,7 +2992,7 @@
if (!tw->text.editable && editable) {
OutputData o_data = tw->text.output->data;

- XmImRegister(widget, (unsigned int) NULL);
+ XmImRegister(widget, (unsigned int)(uintptr_t) NULL);

(*tw->text.output->PosToXY)(tw, tw->text.cursor_position,
&xmim_point.x, &xmim_point.y);
--- openmotif-2.2.4/lib/Xm/TextF.c.org 2009-08-29 15:40:01.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/TextF.c 2009-08-29 15:41:50.000000000 -0400
@@ -7168,7 +7168,7 @@
XmTextFieldSetEditable((Widget)tf, TextF_Editable(tf));

if (TextF_Editable(tf)) {
- XmImRegister((Widget)tf, (unsigned int) NULL);
+ XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);
GetXYFromPos(tf, TextF_CursorPosition(tf), &xmim_point.x, &xmim_point.y);
(void)TextFieldGetDisplayRect((Widget)tf, &xmim_area);
n = 0;
@@ -8034,7 +8034,7 @@
diff_values = True;
if (TextF_WcValue(new_tf) == NULL) {
TextF_WcValue(new_tf) = (wchar_t*) XtMalloc(sizeof(wchar_t));
- *TextF_WcValue(new_tf) = (wchar_t)NULL;
+ *TextF_WcValue(new_tf) = (wchar_t)(uintptr_t)NULL;
}
ValidateString(new_tf, (char*)TextF_WcValue(new_tf), True);
} else if (TextF_Value(new_tf) != TextF_Value(old_tf)) {
@@ -9906,7 +9906,7 @@
* give the IM the relevent values. */

if (!TextF_Editable(tf) && editable) {
- XmImRegister((Widget)tf, (unsigned int) NULL);
+ XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);

GetXYFromPos(tf, TextF_CursorPosition(tf), &xmim_point.x,
&xmim_point.y);
--- openmotif-2.2.4/lib/Xm/Protocols.c.org 2009-08-29 15:43:09.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/Protocols.c 2009-08-29 15:43:59.000000000 -0400
@@ -136,7 +136,7 @@
*
***************************************************************************/

-static XContext allProtocolsMgrContext = (XContext) NULL;
+static XContext allProtocolsMgrContext = (XContext)(uintptr_t) NULL;

#define Offset(field) XtOffsetOf( struct _XmProtocolRec, protocol.field)
@@ -374,7 +374,7 @@
display = XtDisplay(shell);

_XmProcessLock();
- if (allProtocolsMgrContext == (XContext) NULL)
+ if (allProtocolsMgrContext == (XContext)(uintptr_t) NULL)
allProtocolsMgrContext = XUniqueContext();
_XmProcessUnlock();

--- openmotif-2.2.4/lib/Xm/Synthetic.c.org 2009-08-29 15:45:30.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/Synthetic.c 2009-08-29 15:46:49.000000000 -0400
@@ -197,7 +197,7 @@

for (i = 0; i < num_resources; i++)
resources[i].resource_name =
- (String) XrmPermStringToQuark (resources[i].resource_name);
+ (String)(uintptr_t) XrmPermStringToQuark (resources[i].resource_name);
}
^L
/**********************************************************************
@@ -241,7 +241,7 @@
for (j = 0; j < num_resources; j++)
{
if ((resources[j].export_proc) &&
- (XrmQuark)(resources[j].resource_name) == quark)
+ (XrmQuark)(uintptr_t)(resources[j].resource_name) == quark)
{
value_size = resources[j].resource_size;

@@ -512,7 +512,7 @@
for (j = 0; j < num_resources; j++)
{
if ((resources[j].import_proc) &&
- (XrmQuark)(resources[j].resource_name) == quark)
+ (XrmQuark)(uintptr_t)(resources[j].resource_name) == quark)
{
value = args[i].value;

--- openmotif-2.2.4/lib/Xm/Obso2_0.c.org 2009-08-29 15:48:36.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/Obso2_0.c 2009-08-29 15:50:09.000000000 -0400
@@ -1584,7 +1584,7 @@
Stuff from Desktop.c
**********************/

-static XContext actualClassContext = (XContext) NULL;
+static XContext actualClassContext = (XContext)(uintptr_t) NULL;

/*ARGSUSED*/
@@ -1611,7 +1611,7 @@
{
WidgetClass actualClass;

- if (actualClassContext == (XContext) NULL)
+ if (actualClassContext == (XContext)(uintptr_t) NULL)
actualClassContext = XUniqueContext();

/*
@@ -1645,7 +1645,7 @@
WidgetClass previous;
WidgetClass oldActualClass;

- if (actualClassContext == (XContext) NULL)
+ if (actualClassContext == (XContext)(uintptr_t) NULL)
actualClassContext = XUniqueContext();

/*
@@ -1692,7 +1692,7 @@
Cardinal *num_args )
{
XmDesktopObject worldObject;
- static XContext worldObjectContext = (XContext) NULL;
+ static XContext worldObjectContext = (XContext)(uintptr_t) NULL;
XmWidgetExtData ext;
Display *display;

@@ -1701,7 +1701,7 @@
** the display is closed, so that we don't get bad data if a second
** display with the same id is opened.
*/
- if (worldObjectContext == (XContext) NULL)
+ if (worldObjectContext == (XContext)(uintptr_t) NULL)
worldObjectContext = XUniqueContext();

display = XtDisplayOfObject(shell);
--- openmotif-2.2.4/lib/Xm/Xpmparse.c.org 2009-08-29 15:51:35.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/Xpmparse.c 2009-08-29 15:55:20.000000000 -0400
@@ -360,7 +360,7 @@
*/
if (USE_HASHTABLE) {
ErrorStatus =
- xpmHashIntern(hashtable, color->string, HashAtomData(a));
+ xpmHashIntern(hashtable, color->string, HashAtomData((uintptr_t)a));
if (ErrorStatus != XpmSuccess) {
xpmFreeColorTable(colorTable, ncolors);
return (ErrorStatus);
@@ -442,7 +442,7 @@
*/
if (USE_HASHTABLE) {
ErrorStatus =
- xpmHashIntern(hashtable, color->string, HashAtomData(a));
+ xpmHashIntern(hashtable, color->string, HashAtomData((uintptr_t)a));
if (ErrorStatus != XpmSuccess) {
xpmFreeColorTable(colorTable, ncolors);
return (ErrorStatus);
--- openmotif-2.2.4/lib/Xm/XpmI.h.org 2009-08-29 15:56:52.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/XpmI.h 2009-08-29 15:57:29.000000000 -0400
@@ -288,7 +288,7 @@
FUNC(xpmHashIntern, int, (xpmHashTable *table, char *tag, void *data));

#define HashAtomData(i) ((void *)i)
-#define HashColorIndex(slot) ((unsigned int)((*slot)->data))
+#define HashColorIndex(slot) ((unsigned int)(uintptr_t)((*slot)->data))
#define USE_HASHTABLE (cpp > 2 && ncolors > 4)

/* I/O utility */
--- openmotif-2.2.4/lib/Xm/IconG.c.org 2009-08-29 16:00:48.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/IconG.c 2009-08-29 16:01:19.000000000 -0400
@@ -279,8 +279,8 @@

/* those are created in ClassInitialize and filled by the
IconConverter. */
-static XContext largeIconContext = (XContext) NULL;
-static XContext smallIconContext = (XContext) NULL;
+static XContext largeIconContext = (XContext)(uintptr_t) NULL;
+static XContext smallIconContext = (XContext)(uintptr_t) NULL;

static XPointer dummy;
#define OwnLargeMask(widget) \
--- openmotif-2.2.4/lib/Xm/SlideC.c.org 2009-08-29 16:03:05.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/SlideC.c 2009-08-29 16:04:33.000000000 -0400
@@ -94,14 +94,14 @@
/* notify that initialize called XtArgsProc */ NULL,
/* NULL XtProc */ NULL,
/* NULL XtPointer */ NULL,
-/* NULL Cardinal */ (Cardinal)NULL,
+/* NULL Cardinal */ (Cardinal)(uintptr_t)NULL,
/* resources for subclass fields XtResourceList */ resources,
/* number of entries in resources Cardinal */ XtNumber(resources),
/* resource class quarkified XrmClass */ NULLQUARK,
-/* NULL Boolean */ (Boolean)NULL,
-/* NULL XtEnum */ (XtEnum)NULL,
-/* NULL Boolean */ (Boolean)NULL,
-/* NULL Boolean */ (Boolean)NULL,
+/* NULL Boolean */ (Boolean)(uintptr_t)NULL,
+/* NULL XtEnum */ (XtEnum)(uintptr_t)NULL,
+/* NULL Boolean */ (Boolean)(uintptr_t)NULL,
+/* NULL Boolean */ (Boolean)(uintptr_t)NULL,
/* free data for subclass pointers XtWidgetProc */ destroy,
/* NULL XtProc */ NULL,
/* NULL XtProc */ NULL,
--- openmotif-2.2.4/lib/Xm/DataF.c.org 2009-08-29 16:05:43.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/DataF.c 2009-08-29 16:07:15.000000000 -0400
@@ -8984,7 +8984,7 @@
/* CR03685 */
SGI_hack_XmImRegister((Widget)tf);
#else
- XmImRegister((Widget)tf, (unsigned int) NULL);
+ XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);
#endif
df_GetXYFromPos(tf, XmTextF_cursor_position(tf), &xmim_point.x, &xmim_point.y);
n = 0;
@@ -10454,7 +10454,7 @@
diff_values = True;
if (XmTextF_wc_value(new_tf) == NULL) {
XmTextF_wc_value(new_tf) = (wchar_t*) XtMalloc(sizeof(wchar_t));
- *XmTextF_wc_value(new_tf) = (wchar_t)NULL;
+ *XmTextF_wc_value(new_tf) = (wchar_t)(uintptr_t)NULL;
}
df_ValidateString(new_tf, (char*)XmTextF_wc_value(new_tf), True);
} else if (XmTextF_value(new_tf) != XmTextF_value(old_tf)) {
@@ -11600,7 +11600,7 @@
/* CR03685 */
SGI_hack_XmImRegister((Widget)tf);
#else
- XmImRegister((Widget)tf, (unsigned int) NULL);
+ XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);
#endif
df_GetXYFromPos(tf, XmTextF_cursor_position(tf), &xmim_point.x,
&xmim_point.y);
--- openmotif-2.2.4/lib/Xm/FontS.c.org 2009-08-29 16:08:47.000000000 -0400
+++ openmotif-2.2.4/lib/Xm/FontS.c 2009-08-29 16:10:59.000000000 -0400
@@ -2653,7 +2653,7 @@
XmStringFree(label);

XtAddCallback(button,
- XmNactivateCallback, ChangeEncoding, (XtPointer) i);
+ XmNactivateCallback, ChangeEncoding, (XtPointer)(uintptr_t) i);

if (streq(*encodings, ENCODING_STRING(fsw)))
{
@@ -2815,7 +2815,7 @@
fsw = (XmFontSelectorWidget) w;
cf = XmFontS_font_info(fsw)->current_font;

- if ((int) data == 0)
+ if ((int)(uintptr_t) data == 0)
{
XtFree(ENCODING_STRING(fsw));
ENCODING_STRING(fsw) = XtNewString(ANY_ENCODING);
@@ -2823,7 +2823,7 @@
else
{
XtFree(ENCODING_STRING(fsw));
- ENCODING_STRING(fsw) = XtNewString(ENCODING_LIST(fsw)[(int) data - 1]);
+ ENCODING_STRING(fsw) = XtNewString(ENCODING_LIST(fsw)[(int)(uintptr_t) data - 1]);
}

UpdateFamilies(fsw);
@@ -3599,7 +3599,7 @@
num_largs = 0;
XtSetArg(largs[num_largs], XmNmenuHistory, button); num_largs++;
XtSetValues(XmFontS_option_menu(set_fsw), largs, num_largs);
- ChangeEncoding((Widget) set_fsw, (XtPointer) current, NULL);
+ ChangeEncoding((Widget) set_fsw, (XtPointer)(uintptr_t) current, NULL);
}
else
{
--- openmotif-2.2.4/clients/mwm/WmResParse.c.org 2009-08-29 16:13:01.000000000 -0400
+++ openmotif-2.2.4/clients/mwm/WmResParse.c 2009-08-29 16:14:50.000000000 -0400
@@ -188,7 +188,7 @@
{"mod3", Mod3Mask},
{"mod4", Mod4Mask},
{"mod5", Mod5Mask},
- {NULL, (unsigned int)NULL},
+ {NULL, (unsigned int)(uintptr_t)NULL},
};

#define ALT_INDEX 3
@@ -351,14 +351,14 @@
{"btn5up", ButtonRelease, ParseImmed, Button5, FALSE},
{"btn5click", ButtonRelease, ParseImmed, Button5, TRUE},
{"btn5click2", ButtonPress, ParseImmed, Button5, TRUE},
- { NULL, (unsigned int)NULL, (Boolean(*)())NULL, (unsigned int)NULL, (Boolean)NULL}
+ { NULL, (unsigned int)(uintptr_t)NULL, (Boolean(*)())NULL, (unsigned int)(uintptr_t)NULL, (Boolean)(uintptr_t)NULL}
};

static EventTableEntry keyEvents[] = {

{"key", KeyPress, ParseKeySym, 0, FALSE},
- { NULL, (unsigned int)NULL, (Boolean(*)())NULL, (unsigned int)NULL, (Boolean)NULL}
+ { NULL, (unsigned int)(uintptr_t)NULL, (Boolean(*)())NULL, (unsigned int)(uintptr_t)NULL, (Boolean)(uintptr_t)NULL}
};

#ifdef PANELIST