From 19cb6769c6c765a88656be5ff4c87bb90a21503a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 30 Aug 2024 23:03:06 +0000 Subject: Fix typo's. Backport more usefull parts from 9.0 --- generic/tkFont.c | 10 +- generic/tkGrab.c | 10 +- generic/tkGrid.c | 64 ++-- generic/tkImgBmap.c | 16 +- generic/tkImgGIF.c | 52 +-- generic/tkImgListFormat.c | 782 +++++++++++++++++++++++----------------------- generic/tkPointer.c | 12 +- generic/tkScrollbar.c | 16 +- tests/button.test | 8 +- tests/canvText.test | 2 +- tests/entry.test | 2 +- tests/font.test | 22 +- tests/imgBmap.test | 2 +- tests/message.test | 2 +- tests/spinbox.test | 2 +- 15 files changed, 502 insertions(+), 500 deletions(-) diff --git a/generic/tkFont.c b/generic/tkFont.c index bb0b34f..ecad770 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -633,7 +633,7 @@ Tk_FontObjCmd( } if ((namedHashPtr == NULL) || nfPtr->deletePending) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "named font \"%s\" doesn't exist", string)); + "named font \"%s\" does not exist", string)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "FONT", string, NULL); return TCL_ERROR; } @@ -1039,7 +1039,7 @@ TkDeleteNamedFont( if (namedHashPtr == NULL) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "named font \"%s\" doesn't exist", name)); + "named font \"%s\" does not exist", name)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "FONT", name, NULL); } return TCL_ERROR; @@ -3215,8 +3215,8 @@ TkIntersectAngledTextLayout( PointInQuadrilateral(cx, cy, rx[1], ry[1]) && PointInQuadrilateral(cx, cy, rx[2], ry[2]) && PointInQuadrilateral(cx, cy, rx[3], ry[3])) { - return 0; - } + return 0; + } } /* @@ -3754,7 +3754,7 @@ ParseFontNameObj( || (objc < 1)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "font \"%s\" doesn't exist", string)); + "font \"%s\" does not exist", string)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "FONT", string, NULL); } return TCL_ERROR; diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 5b7cbde..f131e83 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -524,24 +524,24 @@ Tk_Grab( if (grabResult == GrabNotViewable) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "grab failed: window not viewable", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRAB", "UNVIEWABLE", NULL); + Tcl_SetErrorCode(interp, "TK", "GRAB", "UNVIEWABLE", (char *)NULL); } else if (grabResult == AlreadyGrabbed) { alreadyGrabbed: Tcl_SetObjResult(interp, Tcl_NewStringObj( "grab failed: another application has grab", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRAB", "GRABBED", NULL); + Tcl_SetErrorCode(interp, "TK", "GRAB", "GRABBED", (char *)NULL); } else if (grabResult == GrabFrozen) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "grab failed: keyboard or pointer frozen", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRAB", "FROZEN", NULL); + Tcl_SetErrorCode(interp, "TK", "GRAB", "FROZEN", (char *)NULL); } else if (grabResult == GrabInvalidTime) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "grab failed: invalid time", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRAB", "BAD_TIME", NULL); + Tcl_SetErrorCode(interp, "TK", "GRAB", "BAD_TIME", (char *)NULL); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "grab failed for unknown reason (code %d)", grabResult)); - Tcl_SetErrorCode(interp, "TK", "GRAB", "UNKNOWN", NULL); + Tcl_SetErrorCode(interp, "TK", "GRAB", "UNKNOWN", (char *)NULL); } return TCL_ERROR; } diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 078ae9e..c4ebef6 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -417,7 +417,7 @@ Tk_GridObjCmd( /* This should not happen */ Tcl_SetObjResult(interp, Tcl_NewStringObj("internal error in grid", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "API_ABUSE", NULL); + Tcl_SetErrorCode(interp, "TK", "API_ABUSE", (char *)NULL); return TCL_ERROR; } @@ -1018,7 +1018,7 @@ GridRowColumnConfigureCommand( if (lObjc == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("no %s indices specified", (slotType == COLUMN) ? "column" : "row")); - Tcl_SetErrorCode(interp, "TK", "GRID", "NO_INDEX", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "NO_INDEX", (char *)NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; } @@ -1031,7 +1031,7 @@ GridRowColumnConfigureCommand( if (lObjc != 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "must specify a single element on retrieval", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRID", "USAGE", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "USAGE", (char *)NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; } @@ -1039,7 +1039,7 @@ GridRowColumnConfigureCommand( Tcl_AppendResult(interp, " (when retrieving options only integer indices are " "allowed)", NULL); - Tcl_SetErrorCode(interp, "TK", "GRID", "INDEX_FORMAT", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "INDEX_FORMAT", (char *)NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; } @@ -1144,14 +1144,14 @@ GridRowColumnConfigureCommand( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the window \"%s\" is not managed by \"%s\"", Tcl_GetString(lObjv[j]), Tcl_GetString(objv[2]))); - Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MANAGED", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MANAGED", (char *)NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; } } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "illegal index \"%s\"", Tcl_GetString(lObjv[j]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID_INDEX", NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID_INDEX", (char *)NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; } @@ -1175,7 +1175,7 @@ GridRowColumnConfigureCommand( "\"%s\" is out of range", Tcl_GetString(lObjv[j]))); Tcl_SetErrorCode(interp, "TK", "GRID", "INDEX_RANGE", - NULL); + (char *)NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; } @@ -1282,7 +1282,7 @@ GridRowColumnConfigureCommand( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid arg \"%s\": should be non-negative", Tcl_GetString(objv[i]))); - Tcl_SetErrorCode(interp, "TK", "GRID", "NEG_INDEX", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "NEG_INDEX", (char *)NULL); return TCL_ERROR; } @@ -1388,7 +1388,7 @@ GridContentCommand( if (value < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%d is an invalid value: should NOT be < 0", value)); - Tcl_SetErrorCode(interp, "TK", "GRID", "NEG_INDEX", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "NEG_INDEX", (char *)NULL); return TCL_ERROR; } if (index == CONTENT_COLUMN) { @@ -2553,8 +2553,8 @@ SetContentColumn( lastCol = ((newColumn >= 0) ? newColumn : 0) + newNumCols; if (lastCol >= MAX_ELEMENT) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("column out of bounds",-1)); - Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_COLUMN", NULL); + Tcl_SetObjResult(interp, Tcl_NewStringObj("column out of bounds", TCL_INDEX_NONE)); + Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_COLUMN", (char *)NULL); return TCL_ERROR; } @@ -2595,7 +2595,7 @@ SetContentRow( lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows; if (lastRow >= MAX_ELEMENT) { Tcl_SetObjResult(interp, Tcl_NewStringObj("row out of bounds", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_ROW", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_ROW", (char *)NULL); return TCL_ERROR; } @@ -3034,7 +3034,7 @@ ConfigureContent( if (length > 1 && i == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad argument \"%s\": must be name of window", string)); - Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", (char *)NULL); return TCL_ERROR; } if (length > 1 && firstChar == '-') { @@ -3044,7 +3044,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unexpected parameter \"%s\" in configure list:" " should be window name or option", string)); - Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", (char *)NULL); return TCL_ERROR; } @@ -3052,7 +3052,7 @@ ConfigureContent( (prevChar == REL_SKIP) || (prevChar == REL_VERT))) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "must specify window before shortcut '-'", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", (char *)NULL); return TCL_ERROR; } @@ -3064,7 +3064,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid window shortcut, \"%s\" should be '-', 'x', or '^'", string)); - Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", (char *)NULL); return TCL_ERROR; } numWindows = i; @@ -3072,7 +3072,7 @@ ConfigureContent( if ((objc - numWindows) & 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "extra option or option with no value", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", (char *)NULL); return TCL_ERROR; } @@ -3101,7 +3101,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad row value \"%s\": must be a non-negative integer", Tcl_GetString(objv[i+1]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "POSITIVE_INT", NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "POSITIVE_INT", (char *)NULL); return TCL_ERROR; } defaultRow = tmp; @@ -3167,7 +3167,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't manage \"%s\": it's a top-level window", Tcl_GetString(objv[j]))); - Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL); + Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", (char *)NULL); return TCL_ERROR; } contentPtr = GetGrid(content); @@ -3197,7 +3197,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad column value \"%s\": must be a non-negative integer", Tcl_GetString(objv[i+1]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", (char *)NULL); return TCL_ERROR; } if (SetContentColumn(interp, contentPtr, tmp, -1) != TCL_OK) { @@ -3210,7 +3210,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad columnspan value \"%s\": must be a positive integer", Tcl_GetString(objv[i+1]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", (char *)NULL); return TCL_ERROR; } if (SetContentColumn(interp, contentPtr, -1, tmp) != TCL_OK) { @@ -3225,7 +3225,7 @@ ConfigureContent( if (other == content) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "window can't be managed in itself", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); + Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", (char *)NULL); return TCL_ERROR; } positionGiven = 1; @@ -3240,7 +3240,7 @@ ConfigureContent( "bad stickyness value \"%s\": must be" " a string containing n, e, s, and/or w", Tcl_GetString(objv[i+1]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "STICKY", NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "STICKY", (char *)NULL); return TCL_ERROR; } contentPtr->sticky = sticky; @@ -3252,7 +3252,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipadx value \"%s\": must be positive screen distance", Tcl_GetString(objv[i+1]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", (char *)NULL); return TCL_ERROR; } contentPtr->iPadX = tmp * 2; @@ -3263,7 +3263,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipady value \"%s\": must be positive screen distance", Tcl_GetString(objv[i+1]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", (char *)NULL); return TCL_ERROR; } contentPtr->iPadY = tmp * 2; @@ -3286,7 +3286,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad row value \"%s\": must be a non-negative integer", Tcl_GetString(objv[i+1]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", (char *)NULL); return TCL_ERROR; } if (SetContentRow(interp, contentPtr, tmp, -1) != TCL_OK) { @@ -3299,7 +3299,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad rowspan value \"%s\": must be a positive integer", Tcl_GetString(objv[i+1]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", (char *)NULL); return TCL_ERROR; } if (SetContentRow(interp, contentPtr, -1, tmp) != TCL_OK) { @@ -3370,7 +3370,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\"", Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); - Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); + Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", (char *)NULL); Unlink(contentPtr); return TCL_ERROR; } @@ -3386,7 +3386,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\": would cause management loop", Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); - Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); + Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", (char *)NULL); Unlink(contentPtr); return TCL_ERROR; } @@ -3470,7 +3470,7 @@ ConfigureContent( if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't use '^', can't find container window", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", (char *)NULL); return TCL_ERROR; } @@ -3524,7 +3524,7 @@ ConfigureContent( if (!match) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't find content to extend with \"^\"", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", (char *)NULL); return TCL_ERROR; } } @@ -3532,7 +3532,7 @@ ConfigureContent( if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't determine container window", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", (char *)NULL); return TCL_ERROR; } SetGridSize(containerPtr); diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index c6f10b9..fca3e44 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -240,7 +240,7 @@ ImgBmapConfigureModel( int maskWidth, maskHeight, dummy1, dummy2; if (Tk_ConfigureWidget(modelPtr->interp, Tk_MainWindow(modelPtr->interp), - configSpecs, objc, (const char **) objv, (char *) modelPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { + configSpecs, objc, (const char **)objv, (char *)modelPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { return TCL_ERROR; } @@ -269,9 +269,9 @@ ImgBmapConfigureModel( || (modelPtr->maskDataString != NULL)) { if (modelPtr->data == NULL) { Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( - "cannot have mask without bitmap", TCL_INDEX_NONE)); + "cannot have a mask without a bitmap", TCL_INDEX_NONE)); Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", - "NO_BITMAP", NULL); + "NO_BITMAP", (char *)NULL); return TCL_ERROR; } modelPtr->maskData = TkGetBitmapData(modelPtr->interp, @@ -287,7 +287,7 @@ ImgBmapConfigureModel( Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( "bitmap and mask have different sizes", TCL_INDEX_NONE)); Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", - "MASK_SIZE", NULL); + "MASK_SIZE", (char *)NULL); return TCL_ERROR; } } @@ -488,7 +488,7 @@ TkGetBitmapData( Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get bitmap data from a file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "SAFE", "BITMAP_FILE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "BITMAP_FILE", (char *)NULL); return NULL; } expandedFileName = Tcl_TranslateFileName(NULL, fileName, &buffer); @@ -593,7 +593,7 @@ TkGetBitmapData( "format error in bitmap data; looks like it's an" " obsolete X10 bitmap file", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "BITMAP", "OBSOLETE", - NULL); + (char *)NULL); } goto errorCleanup; } @@ -637,7 +637,7 @@ TkGetBitmapData( if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "format error in bitmap data", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "BITMAP", "FORMAT", NULL); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "BITMAP", "FORMAT", (char *)NULL); } errorCleanup: @@ -1210,7 +1210,7 @@ ImgBmapPostscript( Tcl_SetObjResult(interp, Tcl_NewStringObj( "unable to generate postscript for bitmaps larger than 60000" " pixels", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "MEMLIMIT", NULL); + Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "MEMLIMIT", (char *)NULL); return TCL_ERROR; } diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 6e169fe..a04196d 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -469,7 +469,7 @@ FileReadGIF( "no value given for \"%s\" option", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "OPT_VALUE", - (char *) NULL); + (char *)NULL); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[++i], &index) != TCL_OK) { @@ -485,14 +485,14 @@ FileReadGIF( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't read GIF header from file \"%s\"", fileName)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "HEADER", - (char *) NULL); + (char *)NULL); return TCL_ERROR; } if ((fileWidth <= 0) || (fileHeight <= 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "GIF image file \"%s\" has dimension(s) <= 0", fileName)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "BOGUS_SIZE", - (char *) NULL); + (char *)NULL); return TCL_ERROR; } @@ -507,7 +507,7 @@ FileReadGIF( Tcl_SetObjResult(interp, Tcl_NewStringObj( "GIF file truncated", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "TRUNCATED", - (char *) NULL); + (char *)NULL); return TCL_ERROR; } bitPixel = 2 << (buf[0] & 0x07); @@ -517,7 +517,7 @@ FileReadGIF( Tcl_SetObjResult(interp, Tcl_NewStringObj( "error reading color map", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLOR_MAP", - (char *) NULL); + (char *)NULL); return TCL_ERROR; } } @@ -563,7 +563,7 @@ FileReadGIF( Tcl_SetObjResult(interp, Tcl_NewStringObj( "no image data for this index", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "NO_DATA", - (char *) NULL); + (char *)NULL); goto error; case GIF_EXTENSION: @@ -581,7 +581,7 @@ FileReadGIF( Tcl_SetObjResult(interp, Tcl_NewStringObj( "error reading extension in GIF image", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "BAD_EXT", - (char *) NULL); + (char *)NULL); goto error; } continue; @@ -591,7 +591,7 @@ FileReadGIF( "couldn't read left/top/width/height in GIF image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "DIMENSIONS", - (char *) NULL); + (char *)NULL); goto error; } break; @@ -622,7 +622,7 @@ FileReadGIF( Tcl_SetObjResult(interp, Tcl_NewStringObj( "error reading color map", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", - "COLOR_MAP", (char *) NULL); + "COLOR_MAP", (char *)NULL); goto error; } } @@ -685,7 +685,7 @@ FileReadGIF( Tcl_SetObjResult(interp, Tcl_NewStringObj( "error reading color map", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLOR_MAP", - (char *) NULL); + (char *)NULL); goto error; } } @@ -929,11 +929,11 @@ ReadOneByte( { unsigned char buf[2]; if (Fread(gifConfPtr, buf, 1, 1, chan) != 1) { - /* - * Premature end of image. - */ + /* + * Premature end of image. + */ - Tcl_SetObjResult(interp, Tcl_NewStringObj( + Tcl_SetObjResult(interp, Tcl_NewStringObj( "premature end of image data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "PREMATURE_END", NULL); return -1; @@ -1218,7 +1218,7 @@ DoExtension( break; case 0xfe: /* Comment Extension */ strcpy(extensionStreamName,"comment"); - /* copy the extension data below */ + /* copy the extension data below */ break; } /* Add extension to dict */ @@ -1349,7 +1349,7 @@ ReadImage( if (initialCodeSize > MAX_LWZ_BITS) { Tcl_SetObjResult(interp, Tcl_NewStringObj("malformed image", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "MALFORMED", - (char *) NULL); + (char *)NULL); return TCL_ERROR; } @@ -1468,24 +1468,24 @@ ReadImage( } firstCode = append[code]; - /* - * Push the head of the code onto the stack. - */ + /* + * Push the head of the code onto the stack. + */ - *top++ = firstCode; + *top++ = firstCode; - if (maxCode < (1 << MAX_LWZ_BITS)) { + if (maxCode < (1 << MAX_LWZ_BITS)) { /* * If there's still room in our codes table, add a new entry. * Otherwise don't, and keep using the current table. - * See DEFERRED CLEAR CODE IN LZW COMPRESSION in the GIF89a - * specification. + * See DEFERRED CLEAR CODE IN LZW COMPRESSION in the GIF89a + * specification. */ prefix[maxCode] = oldCode; append[maxCode] = firstCode; maxCode++; - } + } /* * maxCode tells us the maximum code value we can accept. If @@ -1867,7 +1867,7 @@ Fread( Tcl_Channel chan) { if (hunk < 0 || count < 0) { - return -1; + return -1; } if (gifConfPtr->fromData == INLINE_DATA_BASE64) { @@ -2047,7 +2047,7 @@ CommonWriteGIF( if (state.num >= MAXCOLORMAPSIZE) { Tcl_SetObjResult(interp, Tcl_NewStringObj("too many colors", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLORFUL", - (char *) NULL); + (char *)NULL); return TCL_ERROR; } if (state.num<2) { diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c index d2a674d..ab2e271 100644 --- a/generic/tkImgListFormat.c +++ b/generic/tkImgListFormat.c @@ -40,7 +40,7 @@ */ #define TK_PHOTO_ALLOC_FAILURE_MESSAGE \ - "not enough free memory for image buffer" + "not enough free memory for image buffer" /* @@ -87,11 +87,11 @@ static const char *const colorFormatNames[] = { struct FormatOptions { int options; /* Individual bits indicate which options were - * specified - see below. */ + * specified - see below. */ Tcl_Obj *formatName; /* Name specified without an option. */ enum ColorFormatType colorFormat; - /* The color format type given with the - * -colorformat option */ + /* The color format type given with the + * -colorformat option */ }; /* @@ -121,34 +121,34 @@ static const char *const formatOptionNames[] = { */ static int ParseFormatOptions(Tcl_Interp *interp, int allowedOptions, - Tcl_Size objc, Tcl_Obj *const objv[], Tcl_Size *indexPtr, - struct FormatOptions *optPtr); + Tcl_Size objc, Tcl_Obj *const objv[], Tcl_Size *indexPtr, + struct FormatOptions *optPtr); static Tcl_Obj *GetBadOptMsg(const char *badValue, int allowedOpts); static int StringMatchDef(Tcl_Obj *data, Tcl_Obj *formatString, - int *widthPtr, int *heightPtr, Tcl_Interp *interp); + int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int StringReadDef(Tcl_Interp *interp, Tcl_Obj *data, - Tcl_Obj *formatString, Tk_PhotoHandle imageHandle, - int destX, int destY, int width, int height, - int srcX, int srcY); + Tcl_Obj *formatString, Tk_PhotoHandle imageHandle, + int destX, int destY, int width, int height, + int srcX, int srcY); static int StringWriteDef(Tcl_Interp *interp, - Tcl_Obj *formatString, - Tk_PhotoImageBlock *blockPtr); + Tcl_Obj *formatString, + Tk_PhotoImageBlock *blockPtr); static int ParseColor(Tcl_Interp *interp, Tcl_Obj *specObj, - Display *display, Colormap colormap, unsigned char *redPtr, - unsigned char *greenPtr, unsigned char *bluePtr, - unsigned char *alphaPtr); + Display *display, Colormap colormap, unsigned char *redPtr, + unsigned char *greenPtr, unsigned char *bluePtr, + unsigned char *alphaPtr); static int ParseColorAsList(const char *colorString, unsigned char *redPtr, - unsigned char *greenPtr, unsigned char *bluePtr, - unsigned char *alphaPtr); + unsigned char *greenPtr, unsigned char *bluePtr, + unsigned char *alphaPtr); static int ParseColorAsHex(Tcl_Interp *interp, const char *colorString, - int colorStrLen, Display *display, Colormap colormap, - unsigned char *redPtr, unsigned char *greenPtr, - unsigned char *bluePtr, unsigned char *alphaPtr); + int colorStrLen, Display *display, Colormap colormap, + unsigned char *redPtr, unsigned char *greenPtr, + unsigned char *bluePtr, unsigned char *alphaPtr); static int ParseColorAsStandard(Tcl_Interp *interp, - const char *colorString, int colorStrLen, - Display *display, Colormap colormap, - unsigned char *redPtr, unsigned char *greenPtr, - unsigned char *bluePtr, unsigned char *alphaPtr); + const char *colorString, int colorStrLen, + Display *display, Colormap colormap, + unsigned char *redPtr, unsigned char *greenPtr, + unsigned char *bluePtr, unsigned char *alphaPtr); /* * The format record for the default image handler @@ -189,14 +189,14 @@ static int ParseFormatOptions( Tcl_Interp *interp, /* For error messages */ int allowedOptions, /* Bitfield specifying which options are - * to be considered allowed */ + * to be considered allowed */ Tcl_Size objc, /* Number of elements in argv[] */ Tcl_Obj *const objv[], /* The arguments to parse */ Tcl_Size *indexPtr, /* Index giving the first element to - * parse. The value is updated to the - * index where parsing ended */ + * parse. The value is updated to the + * index where parsing ended */ struct FormatOptions *optPtr) /* Parsed option values are written to - * this struct */ + * this struct */ { Tcl_Size optIndex, index; @@ -212,76 +212,76 @@ ParseFormatOptions( optPtr->formatName = NULL; optPtr->colorFormat = COLORFORMAT_RGB2; for (index = *indexPtr; index < objc; *indexPtr = ++index) { - int optionExists; - - /* - * The first value can be the format handler's name. It goes to - * optPtr->name. - */ - option = Tcl_GetString(objv[index]); - if (option[0] != '-') { - if (first) { - optPtr->formatName = objv[index]; - first = 0; - continue; - } else { - break; - } - } - first = 0; - - /* - * Check if option is known and allowed - */ - - optionExists = 1; - if (Tcl_GetIndexFromObj(NULL, objv[index], formatOptionNames, - "format option", 0, &optIndex) != TCL_OK) { - optionExists = 0; - } - if (!optionExists || !((1 << optIndex) & allowedOptions)) { - Tcl_SetObjResult(interp, GetBadOptMsg(Tcl_GetString(objv[index]), - allowedOptions)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); - return TCL_ERROR; - } - - /* - * Option-specific checks - */ - - switch (1 << optIndex) { - case OPT_COLORFORMAT: - *indexPtr = ++index; - if (index >= objc) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("the \"%s\" option " - "requires a value", Tcl_GetString(objv[index - 1]))); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "MISSING_VALUE", NULL); - return TCL_ERROR; - } - if (Tcl_GetIndexFromObj(NULL, objv[index], colorFormatNames, "", - TCL_EXACT, &typeIndex) != TCL_OK - || (typeIndex != COLORFORMAT_LIST - && typeIndex != COLORFORMAT_RGB2 - && typeIndex != COLORFORMAT_RGBA2) ) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad color format " - "\"%s\": must be rgb, rgba, or list", - Tcl_GetString(objv[index]))); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "BAD_COLOR_FORMAT", NULL); - return TCL_ERROR; - } - optPtr->colorFormat = (enum ColorFormatType)typeIndex; - break; - default: - Tcl_Panic("ParseFormatOptions: unexpected switch fallthrough"); - } - - /* - * Add option to bitfield in optPtr - */ - optPtr->options |= (1 << optIndex); + int optionExists; + + /* + * The first value can be the format handler's name. It goes to + * optPtr->name. + */ + option = Tcl_GetString(objv[index]); + if (option[0] != '-') { + if (first) { + optPtr->formatName = objv[index]; + first = 0; + continue; + } else { + break; + } + } + first = 0; + + /* + * Check if option is known and allowed + */ + + optionExists = 1; + if (Tcl_GetIndexFromObj(NULL, objv[index], formatOptionNames, + "format option", 0, &optIndex) != TCL_OK) { + optionExists = 0; + } + if (!optionExists || !((1 << optIndex) & allowedOptions)) { + Tcl_SetObjResult(interp, GetBadOptMsg(Tcl_GetString(objv[index]), + allowedOptions)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", (char *)NULL); + return TCL_ERROR; + } + + /* + * Option-specific checks + */ + + switch (1 << optIndex) { + case OPT_COLORFORMAT: + *indexPtr = ++index; + if (index >= objc) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("the \"%s\" option " + "requires a value", Tcl_GetString(objv[index - 1]))); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "MISSING_VALUE", (char *)NULL); + return TCL_ERROR; + } + if (Tcl_GetIndexFromObj(NULL, objv[index], colorFormatNames, "", + TCL_EXACT, &typeIndex) != TCL_OK + || (typeIndex != COLORFORMAT_LIST + && typeIndex != COLORFORMAT_RGB2 + && typeIndex != COLORFORMAT_RGBA2) ) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad color format " + "\"%s\": must be rgb, rgba, or list", + Tcl_GetString(objv[index]))); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "BAD_COLOR_FORMAT", (char *)NULL); + return TCL_ERROR; + } + optPtr->colorFormat = (enum ColorFormatType)typeIndex; + break; + default: + Tcl_Panic("ParseFormatOptions: unexpected switch fallthrough"); + } + + /* + * Add option to bitfield in optPtr + */ + optPtr->options |= (1 << optIndex); } return TCL_OK; @@ -311,29 +311,29 @@ GetBadOptMsg( Tcl_Obj *resObj = Tcl_ObjPrintf("bad format option \"%s\": ", badValue); if (allowedOpts == 0) { - Tcl_AppendToObj(resObj, "no options allowed", TCL_INDEX_NONE); + Tcl_AppendToObj(resObj, "no options allowed", TCL_INDEX_NONE); } else { - Tcl_AppendToObj(resObj, "must be ", TCL_INDEX_NONE); - bit = 1; - for (i = 0; formatOptionNames[i] != NULL; i++) { - if (allowedOpts & bit) { - if (allowedOpts & (bit -1)) { - /* - * not the first option - */ - if (allowedOpts & ~((bit << 1) - 1)) { - /* - * not the last option - */ - Tcl_AppendToObj(resObj, ", ", TCL_INDEX_NONE); - } else { - Tcl_AppendToObj(resObj, ", or ", TCL_INDEX_NONE); - } - } - Tcl_AppendToObj(resObj, formatOptionNames[i], TCL_INDEX_NONE); - } - bit <<=1; - } + Tcl_AppendToObj(resObj, "must be ", TCL_INDEX_NONE); + bit = 1; + for (i = 0; formatOptionNames[i] != NULL; i++) { + if (allowedOpts & bit) { + if (allowedOpts & (bit -1)) { + /* + * not the first option + */ + if (allowedOpts & ~((bit << 1) - 1)) { + /* + * not the last option + */ + Tcl_AppendToObj(resObj, ", ", TCL_INDEX_NONE); + } else { + Tcl_AppendToObj(resObj, ", or ", TCL_INDEX_NONE); + } + } + Tcl_AppendToObj(resObj, formatOptionNames[i], TCL_INDEX_NONE); + } + bit <<=1; + } } return resObj; } @@ -377,34 +377,34 @@ StringMatchDef( */ if (Tcl_ListObjGetElements(interp, data, &rowCount, &rowListPtr) - != TCL_OK) { - return 0; + != TCL_OK) { + return 0; } if (rowCount == 0) { - /* - * empty list is valid data - */ + /* + * empty list is valid data + */ - *widthPtr = 0; - *heightPtr = 0; - return 1; + *widthPtr = 0; + *heightPtr = 0; + return 1; } colCount = -1; for (y = 0; y < rowCount; y++) { - if (Tcl_ListObjLength(interp, rowListPtr[y], &curColCount) != TCL_OK) { - return 0; - } - if (colCount < 0) { - colCount = curColCount; - } else if (curColCount != colCount) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid row # %" TCL_SIZE_MODIFIER "d: " - "all rows must have the same number of elements", y)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_DATA", NULL); - } - return 0; - } + if (Tcl_ListObjLength(interp, rowListPtr[y], &curColCount) != TCL_OK) { + return 0; + } + if (colCount < 0) { + colCount = curColCount; + } else if (curColCount != colCount) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid row # %" TCL_SIZE_MODIFIER "d: " + "all rows must have the same number of elements", y)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_DATA", (char *)NULL); + } + return 0; + } } /* @@ -413,16 +413,16 @@ StringMatchDef( * pixel for validity. */ if (Tcl_ListObjIndex(interp, rowListPtr[0], 0, &pixelData) != TCL_OK) { - return 0; + return 0; } (void)Tcl_GetString(pixelData); if (pixelData->length > TK_PHOTO_MAX_COLOR_LENGTH) { - return 0; + return 0; } if (ParseColor(interp, pixelData, Tk_Display(Tk_MainWindow(interp)), - Tk_Colormap(Tk_MainWindow(interp)), &dummy, &dummy, &dummy, &dummy) - != TCL_OK) { - return 0; + Tk_Colormap(Tk_MainWindow(interp)), &dummy, &dummy, &dummy, &dummy) + != TCL_OK) { + return 0; } /* @@ -464,10 +464,10 @@ StringReadDef( Tcl_Obj *formatString, /* value of the -format option */ Tk_PhotoHandle imageHandle, /* write data to this image */ int destX, int destY, /* start writing data at this point - * in destination image*/ + * in destination image*/ int width, int height, /* dimensions of area to write to */ int srcX, int srcY) /* start reading source data at these - * coordinates */ + * coordinates */ { Tcl_Obj **rowListPtr, **colListPtr; Tcl_Obj **objv; @@ -488,21 +488,21 @@ StringReadDef( memset(&opts, 0, sizeof(opts)); if (formatString != NULL) { - if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv) - != TCL_OK) { - return TCL_ERROR; - } - optIndex = 0; - if (ParseFormatOptions(interp, 0, objc, objv, &optIndex, &opts) - != TCL_OK) { - return TCL_ERROR; - } - if (optIndex < objc) { - Tcl_SetObjResult(interp, - GetBadOptMsg(Tcl_GetString(objv[optIndex]), 0)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); - return TCL_ERROR; - } + if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv) + != TCL_OK) { + return TCL_ERROR; + } + optIndex = 0; + if (ParseFormatOptions(interp, 0, objc, objv, &optIndex, &opts) + != TCL_OK) { + return TCL_ERROR; + } + if (optIndex < objc) { + Tcl_SetObjResult(interp, + GetBadOptMsg(Tcl_GetString(objv[optIndex]), 0)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", (char *)NULL); + return TCL_ERROR; + } } /* @@ -510,24 +510,24 @@ StringReadDef( */ if (Tcl_ListObjGetElements(interp, data, &rowCount, &rowListPtr) - != TCL_OK ) { - return TCL_ERROR; + != TCL_OK ) { + return TCL_ERROR; } if ( rowCount > 0 && Tcl_ListObjLength(interp, rowListPtr[0], &colCount) - != TCL_OK) { - return TCL_ERROR; + != TCL_OK) { + return TCL_ERROR; } if (width <= 0 || height <= 0 || rowCount == 0 || colCount == 0) { - /* - * No changes with zero sized input or zero sized output region - */ + /* + * No changes with zero sized input or zero sized output region + */ - return TCL_OK; + return TCL_OK; } if (srcX < 0 || srcY < 0 || srcX >= rowCount || srcY >= colCount) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("source coordinates out of range")); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", NULL); - return TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf("source coordinates out of range")); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", (char *)NULL); + return TCL_ERROR; } /* @@ -536,11 +536,11 @@ StringReadDef( */ if (colCount > (int)(UINT_MAX / 4 / rowCount)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "photo image dimensions exceed Tcl memory limits")); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "OVERFLOW", NULL); - return TCL_OK; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "photo image dimensions exceed Tcl memory limits")); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "OVERFLOW", (char *)NULL); + return TCL_OK; } /* @@ -557,39 +557,39 @@ StringReadDef( srcBlock.offset[3] = 3; srcBlock.pixelPtr = (unsigned char *)attemptckalloc(srcBlock.pitch * srcBlock.height); if (srcBlock.pixelPtr == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf(TK_PHOTO_ALLOC_FAILURE_MESSAGE)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); - return TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf(TK_PHOTO_ALLOC_FAILURE_MESSAGE)); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); + return TCL_ERROR; } curPixelPtr = srcBlock.pixelPtr; display = Tk_Display(Tk_MainWindow(interp)); colormap = Tk_Colormap(Tk_MainWindow(interp)); for (y = srcY; y < rowCount; y++) { - /* - * We don't test the length of row, as that's been done in - * ImgStringMatch() - */ - - if (Tcl_ListObjGetElements(interp, rowListPtr[y], &curColCount, - &colListPtr) != TCL_OK) { - goto errorExit; - } - for (x = srcX; x < colCount; x++) { - if (ParseColor(interp, colListPtr[x], display, colormap, - curPixelPtr, curPixelPtr + 1, curPixelPtr + 2, - curPixelPtr + 3) != TCL_OK) { - goto errorExit; - } - curPixelPtr += 4; - } + /* + * We don't test the length of row, as that's been done in + * ImgStringMatch() + */ + + if (Tcl_ListObjGetElements(interp, rowListPtr[y], &curColCount, + &colListPtr) != TCL_OK) { + goto errorExit; + } + for (x = srcX; x < colCount; x++) { + if (ParseColor(interp, colListPtr[x], display, colormap, + curPixelPtr, curPixelPtr + 1, curPixelPtr + 2, + curPixelPtr + 3) != TCL_OK) { + goto errorExit; + } + curPixelPtr += 4; + } } /* * Write image data to destHandle */ if (Tk_PhotoPutBlock(interp, imageHandle, &srcBlock, destX, destY, - width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { - goto errorExit; + width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { + goto errorExit; } ckfree(srcBlock.pixelPtr); @@ -635,20 +635,20 @@ StringWriteDef( * Parse format suboptions */ if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv) - != TCL_OK) { - return TCL_ERROR; + != TCL_OK) { + return TCL_ERROR; } allowedOpts = OPT_COLORFORMAT; optIndex = 0; if (ParseFormatOptions(interp, allowedOpts, objc, objv, &optIndex, &opts) - != TCL_OK) { - return TCL_ERROR; + != TCL_OK) { + return TCL_ERROR; } if (optIndex < objc) { - Tcl_SetObjResult(interp, - GetBadOptMsg(Tcl_GetString(objv[optIndex]), allowedOpts)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); - return TCL_ERROR; + Tcl_SetObjResult(interp, + GetBadOptMsg(Tcl_GetString(objv[optIndex]), allowedOpts)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", (char *)NULL); + return TCL_ERROR; } greenOffset = blockPtr->offset[1] - blockPtr->offset[0]; @@ -660,84 +660,84 @@ StringWriteDef( */ if (blockPtr->offset[3] < 0) { - hasAlpha = 0; - alphaOffset = 0; + hasAlpha = 0; + alphaOffset = 0; } else { - hasAlpha = 1; - alphaOffset = blockPtr->offset[3] - blockPtr->offset[0]; + hasAlpha = 1; + alphaOffset = blockPtr->offset[3] - blockPtr->offset[0]; } if ((blockPtr->width > 0) && (blockPtr->height > 0)) { - int row, col; - Tcl_DString data, line; - char colorBuf[11]; - unsigned char *pixelPtr; - unsigned char alphaVal = 255; - - Tcl_DStringInit(&data); - for (row=0; rowheight; row++) { - pixelPtr = blockPtr->pixelPtr + blockPtr->offset[0] - + row * blockPtr->pitch; - Tcl_DStringInit(&line); - for (col=0; colwidth; col++) { - if (hasAlpha) { - alphaVal = pixelPtr[alphaOffset]; - } - - /* - * We don't build lines as a list for #RGBA and #RGB. Since - * these color formats look like comments, the first element - * of the list would get quoted with an additional {} . - * While this is not a problem if the data is used as - * a list, it would cause problems if someone decides to parse - * it as a string (and it looks kinda strange) - */ - - switch (opts.colorFormat) { - case COLORFORMAT_RGB2: - snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x ", pixelPtr[0], - pixelPtr[greenOffset], pixelPtr[blueOffset]); - Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); - break; - case COLORFORMAT_RGBA2: - snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x%02x ", - pixelPtr[0], pixelPtr[greenOffset], - pixelPtr[blueOffset], alphaVal); - Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); - break; - case COLORFORMAT_LIST: - Tcl_DStringStartSublist(&line); - snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[0]); - Tcl_DStringAppendElement(&line, colorBuf); - snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[greenOffset]); - Tcl_DStringAppendElement(&line, colorBuf); - snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[blueOffset]); - Tcl_DStringAppendElement(&line, colorBuf); - snprintf(colorBuf, sizeof(colorBuf), "%d", alphaVal); - Tcl_DStringAppendElement(&line, colorBuf); - Tcl_DStringEndSublist(&line); - break; - default: - Tcl_Panic("unexpected switch fallthrough"); - } - pixelPtr += blockPtr->pixelSize; - } - if (opts.colorFormat != COLORFORMAT_LIST) { - /* - * For the #XXX formats, we need to remove the last - * whitespace. - */ - - *(Tcl_DStringValue(&line) + Tcl_DStringLength(&line) - 1) - = '\0'; - } - Tcl_DStringAppendElement(&data, Tcl_DStringValue(&line)); - Tcl_DStringFree(&line); - } - result = Tcl_NewStringObj(Tcl_DStringValue(&data), TCL_INDEX_NONE); - Tcl_DStringFree(&data); + int row, col; + Tcl_DString data, line; + char colorBuf[11]; + unsigned char *pixelPtr; + unsigned char alphaVal = 255; + + Tcl_DStringInit(&data); + for (row=0; rowheight; row++) { + pixelPtr = blockPtr->pixelPtr + blockPtr->offset[0] + + row * blockPtr->pitch; + Tcl_DStringInit(&line); + for (col=0; colwidth; col++) { + if (hasAlpha) { + alphaVal = pixelPtr[alphaOffset]; + } + + /* + * We don't build lines as a list for #RGBA and #RGB. Since + * these color formats look like comments, the first element + * of the list would get quoted with an additional {} . + * While this is not a problem if the data is used as + * a list, it would cause problems if someone decides to parse + * it as a string (and it looks kinda strange) + */ + + switch (opts.colorFormat) { + case COLORFORMAT_RGB2: + snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x ", pixelPtr[0], + pixelPtr[greenOffset], pixelPtr[blueOffset]); + Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); + break; + case COLORFORMAT_RGBA2: + snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x%02x ", + pixelPtr[0], pixelPtr[greenOffset], + pixelPtr[blueOffset], alphaVal); + Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); + break; + case COLORFORMAT_LIST: + Tcl_DStringStartSublist(&line); + snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[0]); + Tcl_DStringAppendElement(&line, colorBuf); + snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[greenOffset]); + Tcl_DStringAppendElement(&line, colorBuf); + snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[blueOffset]); + Tcl_DStringAppendElement(&line, colorBuf); + snprintf(colorBuf, sizeof(colorBuf), "%d", alphaVal); + Tcl_DStringAppendElement(&line, colorBuf); + Tcl_DStringEndSublist(&line); + break; + default: + Tcl_Panic("unexpected switch fallthrough"); + } + pixelPtr += blockPtr->pixelSize; + } + if (opts.colorFormat != COLORFORMAT_LIST) { + /* + * For the #XXX formats, we need to remove the last + * whitespace. + */ + + *(Tcl_DStringValue(&line) + Tcl_DStringLength(&line) - 1) + = '\0'; + } + Tcl_DStringAppendElement(&data, Tcl_DStringValue(&line)); + Tcl_DStringFree(&line); + } + result = Tcl_NewStringObj(Tcl_DStringValue(&data), TCL_INDEX_NONE); + Tcl_DStringFree(&data); } else { - result = Tcl_NewObj(); + result = Tcl_NewObj(); } Tcl_SetObjResult(interp, result); @@ -770,7 +770,7 @@ ParseColor( Tcl_Interp *interp, /* error messages go there */ Tcl_Obj *specObj, /* the color data to parse */ Display *display, /* display of main window, needed to parse - * standard Tk colors */ + * standard Tk colors */ Colormap colormap, /* colormap of current display */ unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, @@ -787,23 +787,23 @@ ParseColor( specString = Tcl_GetStringFromObj(specObj, &length); if (length == 0) { - /* Empty string */ - *redPtr = *greenPtr = *bluePtr = *alphaPtr = 0; - return TCL_OK; + /* Empty string */ + *redPtr = *greenPtr = *bluePtr = *alphaPtr = 0; + return TCL_OK; } if (length > TK_PHOTO_MAX_COLOR_LENGTH) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid color")); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_COLOR", NULL); - return TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid color")); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_COLOR", (char *)NULL); + return TCL_ERROR; } if (specString[0] == '#') { - return ParseColorAsHex(interp, specString, length, display, - colormap, redPtr, greenPtr, bluePtr, alphaPtr); + return ParseColorAsHex(interp, specString, length, display, + colormap, redPtr, greenPtr, bluePtr, alphaPtr); } if (ParseColorAsList(specString, - redPtr, greenPtr, bluePtr, alphaPtr) == TCL_OK) { - return TCL_OK; + redPtr, greenPtr, bluePtr, alphaPtr) == TCL_OK) { + return TCL_OK; } /* @@ -813,7 +813,7 @@ ParseColor( Tcl_ResetResult(interp); return ParseColorAsStandard(interp, specString, length, display, - colormap, redPtr, greenPtr, bluePtr, alphaPtr); + colormap, redPtr, greenPtr, bluePtr, alphaPtr); } @@ -863,24 +863,24 @@ ParseColorAsList( */ while(isspace(UCHAR(*curPos))) { - ++curPos; + ++curPos; } while (i < 4 && *curPos != '\0') { - values[i] = strtol(curPos, (char **)&curPos, 0); - if (values[i] < 0 || values[i] > 255) { - return TCL_ERROR; - } - while(isspace(UCHAR(*curPos))) { - ++curPos; - } - ++i; + values[i] = strtol(curPos, (char **)&curPos, 0); + if (values[i] < 0 || values[i] > 255) { + return TCL_ERROR; + } + while(isspace(UCHAR(*curPos))) { + ++curPos; + } + ++i; } if (i < 3 || *curPos != '\0') { - return TCL_ERROR; + return TCL_ERROR; } if (i < 4) { - values[3] = 255; + values[3] = 255; } *redPtr = (unsigned char) values[0]; @@ -897,7 +897,7 @@ ParseColorAsList( * ParseColorAsHex -- * * This function extracts color and alpha values from a string - * starting with '#', followed by hex digits. It undestands both + * starting with '#', followed by hex digits. It understands both * the #RGBA form and the #RBG (with optional suffix) * * Results: @@ -927,39 +927,39 @@ ParseColorAsHex( unsigned long int colorValue = 0; if (colorStrLen - 1 != 4 && colorStrLen - 1 != 8) { - return ParseColorAsStandard(interp, colorString, colorStrLen, - display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); + return ParseColorAsStandard(interp, colorString, colorStrLen, + display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); } for (i = 1; i < colorStrLen; i++) { - if (!isxdigit(UCHAR(colorString[i]))) { - /* - * There still is a chance that this is a Tk color with - * an alpha suffix - */ - - return ParseColorAsStandard(interp, colorString, colorStrLen, - display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); - } + if (!isxdigit(UCHAR(colorString[i]))) { + /* + * There still is a chance that this is a Tk color with + * an alpha suffix + */ + + return ParseColorAsStandard(interp, colorString, colorStrLen, + display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); + } } colorValue = strtoul(colorString + 1, NULL, 16); switch (colorStrLen - 1) { case 4: - /* #RGBA format */ - *redPtr = (unsigned char) ((colorValue >> 12) * 0x11); - *greenPtr = (unsigned char) (((colorValue >> 8) & 0xf) * 0x11); - *bluePtr = (unsigned char) (((colorValue >> 4) & 0xf) * 0x11); - *alphaPtr = (unsigned char) ((colorValue & 0xf) * 0x11); - return TCL_OK; + /* #RGBA format */ + *redPtr = (unsigned char) ((colorValue >> 12) * 0x11); + *greenPtr = (unsigned char) (((colorValue >> 8) & 0xf) * 0x11); + *bluePtr = (unsigned char) (((colorValue >> 4) & 0xf) * 0x11); + *alphaPtr = (unsigned char) ((colorValue & 0xf) * 0x11); + return TCL_OK; case 8: - /* #RRGGBBAA format */ - *redPtr = (unsigned char) (colorValue >> 24); - *greenPtr = (unsigned char) ((colorValue >> 16) & 0xff); - *bluePtr = (unsigned char) ((colorValue >> 8) & 0xff); - *alphaPtr = (unsigned char) (colorValue & 0xff); - return TCL_OK; + /* #RRGGBBAA format */ + *redPtr = (unsigned char) (colorValue >> 24); + *greenPtr = (unsigned char) ((colorValue >> 16) & 0xff); + *bluePtr = (unsigned char) ((colorValue >> 8) & 0xff); + *alphaPtr = (unsigned char) (colorValue & 0xff); + return TCL_OK; default: - Tcl_Panic("unexpected switch fallthrough"); + Tcl_Panic("unexpected switch fallthrough"); } /* Shouldn't get here */ @@ -971,7 +971,7 @@ ParseColorAsHex( * * ParseColorAsStandard -- * - * This function tries to split a color stirng in a color and a + * This function tries to split a color string in a color and a * suffix part and to extract color and alpha values from them. The * color part is treated as regular Tk color. * @@ -1010,31 +1010,31 @@ ParseColorAsStandard( */ if ((suffixString = strrchr(specString, '@')) == NULL - && ((suffixString = strrchr(specString, '#')) == NULL - || suffixString == specString)) { - suffixString = specString + specStrLen; - colorString = specString; + && ((suffixString = strrchr(specString, '#')) == NULL + || suffixString == specString)) { + suffixString = specString + specStrLen; + colorString = specString; } else { - strncpy(colorBuffer, specString, suffixString - specString); - colorBuffer[suffixString - specString] = '\0'; - colorString = (const char*)colorBuffer; + strncpy(colorBuffer, specString, suffixString - specString); + colorBuffer[suffixString - specString] = '\0'; + colorString = (const char*)colorBuffer; } /* * Try to parse as standard Tk color. * * We don't use Tk_GetColor() et al. here, as those functions - * migth return a color that does not exaxtly match the given name + * might return a color that does not exactly match the given name * if the colormap is full. Also, we don't really want the color to be * added to the colormap. */ if ( ! TkParseColor(display, colormap, colorString, &parsedColor)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "invalid color name \"%s\"", specString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_COLOR", NULL); - return TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "invalid color name \"%s\"", specString)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_COLOR", (char *)NULL); + return TCL_ERROR; } /* @@ -1043,54 +1043,54 @@ ParseColorAsStandard( switch (suffixString[0]) { case '\0': - suffixAlpha = 255; - break; + suffixAlpha = 255; + break; case '@': - if (Tcl_GetDouble(NULL, suffixString + 1, &fracAlpha) != TCL_OK) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha " - "suffix \"%s\": expected floating-point value", - suffixString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID COLOR", NULL); - return TCL_ERROR; - } - if (fracAlpha < 0 || fracAlpha > 1) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha suffix" - " \"%s\": value must be in the range from 0 to 1", - suffixString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_COLOR", NULL); - return TCL_ERROR; - } - suffixAlpha = (unsigned int) floor(fracAlpha * 255 + 0.5); - break; + if (Tcl_GetDouble(NULL, suffixString + 1, &fracAlpha) != TCL_OK) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha " + "suffix \"%s\": expected floating-point value", + suffixString)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID COLOR", (char *)NULL); + return TCL_ERROR; + } + if (fracAlpha < 0 || fracAlpha > 1) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha suffix" + " \"%s\": value must be in the range from 0 to 1", + suffixString)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_COLOR", (char *)NULL); + return TCL_ERROR; + } + suffixAlpha = (unsigned int) floor(fracAlpha * 255 + 0.5); + break; case '#': - if (strlen(suffixString + 1) < 1 || strlen(suffixString + 1)> 2) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "invalid alpha suffix \"%s\"", suffixString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_COLOR", NULL); - return TCL_ERROR; - } - for (i = 1; i <= (int)strlen(suffixString + 1); i++) { - if ( ! isxdigit(UCHAR(suffixString[i]))) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "invalid alpha suffix \"%s\": expected hex digit", - suffixString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_COLOR", NULL); - return TCL_ERROR; - } - } - if (strlen(suffixString + 1) == 1) { - sscanf(suffixString, "#%1x", &suffixAlpha); - suffixAlpha *= 0x11; - } else { - sscanf(suffixString, "#%2x", &suffixAlpha); - } - break; + if (strlen(suffixString + 1) < 1 || strlen(suffixString + 1)> 2) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "invalid alpha suffix \"%s\"", suffixString)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_COLOR", (char *)NULL); + return TCL_ERROR; + } + for (i = 1; i <= (int)strlen(suffixString + 1); i++) { + if ( ! isxdigit(UCHAR(suffixString[i]))) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "invalid alpha suffix \"%s\": expected hex digit", + suffixString)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_COLOR", (char *)NULL); + return TCL_ERROR; + } + } + if (strlen(suffixString + 1) == 1) { + sscanf(suffixString, "#%1x", &suffixAlpha); + suffixAlpha *= 0x11; + } else { + sscanf(suffixString, "#%2x", &suffixAlpha); + } + break; default: - Tcl_Panic("unexpected switch fallthrough"); + Tcl_Panic("unexpected switch fallthrough"); } *redPtr = (unsigned char) (parsedColor.red >> 8); diff --git a/generic/tkPointer.c b/generic/tkPointer.c index 2fbdedf..1bc8411 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -512,14 +512,14 @@ TkPointerDeadWindow( } if (!(tsdPtr->restrictWinPtr || tsdPtr->grabWinPtr)) { - /* - * Release mouse capture only if the dead window is the capturing - * window. - */ + /* + * Release mouse capture only if the dead window is the capturing + * window. + */ - if (winPtr == (TkWindow *)TkpGetCapture()) { + if (winPtr == (TkWindow *)TkpGetCapture()) { TkpSetCapture(NULL); - } + } } } diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index ec94418..01d8c77 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -228,12 +228,12 @@ ScrollbarWidgetObjCmd( int result = TCL_OK, cmdIndex, length; Tcl_Size len; static const char *const commandNames[] = { - "activate", "cget", "configure", "delta", "fraction", - "get", "identify", "set", NULL + "activate", "cget", "configure", "delta", "fraction", + "get", "identify", "set", NULL }; enum command { - COMMAND_ACTIVATE, COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DELTA, - COMMAND_FRACTION, COMMAND_GET, COMMAND_IDENTIFY, COMMAND_SET + COMMAND_ACTIVATE, COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DELTA, + COMMAND_FRACTION, COMMAND_GET, COMMAND_IDENTIFY, COMMAND_SET }; if (objc < 2) { @@ -531,7 +531,7 @@ ConfigureScrollbar( int flags) /* Flags to pass to Tk_ConfigureWidget. */ { if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs, objc, - (const char **)objv, (char *) scrollPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { + (const char **)objv, (char *)scrollPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { return TCL_ERROR; } @@ -541,17 +541,19 @@ ConfigureScrollbar( */ if (scrollPtr->command != NULL) { - scrollPtr->commandSize = (int) strlen(scrollPtr->command); + scrollPtr->commandSize = (int) strlen(scrollPtr->command); } else { scrollPtr->commandSize = 0; } if (scrollPtr->highlightWidth < 0) { scrollPtr->highlightWidth = 0; } + if (scrollPtr->borderWidth < 0) { + scrollPtr->borderWidth = 0; + } if (scrollPtr->elementBorderWidth < 0) { scrollPtr->elementBorderWidth = -1; } - /* * Configure platform specific options. */ diff --git a/tests/button.test b/tests/button.test index 323e2de..a51b997 100644 --- a/tests/button.test +++ b/tests/button.test @@ -1020,7 +1020,7 @@ test button-1.104 {configuration option: "activebackground" for label} -setup { .l configure -font {} } -cleanup { destroy .l -} -returnCodes error -result {font "" doesn't exist} +} -returnCodes error -result {font "" does not exist} test button-1.105 {configuration option: "font" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 pack .b @@ -1039,7 +1039,7 @@ test button-1.106 {configuration option: "activebackground" for button} -setup { .b configure -font {} } -cleanup { destroy .b -} -returnCodes error -result {font "" doesn't exist} +} -returnCodes error -result {font "" does not exist} test button-1.107 {configuration option: "font" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 pack .c @@ -1058,7 +1058,7 @@ test button-1.108 {configuration option: "activebackground" for checkbutton} -se .c configure -font {} } -cleanup { destroy .c -} -returnCodes error -result {font "" doesn't exist} +} -returnCodes error -result {font "" does not exist} test button-1.109 {configuration option: "font" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 pack .r @@ -1077,7 +1077,7 @@ test button-1.110 {configuration option: "activebackground" for radiobutton} -se .r configure -font {} } -cleanup { destroy .r -} -returnCodes error -result {font "" doesn't exist} +} -returnCodes error -result {font "" does not exist} test button-1.111 {configuration option: "foreground" for label} -setup { label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} diff --git a/tests/canvText.test b/tests/canvText.test index da41395..1263ad4 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -44,7 +44,7 @@ test canvText-1.6 {configuration options: good value for "font"} -body { } -result {{Times 40} {Times 40}} test canvasText-1.7 {configuration options: bad value for "font"} -body { .c itemconfigure test -font {} -} -returnCodes error -result {font "" doesn't exist} +} -returnCodes error -result {font "" does not exist} test canvText-1.8 {configuration options: good value for "justify"} -body { .c itemconfigure test -justify left list [lindex [.c itemconfigure test -justify] 4] [.c itemcget test -justify] diff --git a/tests/entry.test b/tests/entry.test index f1803c9..b413291 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -241,7 +241,7 @@ test entry-1.20 {configuration option: "font" for entry} -setup { .e configure -font {} } -cleanup { destroy .e -} -returnCodes error -result {font "" doesn't exist} +} -returnCodes error -result {font "" does not exist} test entry-1.21 {configuration option: "foreground" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} diff --git a/tests/font.test b/tests/font.test index eadb794..922f8fb 100644 --- a/tests/font.test +++ b/tests/font.test @@ -97,7 +97,7 @@ test font-2.1 {TkFontPkgFree} -setup { lappend x [foo eval {catch {font families} msg; set msg}] } -cleanup { interp delete foo -} -result {{named font "wiggles" doesn't exist} {cannot invoke "font" command: application has been destroyed}} +} -result {{named font "wiggles" does not exist} {cannot invoke "font" command: application has been destroyed}} test font-3.1 {font command: general} -body { @@ -133,7 +133,7 @@ test font-4.6 {font command: actual: arguments} -body { test font-4.7 {font command: actual: arguments} -constraints noExceed -body { # (tkfont == NULL) font actual "\{xyz" -} -returnCodes error -result "font \"{xyz\" doesn't exist" +} -returnCodes error -result "font \"{xyz\" does not exist" test font-4.8 {font command: actual: all attributes} -body { # not (objc > 3) so objPtr = NULL lindex [font actual {-family times}] 0 @@ -173,7 +173,7 @@ test font-5.1 {font command: configure} -body { test font-5.2 {font command: configure: non-existent font} -body { # (namedHashPtr == NULL) font configure xyz -} -returnCodes error -result {named font "xyz" doesn't exist} +} -returnCodes error -result {named font "xyz" does not exist} test font-5.3 {font command: configure: "deleted" font} -setup { destroy .t.f catch {font delete xyz} @@ -187,7 +187,7 @@ test font-5.3 {font command: configure: "deleted" font} -setup { font configure xyz } -cleanup { destroy .t.f -} -returnCodes error -result {named font "xyz" doesn't exist} +} -returnCodes error -result {named font "xyz" does not exist} test font-5.4 {font command: configure: get all options} -setup { catch {font delete xyz} } -body { @@ -330,7 +330,7 @@ test font-7.4 {font command: delete: non-existent} -setup { } -body { # (namedHashPtr == NULL) font delete xyz -} -returnCodes error -result {named font "xyz" doesn't exist} +} -returnCodes error -result {named font "xyz" does not exist} test font-7.5 {font command: delete: mark for later deletion} -setup { destroy .t.f catch {font delete xyz} @@ -345,7 +345,7 @@ test font-7.5 {font command: delete: mark for later deletion} -setup { font configure xyz } -cleanup { destroy .t.f -} -returnCodes error -result {named font "xyz" doesn't exist} +} -returnCodes error -result {named font "xyz" does not exist} test font-7.6 {font command: delete: mark for later deletion} -setup { destroy .t.f catch {font delete xyz} @@ -405,7 +405,7 @@ test font-9.3 {font command: measure: arguments} -body { test font-9.4 {font command: measure: arguments} -constraints noExceed -body { # (tkfont == NULL) font measure "\{xyz" abc -} -returnCodes error -result "font \"{xyz\" doesn't exist" +} -returnCodes error -result "font \"{xyz\" does not exist" test font-9.5 {font command: measure} -body { # Tk_TextWidth() expr {[font measure $fixed "abcdefg"] == [font measure $fixed "a"]*7 } @@ -443,7 +443,7 @@ test font-10.5 {font command: metrics: arguments} -body { test font-10.6 {font command: metrics: bad font} -constraints noExceed -body { # (tkfont == NULL) font metrics "\{xyz" -} -returnCodes error -result "font \"{xyz\" doesn't exist" +} -returnCodes error -result "font \"{xyz\" does not exist" test font-10.7 {font command: metrics: get all metrics} -setup { catch {unset a} } -body { @@ -707,7 +707,7 @@ test font-15.9 {Tk_AllocFontFromObj procedure: get attribute font} -setup { test font-15.10 {Tk_AllocFontFromObj procedure: no match} -constraints noExceed -body { # (ParseFontNameObj() != TCL_OK) font actual "\{xyz" -} -returnCodes error -result "font \"{xyz\" doesn't exist" +} -returnCodes error -result "font \"{xyz\" does not exist" test font-15.11 {Tk_AllocFontFromObj procedure: get attribute font} -body { # not (ParseFontNameObj() != TCL_OK) lindex [font actual {plan 9}] 0 @@ -2254,10 +2254,10 @@ test font-38.6 {ParseFontNameObj procedure: begins with *} -body { } -result [font actual {times 0} -family] test font-38.7 {ParseFontNameObj procedure: arguments} -constraints noExceed -body { font actual "\{xyz" -} -returnCodes error -result "font \"{xyz\" doesn't exist" +} -returnCodes error -result "font \"{xyz\" does not exist" test font-38.8 {ParseFontNameObj procedure: arguments} -constraints noExceed -body { font actual "" -} -returnCodes error -result {font "" doesn't exist} +} -returnCodes error -result {font "" does not exist} test font-38.9 {ParseFontNameObj procedure: arguments} -body { font actual {times 20 xyz xyz} } -returnCodes error -result {unknown font style "xyz"} diff --git a/tests/imgBmap.test b/tests/imgBmap.test index 9aaf674..c498c90 100644 --- a/tests/imgBmap.test +++ b/tests/imgBmap.test @@ -157,7 +157,7 @@ test imageBmap-3.3 {ImgBmapConfigureModel procedure, memory de-allocation} -body test imageBmap-3.4 {ImgBmapConfigureModel procedure} -body { image create bitmap i1 i1 configure -maskdata $data2 -} -returnCodes error -result {cannot have mask without bitmap} +} -returnCodes error -result {cannot have a mask without a bitmap} test imageBmap-3.5 {ImgBmapConfigureModel procedure} -body { image create bitmap i1 -data $data1 -maskdata { #define foo_width 8 diff --git a/tests/message.test b/tests/message.test index 0b86177..df89c30 100644 --- a/tests/message.test +++ b/tests/message.test @@ -190,7 +190,7 @@ test message-1.18 {configuration option: "font"} -setup { .m configure -font {} } -cleanup { destroy .m -} -returnCodes error -result {font "" doesn't exist} +} -returnCodes error -result {font "" does not exist} test message-1.19 {configuration option: "-foreground"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} diff --git a/tests/spinbox.test b/tests/spinbox.test index 4060c96..e5ba78c 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -338,7 +338,7 @@ test spinbox-1.27 {configuration option: "font" for spinbox} -setup { .e configure -font {} } -cleanup { destroy .e -} -returnCodes error -result {font "" doesn't exist} +} -returnCodes error -result {font "" does not exist} test spinbox-1.28 {configuration option: "foreground"} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -- cgit v0.12 From 2fd74cf1288e7c6a8f43e04b9ec6e642a5e9647c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 30 Aug 2024 23:05:14 +0000 Subject: two more --- tests/unixFont.test | 2 +- tests/winFont.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unixFont.test b/tests/unixFont.test index e11b795..08757cd 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -71,7 +71,7 @@ proc getsize {} { test unixfont-1.1 {TkpGetNativeFont procedure: not native} {x11 noExceed} { list [catch {font measure {} xyz} msg] $msg -} {1 {font "" doesn't exist}} +} {1 {font "" does not exist}} test unixfont-1.2 {TkpGetNativeFont procedure: native} {x11 failsOnUbuntu} { font measure fixed 0 } 6 diff --git a/tests/winFont.test b/tests/winFont.test index 03096f6..0f80e8c 100644 --- a/tests/winFont.test +++ b/tests/winFont.test @@ -21,7 +21,7 @@ test winfont-1.1 {TkpGetNativeFont procedure: not native} -constraints { } -body { catch {font delete xyz} font measure {} xyz -} -returnCodes error -result {font "" doesn't exist} +} -returnCodes error -result {font "" does not exist} test winfont-1.2 {TkpGetNativeFont procedure: native} -constraints win -body { font measure ansifixed 0 font measure ansi 0 -- cgit v0.12