diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-10 13:10:23 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-10 13:10:23 (GMT) |
commit | fdf8dbb801759671f5e6c83be96cf8f78a8cb3cc (patch) | |
tree | 6be51a127548928e9608a8cad4ba3aca1f2fc2cf | |
parent | 23f8f1f53c2ab0960a3389b9342637f928e27e2b (diff) | |
parent | 0e5885d7fab885a2ef6ee3d709a6745b0bf585fb (diff) | |
download | tk-fdf8dbb801759671f5e6c83be96cf8f78a8cb3cc.zip tk-fdf8dbb801759671f5e6c83be96cf8f78a8cb3cc.tar.gz tk-fdf8dbb801759671f5e6c83be96cf8f78a8cb3cc.tar.bz2 |
Merge 8.6. Modify local xvfb-run script such that it works on macOS, and use it
42 files changed, 305 insertions, 282 deletions
diff --git a/.travis.yml b/.travis.yml index cce1228..eae4ee4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -177,7 +177,8 @@ jobs: install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: - - Xvfb :1337 -screen 0 1280x1024x24 -ac -nolisten tcp -nolisten unix & make binaries libraries tktest test DISPLAY=:1337 ERROR_ON_FAILURES=1 + - make binaries libraries tktest + - ./xvfb-run make test # Older MacOS versions - name: "macOS/Clang/Xcode 11/Shared" os: osx diff --git a/generic/tkFont.c b/generic/tkFont.c index 0b858fc..ab431a0 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -380,7 +380,7 @@ void TkFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - TkFontInfo *fiPtr = ckalloc(sizeof(TkFontInfo)); + TkFontInfo *fiPtr = (TkFontInfo *)ckalloc(sizeof(TkFontInfo)); Tcl_InitHashTable(&fiPtr->fontCache, TCL_STRING_KEYS); Tcl_InitHashTable(&fiPtr->namedTable, TCL_STRING_KEYS); @@ -473,7 +473,7 @@ Tk_FontObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int index; - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkFontInfo *fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr; static const char *const optionStrings[] = { "actual", "configure", "create", "delete", @@ -617,9 +617,9 @@ Tk_FontObjCmd( } string = Tcl_GetString(objv[2]); namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string); - nfPtr = NULL; /* lint. */ + nfPtr = NULL; if (namedHashPtr != NULL) { - nfPtr = Tcl_GetHashValue(namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); } if ((namedHashPtr == NULL) || nfPtr->deletePending) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -797,10 +797,10 @@ Tk_FontObjCmd( resultPtr = Tcl_NewObj(); namedHashPtr = Tcl_FirstHashEntry(&fiPtr->namedTable, &search); while (namedHashPtr != NULL) { - NamedFont *nfPtr = Tcl_GetHashValue(namedHashPtr); + NamedFont *nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (!nfPtr->deletePending) { - char *string = Tcl_GetHashKey(&fiPtr->namedTable, + char *string = (char *)Tcl_GetHashKey(&fiPtr->namedTable, namedHashPtr); Tcl_ListObjAppendElement(NULL, resultPtr, @@ -843,7 +843,7 @@ UpdateDependentFonts( Tcl_HashEntry *cacheHashPtr; Tcl_HashSearch search; TkFont *fontPtr; - NamedFont *nfPtr = Tcl_GetHashValue(namedHashPtr); + NamedFont *nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (nfPtr->refCount == 0) { /* @@ -856,7 +856,7 @@ UpdateDependentFonts( cacheHashPtr = Tcl_FirstHashEntry(&fiPtr->fontCache, &search); while (cacheHashPtr != NULL) { - for (fontPtr = Tcl_GetHashValue(cacheHashPtr); + for (fontPtr = (TkFont *)Tcl_GetHashValue(cacheHashPtr); fontPtr != NULL; fontPtr = fontPtr->nextPtr) { if (fontPtr->namedHashPtr == namedHashPtr) { TkpGetFontFromAttributes(fontPtr, tkwin, &nfPtr->fa); @@ -874,7 +874,7 @@ static void TheWorldHasChanged( ClientData clientData) /* Info about application's fonts. */ { - TkFontInfo *fiPtr = clientData; + TkFontInfo *fiPtr = (TkFontInfo *)clientData; /* * On macOS it is catastrophic to recompute all widgets while the @@ -964,7 +964,7 @@ TkCreateNamedFont( namedHashPtr = Tcl_CreateHashEntry(&fiPtr->namedTable, name, &isNew); if (!isNew) { - nfPtr = Tcl_GetHashValue(namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (!nfPtr->deletePending) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -986,7 +986,7 @@ TkCreateNamedFont( return TCL_OK; } - nfPtr = ckalloc(sizeof(NamedFont)); + nfPtr = (NamedFont *)ckalloc(sizeof(NamedFont)); nfPtr->deletePending = 0; Tcl_SetHashValue(namedHashPtr, nfPtr); nfPtr->fa = *faPtr; @@ -1025,7 +1025,7 @@ TkDeleteNamedFont( } return TCL_ERROR; } - nfPtr = Tcl_GetHashValue(namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (nfPtr->refCount != 0) { nfPtr->deletePending = 1; } else { @@ -1114,7 +1114,7 @@ Tk_AllocFontFromObj( SetFontFromAny(interp, objPtr); } - oldFontPtr = objPtr->internalRep.twoPtrValue.ptr1; + oldFontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1; if (oldFontPtr != NULL) { if (oldFontPtr->resourceRefCount == 0) { /* @@ -1143,7 +1143,7 @@ Tk_AllocFontFromObj( cacheHashPtr = Tcl_CreateHashEntry(&fiPtr->fontCache, Tcl_GetString(objPtr), &isNew); } - firstFontPtr = Tcl_GetHashValue(cacheHashPtr); + firstFontPtr = (TkFont *)Tcl_GetHashValue(cacheHashPtr); for (fontPtr = firstFontPtr; (fontPtr != NULL); fontPtr = fontPtr->nextPtr) { if (Tk_Screen(tkwin) == fontPtr->screen) { @@ -1166,7 +1166,7 @@ Tk_AllocFontFromObj( * Construct a font based on a named font. */ - nfPtr = Tcl_GetHashValue(namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); nfPtr->refCount++; fontPtr = TkpGetFontFromAttributes(NULL, tkwin, &nfPtr->fa); @@ -1299,7 +1299,7 @@ Tk_GetFontFromObj( SetFontFromAny(NULL, objPtr); } - fontPtr = objPtr->internalRep.twoPtrValue.ptr1; + fontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1; if (fontPtr != NULL) { if (fontPtr->resourceRefCount == 0) { /* @@ -1326,7 +1326,7 @@ Tk_GetFontFromObj( hashPtr = Tcl_FindHashEntry(&fiPtr->fontCache, Tcl_GetString(objPtr)); } if (hashPtr != NULL) { - for (fontPtr = Tcl_GetHashValue(hashPtr); fontPtr != NULL; + for (fontPtr = (TkFont *)Tcl_GetHashValue(hashPtr); fontPtr != NULL; fontPtr = fontPtr->nextPtr) { if (Tk_Screen(tkwin) == fontPtr->screen) { fontPtr->objRefCount++; @@ -1361,7 +1361,7 @@ Tk_GetFontFromObj( static int SetFontFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ + TCL_UNUSED(Tcl_Interp *), /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; @@ -1437,8 +1437,7 @@ Tk_FreeFont( if (fontPtr == NULL) { return; } - fontPtr->resourceRefCount--; - if (fontPtr->resourceRefCount > 0) { + if (fontPtr->resourceRefCount-- > 1) { return; } if (fontPtr->namedHashPtr != NULL) { @@ -1447,7 +1446,7 @@ Tk_FreeFont( * the named font and free it if no-one else is using it. */ - nfPtr = Tcl_GetHashValue(fontPtr->namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(fontPtr->namedHashPtr); nfPtr->refCount--; if ((nfPtr->refCount == 0) && nfPtr->deletePending) { Tcl_DeleteHashEntry(fontPtr->namedHashPtr); @@ -1455,7 +1454,7 @@ Tk_FreeFont( } } - prevPtr = Tcl_GetHashValue(fontPtr->cacheHashPtr); + prevPtr = (TkFont *)Tcl_GetHashValue(fontPtr->cacheHashPtr); if (prevPtr == fontPtr) { if (fontPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(fontPtr->cacheHashPtr); @@ -1533,7 +1532,7 @@ static void FreeFontObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkFont *fontPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkFont *fontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1; if (fontPtr != NULL) { fontPtr->objRefCount--; @@ -1568,7 +1567,7 @@ DupFontObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkFont *fontPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkFont *fontPtr = (TkFont *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = fontPtr; @@ -2007,8 +2006,8 @@ Tk_ComputeTextLayout( maxChunks = 1; - layoutPtr = ckalloc(sizeof(TextLayout) - + (maxChunks-1) * sizeof(LayoutChunk)); + layoutPtr = (TextLayout *)ckalloc(Tk_Offset(TextLayout, chunks) + + maxChunks * sizeof(LayoutChunk)); layoutPtr->tkfont = tkfont; layoutPtr->string = string; layoutPtr->numChunks = 0; @@ -3405,7 +3404,7 @@ noMapping: ; static int ConfigAttributesObj( Tcl_Interp *interp, /* Interp for error return. */ - Tk_Window tkwin, /* For display on which font will be used. */ + TCL_UNUSED(Tk_Window), /* For display on which font will be used. */ int objc, /* Number of elements in argv. */ Tcl_Obj *const objv[], /* Command line options. */ TkFontAttributes *faPtr) /* Font attributes structure whose fields are @@ -3780,7 +3779,7 @@ NewChunk( maxChunks = *maxPtr; if (layoutPtr->numChunks == maxChunks) { maxChunks *= 2; - s = sizeof(TextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk)); + s = Tk_Offset(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk)); layoutPtr = ckrealloc(layoutPtr, s); *layoutPtrPtr = layoutPtr; @@ -4244,7 +4243,7 @@ TkDebugFont( hashPtr = Tcl_FindHashEntry( &((TkWindow *) tkwin)->mainPtr->fontInfoPtr->fontCache, name); if (hashPtr != NULL) { - fontPtr = Tcl_GetHashValue(hashPtr); + fontPtr = (TkFont *)Tcl_GetHashValue(hashPtr); if (fontPtr == NULL) { Tcl_Panic("TkDebugFont found empty hash table entry"); } @@ -4297,7 +4296,7 @@ TkFontGetFirstTextLayout( } chunkPtr = layoutPtr->chunks; numBytesInChunk = chunkPtr->numBytes; - strncpy(dst, chunkPtr->start, (size_t) numBytesInChunk); + strncpy(dst, chunkPtr->start, numBytesInChunk); *font = layoutPtr->tkfont; return numBytesInChunk; } diff --git a/generic/tkSelect.c b/generic/tkSelect.c index ef16ff5..91f0836 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -125,7 +125,7 @@ Tk_CreateSelHandler( * listed in the ICCCM will be tolerated * (blech). */ { - register TkSelHandler *selPtr; + TkSelHandler *selPtr; TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->dispPtr->multipleAtom == None) { @@ -139,7 +139,7 @@ Tk_CreateSelHandler( for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) { if (selPtr == NULL) { - selPtr = ckalloc(sizeof(TkSelHandler)); + selPtr = (TkSelHandler *)ckalloc(sizeof(TkSelHandler)); selPtr->nextPtr = winPtr->selHandlerList; winPtr->selHandlerList = selPtr; break; @@ -177,7 +177,7 @@ Tk_CreateSelHandler( target = winPtr->dispPtr->utf8Atom; for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) { if (selPtr == NULL) { - selPtr = ckalloc(sizeof(TkSelHandler)); + selPtr = (TkSelHandler *)ckalloc(sizeof(TkSelHandler)); selPtr->nextPtr = winPtr->selHandlerList; winPtr->selHandlerList = selPtr; selPtr->selection = selection; @@ -239,9 +239,9 @@ Tk_DeleteSelHandler( * removed. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register TkSelHandler *selPtr, *prevPtr; - register TkSelInProgress *ipPtr; - ThreadSpecificData *tsdPtr = + TkSelHandler *selPtr, *prevPtr; + TkSelInProgress *ipPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -353,7 +353,7 @@ Tk_OwnSelection( ClientData clientData) /* Arbitrary one-word argument to pass to * proc. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; Tk_LostSelProc *clearProc = NULL; @@ -382,7 +382,7 @@ Tk_OwnSelection( } } if (infoPtr == NULL) { - infoPtr = ckalloc(sizeof(TkSelectionInfo)); + infoPtr = (TkSelectionInfo *)ckalloc(sizeof(TkSelectionInfo)); infoPtr->selection = selection; infoPtr->nextPtr = dispPtr->selectionInfoPtr; dispPtr->selectionInfoPtr = infoPtr; @@ -460,7 +460,7 @@ Tk_ClearSelection( Tk_Window tkwin, /* Window that selects a display. */ Atom selection) /* Selection to be cancelled. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; TkSelectionInfo *prevPtr; @@ -556,7 +556,7 @@ Tk_GetSelection( TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (dispPtr->multipleAtom == None) { @@ -577,7 +577,7 @@ Tk_GetSelection( } } if (infoPtr != NULL) { - register TkSelHandler *selPtr; + TkSelHandler *selPtr; int offset, result, count; char buffer[TK_SEL_BYTES_AT_ONCE+1]; TkSelInProgress ip; @@ -670,7 +670,7 @@ Tk_SelectionObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; const char *path = NULL; Atom selection; const char *selName = NULL; @@ -830,7 +830,7 @@ Tk_SelectionObjCmd( Atom target, format; const char *targetName = NULL; const char *formatName = NULL; - register CommandInfo *cmdInfoPtr; + CommandInfo *cmdInfoPtr; int cmdLength; static const char *const handleOptionStrings[] = { "-format", "-selection", "-type", NULL @@ -904,7 +904,7 @@ Tk_SelectionObjCmd( if (cmdLength == 0) { Tk_DeleteSelHandler(tkwin, selection, target); } else { - cmdInfoPtr = ckalloc(Tk_Offset(CommandInfo, command) + cmdInfoPtr = (CommandInfo *)ckalloc(Tk_Offset(CommandInfo, command) + 1 + cmdLength); cmdInfoPtr->interp = interp; cmdInfoPtr->charOffset = 0; @@ -919,7 +919,7 @@ Tk_SelectionObjCmd( } case SELECTION_OWN: { - register LostCommand *lostPtr; + LostCommand *lostPtr; Tcl_Obj *commandObj = NULL; static const char *const ownOptionStrings[] = { "-command", "-displayof", "-selection", NULL @@ -1008,7 +1008,7 @@ Tk_SelectionObjCmd( Tk_OwnSelection(tkwin, selection, NULL, NULL); return TCL_OK; } - lostPtr = ckalloc(sizeof(LostCommand)); + lostPtr = (LostCommand *)ckalloc(sizeof(LostCommand)); lostPtr->interp = interp; lostPtr->cmdObj = commandObj; Tcl_IncrRefCount(commandObj); @@ -1040,7 +1040,7 @@ Tk_SelectionObjCmd( TkSelInProgress * TkSelGetInProgress(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->pendingPtr; @@ -1067,7 +1067,7 @@ void TkSelSetInProgress( TkSelInProgress *pendingPtr) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->pendingPtr = pendingPtr; @@ -1092,12 +1092,12 @@ TkSelSetInProgress( void TkSelDeadWindow( - register TkWindow *winPtr) /* Window that's being deleted. */ + TkWindow *winPtr) /* Window that's being deleted. */ { - register TkSelHandler *selPtr; - register TkSelInProgress *ipPtr; + TkSelHandler *selPtr; + TkSelInProgress *ipPtr; TkSelectionInfo *infoPtr, *prevPtr, *nextPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1170,7 +1170,7 @@ TkSelInit( Tk_Window tkwin) /* Window token (used to find display to * initialize). */ { - register TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; + TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; /* * Fetch commonly-used atoms. @@ -1221,9 +1221,9 @@ TkSelInit( void TkSelClearSelection( Tk_Window tkwin, /* Window for which event was targeted. */ - register XEvent *eventPtr) /* X SelectionClear event. */ + XEvent *eventPtr) /* X SelectionClear event. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; TkSelectionInfo *prevPtr; @@ -1285,16 +1285,15 @@ TkSelClearSelection( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int SelGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ - Tcl_Interp *interp, /* Interpreter used for error reporting (not + TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { - Tcl_DStringAppend(clientData, portion, -1); + Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1); return TCL_OK; } @@ -1411,7 +1410,7 @@ HandleTclCommand( cmdInfoPtr->charOffset += numChars; length = p - string; if (length > 0) { - strncpy(cmdInfoPtr->buffer, string, (size_t) length); + strncpy(cmdInfoPtr->buffer, string, length); } cmdInfoPtr->buffer[length] = '\0'; } @@ -1470,7 +1469,7 @@ TkSelDefaultSelection( Atom *typePtr) /* Store here the type of the selection, for * use in converting to proper X format. */ { - register TkWindow *winPtr = (TkWindow *) infoPtr->owner; + TkWindow *winPtr = (TkWindow *) infoPtr->owner; TkDisplay *dispPtr = winPtr->dispPtr; if (target == dispPtr->timestampAtom) { @@ -1483,7 +1482,7 @@ TkSelDefaultSelection( } if (target == dispPtr->targetsAtom) { - register TkSelHandler *selPtr; + TkSelHandler *selPtr; int length; Tcl_DString ds; @@ -1509,7 +1508,7 @@ TkSelDefaultSelection( Tcl_DStringFree(&ds); return -1; } - memcpy(buffer, Tcl_DStringValue(&ds), (unsigned) (1+length)); + memcpy(buffer, Tcl_DStringValue(&ds), length + 1); Tcl_DStringFree(&ds); *typePtr = XA_ATOM; return length; @@ -1566,7 +1565,7 @@ static void LostSelection( ClientData clientData) /* Pointer to LostCommand structure. */ { - LostCommand *lostPtr = clientData; + LostCommand *lostPtr = (LostCommand *)clientData; Tcl_Interp *interp = lostPtr->interp; Tcl_InterpState savedState; int code; diff --git a/generic/tkText.c b/generic/tkText.c index 2ddfea1..5996688 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -14,9 +14,9 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#include "default.h" #include "tkInt.h" #include "tkUndo.h" +#include "default.h" #if defined(MAC_OSX_TK) #define Style TkStyle @@ -461,7 +461,7 @@ Tk_TextObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -502,7 +502,7 @@ CreateWidget( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkText *textPtr; + TkText *textPtr; Tk_OptionTable optionTable; TkTextIndex startIndex; Tk_Window newWin; @@ -523,7 +523,7 @@ CreateWidget( * and 'insert', 'current' mark pointers are all NULL to start. */ - textPtr = ckalloc(sizeof(TkText)); + textPtr = (TkText *)ckalloc(sizeof(TkText)); memset(textPtr, 0, sizeof(TkText)); textPtr->tkwin = newWin; @@ -534,7 +534,7 @@ CreateWidget( textPtr, TextCmdDeletedProc); if (sharedPtr == NULL) { - sharedPtr = ckalloc(sizeof(TkSharedText)); + sharedPtr = (TkSharedText *)ckalloc(sizeof(TkSharedText)); memset(sharedPtr, 0, sizeof(TkSharedText)); sharedPtr->refCount = 0; @@ -632,7 +632,7 @@ CreateWidget( */ textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL); - textPtr->selTagPtr->reliefString = + textPtr->selTagPtr->reliefString = (char *) ckalloc(sizeof(DEF_TEXT_SELECT_RELIEF)); strcpy(textPtr->selTagPtr->reliefString, DEF_TEXT_SELECT_RELIEF); Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &textPtr->selTagPtr->relief); @@ -699,7 +699,7 @@ TextWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; int result = TCL_OK; int index; @@ -864,11 +864,10 @@ TextWidgetObjCmd( for (i = 2; i < objc-2; i++) { int value; - size_t length; - const char *option = Tcl_GetString(objv[i]); + int length; + const char *option = Tcl_GetStringFromObj(objv[i], &length); char c; - length = objv[i]->length; if (length < 2 || option[0] != '-') { goto badOption; } @@ -1126,7 +1125,7 @@ TextWidgetObjCmd( objc -= 2; objv += 2; - indices = ckalloc((objc + 1) * sizeof(TkTextIndex)); + indices = (TkTextIndex *)ckalloc((objc + 1) * sizeof(TkTextIndex)); /* * First pass verifies that all indices are valid. @@ -1154,8 +1153,8 @@ TextWidgetObjCmd( COUNT_INDICES); objc++; } - useIdx = ckalloc(objc); - memset(useIdx, 0, (size_t) objc); + useIdx = (char *)ckalloc(objc); + memset(useIdx, 0, objc); /* * Do a decreasing order sort so that we delete the end ranges @@ -1260,7 +1259,7 @@ TextWidgetObjCmd( Tcl_Obj *objPtr = NULL; int i, found = 0, visible = 0; const char *name; - size_t length; + int length; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, @@ -1276,14 +1275,12 @@ TextWidgetObjCmd( i = 2; if (objc > 3) { - name = Tcl_GetString(objv[i]); - length = objv[i]->length; + name = Tcl_GetStringFromObj(objv[i], &length); if (length > 1 && name[0] == '-') { if (strncmp("-displaychars", name, length) == 0) { i++; visible = 1; - name = Tcl_GetString(objv[i]); - length = objv[i]->length; + name = Tcl_GetStringFromObj(objv[i], &length); } if ((i < objc-1) && (length == 2) && !strcmp("--", name)) { i++; @@ -1610,7 +1607,7 @@ SharedTextObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkSharedText *sharedPtr = clientData; + TkSharedText *sharedPtr = (TkSharedText *)clientData; int result = TCL_OK; int index; @@ -1980,7 +1977,7 @@ DestroyText( for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->windowTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { TkTextEmbWindowClient *loop; - TkTextSegment *ewPtr = Tcl_GetHashValue(hPtr); + TkTextSegment *ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); loop = ewPtr->body.ew.clients; if (loop->textPtr == textPtr) { @@ -2012,7 +2009,7 @@ DestroyText( for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - tagPtr = Tcl_GetHashValue(hPtr); + tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr); /* * No need to use 'TkTextDeleteTag' since we've already removed @@ -2078,7 +2075,7 @@ DestroyText( static int ConfigureText( Tcl_Interp *interp, /* Used for error reporting. */ - register TkText *textPtr, /* Information about widget; may or may not + TkText *textPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2381,7 +2378,7 @@ static void TextWorldChangedCallback( ClientData instanceData) /* Information about widget. */ { - TkText *textPtr = instanceData; + TkText *textPtr = (TkText *)instanceData; TextWorldChanged(textPtr, TK_TEXT_LINE_GEOMETRY); } @@ -2470,9 +2467,9 @@ TextWorldChanged( static void TextEventProc( ClientData clientData, /* Information about window. */ - register XEvent *eventPtr) /* Information about event. */ + XEvent *eventPtr) /* Information about event. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TkTextIndex index, index2; if (eventPtr->type == Expose) { @@ -2581,7 +2578,7 @@ static void TextCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; Tk_Window tkwin = textPtr->tkwin; /* @@ -2634,14 +2631,13 @@ InsertChars( int viewUpdate) /* Update the view if set. */ { int lineIndex; - size_t length; + int length; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; - const char *string = Tcl_GetString(stringPtr); + const char *string = Tcl_GetStringFromObj(stringPtr, &length); - length = stringPtr->length; if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; } @@ -2667,7 +2663,7 @@ InsertChars( resetViewCount = 0; if (sharedTextPtr->refCount > PIXEL_CLIENTS) { - lineAndByteIndex = ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount); + lineAndByteIndex = (int *)ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount); } else { lineAndByteIndex = pixels; } @@ -2916,7 +2912,7 @@ TextUndoRedoCallback( Tcl_Obj *objPtr) /* Arguments of a command to be handled by the * shared text data structure. */ { - TkSharedText *sharedPtr = clientData; + TkSharedText *sharedPtr = (TkSharedText *)clientData; int res, objc; Tcl_Obj **objv; TkText *textPtr; @@ -3155,9 +3151,7 @@ DeleteIndexRange( for (i=0, hPtr=Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search); hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) { - TkTextTag *tagPtr = Tcl_GetHashValue(hPtr); - - TkBTreeTag(&index1, &index2, tagPtr, 0); + TkBTreeTag(&index1, &index2, (TkTextTag *)Tcl_GetHashValue(hPtr), 0); } /* @@ -3191,7 +3185,7 @@ DeleteIndexRange( resetViewCount = 0; if (sharedTextPtr->refCount > PIXEL_CLIENTS) { - lineAndByteIndex = ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount); + lineAndByteIndex = (int *)ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount); } else { lineAndByteIndex = pixels; } @@ -3380,7 +3374,7 @@ TextFetchSelection( * not including terminating NULL * character. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TkTextIndex eof; int count, chunkSize, offsetInSeg; TkTextSearch search; @@ -3464,7 +3458,7 @@ TextFetchSelection( if ((segPtr->typePtr == &tkTextCharType) && !TkTextIsElided(textPtr, &textPtr->selIndex, NULL)) { memcpy(buffer, segPtr->body.chars + offsetInSeg, - (size_t) chunkSize); + chunkSize); buffer += chunkSize; maxBytes -= chunkSize; count += chunkSize; @@ -3511,7 +3505,7 @@ void TkTextLostSelection( ClientData clientData) /* Information about text widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; if (TkpAlwaysShowSelection(textPtr->tkwin)) { TkTextIndex start, end; @@ -3596,7 +3590,7 @@ static void TextBlinkProc( ClientData clientData) /* Pointer to record describing text. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TkTextIndex index; int x, y, w, h, charWidth; @@ -3976,7 +3970,7 @@ TextSearchGetLineIndex( { const TkTextIndex *indexPtr; int line; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; indexPtr = TkTextGetIndexFromObj(interp, textPtr, objPtr); if (indexPtr == NULL) { @@ -4041,7 +4035,7 @@ TextSearchIndexInLine( TkTextSegment *segPtr; TkTextIndex curIndex; int index, leftToScan; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; index = 0; curIndex.tree = textPtr->sharedTextPtr->tree; @@ -4111,7 +4105,7 @@ TextSearchAddNextLine( TkTextLine *linePtr, *thisLinePtr; TkTextIndex curIndex; TkTextSegment *segPtr; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; int nothingYet = 1; /* @@ -4233,7 +4227,7 @@ TextSearchFoundMatch( TkTextIndex curIndex, foundIndex; TkTextSegment *segPtr; TkTextLine *linePtr; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; if (lineNum == searchSpecPtr->stopLine) { /* @@ -4284,7 +4278,7 @@ TextSearchFoundMatch( * reached the end of the match or we have reached the end of the line. */ - linePtr = clientData; + linePtr = (TkTextLine *)clientData; if (linePtr == NULL) { linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr, lineNum); @@ -4494,8 +4488,8 @@ TkTextGetTabs( * Parse the elements of the list one at a time to fill in the array. */ - tabArrayPtr = ckalloc(sizeof(TkTextTabArray) - + (count - 1) * sizeof(TkTextTab)); + tabArrayPtr = (TkTextTabArray *)ckalloc(Tk_Offset(TkTextTabArray, tabs) + + count * sizeof(TkTextTab)); tabArrayPtr->numTabs = 0; prevStop = 0.0; lastStop = 0.0; @@ -4621,7 +4615,7 @@ TkTextGetTabs( static int TextDumpCmd( - register TkText *textPtr, /* Information about text widget. */ + TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already @@ -4708,14 +4702,13 @@ TextDumpCmd( if (objc == arg) { TkTextIndexForwChars(NULL, &index1, 1, &index2, COUNT_INDICES); } else { - size_t length; + int length; const char *str; if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) { return TCL_ERROR; } - str = Tcl_GetString(objv[arg]); - length = objv[arg]->length; + str = Tcl_GetStringFromObj(objv[arg], &length); if (strncmp(str, "end", length) == 0) { atEnd = 1; } @@ -4859,7 +4852,7 @@ DumpLine( */ int length = last - first; - char *range = ckalloc(length + 1); + char *range = (char *)ckalloc(length + 1); memcpy(range, segPtr->body.chars + first, length); range[length] = '\0'; @@ -4890,7 +4883,7 @@ DumpLine( name = NULL; lineChanged = 0; } else { - name = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, + name = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, markPtr->hPtr); } if (name != NULL) { @@ -5016,7 +5009,7 @@ DumpSegment( const char *value, /* Segment value. */ Tcl_Obj *command, /* Script callback. */ const TkTextIndex *index, /* index with line/byte position info. */ - int what) /* Look for TK_DUMP_INDEX bit. */ + TCL_UNUSED(int)) /* Look for TK_DUMP_INDEX bit. */ { char buffer[TK_POS_CHARS]; Tcl_Obj *values[3], *tuple; @@ -5518,7 +5511,7 @@ void TkTextRunAfterSyncCmd( ClientData clientData) /* Information about text widget. */ { - register TkText *textPtr = (TkText *) clientData; + TkText *textPtr = (TkText *)clientData; int code; if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { @@ -5592,7 +5585,7 @@ SearchPerform( if (toPtr != NULL) { const TkTextIndex *indexToPtr, *indexFromPtr; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; indexToPtr = TkTextGetIndexFromObj(interp, textPtr, toPtr); if (indexToPtr == NULL) { @@ -5673,7 +5666,8 @@ SearchCore( * they are Unicode char offsets. */ - int firstOffset, lastOffset, matchOffset, matchLength; + int firstOffset, lastOffset; + int matchOffset, matchLength; int passes; int lineNum = searchSpecPtr->startLine; int code = TCL_OK; @@ -5746,8 +5740,7 @@ SearchCore( * it has dual purpose. */ - pattern = Tcl_GetString(patObj); - matchLength = patObj->length; + pattern = Tcl_GetStringFromObj(patObj, &matchLength); nl = strchr(pattern, '\n'); /* @@ -5916,7 +5909,7 @@ SearchCore( } while (p >= startOfLine + firstOffset) { if (matchLength == 0 || (p[0] == c && !strncmp( - p, pattern, (size_t) matchLength))) { + p, pattern, matchLength))) { goto backwardsMatch; } p--; @@ -5945,7 +5938,7 @@ SearchCore( */ p = startOfLine + lastOffset - firstNewLine - 1; - if (strncmp(p, pattern, (unsigned) firstNewLine + 1)) { + if (strncmp(p, pattern, firstNewLine + 1)) { /* * No match. */ @@ -6011,7 +6004,7 @@ SearchCore( * result. */ - if (strncmp(p,pattern,(size_t)matchLength)) { + if (strncmp(p, pattern, matchLength)) { p = NULL; } break; @@ -6259,8 +6252,8 @@ SearchCore( */ if ((match && - firstOffset+info.matches[0].end != lastTotal && - firstOffset+info.matches[0].end < prevFullLine) + firstOffset + info.matches[0].end != lastTotal && + firstOffset + info.matches[0].end < prevFullLine) || info.extendStart < 0) { break; } @@ -6329,8 +6322,8 @@ SearchCore( * Possible overlap or enclosure. */ - if (thisOffset-lastNonOverlap >= - lastBackwardsMatchOffset+matchLength){ + if (thisOffset - lastNonOverlap >= + lastBackwardsMatchOffset + matchLength){ /* * Totally encloses previous match, so * forget the previous match. @@ -6434,7 +6427,7 @@ SearchCore( * matches on the heap. */ - int *newArray = + int *newArray = (int *) ckalloc(4 * matchNum * sizeof(int)); memcpy(newArray, storeMatch, matchNum*sizeof(int)); memcpy(newArray + 2*matchNum, storeLength, @@ -6695,8 +6688,8 @@ SearchCore( static Tcl_Obj * GetLineStartEnd( - ClientData clientData, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *recordPtr, /* Pointer to widget record. */ int internalOffset) /* Offset within *recordPtr containing the * line value. */ @@ -6730,9 +6723,9 @@ GetLineStartEnd( static int SetLineStartEnd( - ClientData clientData, + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interp; may be used for errors. */ - Tk_Window tkwin, /* Window for which option is being set. */ + TCL_UNUSED(Tk_Window), /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. * We use a pointer to the pointer because we * may need to return a value (NULL). */ @@ -6789,8 +6782,8 @@ SetLineStartEnd( static void RestoreLineStartEnd( - ClientData clientData, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *internalPtr, /* Pointer to storage for value. */ char *oldInternalPtr) /* Pointer to old value. */ { @@ -6848,7 +6841,7 @@ ObjectIsEmpty( int TkpTesttextCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -6867,7 +6860,7 @@ TkpTesttextCmd( if (Tcl_GetCommandInfo(interp, Tcl_GetString(objv[1]), &info) == 0) { return TCL_ERROR; } - textPtr = info.objClientData; + textPtr = (TkText *)info.objClientData; len = strlen(Tcl_GetString(objv[2])); if (strncmp(Tcl_GetString(objv[2]), "byteindex", len) == 0) { if (objc != 5) { diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 6d680f6..6ab8508 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -444,8 +444,8 @@ typedef struct TextDInfo { typedef struct CharInfo { int numBytes; /* Number of bytes to display. */ - char chars[1]; /* UTF characters to display. Actual size will - * be numBytes, not 1. THIS MUST BE THE LAST + char chars[1]; /* UTF characters to display. + * Allocated as large as necessary. THIS MUST BE THE LAST * FIELD IN THE STRUCTURE. */ } CharInfo; @@ -658,10 +658,10 @@ void TkTextCreateDInfo( TkText *textPtr) /* Overall information for text widget. */ { - register TextDInfo *dInfoPtr; + TextDInfo *dInfoPtr; XGCValues gcValues; - dInfoPtr = ckalloc(sizeof(TextDInfo)); + dInfoPtr = (TextDInfo *)ckalloc(sizeof(TextDInfo)); Tcl_InitHashTable(&dInfoPtr->styleTable, sizeof(StyleValues)/sizeof(int)); dInfoPtr->dLinePtr = NULL; dInfoPtr->copyGC = NULL; @@ -717,7 +717,7 @@ void TkTextFreeDInfo( TkText *textPtr) /* Overall information for text widget. */ { - register TextDInfo *dInfoPtr = textPtr->dInfoPtr; + TextDInfo *dInfoPtr = textPtr->dInfoPtr; /* * Be careful to free up styleTable *after* freeing up all the DLines, so @@ -773,7 +773,7 @@ GetStyle( * information is wanted. */ { TkTextTag **tagPtrs; - register TkTextTag *tagPtr; + TkTextTag *tagPtr; StyleValues styleValues; TextStyle *stylePtr; Tcl_HashEntry *hPtr; @@ -1002,7 +1002,7 @@ GetStyle( hPtr = Tcl_CreateHashEntry(&textPtr->dInfoPtr->styleTable, (char *) &styleValues, &isNew); if (!isNew) { - stylePtr = Tcl_GetHashValue(hPtr); + stylePtr = (TextStyle *)Tcl_GetHashValue(hPtr); stylePtr->refCount++; return stylePtr; } @@ -1011,7 +1011,7 @@ GetStyle( * No existing style matched. Make a new one. */ - stylePtr = ckalloc(sizeof(TextStyle)); + stylePtr = (TextStyle *)ckalloc(sizeof(TextStyle)); stylePtr->refCount = 1; if (styleValues.border != NULL) { gcValues.foreground = Tk_3DBorderColor(styleValues.border)->pixel; @@ -1069,7 +1069,7 @@ GetStyle( static void FreeStyle( TkText *textPtr, /* Information about overall widget. */ - register TextStyle *stylePtr) + TextStyle *stylePtr) /* Information about style to free. */ { stylePtr->refCount--; @@ -1132,7 +1132,7 @@ LayoutDLine( * necessarily point to a character * segment. */ { - register DLine *dlPtr; /* New display line. */ + DLine *dlPtr; /* New display line. */ TkTextSegment *segPtr; /* Current segment in text. */ TkTextDispChunk *lastChunkPtr; /* Last chunk allocated so far for line. */ @@ -1186,7 +1186,7 @@ LayoutDLine( * Create and initialize a new DLine structure. */ - dlPtr = ckalloc(sizeof(DLine)); + dlPtr = (DLine *)ckalloc(sizeof(DLine)); dlPtr->index = *indexPtr; dlPtr->byteCount = 0; dlPtr->y = 0; @@ -1435,7 +1435,7 @@ LayoutDLine( continue; } if (chunkPtr == NULL) { - chunkPtr = ckalloc(sizeof(TkTextDispChunk)); + chunkPtr = (TkTextDispChunk *)ckalloc(sizeof(TkTextDispChunk)); chunkPtr->nextPtr = NULL; chunkPtr->clientData = NULL; } @@ -1833,8 +1833,8 @@ static void UpdateDisplayInfo( TkText *textPtr) /* Text widget to update. */ { - register TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register DLine *dlPtr, *prevPtr; + TextDInfo *dInfoPtr = textPtr->dInfoPtr; + DLine *dlPtr, *prevPtr; TkTextIndex index; TkTextLine *lastLinePtr; int y, maxY, xPixelOffset, maxOffset, lineHeight; @@ -1871,7 +1871,7 @@ UpdateDisplayInfo( y = dInfoPtr->y - dInfoPtr->newTopPixelOffset; maxY = dInfoPtr->maxY; while (1) { - register DLine *newPtr; + DLine *newPtr; if (index.linePtr == lastLinePtr) { break; @@ -1982,7 +1982,7 @@ UpdateDisplayInfo( */ if (index.linePtr != prevPtr->index.linePtr) { - register DLine *nextPtr; + DLine *nextPtr; nextPtr = dlPtr; while ((nextPtr != NULL) @@ -2351,7 +2351,7 @@ UpdateDisplayInfo( static void FreeDLines( TkText *textPtr, /* Information about overall text widget. */ - register DLine *firstPtr, /* Pointer to first DLine to free up. */ + DLine *firstPtr, /* Pointer to first DLine to free up. */ DLine *lastPtr, /* Pointer to DLine just after last one to * free (NULL means everything starting with * firstPtr). */ @@ -2364,8 +2364,8 @@ FreeDLines( * we shouldn't invalidate anything for the * overall widget. */ { - register TkTextDispChunk *chunkPtr, *nextChunkPtr; - register DLine *nextDLinePtr; + TkTextDispChunk *chunkPtr, *nextChunkPtr; + DLine *nextDLinePtr; if (action == DLINE_FREE_TEMP) { lineHeightsRecalculated++; @@ -2384,7 +2384,7 @@ FreeDLines( if (textPtr->dInfoPtr->dLinePtr == firstPtr) { textPtr->dInfoPtr->dLinePtr = lastPtr; } else { - register DLine *prevPtr; + DLine *prevPtr; for (prevPtr = textPtr->dInfoPtr->dLinePtr; prevPtr->nextPtr != firstPtr; prevPtr = prevPtr->nextPtr) { @@ -2432,14 +2432,14 @@ FreeDLines( static void DisplayDLine( TkText *textPtr, /* Text widget in which to draw line. */ - register DLine *dlPtr, /* Information about line to draw. */ + DLine *dlPtr, /* Information about line to draw. */ DLine *prevPtr, /* Line just before one to draw, or NULL if * dlPtr is the top line. */ Pixmap pixmap) /* Pixmap to use for double-buffering. Caller * must make sure it's large enough to hold * line. */ { - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; TextDInfo *dInfoPtr = textPtr->dInfoPtr; Display *display; int height, y_off; @@ -2611,7 +2611,7 @@ DisplayDLine( static void DisplayLineBackground( TkText *textPtr, /* Text widget containing line. */ - register DLine *dlPtr, /* Information about line to draw. */ + DLine *dlPtr, /* Information about line to draw. */ DLine *prevPtr, /* Line just above dlPtr, or NULL if dlPtr is * the top-most line in the window. */ Pixmap pixmap) /* Pixmap to use for double-buffering. Caller @@ -3007,7 +3007,7 @@ static void AsyncUpdateLineMetrics( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TextDInfo *dInfoPtr = textPtr->dInfoPtr; int lineNum; @@ -4164,9 +4164,9 @@ static void DisplayText( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register DLine *dlPtr; + DLine *dlPtr; DLine *prevPtr; Pixmap pixmap; int maxHeight, borders; @@ -4254,7 +4254,7 @@ DisplayText( */ for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL; dlPtr = dlPtr->nextPtr) { - register DLine *dlPtr2; + DLine *dlPtr2; int offset, height, y, oldY; TkRegion damageRgn; @@ -4552,7 +4552,7 @@ DisplayText( * proc of embedded windows only. */ #endif - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL); chunkPtr = chunkPtr->nextPtr) { @@ -4754,7 +4754,7 @@ TextInvalidateRegion( TkText *textPtr, /* Widget record for text widget. */ TkRegion region) /* Region of area to redraw. */ { - register DLine *dlPtr; + DLine *dlPtr; TextDInfo *dInfoPtr = textPtr->dInfoPtr; int maxY, inset; XRectangle rect; @@ -5012,7 +5012,7 @@ TextRedrawTag( int withTag) /* 1 means redraw characters that have the * tag, 0 means redraw those without. */ { - register DLine *dlPtr; + DLine *dlPtr; DLine *endPtr; int tagOn; TkTextSearch search; @@ -5352,7 +5352,7 @@ TkTextSetYView( * are to be off the top of the screen. */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register DLine *dlPtr; + DLine *dlPtr; int bottomY, close, lineIndex; TkTextIndex tmpIndex, rounded; int lineHeight; @@ -6180,7 +6180,7 @@ TkTextYviewCmd( pickPlace = 0; if (Tcl_GetString(objv[2])[0] == '-') { - register const char *switchStr = + const char *switchStr = Tcl_GetStringFromObj(objv[2], &switchLength); if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace", @@ -6358,7 +6358,7 @@ TkTextPendingsync( int TkTextScanCmd( - register TkText *textPtr, /* Information about text widget. */ + TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already @@ -6844,7 +6844,7 @@ static void AsyncUpdateYScrollbar( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; textPtr->dInfoPtr->scrollbarTimer = NULL; @@ -6879,7 +6879,7 @@ AsyncUpdateYScrollbar( static DLine * FindDLine( TkText *textPtr, /* Widget record for text widget. */ - register DLine *dlPtr, /* Pointer to first in list of DLines to + DLine *dlPtr, /* Pointer to first in list of DLines to * search. */ const TkTextIndex *indexPtr)/* Index of desired character. */ { @@ -7049,7 +7049,7 @@ TkTextPixelIndex( * border of the widget). */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register DLine *dlPtr, *validDlPtr; + DLine *dlPtr, *validDlPtr; int nearby = 0; /* @@ -7151,7 +7151,7 @@ DlineIndexOfX( * the character nearest to x. */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; /* * Scan through the line's chunks to find the one that contains the @@ -7279,7 +7279,7 @@ DlineXOfIndex( int byteIndex) /* The byte index for which we want the * coordinate. */ { - register TkTextDispChunk *chunkPtr = dlPtr->chunkPtr; + TkTextDispChunk *chunkPtr = dlPtr->chunkPtr; int x = 0; if (byteIndex == 0 || chunkPtr == NULL) { @@ -7349,7 +7349,7 @@ TkTextIndexBbox( { TextDInfo *dInfoPtr = textPtr->dInfoPtr; DLine *dlPtr; - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; int byteCount; /* @@ -7541,14 +7541,14 @@ TkTextDLineInfo( static void ElideBboxProc( - TkText *textPtr, + TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ - int index, /* Index of desired character within the + TCL_UNUSED(int), /* Index of desired character within the * chunk. */ int y, /* Topmost pixel in area allocated for this * line. */ - int lineHeight, /* Height of line, in pixels. */ - int baseline, /* Location of line's baseline, in pixels + TCL_UNUSED(int), /* Height of line, in pixels. */ + TCL_UNUSED(int), /* Location of line's baseline, in pixels * measured down from y. */ int *xPtr, int *yPtr, /* Gets filled in with coords of character's * upper-left pixel. X-coord is in same @@ -7569,8 +7569,8 @@ ElideBboxProc( static int ElideMeasureProc( - TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */ - int x) /* X-coordinate, in same coordinate system as + TCL_UNUSED(TkTextDispChunk *), /* Chunk containing desired coord. */ + TCL_UNUSED(int)) /* X-coordinate, in same coordinate system as * chunkPtr->x. */ { return 0 /*chunkPtr->numBytes - 1*/; @@ -7599,8 +7599,8 @@ ElideMeasureProc( int TkTextCharLayoutProc( - TkText *textPtr, /* Text widget being layed out. */ - TkTextIndex *indexPtr, /* Index of first character to lay out + TCL_UNUSED(TkText *), /* Text widget being layed out. */ + TCL_UNUSED(TkTextIndex *), /* Index of first character to lay out * (corresponds to segPtr and offset). */ TkTextSegment *segPtr, /* Segment being layed out. */ int byteOffset, /* Byte offset within segment of first @@ -7614,7 +7614,7 @@ TkTextCharLayoutProc( TkWrapMode wrapMode, /* How to handle line wrapping: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ - register TkTextDispChunk *chunkPtr) + TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been * set by the caller. */ @@ -7765,9 +7765,9 @@ TkTextCharLayoutProc( chunkPtr->breakIndex = -1; #if !TK_LAYOUT_WITH_BASE_CHUNKS - ciPtr = ckalloc((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit); + ciPtr = (CharInfo *)ckalloc((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit); chunkPtr->clientData = ciPtr; - memcpy(ciPtr->chars, p, (unsigned) bytesThatFit); + memcpy(ciPtr->chars, p, bytesThatFit); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ ciPtr->numBytes = bytesThatFit; @@ -7878,7 +7878,7 @@ CharChunkMeasureChars( * here. */ { Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; - CharInfo *ciPtr = chunkPtr->clientData; + CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; #if !TK_LAYOUT_WITH_BASE_CHUNKS if (chars == NULL) { @@ -7953,21 +7953,21 @@ CharChunkMeasureChars( static void CharDisplayProc( - TkText *textPtr, + TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */ int x, /* X-position in dst at which to draw this * chunk (may differ from the x-position in * the chunk because of scrolling). */ int y, /* Y-position at which to draw this chunk in * dst. */ - int height, /* Total height of line. */ + TCL_UNUSED(int), /* Total height of line. */ int baseline, /* Offset of baseline from y. */ Display *display, /* Display to use for drawing. */ Drawable dst, /* Pixmap or window in which to draw chunk. */ - int screenY) /* Y-coordinate in text window that + TCL_UNUSED(int)) /* Y-coordinate in text window that * corresponds to y. */ { - CharInfo *ciPtr = chunkPtr->clientData; + CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; const char *string; TextStyle *stylePtr; StyleValues *sValuePtr; @@ -8115,10 +8115,10 @@ CharDisplayProc( static void CharUndisplayProc( - TkText *textPtr, /* Overall information about text widget. */ + TCL_UNUSED(TkText *), /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { - CharInfo *ciPtr = chunkPtr->clientData; + CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; if (ciPtr) { #if TK_LAYOUT_WITH_BASE_CHUNKS @@ -8204,13 +8204,13 @@ CharMeasureProc( static void CharBboxProc( - TkText *textPtr, + TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ int byteIndex, /* Byte offset of desired character within the * chunk. */ int y, /* Topmost pixel in area allocated for this * line. */ - int lineHeight, /* Height of line, in pixels. */ + TCL_UNUSED(int), /* Height of line, in pixels. */ int baseline, /* Location of line's baseline, in pixels * measured down from y. */ int *xPtr, int *yPtr, /* Gets filled in with coords of character's @@ -8221,7 +8221,7 @@ CharBboxProc( int *heightPtr) /* Gets filled in with height of character, in * pixels. */ { - CharInfo *ciPtr = chunkPtr->clientData; + CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; int maxX; maxX = chunkPtr->width + chunkPtr->x; @@ -8384,7 +8384,7 @@ AdjustForTab( if (chunkPtr2->displayProc != CharDisplayProc) { continue; } - ciPtr = chunkPtr2->clientData; + ciPtr = (CharInfo *)chunkPtr2->clientData; for (p = ciPtr->chars, i = 0; i < ciPtr->numBytes; p++, i++) { if (isdigit(UCHAR(*p))) { gotDigit = 1; @@ -8405,7 +8405,7 @@ AdjustForTab( if (decimalChunkPtr != NULL) { int curX; - ciPtr = decimalChunkPtr->clientData; + ciPtr = (CharInfo *)decimalChunkPtr->clientData; CharChunkMeasureChars(decimalChunkPtr, NULL, 0, 0, decimal, decimalChunkPtr->x, -1, 0, &curX); desired = tabX - (curX - x); @@ -8676,7 +8676,7 @@ MeasureChars( int curX, width, ch; const char *special, *end, *start; - ch = 0; /* lint. */ + ch = 0; curX = startX; start = source + rangeStart; end = start + rangeLength; diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl index b5cffa8..43f8801 100644 --- a/library/demos/knightstour.tcl +++ b/library/demos/knightstour.tcl @@ -21,8 +21,6 @@ # If you let it repeat then it will choose random start positions # for each new tour. -package require Tk 8.5 - # Return a list of accessible squares from a given square proc ValidMoves {square} { set moves {} diff --git a/tests/all.tcl b/tests/all.tcl index d15e5ca..b477218 100644 --- a/tests/all.tcl +++ b/tests/all.tcl @@ -14,6 +14,8 @@ package require tcltest 2.2 tcltest::configure {*}$argv tcltest::configure -testdir [file normalize [file dirname [info script]]] tcltest::configure -loadfile \ - [file join [tcltest::testsDirectory] constraints.tcl] + [file join [tcltest::testsDirectory] constraints.tcl] tcltest::configure -singleproc 1 -tcltest::runAllTests +set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)] +unset -nocomplain env(ERROR_ON_FAILURES) +if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1} diff --git a/tests/busy.test b/tests/busy.test index cdce30e..98d83a8 100644 --- a/tests/busy.test +++ b/tests/busy.test @@ -6,7 +6,7 @@ # # Copyright (c) 1998-2000 by Jos Decoster. All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 tcltest::configure {*}$argv tcltest::loadTestedCommands namespace import -force tcltest::test diff --git a/tests/canvMoveto.test b/tests/canvMoveto.test index 79761a4..a6cf849 100644 --- a/tests/canvMoveto.test +++ b/tests/canvMoveto.test @@ -6,7 +6,7 @@ # Copyright (c) 2004 Neil McKay. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands @@ -33,7 +33,7 @@ test canvMoveto-1.5 {Bad args handling for "moveto" command} -body { test canvMoveto-2.1 {Canvas "moveto" command coordinates} { .c moveto test 200 150 .c bbox test -} {200 150 272 232} +} {200 150 272 232} test canvMoveto-2.2 {Canvas "moveto" command, blank y coordinate} { .c moveto test 200 150 .c moveto test 150 {} diff --git a/tests/canvas.test b/tests/canvas.test index 697badb..54bf500 100644 --- a/tests/canvas.test +++ b/tests/canvas.test @@ -7,7 +7,7 @@ # Copyright (c) 2008 Donal K. Fellows # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands imageInit diff --git a/tests/color.test b/tests/color.test index 4cdaf23..ce1a75d 100644 --- a/tests/color.test +++ b/tests/color.test @@ -5,7 +5,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands diff --git a/tests/constraints.tcl b/tests/constraints.tcl index 9b48e8d..826c281 100644 --- a/tests/constraints.tcl +++ b/tests/constraints.tcl @@ -17,7 +17,7 @@ if {![winfo ismapped .]} { update } -package require tcltest 2.1 +package require tcltest 2.2 namespace eval tk { namespace eval test { diff --git a/tests/filebox.test b/tests/filebox.test index 0114a07..fdb5614 100644 --- a/tests/filebox.test +++ b/tests/filebox.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands @@ -167,7 +167,7 @@ foreach mode $modes { catch {tk_getOpenFile -foo 1} msg regsub -all , $msg "" options regsub \"-foo\" $options "" options - + foreach option $options { if {[string index $option 0] eq "-"} { test filebox-1.2-$mode$option "tk_getOpenFile command" -body { diff --git a/tests/fontchooser.test b/tests/fontchooser.test index 4dad5da..3fbc01f 100644 --- a/tests/fontchooser.test +++ b/tests/fontchooser.test @@ -2,7 +2,7 @@ # # Copyright (c) 2008 Pat Thoyts -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands diff --git a/tests/scrollbar.test b/tests/scrollbar.test index ae938dc..097ab79 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands @@ -23,7 +23,7 @@ proc getTroughSize {w} { return [expr {[winfo height $w] - 2*[testmetrics cyvscroll $w]}] } else { return [expr {[winfo width $w] - 2*[testmetrics cxhscroll $w]}] - } + } } else { if {[tk windowingsystem] eq "x11"} { # Calculations here assume that the arrow area is a square. @@ -60,7 +60,7 @@ proc getTroughSize {w} { foreach {width height} [wm minsize .] { set height [expr {($height < 200) ? 200 : $height}] set width [expr {($width < 1) ? 1 : $width}] -} +} frame .f -height $height -width $width pack .f -side left @@ -380,15 +380,15 @@ test scrollbar-3.59 {ScrollbarWidgetCmd procedure, "set" option} { set result } {0.0 0.3} test scrollbar-3.60 {ScrollbarWidgetCmd procedure, "set" option} { - .s set 1.1 .4 + .s set 1.1 .4 .s get } {1.0 1.0} test scrollbar-3.61 {ScrollbarWidgetCmd procedure, "set" option} { - .s set .5 -.3 + .s set .5 -.3 .s get } {0.5 0.5} test scrollbar-3.62 {ScrollbarWidgetCmd procedure, "set" option} { - .s set .5 87 + .s set .5 87 .s get } {0.5 1.0} test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} { @@ -412,15 +412,15 @@ test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 3 jkl} msg] $msg } {1 {expected integer but got "jkl"}} test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} { - .s set -10 50 20 30 + .s set -10 50 20 30 .s get } {0 50 0 0} test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} { - .s set 100 -10 20 30 + .s set 100 -10 20 30 .s get } {100 0 20 30} test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} { - .s set 100 50 30 20 + .s set 100 50 30 20 .s get } {100 50 30 30} test scrollbar-3.71 {ScrollbarWidgetCmd procedure, "set" option} { @@ -499,7 +499,7 @@ test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua { .s identify 8 19 } {trough1} test scrollbar-6.14 {ScrollbarPosition procedure} win { - .s identify [expr {[winfo width .s] / 2}] 0 + .s identify [expr {[winfo width .s] / 2}] 0 } {arrow1} test scrollbar-6.15 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[testmetrics cyvscroll .s] - 1}] @@ -610,7 +610,7 @@ test scrollbar-6.41.2 {ScrollbarPosition procedure} aqua { } {trough2} test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} { .t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s] - - 1}] [expr {[winfo height .t.s] / 2}] + - 1}] [expr {[winfo height .t.s] / 2}] } {slider} test scrollbar-6.44 {ScrollbarPosition procedure} unix { .t.s identify 100 18 @@ -759,7 +759,7 @@ test scrollbar-11.1 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destructi update ; # shall not trigger error invalid command name ".top.s" } -cleanup { destroy .top.s .top -} -result {} +} -result {} test scrollbar-11.2 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body { proc destroy_scrollbar {{y 0}} { if {[winfo exists .top.s]} { @@ -778,7 +778,7 @@ test scrollbar-11.2 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destructi update ; # shall not trigger error invalid command name ".top.s" } -cleanup { destroy .top.s .top -} -result {} +} -result {} catch {destroy .s} catch {destroy .t} diff --git a/tests/send.test b/tests/send.test index 403a207..7fdf0af 100644 --- a/tests/send.test +++ b/tests/send.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands diff --git a/tests/textDisp.test b/tests/textDisp.test index 0881102..44297a0 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test @@ -612,7 +612,7 @@ if {$tcl_platform(platform) == "windows"} { test textDisp-4.6 {UpdateDisplayInfo, tiny window} { # This test was failing on Windows because the title bar on . # was a certain minimum size and it was interfering with the size - # requested. The "overrideredirect" gets rid of the titlebar so + # requested. The "overrideredirect" gets rid of the titlebar so # the toplevel can shrink to the appropriate size. On Unix, setting # the overrideredirect on "." confuses the window manager and # causes subsequent tests to fail. @@ -644,7 +644,7 @@ set hlth [.t cget -highlightthickness] test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} { # This test was failing on Windows because the title bar on . # was a certain minimum size and it was interfering with the size - # requested. The "overrideredirect" gets rid of the titlebar so + # requested. The "overrideredirect" gets rid of the titlebar so # the toplevel can shrink to the appropriate size. On Unix, setting # the overrideredirect on "." confuses the window manager and # causes subsequent tests to fail. @@ -1912,7 +1912,7 @@ test textDisp-14.14 {TkTextXviewCmd procedure} { .t insert end "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9\n" .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview moveto 0 - .t xview scroll 21 u + .t xview scroll 21 u set x [.t index @0,22] .t xview scroll -1 u lappend x [.t index @0,22] @@ -2369,7 +2369,7 @@ test textDisp-17.8 {TkTextScanCmd procedure} {textfonts} { .t xview moveto 0 .t scan mark 0 60 .t scan dragto 30 100 - .t scan dragto 25 95 + .t scan dragto 25 95 .t index @0,0 } {4.7} test textDisp-17.9 {TkTextScanCmd procedure} {textfonts} { @@ -2931,7 +2931,7 @@ test textDisp-20.1 {FindDLine} { list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \ [.t dlineinfo 58.0] } [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] -test textDisp-20.2 {FindDLine} { +test textDisp-20.2 {FindDLine} { .t yview 100.0 .t yview -pickplace 53.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21] @@ -2980,7 +2980,7 @@ test textDisp-21.4 {count -displaylines regression} { Use the Up (cursor) key to scroll up one line at a time. At the second press, the cursor either gets locked or jumps several lines. Connect with Tkcon. The command -.u count -displaylines \ +.u count -displaylines \ 3.10 2.173 should give answer -1; it gives me 5. @@ -3884,7 +3884,7 @@ test textDisp-29.2.5 {miscellaneous: can show last character} { set iWidth [lindex [.t2.t bbox end-2c] 2] .t2.t xview scroll 2 units set iWidth2 [lindex [.t2.t bbox end-2c] 2] - + if {($iWidth == $iWidth2) && $iWidth >= 2} { set result "correct" } else { diff --git a/tests/textIndex.test b/tests/textIndex.test index 4db3548..bd4e955 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test @@ -17,7 +17,7 @@ pack .t -expand 1 -fill both update .t debug on wm geometry . {} - + # The statements below reset the main window; it's needed if the window # manager is mwm to make mwm forget about a previous minimum size setting. diff --git a/tests/ttk/all.tcl b/tests/ttk/all.tcl index f03cd56..b55f957 100644 --- a/tests/ttk/all.tcl +++ b/tests/ttk/all.tcl @@ -16,5 +16,6 @@ tcltest::configure -testdir [file normalize [file dirname [info script]]] tcltest::configure -loadfile \ [file join [file dirname [tcltest::testsDirectory]] constraints.tcl] tcltest::configure -singleproc 1 -tcltest::runAllTests - +set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)] +unset -nocomplain env(ERROR_ON_FAILURES) +if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1} diff --git a/tests/ttk/checkbutton.test b/tests/ttk/checkbutton.test index 15d365f..8b8c9b7 100644 --- a/tests/ttk/checkbutton.test +++ b/tests/ttk/checkbutton.test @@ -3,7 +3,8 @@ # package require Tk -package require tcltest ; namespace import -force tcltest::* +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test checkbutton-1.1 "Checkbutton check" -body { diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test index c14db9b..ef77adb 100644 --- a/tests/ttk/combobox.test +++ b/tests/ttk/combobox.test @@ -2,8 +2,9 @@ # ttk::combobox widget tests # -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test combobox-1.0 "Combobox tests -- setup" -body { diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index d5bcf45..6524d71 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -2,8 +2,9 @@ # Tile package: entry widget tests # -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands variable scrollInfo diff --git a/tests/ttk/image.test b/tests/ttk/image.test index 5e48d5c..ea0ab1d 100644 --- a/tests/ttk/image.test +++ b/tests/ttk/image.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test image-1.1 "Bad image element" -body { diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test index 6b4761f..1f64d67 100644 --- a/tests/ttk/labelframe.test +++ b/tests/ttk/labelframe.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test labelframe-1.0 "Setup" -body { diff --git a/tests/ttk/layout.test b/tests/ttk/layout.test index 52f44b4..5dfce9b 100644 --- a/tests/ttk/layout.test +++ b/tests/ttk/layout.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test layout-1.1 "Size computations for mixed-orientation layouts" -body { diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test index ac63088..fbab6bd 100644 --- a/tests/ttk/notebook.test +++ b/tests/ttk/notebook.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test notebook-1.0 "Setup" -body { diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test index ad2865c..9d3cf77 100644 --- a/tests/ttk/panedwindow.test +++ b/tests/ttk/panedwindow.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands proc propagate-geometry {} { update idletasks } diff --git a/tests/ttk/progressbar.test b/tests/ttk/progressbar.test index b9add86..abdb55a 100644 --- a/tests/ttk/progressbar.test +++ b/tests/ttk/progressbar.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands diff --git a/tests/ttk/radiobutton.test b/tests/ttk/radiobutton.test index ba02954..09abcb8 100644 --- a/tests/ttk/radiobutton.test +++ b/tests/ttk/radiobutton.test @@ -3,7 +3,8 @@ # package require Tk -package require tcltest ; namespace import -force tcltest::* +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test radiobutton-1.1 "Radiobutton check" -body { diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test index 0743def..3c10853 100644 --- a/tests/ttk/scrollbar.test +++ b/tests/ttk/scrollbar.test @@ -1,5 +1,6 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}] diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test index 4bdabee..cd3b2ce 100644 --- a/tests/ttk/spinbox.test +++ b/tests/ttk/spinbox.test @@ -3,7 +3,8 @@ # package require Tk -package require tcltest ; namespace import -force tcltest::* +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands test spinbox-1.0 "Spinbox tests -- setup" -body { diff --git a/tests/ttk/treetags.test b/tests/ttk/treetags.test index f91673f..e3cd383 100644 --- a/tests/ttk/treetags.test +++ b/tests/ttk/treetags.test @@ -1,6 +1,7 @@ package require Tk -package require tcltest ; namespace import -force tcltest::* +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands ### treeview tag invariants: diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test index f068243..51f20a5 100644 --- a/tests/ttk/treeview.test +++ b/tests/ttk/treeview.test @@ -3,8 +3,9 @@ # what it currently does) # -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands # consistencyCheck -- diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test index eb320e9..16d4506 100644 --- a/tests/ttk/ttk.test +++ b/tests/ttk/ttk.test @@ -1,6 +1,7 @@ -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands proc skip args {} diff --git a/tests/ttk/validate.test b/tests/ttk/validate.test index 5755943..5430903 100644 --- a/tests/ttk/validate.test +++ b/tests/ttk/validate.test @@ -3,8 +3,8 @@ ## Derived from core test suite entry-19.1 through entry-19.20 ## -package require Tk 8.5 -package require tcltest 2.1 +package require Tk +package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands diff --git a/tests/ttk/vsapi.test b/tests/ttk/vsapi.test index bb88fef..8fd4c89 100644 --- a/tests/ttk/vsapi.test +++ b/tests/ttk/vsapi.test @@ -1,8 +1,9 @@ # -*- tcl -*- # -package require Tk 8.5 -package require tcltest ; namespace import -force tcltest::* +package require Tk +package require tcltest 2.2 +namespace import -force tcltest::* loadTestedCommands testConstraint xpnative \ diff --git a/tests/unixFont.test b/tests/unixFont.test index 177dab5..eb2a23b 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -12,7 +12,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands diff --git a/tests/winSend.test b/tests/winSend.test index 31c800e..d4860b4 100644 --- a/tests/winSend.test +++ b/tests/winSend.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands diff --git a/tests/wm.test b/tests/wm.test index 58910dd..1eda872 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -11,7 +11,7 @@ # Window manager tests that only work on a specific platform should be placed # in unixWm.test or winWm.test. -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands @@ -1527,7 +1527,7 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body { test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ overrideredirect toplevel on unix} -constraints x11 -body { toplevel .t - tkwait visibility .t + tkwait visibility .t wm overrideredirect .t 1 raise . update @@ -1539,7 +1539,7 @@ test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \ overrideredirect toplevel on macOS or win} -constraints aquaOrWin32 -body { toplevel .t - tkwait visibility .t + tkwait visibility .t wm overrideredirect .t 1 raise . update @@ -1551,7 +1551,7 @@ test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \ test wm-stackorder-5.3 {An overrideredirect window\ can be explicitly lowered} -body { toplevel .t - tkwait visibility .t + tkwait visibility .t wm overrideredirect .t 1 lower .t update diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 00893f2..029f3aa 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -27,7 +27,7 @@ typedef struct ProtocolHandler { /* Next in list of protocol handlers for the * same top-level window, or NULL for end of * list. */ - Tcl_Interp *interp; /* Interpreter in which to invoke command. */ + Tcl_Interp *interp; /* Interpreter in which to invoke command. */ char command[1]; /* Tcl command to invoke when a client message * for this protocol arrives. The actual size * of the structure varies to accommodate the diff --git a/unix/xvfb-run b/unix/xvfb-run index 62388fd..5eb77ac 100755 --- a/unix/xvfb-run +++ b/unix/xvfb-run @@ -93,9 +93,7 @@ clean_up() { } # Parse the command line. -ARGS=$(getopt --options +ae:f:hn:lp:s:w: \ - --long auto-servernum,error-file:,auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: \ - --name "$PROGNAME" -- "$@") +ARGS=$(getopt ae:f:hn:lp:s:w: "$@") GETOPT_STATUS=$? if [ $GETOPT_STATUS -ne 0 ]; then @@ -152,7 +150,23 @@ if [ -z "$AUTHFILE" ]; then fi # Start Xvfb. -MCOOKIE=$(mcookie) +# Get the cookie to use. +set +e +MCOOKIE=$(mcookie 2>/dev/null) + +# If the mcookie utility is not installed, simulate it. + +if [ $? -ne 0 ]; then + # + # Set the random device to /dev/random if you need very secure + # random numbers. Otherwise, /dev/urandom will be fine. + # + + RANDOM_DEVICE=/dev/urandom + + MCOOKIE=$(od -X -A n -N 16 $RANDOM_DEVICE | tr -d '\011\040') +fi +set -e tries=10 while [ $tries -gt 0 ]; do tries=$(( $tries - 1 )) diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 923a58f..ff3f07f 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -57,7 +57,7 @@ typedef struct ProtocolHandler { /* Next in list of protocol handlers for the * same top-level window, or NULL for end of * list. */ - Tcl_Interp *interp; /* Interpreter in which to invoke command. */ + Tcl_Interp *interp; /* Interpreter in which to invoke command. */ char command[1]; /* Tcl command to invoke when a client message * for this protocol arrives. The actual size * of the structure varies to accommodate the |