Ticket #21330: patch-uintptr_t-cast.diff

File patch-uintptr_t-cast.diff, 17.1 KB (added by howarth@…, 15 years ago)

patch to add casts with uintptr_t to eliminate "cast to pointer from integer of different size" warnings

  • lib/Xm/DragBS.c

    old new  
    217217static unsigned long    firstProtectRequest;
    218218static Window           errorWindow;
    219219
    220 static XContext         displayToMotifWindowContext = (XContext) NULL;
    221 static XContext         displayToTargetsContext = (XContext) NULL;
    222 static XContext         displayToAtomsContext = (XContext) NULL;
     220static XContext         displayToMotifWindowContext = (XContext)(uintptr_t) NULL;
     221static XContext         displayToTargetsContext = (XContext)(uintptr_t) NULL;
     222static XContext         displayToAtomsContext = (XContext)(uintptr_t) NULL;
    223223
    224224
    225225/*****************************************************************************
     
    304304    XContext    loc_context;
    305305
    306306    _XmProcessLock();
    307     if (displayToMotifWindowContext == (XContext) NULL) {
     307    if (displayToMotifWindowContext == (XContext)(uintptr_t) NULL) {
    308308        displayToMotifWindowContext = XUniqueContext();
    309309    }
    310310    loc_context = displayToMotifWindowContext;
     
    335335    XContext loc_context;
    336336
    337337    _XmProcessLock();
    338     if (displayToMotifWindowContext == (XContext) NULL) {
     338    if (displayToMotifWindowContext == (XContext)(uintptr_t) NULL) {
    339339        displayToMotifWindowContext = XUniqueContext();
    340340    }
    341341    loc_context = displayToMotifWindowContext;
     
    378378    XContext            loc_context;
    379379
    380380    _XmProcessLock();
    381     if (displayToTargetsContext == (XContext) NULL) {
     381    if (displayToTargetsContext == (XContext)(uintptr_t) NULL) {
    382382        displayToTargetsContext = XUniqueContext();
    383383    }
    384384    loc_context = displayToTargetsContext;
     
    409409    XContext    loc_context;
    410410
    411411    _XmProcessLock();
    412     if (displayToTargetsContext == (XContext) NULL) {
     412    if (displayToTargetsContext == (XContext)(uintptr_t) NULL) {
    413413        displayToTargetsContext = XUniqueContext();
    414414    }
    415415    loc_context = displayToTargetsContext;
     
    464464    XContext            loc_context;
    465465
    466466    _XmProcessLock();
    467     if (displayToAtomsContext == (XContext) NULL) {
     467    if (displayToAtomsContext == (XContext)(uintptr_t) NULL) {
    468468        displayToAtomsContext = XUniqueContext();
    469469    }
    470470    loc_context = displayToAtomsContext;
     
    495495    XContext loc_context;
    496496
    497497    _XmProcessLock();
    498     if (displayToAtomsContext == (XContext) NULL) {
     498    if (displayToAtomsContext == (XContext)(uintptr_t) NULL) {
    499499        displayToAtomsContext = XUniqueContext();
    500500    }
    501501    loc_context = displayToAtomsContext;
  • lib/Xm/DragIcon.c

    old new  
    760760#undef Offset
    761761#define Offset(x) (XtOffsetOf( struct _XmDragIconRec, drag.x))
    762762
    763 static XContext _XmTextualDragIconContext = (XContext) NULL;
     763static XContext _XmTextualDragIconContext = (XContext)(uintptr_t) NULL;
    764764
    765765static XtResource resources[]=
    766766{
     
    12401240   use_alt = dpy -> display.enable_drag_icon;
    12411241
    12421242   _XmProcessLock();
    1243    if (_XmTextualDragIconContext == (XContext) NULL)
     1243   if (_XmTextualDragIconContext == (XContext)(uintptr_t) NULL)
    12441244      _XmTextualDragIconContext = XUniqueContext();
    12451245   loc_context = _XmTextualDragIconContext;
    12461246   _XmProcessUnlock();
  • lib/Xm/Text.c

    old new  
    654654static void
    655655_XmCreateCutBuffers(Widget w)
    656656{
    657   static XContext context = (XContext)NULL;
     657  static XContext context = (XContext)(uintptr_t)NULL;
    658658  char * tmp = NULL;
    659659  Display *dpy = XtDisplay(w);
    660660  Screen *screen = XtScreen(w);
    661661  XContext local_context;
    662662
    663663  _XmProcessLock();
    664   if (context == (XContext)NULL) context = XUniqueContext();
     664  if (context == (XContext)(uintptr_t)NULL) context = XUniqueContext();
    665665
    666666  local_context = context;
    667667  _XmProcessUnlock();
     
    30233023  if (!tw->text.editable && editable) {
    30243024    OutputData o_data = tw->text.output->data;
    30253025   
    3026     XmImRegister(widget, (unsigned int) NULL);
     3026    XmImRegister(widget, (unsigned int)(uintptr_t) NULL);
    30273027   
    30283028    (*tw->text.output->PosToXY)(tw, tw->text.cursor_position,
    30293029                                &xmim_point.x, &xmim_point.y);
  • lib/Xm/TextF.c

    old new  
    73067306  XmTextFieldSetEditable((Widget)tf, TextF_Editable(tf));
    73077307 
    73087308  if (TextF_Editable(tf)) {
    7309     XmImRegister((Widget)tf, (unsigned int) NULL);
     7309    XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);
    73107310    GetXYFromPos(tf, TextF_CursorPosition(tf), &xmim_point.x, &xmim_point.y);
    73117311    (void)TextFieldGetDisplayRect((Widget)tf, &xmim_area);
    73127312    n = 0;
     
    81788178      diff_values = True;
    81798179      if (TextF_WcValue(new_tf) == NULL) {
    81808180        TextF_WcValue(new_tf) = (wchar_t*) XtMalloc(sizeof(wchar_t));
    8181         *TextF_WcValue(new_tf) = (wchar_t)NULL;
     8181        *TextF_WcValue(new_tf) = (wchar_t)(uintptr_t)NULL;
    81828182      }
    81838183      ValidateString(new_tf, (char*)TextF_WcValue(new_tf), True);
    81848184    } else if (TextF_Value(new_tf) != TextF_Value(old_tf)) {
     
    1009110091   * give the IM the relevent values. */
    1009210092 
    1009310093  if (!TextF_Editable(tf) && editable) {
    10094     XmImRegister((Widget)tf, (unsigned int) NULL);
     10094    XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);
    1009510095   
    1009610096    GetXYFromPos(tf, TextF_CursorPosition(tf), &xmim_point.x,
    1009710097                 &xmim_point.y);
  • lib/Xm/Protocols.c

    old new  
    136136 *
    137137 ***************************************************************************/
    138138
    139 static XContext allProtocolsMgrContext = (XContext) NULL;
     139static XContext allProtocolsMgrContext = (XContext)(uintptr_t) NULL;
    140140
    141141
    142142#define Offset(field) XtOffsetOf( struct _XmProtocolRec, protocol.field)
     
    374374          display = XtDisplay(shell);
    375375         
    376376          _XmProcessLock();
    377           if (allProtocolsMgrContext == (XContext) NULL)
     377          if (allProtocolsMgrContext == (XContext)(uintptr_t) NULL)
    378378            allProtocolsMgrContext = XUniqueContext();
    379379          _XmProcessUnlock();
    380380         
  • lib/Xm/VendorS.c

    old new  
    15761576        ttp->post_delay = 5000;
    15771577        ttp->post_duration = 5000;
    15781578        ttp->enable = False;
    1579         ttp->timer = (int) NULL;
    1580         ttp->duration_timer = (int) NULL;
     1579        ttp->timer = (int)(uintptr_t) NULL;
     1580        ttp->duration_timer = (int)(uintptr_t) NULL;
    15811581        ttp->leave_time = 0;
    15821582        ttp->slider = ttp->label = NULL;
    15831583 
  • lib/Xm/Synthetic.c

    old new  
    197197 
    198198  for (i = 0; i < num_resources; i++)
    199199    resources[i].resource_name =
    200       (String) XrmPermStringToQuark (resources[i].resource_name);
     200      (String)(uintptr_t) XrmPermStringToQuark (resources[i].resource_name);
    201201}
    202202
    203203
  • lib/Xm/Obso2_0.c

     /**********************************************************************
    @@ -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;
     	      
    old new  
    15841584  Stuff from Desktop.c
    15851585**********************/
    15861586
    1587 static XContext actualClassContext = (XContext) NULL;
     1587static XContext actualClassContext = (XContext)(uintptr_t) NULL;
    15881588
    15891589
    15901590/*ARGSUSED*/
     
    16111611{
    16121612          WidgetClass           actualClass;
    16131613
    1614           if (actualClassContext == (XContext) NULL)
     1614          if (actualClassContext == (XContext)(uintptr_t) NULL)
    16151615            actualClassContext = XUniqueContext();
    16161616         
    16171617          /*
     
    16451645    WidgetClass previous;
    16461646    WidgetClass oldActualClass;
    16471647
    1648     if (actualClassContext == (XContext) NULL)
     1648    if (actualClassContext == (XContext)(uintptr_t) NULL)
    16491649      actualClassContext = XUniqueContext();
    16501650   
    16511651    /*
     
    16921692        Cardinal *num_args )
    16931693{
    16941694    XmDesktopObject     worldObject;
    1695     static XContext     worldObjectContext = (XContext) NULL;
     1695    static XContext     worldObjectContext = (XContext)(uintptr_t) NULL;
    16961696    XmWidgetExtData     ext;
    16971697    Display             *display;
    16981698   
     
    17011701    ** the display is closed, so that we don't get bad data if a second
    17021702    ** display with the same id is opened.
    17031703    */
    1704     if (worldObjectContext == (XContext) NULL)
     1704    if (worldObjectContext == (XContext)(uintptr_t) NULL)
    17051705      worldObjectContext = XUniqueContext();
    17061706
    17071707    display = XtDisplayOfObject(shell);
  • lib/Xm/Xpmparse.c

    old new  
    387387             */
    388388            if (USE_HASHTABLE) {
    389389                ErrorStatus =
    390                     xpmHashIntern(hashtable, color->string, HashAtomData(a));
     390                    xpmHashIntern(hashtable, color->string, HashAtomData((uintptr_t)a));
    391391                if (ErrorStatus != XpmSuccess) {
    392392                    xpmFreeColorTable(colorTable, ncolors);
    393393                    return (ErrorStatus);
     
    475475             */
    476476            if (USE_HASHTABLE) {
    477477                ErrorStatus =
    478                     xpmHashIntern(hashtable, color->string, HashAtomData(a));
     478                    xpmHashIntern(hashtable, color->string, HashAtomData((uintptr_t)a));
    479479                if (ErrorStatus != XpmSuccess) {
    480480                    xpmFreeColorTable(colorTable, ncolors);
    481481                    return (ErrorStatus);
  • lib/Xm/SlideC.c

    old new  
    9494/* notify that initialize called    XtArgsProc        */ NULL,
    9595/* NULL                             XtProc            */ NULL,
    9696/* NULL                             XtPointer         */ NULL,
    97 /* NULL                             Cardinal          */ (Cardinal)NULL,
     97/* NULL                             Cardinal          */ (Cardinal)(uintptr_t)NULL,
    9898/* resources for subclass fields    XtResourceList    */ resources,
    9999/* number of entries in resources   Cardinal          */ XtNumber(resources),
    100100/* resource class quarkified        XrmClass          */ NULLQUARK,
    101 /* NULL                             Boolean           */ (Boolean)NULL,
    102 /* NULL                             XtEnum            */ (XtEnum)NULL,
    103 /* NULL                             Boolean           */ (Boolean)NULL,
    104 /* NULL                             Boolean           */ (Boolean)NULL,
     101/* NULL                             Boolean           */ (Boolean)(uintptr_t)NULL,
     102/* NULL                             XtEnum            */ (XtEnum)(uintptr_t)NULL,
     103/* NULL                             Boolean           */ (Boolean)(uintptr_t)NULL,
     104/* NULL                             Boolean           */ (Boolean)(uintptr_t)NULL,
    105105/* free data for subclass pointers  XtWidgetProc      */ destroy,
    106106/* NULL                             XtProc            */ NULL,
    107107/* NULL                             XtProc            */ NULL,
  • lib/Xm/DataF.c

    old new  
    91219121      /* CR03685 */
    91229122      SGI_hack_XmImRegister((Widget)tf);
    91239123#else
    9124       XmImRegister((Widget)tf, (unsigned int) NULL);
     9124      XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);
    91259125#endif
    91269126      df_GetXYFromPos(tf, XmTextF_cursor_position(tf), &xmim_point.x, &xmim_point.y);
    91279127      n = 0;
     
    1063110631           diff_values = True;
    1063210632           if (XmTextF_wc_value(new_tf) == NULL) {
    1063310633              XmTextF_wc_value(new_tf) = (wchar_t*) XtMalloc(sizeof(wchar_t));
    10634               *XmTextF_wc_value(new_tf) = (wchar_t)NULL;
     10634              *XmTextF_wc_value(new_tf) = (wchar_t)(uintptr_t)NULL;
    1063510635           }
    1063610636           df_ValidateString(new_tf, (char*)XmTextF_wc_value(new_tf), True);
    1063710637        } else if (XmTextF_value(new_tf) != XmTextF_value(old_tf)) {
     
    1177711777       /* CR03685 */
    1177811778       SGI_hack_XmImRegister((Widget)tf);
    1177911779#else
    11780        XmImRegister((Widget)tf, (unsigned int) NULL);
     11780       XmImRegister((Widget)tf, (unsigned int)(uintptr_t) NULL);
    1178111781#endif
    1178211782       df_GetXYFromPos(tf, XmTextF_cursor_position(tf), &xmim_point.x,
    1178311783                       &xmim_point.y);
  • lib/Xm/FontS.c

    old new  
    27482748        XmStringFree(label);
    27492749
    27502750        XtAddCallback(button,
    2751                       XmNactivateCallback, ChangeEncoding, (XtPointer) i);
     2751                      XmNactivateCallback, ChangeEncoding, (XtPointer)(uintptr_t) i);
    27522752
    27532753        if (streq(*encodings, ENCODING_STRING(fsw)))
    27542754        {
     
    29102910    fsw = (XmFontSelectorWidget) w;
    29112911    cf = XmFontS_font_info(fsw)->current_font;
    29122912
    2913     if ((int) data == 0)
     2913    if ((int)(uintptr_t) data == 0)
    29142914        {
    29152915        XtFree(ENCODING_STRING(fsw));
    29162916        ENCODING_STRING(fsw) = XtNewString(ANY_ENCODING);
     
    29182918    else
    29192919        {
    29202920        XtFree(ENCODING_STRING(fsw));
    2921         ENCODING_STRING(fsw) = XtNewString(ENCODING_LIST(fsw)[(int) data - 1]);
     2921        ENCODING_STRING(fsw) = XtNewString(ENCODING_LIST(fsw)[(int)(uintptr_t) data - 1]);
    29222922        }
    29232923
    29242924    UpdateFamilies(fsw);
     
    36763676            num_largs = 0;
    36773677            XtSetArg(largs[num_largs], XmNmenuHistory, button); num_largs++;
    36783678            XtSetValues(XmFontS_option_menu(set_fsw), largs, num_largs);
    3679             ChangeEncoding((Widget) set_fsw, (XtPointer) current, NULL);
     3679            ChangeEncoding((Widget) set_fsw, (XtPointer)(uintptr_t) current, NULL);
    36803680        }
    36813681        else
    36823682        {
  • clients/mwm/WmResParse.c

    old new  
    188188    {"mod3",    Mod3Mask},
    189189    {"mod4",    Mod4Mask},
    190190    {"mod5",    Mod5Mask},
    191     {NULL,      (unsigned int)NULL},
     191    {NULL,      (unsigned int)(uintptr_t)NULL},
    192192};
    193193
    194194#define ALT_INDEX 3
     
    351351    {"btn5up",      ButtonRelease,  ParseImmed,    Button5,  FALSE},
    352352    {"btn5click",   ButtonRelease,  ParseImmed,    Button5,  TRUE},
    353353    {"btn5click2",  ButtonPress,    ParseImmed,    Button5,  TRUE},
    354     { NULL, (unsigned int)NULL, (Boolean(*)())NULL, (unsigned int)NULL, (Boolean)NULL}
     354    { NULL, (unsigned int)(uintptr_t)NULL, (Boolean(*)())NULL, (unsigned int)(uintptr_t)NULL, (Boolean)(uintptr_t)NULL}
    355355};
    356356
    357357
    358358static EventTableEntry keyEvents[] = {
    359359
    360360    {"key",         KeyPress,    ParseKeySym,    0,  FALSE},
    361     { NULL, (unsigned int)NULL, (Boolean(*)())NULL, (unsigned int)NULL, (Boolean)NULL}
     361    { NULL, (unsigned int)(uintptr_t)NULL, (Boolean(*)())NULL, (unsigned int)(uintptr_t)NULL, (Boolean)(uintptr_t)NULL}
    362362};
    363363
    364364#ifdef PANELIST
  • lib/Xm/IconG.c

    old new  
    279279
    280280/* those are created in ClassInitialize and filled by the
    281281   IconConverter. */
    282 static XContext         largeIconContext = (XContext) NULL;
    283 static XContext         smallIconContext = (XContext) NULL;
     282static XContext         largeIconContext = (XContext)(uintptr_t) NULL;
     283static XContext         smallIconContext = (XContext)(uintptr_t) NULL;
    284284
    285285static XPointer dummy;
    286286#define OwnLargeMask(widget) \
  • clients/mwm/WmMenu.c

    old new  
    861861static MenuItem *MakeClientCommandMenuItem (String label, String funcArgs)
    862862{
    863863    return(MakeMenuItem(label, F_InvokeCommand, funcArgs,
    864                         (KeySym) NULL, (unsigned int)0,
    865                         (KeyCode) NULL, (String)NULL));
     864                        (KeySym)(uintptr_t) NULL, (unsigned int)0,
     865                        (KeyCode)(uintptr_t) NULL, (String)(uintptr_t)NULL));
    866866}
    867867
    868868
  • lib/Xm/XpmI.h

    @@ -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;
    old new  
    291291FUNC(xpmHashIntern, int, (xpmHashTable *table, char *tag, void *data));
    292292
    293293#define HashAtomData(i) ((void *)i)
    294 #define HashColorIndex(slot) ((unsigned int)((*slot)->data))
     294#define HashColorIndex(slot) ((unsigned int)(uintptr_t)((*slot)->data))
    295295#define USE_HASHTABLE (cpp > 2 && ncolors > 4)
    296296
    297297/* I/O utility */
  • lib/Xm/BaseClass.c

    old new  
    577577  static ExtToContextRec extToContextMap[16];
    578578  Cardinal               i;
    579579  ExtToContext           curr;
    580   XContext               context = (XContext) NULL;
     580  XContext               context = (XContext)(uintptr_t) NULL;
    581581 
    582582  _XmProcessLock();
    583583  for (i = 0, curr = &extToContextMap[0];
  • lib/Xm/XmIm.c

    old new  
    24992499  (void) add_ref(&xic_info->widget_refs, widget);
    25002500 
    25012501  /* Set the current XIC for this widget. */
    2502   if (xim_info->current_xics == (XContext) NULL)
     2502  if (xim_info->current_xics == (XContext)(uintptr_t) NULL)
    25032503    xim_info->current_xics = XUniqueContext();
    25042504  (void) XSaveContext(XtDisplay(widget), (XID) widget,
    25052505                      xim_info->current_xics, (XPointer) xic_info);