diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | generic/tkCanvLine.c | 8 | ||||
-rw-r--r-- | generic/tkCanvPoly.c | 8 | ||||
-rw-r--r-- | generic/tkCanvText.c | 16 | ||||
-rw-r--r-- | generic/tkCanvas.c | 11 | ||||
-rw-r--r-- | generic/tkConfig.c | 4 | ||||
-rw-r--r-- | generic/tkFocus.c | 10 | ||||
-rw-r--r-- | generic/tkFrame.c | 35 | ||||
-rw-r--r-- | generic/tkGrid.c | 4 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 25 | ||||
-rw-r--r-- | generic/tkPack.c | 16 | ||||
-rw-r--r-- | generic/tkPanedWindow.c | 4 |
12 files changed, 78 insertions, 72 deletions
@@ -1,3 +1,12 @@ +2005-08-11 Donal K. Fellows <donal.k.fellows@man.ac.uk> + + * generic/tkCanvLine.c, generic/tkCanvPoly.c, generic/tkCanvText.c: + * generic/tkCanvas.c, generic/tkConfig.c, generic/tkFocus.c: + * generic/tkFrame.c, generic/tkGrid.c, generic/tkImgPhoto.c: + * generic/tkPack.c, generic/tkPanedWindow.c: Don't pass size_t + arguments to Tcl_GetStringFromObj, even with casting; it's not + portable to 64-bit systems. [Bug 1252702] + 2005-08-09 Daniel Steffen <das@users.sourceforge.net> * macosx/tkMacOSXCarbonEvents.c (new): moved carbon events code into diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index d8be008..e868ae6 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvLine.c,v 1.13 2003/02/09 07:48:22 hobbs Exp $ + * RCS: @(#) $Id: tkCanvLine.c,v 1.13.2.1 2005/08/11 12:17:09 dkf Exp $ */ #include <stdio.h> @@ -1729,11 +1729,11 @@ GetLineIndex(interp, canvas, itemPtr, obj, indexPtr) int *indexPtr; /* Where to store converted index. */ { LineItem *linePtr = (LineItem *) itemPtr; - size_t length; - char *string = Tcl_GetStringFromObj(obj, (int *) &length); + int length; + char *string = Tcl_GetStringFromObj(obj, &length); if (string[0] == 'e') { - if (strncmp(string, "end", length) == 0) { + if (strncmp(string, "end", (unsigned) length) == 0) { *indexPtr = 2*linePtr->numPoints; } else { badIndex: diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 2b5f036..6831a5d 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvPoly.c,v 1.10.2.1 2003/05/11 00:57:09 hobbs Exp $ + * RCS: @(#) $Id: tkCanvPoly.c,v 1.10.2.2 2005/08/11 12:17:09 dkf Exp $ */ #include <stdio.h> @@ -1662,11 +1662,11 @@ GetPolygonIndex(interp, canvas, itemPtr, obj, indexPtr) int *indexPtr; /* Where to store converted index. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; - size_t length; - char *string = Tcl_GetStringFromObj(obj, (int *) &length); + int length; + char *string = Tcl_GetStringFromObj(obj, &length); if (string[0] == 'e') { - if (strncmp(string, "end", length) == 0) { + if (strncmp(string, "end", (unsigned) length) == 0) { *indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed); } else { badIndex: diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 99d8e30..d2c1bf8 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvText.c,v 1.15.2.1 2004/06/08 20:44:11 mdejong Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.15.2.2 2005/08/11 12:17:09 dkf Exp $ */ #include <stdio.h> @@ -1247,27 +1247,25 @@ GetTextIndex(interp, canvas, itemPtr, obj, indexPtr) * index. */ { TextItem *textPtr = (TextItem *) itemPtr; - size_t length; - int c; + int c, length; TkCanvas *canvasPtr = (TkCanvas *) canvas; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; - char *string = Tcl_GetStringFromObj(obj, (int *) &length); + char *string = Tcl_GetStringFromObj(obj, &length); c = string[0]; - length = strlen(string); - if ((c == 'e') && (strncmp(string, "end", length) == 0)) { + if ((c == 'e') && (strncmp(string, "end", (unsigned) length) == 0)) { *indexPtr = textPtr->numChars; - } else if ((c == 'i') && (strncmp(string, "insert", length) == 0)) { + } else if ((c=='i') && (strncmp(string, "insert", (unsigned) length)==0)) { *indexPtr = textPtr->insertPos; - } else if ((c == 's') && (strncmp(string, "sel.first", length) == 0) + } else if ((c=='s') && (strncmp(string, "sel.first", (unsigned) length)==0) && (length >= 5)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC); return TCL_ERROR; } *indexPtr = textInfoPtr->selectFirst; - } else if ((c == 's') && (strncmp(string, "sel.last", length) == 0) + } else if ((c=='s') && (strncmp(string, "sel.last", (unsigned) length)==0) && (length >= 5)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC); diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 22625ff..9c29edb 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvas.c,v 1.21.2.2 2005/06/21 17:29:16 dgp Exp $ + * RCS: @(#) $Id: tkCanvas.c,v 1.21.2.3 2005/08/11 12:17:09 dkf Exp $ */ /* #define USE_OLD_TAG_SEARCH 1 */ @@ -521,8 +521,7 @@ CanvasWidgetCmd(clientData, interp, objc, objv) Tcl_Obj *CONST objv[]; /* Argument objects. */ { TkCanvas *canvasPtr = (TkCanvas *) clientData; - unsigned int length; - int c, result; + int c, length, result; Tk_Item *itemPtr = NULL; /* Initialization needed only to * prevent compiler warning. */ #ifdef USE_OLD_TAG_SEARCH @@ -933,12 +932,12 @@ CanvasWidgetCmd(clientData, interp, objc, objv) result = TCL_ERROR; goto done; } - arg = Tcl_GetStringFromObj(objv[2], (int *) &length); + arg = Tcl_GetStringFromObj(objv[2], &length); c = arg[0]; Tcl_MutexLock(&typeListMutex); for (typePtr = typeList; typePtr != NULL; typePtr = typePtr->nextPtr) { if ((c == typePtr->name[0]) - && (strncmp(arg, typePtr->name, length) == 0)) { + && (strncmp(arg, typePtr->name, (unsigned) length) == 0)) { if (matchPtr != NULL) { Tcl_MutexUnlock(&typeListMutex); badType: @@ -5571,7 +5570,7 @@ GetStringsFromObjs(argc, objv) } argv = (CONST char **) ckalloc((argc+1) * sizeof(char *)); for (i = 0; i < argc; i++) { - argv[i]=Tcl_GetStringFromObj(objv[i], (int *) NULL); + argv[i] = Tcl_GetStringFromObj(objv[i], NULL); } argv[argc] = 0; return argv; diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 643ef81..124c452 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkConfig.c,v 1.18 2002/08/05 04:30:38 dgp Exp $ + * RCS: @(#) $Id: tkConfig.c,v 1.18.2.1 2005/08/11 12:17:09 dkf Exp $ */ /* @@ -1158,7 +1158,7 @@ GetOptionFromObj(interp, objPtr, tablePtr) * The answer isn't cached. */ - name = Tcl_GetStringFromObj(objPtr, (int *) NULL); + name = Tcl_GetStringFromObj(objPtr, NULL); bestPtr = GetOption(name, tablePtr); if (bestPtr == NULL) { goto error; diff --git a/generic/tkFocus.c b/generic/tkFocus.c index 93af5f5..6976e23 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFocus.c,v 1.10 2002/10/08 19:57:59 hobbs Exp $ + * RCS: @(#) $Id: tkFocus.c,v 1.10.2.1 2005/08/11 12:17:09 dkf Exp $ */ #include "tkInt.h" @@ -149,7 +149,7 @@ Tk_FocusObjCmd(clientData, interp, objc, objv) */ if (objc == 2) { - windowName = Tcl_GetStringFromObj(objv[1], (int *) NULL); + windowName = Tcl_GetStringFromObj(objv[1], NULL); /* * The empty string case exists for backwards compatibility. @@ -180,7 +180,7 @@ Tk_FocusObjCmd(clientData, interp, objc, objv) } switch (index) { case 0: { /* -displayof */ - windowName = Tcl_GetStringFromObj(objv[2], (int *) NULL); + windowName = Tcl_GetStringFromObj(objv[2], NULL); newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin); if (newPtr == NULL) { return TCL_ERROR; @@ -192,7 +192,7 @@ Tk_FocusObjCmd(clientData, interp, objc, objv) break; } case 1: { /* -force */ - windowName = Tcl_GetStringFromObj(objv[2], (int *) NULL); + windowName = Tcl_GetStringFromObj(objv[2], NULL); /* * The empty string case exists for backwards compatibility. @@ -209,7 +209,7 @@ Tk_FocusObjCmd(clientData, interp, objc, objv) break; } case 2: { /* -lastfor */ - windowName = Tcl_GetStringFromObj(objv[2], (int *) NULL); + windowName = Tcl_GetStringFromObj(objv[2], NULL); newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin); if (newPtr == NULL) { return TCL_ERROR; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index d80446c..5636917 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFrame.c,v 1.15.2.2 2005/07/28 04:57:37 hobbs Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.15.2.3 2005/08/11 12:17:09 dkf Exp $ */ #include "default.h" @@ -485,8 +485,7 @@ CreateFrame(clientData, interp, objc, objv, type, appName) Tk_OptionTable optionTable; Tk_Window new; CONST char *className, *screenName, *visualName, *colormapName, *arg, *useOption; - int i, c, depth; - size_t length; + int i, c, depth, length; unsigned int mask; Colormap colormap; Visual *visual; @@ -513,25 +512,25 @@ CreateFrame(clientData, interp, objc, objv, type, appName) className = colormapName = screenName = visualName = useOption = NULL; colormap = None; for (i = 2; i < objc; i += 2) { - arg = Tcl_GetStringFromObj(objv[i], (int *) &length); + arg = Tcl_GetStringFromObj(objv[i], &length); if (length < 2) { continue; } c = arg[1]; - if ((c == 'c') && (strncmp(arg, "-class", length) == 0) + if ((c == 'c') && (strncmp(arg, "-class", (unsigned) length) == 0) && (length >= 3)) { className = Tcl_GetString(objv[i+1]); } else if ((c == 'c') - && (strncmp(arg, "-colormap", length) == 0)) { + && (strncmp(arg, "-colormap", (unsigned) length) == 0)) { colormapName = Tcl_GetString(objv[i+1]); } else if ((c == 's') && (type == TYPE_TOPLEVEL) - && (strncmp(arg, "-screen", length) == 0)) { + && (strncmp(arg, "-screen", (unsigned) length) == 0)) { screenName = Tcl_GetString(objv[i+1]); } else if ((c == 'u') && (type == TYPE_TOPLEVEL) - && (strncmp(arg, "-use", length) == 0)) { + && (strncmp(arg, "-use", (unsigned) length) == 0)) { useOption = Tcl_GetString(objv[i+1]); } else if ((c == 'v') - && (strncmp(arg, "-visual", length) == 0)) { + && (strncmp(arg, "-visual", (unsigned) length) == 0)) { visualName = Tcl_GetString(objv[i+1]); } } @@ -735,8 +734,7 @@ FrameWidgetObjCmd(clientData, interp, objc, objv) }; register Frame *framePtr = (Frame *) clientData; int result = TCL_OK, index; - size_t length; - int c, i; + int c, i, length; Tcl_Obj *objPtr; if (objc < 2) { @@ -784,25 +782,26 @@ FrameWidgetObjCmd(clientData, interp, objc, objv) */ for (i = 2; i < objc; i++) { - char *arg = Tcl_GetStringFromObj(objv[i], (int *) &length); + char *arg = Tcl_GetStringFromObj(objv[i], &length); if (length < 2) { continue; } c = arg[1]; - if (((c == 'c') && (strncmp(arg, "-class", length) == 0) + if (((c == 'c') + && (strncmp(arg, "-class", (unsigned) length) == 0) && (length >= 2)) || ((c == 'c') - && (strncmp(arg, "-colormap", length) == 0) + && (strncmp(arg, "-colormap", (unsigned) length) == 0) && (length >= 3)) || ((c == 'c') - && (strncmp(arg, "-container", length) == 0) + && (strncmp(arg, "-container", (unsigned) length) == 0) && (length >= 3)) || ((c == 's') && (framePtr->type == TYPE_TOPLEVEL) - && (strncmp(arg, "-screen", length) == 0)) + && (strncmp(arg, "-screen", (unsigned) length) == 0)) || ((c == 'u') && (framePtr->type == TYPE_TOPLEVEL) - && (strncmp(arg, "-use", length) == 0)) + && (strncmp(arg, "-use", (unsigned) length) == 0)) || ((c == 'v') - && (strncmp(arg, "-visual", length) == 0))) { + && (strncmp(arg, "-visual", (unsigned) length) ==0))) { Tcl_AppendResult(interp, "can't modify ", arg, " option after widget is created", (char *) NULL); result = TCL_ERROR; diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 9de0742..80bb59f 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkGrid.c,v 1.25.2.2 2005/01/11 10:46:39 dkf Exp $ + * RCS: @(#) $Id: tkGrid.c,v 1.25.2.3 2005/08/11 12:17:09 dkf Exp $ */ #include "tkInt.h" @@ -2540,7 +2540,7 @@ ConfigureSlaves(interp, tkwin, objc, objv) firstChar = 0; for (numWindows = i = 0; i < objc; i++) { prevChar = firstChar; - string = Tcl_GetStringFromObj(objv[i], (int *) &length); + string = Tcl_GetStringFromObj(objv[i], &length); firstChar = string[0]; if (firstChar == '.') { diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 9daf790..5758897 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -17,7 +17,7 @@ * Department of Computer Science, * Australian National University. * - * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.13 2004/12/09 10:05:38 dkf Exp $ + * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.14 2005/08/11 12:17:09 dkf Exp $ */ #include "tkInt.h" @@ -674,10 +674,9 @@ ImgPhotoCmd(clientData, interp, objc, objv) XColor color; Tk_PhotoImageFormat *imageFormat; int imageWidth, imageHeight; - int matched; + int length, matched; Tcl_Channel chan; Tk_PhotoHandle srcHandle; - size_t length; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -717,12 +716,12 @@ ImgPhotoCmd(clientData, interp, objc, objv) Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } - arg = Tcl_GetStringFromObj(objv[2], (int *) &length); - if (strncmp(arg,"-data", length) == 0) { + arg = Tcl_GetStringFromObj(objv[2], &length); + if (strncmp(arg,"-data", (unsigned) length) == 0) { if (masterPtr->dataString) { Tcl_SetObjResult(interp, masterPtr->dataString); } - } else if (strncmp(arg,"-format", length) == 0) { + } else if (strncmp(arg,"-format", (unsigned) length) == 0) { if (masterPtr->format) { Tcl_SetObjResult(interp, masterPtr->format); } @@ -765,8 +764,9 @@ ImgPhotoCmd(clientData, interp, objc, objv) return TCL_OK; } if (objc == 3) { - char *arg = Tcl_GetStringFromObj(objv[2], (int *) &length); - if (!strncmp(arg, "-data", length)) { + char *arg = Tcl_GetStringFromObj(objv[2], &length); + + if (!strncmp(arg, "-data", (unsigned) length)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "-data {} {} {}", (char *) NULL); if (masterPtr->dataString) { @@ -777,7 +777,7 @@ ImgPhotoCmd(clientData, interp, objc, objv) " {}", (char *) NULL); } return TCL_OK; - } else if (!strncmp(arg, "-format", length)) { + } else if (!strncmp(arg, "-format", (unsigned) length)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "-format {} {} {}", (char *) NULL); if (masterPtr->format) { @@ -5830,15 +5830,16 @@ PhotoOptionFind(interp, obj) Tcl_Interp *interp; /* Interpreter that is being deleted. */ Tcl_Obj *obj; /* Name of option to be found. */ { - size_t length; - char *name = Tcl_GetStringFromObj(obj, (int *) &length); + int length; + char *name = Tcl_GetStringFromObj(obj, &length); OptionAssocData *list; char *prevname = NULL; Tcl_ObjCmdProc *proc = (Tcl_ObjCmdProc *) NULL; + list = (OptionAssocData *) Tcl_GetAssocData(interp, "photoOption", (Tcl_InterpDeleteProc **) NULL); while (list != (OptionAssocData *) NULL) { - if (strncmp(name, list->name, length) == 0) { + if (strncmp(name, list->name, (unsigned) length) == 0) { if (proc != (Tcl_ObjCmdProc *) NULL) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "ambiguous option \"", name, diff --git a/generic/tkPack.c b/generic/tkPack.c index 6a57384..10d306a 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkPack.c,v 1.16.2.2 2005/01/11 10:46:39 dkf Exp $ + * RCS: @(#) $Id: tkPack.c,v 1.16.2.3 2005/08/11 12:17:09 dkf Exp $ */ #include "tkPort.h" @@ -1143,24 +1143,24 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv) packPtr->flags |= OLD_STYLE; for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; - char *curOpt = Tcl_GetStringFromObj(curOptPtr, (int *) &length); + char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length); c = curOpt[0]; if ((c == 't') - && (strncmp(curOpt, "top", (size_t) length)) == 0) { + && (strncmp(curOpt, "top", (unsigned) length)) == 0) { packPtr->side = TOP; } else if ((c == 'b') - && (strncmp(curOpt, "bottom", (size_t) length)) == 0) { + && (strncmp(curOpt, "bottom", (unsigned) length)) == 0) { packPtr->side = BOTTOM; } else if ((c == 'l') - && (strncmp(curOpt, "left", (size_t) length)) == 0) { + && (strncmp(curOpt, "left", (unsigned) length)) == 0) { packPtr->side = LEFT; } else if ((c == 'r') - && (strncmp(curOpt, "right", (size_t) length)) == 0) { + && (strncmp(curOpt, "right", (unsigned) length)) == 0) { packPtr->side = RIGHT; } else if ((c == 'e') - && (strncmp(curOpt, "expand", (size_t) length)) == 0) { + && (strncmp(curOpt, "expand", (unsigned) length)) == 0) { packPtr->flags |= EXPAND; } else if ((c == 'f') && (strcmp(curOpt, "fill")) == 0) { @@ -1198,7 +1198,7 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv) packPtr->iPadY = 0; index++; } else if ((c == 'f') && (length > 1) - && (strncmp(curOpt, "frame", (size_t) length) == 0)) { + && (strncmp(curOpt, "frame", (unsigned) length) == 0)) { if (optionCount < (index+2)) { Tcl_AppendResult(interp, "wrong # args: \"frame\" ", "option must be followed by anchor point", diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 505032f..e286851 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkPanedWindow.c,v 1.13.2.8 2005/05/31 05:22:06 hobbs Exp $ + * RCS: @(#) $Id: tkPanedWindow.c,v 1.13.2.9 2005/08/11 12:17:09 dkf Exp $ */ #include "tkPort.h" @@ -349,7 +349,7 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv) } tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), - Tcl_GetStringFromObj(objv[1], NULL), (char *) NULL); + Tcl_GetStringFromObj(objv[1], NULL), NULL); if (tkwin == NULL) { return TCL_ERROR; } |