From: Arun Persaud Date: Wed, 6 Apr 2011 06:47:34 +0000 (-0700) Subject: fixed 64 bit warnings by casting integers to intptr_t before casting to int X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=5dca19a2828b0e6e0594b734792533e0c4f76146;p=xboard.git fixed 64 bit warnings by casting integers to intptr_t before casting to int --- diff --git a/args.h b/args.h index 3480ac1..c201aba 100644 --- a/args.h +++ b/args.h @@ -1009,7 +1009,7 @@ ParseArgs(GetFunc get, void *cl) break; case ArgColor: - ParseColor((int)ad->argLoc, argValue); + ParseColor((int)(intptr_t)ad->argLoc, argValue); break; case ArgAttribs: { @@ -1023,7 +1023,7 @@ ParseArgs(GetFunc get, void *cl) break; case ArgFont: - ParseFont(argValue, (int)ad->argLoc); + ParseFont(argValue, (int)(intptr_t)ad->argLoc); break; case ArgCommSettings: @@ -1119,13 +1119,13 @@ SetDefaultsFromList() case ArgBoolean: case ArgTrue: case ArgFalse: - *(Boolean *) argDescriptors[i].argLoc = (int)argDescriptors[i].defaultValue; + *(Boolean *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue; break; case ArgInt: case ArgX: case ArgY: case ArgZ: - *(int *) argDescriptors[i].argLoc = (int)argDescriptors[i].defaultValue; + *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue; break; case ArgString: case ArgFilename: @@ -1133,10 +1133,10 @@ SetDefaultsFromList() *(char **) argDescriptors[i].argLoc = (char *)argDescriptors[i].defaultValue; break; case ArgBoardSize: - *(int *) argDescriptors[i].argLoc = (int)argDescriptors[i].defaultValue; + *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue; break; case ArgColor: - ParseColor((int)argDescriptors[i].argLoc, (char*)argDescriptors[i].defaultValue); + ParseColor((int)(intptr_t)argDescriptors[i].argLoc, (char*)argDescriptors[i].defaultValue); break; case ArgFloat: // floats cannot be casted to int without precision loss default: ; // some arg types cannot be initialized through table diff --git a/filebrowser/draw.c b/filebrowser/draw.c index b21d170..46ed663 100644 --- a/filebrowser/draw.c +++ b/filebrowser/draw.c @@ -505,7 +505,7 @@ SFscrollTimer(p, id) int save; int n; - n = (int) p; + n = (int)(intptr_t) p; dir = &(SFdirs[SFdirPtr + n]); save = dir->vOrigin; @@ -535,7 +535,7 @@ SFscrollTimer(p, id) if (SFbuttonPressed) { SFscrollTimerId = XtAppAddTimeOut(SFapp, - SFscrollTimerInterval(), SFscrollTimer, (XtPointer) n); + SFscrollTimerInterval(), SFscrollTimer, (XtPointer)(intptr_t) n); } } @@ -576,7 +576,7 @@ SFnewInvertEntry(n, event) SFscrollTimerAdded = 1; SFscrollTimerId = XtAppAddTimeOut(SFapp, SFscrollTimerInterval(), SFscrollTimer, - (XtPointer) n); + (XtPointer)(intptr_t) n); } } diff --git a/filebrowser/selfile.c b/filebrowser/selfile.c index 860ed8b..a858e34 100644 --- a/filebrowser/selfile.c +++ b/filebrowser/selfile.c @@ -156,7 +156,7 @@ SFexposeList(w, n, event, cont) return; } - SFdrawList((int)n, SF_DO_NOT_SCROLL); + SFdrawList((int)(intptr_t)n, SF_DO_NOT_SCROLL); } /* ARGSUSED */ @@ -428,9 +428,9 @@ SFcreateWidgets(toplevel, prompt, ok, cancel) scrollbarWidgetClass, selFileLists[n], arglist, i); XtAddCallback(selFileVScrolls[n], XtNjumpProc, - SFvFloatSliderMovedCallback, (XtPointer) n); + SFvFloatSliderMovedCallback, (XtPointer)(intptr_t) n); XtAddCallback(selFileVScrolls[n], XtNscrollProc, - SFvAreaSelectedCallback, (XtPointer) n); + SFvAreaSelectedCallback, (XtPointer)(intptr_t) n); i = 0; @@ -445,9 +445,9 @@ SFcreateWidgets(toplevel, prompt, ok, cancel) scrollbarWidgetClass, selFileLists[n], arglist, i); XtAddCallback(selFileHScrolls[n], XtNjumpProc, - SFhSliderMovedCallback, (XtPointer) n); + SFhSliderMovedCallback, (XtPointer)(intptr_t) n); XtAddCallback(selFileHScrolls[n], XtNscrollProc, - SFhAreaSelectedCallback, (XtPointer) n); + SFhAreaSelectedCallback, (XtPointer)(intptr_t) n); } i = 0; @@ -506,17 +506,17 @@ SFcreateWidgets(toplevel, prompt, ok, cancel) for (n = 0; n < NR; n++) { XtAddEventHandler(selFileLists[n], ExposureMask, True, - SFexposeList, (XtPointer) n); + SFexposeList, (XtPointer)(intptr_t) n); XtAddEventHandler(selFileLists[n], EnterWindowMask, False, - SFenterList, (XtPointer) n); + SFenterList, (XtPointer)(intptr_t) n); XtAddEventHandler(selFileLists[n], LeaveWindowMask, False, - SFleaveList, (XtPointer) n); + SFleaveList, (XtPointer)(intptr_t) n); XtAddEventHandler(selFileLists[n], PointerMotionMask, False, - SFmotionList, (XtPointer) n); + SFmotionList, (XtPointer)(intptr_t) n); XtAddEventHandler(selFileLists[n], ButtonPressMask, False, - SFbuttonPressList, (XtPointer) n); + SFbuttonPressList, (XtPointer)(intptr_t) n); XtAddEventHandler(selFileLists[n], ButtonReleaseMask, False, - SFbuttonReleaseList, (XtPointer) n); + SFbuttonReleaseList, (XtPointer)(intptr_t) n); } XtAddEventHandler(selFileField, KeyPressMask, False, diff --git a/xboard.c b/xboard.c index 73bd41c..612cbfe 100644 --- a/xboard.c +++ b/xboard.c @@ -1480,7 +1480,7 @@ void SaveFontArg(FILE *f, ArgDescriptor *ad) { char *name; - int i, n = (int)ad->argLoc; + int i, n = (int)(intptr_t)ad->argLoc; switch(n) { case 0: // CLOCK_FONT name = appData.clockFont; @@ -1512,14 +1512,14 @@ ExportSounds() void SaveAttribsArg(FILE *f, ArgDescriptor *ad) { // here the "argLoc" defines a table index. It could have contained the 'ta' pointer itself, though - fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, (&appData.colorShout)[(int)ad->argLoc]); + fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, (&appData.colorShout)[(int)(intptr_t)ad->argLoc]); } void SaveColor(FILE *f, ArgDescriptor *ad) { // in WinBoard the color is an int and has to be converted to text. In X it would be a string already? - if(colorVariable[(int)ad->argLoc]) - fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, *(char**)colorVariable[(int)ad->argLoc]); + if(colorVariable[(int)(intptr_t)ad->argLoc]) + fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, *(char**)colorVariable[(int)(intptr_t)ad->argLoc]); } void