From 6d61d799f483c98a1e0aeb624fa001a7fce24af0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 2 Apr 2019 18:18:31 +0000 Subject: More use of Tcl_NewWideIntObj(), and more internal use of (size_t), for bigger ranges. --- doc/scale.n | 2 +- generic/tkCanvas.c | 18 ++++----- generic/tkCmds.c | 58 +++++++++++++-------------- generic/tkConfig.c | 6 +-- generic/tkEntry.c | 20 +++++----- generic/tkFileFilter.c | 12 +++--- generic/tkFont.c | 8 ++-- generic/tkGrid.c | 40 +++++++++---------- generic/tkImage.c | 4 +- generic/tkImgPhoto.c | 10 ++--- generic/tkListbox.c | 16 ++++---- generic/tkPack.c | 6 +-- generic/tkPanedWindow.c | 14 +++---- generic/tkScale.c | 4 +- generic/tkScrollbar.c | 8 ++-- generic/tkText.c | 101 ++++++++++++++++++++++++------------------------ win/tkWinMenu.c | 10 ++--- win/ttkWinXPTheme.c | 12 +++--- 18 files changed, 175 insertions(+), 174 deletions(-) diff --git a/doc/scale.n b/doc/scale.n index b1f1981..d6407a0 100644 --- a/doc/scale.n +++ b/doc/scale.n @@ -78,7 +78,7 @@ specified by the \fB\-activebackground\fR option. .OP \-tickinterval tickInterval TickInterval Must be a real value. Determines the spacing between numerical -tick marks displayed below or to the left of the slider. The values will all be displayed with the same number of decimal places, which will be enough to ensure they are all accurate to within 20% of a tick interval. +tick marks displayed below or to the left of the slider. The values will all be displayed with the same number of decimal places, which will be enough to ensure they are all accurate to within 20% of a tick interval. If 0, no tick marks will be displayed. .OP \-to to To Specifies a real value corresponding diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index f3778a6..6db501b 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -831,10 +831,10 @@ CanvasWidgetCmd( if (gotAny) { Tcl_Obj *resultObjs[4]; - resultObjs[0] = Tcl_NewIntObj(x1); - resultObjs[1] = Tcl_NewIntObj(y1); - resultObjs[2] = Tcl_NewIntObj(x2); - resultObjs[3] = Tcl_NewIntObj(y2); + resultObjs[0] = Tcl_NewWideIntObj(x1); + resultObjs[1] = Tcl_NewWideIntObj(y1); + resultObjs[2] = Tcl_NewWideIntObj(x2); + resultObjs[3] = Tcl_NewWideIntObj(y2); Tcl_SetObjResult(interp, Tcl_NewListObj(4, resultObjs)); } break; @@ -1239,7 +1239,7 @@ CanvasWidgetCmd( itemPtr->redraw_flags |= FORCE_REDRAW; EventuallyRedrawItem(canvasPtr, itemPtr); canvasPtr->flags |= REPICK_NEEDED; - Tcl_SetObjResult(interp, Tcl_NewIntObj(itemPtr->id)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(itemPtr->id)); break; } case CANV_DCHARS: { @@ -1385,7 +1385,7 @@ CanvasWidgetCmd( itemPtr = canvasPtr->textInfo.focusItemPtr; if (objc == 2) { if (itemPtr != NULL) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(itemPtr->id)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(itemPtr->id)); } goto done; } @@ -1477,7 +1477,7 @@ CanvasWidgetCmd( if (result != TCL_OK) { goto done; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); break; } case CANV_INSERT: { @@ -1924,7 +1924,7 @@ CanvasWidgetCmd( } if (canvasPtr->textInfo.selItemPtr != NULL) { Tcl_SetObjResult(interp, - Tcl_NewIntObj(canvasPtr->textInfo.selItemPtr->id)); + Tcl_NewWideIntObj(canvasPtr->textInfo.selItemPtr->id)); } break; case CANV_TO: @@ -4441,7 +4441,7 @@ DoItem( */ if (tag == NULL) { - Tcl_ListObjAppendElement(NULL, accumObj, Tcl_NewIntObj(itemPtr->id)); + Tcl_ListObjAppendElement(NULL, accumObj, Tcl_NewWideIntObj(itemPtr->id)); return; } diff --git a/generic/tkCmds.c b/generic/tkCmds.c index cefd5fc..391d906 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -746,15 +746,15 @@ CaretCmd( Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj("-height", 7)); Tcl_ListObjAppendElement(interp, objPtr, - Tcl_NewIntObj(caretPtr->height)); + Tcl_NewWideIntObj(caretPtr->height)); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj("-x", 2)); Tcl_ListObjAppendElement(interp, objPtr, - Tcl_NewIntObj(caretPtr->x)); + Tcl_NewWideIntObj(caretPtr->x)); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj("-y", 2)); Tcl_ListObjAppendElement(interp, objPtr, - Tcl_NewIntObj(caretPtr->y)); + Tcl_NewWideIntObj(caretPtr->y)); Tcl_SetObjResult(interp, objPtr); } else if (objc == 3) { int value; @@ -774,7 +774,7 @@ CaretCmd( } else /* if (index == TK_CARET_HEIGHT) -- last case */ { value = caretPtr->height; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(value)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value)); } else { int i, value, x = 0, y = 0, height = -1; @@ -1363,7 +1363,7 @@ Tk_WinfoObjCmd( switch ((enum options) index) { case WIN_CELLS: Tcl_SetObjResult(interp, - Tcl_NewIntObj(Tk_Visual(tkwin)->map_entries)); + Tcl_NewWideIntObj(Tk_Visual(tkwin)->map_entries)); break; case WIN_CHILDREN: { Tcl_Obj *strPtr, *resultPtr = Tcl_NewObj(); @@ -1386,14 +1386,14 @@ Tk_WinfoObjCmd( Tcl_NewBooleanObj(TkpCmapStressed(tkwin,Tk_Colormap(tkwin)))); break; case WIN_DEPTH: - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_Depth(tkwin))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Depth(tkwin))); break; case WIN_GEOMETRY: Tcl_SetObjResult(interp, Tcl_ObjPrintf("%dx%d+%d+%d", Tk_Width(tkwin), Tk_Height(tkwin), Tk_X(tkwin), Tk_Y(tkwin))); break; case WIN_HEIGHT: - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_Height(tkwin))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Height(tkwin))); break; case WIN_ID: { char buf[TCL_INTEGER_SPACE]; @@ -1444,28 +1444,28 @@ Tk_WinfoObjCmd( if (useX & useY) { Tcl_Obj *xyObj[2]; - xyObj[0] = Tcl_NewIntObj(x); - xyObj[1] = Tcl_NewIntObj(y); + xyObj[0] = Tcl_NewWideIntObj(x); + xyObj[1] = Tcl_NewWideIntObj(y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, xyObj)); } else if (useX) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(x)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x)); } else { - Tcl_SetObjResult(interp, Tcl_NewIntObj(y)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(y)); } break; case WIN_REQHEIGHT: - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_ReqHeight(tkwin))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_ReqHeight(tkwin))); break; case WIN_REQWIDTH: - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_ReqWidth(tkwin))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_ReqWidth(tkwin))); break; case WIN_ROOTX: Tk_GetRootCoords(tkwin, &x, &y); - Tcl_SetObjResult(interp, Tcl_NewIntObj(x)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x)); break; case WIN_ROOTY: Tk_GetRootCoords(tkwin, &x, &y); - Tcl_SetObjResult(interp, Tcl_NewIntObj(y)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(y)); break; case WIN_SCREEN: Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s.%d", @@ -1473,27 +1473,27 @@ Tk_WinfoObjCmd( break; case WIN_SCREENCELLS: Tcl_SetObjResult(interp, - Tcl_NewIntObj(CellsOfScreen(Tk_Screen(tkwin)))); + Tcl_NewWideIntObj(CellsOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENDEPTH: Tcl_SetObjResult(interp, - Tcl_NewIntObj(DefaultDepthOfScreen(Tk_Screen(tkwin)))); + Tcl_NewWideIntObj(DefaultDepthOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENHEIGHT: Tcl_SetObjResult(interp, - Tcl_NewIntObj(HeightOfScreen(Tk_Screen(tkwin)))); + Tcl_NewWideIntObj(HeightOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENWIDTH: Tcl_SetObjResult(interp, - Tcl_NewIntObj(WidthOfScreen(Tk_Screen(tkwin)))); + Tcl_NewWideIntObj(WidthOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENMMHEIGHT: Tcl_SetObjResult(interp, - Tcl_NewIntObj(HeightMMOfScreen(Tk_Screen(tkwin)))); + Tcl_NewWideIntObj(HeightMMOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENMMWIDTH: Tcl_SetObjResult(interp, - Tcl_NewIntObj(WidthMMOfScreen(Tk_Screen(tkwin)))); + Tcl_NewWideIntObj(WidthMMOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENVISUAL: class = DefaultVisualOfScreen(Tk_Screen(tkwin))->class; @@ -1539,28 +1539,28 @@ Tk_WinfoObjCmd( break; case WIN_VROOTHEIGHT: Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height); - Tcl_SetObjResult(interp, Tcl_NewIntObj(height)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(height)); break; case WIN_VROOTWIDTH: Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height); - Tcl_SetObjResult(interp, Tcl_NewIntObj(width)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(width)); break; case WIN_VROOTX: Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height); - Tcl_SetObjResult(interp, Tcl_NewIntObj(x)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x)); break; case WIN_VROOTY: Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height); - Tcl_SetObjResult(interp, Tcl_NewIntObj(y)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(y)); break; case WIN_WIDTH: - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_Width(tkwin))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Width(tkwin))); break; case WIN_X: - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_X(tkwin))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_X(tkwin))); break; case WIN_Y: - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tk_Y(tkwin))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Y(tkwin))); break; /* @@ -1735,7 +1735,7 @@ Tk_WinfoObjCmd( if (Tk_GetPixels(interp, tkwin, string, &pixels) != TCL_OK) { return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(pixels)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pixels)); break; } case WIN_RGB: { diff --git a/generic/tkConfig.c b/generic/tkConfig.c index b9499e5..892692a 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -1874,10 +1874,10 @@ GetObjectForOption( objPtr = NULL; switch (optionPtr->specPtr->type) { case TK_OPTION_BOOLEAN: - objPtr = Tcl_NewIntObj(*((int *) internalPtr)); + objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); break; case TK_OPTION_INT: - objPtr = Tcl_NewIntObj(*((int *) internalPtr)); + objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); break; case TK_OPTION_DOUBLE: objPtr = Tcl_NewDoubleObj(*((double *) internalPtr)); @@ -1951,7 +1951,7 @@ GetObjectForOption( *((Tk_Anchor *) internalPtr)), -1); break; case TK_OPTION_PIXELS: - objPtr = Tcl_NewIntObj(*((int *) internalPtr)); + objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); break; case TK_OPTION_WINDOW: { Tk_Window tkwin = *((Tk_Window *) internalPtr); diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 7e94d9b..fea83b5 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -640,10 +640,10 @@ EntryWidgetObjCmd( index--; } Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height); - bbox[0] = Tcl_NewIntObj(x + entryPtr->layoutX); - bbox[1] = Tcl_NewIntObj(y + entryPtr->layoutY); - bbox[2] = Tcl_NewIntObj(width); - bbox[3] = Tcl_NewIntObj(height); + bbox[0] = Tcl_NewWideIntObj(x + entryPtr->layoutX); + bbox[1] = Tcl_NewWideIntObj(y + entryPtr->layoutY); + bbox[2] = Tcl_NewWideIntObj(width); + bbox[3] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(4, bbox)); break; } @@ -734,7 +734,7 @@ EntryWidgetObjCmd( &index) != TCL_OK) { goto error; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); break; } @@ -3840,10 +3840,10 @@ SpinboxWidgetObjCmd( index--; } Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height); - bbox[0] = Tcl_NewIntObj(x + entryPtr->layoutX); - bbox[1] = Tcl_NewIntObj(y + entryPtr->layoutY); - bbox[2] = Tcl_NewIntObj(width); - bbox[3] = Tcl_NewIntObj(height); + bbox[0] = Tcl_NewWideIntObj(x + entryPtr->layoutX); + bbox[1] = Tcl_NewWideIntObj(y + entryPtr->layoutY); + bbox[2] = Tcl_NewWideIntObj(width); + bbox[3] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(4, bbox)); break; } @@ -3954,7 +3954,7 @@ SpinboxWidgetObjCmd( &index) != TCL_OK) { goto error; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); break; } diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index 8588d70..6cb188b 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -262,8 +262,8 @@ AddClause( */ for (i=0; i 0 && globList != NULL) { for (i=0; iascent + fmPtr->descent; break; case 3: i = fmPtr->fixed; break; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(i)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(i)); } Tk_FreeFont(tkfont); break; @@ -3494,9 +3494,9 @@ GetAttributeInfoObj( case FONT_SIZE: if (faPtr->size >= 0.0) { - valuePtr = Tcl_NewIntObj((int)(faPtr->size + 0.5)); + valuePtr = Tcl_NewWideIntObj((Tcl_WideInt)(faPtr->size + 0.5)); } else { - valuePtr = Tcl_NewIntObj(-(int)(-faPtr->size + 0.5)); + valuePtr = Tcl_NewWideIntObj(-(Tcl_WideInt)(-faPtr->size + 0.5)); } break; diff --git a/generic/tkGrid.c b/generic/tkGrid.c index c632793..436151a 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -292,8 +292,8 @@ static void GridLostSlaveProc(ClientData clientData, Tk_Window tkwin); static void GridReqProc(ClientData clientData, Tk_Window tkwin); static void InitMasterData(Gridder *masterPtr); -static Tcl_Obj * NewPairObj(int, int); -static Tcl_Obj * NewQuadObj(int, int, int, int); +static Tcl_Obj * NewPairObj(Tcl_WideInt, Tcl_WideInt); +static Tcl_Obj * NewQuadObj(Tcl_WideInt, Tcl_WideInt, Tcl_WideInt, Tcl_WideInt); static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn, int maxOffset); static void SetGridSize(Gridder *gridPtr); @@ -741,13 +741,13 @@ GridInfoCommand( Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), TkNewWindowObj(slavePtr->masterPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1), - Tcl_NewIntObj(slavePtr->column)); + Tcl_NewWideIntObj(slavePtr->column)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1), - Tcl_NewIntObj(slavePtr->row)); + Tcl_NewWideIntObj(slavePtr->row)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1), - Tcl_NewIntObj(slavePtr->numCols)); + Tcl_NewWideIntObj(slavePtr->numCols)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1), - Tcl_NewIntObj(slavePtr->numRows)); + Tcl_NewWideIntObj(slavePtr->numRows)); TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX); TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY); TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft, slavePtr->padX); @@ -1055,17 +1055,17 @@ GridRowColumnConfigureCommand( Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-minsize", -1)); - Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(minsize)); + Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(minsize)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-pad", -1)); - Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(pad)); + Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(pad)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-uniform", -1)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj(uniform == NULL ? "" : uniform, -1)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-weight", -1)); - Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(weight)); + Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(weight)); Tcl_SetObjResult(interp, res); Tcl_DecrRefCount(listCopy); return TCL_OK; @@ -1082,10 +1082,10 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } if (index == ROWCOL_MINSIZE) { - Tcl_SetObjResult(interp, Tcl_NewIntObj( + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].minSize : 0)); } else if (index == ROWCOL_WEIGHT) { - Tcl_SetObjResult(interp, Tcl_NewIntObj( + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].weight : 0)); } else if (index == ROWCOL_UNIFORM) { Tk_Uid value = (ok == TCL_OK) ? slotPtr[slot].uniform : ""; @@ -1093,7 +1093,7 @@ GridRowColumnConfigureCommand( Tcl_SetObjResult(interp, Tcl_NewStringObj( (value == NULL) ? "" : value, -1)); } else if (index == ROWCOL_PAD) { - Tcl_SetObjResult(interp, Tcl_NewIntObj( + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].pad : 0)); } Tcl_DecrRefCount(listCopy); @@ -3631,12 +3631,12 @@ StringToSticky( static Tcl_Obj * NewPairObj( - int val1, int val2) + Tcl_WideInt val1, Tcl_WideInt val2) { Tcl_Obj *ary[2]; - ary[0] = Tcl_NewIntObj(val1); - ary[1] = Tcl_NewIntObj(val2); + ary[0] = Tcl_NewWideIntObj(val1); + ary[1] = Tcl_NewWideIntObj(val2); return Tcl_NewListObj(2, ary); } @@ -3658,14 +3658,14 @@ NewPairObj( static Tcl_Obj * NewQuadObj( - int val1, int val2, int val3, int val4) + Tcl_WideInt val1, Tcl_WideInt val2, Tcl_WideInt val3, Tcl_WideInt val4) { Tcl_Obj *ary[4]; - ary[0] = Tcl_NewIntObj(val1); - ary[1] = Tcl_NewIntObj(val2); - ary[2] = Tcl_NewIntObj(val3); - ary[3] = Tcl_NewIntObj(val4); + ary[0] = Tcl_NewWideIntObj(val1); + ary[1] = Tcl_NewWideIntObj(val2); + ary[2] = Tcl_NewWideIntObj(val3); + ary[3] = Tcl_NewWideIntObj(val4); return Tcl_NewListObj(4, ary); } diff --git a/generic/tkImage.c b/generic/tkImage.c index 32e09c0..3829dff 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -474,7 +474,7 @@ Tk_ImageObjCmd( switch ((enum options) index) { case IMAGE_HEIGHT: - Tcl_SetObjResult(interp, Tcl_NewIntObj(masterPtr->height)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(masterPtr->height)); break; case IMAGE_INUSE: Tcl_SetObjResult(interp, Tcl_NewBooleanObj( @@ -487,7 +487,7 @@ Tk_ImageObjCmd( } break; case IMAGE_WIDTH: - Tcl_SetObjResult(interp, Tcl_NewIntObj(masterPtr->width)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(masterPtr->width)); break; default: Tcl_Panic("can't happen"); diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index e1d54dd..c1055ac 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -849,10 +849,10 @@ ImgPhotoCmd( */ pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; - channels[0] = Tcl_NewIntObj(pixelPtr[0]); - channels[1] = Tcl_NewIntObj(pixelPtr[1]); - channels[2] = Tcl_NewIntObj(pixelPtr[2]); - channels[3] = Tcl_NewIntObj(pixelPtr[3]); + channels[0] = Tcl_NewWideIntObj(pixelPtr[0]); + channels[1] = Tcl_NewWideIntObj(pixelPtr[1]); + channels[2] = Tcl_NewWideIntObj(pixelPtr[2]); + channels[3] = Tcl_NewWideIntObj(pixelPtr[3]); Tcl_SetObjResult(interp, Tcl_NewListObj(channelCount, channels)); return TCL_OK; } @@ -1141,7 +1141,7 @@ ImgPhotoCmd( if (boolMode) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj( ! pixelPtr[3])); } else { - Tcl_SetObjResult(interp, Tcl_NewIntObj(pixelPtr[3])); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pixelPtr[3])); } return TCL_OK; } diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 3a0237c..fec3759 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -728,7 +728,7 @@ ListboxWidgetObjCmd( objPtr = Tcl_NewObj(); for (i = 0; i < listPtr->nElements; i++) { if (Tcl_FindHashEntry(listPtr->selection, KEY(i))) { - Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewIntObj(i)); + Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(i)); } } Tcl_SetObjResult(interp, objPtr); @@ -841,7 +841,7 @@ ListboxWidgetObjCmd( if (result != TCL_OK) { break; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); result = TCL_OK; break; @@ -956,7 +956,7 @@ ListboxWidgetObjCmd( break; } index = NearestListboxElement(listPtr, y); - Tcl_SetObjResult(interp, Tcl_NewIntObj(index)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); result = TCL_OK; break; } @@ -1044,7 +1044,7 @@ ListboxWidgetObjCmd( result = TCL_ERROR; break; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(listPtr->nElements)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(listPtr->nElements)); result = TCL_OK; break; case COMMAND_XVIEW: @@ -1130,10 +1130,10 @@ ListboxBboxSubCmd( } y = ((index - listPtr->topIndex)*listPtr->lineHeight) + listPtr->inset + listPtr->selBorderWidth; - results[0] = Tcl_NewIntObj(x); - results[1] = Tcl_NewIntObj(y); - results[2] = Tcl_NewIntObj(pixelWidth); - results[3] = Tcl_NewIntObj(fm.linespace); + results[0] = Tcl_NewWideIntObj(x); + results[1] = Tcl_NewWideIntObj(y); + results[2] = Tcl_NewWideIntObj(pixelWidth); + results[3] = Tcl_NewWideIntObj(fm.linespace); Tcl_SetObjResult(interp, Tcl_NewListObj(4, results)); } return TCL_OK; diff --git a/generic/tkPack.c b/generic/tkPack.c index aabfe1f..c1b6345 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -163,10 +163,10 @@ TkAppendPadAmount( if (halfSpace*2 == allSpace) { Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, -1), - Tcl_NewIntObj(halfSpace)); + Tcl_NewWideIntObj(halfSpace)); } else { - padding[0] = Tcl_NewIntObj(halfSpace); - padding[1] = Tcl_NewIntObj(allSpace - halfSpace); + padding[0] = Tcl_NewWideIntObj(halfSpace); + padding[1] = Tcl_NewWideIntObj(allSpace - halfSpace); Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, -1), Tcl_NewListObj(2, padding)); } diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index faec67a..740ce41 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -1132,8 +1132,8 @@ PanedWindowSashCommand( } slavePtr = pwPtr->slaves[sash]; - coords[0] = Tcl_NewIntObj(slavePtr->sashx); - coords[1] = Tcl_NewIntObj(slavePtr->sashy); + coords[0] = Tcl_NewWideIntObj(slavePtr->sashx); + coords[1] = Tcl_NewWideIntObj(slavePtr->sashy); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); break; @@ -1166,8 +1166,8 @@ PanedWindowSashCommand( pwPtr->slaves[sash]->markx = x; pwPtr->slaves[sash]->marky = y; } else { - coords[0] = Tcl_NewIntObj(pwPtr->slaves[sash]->markx); - coords[1] = Tcl_NewIntObj(pwPtr->slaves[sash]->marky); + coords[0] = Tcl_NewWideIntObj(pwPtr->slaves[sash]->markx); + coords[1] = Tcl_NewWideIntObj(pwPtr->slaves[sash]->marky); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); } break; @@ -2877,8 +2877,8 @@ PanedWindowProxyCommand( return TCL_ERROR; } - coords[0] = Tcl_NewIntObj(pwPtr->proxyx); - coords[1] = Tcl_NewIntObj(pwPtr->proxyy); + coords[0] = Tcl_NewWideIntObj(pwPtr->proxyx); + coords[1] = Tcl_NewWideIntObj(pwPtr->proxyy); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); break; @@ -3142,7 +3142,7 @@ PanedWindowIdentifyCoords( if (found != -1) { Tcl_Obj *list[2]; - list[0] = Tcl_NewIntObj(found); + list[0] = Tcl_NewWideIntObj(found); list[1] = Tcl_NewStringObj((isHandle ? "handle" : "sash"), -1); Tcl_SetObjResult(interp, Tcl_NewListObj(2, list)); } diff --git a/generic/tkScale.c b/generic/tkScale.c index 200b107..919d8d0 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -451,8 +451,8 @@ ScaleWidgetObjCmd( y = scalePtr->horizTroughY + scalePtr->width/2 + scalePtr->borderWidth; } - coords[0] = Tcl_NewIntObj(x); - coords[1] = Tcl_NewIntObj(y); + coords[0] = Tcl_NewWideIntObj(x); + coords[1] = Tcl_NewWideIntObj(y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); break; } diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 030767b..4dba6e6 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -381,10 +381,10 @@ ScrollbarWidgetObjCmd( } #ifndef TK_NO_DEPRECATED if (scrollPtr->flags & OLD_STYLE_COMMANDS) { - resObjs[0] = Tcl_NewIntObj(scrollPtr->totalUnits); - resObjs[1] = Tcl_NewIntObj(scrollPtr->windowUnits); - resObjs[2] = Tcl_NewIntObj(scrollPtr->firstUnit); - resObjs[3] = Tcl_NewIntObj(scrollPtr->lastUnit); + resObjs[0] = Tcl_NewWideIntObj(scrollPtr->totalUnits); + resObjs[1] = Tcl_NewWideIntObj(scrollPtr->windowUnits); + resObjs[2] = Tcl_NewWideIntObj(scrollPtr->firstUnit); + resObjs[3] = Tcl_NewWideIntObj(scrollPtr->lastUnit); Tcl_SetObjResult(interp, Tcl_NewListObj(4, resObjs)); break; } diff --git a/generic/tkText.c b/generic/tkText.c index fc63992..688fdce 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -748,10 +748,10 @@ TextWidgetObjCmd( NULL) == 0) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(x)); - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(y)); - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(width)); - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(height)); + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(x)); + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(y)); + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(width)); + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(height)); Tcl_SetObjResult(interp, listObj); } @@ -1019,7 +1019,7 @@ TextWidgetObjCmd( countDone: found++; if (found == 1) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(value)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value)); } else { if (found == 2) { /* @@ -1031,7 +1031,7 @@ TextWidgetObjCmd( Tcl_ListObjAppendElement(NULL, objPtr, Tcl_GetObjResult(interp)); } - Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewIntObj(value)); + Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(value)); } } @@ -1043,7 +1043,7 @@ TextWidgetObjCmd( int value = CountIndices(textPtr, indexFromPtr, indexToPtr, COUNT_INDICES); - Tcl_SetObjResult(interp, Tcl_NewIntObj(value)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value)); } else if (found > 1) { Tcl_SetObjResult(interp, objPtr); } @@ -1239,11 +1239,11 @@ TextWidgetObjCmd( &base) == 0) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(x)); - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(y)); - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(width)); - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(height)); - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewIntObj(base)); + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(x)); + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(y)); + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(width)); + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(height)); + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(base)); Tcl_SetObjResult(interp, listObj); } @@ -4273,7 +4273,7 @@ TextSearchFoundMatch( int matchLength) /* Length also in bytes/chars as per search * type. */ { - int numChars; + size_t numChars; int leftToScan; TkTextIndex curIndex, foundIndex; TkTextSegment *segPtr; @@ -4313,7 +4313,7 @@ TextSearchFoundMatch( if (searchSpecPtr->strictLimits && lineNum == searchSpecPtr->stopLine) { if (searchSpecPtr->backwards ^ - ((matchOffset + numChars) > searchSpecPtr->stopOffset)) { + ((matchOffset + numChars + 1) > (size_t) searchSpecPtr->stopOffset + 1)) { return 0; } } @@ -4466,7 +4466,7 @@ TextSearchFoundMatch( */ if (searchSpecPtr->varPtr != NULL) { - Tcl_Obj *tmpPtr = Tcl_NewIntObj(numChars); + Tcl_Obj *tmpPtr = Tcl_NewWideIntObj(numChars); if (searchSpecPtr->all) { if (searchSpecPtr->countPtr == NULL) { searchSpecPtr->countPtr = Tcl_NewObj(); @@ -5759,7 +5759,8 @@ SearchCore( * they are Unicode char offsets. */ - int firstOffset, lastOffset, matchOffset, matchLength; + int firstOffset, lastOffset; + size_t matchOffset, matchLength; int passes; int lineNum = searchSpecPtr->startLine; int code = TCL_OK; @@ -5780,9 +5781,9 @@ SearchCore( #define LOTS_OF_MATCHES 20 int matchNum = LOTS_OF_MATCHES; - int smArray[2 * LOTS_OF_MATCHES]; - int *storeMatch = smArray; - int *storeLength = smArray + LOTS_OF_MATCHES; + size_t smArray[2 * LOTS_OF_MATCHES]; + size_t *storeMatch = smArray; + size_t *storeLength = smArray + LOTS_OF_MATCHES; int lastBackwardsLineMatch = -1; int lastBackwardsMatchOffset = -1; @@ -5832,7 +5833,7 @@ SearchCore( * it has dual purpose. */ - pattern = Tcl_GetStringFromObj(patObj, &matchLength); + pattern = TkGetStringFromObj(patObj, &matchLength); nl = strchr(pattern, '\n'); /* @@ -5967,11 +5968,11 @@ SearchCore( do { int ch; const char *p; - int lastFullLine = lastOffset; + size_t lastFullLine = lastOffset; if (firstNewLine == -1) { if (searchSpecPtr->strictLimits - && (firstOffset + matchLength > lastOffset)) { + && (firstOffset + matchLength + 1 > (size_t)lastOffset + 1)) { /* * Not enough characters to match. */ @@ -6001,7 +6002,7 @@ SearchCore( } while (p >= startOfLine + firstOffset) { if (matchLength == 0 || (p[0] == c && !strncmp( - p, pattern, (size_t) matchLength))) { + p, pattern, matchLength))) { goto backwardsMatch; } p--; @@ -6089,14 +6090,14 @@ SearchCore( * exact searches. */ - if ((lastTotal - skipFirst) >= matchLength) { + if ((size_t)lastTotal - skipFirst + 1 >= matchLength + 1) { /* * We now have enough text to match, so we * make a final test and break whatever the * result. */ - if (strncmp(p,pattern,(size_t)matchLength)) { + if (strncmp(p, pattern, matchLength)) { p = NULL; } break; @@ -6171,7 +6172,7 @@ SearchCore( } } else { firstOffset = matchLength ? p - startOfLine + matchLength - : p - startOfLine + 1; + : p - startOfLine + (size_t)1; if (firstOffset >= lastOffset) { /* * Now, we have to be careful not to find @@ -6211,7 +6212,7 @@ SearchCore( do { Tcl_RegExpInfo info; int match; - int lastFullLine = lastOffset; + size_t lastFullLine = lastOffset; match = Tcl_RegExpExecObj(interp, regexp, theLine, firstOffset, 1, (firstOffset>0 ? TCL_REG_NOTBOL : 0)); @@ -6229,9 +6230,9 @@ SearchCore( if (!match || ((info.extendStart == info.matches[0].start) - && (info.matches[0].end == lastOffset-firstOffset))) { + && ((size_t) info.matches[0].end == (size_t) lastOffset - firstOffset))) { int extraLines = 0; - int prevFullLine; + size_t prevFullLine; /* * If we find a match that overlaps more than one line, we @@ -6247,7 +6248,7 @@ SearchCore( lastNonOverlap = lastTotal; } - if (info.extendStart < 0) { + if ((size_t) info.extendStart == (size_t) -1) { /* * No multi-line match is possible. */ @@ -6344,9 +6345,9 @@ SearchCore( */ if ((match && - firstOffset+info.matches[0].end != lastTotal && - firstOffset+info.matches[0].end < prevFullLine) - || info.extendStart < 0) { + firstOffset+(size_t) info.matches[0].end != (size_t) lastTotal && + firstOffset+(size_t) info.matches[0].end + 1 < prevFullLine + 1) + || (size_t) info.extendStart == (size_t) -1) { break; } @@ -6357,10 +6358,10 @@ SearchCore( * that line. */ - if (match && (info.matches[0].start >= lastOffset)) { + if (match && ((size_t) info.matches[0].start + 1 >= (size_t) lastOffset + 1)) { break; } - if (match && ((firstOffset + info.matches[0].end) + if (match && ((firstOffset + (size_t) info.matches[0].end) >= prevFullLine)) { if (extraLines > 0) { extraLinesSearched = extraLines - 1; @@ -6414,8 +6415,8 @@ SearchCore( * Possible overlap or enclosure. */ - if (thisOffset-lastNonOverlap >= - lastBackwardsMatchOffset+matchLength){ + if ((size_t)thisOffset - lastNonOverlap >= + lastBackwardsMatchOffset + matchLength + 1){ /* * Totally encloses previous match, so * forget the previous match. @@ -6496,12 +6497,12 @@ SearchCore( * previous match. */ - if (matchOffset == -1 || + if (matchOffset == (size_t)-1 || ((searchSpecPtr->all || searchSpecPtr->backwards) - && ((firstOffset < matchOffset) - || ((firstOffset + info.matches[0].end - - info.matches[0].start) - > (matchOffset + matchLength))))) { + && (((size_t)firstOffset + 1< matchOffset + 1) + || ((firstOffset + (size_t) info.matches[0].end + - (size_t) info.matches[0].start) + > matchOffset + matchLength)))) { matchOffset = firstOffset; matchLength = info.matches[0].end - info.matches[0].start; @@ -6519,9 +6520,9 @@ SearchCore( * matches on the heap. */ - int *newArray = - ckalloc(4 * matchNum * sizeof(int)); - memcpy(newArray, storeMatch, matchNum*sizeof(int)); + size_t *newArray = + ckalloc(4 * matchNum * sizeof(size_t)); + memcpy(newArray, storeMatch, matchNum*sizeof(size_t)); memcpy(newArray + 2*matchNum, storeLength, matchNum * sizeof(int)); if (storeMatch != smArray) { @@ -6558,7 +6559,7 @@ SearchCore( * explicitly disallow overlapping matches. */ - if (matchLength > 0 && !searchSpecPtr->overlap + if (matchLength + 1 > 1 && !searchSpecPtr->overlap && !searchSpecPtr->backwards) { firstOffset += matchLength; if (firstOffset >= lastOffset) { @@ -6615,8 +6616,8 @@ SearchCore( * found which would exercise such a problem. */ } - if (storeMatch[matches] + storeLength[matches] - >= matchOffset + matchLength) { + if (storeMatch[matches] + storeLength[matches] + 1 + >= matchOffset + matchLength + 1) { /* * The new match totally encloses the previous one, so * we overwrite the previous one. @@ -6664,7 +6665,7 @@ SearchCore( * we are done. */ - if ((lastBackwardsLineMatch == -1) && (matchOffset >= 0) + if ((lastBackwardsLineMatch == -1) && (matchOffset != (size_t) -1) && !searchSpecPtr->all) { searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, lineInfo, theLine, matchOffset, matchLength); @@ -6791,7 +6792,7 @@ GetLineStartEnd( if (linePtr == NULL) { return Tcl_NewObj(); } - return Tcl_NewIntObj(1 + TkBTreeLinesTo(NULL, linePtr)); + return Tcl_NewWideIntObj(1 + TkBTreeLinesTo(NULL, linePtr)); } /* diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index df817ee..18a1260 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -1247,7 +1247,7 @@ TkWinHandleMenuEvent( hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *plParam); if (hashEntryPtr != NULL) { - int i, len, underline; + size_t i, len, underline; Tcl_Obj *labelPtr; WCHAR *wlabel; int menuChar; @@ -1262,18 +1262,18 @@ TkWinHandleMenuEvent( menuChar = Tcl_UniCharToUpper(LOWORD(*pwParam)); Tcl_DStringInit(&ds); - for (i = 0; i < (int)menuPtr->numEntries; i++) { + for (i = 0; i < (size_t)menuPtr->numEntries; i++) { underline = menuPtr->entries[i]->underline; labelPtr = menuPtr->entries[i]->labelPtr; - if ((underline >= 0) && (labelPtr != NULL)) { + if ((underline != (size_t)-1) && (labelPtr != NULL)) { /* * Ensure we don't exceed the label length, then check */ - const char *src = Tcl_GetStringFromObj(labelPtr, &len); + const char *src = TkGetStringFromObj(labelPtr, &len); Tcl_DStringFree(&ds); wlabel = (WCHAR *) Tcl_WinUtfToTChar(src, len, &ds); - if ((underline < len) && (menuChar == + if ((underline + 1 < len + 1) && (menuChar == Tcl_UniCharToUpper(wlabel[underline]))) { *plResult = (2 << 16) | i; returnResult = 1; diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index fd6571f..29f2829 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -826,13 +826,13 @@ static void TextElementSize( RECT rc = {0, 0}; HRESULT hr = S_OK; const char *src; - int len; + size_t len; Tcl_DString ds; if (!InitElementData(elementData, tkwin, 0)) return; - src = Tcl_GetStringFromObj(element->textObj, &len); + src = TkGetStringFromObj(element->textObj, &len); Tcl_WinUtfToTChar(src, len, &ds); hr = elementData->procs->GetThemeTextExtent( elementData->hTheme, @@ -865,13 +865,13 @@ static void TextElementDraw( RECT rc = BoxToRect(b); HRESULT hr = S_OK; const char *src; - int len; + size_t len; Tcl_DString ds; if (!InitElementData(elementData, tkwin, d)) return; - src = Tcl_GetStringFromObj(element->textObj, &len); + src = TkGetStringFromObj(element->textObj, &len); Tcl_WinUtfToTChar(src, len, &ds); hr = elementData->procs->DrawThemeText( elementData->hTheme, @@ -1116,7 +1116,7 @@ Ttk_CreateVsapiElement( Ttk_StateTable *stateTable; Ttk_Padding pad = {0, 0, 0, 0}; int flags = 0; - int length = 0; + size_t length = 0; char *name; LPWSTR wname; Ttk_ElementSpec *elementSpec = &GenericElementSpec; @@ -1138,7 +1138,7 @@ Ttk_CreateVsapiElement( if (Tcl_GetIntFromObj(interp, objv[1], &partId) != TCL_OK) { return TCL_ERROR; } - name = Tcl_GetStringFromObj(objv[0], &length); + name = TkGetStringFromObj(objv[0], &length); className = (WCHAR *) Tcl_WinUtfToTChar(name, length, &classBuf); /* flags or padding */ -- cgit v0.12