From 871d0ab87051648f1dcc4fc86445dcde3527c7b2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 12 Dec 2019 16:24:28 +0000 Subject: WIP: Add support for C++ --- generic/tk3d.c | 21 +++---- generic/tkArgv.c | 12 ++-- generic/tkAtom.c | 6 +- generic/tkBind.c | 10 +-- generic/tkConsole.c | 52 ++++++++++------ generic/tkStubLib.c | 4 +- generic/ttk/ttkStubLib.c | 4 +- unix/configure | 10 ++- unix/tkUnixMenubu.c | 7 ++- unix/tkUnixScale.c | 6 +- win/configure | 19 +++++- win/tkWin32Dll.c | 1 + win/tkWin3d.c | 2 +- win/tkWinButton.c | 7 ++- win/tkWinClipboard.c | 16 +++-- win/tkWinColor.c | 26 +++++--- win/tkWinCursor.c | 15 ++++- win/tkWinDialog.c | 19 ++++-- xlib/xcolors.c | 3 + xlib/xgc.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++- xlib/xutil.c | 4 +- 21 files changed, 316 insertions(+), 86 deletions(-) diff --git a/generic/tk3d.c b/generic/tk3d.c index 9ed419a..faa12b7 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -90,7 +90,7 @@ Tk_Alloc3DBorderFromObj( if (objPtr->typePtr != &tkBorderObjType) { InitBorderObj(objPtr); } - borderPtr = objPtr->internalRep.twoPtrValue.ptr1; + borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkBorder, see if it's the one we @@ -127,7 +127,7 @@ Tk_Alloc3DBorderFromObj( */ if (borderPtr != NULL) { - TkBorder *firstBorderPtr = Tcl_GetHashValue(borderPtr->hashPtr); + TkBorder *firstBorderPtr = (TkBorder *)Tcl_GetHashValue(borderPtr->hashPtr); FreeBorderObj(objPtr); for (borderPtr = firstBorderPtr ; borderPtr != NULL; @@ -200,7 +200,7 @@ Tk_Get3DBorder( hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &isNew); if (!isNew) { - existingBorderPtr = Tcl_GetHashValue(hashPtr); + existingBorderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); for (borderPtr = existingBorderPtr; borderPtr != NULL; borderPtr = borderPtr->nextPtr) { if ((Tk_Screen(tkwin) == borderPtr->screen) @@ -420,12 +420,11 @@ Tk_Free3DBorder( Display *display = DisplayOfScreen(borderPtr->screen); TkBorder *prevPtr; - borderPtr->resourceRefCount--; - if (borderPtr->resourceRefCount > 0) { + if (borderPtr->resourceRefCount-- > 1) { return; } - prevPtr = Tcl_GetHashValue(borderPtr->hashPtr); + prevPtr = (TkBorder *)Tcl_GetHashValue(borderPtr->hashPtr); TkpFreeBorder(borderPtr); if (borderPtr->bgColorPtr != NULL) { Tk_FreeColor(borderPtr->bgColorPtr); @@ -527,7 +526,7 @@ static void FreeBorderObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkBorder *borderPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkBorder *borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1; if (borderPtr != NULL) { borderPtr->objRefCount--; @@ -562,7 +561,7 @@ DupBorderObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkBorder *borderPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkBorder *borderPtr = (TkBorder *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = borderPtr; @@ -1253,7 +1252,7 @@ Tk_Get3DBorderFromObj( * cached in the internal representation of the Tcl_Obj. Check it out... */ - borderPtr = objPtr->internalRep.twoPtrValue.ptr1; + borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1; if ((borderPtr != NULL) && (borderPtr->resourceRefCount > 0) && (Tk_Screen(tkwin) == borderPtr->screen) @@ -1281,7 +1280,7 @@ Tk_Get3DBorderFromObj( if (hashPtr == NULL) { goto error; } - for (borderPtr = Tcl_GetHashValue(hashPtr); borderPtr != NULL; + for (borderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); borderPtr != NULL; borderPtr = borderPtr->nextPtr) { if ((Tk_Screen(tkwin) == borderPtr->screen) && (Tk_Colormap(tkwin) == borderPtr->colormap)) { @@ -1371,7 +1370,7 @@ TkDebugBorder( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, name); if (hashPtr != NULL) { - TkBorder *borderPtr = Tcl_GetHashValue(hashPtr); + TkBorder *borderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); if (borderPtr == NULL) { Tcl_Panic("TkDebugBorder found empty hash table entry"); diff --git a/generic/tkArgv.c b/generic/tkArgv.c index ca5ecc0..807a145 100644 --- a/generic/tkArgv.c +++ b/generic/tkArgv.c @@ -228,9 +228,9 @@ Tk_ParseArgv( break; case TK_ARGV_FUNC: { typedef int (ArgvFunc)(char *, const char *, const char *); - ArgvFunc *handlerProc = infoPtr->src; + ArgvFunc *handlerProc = (ArgvFunc *)infoPtr->src; - if (handlerProc(infoPtr->dst, infoPtr->key, argv[srcIndex])) { + if (handlerProc((char *)infoPtr->dst, infoPtr->key, argv[srcIndex])) { srcIndex++; argc--; } @@ -239,9 +239,9 @@ Tk_ParseArgv( case TK_ARGV_GENFUNC: { typedef int (ArgvGenFunc)(char *, Tcl_Interp *, const char *, int, const char **); - ArgvGenFunc *handlerProc = infoPtr->src; + ArgvGenFunc *handlerProc = (ArgvGenFunc *)infoPtr->src; - argc = handlerProc(infoPtr->dst, interp, infoPtr->key, argc, + argc = handlerProc((char *)infoPtr->dst, interp, infoPtr->key, argc, argv+srcIndex); if (argc < 0) { return TCL_ERROR; @@ -253,14 +253,14 @@ Tk_ParseArgv( Tcl_SetErrorCode(interp, "TK", "ARG", "HELP", NULL); return TCL_ERROR; case TK_ARGV_CONST_OPTION: - Tk_AddOption(tkwin, infoPtr->dst, infoPtr->src, + Tk_AddOption(tkwin, (char *)infoPtr->dst, (char *)infoPtr->src, TK_INTERACTIVE_PRIO); break; case TK_ARGV_OPTION_VALUE: if (argc < 1) { goto missingArg; } - Tk_AddOption(tkwin, infoPtr->dst, argv[srcIndex], + Tk_AddOption(tkwin, (char *)infoPtr->dst, argv[srcIndex], TK_INTERACTIVE_PRIO); srcIndex++; argc--; diff --git a/generic/tkAtom.c b/generic/tkAtom.c index ddfa97f..a4e1e11 100644 --- a/generic/tkAtom.c +++ b/generic/tkAtom.c @@ -154,11 +154,11 @@ Tk_GetAtomName( if (mustFree) { XFree(mustFree); } - name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); + name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr, (char *)name); } - return Tcl_GetHashValue(hPtr); + return (const char *)Tcl_GetHashValue(hPtr); } /* @@ -200,7 +200,7 @@ AtomInit( name = atomNameArray[atom - 1]; hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); Tcl_SetHashValue(hPtr, INT2PTR(atom)); - name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); + name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr, (char *)name); } diff --git a/generic/tkBind.c b/generic/tkBind.c index ed81584..371482e 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -4681,7 +4681,7 @@ FindSequence( unsigned sequenceSize = numPats*sizeof(TkPattern); PatSeq *psPtr2; - for (psPtr2 = Tcl_GetHashValue(hPtr); psPtr2; psPtr2 = psPtr2->nextSeqPtr) { + for (psPtr2 = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr2; psPtr2 = psPtr2->nextSeqPtr) { assert(TEST_PSENTRY(psPtr2)); if (numPats == psPtr2->numPats && memcmp(patPtr, psPtr2->pats, sequenceSize) == 0) { ckfree(psPtr); @@ -4717,7 +4717,7 @@ FindSequence( psPtr->added = 0; psPtr->modMaskUsed = (modMask != 0); psPtr->script = NULL; - psPtr->nextSeqPtr = Tcl_GetHashValue(hPtr); + psPtr->nextSeqPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr->hPtr = hPtr; psPtr->ptr.nextObj = NULL; assert(psPtr->ptr.owners == NULL); @@ -4859,7 +4859,7 @@ ParseEventDescription( size = p - field; if (size >= sizeof(buf)) { - bufPtr = ckalloc(size + 1); + bufPtr = (char *)ckalloc(size + 1); } strncpy(bufPtr, field, size); bufPtr[size] = '\0'; @@ -4891,7 +4891,7 @@ ParseEventDescription( if (!(hPtr = Tcl_FindHashEntry(&modTable, field))) { break; } - modPtr = Tcl_GetHashValue(hPtr); + modPtr = (ModInfo *)Tcl_GetHashValue(hPtr); patPtr->modMask |= modPtr->mask; if (modPtr->flags & MULT_CLICKS) { unsigned i = modPtr->flags & MULT_CLICKS; @@ -4906,7 +4906,7 @@ ParseEventDescription( eventFlags = 0; if ((hPtr = Tcl_FindHashEntry(&eventTable, field))) { - const EventInfo *eiPtr = Tcl_GetHashValue(hPtr); + const EventInfo *eiPtr = (const EventInfo *)Tcl_GetHashValue(hPtr); patPtr->eventType = eiPtr->type; eventFlags = flagArray[eiPtr->type]; diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 7a74344..c1d4c42 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -227,7 +227,7 @@ Tk_InitConsoleChannels( return; } - consoleInitPtr = Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int)); + consoleInitPtr = (int *)Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int)); if (*consoleInitPtr) { /* * We've already initialized console channels in this thread. @@ -255,13 +255,13 @@ Tk_InitConsoleChannels( * interp for it to live in. */ - info = ckalloc(sizeof(ConsoleInfo)); + info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo)); info->consoleInterp = NULL; info->interp = NULL; info->refCount = 0; if (doIn) { - ChannelData *data = ckalloc(sizeof(ChannelData)); + ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData)); data->info = info; data->info->refCount++; @@ -278,7 +278,7 @@ Tk_InitConsoleChannels( } if (doOut) { - ChannelData *data = ckalloc(sizeof(ChannelData)); + ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData)); data->info = info; data->info->refCount++; @@ -295,7 +295,7 @@ Tk_InitConsoleChannels( } if (doErr) { - ChannelData *data = ckalloc(sizeof(ChannelData)); + ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData)); data->info = info; data->info->refCount++; @@ -377,7 +377,7 @@ Tk_CreateConsoleWindow( * New ConsoleInfo for a new console window. */ - info = ckalloc(sizeof(ConsoleInfo)); + info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo)); info->refCount = 0; /* @@ -407,7 +407,7 @@ Tk_CreateConsoleWindow( } } } else { - info = ckalloc(sizeof(ConsoleInfo)); + info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo)); info->refCount = 0; } @@ -497,7 +497,7 @@ ConsoleOutput( int toWrite, /* How many bytes to write? */ int *errorCode) /* Where to store error code. */ { - ChannelData *data = instanceData; + ChannelData *data = (ChannelData *)instanceData; ConsoleInfo *info = data->info; *errorCode = 0; @@ -561,12 +561,17 @@ ConsoleOutput( /* ARGSUSED */ static int ConsoleInput( - ClientData instanceData, /* Unused. */ + void *dummy, /* Unused. */ char *buf, /* Where to store data read. */ int bufSize, /* How much space is available in the * buffer? */ int *errorCode) /* Where to store error code. */ { + (void)dummy; + (void)buf; + (void)bufSize; + (void)errorCode; + return 0; /* Always return EOF. */ } @@ -589,11 +594,12 @@ ConsoleInput( /* ARGSUSED */ static int ConsoleClose( - ClientData instanceData, /* Unused. */ - Tcl_Interp *interp) /* Unused. */ + ClientData instanceData, + Tcl_Interp *dummy) /* Unused. */ { - ChannelData *data = instanceData; + ChannelData *data = (ChannelData *)instanceData; ConsoleInfo *info = data->info; + (void)dummy; if (info) { if (info->refCount-- <= 1) { @@ -629,11 +635,13 @@ ConsoleClose( /* ARGSUSED */ static void ConsoleWatch( - ClientData instanceData, /* Device ID for the channel. */ + ClientData dummy, /* Device ID for the channel. */ int mask) /* OR-ed combination of TCL_READABLE, * TCL_WRITABLE and TCL_EXCEPTION, for the * events we are interested in. */ { + (void)dummy; + (void)mask; } /* @@ -656,12 +664,16 @@ ConsoleWatch( /* ARGSUSED */ static int ConsoleHandle( - ClientData instanceData, /* Device ID for the channel. */ + ClientData dummy, /* Device ID for the channel. */ int direction, /* TCL_READABLE or TCL_WRITABLE to indicate * which direction of the channel is being * requested. */ ClientData *handlePtr) /* Where to store handle */ { + (void)dummy; + (void)direction; + (void)handlePtr; + return TCL_ERROR; } @@ -694,7 +706,7 @@ ConsoleObjCmd( "eval", "hide", "show", "title", NULL}; enum option {CON_EVAL, CON_HIDE, CON_SHOW, CON_TITLE}; Tcl_Obj *cmd = NULL; - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; Tcl_Interp *consoleInterp = info->consoleInterp; if (objc < 2) { @@ -784,7 +796,7 @@ InterpreterObjCmd( int index, result = TCL_OK; static const char *const options[] = {"eval", "record", NULL}; enum option {OTHER_EVAL, OTHER_RECORD}; - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; Tcl_Interp *otherInterp = info->interp; if (objc < 2) { @@ -852,7 +864,7 @@ static void DeleteConsoleInterp( ClientData clientData) { - Tcl_Interp *interp = clientData; + Tcl_Interp *interp = (Tcl_Interp *)clientData; Tcl_DeleteInterp(interp); } @@ -879,7 +891,7 @@ InterpDeleteProc( ClientData clientData, Tcl_Interp *interp) { - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; if (info->consoleInterp == interp) { Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp); @@ -911,7 +923,7 @@ static void ConsoleDeleteProc( ClientData clientData) { - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; if (info->consoleInterp) { Tcl_DeleteInterp(info->consoleInterp); @@ -946,7 +958,7 @@ ConsoleEventProc( XEvent *eventPtr) { if (eventPtr->type == DestroyNotify) { - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c index ea48894..aed0b80 100644 --- a/generic/tkStubLib.c +++ b/generic/tkStubLib.c @@ -77,10 +77,10 @@ Tk_InitStubs( { const char *packageName = "Tk"; const char *errMsg = NULL; - ClientData clientData = NULL; + void *clientData = NULL; const char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, packageName, version, 0, &clientData); - const TkStubs *stubsPtr = clientData; + const TkStubs *stubsPtr = (const TkStubs *)clientData; if (actualVersion == NULL) { return NULL; diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c index c17f1e9..5675416 100644 --- a/generic/ttk/ttkStubLib.c +++ b/generic/ttk/ttkStubLib.c @@ -36,10 +36,10 @@ TtkInitializeStubs( int exact = 0; const char *packageName = "Ttk"; const char *errMsg = NULL; - ClientData pkgClientData = NULL; + void *pkgClientData = NULL; const char *actualVersion = Tcl_PkgRequireEx( interp, packageName, version, exact, &pkgClientData); - const TtkStubs *stubsPtr = pkgClientData; + const TtkStubs *stubsPtr = (const TtkStubs *)pkgClientData; if (!actualVersion) { return NULL; diff --git a/unix/configure b/unix/configure index 8628eec..571b9ec 100755 --- a/unix/configure +++ b/unix/configure @@ -4249,7 +4249,12 @@ fi if test "$GCC" = yes; then : CFLAGS_OPTIMIZE=-O2 - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith" + case "${CC}" in + *++) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wunused-parameter" + ;; + esac else @@ -6196,6 +6201,9 @@ fi if test "${tcl_cv_type_64bit}" = none ; then +$as_echo "#define MP_32BIT 1" >>confdefs.h + + $as_echo "#define TCL_WIDE_INT_IS_LONG 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index eb0af47..407dc30 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -34,7 +34,9 @@ TkMenuButton * TkpCreateMenuButton( Tk_Window tkwin) { - return ckalloc(sizeof(TkMenuButton)); + (void)tkwin; + + return (TkMenuButton *)ckalloc(sizeof(TkMenuButton)); } /* @@ -58,7 +60,7 @@ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { - TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; @@ -321,6 +323,7 @@ void TkpDestroyMenuButton( TkMenuButton *mbPtr) { + (void)mbPtr; } /* diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index ca5183d..b090c4f 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.c @@ -52,7 +52,9 @@ TkScale * TkpCreateScale( Tk_Window tkwin) { - return ckalloc(sizeof(TkScale)); + (void)tkwin; + + return (TkScale *)ckalloc(sizeof(TkScale)); } /* @@ -546,7 +548,7 @@ void TkpDisplayScale( ClientData clientData) /* Widget record for scale. */ { - TkScale *scalePtr = clientData; + TkScale *scalePtr = (TkScale *)clientData; Tk_Window tkwin = scalePtr->tkwin; Tcl_Interp *interp = scalePtr->interp; Pixmap pixmap; diff --git a/win/configure b/win/configure index 33e23ac..95a550c 100755 --- a/win/configure +++ b/win/configure @@ -4026,14 +4026,14 @@ $as_echo "$ac_cv_cross" >&6; } if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" + CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; *) - CC="i686-w64-mingw32-gcc" + CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" @@ -4267,10 +4267,19 @@ $as_echo "using shared flags" >&6; } CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= + case "${CC}" in + *++) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format -Wunused-parameter" + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + ;; + esac + # Specify the CC output file names based on the target name CC_OBJNAME="-o \$@" CC_EXENAME="-o \$@" @@ -4639,6 +4648,10 @@ $as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h fi fi + +$as_echo "#define MP_32BIT 1" >>confdefs.h + + # DL_LIBS is empty, but then we match the Unix version diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c index 88b0507..49ffd83 100644 --- a/win/tkWin32Dll.c +++ b/win/tkWin32Dll.c @@ -104,6 +104,7 @@ DllMain( #ifdef HAVE_NO_SEH TCLEXCEPTION_REGISTRATION registration; #endif + (void)reserved; /* * If we are attaching to the DLL from a new process, tell Tk about the diff --git a/win/tkWin3d.c b/win/tkWin3d.c index 9f7ca22..3684400 100644 --- a/win/tkWin3d.c +++ b/win/tkWin3d.c @@ -43,7 +43,7 @@ typedef struct { TkBorder * TkpGetBorder(void) { - WinBorder *borderPtr = ckalloc(sizeof(WinBorder)); + WinBorder *borderPtr = (WinBorder *)ckalloc(sizeof(WinBorder)); borderPtr->light2ColorPtr = NULL; borderPtr->dark2ColorPtr = NULL; diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 3ba3be5..0dca943 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -149,7 +149,7 @@ InitBoxes(void) size = tsdPtr->boxesPtr->biSize + (sizeof(RGBQUAD) << tsdPtr->boxesPtr->biBitCount) + tsdPtr->boxesPtr->biSizeImage; - newBitmap = ckalloc(size); + newBitmap = (LPBITMAPINFOHEADER)ckalloc(size); memcpy(newBitmap, tsdPtr->boxesPtr, size); tsdPtr->boxesPtr = newBitmap; tsdPtr->boxWidth = tsdPtr->boxesPtr->biWidth / 4; @@ -211,8 +211,9 @@ TkpCreateButton( Tk_Window tkwin) { WinButton *butPtr; + (void)tkwin; - butPtr = ckalloc(sizeof(WinButton)); + butPtr = (WinButton *)ckalloc(sizeof(WinButton)); butPtr->hwnd = NULL; return (TkButton *) butPtr; } @@ -316,7 +317,7 @@ TkpDisplayButton( { TkWinDCState state; HDC dc; - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index 06eebbd..2b009af 100644 --- a/win/tkWinClipboard.c +++ b/win/tkWinClipboard.c @@ -78,7 +78,7 @@ TkSelGetSelection( CloseClipboard(); goto error; } - data = GlobalLock(handle); + data = (char *)GlobalLock(handle); Tcl_DStringInit(&ds); Tcl_WCharToUtfDString((WCHAR *)data, wcslen((WCHAR *)data), &ds); GlobalUnlock(handle); @@ -101,7 +101,7 @@ TkSelGetSelection( Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, "cp######", -1); - data = GlobalLock(handle); + data = (char *)GlobalLock(handle); /* * Even though the documentation claims that GetLocaleInfo expects @@ -131,7 +131,7 @@ TkSelGetSelection( CloseClipboard(); goto error; } - data = GlobalLock(handle); + data = (char *)GlobalLock(handle); Tcl_ExternalToUtfDString(encoding, data, -1, &ds); GlobalUnlock(handle); if (encoding) { @@ -234,6 +234,8 @@ XSetSelectionOwner( { HWND hwnd = owner ? TkWinGetHWND(owner) : NULL; Tk_Window tkwin; + (void)display; + (void)time; /* * This is a gross hack because the Tk_InternAtom interface is broken. It @@ -283,6 +285,7 @@ TkWinClipboardRender( char *buffer, *p, *rawText, *endPtr; int length; Tcl_DString ds; + (void)format; for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL; targetPtr = targetPtr->nextPtr) { @@ -314,7 +317,7 @@ TkWinClipboardRender( * Copy the data and change EOL characters. */ - buffer = rawText = ckalloc(length + 1); + buffer = rawText = (char *)ckalloc(length + 1); if (targetPtr != NULL) { for (cbPtr = targetPtr->firstBufferPtr; cbPtr != NULL; cbPtr = cbPtr->nextPtr) { @@ -338,7 +341,7 @@ TkWinClipboardRender( Tcl_DStringFree(&ds); return; } - buffer = GlobalLock(handle); + buffer = (char *)GlobalLock(handle); memcpy(buffer, Tcl_DStringValue(&ds), (unsigned) Tcl_DStringLength(&ds) + 2); GlobalUnlock(handle); @@ -369,6 +372,8 @@ TkSelUpdateClipboard( TkClipboardTarget *targetPtr) { HWND hwnd = TkWinGetHWND(winPtr->window); + (void)targetPtr; + UpdateClipboard(hwnd); } @@ -450,6 +455,7 @@ void TkSelPropProc( XEvent *eventPtr) /* X PropertyChange event. */ { + (void)eventPtr; } /* diff --git a/win/tkWinColor.c b/win/tkWinColor.c index 8a1273a..78e3b6c 100644 --- a/win/tkWinColor.c +++ b/win/tkWinColor.c @@ -173,7 +173,7 @@ TkpGetColor( && FindSystemColor(name+6, &color, &index)) || TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), name, &color)) { - winColPtr = ckalloc(sizeof(WinColor)); + winColPtr = (WinColor *)ckalloc(sizeof(WinColor)); winColPtr->info.color = color; winColPtr->index = index; @@ -211,7 +211,7 @@ TkpGetColorByValue( XColor *colorPtr) /* Red, green, and blue fields indicate * desired color. */ { - WinColor *tkColPtr = ckalloc(sizeof(WinColor)); + WinColor *tkColPtr = (WinColor *)ckalloc(sizeof(WinColor)); tkColPtr->info.color.red = colorPtr->red; tkColPtr->info.color.green = colorPtr->green; @@ -307,6 +307,7 @@ XAllocColor( TkWinColormap *cmap = (TkWinColormap *) colormap; PALETTEENTRY entry, closeEntry; HDC dc = GetDC(NULL); + (void)display; entry.peRed = (color->red) >> 8; entry.peGreen = (color->green) >> 8; @@ -316,7 +317,7 @@ XAllocColor( if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) { unsigned long sizePalette = GetDeviceCaps(dc, SIZEPALETTE); UINT newPixel, closePixel; - int new; + int isNew; size_t refCount; Tcl_HashEntry *entryPtr; UINT index; @@ -358,8 +359,8 @@ XAllocColor( color->pixel = PALETTERGB(entry.peRed, entry.peGreen, entry.peBlue); entryPtr = Tcl_CreateHashEntry(&cmap->refCounts, - INT2PTR(color->pixel), &new); - if (new) { + INT2PTR(color->pixel), &isNew); + if (isNew) { refCount = 1; } else { refCount = (size_t)Tcl_GetHashValue(entryPtr) + 1; @@ -414,6 +415,8 @@ XFreeColors( PALETTEENTRY entry, *entries; Tcl_HashEntry *entryPtr; HDC dc = GetDC(NULL); + (void)display; + (void)planes; /* * We don't have to do anything for non-palette devices. @@ -436,7 +439,7 @@ XFreeColors( GetPaletteEntries(cmap->palette, index, 1, &entry); if (cref == RGB(entry.peRed, entry.peGreen, entry.peBlue)) { count = cmap->size - index; - entries = ckalloc(sizeof(PALETTEENTRY) * count); + entries = (PALETTEENTRY *)ckalloc(sizeof(PALETTEENTRY) * count); GetPaletteEntries(cmap->palette, index+1, count, entries); SetPaletteEntries(cmap->palette, index, count, entries); ckfree(entries); @@ -482,9 +485,13 @@ XCreateColormap( PALETTEENTRY *entryPtr; TkWinColormap *cmap; Tcl_HashEntry *hashPtr; - int new; + int isNew; UINT i; HPALETTE sysPal; + (void)display; + (void)w; + (void)visual; + (void)alloc; /* * Allocate a starting palette with all of the reserved colors. @@ -496,7 +503,7 @@ XCreateColormap( logPalettePtr->palNumEntries = GetPaletteEntries(sysPal, 0, 256, logPalettePtr->palPalEntry); - cmap = ckalloc(sizeof(TkWinColormap)); + cmap = (TkWinColormap *)ckalloc(sizeof(TkWinColormap)); cmap->size = logPalettePtr->palNumEntries; cmap->stale = 0; cmap->palette = CreatePalette(logPalettePtr); @@ -509,7 +516,7 @@ XCreateColormap( for (i = 0; i < logPalettePtr->palNumEntries; i++) { entryPtr = logPalettePtr->palPalEntry + i; hashPtr = Tcl_CreateHashEntry(&cmap->refCounts, INT2PTR(PALETTERGB( - entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue)), &new); + entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue)), &isNew); Tcl_SetHashValue(hashPtr, INT2PTR(1)); } @@ -539,6 +546,7 @@ XFreeColormap( Colormap colormap) { TkWinColormap *cmap = (TkWinColormap *) colormap; + (void)display; if (!DeleteObject(cmap->palette)) { Tcl_Panic("Unable to free colormap, palette is still selected"); diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c index 3cf33e8..63f3add 100644 --- a/win/tkWinCursor.c +++ b/win/tkWinCursor.c @@ -100,6 +100,7 @@ TkGetCursorByName( TkWinCursor *cursorPtr; int argc; const char **argv = NULL; + (void)tkwin; /* * All cursor names are valid lists of one element (for @@ -113,7 +114,7 @@ TkGetCursorByName( goto badCursorSpec; } - cursorPtr = ckalloc(sizeof(TkWinCursor)); + cursorPtr = (TkWinCursor *)ckalloc(sizeof(TkWinCursor)); cursorPtr->info.cursor = (Tk_Cursor) cursorPtr; cursorPtr->winCursor = NULL; cursorPtr->system = 0; @@ -201,6 +202,16 @@ TkCreateCursorFromData( XColor fgColor, /* Foreground color for cursor. */ XColor bgColor) /* Background color for cursor. */ { + (void)tkwin; + (void)source; + (void)mask; + (void)width; + (void)height; + (void)xHot; + (void)yHot; + (void)fgColor; + (void)bgColor; + return NULL; } @@ -225,6 +236,8 @@ void TkpFreeCursor( TkCursor *cursorPtr) { + (void)cursorPtr; + /* TkWinCursor *winCursorPtr = (TkWinCursor *) cursorPtr; */ } diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index b145476..6059d21 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -3444,6 +3444,8 @@ FontchooserShowCmd( HDC hdc; HookData *hdPtr; int r = TCL_OK, oldMode = 0; + (void)objc; + (void)objv; hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); @@ -3546,12 +3548,15 @@ FontchooserShowCmd( static int FontchooserHideCmd( - ClientData clientData, /* Main window */ + ClientData dummy, /* Main window */ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - HookData *hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); + HookData *hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); + (void)dummy; + (void)objc; + (void)objv; if (hdPtr->hwnd && IsWindow(hdPtr->hwnd)) { EndDialog(hdPtr->hwnd, 0); @@ -3571,9 +3576,10 @@ FontchooserHideCmd( */ static void -DeleteHookData(ClientData clientData, Tcl_Interp *interp) +DeleteHookData(ClientData clientData, Tcl_Interp *dummy) { - HookData *hdPtr = clientData; + HookData *hdPtr = (HookData *)clientData; + (void)dummy; if (hdPtr->parentObj) { Tcl_DecrRefCount(hdPtr->parentObj); @@ -3610,9 +3616,10 @@ const TkEnsemble tkFontchooserEnsemble[] = { }; int -TkInitFontchooser(Tcl_Interp *interp, ClientData clientData) +TkInitFontchooser(Tcl_Interp *interp, ClientData dummy) { - HookData *hdPtr = ckalloc(sizeof(HookData)); + HookData *hdPtr = (HookData *)ckalloc(sizeof(HookData)); + (void)dummy; memset(hdPtr, 0, sizeof(HookData)); Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteHookData, hdPtr); diff --git a/xlib/xcolors.c b/xlib/xcolors.c index 31db297..f2d3d2e 100644 --- a/xlib/xcolors.c +++ b/xlib/xcolors.c @@ -341,6 +341,9 @@ XParseColor( const char *spec, XColor *colorPtr) { + (void)display; + (void)map; + if (spec[0] == '#') { char *p; Tcl_WideInt value = parseHex64bit(++spec, &p); diff --git a/xlib/xgc.c b/xlib/xgc.c index aea8851..81209e8 100644 --- a/xlib/xgc.c +++ b/xlib/xgc.c @@ -48,7 +48,7 @@ static TkpClipMask *AllocClipMask(GC gc) { TkpClipMask *clip_mask = (TkpClipMask*) gc->clip_mask; if (clip_mask == NULL) { - clip_mask = ckalloc(sizeof(TkpClipMask)); + clip_mask = (TkpClipMask *)ckalloc(sizeof(TkpClipMask)); gc->clip_mask = (Pixmap) clip_mask; #ifdef MAC_OSX_TK } else if (clip_mask->type == TKP_CLIP_REGION) { @@ -110,6 +110,7 @@ XCreateGC( XGCValues *values) { GC gp; + (void)d; /* * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars @@ -120,7 +121,7 @@ XCreateGC( #define MAX_DASH_LIST_SIZE 10 - gp = ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize); + gp = (GC)ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize); if (!gp) { return NULL; } @@ -265,6 +266,8 @@ int XFreeGC( Display *d, GC gc) { + (void)d; + if (gc != NULL) { FreeClipMask(gc); TkpFreeGCCache(gc); @@ -296,6 +299,8 @@ XSetForeground( GC gc, unsigned long foreground) { + (void)display; + gc->foreground = foreground; return Success; } @@ -306,6 +311,8 @@ XSetBackground( GC gc, unsigned long background) { + (void)display; + gc->background = background; return Success; } @@ -319,6 +326,7 @@ XSetDashes( int n) { char *p = &(gc->dashes); + (void)display; #ifdef TkWinDeleteBrush TkWinDeleteBrush(gc->fgBrush); @@ -341,6 +349,8 @@ XSetFunction( GC gc, int function) { + (void)display; + gc->function = function; return Success; } @@ -351,6 +361,8 @@ XSetFillRule( GC gc, int fill_rule) { + (void)display; + gc->fill_rule = fill_rule; return Success; } @@ -361,6 +373,8 @@ XSetFillStyle( GC gc, int fill_style) { + (void)display; + gc->fill_style = fill_style; return Success; } @@ -371,6 +385,8 @@ XSetTSOrigin( GC gc, int x, int y) { + (void)display; + gc->ts_x_origin = x; gc->ts_y_origin = y; return Success; @@ -382,6 +398,8 @@ XSetFont( GC gc, Font font) { + (void)display; + gc->font = font; return Success; } @@ -392,6 +410,8 @@ XSetArcMode( GC gc, int arc_mode) { + (void)display; + gc->arc_mode = arc_mode; return Success; } @@ -402,6 +422,8 @@ XSetStipple( GC gc, Pixmap stipple) { + (void)display; + gc->stipple = stipple; return Success; } @@ -415,6 +437,8 @@ XSetLineAttributes( int cap_style, int join_style) { + (void)display; + gc->line_width = line_width; gc->line_style = line_style; gc->cap_style = cap_style; @@ -429,6 +453,8 @@ XSetClipOrigin( int clip_x_origin, int clip_y_origin) { + (void)display; + gc->clip_x_origin = clip_x_origin; gc->clip_y_origin = clip_y_origin; return Success; @@ -461,6 +487,8 @@ TkSetRegion( GC gc, TkRegion r) { + (void)display; + if (r == NULL) { Tcl_Panic("must not pass NULL to TkSetRegion for compatibility with X11; use XSetClipMask instead"); } else { @@ -481,6 +509,8 @@ XSetClipMask( GC gc, Pixmap pixmap) { + (void)display; + if (pixmap == None) { FreeClipMask(gc); } else { @@ -539,6 +569,7 @@ XDrawPoints( int mode) { int res = Success; + (void)mode; while (npoints-- > 0) { res = XDrawLine(display, d, gc, @@ -558,6 +589,12 @@ XDrawSegments( XSegment *segments, int nsegments) { + (void)display; + (void)d; + (void)gc; + (void)segments; + (void)nsegments; + return BadDrawable; } #endif @@ -568,6 +605,10 @@ XFetchBuffer( int *nbytes_return, int buffer) { + (void)display; + (void)nbytes_return; + (void)buffer; + return (char *) 0; } @@ -577,6 +618,10 @@ XFetchName( Window w, char **window_name_return) { + (void)display; + (void)w; + (void)window_name_return; + return Success; } @@ -586,6 +631,10 @@ XListProperties( Window w, int *num_prop_return) { + (void)display; + (void)w; + (void)num_prop_return; + return (Atom *) 0; } @@ -594,7 +643,10 @@ XMapRaised( Display *display, Window w) { - return Success; + (void)display; + (void)w; + + return Success; } int @@ -608,6 +660,15 @@ XQueryTextExtents( int *font_descent_return, XCharStruct *overall_return) { + (void)display; + (void)font_ID; + (void)string; + (void)nchars; + (void)direction_return; + (void)font_ascent_return; + (void)font_descent_return; + (void)overall_return; + return Success; } @@ -619,6 +680,12 @@ XReparentWindow( int x, int y) { + (void)display; + (void)w; + (void)parent; + (void)x; + (void)y; + return BadWindow; } @@ -627,6 +694,9 @@ XUndefineCursor( Display *display, Window w) { + (void)display; + (void)w; + return Success; } @@ -634,6 +704,7 @@ XVaNestedList XVaCreateNestedList( int unused, ...) { + (void)unused; return NULL; } @@ -641,6 +712,7 @@ char * XSetICValues( XIC xic, ...) { + (void)xic; return NULL; } @@ -648,6 +720,7 @@ char * XGetICValues( XIC xic, ...) { + (void)xic; return NULL; } @@ -655,6 +728,7 @@ void XSetICFocus( XIC xic) { + (void)xic; } Window @@ -672,6 +746,19 @@ XCreateWindow( unsigned long value_mask, XSetWindowAttributes *attributes) { + (void)display; + (void)parent; + (void)x; + (void)y; + (void)width; + (void)height; + (void)border_width; + (void)depth; + (void)clazz; + (void)visual; + (void)value_mask; + (void)attributes; + return 0; } @@ -681,6 +768,10 @@ XPointInRegion( int x, int y) { + (void)rgn; + (void)x; + (void)y; + return 0; } @@ -690,6 +781,10 @@ XUnionRegion( Region srcb, Region dr_return) { + (void)srca; + (void)srcb; + (void)dr_return; + return 0; } @@ -699,6 +794,10 @@ XPolygonRegion( int n, int rule) { + (void)pts; + (void)n; + (void)rule; + return 0; } @@ -706,6 +805,7 @@ void XDestroyIC( XIC ic) { + (void)ic; } Cursor @@ -718,6 +818,14 @@ XCreatePixmapCursor( unsigned int x, unsigned int y) { + (void)display; + (void)source; + (void)mask; + (void)foreground_color; + (void)background_color; + (void)x; + (void)y; + return (Cursor) NULL; } @@ -731,6 +839,14 @@ XCreateGlyphCursor( XColor _Xconst *foreground_color, XColor _Xconst *background_color) { + (void)display; + (void)source_font; + (void)mask_font; + (void)source_char; + (void)mask_char; + (void)foreground_color; + (void)background_color; + return 1; } @@ -742,6 +858,12 @@ XCreateFontSet( int *missing_charset_count /* missing_charset_count */, char **def_string /* def_string */ ) { + (void)display; + (void)base_font_name_list; + (void)missing_charset_list; + (void)missing_charset_count; + (void)def_string; + return (XFontSet)0; } @@ -750,18 +872,23 @@ XFreeFontSet( Display *display, /* display */ XFontSet fontset /* font_set */ ) { + (void)display; + (void)fontset; } void XFreeStringList( char **list /* list */ ) { + (void)list; } Status XCloseIM( XIM im /* im */ ) { + (void)im; + return Success; } @@ -774,6 +901,13 @@ XRegisterIMInstantiateCallback( XIDProc callback /* callback */, XPointer client_data /* client_data */ ) { + (void)dpy; + (void)rdb; + (void)res_name; + (void)res_class; + (void)callback; + (void)client_data; + return False; } @@ -786,6 +920,13 @@ XUnregisterIMInstantiateCallback( XIDProc callback /* callback */, XPointer client_data /* client_data */ ) { + (void)dpy; + (void)rdb; + (void)res_name; + (void)res_class; + (void)callback; + (void)client_data; + return False; } @@ -793,6 +934,8 @@ char * XSetLocaleModifiers( const char *modifier_list /* modifier_list */ ) { + (void)modifier_list; + return NULL; } @@ -802,6 +945,11 @@ XIM XOpenIM( char *res_name /* res_name */, char *res_class /* res_class */ ) { + (void)dpy; + (void)rdb; + (void)res_name; + (void)res_class; + return NULL; } @@ -809,6 +957,8 @@ char * XGetIMValues( XIM im /* im */, ... ) { + (void)im; + return NULL; } @@ -816,6 +966,8 @@ char * XSetIMValues( XIM im /* im */, ... ) { + (void)im; + return NULL; } diff --git a/xlib/xutil.c b/xlib/xutil.c index d80b742..a5f3b99 100644 --- a/xlib/xutil.c +++ b/xlib/xutil.c @@ -36,6 +36,8 @@ XInternAtom( Bool only_if_exists) { static Atom atom = XA_LAST_PREDEFINED; + (void)atom_name; + (void)only_if_exists; display->request++; return ++atom; @@ -64,7 +66,7 @@ XGetVisualInfo( XVisualInfo *vinfo_template, int *nitems_return) { - XVisualInfo *info = ckalloc(sizeof(XVisualInfo)); + XVisualInfo *info = (XVisualInfo *)ckalloc(sizeof(XVisualInfo)); info->visual = DefaultVisual(display, 0); info->visualid = info->visual->visualid; -- cgit v0.12 From 2f89fa96c29e874b87523d628df15c62984dd9b7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 20 Dec 2019 10:41:43 +0000 Subject: Much more WIP: Appears to be working on UNIX, and for a bit part on Windows too. --- generic/tk3d.c | 8 +- generic/tkArgv.c | 6 +- generic/tkArray.h | 4 +- generic/tkBind.c | 68 +++++----- generic/tkBitmap.c | 49 ++++--- generic/tkBusy.c | 30 +++-- generic/tkButton.c | 47 +++++-- generic/tkCanvArc.c | 22 +++- generic/tkCanvBmap.c | 4 + generic/tkCanvImg.c | 7 +- generic/tkCanvLine.c | 48 ++++--- generic/tkCanvPoly.c | 19 ++- generic/tkCanvPs.c | 5 +- generic/tkCanvText.c | 7 +- generic/tkCanvUtil.c | 78 +++++++---- generic/tkCanvWind.c | 21 ++- generic/tkCanvas.c | 58 ++++----- generic/tkClipboard.c | 31 +++-- generic/tkCmds.c | 67 +++++----- generic/tkColor.c | 22 ++-- generic/tkConfig.c | 37 +++--- generic/tkCursor.c | 28 ++-- generic/tkDList.h | 16 +-- generic/tkEntry.c | 95 ++++++++------ generic/tkError.c | 2 +- generic/tkEvent.c | 73 ++++++----- generic/tkFileFilter.c | 22 ++-- generic/tkFocus.c | 16 +-- generic/tkFont.c | 50 ++++---- generic/tkFrame.c | 64 +++++---- generic/tkGC.c | 16 +-- generic/tkGeometry.c | 34 ++--- generic/tkGet.c | 9 +- generic/tkGrab.c | 35 ++--- generic/tkGrid.c | 56 ++++---- generic/tkImage.c | 45 +++---- generic/tkImgBmap.c | 23 ++-- generic/tkImgGIF.c | 30 +++-- generic/tkImgListFormat.c | 13 +- generic/tkImgPNG.c | 20 ++- generic/tkImgPPM.c | 13 +- generic/tkImgPhInstance.c | 31 ++--- generic/tkImgPhoto.c | 52 ++++---- generic/tkImgSVGnano.c | 15 ++- generic/tkImgUtil.c | 2 +- generic/tkInt.h | 4 +- generic/tkListbox.c | 80 ++++++------ generic/tkMacWinMenu.c | 6 +- generic/tkMain.c | 3 +- generic/tkMenu.c | 73 ++++++----- generic/tkMenuDraw.c | 34 +++-- generic/tkMenubutton.c | 37 ++++-- generic/tkMessage.c | 38 +++--- generic/tkObj.c | 53 ++++---- generic/tkOldConfig.c | 33 ++--- generic/tkOldTest.c | 22 ++-- generic/tkOption.c | 71 +++++----- generic/tkPack.c | 42 +++--- generic/tkPanedWindow.c | 60 +++++---- generic/tkPlace.c | 43 ++++--- generic/tkPointer.c | 23 +++- generic/tkRectOval.c | 6 + generic/tkScale.c | 37 +++--- generic/tkScrollbar.c | 12 +- generic/tkSelect.c | 64 ++++----- generic/tkSquare.c | 20 +-- generic/tkStubInit.c | 36 ++++-- generic/tkStyle.c | 78 +++++------ generic/tkTest.c | 100 ++++++++++----- generic/tkText.c | 93 +++++++------- generic/tkTextBTree.c | 292 +++++++++++++++++++++--------------------- generic/tkTextDisp.c | 104 ++++++++------- generic/tkTextImage.c | 39 ++++-- generic/tkTextIndex.c | 26 ++-- generic/tkTextMark.c | 43 +++++-- generic/tkTextTag.c | 38 +++--- generic/tkTextWind.c | 44 ++++--- generic/tkTrig.c | 16 +-- generic/tkUndo.c | 10 +- generic/tkUtil.c | 57 +++++---- generic/tkVisual.c | 40 +++--- generic/tkWindow.c | 110 ++++++++-------- generic/ttk/ttk.decls | 2 +- generic/ttk/ttkBlink.c | 10 +- generic/ttk/ttkButton.c | 51 +++++--- generic/ttk/ttkCache.c | 34 +++-- generic/ttk/ttkClamTheme.c | 157 ++++++++++++++++------- generic/ttk/ttkClassicTheme.c | 52 +++++--- generic/ttk/ttkDecls.h | 4 +- generic/ttk/ttkDefaultTheme.c | 143 +++++++++++++-------- generic/ttk/ttkElements.c | 280 +++++++++++++++++++++++++++------------- generic/ttk/ttkEntry.c | 141 ++++++++++---------- generic/ttk/ttkFrame.c | 37 ++++-- generic/ttk/ttkImage.c | 33 +++-- generic/ttk/ttkInit.c | 10 +- generic/ttk/ttkLabel.c | 43 ++++--- generic/ttk/ttkLayout.c | 8 +- generic/ttk/ttkManager.c | 16 +-- generic/ttk/ttkNotebook.c | 83 ++++++------ generic/ttk/ttkPanedwindow.c | 83 ++++++------ generic/ttk/ttkProgress.c | 37 ++++-- generic/ttk/ttkScale.c | 34 ++--- generic/ttk/ttkScroll.c | 2 +- generic/ttk/ttkScrollbar.c | 18 +-- generic/ttk/ttkSeparator.c | 2 +- generic/ttk/ttkSquare.c | 15 ++- generic/ttk/ttkState.c | 4 +- generic/ttk/ttkTagSet.c | 16 +-- generic/ttk/ttkTheme.c | 109 +++++++++------- generic/ttk/ttkTrace.c | 6 +- generic/ttk/ttkTrack.c | 4 +- generic/ttk/ttkTreeview.c | 115 +++++++++-------- generic/ttk/ttkWidget.c | 45 ++++--- macosx/ttkMacOSXTheme.c | 12 +- unix/tkAppInit.c | 6 + unix/tkUnix.c | 5 + unix/tkUnix3d.c | 2 +- unix/tkUnixButton.c | 8 +- unix/tkUnixColor.c | 14 +- unix/tkUnixConfig.c | 4 + unix/tkUnixCursor.c | 4 +- unix/tkUnixDraw.c | 2 + unix/tkUnixEmbed.c | 41 +++--- unix/tkUnixEvent.c | 22 +++- unix/tkUnixFont.c | 48 ++++--- unix/tkUnixInit.c | 4 +- unix/tkUnixKey.c | 10 +- unix/tkUnixMenu.c | 49 ++++++- unix/tkUnixRFont.c | 14 +- unix/tkUnixScrlbr.c | 10 +- unix/tkUnixSelect.c | 27 ++-- unix/tkUnixSend.c | 48 +++---- unix/tkUnixWm.c | 88 +++++++++---- win/stubs.c | 177 ++++++++++++++++++++++++- win/tkWinFont.c | 4 +- win/tkWinMenu.c | 102 +++++++++++---- win/tkWinPixmap.c | 8 +- win/tkWinPointer.c | 28 +++- win/tkWinScrlbr.c | 7 +- win/tkWinSend.c | 10 +- win/tkWinSendCom.c | 53 +++++--- win/tkWinTest.c | 23 ++-- win/tkWinWindow.c | 6 +- win/tkWinWm.c | 104 ++++++++++----- win/tkWinX.c | 34 +++-- win/ttkWinTheme.c | 133 +++++++++++++------ win/ttkWinXPTheme.c | 44 ++++--- win/winMain.c | 6 + 148 files changed, 3664 insertions(+), 2372 deletions(-) diff --git a/generic/tk3d.c b/generic/tk3d.c index faa12b7..155f6ae 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -593,7 +593,7 @@ Tk_SetBackgroundFromBorder( Tk_Window tkwin, /* Window whose background is to be set. */ Tk_3DBorder border) /* Token for border. */ { - register TkBorder *borderPtr = (TkBorder *) border; + TkBorder *borderPtr = (TkBorder *) border; Tk_SetWindowBackground(tkwin, borderPtr->bgColorPtr->pixel); } @@ -758,7 +758,7 @@ Tk_Draw3DPolygon( { XPoint poly[4], b1, b2, newB1, newB2; XPoint perp, c, shift1, shift2; /* Used for handling parallel lines. */ - register XPoint *p1Ptr, *p2Ptr; + XPoint *p1Ptr, *p2Ptr; TkBorder *borderPtr = (TkBorder *) border; GC gc; int i, lightOnLeft, dx, dy, parallel, pointsSeen; @@ -955,7 +955,7 @@ Tk_Fill3DRectangle( int relief) /* Indicates 3D effect: TK_RELIEF_FLAT, * TK_RELIEF_RAISED, or TK_RELIEF_SUNKEN. */ { - register TkBorder *borderPtr = (TkBorder *) border; + TkBorder *borderPtr = (TkBorder *) border; int doubleBorder; /* @@ -1026,7 +1026,7 @@ Tk_Fill3DPolygon( * TK_RELIEF_FLAT, TK_RELIEF_RAISED, or * TK_RELIEF_SUNKEN. */ { - register TkBorder *borderPtr = (TkBorder *) border; + TkBorder *borderPtr = (TkBorder *) border; XFillPolygon(Tk_Display(tkwin), drawable, borderPtr->bgGC, pointPtr, numPoints, Complex, CoordModeOrigin); diff --git a/generic/tkArgv.c b/generic/tkArgv.c index 807a145..81e7a44 100644 --- a/generic/tkArgv.c +++ b/generic/tkArgv.c @@ -67,12 +67,12 @@ Tk_ParseArgv( int flags) /* Or'ed combination of various flag bits, * such as TK_ARGV_NO_DEFAULTS. */ { - register const Tk_ArgvInfo *infoPtr; + const Tk_ArgvInfo *infoPtr; /* Pointer to the current entry in the table * of argument descriptions. */ const Tk_ArgvInfo *matchPtr;/* Descriptor that matches current argument. */ const char *curArg; /* Current argument */ - register char c; /* Second character of current arg (used for + char c; /* Second character of current arg (used for * quick check for matching; use 2nd char. * because first char. will almost always be * '-'). */ @@ -338,7 +338,7 @@ PrintUsage( * this word, then don't generate information * for default options. */ { - register const Tk_ArgvInfo *infoPtr; + const Tk_ArgvInfo *infoPtr; size_t width, i, numSpaces; Tcl_Obj *message; diff --git a/generic/tkArray.h b/generic/tkArray.h index 65693fe..2bfdd5f 100644 --- a/generic/tkArray.h +++ b/generic/tkArray.h @@ -273,7 +273,7 @@ AT##_Resize(AT **arrp, size_t newSize) \ } else { \ int init = *arrp == NULL; \ size_t memSize = AT##_BufferSize(newSize - 1) + sizeof(AT); \ - *arrp = ckrealloc(*arrp, memSize); \ + *arrp = (AT *)ckrealloc(*arrp, memSize); \ if (init) { \ (*arrp)->size = 0; \ } else if (newSize < (*arrp)->size) { \ @@ -484,7 +484,7 @@ AT##_Resize(AT **arrp, size_t newCapacity) \ } else { \ int init = *arrp == NULL; \ size_t memSize = AT##_BufferSize(newCapacity - 1) + sizeof(AT); \ - *arrp = ckrealloc(*arrp, memSize); \ + *arrp = (AT *)ckrealloc(*arrp, memSize); \ if (init) { \ (*arrp)->size = 0; \ } else if (newCapacity < (*arrp)->size) { \ diff --git a/generic/tkBind.c b/generic/tkBind.c index 371482e..114d0fe 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -934,6 +934,8 @@ FreePatSeqEntry( PSEntry *entry) { PSEntry *next = PSList_Next(entry); + (void)pool; + PSModMaskArr_Free(&entry->lastModMaskArr); ckfree(entry); return next; @@ -1035,7 +1037,7 @@ MakeListEntry( assert(TEST_PSENTRY(psPtr)); if (PSList_IsEmpty(pool)) { - newEntry = ckalloc(sizeof(PSEntry)); + newEntry = (PSEntry *)ckalloc(sizeof(PSEntry)); newEntry->lastModMaskArr = NULL; DEBUG(countEntryItems += 1;) } else { @@ -1112,7 +1114,7 @@ GetLookupForEvent( key.object = object; key.type = eventPtr->xev.type; hPtr = Tcl_FindHashEntry(&lookupTables->listTable, (char *) &key); - return hPtr ? Tcl_GetHashValue(hPtr) : NULL; + return hPtr ? (PSList *)Tcl_GetHashValue(hPtr) : NULL; } /* @@ -1150,14 +1152,14 @@ ClearLookupTable( nextPtr = Tcl_NextHashEntry(&search); if (object) { - const PatternTableKey *key = Tcl_GetHashKey(&lookupTables->listTable, hPtr); + const PatternTableKey *key = (const PatternTableKey *)Tcl_GetHashKey(&lookupTables->listTable, hPtr); if (key->object != object) { continue; } Tcl_DeleteHashEntry(hPtr); } - psList = Tcl_GetHashValue(hPtr); + psList = (PSList *)Tcl_GetHashValue(hPtr); PSList_Move(pool, psList); ckfree(psList); DEBUG(countListItems -= 1;) @@ -1371,7 +1373,7 @@ TkBindInit( mainPtr->bindingTable = Tk_CreateBindingTable(mainPtr->interp); - bindInfoPtr = ckalloc(sizeof(BindInfo)); + bindInfoPtr = (BindInfo *)ckalloc(sizeof(BindInfo)); InitVirtualEventTable(&bindInfoPtr->virtualEventTable); bindInfoPtr->screenInfo.curDispPtr = NULL; bindInfoPtr->screenInfo.curScreenIndex = -1; @@ -1447,7 +1449,7 @@ Tk_CreateBindingTable( Tcl_Interp *interp) /* Interpreter to associate with the binding table: commands are * executed in this interpreter. */ { - BindingTable *bindPtr = ckalloc(sizeof(BindingTable)); + BindingTable *bindPtr = (BindingTable *)ckalloc(sizeof(BindingTable)); unsigned i; assert(interp); @@ -1506,7 +1508,7 @@ Tk_DeleteBindingTable( PatSeq *nextPtr; PatSeq *psPtr; - for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { + for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { assert(TEST_PSENTRY(psPtr)); nextPtr = psPtr->nextSeqPtr; FreePatSeq(psPtr); @@ -1573,12 +1575,12 @@ InsertPatSeq( hPtr = Tcl_CreateHashEntry(&lookupTables->listTable, (char *) &key, &isNew); if (isNew) { - psList = ckalloc(sizeof(PSList)); + psList = (PSList *)ckalloc(sizeof(PSList)); PSList_Init(psList); Tcl_SetHashValue(hPtr, psList); DEBUG(countListItems += 1;) } else { - psList = Tcl_GetHashValue(hPtr); + psList = (PSList *)Tcl_GetHashValue(hPtr); } psEntry = MakeListEntry(&lookupTables->entryPool, psPtr, 0); @@ -1666,7 +1668,7 @@ Tk_CreateBinding( */ hPtr = Tcl_CreateHashEntry(&bindPtr->objectTable, (char *) object, &isNew); - psPtr->ptr.nextObj = isNew ? NULL : Tcl_GetHashValue(hPtr); + psPtr->ptr.nextObj = isNew ? NULL : (PatSeq *)Tcl_GetHashValue(hPtr); Tcl_SetHashValue(hPtr, psPtr); InsertPatSeq(&bindPtr->lookupTables, psPtr); } @@ -1676,14 +1678,14 @@ Tk_CreateBinding( size_t length1 = strlen(oldStr); size_t length2 = strlen(script); - newStr = ckalloc(length1 + length2 + 2); + newStr = (char *)ckalloc(length1 + length2 + 2); memcpy(newStr, oldStr, length1); newStr[length1] = '\n'; memcpy(newStr + length1 + 1, script, length2 + 1); } else { size_t length = strlen(script); - newStr = ckalloc(length + 1); + newStr = (char *)ckalloc(length + 1); memcpy(newStr, script, length + 1); } ckfree(oldStr); @@ -1738,7 +1740,7 @@ Tk_DeleteBinding( if (!(hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, (char *) object))) { Tcl_Panic("Tk_DeleteBinding couldn't find object table entry"); } - prevPtr = Tcl_GetHashValue(hPtr); + prevPtr = (PatSeq *)Tcl_GetHashValue(hPtr); if (prevPtr == psPtr) { Tcl_SetHashValue(hPtr, psPtr->ptr.nextObj); } else { @@ -1839,7 +1841,7 @@ Tk_GetAllBindings( * For each binding, output information about each of the patterns in its sequence. */ - for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = psPtr->ptr.nextObj) { + for (psPtr = (const PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = psPtr->ptr.nextObj) { assert(TEST_PSENTRY(psPtr)); Tcl_ListObjAppendElement(NULL, resultObj, GetPatternObj(psPtr)); } @@ -1878,7 +1880,7 @@ RemovePatSeqFromLookup( SetupPatternKey(&key, psPtr); if ((hPtr = Tcl_FindHashEntry(&lookupTables->listTable, (char *) &key))) { - PSList *psList = Tcl_GetHashValue(hPtr); + PSList *psList = (PSList *)Tcl_GetHashValue(hPtr); PSEntry *psEntry; TK_DLIST_FOREACH(psEntry, psList) { @@ -1962,7 +1964,7 @@ DeletePatSeq( assert(!psPtr->added); assert(!psPtr->owned); - prevPtr = Tcl_GetHashValue(psPtr->hPtr); + prevPtr = (PatSeq *)Tcl_GetHashValue(psPtr->hPtr); nextPtr = psPtr->ptr.nextObj; /* @@ -2033,7 +2035,7 @@ Tk_DeleteAllBindings( ClearLookupTable(&bindPtr->lookupTables, object); ClearPromotionLists(bindPtr, object); - for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { + for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { assert(TEST_PSENTRY(psPtr)); DEBUG(psPtr->added = 0;) nextPtr = DeletePatSeq(psPtr); @@ -2358,7 +2360,7 @@ Tk_BindEvent( if ((size_t) numObjects > SIZE_OF_ARRAY(matchPtrBuf)) { /* it's unrealistic that the buffer size is too small, but who knows? */ - matchPtrArr = ckalloc(numObjects*sizeof(matchPtrArr[0])); + matchPtrArr = (PatSeq **)ckalloc(numObjects*sizeof(matchPtrArr[0])); } memset(matchPtrArr, 0, numObjects*sizeof(matchPtrArr[0])); @@ -2399,8 +2401,8 @@ Tk_BindEvent( PSList *psSuccList = PromArr_First(bindPtr->promArr); PatSeq *bestPtr; - psl[0] = GetLookupForEvent(physTables, curEvent, objArr[k], 1); - psl[1] = GetLookupForEvent(physTables, curEvent, objArr[k], 0); + psl[0] = GetLookupForEvent(physTables, curEvent, (Tcl_Obj *)objArr[k], 1); + psl[1] = GetLookupForEvent(physTables, curEvent, (Tcl_Obj *)objArr[k], 0); assert(psl[0] == NULL || psl[0] != psl[1]); @@ -3442,7 +3444,7 @@ DeleteVirtualEventTable( PatSeq *nextPtr; PatSeq *psPtr; - for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { + for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { assert(TEST_PSENTRY(psPtr)); nextPtr = psPtr->nextSeqPtr; DEBUG(psPtr->owned = 0;) @@ -3523,7 +3525,7 @@ CreateVirtualEvent( * Make virtual event own the physical event. */ - owned = Tcl_GetHashValue(vhPtr); + owned = (PhysOwned *)Tcl_GetHashValue(vhPtr); if (!PhysOwned_Contains(owned, psPtr)) { PhysOwned_Append(&owned, psPtr); @@ -3585,7 +3587,7 @@ DeleteVirtualEvent( if (!(vhPtr = Tcl_FindHashEntry(&vetPtr->nameTable, virtUid))) { return TCL_OK; } - owned = Tcl_GetHashValue(vhPtr); + owned = (PhysOwned *)Tcl_GetHashValue(vhPtr); eventPSPtr = NULL; if (eventString) { @@ -3717,7 +3719,7 @@ GetVirtualEvent( } resultObj = Tcl_NewObj(); - owned = Tcl_GetHashValue(vhPtr); + owned = (const PhysOwned *)Tcl_GetHashValue(vhPtr); for (iPhys = 0; iPhys < PhysOwned_Size(owned); ++iPhys) { Tcl_ListObjAppendElement(NULL, resultObj, GetPatternObj(PhysOwned_Get(owned, iPhys))); } @@ -3806,7 +3808,7 @@ HandleEventGenerate( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - union { XEvent general; XVirtualEvent virtual; } event; + union { XEvent general; XVirtualEvent virt; } event; const char *p; const char *name; @@ -3909,7 +3911,7 @@ HandleEventGenerate( } else if (flags & BUTTON) { event.general.xbutton.button = pat.info; } else if (flags & VIRTUAL) { - event.virtual.name = pat.name; + event.virt.name = pat.name; } } if (flags & (CREATE|UNMAP|MAP|REPARENT|CONFIG|GRAVITY|CIRC)) { @@ -4349,7 +4351,7 @@ HandleEventGenerate( * refcount before firing it into the low-level event subsystem; the * refcount will be decremented once the event has been processed. */ - event.virtual.user_data = userDataObj; + event.virt.user_data = userDataObj; Tcl_IncrRefCount(userDataObj); } @@ -4479,7 +4481,7 @@ static void DoWarp( ClientData clientData) { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; assert(clientData); @@ -4609,7 +4611,7 @@ FindSequence( assert(lookupTables); assert(eventString); - psPtr = ckalloc(PATSEQ_MEMSIZE(patsBufSize)); + psPtr = (PatSeq *)ckalloc(PATSEQ_MEMSIZE(patsBufSize)); /* *------------------------------------------------------------------ @@ -4621,7 +4623,7 @@ FindSequence( if (numPats >= patsBufSize) { unsigned pos = patPtr - psPtr->pats; patsBufSize += patsBufSize; - psPtr = ckrealloc(psPtr, PATSEQ_MEMSIZE(patsBufSize)); + psPtr = (PatSeq *)ckrealloc(psPtr, PATSEQ_MEMSIZE(patsBufSize)); patPtr = psPtr->pats + pos; } @@ -4670,11 +4672,11 @@ FindSequence( return NULL; } if (patsBufSize > numPats) { - psPtr = ckrealloc(psPtr, PATSEQ_MEMSIZE(numPats)); + psPtr = (PatSeq *)ckrealloc(psPtr, PATSEQ_MEMSIZE(numPats)); } patPtr = psPtr->pats; - psPtr->object = object; + psPtr->object = (Tcl_Obj *)object; SetupPatternKey(&key, psPtr); hPtr = Tcl_CreateHashEntry(&lookupTables->patternTable, (char *) &key, &isNew); if (!isNew) { @@ -5230,7 +5232,7 @@ TkKeysymToString( Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym); if (hPtr) { - return Tcl_GetHashValue(hPtr); + return (const char *)Tcl_GetHashValue(hPtr); } #endif /* REDO_KEYSYM_LOOKUP */ diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index f642174..252fd4c 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -167,7 +167,7 @@ Tk_AllocBitmapFromObj( if (objPtr->typePtr != &tkBitmapObjType) { InitBitmapObj(objPtr); } - bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkBitmap, see if it's the one we @@ -197,7 +197,7 @@ Tk_AllocBitmapFromObj( */ if (bitmapPtr != NULL) { - TkBitmap *firstBitmapPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr); + TkBitmap *firstBitmapPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr); FreeBitmapObj(objPtr); for (bitmapPtr = firstBitmapPtr; bitmapPtr != NULL; @@ -307,7 +307,7 @@ GetBitmap( Pixmap bitmap; int isNew, width = 0, height = 0, dummy2; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!dispPtr->bitmapInit) { @@ -317,7 +317,7 @@ GetBitmap( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapNameTable, string, &isNew); if (!isNew) { - existingBitmapPtr = Tcl_GetHashValue(nameHashPtr); + existingBitmapPtr = (TkBitmap *)Tcl_GetHashValue(nameHashPtr); for (bitmapPtr = existingBitmapPtr; bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) { if ((Tk_Display(tkwin) == bitmapPtr->display) && @@ -395,7 +395,7 @@ GetBitmap( goto error; } } else { - predefPtr = Tcl_GetHashValue(predefHashPtr); + predefPtr = (TkPredefBitmap *)Tcl_GetHashValue(predefHashPtr); width = predefPtr->width; height = predefPtr->height; if (predefPtr->native) { @@ -407,7 +407,7 @@ GetBitmap( } else { bitmap = XCreateBitmapFromData(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), - predefPtr->source, (unsigned)width, (unsigned)height); + (const char *)predefPtr->source, (unsigned)width, (unsigned)height); } } } @@ -416,7 +416,7 @@ GetBitmap( * Add information about this bitmap to our database. */ - bitmapPtr = ckalloc(sizeof(TkBitmap)); + bitmapPtr = (TkBitmap *)ckalloc(sizeof(TkBitmap)); bitmapPtr->bitmap = bitmap; bitmapPtr->width = width; bitmapPtr->height = height; @@ -474,7 +474,7 @@ Tk_DefineBitmap( int isNew; Tcl_HashEntry *predefHashPtr; TkPredefBitmap *predefPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -497,7 +497,7 @@ Tk_DefineBitmap( Tcl_SetErrorCode(interp, "TK", "BITMAP", "EXISTS", NULL); return TCL_ERROR; } - predefPtr = ckalloc(sizeof(TkPredefBitmap)); + predefPtr = (TkPredefBitmap *)ckalloc(sizeof(TkPredefBitmap)); predefPtr->source = source; predefPtr->width = width; predefPtr->height = height; @@ -540,7 +540,7 @@ Tk_NameOfBitmap( if (idHashPtr == NULL) { goto unknown; } - bitmapPtr = Tcl_GetHashValue(idHashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr); return bitmapPtr->nameHashPtr->key.string; } @@ -582,7 +582,7 @@ Tk_SizeOfBitmap( if (idHashPtr == NULL) { goto unknownBitmap; } - bitmapPtr = Tcl_GetHashValue(idHashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr); *widthPtr = bitmapPtr->width; *heightPtr = bitmapPtr->height; } @@ -612,14 +612,13 @@ FreeBitmap( { TkBitmap *prevPtr; - bitmapPtr->resourceRefCount--; - if (bitmapPtr->resourceRefCount > 0) { + if (bitmapPtr->resourceRefCount-- > 1) { return; } Tk_FreePixmap(bitmapPtr->display, bitmapPtr->bitmap); Tcl_DeleteHashEntry(bitmapPtr->idHashPtr); - prevPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr); + prevPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr); if (prevPtr == bitmapPtr) { if (bitmapPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(bitmapPtr->nameHashPtr); @@ -671,7 +670,7 @@ Tk_FreeBitmap( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeBitmap received unknown bitmap argument"); } - FreeBitmap(Tcl_GetHashValue(idHashPtr)); + FreeBitmap((TkBitmap *)Tcl_GetHashValue(idHashPtr)); } /* @@ -735,7 +734,7 @@ static void FreeBitmapObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkBitmap *bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkBitmap *bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; if (bitmapPtr != NULL) { bitmapPtr->objRefCount--; @@ -770,7 +769,7 @@ DupBitmapObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkBitmap *bitmapPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkBitmap *bitmapPtr = (TkBitmap *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr; @@ -820,20 +819,20 @@ Tk_GetBitmapFromData( char string[16 + TCL_INTEGER_SPACE]; char *name; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { BitmapInit(dispPtr); } - nameKey.source = source; + nameKey.source = (const char *)source; nameKey.width = width; nameKey.height = height; dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable, (char *) &nameKey, &isNew); if (!isNew) { - name = Tcl_GetHashValue(dataHashPtr); + name = (char *)Tcl_GetHashValue(dataHashPtr); } else { dispPtr->bitmapAutoNumber++; sprintf(string, "_tk%d", dispPtr->bitmapAutoNumber); @@ -911,7 +910,7 @@ GetBitmapFromObj( InitBitmapObj(objPtr); } - bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; if (bitmapPtr != NULL) { if ((bitmapPtr->resourceRefCount > 0) && (Tk_Display(tkwin) == bitmapPtr->display)) { @@ -932,7 +931,7 @@ GetBitmapFromObj( * more TkBitmap structures. See if any of them will work. */ - for (bitmapPtr = Tcl_GetHashValue(hashPtr); bitmapPtr != NULL; + for (bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr); bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) { if (Tk_Display(tkwin) == bitmapPtr->display) { objPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr; @@ -1012,7 +1011,7 @@ BitmapInit( * or NULL if unavailable. */ { Tcl_Interp *dummy; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1150,7 +1149,7 @@ TkDebugBitmap( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->bitmapNameTable, name); if (hashPtr != NULL) { - bitmapPtr = Tcl_GetHashValue(hashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr); if (bitmapPtr == NULL) { Tcl_Panic("TkDebugBitmap found empty hash table entry"); } @@ -1190,7 +1189,7 @@ TkDebugBitmap( Tcl_HashTable * TkGetBitmapPredefTable(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return &tsdPtr->predefBitmapTable; diff --git a/generic/tkBusy.c b/generic/tkBusy.c index fa526a3..d1f2696 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -54,7 +54,7 @@ static void MakeTransparentWindowExist(Tk_Window tkwin, Window parent); static inline Tk_Window NextChild(Tk_Window tkwin); static void RefWinEventProc(ClientData clientData, - register XEvent *eventPtr); + XEvent *eventPtr); static inline void SetWindowInstanceData(Tk_Window tkwin, ClientData instanceData); @@ -128,7 +128,8 @@ BusyCustodyProc( ClientData clientData, /* Information about the busy window. */ Tk_Window tkwin) /* Not used. */ { - Busy *busyPtr = clientData; + Busy *busyPtr = (Busy *)clientData; + (void)tkwin; Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc, busyPtr); @@ -159,11 +160,14 @@ BusyCustodyProc( /* ARGSUSED */ static void BusyGeometryProc( - ClientData clientData, /* Information about window that got new + ClientData dummy, /* Information about window that got new * preferred geometry. */ Tk_Window tkwin) /* Other Tk-related information about the * window. */ { + (void)dummy; + (void)tkwin; + /* Should never get here */ } @@ -249,9 +253,9 @@ DoConfigureNotify( static void RefWinEventProc( ClientData clientData, /* Busy window record */ - register XEvent *eventPtr) /* Event which triggered call to routine */ + XEvent *eventPtr) /* Event which triggered call to routine */ { - register Busy *busyPtr = clientData; + Busy *busyPtr = (Busy *)clientData; switch (eventPtr->type) { case ReparentNotify: @@ -333,7 +337,7 @@ static void DestroyBusy( void *data) /* Busy window structure record */ { - register Busy *busyPtr = data; + Busy *busyPtr = (Busy *)data; if (busyPtr->hashPtr != NULL) { Tcl_DeleteHashEntry(busyPtr->hashPtr); @@ -377,7 +381,7 @@ BusyEventProc( ClientData clientData, /* Busy window record */ XEvent *eventPtr) /* Event which triggered call to routine */ { - Busy *busyPtr = clientData; + Busy *busyPtr = (Busy *)clientData; if (eventPtr->type == DestroyNotify) { busyPtr->tkBusy = NULL; @@ -527,10 +531,10 @@ CreateBusy( Window parent; Tk_FakeWin *winPtr; - busyPtr = ckalloc(sizeof(Busy)); + busyPtr = (Busy *)ckalloc(sizeof(Busy)); x = y = 0; length = strlen(Tk_Name(tkRef)); - name = ckalloc(length + 6); + name = (char *)ckalloc(length + 6); if (Tk_IsTopLevel(tkRef)) { fmt = "_Busy"; /* Child */ tkParent = tkRef; @@ -696,7 +700,7 @@ GetBusy( Tcl_GetString(windowObj), NULL); return NULL; } - return Tcl_GetHashValue(hPtr); + return (Busy *)Tcl_GetHashValue(hPtr); } /* @@ -746,7 +750,7 @@ HoldBusy( Tcl_SetHashValue(hPtr, busyPtr); busyPtr->hashPtr = hPtr; } else { - busyPtr = Tcl_GetHashValue(hPtr); + busyPtr = (Busy *)Tcl_GetHashValue(hPtr); } busyPtr->tablePtr = busyTablePtr; @@ -792,7 +796,7 @@ Tk_BusyObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; Tcl_HashTable *busyTablePtr = &((TkWindow *) tkwin)->mainPtr->busyTable; Busy *busyPtr; Tcl_Obj *objPtr; @@ -894,7 +898,7 @@ Tk_BusyObjCmd( objPtr = Tcl_NewObj(); for (hPtr = Tcl_FirstHashEntry(busyTablePtr, &cursor); hPtr != NULL; hPtr = Tcl_NextHashEntry(&cursor)) { - busyPtr = Tcl_GetHashValue(hPtr); + busyPtr = (Busy *)Tcl_GetHashValue(hPtr); if (pattern == NULL || Tcl_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) { Tcl_ListObjAppendElement(interp, objPtr, diff --git a/generic/tkButton.c b/generic/tkButton.c index c43fe9b..b9049a7 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -628,7 +628,7 @@ Tk_RadiobuttonObjCmd( static int ButtonCreate( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument values. */ @@ -639,8 +639,9 @@ ButtonCreate( TkButton *butPtr; Tk_OptionTable optionTable; Tk_Window tkwin; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; if (!tsdPtr->defaultsInitialized) { TkpButtonSetDefaults(); @@ -788,7 +789,7 @@ ButtonWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; int index; int result; Tcl_Obj *objPtr; @@ -1036,7 +1037,7 @@ DestroyButton( static int ConfigureButton( Tcl_Interp *interp, /* Used for error reporting. */ - register TkButton *butPtr, /* Information about widget; may or may + TkButton *butPtr, /* Information about widget; may or may * not already have values for some fields. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -1348,7 +1349,7 @@ TkButtonWorldChanged( XGCValues gcValues; GC newGC; unsigned long mask; - TkButton *butPtr = instanceData; + TkButton *butPtr = (TkButton *)instanceData; /* * Recompute GCs. @@ -1459,7 +1460,7 @@ ButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; } else if (eventPtr->type == ConfigureNotify) { @@ -1517,7 +1518,7 @@ static void ButtonCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; /* * This function could be invoked either because the window was destroyed @@ -1612,9 +1613,11 @@ ButtonVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; const char *value; Tcl_Obj *valuePtr; + (void)name1; + (void)name2; /* * If the variable is being unset, then just re-establish the trace unless @@ -1722,8 +1725,10 @@ ButtonTextVarProc( const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; Tcl_Obj *valuePtr; + (void)name1; + (void)name2; if (butPtr->flags & BUTTON_DELETED) { return NULL; @@ -1817,7 +1822,13 @@ ButtonImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; if (butPtr->tkwin != NULL) { TkpComputeButtonGeometry(butPtr); @@ -1855,7 +1866,13 @@ ButtonSelectImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; #ifdef MAC_OSX_TK if (butPtr->tkwin != NULL) { @@ -1902,7 +1919,13 @@ ButtonTristateImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; #ifdef MAC_OSX_TK if (butPtr->tkwin != NULL) { diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index b41dc64..d6ba762 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -712,6 +712,7 @@ DeleteArc( Display *display) /* Display containing window for canvas. */ { ArcItem *arcPtr = (ArcItem *) itemPtr; + (void)canvas; Tk_DeleteOutline(display, &(arcPtr->outline)); if (arcPtr->numOutlinePoints != 0) { @@ -909,6 +910,10 @@ DisplayArc( double lineWidth; Tk_State state = itemPtr->state; Pixmap stipple; + (void)x; + (void)y; + (void)width; + (void)height; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; @@ -1632,7 +1637,7 @@ ComputeArcOutline( */ if (arcPtr->numOutlinePoints == 0) { - arcPtr->outlinePtr = ckalloc(26 * sizeof(double)); + arcPtr->outlinePtr = (double *)ckalloc(26 * sizeof(double)); arcPtr->numOutlinePoints = 22; } outlinePtr = arcPtr->outlinePtr; @@ -2012,6 +2017,7 @@ ArcToPostscript( Tk_State state = itemPtr->state; Tcl_Obj *psObj; Tcl_InterpState interpState; + (void)prepass; y1 = Tk_CanvasPsY(canvas, arcPtr->bbox[1]); y2 = Tk_CanvasPsY(canvas, arcPtr->bbox[3]); @@ -2213,7 +2219,7 @@ ArcToPostscript( static int StyleParseProc( - ClientData clientData, /* some flags.*/ + ClientData dummy, /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option. */ @@ -2222,8 +2228,9 @@ StyleParseProc( { int c; size_t length; - - register Style *stylePtr = (Style *) (widgRec + offset); + Style *stylePtr = (Style *) (widgRec + offset); + (void)dummy; + (void)tkwin; if (value == NULL || *value == 0) { *stylePtr = PIESLICE_STYLE; @@ -2277,7 +2284,7 @@ StyleParseProc( static const char * StylePrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Ignored. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ @@ -2285,7 +2292,10 @@ StylePrintProc( * information about how to reclaim storage * for return string. */ { - register Style *stylePtr = (Style *) (widgRec + offset); + Style *stylePtr = (Style *) (widgRec + offset); + (void)dummy; + (void)tkwin; + (void)freeProcPtr; if (*stylePtr == ARC_STYLE) { return "arc"; diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index e7b19ae..b9ef3bd 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -422,6 +422,7 @@ DeleteBitmap( Display *display) /* Display containing window for canvas. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; + (void)canvas; if (bmapPtr->bitmap != None) { Tk_FreeBitmap(display, bmapPtr->bitmap); @@ -680,6 +681,7 @@ BitmapToPoint( { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; + (void)canvas; x1 = bmapPtr->header.x1; y1 = bmapPtr->header.y1; @@ -738,6 +740,7 @@ BitmapToArea( * area. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; + (void)canvas; if ((rectPtr[2] <= bmapPtr->header.x1) || (rectPtr[0] >= bmapPtr->header.x2) @@ -893,6 +896,7 @@ BitmapToPostscript( Tk_State state = itemPtr->state; Tcl_Obj *psObj; Tcl_InterpState interpState; + (void)prepass; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index 19e1c70..13bf618 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.c @@ -385,6 +385,8 @@ DeleteImage( Display *display) /* Display containing window for canvas. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; + (void)canvas; + (void)display; if (imgPtr->imageString != NULL) { ckfree(imgPtr->imageString); @@ -537,6 +539,7 @@ DisplayImage( short drawableX, drawableY; Tk_Image image; Tk_State state = itemPtr->state; + (void)display; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; @@ -595,6 +598,7 @@ ImageToPoint( { ImageItem *imgPtr = (ImageItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; + (void)canvas; x1 = imgPtr->header.x1; y1 = imgPtr->header.y1; @@ -652,6 +656,7 @@ ImageToArea( * area. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; + (void)canvas; if ((rectPtr[2] <= imgPtr->header.x1) || (rectPtr[0] >= imgPtr->header.x2) @@ -888,7 +893,7 @@ ImageChangedProc( * 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - ImageItem *imgPtr = clientData; + ImageItem *imgPtr = (ImageItem *)clientData; /* * If the image's size changed and it's not anchored at its northwest diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index 5f2dcb7..b2d8490 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -409,7 +409,7 @@ LineCoords( numPoints = objc/2; if (linePtr->numPoints != numPoints) { - coordPtr = ckalloc(sizeof(double) * objc); + coordPtr = (double *)ckalloc(sizeof(double) * objc); if (linePtr->coordPtr != NULL) { ckfree(linePtr->coordPtr); } @@ -610,6 +610,7 @@ DeleteLine( Display *display) /* Display containing window for canvas. */ { LineItem *linePtr = (LineItem *) itemPtr; + (void)canvas; Tk_DeleteOutline(display, &linePtr->outline); if (linePtr->coordPtr != NULL) { @@ -843,6 +844,10 @@ DisplayLine( double linewidth; int numPoints; Tk_State state = itemPtr->state; + (void)x; + (void)y; + (void)width; + (void)height; if (!linePtr->numPoints || (linePtr->outline.gc == NULL)) { return; @@ -878,7 +883,7 @@ DisplayLine( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * 3 * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * 3 * sizeof(XPoint)); } if ((linePtr->smooth) && (linePtr->numPoints > 2)) { @@ -987,7 +992,7 @@ LineInsert( linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0]; linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1]; } - newCoordPtr = ckalloc(sizeof(double) * (length + objc)); + newCoordPtr = (double *)ckalloc(sizeof(double) * (length + objc)); for (i=0; icoordPtr[i]; } @@ -1368,7 +1373,7 @@ LineToPoint( if (numPoints <= MAX_STATIC_POINTS) { linePoints = staticSpace; } else { - linePoints = ckalloc(2 * numPoints * sizeof(double)); + linePoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, linePoints); @@ -1603,7 +1608,7 @@ LineToArea( if (numPoints <= MAX_STATIC_POINTS) { linePoints = staticSpace; } else { - linePoints = ckalloc(2 * numPoints * sizeof(double)); + linePoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, linePoints); @@ -1748,6 +1753,7 @@ GetLineIndex( { LineItem *linePtr = (LineItem *) itemPtr; const char *string = Tcl_GetString(obj); + (void)canvas; if (string[0] == 'e') { if (strncmp(string, "end", obj->length) == 0) { @@ -1929,7 +1935,7 @@ RotateLine( /* ARGSUSED */ static int ParseArrowShape( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Used for error reporting. */ Tk_Window tkwin, /* Not used. */ const char *value, /* Textual specification of arrow shape. */ @@ -1942,6 +1948,8 @@ ParseArrowShape( double a, b, c; int argc; const char **argv = NULL; + (void)dummy; + (void)tkwin; if ((size_t)offset != offsetof(LineItem, arrowShapeA)) { Tcl_Panic("ParseArrowShape received bogus offset"); @@ -1998,7 +2006,7 @@ ParseArrowShape( /* ARGSUSED */ static const char * PrintArrowShape( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tk_Window tkwin, /* Window associated with linePtr's widget. */ char *recordPtr, /* Pointer to item record containing current * shape information. */ @@ -2007,7 +2015,10 @@ PrintArrowShape( * string here. */ { LineItem *linePtr = (LineItem *) recordPtr; - char *buffer = ckalloc(120); + char *buffer = (char *)ckalloc(120); + (void)dummy; + (void)tkwin; + (void)offset; sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA, linePtr->arrowShapeB, linePtr->arrowShapeC); @@ -2035,7 +2046,7 @@ PrintArrowShape( static int ArrowParseProc( - ClientData clientData, /* some flags.*/ + ClientData dummy, /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option. */ @@ -2044,8 +2055,9 @@ ArrowParseProc( { int c; size_t length; - - register Arrows *arrowPtr = (Arrows *) (widgRec + offset); + Arrows *arrowPtr = (Arrows *) (widgRec + offset); + (void)dummy; + (void)tkwin; if (value == NULL || *value == 0) { *arrowPtr = ARROWS_NONE; @@ -2103,7 +2115,7 @@ ArrowParseProc( static const char * ArrowPrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ @@ -2111,7 +2123,10 @@ ArrowPrintProc( * information about how to reclaim storage * for return string. */ { - register Arrows *arrowPtr = (Arrows *) (widgRec + offset); + Arrows *arrowPtr = (Arrows *) (widgRec + offset); + (void)dummy; + (void)tkwin; + (void)freeProcPtr; switch (*arrowPtr) { case ARROWS_FIRST: @@ -2206,7 +2221,7 @@ ConfigureArrows( if (linePtr->arrow != ARROWS_LAST) { poly = linePtr->firstArrowPtr; if (poly == NULL) { - poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double)); + poly = (double *)ckalloc(2 * PTS_IN_ARROW * sizeof(double)); poly[0] = poly[10] = linePtr->coordPtr[0]; poly[1] = poly[11] = linePtr->coordPtr[1]; linePtr->firstArrowPtr = poly; @@ -2250,7 +2265,7 @@ ConfigureArrows( coordPtr = linePtr->coordPtr + 2*(linePtr->numPoints-2); poly = linePtr->lastArrowPtr; if (poly == NULL) { - poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double)); + poly = (double *)ckalloc(2 * PTS_IN_ARROW * sizeof(double)); poly[0] = poly[10] = coordPtr[2]; poly[1] = poly[11] = coordPtr[3]; linePtr->lastArrowPtr = poly; @@ -2319,6 +2334,7 @@ LineToPostscript( Tk_State state = itemPtr->state; Tcl_Obj *psObj; Tcl_InterpState interpState; + (void)prepass; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; @@ -2419,7 +2435,7 @@ LineToPostscript( linePtr->numPoints, linePtr->splineSteps, NULL, NULL); pointPtr = staticPoints; if (numPoints > MAX_STATIC_POINTS) { - pointPtr = ckalloc(numPoints * 2 * sizeof(double)); + pointPtr = (double *)ckalloc(numPoints * 2 * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr); diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index eeba814..5b5769a 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -378,7 +378,7 @@ PolygonCoords( * another point to close the polygon. */ - polyPtr->coordPtr = ckalloc(sizeof(double) * (objc+2)); + polyPtr->coordPtr = (double *)ckalloc(sizeof(double) * (objc+2)); polyPtr->pointsAllocated = numPoints+1; } for (i = objc-1; i >= 0; i--) { @@ -571,6 +571,7 @@ DeletePolygon( Display *display) /* Display containing window for canvas. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; + (void)canvas; Tk_DeleteOutline(display, &polyPtr->outline); if (polyPtr->coordPtr != NULL) { @@ -827,7 +828,7 @@ TkFillPolygon( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * sizeof(XPoint)); } for (i=0, pPtr=pointPtr ; istate; Pixmap stipple = polyPtr->fillStipple; double linewidth = polyPtr->outline.width; + (void)x; + (void)y; + (void)width; + (void)height; if (((polyPtr->fillGC == NULL) && (polyPtr->outline.gc == NULL)) || (polyPtr->numPoints < 1) || @@ -973,7 +978,7 @@ DisplayPolygon( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * sizeof(XPoint)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL); @@ -1040,7 +1045,7 @@ PolygonInsert( while (beforeThis < 0) { beforeThis += length; } - newCoordPtr = ckalloc(sizeof(double) * (length + 2 + objc)); + newCoordPtr = (double *)ckalloc(sizeof(double) * (length + 2 + objc)); for (i=0; icoordPtr[i]; } @@ -1290,7 +1295,7 @@ PolygonToPoint( if (numPoints <= MAX_STATIC_POINTS) { polyPoints = staticSpace; } else { - polyPoints = ckalloc(2 * numPoints * sizeof(double)); + polyPoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints); @@ -1499,7 +1504,7 @@ PolygonToArea( if (numPoints <= MAX_STATIC_POINTS) { polyPoints = staticSpace; } else { - polyPoints = ckalloc(2 * numPoints * sizeof(double)); + polyPoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints); @@ -1678,6 +1683,7 @@ GetPolygonIndex( { PolygonItem *polyPtr = (PolygonItem *) itemPtr; const char *string = Tcl_GetString(obj); + (void)canvas; if (string[0] == 'e') { if (strncmp(string, "end", obj->length) != 0) { @@ -1851,6 +1857,7 @@ PolygonToPostscript( double width; Tcl_Obj *psObj; Tcl_InterpState interpState; + (void)prepass; if (polyPtr->numPoints < 2 || polyPtr->coordPtr == NULL) { return TCL_OK; diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index 2598d4e..386ada9 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.c @@ -1194,6 +1194,8 @@ TkImageGetColor( double *red, double *green, double *blue) /* Color data to return */ { + (void)cdata; + *red = (double) GetRValue(pixel) / 255.0; *green = (double) GetGValue(pixel) / 255.0; *blue = (double) GetBValue(pixel) / 255.0; @@ -1262,6 +1264,7 @@ TkPostscriptImage( Visual *visual; TkColormapData cdata; Tcl_Obj *psObj; + (void)y; if (psInfoPtr->prepass) { return TCL_OK; @@ -1276,7 +1279,7 @@ TkPostscriptImage( */ ncolors = visual->map_entries; - cdata.colors = ckalloc(sizeof(XColor) * ncolors); + cdata.colors = (XColor *)ckalloc(sizeof(XColor) * ncolors); cdata.ncolors = ncolors; if (visual->c_class == DirectColor || visual->c_class == TrueColor) { diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 61aa9be..6d7a91b 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -570,6 +570,7 @@ DeleteText( Display *display) /* Display containing window for canvas. */ { TextItem *textPtr = (TextItem *) itemPtr; + (void)canvas; if (textPtr->color != NULL) { Tk_FreeColor(textPtr->color); @@ -1031,7 +1032,7 @@ TextInsert( return; } - newStr = ckalloc(textPtr->numBytes + byteCount + 1); + newStr = (char *)ckalloc(textPtr->numBytes + byteCount + 1); memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, string); strcpy(newStr + byteIndex + byteCount, text + byteIndex); @@ -1112,7 +1113,7 @@ TextDeleteChars( byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved) - (text + byteIndex); - newStr = ckalloc(textPtr->numBytes + 1 - byteCount); + newStr = (char *)ckalloc(textPtr->numBytes + 1 - byteCount); memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, text + byteIndex + byteCount); @@ -1479,6 +1480,7 @@ SetTextCursor( * which cursor is to be positioned. */ { TextItem *textPtr = (TextItem *) itemPtr; + (void)canvas; if (index < 0) { textPtr->insertPos = 0; @@ -1525,6 +1527,7 @@ GetSelText( char *text; const char *selStart, *selEnd; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; + (void)canvas; if ((textInfoPtr->selectFirst < 0) || (textInfoPtr->selectFirst > textInfoPtr->selectLast)) { diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index 2c6d480..cbc52dd 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -230,12 +230,14 @@ Tk_CanvasWindowCoords( int Tk_CanvasGetCoord( - Tcl_Interp *interp, /* Interpreter for error reporting. */ + Tcl_Interp *dummy, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to which coordinate applies. */ const char *string, /* Describes coordinate (any screen coordinate * form may be used here). */ double *doublePtr) /* Place to store converted coordinate. */ { + (void)dummy; + if (Tk_GetScreenMM(Canvas(canvas)->interp, Canvas(canvas)->tkwin, string, doublePtr) != TCL_OK) { return TCL_ERROR; @@ -266,12 +268,14 @@ Tk_CanvasGetCoord( int Tk_CanvasGetCoordFromObj( - Tcl_Interp *interp, /* Interpreter for error reporting. */ + Tcl_Interp *dummy, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to which coordinate applies. */ Tcl_Obj *obj, /* Describes coordinate (any screen coordinate * form may be used here). */ double *doublePtr) /* Place to store converted coordinate. */ { + (void)dummy; + return Tk_GetDoublePixelsFromObj(Canvas(canvas)->interp, Canvas(canvas)->tkwin, obj, doublePtr); } @@ -331,7 +335,7 @@ Tk_CanvasSetOffset( * redisplaying the canvas. */ Tk_TSOffset *offset) /* Offset (may be NULL pointer)*/ { - register TkCanvas *canvasPtr = Canvas(canvas); + TkCanvas *canvasPtr = Canvas(canvas); int flags = 0; int x = - canvasPtr->drawableXOrigin; int y = - canvasPtr->drawableYOrigin; @@ -398,17 +402,20 @@ Tk_CanvasGetTextInfo( int Tk_CanvasTagsParseProc( - ClientData clientData, /* Not used.*/ + ClientData dummy, /* Not used.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option (list of tag names). */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item (ignored). */ { - register Tk_Item *itemPtr = (Tk_Item *) widgRec; + Tk_Item *itemPtr = (Tk_Item *) widgRec; int argc, i; const char **argv; Tk_Uid *newPtr; + (void)dummy; + (void)tkwin; + (void)offset; /* * Break the value up into the individual tag names. @@ -423,7 +430,7 @@ Tk_CanvasTagsParseProc( */ if (itemPtr->tagSpace < argc) { - newPtr = ckalloc(argc * sizeof(Tk_Uid)); + newPtr = (Tk_Uid *)ckalloc(argc * sizeof(Tk_Uid)); for (i = itemPtr->numTags-1; i >= 0; i--) { newPtr[i] = itemPtr->tagPtr[i]; } @@ -465,7 +472,7 @@ Tk_CanvasTagsParseProc( const char * Tk_CanvasTagsPrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Ignored. */ @@ -473,7 +480,10 @@ Tk_CanvasTagsPrintProc( * information about how to reclaim storage * for return string. */ { - register Tk_Item *itemPtr = (Tk_Item *) widgRec; + Tk_Item *itemPtr = (Tk_Item *) widgRec; + (void)dummy; + (void)tkwin; + (void)offset; if (itemPtr->numTags == 0) { *freeProcPtr = NULL; @@ -507,13 +517,16 @@ Tk_CanvasTagsPrintProc( int TkCanvasDashParseProc( - ClientData clientData, /* Not used.*/ + ClientData dummy, /* Not used.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { + (void)dummy; + (void)tkwin; + return Tk_GetDash(interp, value, (Tk_Dash *) (widgRec+offset)); } @@ -541,7 +554,7 @@ TkCanvasDashParseProc( const char * TkCanvasDashPrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset in record for item. */ @@ -552,11 +565,13 @@ TkCanvasDashPrintProc( Tk_Dash *dash = (Tk_Dash *) (widgRec+offset); char *buffer, *p; int i = dash->number; + (void)dummy; + (void)tkwin; if (i < 0) { i = -i; *freeProcPtr = TCL_DYNAMIC; - buffer = ckalloc(i + 1); + buffer = (char *)ckalloc(i + 1); p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; memcpy(buffer, p, (unsigned int) i); buffer[i] = 0; @@ -565,7 +580,7 @@ TkCanvasDashPrintProc( *freeProcPtr = NULL; return ""; } - buffer = ckalloc(4 * i); + buffer = (char *)ckalloc(4 * i); *freeProcPtr = TCL_DYNAMIC; p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; @@ -601,12 +616,12 @@ InitSmoothMethods( { SmoothAssocData *methods, *ptr; - methods = ckalloc(sizeof(SmoothAssocData)); + methods = (SmoothAssocData *)ckalloc(sizeof(SmoothAssocData)); methods->smooth.name = tkRawSmoothMethod.name; methods->smooth.coordProc = tkRawSmoothMethod.coordProc; methods->smooth.postscriptProc = tkRawSmoothMethod.postscriptProc; - ptr = methods->nextPtr = ckalloc(sizeof(SmoothAssocData)); + ptr = methods->nextPtr = (SmoothAssocData *)ckalloc(sizeof(SmoothAssocData)); ptr->smooth.name = tkBezierSmoothMethod.name; ptr->smooth.coordProc = tkBezierSmoothMethod.coordProc; ptr->smooth.postscriptProc = tkBezierSmoothMethod.postscriptProc; @@ -640,7 +655,7 @@ Tk_CreateSmoothMethod( const Tk_SmoothMethod *smooth) { SmoothAssocData *methods, *typePtr2, *prevPtr, *ptr; - methods = Tcl_GetAssocData(interp, "smoothMethod", NULL); + methods = (SmoothAssocData *)Tcl_GetAssocData(interp, "smoothMethod", NULL); /* * Initialize if we were not previously initialized. @@ -666,7 +681,7 @@ Tk_CreateSmoothMethod( break; } } - ptr = ckalloc(sizeof(SmoothAssocData)); + ptr = (SmoothAssocData *)ckalloc(sizeof(SmoothAssocData)); ptr->smooth.name = smooth->name; ptr->smooth.coordProc = smooth->coordProc; ptr->smooth.postscriptProc = smooth->postscriptProc; @@ -695,9 +710,10 @@ static void SmoothMethodCleanupProc( ClientData clientData, /* Points to "smoothMethod" AssocData for the * interpreter. */ - Tcl_Interp *interp) /* Interpreter that is being deleted. */ + Tcl_Interp *dummy) /* Interpreter that is being deleted. */ { - SmoothAssocData *ptr, *methods = clientData; + SmoothAssocData *ptr, *methods = (SmoothAssocData *)clientData; + (void)dummy; while (methods != NULL) { ptr = methods; @@ -725,26 +741,28 @@ SmoothMethodCleanupProc( int TkSmoothParseProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { - register const Tk_SmoothMethod **smoothPtr = + const Tk_SmoothMethod **smoothPtr = (const Tk_SmoothMethod **) (widgRec + offset); const Tk_SmoothMethod *smooth = NULL; int b; size_t length; SmoothAssocData *methods; + (void)dummy; + (void)tkwin; if (value == NULL || *value == 0) { *smoothPtr = NULL; return TCL_OK; } length = strlen(value); - methods = Tcl_GetAssocData(interp, "smoothMethod", NULL); + methods = (SmoothAssocData *)Tcl_GetAssocData(interp, "smoothMethod", NULL); /* * Not initialized yet; fix that now. @@ -817,7 +835,7 @@ TkSmoothParseProc( const char * TkSmoothPrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ @@ -825,8 +843,11 @@ TkSmoothPrintProc( * information about how to reclaim storage * for return string. */ { - register const Tk_SmoothMethod *smoothPtr = + const Tk_SmoothMethod *smoothPtr = * (Tk_SmoothMethod **) (widgRec + offset); + (void)dummy; + (void)tkwin; + (void)freeProcPtr; return smoothPtr ? smoothPtr->name : "0"; } @@ -876,7 +897,7 @@ Tk_GetDash( } i = strlen(value); if (i > (int) sizeof(char *)) { - dash->pattern.pt = pt = ckalloc(strlen(value)); + dash->pattern.pt = pt = (char *)ckalloc(strlen(value)); } else { pt = dash->pattern.array; } @@ -894,7 +915,7 @@ Tk_GetDash( ckfree(dash->pattern.pt); } if (argc > (int) sizeof(char *)) { - dash->pattern.pt = pt = ckalloc(argc); + dash->pattern.pt = pt = (char *)ckalloc(argc); } else { pt = dash->pattern.array; } @@ -1225,7 +1246,7 @@ Tk_ChangeOutlineGC( int i = -dash->number; p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; - q = ckalloc(2 * i); + q = (char *)ckalloc(2 * i); i = DashConvert(q, p, i, width); XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, q,i); ckfree(q); @@ -1446,7 +1467,7 @@ Tk_CanvasPsOutline( Tcl_AppendPrintfToObj(psObj, "] %d setdash\n", outline->offset); } else if (dash->number < 0) { if (dash->number < -5) { - lptr = ckalloc(1 - 2*dash->number); + lptr = (char *)ckalloc(1 - 2*dash->number); } i = DashConvert(lptr, ptr, -dash->number, width); if (i > 0) { @@ -1659,6 +1680,7 @@ TkCanvTranslatePath( int i, j; /* Loop counters */ double limit[4]; /* Boundries at which clipping occurs */ double staticSpace[480]; /* Temp space from the stack */ + (void)closedPath; /* * Constrain all vertices of the path to be within a box that is no larger @@ -1718,7 +1740,7 @@ TkCanvTranslatePath( if (numVertex*12 <= (int) (sizeof(staticSpace) / sizeof(double))) { tempArr = staticSpace; } else { - tempArr = ckalloc(numVertex * 12 * sizeof(double)); + tempArr = (double *)ckalloc(numVertex * 12 * sizeof(double)); } for (i=0; itkwin != NULL) { Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask, @@ -570,6 +571,11 @@ DisplayWinItem( short x, y; Tk_Window canvasTkwin = Tk_CanvasTkwin(canvas); Tk_State state = itemPtr->state; + (void)display; + (void)regionX; + (void)regionY; + (void)regionWidth; + (void)regionHeight; if (winItemPtr->tkwin == NULL) { return; @@ -658,6 +664,7 @@ WinItemToPoint( { WindowItem *winItemPtr = (WindowItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; + (void)canvas; x1 = winItemPtr->header.x1; y1 = winItemPtr->header.y1; @@ -715,6 +722,7 @@ WinItemToArea( * area. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; + (void)canvas; if ((rectPtr[2] <= winItemPtr->header.x1) || (rectPtr[0] >= winItemPtr->header.x2) @@ -751,9 +759,12 @@ WinItemToArea( #ifdef X_GetImage static int xerrorhandler( - ClientData clientData, + ClientData dummy, XErrorEvent *e) { + (void)dummy; + (void)e; + return 0; } #endif /* X_GetImage */ @@ -1044,7 +1055,7 @@ WinItemStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - WindowItem *winItemPtr = clientData; + WindowItem *winItemPtr = (WindowItem *)clientData; if (eventPtr->type == DestroyNotify) { winItemPtr->tkwin = NULL; @@ -1074,7 +1085,8 @@ WinItemRequestProc( ClientData clientData, /* Pointer to record for window item. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - WindowItem *winItemPtr = clientData; + WindowItem *winItemPtr = (WindowItem *)clientData; + (void)tkwin; ComputeWindowBbox(winItemPtr->canvas, winItemPtr); @@ -1111,8 +1123,9 @@ WinItemLostSlaveProc( * was stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - WindowItem *winItemPtr = clientData; + WindowItem *winItemPtr = (WindowItem *)clientData; Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas); + (void)tkwin; Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask, WinItemStructureProc, winItemPtr); diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 8def19c..228803b 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -684,7 +684,7 @@ Tk_CanvasObjCmd( int argc, /* Number of arguments. */ Tcl_Obj *const argv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkCanvas *canvasPtr; Tk_Window newWin; @@ -708,7 +708,7 @@ Tk_CanvasObjCmd( * pointers). */ - canvasPtr = ckalloc(sizeof(TkCanvas)); + canvasPtr = (TkCanvas *)ckalloc(sizeof(TkCanvas)); canvasPtr->tkwin = newWin; canvasPtr->display = Tk_Display(newWin); canvasPtr->interp = interp; @@ -832,7 +832,7 @@ CanvasWidgetCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; int c, result; Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent * compiler warning. */ @@ -962,7 +962,7 @@ CanvasWidgetCmd( entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, INT2PTR(searchPtr->id)); if (entryPtr != NULL) { - itemPtr = Tcl_GetHashValue(entryPtr); + itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr); object = itemPtr; } @@ -1305,7 +1305,7 @@ CanvasWidgetCmd( } typePtr = matchPtr; - itemPtr = ckalloc(typePtr->itemSize); + itemPtr = (Tk_Item *)ckalloc(typePtr->itemSize); itemPtr->id = canvasPtr->nextId; canvasPtr->nextId++; itemPtr->tagPtr = itemPtr->staticTagSpace; @@ -2233,7 +2233,7 @@ static void DestroyCanvas( void *memPtr) /* Info about canvas widget. */ { - TkCanvas *canvasPtr = memPtr; + TkCanvas *canvasPtr = (TkCanvas *)memPtr; Tk_Item *itemPtr; TagSearchExpr *expr, *next; @@ -2466,7 +2466,7 @@ static void CanvasWorldChanged( ClientData instanceData) /* Information about widget. */ { - TkCanvas *canvasPtr = instanceData; + TkCanvas *canvasPtr = (TkCanvas *)instanceData; Tk_Item *itemPtr; itemPtr = canvasPtr->firstItemPtr; @@ -2579,12 +2579,12 @@ DrawCanvas( int subsample, /* If either subsample or zoom are not 1 then we call Tk_PhotoPutZoomedBlock() */ int zoom) { - TkCanvas * canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin; Display *displayPtr; Tk_PhotoImageBlock blockPtr = {0}; Window wid; - Tk_Item * itemPtr; + Tk_Item *itemPtr; Pixmap pixmap = 0; XImage *ximagePtr = NULL; Visual *visualPtr; @@ -2811,7 +2811,7 @@ DrawCanvas( blockPtr.offset[1] = 1; blockPtr.offset[2] = 2; blockPtr.offset[3] = 3; - blockPtr.pixelPtr = ckalloc(blockPtr.pixelSize * blockPtr.height * blockPtr.width); + blockPtr.pixelPtr = (unsigned char *)ckalloc(blockPtr.pixelSize * blockPtr.height * blockPtr.width); /* * Now convert the image data pixel by pixel from XImage to 32bit RGBA @@ -2998,7 +2998,7 @@ static void DisplayCanvas( ClientData clientData) /* Information about widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin = canvasPtr->tkwin; Tk_Item *itemPtr; Pixmap pixmap; @@ -3252,7 +3252,7 @@ CanvasEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; if (eventPtr->type == Expose) { int x, y; @@ -3342,7 +3342,7 @@ static void CanvasCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin = canvasPtr->tkwin; /* @@ -3632,7 +3632,7 @@ InitCanvas(void) static SearchUids * GetStaticUids(void) { - SearchUids *searchUids = + SearchUids *searchUids = (SearchUids *) Tcl_GetThreadData(&dataKey, sizeof(SearchUids)); if (searchUids->allUid == NULL) { @@ -3671,7 +3671,7 @@ TagSearchExprInit( TagSearchExpr *expr = *exprPtrPtr; if (expr == NULL) { - expr = ckalloc(sizeof(TagSearchExpr)); + expr = (TagSearchExpr *)ckalloc(sizeof(TagSearchExpr)); expr->allocated = 0; expr->uids = NULL; expr->next = NULL; @@ -3752,7 +3752,7 @@ TagSearchScan( * Allocate primary search struct on first call. */ - *searchPtrPtr = searchPtr = ckalloc(sizeof(TagSearch)); + *searchPtrPtr = searchPtr = (TagSearch *)ckalloc(sizeof(TagSearch)); searchPtr->expr = NULL; /* @@ -3760,7 +3760,7 @@ TagSearchScan( */ searchPtr->rewritebufferAllocated = 100; - searchPtr->rewritebuffer = ckalloc(searchPtr->rewritebufferAllocated); + searchPtr->rewritebuffer =(char *) ckalloc(searchPtr->rewritebufferAllocated); } TagSearchExprInit(&searchPtr->expr); @@ -3777,7 +3777,7 @@ TagSearchScan( if ((unsigned) searchPtr->stringLength >= searchPtr->rewritebufferAllocated) { searchPtr->rewritebufferAllocated = searchPtr->stringLength + 100; - searchPtr->rewritebuffer = + searchPtr->rewritebuffer = (char *) ckrealloc(searchPtr->rewritebuffer, searchPtr->rewritebufferAllocated); } @@ -3960,10 +3960,10 @@ TagSearchScanExpr( if (expr->index >= expr->allocated-1) { expr->allocated += 15; if (expr->uids) { - expr->uids = ckrealloc(expr->uids, + expr->uids = (Tk_Uid *)ckrealloc(expr->uids, expr->allocated * sizeof(Tk_Uid)); } else { - expr->uids = ckalloc(expr->allocated * sizeof(Tk_Uid)); + expr->uids = (Tk_Uid *)ckalloc(expr->allocated * sizeof(Tk_Uid)); } } @@ -4375,7 +4375,7 @@ TagSearchFirst( entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable, INT2PTR(searchPtr->id)); if (entryPtr != NULL) { - itemPtr = Tcl_GetHashValue(entryPtr); + itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr); lastPtr = itemPtr->prevPtr; } else { lastPtr = itemPtr = NULL; @@ -4593,7 +4593,7 @@ DoItem( Tk_Uid *newTagPtr; itemPtr->tagSpace += 5; - newTagPtr = ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid)); + newTagPtr = (Tk_Uid*)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid)); memcpy((void *) newTagPtr, itemPtr->tagPtr, itemPtr->numTags * sizeof(Tk_Uid)); if (itemPtr->tagPtr != itemPtr->staticTagSpace) { @@ -5078,7 +5078,7 @@ CanvasBindProc( ClientData clientData, /* Pointer to canvas structure. */ XEvent *eventPtr) /* Pointer to X event that just happened. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; unsigned long mask; Tcl_Preserve(canvasPtr); @@ -5481,7 +5481,7 @@ CanvasDoEvent( if (numObjects <= NUM_STATIC) { objectPtr = staticObjects; } else { - objectPtr = ckalloc(numObjects * sizeof(void *)); + objectPtr = (void **)ckalloc(numObjects * sizeof(void *)); } objectPtr[0] = (char *)searchUids->allUid; for (i = itemPtr->numTags-1; i >= 0; i--) { @@ -5538,7 +5538,7 @@ static void CanvasBlinkProc( ClientData clientData) /* Pointer to record describing entry. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; if (!canvasPtr->textInfo.gotFocus || (canvasPtr->insertOffTime == 0)) { return; @@ -5694,7 +5694,7 @@ CanvasFetchSelection( * not including terminating NULL * character. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; return ItemSelection(canvasPtr, canvasPtr->textInfo.selItemPtr, offset, buffer, maxBytes); @@ -5722,7 +5722,7 @@ static void CanvasLostSelection( ClientData clientData) /* Information about entry widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.selItemPtr); canvasPtr->textInfo.selItemPtr = NULL; @@ -6057,13 +6057,13 @@ TkGetStringsFromObjs( int objc, Tcl_Obj *const objv[]) { - register int i; + int i; const char **argv; if (objc <= 0) { return NULL; } - argv = ckalloc((objc+1) * sizeof(char *)); + argv = (const char **)ckalloc((objc+1) * sizeof(char *)); for (i = 0; i < objc; i++) { argv[i] = Tcl_GetString(objv[i]); } diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index 3c3d89b..10fc910 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -56,7 +56,7 @@ ClipboardHandler( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - TkClipboardTarget *targetPtr = clientData; + TkClipboardTarget *targetPtr = (TkClipboardTarget *)clientData; TkClipboardBuffer *cbPtr; char *srcPtr, *destPtr; size_t count = 0; @@ -134,7 +134,7 @@ ClipboardAppHandler( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; size_t length; const char *p; @@ -172,12 +172,16 @@ ClipboardAppHandler( static int ClipboardWindowHandler( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ int offset, /* Return selection bytes starting at this * offset. */ char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { + (void)dummy; + (void)offset; + (void)maxBytes; + buffer[0] = '.'; buffer[1] = 0; return 1; @@ -205,7 +209,7 @@ static void ClipboardLostSel( ClientData clientData) /* Pointer to TkDisplay structure. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; dispPtr->clipboardActive = 0; } @@ -358,7 +362,7 @@ Tk_ClipboardAppend( } } if (targetPtr == NULL) { - targetPtr = ckalloc(sizeof(TkClipboardTarget)); + targetPtr = (TkClipboardTarget *)ckalloc(sizeof(TkClipboardTarget)); targetPtr->type = type; targetPtr->format = format; targetPtr->firstBufferPtr = targetPtr->lastBufferPtr = NULL; @@ -380,7 +384,7 @@ Tk_ClipboardAppend( * Append a new buffer to the buffer chain. */ - cbPtr = ckalloc(sizeof(TkClipboardBuffer)); + cbPtr = (TkClipboardBuffer *)ckalloc(sizeof(TkClipboardBuffer)); cbPtr->nextPtr = NULL; if (targetPtr->lastBufferPtr != NULL) { targetPtr->lastBufferPtr->nextPtr = cbPtr; @@ -390,7 +394,7 @@ Tk_ClipboardAppend( targetPtr->lastBufferPtr = cbPtr; cbPtr->length = strlen(buffer); - cbPtr->buffer = ckalloc(cbPtr->length + 1); + cbPtr->buffer = (char *)ckalloc(cbPtr->length + 1); strcpy(cbPtr->buffer, buffer); TkSelUpdateClipboard((TkWindow *) dispPtr->clipWindow, targetPtr); @@ -422,7 +426,7 @@ Tk_ClipboardObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; const char *path = NULL; Atom selection; static const char *const optionStrings[] = { "append", "clear", "get", NULL }; @@ -636,10 +640,11 @@ Tk_ClipboardObjCmd( int TkClipInit( - Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - register TkDisplay *dispPtr)/* Display to initialize. */ + Tcl_Interp *dummy, /* Interpreter to use for error reporting. */ + TkDisplay *dispPtr)/* Display to initialize. */ { XSetWindowAttributes atts; + (void)dummy; dispPtr->clipTargetPtr = NULL; dispPtr->clipboardActive = 0; @@ -705,11 +710,13 @@ static int ClipboardGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ - Tcl_Interp *interp, /* Interpreter used for error reporting (not + Tcl_Interp *dummy, /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { - Tcl_DStringAppend(clientData, portion, -1); + (void)dummy; + + Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1); return TCL_OK; } diff --git a/generic/tkCmds.c b/generic/tkCmds.c index d7f742a..2c0eadb 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -99,7 +99,7 @@ Tk_BellObjCmd( "-displayof", "-nice", NULL }; enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE }; - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int i, index, nice = 0; Tk_ErrorHandler handler; @@ -163,7 +163,7 @@ Tk_BindObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr; ClientData object; const char *string; @@ -187,7 +187,7 @@ Tk_BindObjCmd( } object = (ClientData) winPtr->pathName; } else { - winPtr = clientData; + winPtr = (TkWindow *)clientData; object = (ClientData) Tk_GetUid(string); } @@ -285,10 +285,10 @@ TkBindEventProc( */ if (winPtr->numTags > MAX_OBJS) { - objPtr = ckalloc(winPtr->numTags * sizeof(ClientData)); + objPtr = (void **)ckalloc(winPtr->numTags * sizeof(void *)); } for (i = 0; i < winPtr->numTags; i++) { - p = winPtr->tagPtr[i]; + p = (const char *)winPtr->tagPtr[i]; if (*p == '.') { hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, p); if (hPtr != NULL) { @@ -347,7 +347,7 @@ Tk_BindtagsObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr, *winPtr2; int i, length; const char *p; @@ -399,7 +399,7 @@ Tk_BindtagsObjCmd( } winPtr->numTags = length; - winPtr->tagPtr = ckalloc(length * sizeof(ClientData)); + winPtr->tagPtr = (void **)ckalloc(length * sizeof(void *)); for (i = 0; i < length; i++) { p = Tcl_GetString(tags[i]); if (p[0] == '.') { @@ -412,7 +412,7 @@ Tk_BindtagsObjCmd( * is one. */ - copy = ckalloc(strlen(p) + 1); + copy = (char *)ckalloc(strlen(p) + 1); strcpy(copy, p); winPtr->tagPtr[i] = (ClientData) copy; } else { @@ -448,7 +448,7 @@ TkFreeBindingTags( const char *p; for (i = 0; i < winPtr->numTags; i++) { - p = winPtr->tagPtr[i]; + p = (const char *)winPtr->tagPtr[i]; if (*p == '.') { /* * Names starting with "." are malloced rather than Uids, so they @@ -488,7 +488,7 @@ Tk_DestroyObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window window; - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int i; for (i = 1; i < objc; i++) { @@ -535,7 +535,7 @@ Tk_LowerObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window mainwin = clientData; + Tk_Window mainwin = (Tk_Window)clientData; Tk_Window tkwin, other; if ((objc != 2) && (objc != 3)) { @@ -595,7 +595,7 @@ Tk_RaiseObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window mainwin = clientData; + Tk_Window mainwin = (Tk_Window)clientData; Tk_Window tkwin, other; if ((objc != 2) && (objc != 3)) { @@ -683,7 +683,7 @@ AppnameCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr; const char *string; @@ -715,7 +715,7 @@ CaretCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int index; Tcl_Obj *objPtr; TkCaret *caretPtr; @@ -807,7 +807,7 @@ ScalingCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; Screen *screenPtr; int skip, width, height; double d; @@ -858,7 +858,7 @@ UseinputmethodsCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkDisplay *dispPtr; int skip; @@ -899,12 +899,13 @@ UseinputmethodsCmd( int WindowingsystemCmd( - ClientData clientData, /* Main window associated with interpreter. */ + ClientData dummy, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *windowingsystem; + (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -928,7 +929,7 @@ InactiveCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin); if (skip < 0) { @@ -992,7 +993,7 @@ Tk_TkwaitObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int done, index; int code = TCL_OK; static const char *const optionStrings[] = { @@ -1117,12 +1118,16 @@ Tk_TkwaitObjCmd( static char * WaitVariableProc( ClientData clientData, /* Pointer to integer to set to 1. */ - Tcl_Interp *interp, /* Interpreter containing variable. */ + Tcl_Interp *dummy, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - int *donePtr = clientData; + int *donePtr = (int *)clientData; + (void)dummy; + (void)name1; + (void)name2; + (void)flags; *donePtr = 1; return NULL; @@ -1134,7 +1139,7 @@ WaitVisibilityProc( ClientData clientData, /* Pointer to integer to set to 1. */ XEvent *eventPtr) /* Information about event (not used). */ { - int *donePtr = clientData; + int *donePtr = (int *)clientData; if (eventPtr->type == VisibilityNotify) { *donePtr = 1; @@ -1148,7 +1153,7 @@ WaitWindowProc( ClientData clientData, /* Pointer to integer to set to 1. */ XEvent *eventPtr) /* Information about event. */ { - int *donePtr = clientData; + int *donePtr = (int *)clientData; if (eventPtr->type == DestroyNotify) { *donePtr = 1; @@ -1175,7 +1180,7 @@ WaitWindowProc( /* ARGSUSED */ int Tk_UpdateObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + ClientData dummy, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1184,6 +1189,7 @@ Tk_UpdateObjCmd( int flags, index; TkDisplay *dispPtr; int code = TCL_OK; + (void)dummy; if (objc == 1) { flags = TCL_DONT_WAIT; @@ -1281,7 +1287,7 @@ Tk_WinfoObjCmd( int index, x, y, width, height, useX, useY, c_class, skip; const char *string; TkWindow *winPtr; - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const TkStateMap visualMap[] = { {PseudoColor, "pseudocolor"}, @@ -1751,7 +1757,7 @@ Tk_WinfoObjCmd( break; } case WIN_VISUALSAVAILABLE: { - XVisualInfo template, *visInfoPtr; + XVisualInfo templ, *visInfoPtr; int count, i; int includeVisualId; Tcl_Obj *strPtr, *resultPtr; @@ -1772,9 +1778,9 @@ Tk_WinfoObjCmd( return TCL_ERROR; } - template.screen = Tk_ScreenNumber(tkwin); + templ.screen = Tk_ScreenNumber(tkwin); visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), VisualScreenMask, - &template, &count); + &templ, &count); if (visInfoPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't find any visuals for screen", -1)); @@ -1891,11 +1897,14 @@ TkGetDisplayOf( /* ARGSUSED */ int TkDeadAppObjCmd( - ClientData clientData, /* Dummy. */ + ClientData dummy, /* Dummy. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { + (void)dummy; + (void)objc; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't invoke \"%s\" command: application has been destroyed", Tcl_GetString(objv[0]))); diff --git a/generic/tkColor.c b/generic/tkColor.c index 2f51b27..cf5c5f6 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -128,7 +128,7 @@ Tk_AllocColorFromObj( */ if (tkColPtr != NULL) { - TkColor *firstColorPtr = Tcl_GetHashValue(tkColPtr->hashPtr); + TkColor *firstColorPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr); FreeColorObj(objPtr); for (tkColPtr = firstColorPtr; tkColPtr != NULL; @@ -203,7 +203,7 @@ Tk_GetColor( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew); if (!isNew) { - existingColPtr = Tcl_GetHashValue(nameHashPtr); + existingColPtr = (TkColor *)Tcl_GetHashValue(nameHashPtr); for (tkColPtr = existingColPtr; tkColPtr != NULL; tkColPtr = tkColPtr->nextPtr) { if ((tkColPtr->screen == Tk_Screen(tkwin)) @@ -314,7 +314,7 @@ Tk_GetColorByValue( valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable, (char *) &valueKey, &isNew); if (!isNew) { - tkColPtr = Tcl_GetHashValue(valueHashPtr); + tkColPtr = (TkColor *)Tcl_GetHashValue(valueHashPtr); tkColPtr->resourceRefCount++; return &tkColPtr->color; } @@ -363,12 +363,12 @@ const char * Tk_NameOfColor( XColor *colorPtr) /* Color whose name is desired. */ { - register TkColor *tkColPtr = (TkColor *) colorPtr; + TkColor *tkColPtr = (TkColor *) colorPtr; if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) { return tkColPtr->hashPtr->key.string; } else { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red, @@ -496,7 +496,7 @@ Tk_FreeColor( } TkpFreeColor(tkColPtr); - prevPtr = Tcl_GetHashValue(tkColPtr->hashPtr); + prevPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr); if (prevPtr == tkColPtr) { if (tkColPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(tkColPtr->hashPtr); @@ -583,7 +583,7 @@ static void FreeColorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkColor *tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1; if (tkColPtr != NULL) { if ((tkColPtr->objRefCount-- <= 1) @@ -617,7 +617,7 @@ DupColorObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkColor *tkColPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkColor *tkColPtr = (TkColor *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = tkColPtr; @@ -667,7 +667,7 @@ Tk_GetColorFromObj( * map. If it is, we are done. */ - tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; + tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1; if ((tkColPtr != NULL) && (tkColPtr->resourceRefCount > 0) && (Tk_Screen(tkwin) == tkColPtr->screen) @@ -693,7 +693,7 @@ Tk_GetColorFromObj( if (hashPtr == NULL) { goto error; } - for (tkColPtr = Tcl_GetHashValue(hashPtr); + for (tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr); (tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) { if ((Tk_Screen(tkwin) == tkColPtr->screen) && (Tk_Colormap(tkwin) == tkColPtr->colormap)) { @@ -809,7 +809,7 @@ TkDebugColor( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, name); if (hashPtr != NULL) { - TkColor *tkColPtr = Tcl_GetHashValue(hashPtr); + TkColor *tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr); if (tkColPtr == NULL) { Tcl_Panic("TkDebugColor found empty hash table entry"); diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 461be56..e527eaa 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -178,7 +178,7 @@ Tk_CreateOptionTable( const Tk_OptionSpec *specPtr, *specPtr2; Option *optionPtr; size_t numOptions, i; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -202,7 +202,7 @@ Tk_CreateOptionTable( hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->hashTable, (char *) templatePtr, &newEntry); if (!newEntry) { - tablePtr = Tcl_GetHashValue(hashEntryPtr); + tablePtr = (OptionTable *)Tcl_GetHashValue(hashEntryPtr); tablePtr->refCount++; return (Tk_OptionTable) tablePtr; } @@ -216,7 +216,7 @@ Tk_CreateOptionTable( for (specPtr = templatePtr; specPtr->type != TK_OPTION_END; specPtr++) { numOptions++; } - tablePtr = ckalloc(sizeof(OptionTable) + (numOptions * sizeof(Option))); + tablePtr = (OptionTable *)ckalloc(sizeof(OptionTable) + (numOptions * sizeof(Option))); tablePtr->refCount = 1; tablePtr->hashEntryPtr = hashEntryPtr; tablePtr->nextPtr = NULL; @@ -266,7 +266,7 @@ Tk_CreateOptionTable( || (specPtr->type == TK_OPTION_BORDER)) && (specPtr->clientData != NULL)) { optionPtr->extra.monoColorPtr = - Tcl_NewStringObj(specPtr->clientData, -1); + Tcl_NewStringObj((const char *)specPtr->clientData, -1); Tcl_IncrRefCount(optionPtr->extra.monoColorPtr); } @@ -275,7 +275,7 @@ Tk_CreateOptionTable( * Get the custom parsing, etc., functions. */ - optionPtr->extra.custom = specPtr->clientData; + optionPtr->extra.custom = (const Tk_ObjCustomOption *)specPtr->clientData; } } if (((specPtr->type == TK_OPTION_STRING) @@ -300,7 +300,7 @@ Tk_CreateOptionTable( if (specPtr->clientData != NULL) { tablePtr->nextPtr = (OptionTable *) - Tk_CreateOptionTable(interp, specPtr->clientData); + Tk_CreateOptionTable(interp, (Tk_OptionSpec *)specPtr->clientData); } return (Tk_OptionTable) tablePtr; @@ -664,7 +664,7 @@ DoObjConfig( if (internalPtr != NULL) { if (valuePtr != NULL) { value = TkGetStringFromObj(valuePtr, &length); - newStr = ckalloc(length + 1); + newStr = (char *)ckalloc(length + 1); strcpy(newStr, value); } else { newStr = NULL; @@ -878,7 +878,7 @@ DoObjConfig( const Tk_ObjCustomOption *custom = optionPtr->extra.custom; if (custom->setProc(custom->clientData, interp, tkwin, - &valuePtr, recordPtr, optionPtr->specPtr->internalOffset, + &valuePtr, (char *)recordPtr, optionPtr->specPtr->internalOffset, (char *)oldInternalPtr, optionPtr->specPtr->flags) != TCL_OK) { return TCL_ERROR; } @@ -1160,9 +1160,9 @@ TkGetOptionSpec( static void FreeOptionInternalRep( - register Tcl_Obj *objPtr) /* Object whose internal rep to free. */ + Tcl_Obj *objPtr) /* Object whose internal rep to free. */ { - register Tk_OptionTable tablePtr = (Tk_OptionTable) objPtr->internalRep.twoPtrValue.ptr1; + Tk_OptionTable tablePtr = (Tk_OptionTable) objPtr->internalRep.twoPtrValue.ptr1; Tk_DeleteOptionTable(tablePtr); objPtr->typePtr = NULL; @@ -1186,7 +1186,7 @@ DupOptionInternalRep( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - register OptionTable *tablePtr = (OptionTable *) srcObjPtr->internalRep.twoPtrValue.ptr1; + OptionTable *tablePtr = (OptionTable *) srcObjPtr->internalRep.twoPtrValue.ptr1; tablePtr->refCount++; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep = srcObjPtr->internalRep; @@ -1283,7 +1283,7 @@ Tk_SetOptions( * more space. */ - newSavePtr = ckalloc(sizeof(Tk_SavedOptions)); + newSavePtr = (Tk_SavedOptions *)ckalloc(sizeof(Tk_SavedOptions)); newSavePtr->recordPtr = recordPtr; newSavePtr->tkwin = tkwin; newSavePtr->numItems = 0; @@ -1395,7 +1395,7 @@ Tk_RestoreSavedOptions( = savePtr->items[i].valuePtr; } if (specPtr->internalOffset != TCL_AUTO_LENGTH) { - register char *ptr = (char *) &savePtr->items[i].internalForm; + char *ptr = (char *) &savePtr->items[i].internalForm; CLANG_ASSERT(internalPtr); switch (specPtr->type) { @@ -1453,7 +1453,7 @@ Tk_RestoreSavedOptions( if (custom->restoreProc != NULL) { custom->restoreProc(custom->clientData, savePtr->tkwin, - internalPtr, ptr); + (char *)internalPtr, ptr); } break; } @@ -1674,7 +1674,7 @@ FreeResources( case TK_OPTION_CUSTOM: { const Tk_ObjCustomOption *custom = optionPtr->extra.custom; if (internalFormExists && custom->freeProc != NULL) { - custom->freeProc(custom->clientData, tkwin, internalPtr); + custom->freeProc(custom->clientData, tkwin, (char *)internalPtr); } break; } @@ -1964,7 +1964,7 @@ GetObjectForOption( case TK_OPTION_CUSTOM: { const Tk_ObjCustomOption *custom = optionPtr->extra.custom; - objPtr = custom->getProc(custom->clientData, tkwin, recordPtr, + objPtr = custom->getProc(custom->clientData, tkwin, (char *)recordPtr, optionPtr->specPtr->internalOffset); break; } @@ -2061,7 +2061,7 @@ Tk_GetOptionValue( Tcl_Obj * TkDebugConfig( - Tcl_Interp *interp, /* Interpreter in which the table is + Tcl_Interp *dummy, /* Interpreter in which the table is * defined. */ Tk_OptionTable table) /* Table about which information is to be * returned. May not necessarily exist in the @@ -2071,8 +2071,9 @@ TkDebugConfig( Tcl_HashEntry *hashEntryPtr; Tcl_HashSearch search; Tcl_Obj *objPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; objPtr = Tcl_NewObj(); if (!tablePtr || !tsdPtr->initialized) { diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 6bdfa9d..98f018a 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -100,7 +100,7 @@ Tk_AllocCursorFromObj( if (objPtr->typePtr != &tkCursorObjType) { InitCursorObj(objPtr); } - cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkCursor, see if it's the one we @@ -129,7 +129,7 @@ Tk_AllocCursorFromObj( */ if (cursorPtr != NULL) { - TkCursor *firstCursorPtr = Tcl_GetHashValue(cursorPtr->hashPtr); + TkCursor *firstCursorPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr); FreeCursorObj(objPtr); for (cursorPtr = firstCursorPtr; cursorPtr != NULL; @@ -229,7 +229,7 @@ TkcGetCursor( * details on legal syntax. */ { Tcl_HashEntry *nameHashPtr; - register TkCursor *cursorPtr; + TkCursor *cursorPtr; TkCursor *existingCursorPtr = NULL; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -241,7 +241,7 @@ TkcGetCursor( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable, string, &isNew); if (!isNew) { - existingCursorPtr = Tcl_GetHashValue(nameHashPtr); + existingCursorPtr = (TkCursor *)Tcl_GetHashValue(nameHashPtr); for (cursorPtr = existingCursorPtr; cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { @@ -320,7 +320,7 @@ Tk_GetCursorFromData( { DataKey dataKey; Tcl_HashEntry *dataHashPtr; - register TkCursor *cursorPtr; + TkCursor *cursorPtr; int isNew; XColor fgColor, bgColor; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -341,7 +341,7 @@ Tk_GetCursorFromData( dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable, (char *) &dataKey, &isNew); if (!isNew) { - cursorPtr = Tcl_GetHashValue(dataHashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(dataHashPtr); cursorPtr->resourceRefCount++; return cursorPtr->cursor; } @@ -432,7 +432,7 @@ Tk_NameOfCursor( if (idHashPtr == NULL) { goto printid; } - cursorPtr = Tcl_GetHashValue(idHashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(idHashPtr); if (cursorPtr->otherTable != &dispPtr->cursorNameTable) { goto printid; } @@ -468,7 +468,7 @@ FreeCursor( } Tcl_DeleteHashEntry(cursorPtr->idHashPtr); - prevPtr = Tcl_GetHashValue(cursorPtr->hashPtr); + prevPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr); if (prevPtr == cursorPtr) { if (cursorPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(cursorPtr->hashPtr); @@ -521,7 +521,7 @@ Tk_FreeCursor( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeCursor received unknown cursor argument"); } - FreeCursor(Tcl_GetHashValue(idHashPtr)); + FreeCursor((TkCursor *)Tcl_GetHashValue(idHashPtr)); } /* @@ -586,7 +586,7 @@ static void FreeCursorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkCursor *cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; if (cursorPtr != NULL) { if ((cursorPtr->objRefCount-- <= 1) @@ -620,7 +620,7 @@ DupCursorObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkCursor *cursorPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkCursor *cursorPtr = (TkCursor *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = cursorPtr; @@ -705,7 +705,7 @@ GetCursorFromObj( * cached is the one that is needed. */ - cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) { return cursorPtr; } @@ -720,7 +720,7 @@ GetCursorFromObj( if (hashPtr == NULL) { goto error; } - for (cursorPtr = Tcl_GetHashValue(hashPtr); + for (cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr); cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { FreeCursorObj(objPtr); @@ -855,7 +855,7 @@ TkDebugCursor( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable, name); if (hashPtr != NULL) { - cursorPtr = Tcl_GetHashValue(hashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr); if (cursorPtr == NULL) { Tcl_Panic("TkDebugCursor found empty hash table entry"); } diff --git a/generic/tkDList.h b/generic/tkDList.h index 2448439..1654497 100644 --- a/generic/tkDList.h +++ b/generic/tkDList.h @@ -361,9 +361,9 @@ LT##_Prepend(LT *head, struct ElemType *elem) \ { \ assert(head); \ assert(elem); \ - elem->_dl_.prev = (void *) head; \ + elem->_dl_.prev = (PSEntry *) head; \ if (!head->first) { \ - elem->_dl_.next = (void *) head; \ + elem->_dl_.next = (PSEntry *) head; \ head->last = elem; \ } else { \ elem->_dl_.next = head->first; \ @@ -378,9 +378,9 @@ LT##_Append(LT *head, struct ElemType *elem) \ { \ assert(head); \ assert(elem); \ - elem->_dl_.next = (void *) head; \ + elem->_dl_.next = (PSEntry *) head; \ if (!head->first) { \ - elem->_dl_.prev = (void *) head; \ + elem->_dl_.prev = (PSEntry *) head; \ head->first = elem; \ } else { \ elem->_dl_.prev = head->last; \ @@ -402,9 +402,9 @@ LT##_Move(LT *dst, LT *src) \ dst->last = src->last; \ } else { \ *dst = *src; \ - dst->first->_dl_.prev = (void *) dst; \ + dst->first->_dl_.prev = (PSEntry *) dst; \ } \ - dst->last->_dl_.next = (void *) dst; \ + dst->last->_dl_.next = (PSEntry *) dst; \ LT##_Init(src); \ } \ } \ @@ -528,11 +528,11 @@ LT##_Traverse(LT *head, LT##_Func func) \ #define TK_DLIST_FOREACH(var, head) \ assert(head); \ - for (var = head->first ? head->first : (void *) head; var != (void *) head; var = var->_dl_.next) + for (var = head->first ? head->first : (PSEntry *) head; var != (PSEntry *) head; var = var->_dl_.next) #define TK_DLIST_FOREACH_REVERSE(var, head) \ assert(head); \ - for (var = head->last ? head->last : (void *) head; var != (void *) head; var = var->_dl_.prev) + for (var = head->last ? head->last : (PSEntry *) head; var != (PSEntry *) head; var = var->_dl_.prev) #endif /* TK_DLIST_DEFINED */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 9ae3a03..b36a163 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -484,15 +484,16 @@ static const Tk_ClassProcs entryClass = { int Tk_EntryObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Entry *entryPtr; + Entry *entryPtr; Tk_OptionTable optionTable; Tk_Window tkwin; char *tmp; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -519,7 +520,7 @@ Tk_EntryObjCmd( * initialized as memset covers the rest. */ - entryPtr = ckalloc(sizeof(Entry)); + entryPtr = (Entry *)ckalloc(sizeof(Entry)); memset(entryPtr, 0, sizeof(Entry)); entryPtr->tkwin = tkwin; @@ -530,7 +531,7 @@ Tk_EntryObjCmd( EntryCmdDeletedProc); entryPtr->optionTable = optionTable; entryPtr->type = TK_ENTRY; - tmp = ckalloc(1); + tmp = (char *)ckalloc(1); tmp[0] = '\0'; entryPtr->string = tmp; entryPtr->selectFirst = -1; @@ -602,7 +603,7 @@ EntryWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; int cmdIndex, selIndex, result; Tcl_Obj *objPtr; @@ -1033,7 +1034,7 @@ static void DestroyEntry( void *memPtr) /* Info about entry widget. */ { - Entry *entryPtr = memPtr; + Entry *entryPtr = (Entry *)memPtr; /* * Free up all the stuff that requires special handling, then let @@ -1236,7 +1237,7 @@ ConfigureEntry( if (formatSpace < TCL_DOUBLE_SPACE) { formatSpace = TCL_DOUBLE_SPACE; } - sbPtr->formatBuf = ckrealloc(sbPtr->formatBuf, formatSpace); + sbPtr->formatBuf = (char *)ckrealloc(sbPtr->formatBuf, formatSpace); /* * We perturb the value of oldFrom to allow us to go into the @@ -1450,7 +1451,7 @@ EntryWorldChanged( unsigned long mask; Tk_3DBorder border; XColor *colorPtr; - Entry *entryPtr = instanceData; + Entry *entryPtr = (Entry *)instanceData; entryPtr->avgWidth = Tk_TextWidth(entryPtr->tkfont, "0", 1); if (entryPtr->avgWidth == 0) { @@ -1560,6 +1561,10 @@ TkpDrawEntryBorderAndFocus( Drawable pixmap, int isSpinbox) { + (void)entryPtr; + (void)pixmap; + (void)isSpinbox; + return 0; } @@ -1586,6 +1591,9 @@ TkpDrawSpinboxButtons( Spinbox *sbPtr, Pixmap pixmap) { + (void)sbPtr; + (void)pixmap; + return 0; } #endif /* Not MAC_OSX_TK */ @@ -1610,7 +1618,7 @@ static void DisplayEntry( ClientData clientData) /* Information about window. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; Tk_Window tkwin = entryPtr->tkwin; int baseY, selStartX, selEndX, cursorX; int showSelection, xBound; @@ -1971,7 +1979,7 @@ EntryComputeGeometry( size = TkUniCharToUtf(ch, buf); entryPtr->numDisplayBytes = entryPtr->numChars * size; - p = ckalloc(entryPtr->numDisplayBytes + 1); + p = (char *)ckalloc(entryPtr->numDisplayBytes + 1); entryPtr->displayString = p; for (i = entryPtr->numChars; --i >= 0; ) { @@ -2140,7 +2148,7 @@ InsertChars( } newByteCount = entryPtr->numBytes + byteCount + 1; - newStr = ckalloc(newByteCount); + newStr = (char *)ckalloc(newByteCount); memcpy(newStr, string, byteIndex); strcpy(newStr + byteIndex, value); strcpy(newStr + byteIndex + byteCount, string + byteIndex); @@ -2241,11 +2249,11 @@ DeleteChars( byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string+byteIndex); newByteCount = entryPtr->numBytes + 1 - byteCount; - newStr = ckalloc(newByteCount); + newStr = (char *)ckalloc(newByteCount); memcpy(newStr, string, (size_t) byteIndex); strcpy(newStr + byteIndex, string + byteIndex + byteCount); - toDelete = ckalloc(byteCount + 1); + toDelete = (char *)ckalloc(byteCount + 1); memcpy(toDelete, string + byteIndex, (size_t) byteCount); toDelete[byteCount] = '\0'; @@ -2431,7 +2439,7 @@ EntrySetValue( * during validation */ - char *tmp = ckalloc(valueLen + 1); + char *tmp = (char *)ckalloc(valueLen + 1); strcpy(tmp, value); value = tmp; @@ -2460,7 +2468,7 @@ EntrySetValue( if (malloced) { entryPtr->string = value; } else { - char *tmp = ckalloc(valueLen + 1); + char *tmp = (char *)ckalloc(valueLen + 1); strcpy(tmp, value); entryPtr->string = tmp; @@ -2520,10 +2528,10 @@ EntryEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; if ((entryPtr->type == TK_SPINBOX) && (eventPtr->type == MotionNotify)) { - Spinbox *sbPtr = clientData; + Spinbox *sbPtr = (Spinbox *)clientData; int elem; elem = GetSpinboxElement(sbPtr, eventPtr->xmotion.x, @@ -2601,7 +2609,7 @@ static void EntryCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; /* * This function could be invoked either because the window was destroyed @@ -2890,7 +2898,7 @@ EntryFetchSelection( int maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NUL character. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; int byteCount; const char *string; const char *selStart, *selEnd; @@ -2937,7 +2945,7 @@ static void EntryLostSelection( ClientData clientData) /* Information about entry widget. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; entryPtr->flags &= ~GOT_SELECTION; @@ -3124,7 +3132,7 @@ static void EntryBlinkProc( ClientData clientData) /* Pointer to record describing entry. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; if ((entryPtr->state == STATE_DISABLED) || (entryPtr->state == STATE_READONLY) || @@ -3219,8 +3227,10 @@ EntryTextVarProc( const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; const char *value; + (void)name1; + (void)name2; if (entryPtr->flags & ENTRY_DELETED) { /* @@ -3302,12 +3312,12 @@ EntryTextVarProc( static int EntryValidate( - register Entry *entryPtr, /* Entry that needs validation. */ - register char *cmd) /* Validation command (NULL-terminated + Entry *entryPtr, /* Entry that needs validation. */ + char *cmd) /* Validation command (NULL-terminated * string). */ { - register Tcl_Interp *interp = entryPtr->interp; - int code, bool; + Tcl_Interp *interp = entryPtr->interp; + int code, result; code = Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT); @@ -3329,7 +3339,7 @@ EntryValidate( */ if (Tcl_GetBooleanFromObj(interp, Tcl_GetObjResult(interp), - &bool) != TCL_OK) { + &result) != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (invalid boolean result from validation command)"); Tcl_BackgroundException(interp, TCL_ERROR); @@ -3338,7 +3348,7 @@ EntryValidate( } Tcl_ResetResult(interp); - return (bool ? TCL_OK : TCL_BREAK); + return (result ? TCL_OK : TCL_BREAK); } /* @@ -3362,7 +3372,7 @@ EntryValidate( static int EntryValidateChange( - register Entry *entryPtr, /* Entry that needs validation. */ + Entry *entryPtr, /* Entry that needs validation. */ const char *change, /* Characters to be added/deleted * (NUL-terminated string). */ const char *newValue, /* Potential new value of entry string */ @@ -3501,8 +3511,8 @@ EntryValidateChange( static void ExpandPercents( - register Entry *entryPtr, /* Entry that needs validation. */ - register const char *before, + Entry *entryPtr, /* Entry that needs validation. */ + const char *before, /* Command containing percent expressions to * be replaced. */ const char *change, /* Characters to added/deleted (NUL-terminated @@ -3516,7 +3526,7 @@ ExpandPercents( int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl * list element. */ int number, length; - register const char *string; + const char *string; int ch; char numStorage[2*TCL_INTEGER_SPACE]; @@ -3666,16 +3676,17 @@ ExpandPercents( int Tk_SpinboxObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Entry *entryPtr; - register Spinbox *sbPtr; + Entry *entryPtr; + Spinbox *sbPtr; Tk_OptionTable optionTable; Tk_Window tkwin; char *tmp; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -3702,7 +3713,7 @@ Tk_SpinboxObjCmd( * initialized as memset covers the rest. */ - sbPtr = ckalloc(sizeof(Spinbox)); + sbPtr = (Spinbox *)ckalloc(sizeof(Spinbox)); entryPtr = (Entry *) sbPtr; memset(sbPtr, 0, sizeof(Spinbox)); @@ -3714,7 +3725,7 @@ Tk_SpinboxObjCmd( EntryCmdDeletedProc); entryPtr->optionTable = optionTable; entryPtr->type = TK_SPINBOX; - tmp = ckalloc(1); + tmp = (char *)ckalloc(1); tmp[0] = '\0'; entryPtr->string = tmp; entryPtr->selectFirst = -1; @@ -3741,7 +3752,7 @@ Tk_SpinboxObjCmd( sbPtr->fromValue = 0.0; sbPtr->toValue = 100.0; sbPtr->increment = 1.0; - sbPtr->formatBuf = ckalloc(TCL_DOUBLE_SPACE); + sbPtr->formatBuf = (char *)ckalloc(TCL_DOUBLE_SPACE); sbPtr->bdRelief = TK_RELIEF_FLAT; sbPtr->buRelief = TK_RELIEF_FLAT; @@ -3804,8 +3815,8 @@ SpinboxWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Entry *entryPtr = clientData; - Spinbox *sbPtr = clientData; + Entry *entryPtr = (Entry *)clientData; + Spinbox *sbPtr = (Spinbox *)clientData; int cmdIndex, selIndex, result; Tcl_Obj *objPtr; @@ -4351,8 +4362,8 @@ GetSpinboxElement( static int SpinboxInvoke( - register Tcl_Interp *interp,/* Current interpreter. */ - register Spinbox *sbPtr, /* Spinbox to invoke. */ + Tcl_Interp *interp,/* Current interpreter. */ + Spinbox *sbPtr, /* Spinbox to invoke. */ int element) /* Element to invoke, either the "up" or * "down" button. */ { diff --git a/generic/tkError.c b/generic/tkError.c index 5aa6d88..938afc3 100644 --- a/generic/tkError.c +++ b/generic/tkError.c @@ -107,7 +107,7 @@ Tk_CreateErrorHandler( * Create the handler record. */ - errorPtr = ckalloc(sizeof(TkErrorHandler)); + errorPtr = (TkErrorHandler *)ckalloc(sizeof(TkErrorHandler)); errorPtr->dispPtr = dispPtr; errorPtr->firstRequest = NextRequest(display); errorPtr->lastRequest = (unsigned) -1; diff --git a/generic/tkEvent.c b/generic/tkEvent.c index ef6393a..b26c8bb 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -695,8 +695,8 @@ Tk_CreateEventHandler( Tk_EventProc *proc, /* Function to call for each selected event */ ClientData clientData) /* Arbitrary data to pass to proc. */ { - register TkEventHandler *handlerPtr; - register TkWindow *winPtr = (TkWindow *) token; + TkEventHandler *handlerPtr; + TkWindow *winPtr = (TkWindow *) token; /* * Skim through the list of existing handlers to (a) compute the overall @@ -711,7 +711,7 @@ Tk_CreateEventHandler( * No event handlers defined at all, so must create. */ - handlerPtr = ckalloc(sizeof(TkEventHandler)); + handlerPtr = (TkEventHandler *)ckalloc(sizeof(TkEventHandler)); winPtr->handlerList = handlerPtr; } else { int found = 0; @@ -742,7 +742,7 @@ Tk_CreateEventHandler( * No event handler matched, so create a new one. */ - handlerPtr->nextPtr = ckalloc(sizeof(TkEventHandler)); + handlerPtr->nextPtr = (TkEventHandler *)ckalloc(sizeof(TkEventHandler)); handlerPtr = handlerPtr->nextPtr; } @@ -785,11 +785,11 @@ Tk_DeleteEventHandler( Tk_EventProc *proc, ClientData clientData) { - register TkEventHandler *handlerPtr; - register InProgress *ipPtr; + TkEventHandler *handlerPtr; + InProgress *ipPtr; TkEventHandler *prevPtr; - register TkWindow *winPtr = (TkWindow *) token; - ThreadSpecificData *tsdPtr = + TkWindow *winPtr = (TkWindow *) token; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -861,10 +861,10 @@ Tk_CreateGenericHandler( ClientData clientData) /* One-word value to pass to proc. */ { GenericHandler *handlerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - handlerPtr = ckalloc(sizeof(GenericHandler)); + handlerPtr = (GenericHandler *)ckalloc(sizeof(GenericHandler)); handlerPtr->proc = proc; handlerPtr->clientData = clientData; @@ -902,7 +902,7 @@ Tk_DeleteGenericHandler( ClientData clientData) { GenericHandler * handler; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (handler=tsdPtr->genericList ; handler ; handler=handler->nextPtr) { @@ -935,7 +935,7 @@ Tk_CreateClientMessageHandler( Tk_ClientMessageProc *proc) /* Function to call on event. */ { GenericHandler *handlerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -943,7 +943,7 @@ Tk_CreateClientMessageHandler( * with an extra clientData field we'll never use. */ - handlerPtr = ckalloc(sizeof(GenericHandler)); + handlerPtr = (GenericHandler *)ckalloc(sizeof(GenericHandler)); handlerPtr->proc = (Tk_GenericProc *) proc; handlerPtr->clientData = NULL; /* never used */ @@ -981,7 +981,7 @@ Tk_DeleteClientMessageHandler( Tk_ClientMessageProc *proc) { GenericHandler * handler; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (handler=tsdPtr->cmList ; handler!=NULL ; handler=handler->nextPtr) { @@ -1012,7 +1012,7 @@ Tk_DeleteClientMessageHandler( void TkEventInit(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->handlersActive = 0; @@ -1047,7 +1047,8 @@ TkXErrorHandler( ClientData clientData, /* Pointer to flag we set. */ XErrorEvent *errEventPtr) /* X error info. */ { - int *error = clientData; + int *error = (int *)clientData; + (void)errEventPtr; *error = 1; return 0; @@ -1134,12 +1135,12 @@ void Tk_HandleEvent( XEvent *eventPtr) /* Event to dispatch. */ { - register TkEventHandler *handlerPtr; + TkEventHandler *handlerPtr; TkWindow *winPtr; unsigned long mask; InProgress ip; Tcl_Interp *interp = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1337,9 +1338,9 @@ TkEventDeadWindow( TkWindow *winPtr) /* Information about the window that is being * deleted. */ { - register TkEventHandler *handlerPtr; - register InProgress *ipPtr; - ThreadSpecificData *tsdPtr = + TkEventHandler *handlerPtr; + InProgress *ipPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1387,8 +1388,8 @@ Time TkCurrentTime( TkDisplay *dispPtr) /* Display for which the time is desired. */ { - register XEvent *eventPtr; - ThreadSpecificData *tsdPtr = + XEvent *eventPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->pendingPtr == NULL) { @@ -1442,7 +1443,7 @@ Tk_RestrictEvents( * argument. */ { Tk_RestrictProc *prev; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); prev = tsdPtr->restrictProc; @@ -1535,7 +1536,7 @@ Tk_QueueWindowEvent( */ if (!(dispPtr->flags & TK_DISPLAY_COLLAPSE_MOTION_EVENTS)) { - wevPtr = ckalloc(sizeof(TkWindowEvent)); + wevPtr = (TkWindowEvent *)ckalloc(sizeof(TkWindowEvent)); wevPtr->header.proc = WindowEventProc; wevPtr->event = *eventPtr; Tcl_QueueEvent(&wevPtr->header, position); @@ -1567,7 +1568,7 @@ Tk_QueueWindowEvent( } } - wevPtr = ckalloc(sizeof(TkWindowEvent)); + wevPtr = (TkWindowEvent *)ckalloc(sizeof(TkWindowEvent)); wevPtr->header.proc = WindowEventProc; wevPtr->event = *eventPtr; if ((eventPtr->type == MotionNotify) && (position == TCL_QUEUE_TAIL)) { @@ -1657,7 +1658,7 @@ WindowEventProc( { TkWindowEvent *wevPtr = (TkWindowEvent *) evPtr; Tk_RestrictAction result; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!(flags & TCL_WINDOW_EVENTS)) { @@ -1756,7 +1757,7 @@ DelayedMotionProc( ClientData clientData) /* Pointer to display containing a delayed * motion event to be serviced. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; if (dispPtr->delayedMotionPtr == NULL) { Tcl_Panic("DelayedMotionProc found no delayed mouse motion event"); @@ -1788,7 +1789,7 @@ TkCreateExitHandler( { ExitHandler *exitPtr; - exitPtr = ckalloc(sizeof(ExitHandler)); + exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; Tcl_MutexLock(&exitMutex); @@ -1884,10 +1885,10 @@ TkCreateThreadExitHandler( ClientData clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - exitPtr = ckalloc(sizeof(ExitHandler)); + exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; @@ -1925,7 +1926,7 @@ TkDeleteThreadExitHandler( ClientData clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr, *prevPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (prevPtr = NULL, exitPtr = tsdPtr->firstExitPtr; exitPtr != NULL; @@ -1964,9 +1965,10 @@ TkDeleteThreadExitHandler( void TkFinalize( - ClientData clientData) /* Arbitrary value to pass to proc. */ + ClientData dummy) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; + (void)dummy; #if defined(_WIN32) && !defined(STATIC_BUILD) if (!tclStubsPtr) { @@ -2016,11 +2018,12 @@ TkFinalize( void TkFinalizeThread( - ClientData clientData) /* Arbitrary value to pass to proc. */ + ClientData dummy) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; Tcl_DeleteThreadExitHandler(TkFinalizeThread, NULL); diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index 561676b..038129f 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -164,7 +164,7 @@ TkFreeFileFilters( FileFilterClause *clausePtr; GlobPattern *globPtr; MacFileType *mfPtr; - register void *toFree; /* A pointer that we are about to free. */ + void *toFree; /* A pointer that we are about to free. */ for (filterPtr = flistPtr->filters; filterPtr != NULL; ) { for (clausePtr = filterPtr->clauses; clausePtr != NULL; ) { @@ -305,7 +305,7 @@ AddClause( * Add the clause into the list of clauses */ - clausePtr = ckalloc(sizeof(FileFilterClause)); + clausePtr = (FileFilterClause *)ckalloc(sizeof(FileFilterClause)); clausePtr->patterns = NULL; clausePtr->patternsTail = NULL; clausePtr->macTypes = NULL; @@ -321,7 +321,7 @@ AddClause( if (globCount > 0 && globList != NULL) { for (i=0; ipattern = ckalloc(len + 1); + globPtr->pattern = (char *)ckalloc(len + 1); globPtr->pattern[0] = '*'; strcpy(globPtr->pattern+1, str); } else if (isWindows) { if (strcmp(str, "*") == 0) { - globPtr->pattern = ckalloc(4); + globPtr->pattern = (char *)ckalloc(4); strcpy(globPtr->pattern, "*.*"); } else if (strcmp(str, "") == 0) { /* @@ -345,14 +345,14 @@ AddClause( * TODO: "*." actually matches with all files on Win95 */ - globPtr->pattern = ckalloc(3); + globPtr->pattern = (char *)ckalloc(3); strcpy(globPtr->pattern, "*."); } else { - globPtr->pattern = ckalloc(len); + globPtr->pattern = (char *)ckalloc(len); strcpy(globPtr->pattern, str); } } else { - globPtr->pattern = ckalloc(len); + globPtr->pattern = (char *)ckalloc(len); strcpy(globPtr->pattern, str); } @@ -376,7 +376,7 @@ AddClause( for (i=0; iclauses = NULL; filterPtr->clausesTail = NULL; len = strlen(name) + 1; - filterPtr->name = ckalloc(len); + filterPtr->name = (char *)ckalloc(len); memcpy(filterPtr->name, name, len); if (flistPtr->filters == NULL) { diff --git a/generic/tkFocus.c b/generic/tkFocus.c index 7b5acfb..40ef139 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -113,8 +113,8 @@ Tk_FocusObjCmd( static const char *const focusOptions[] = { "-displayof", "-force", "-lastfor", NULL }; - Tk_Window tkwin = clientData; - TkWindow *winPtr = clientData; + Tk_Window tkwin = (Tk_Window)clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *newPtr, *topLevelPtr; ToplevelFocusInfo *tlFocusPtr; const char *windowName; @@ -415,7 +415,7 @@ TkFocusFilterEvent( } } if (tlFocusPtr == NULL) { - tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + tlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); tlFocusPtr->topLevelPtr = tlFocusPtr->focusWinPtr = winPtr; tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tlFocusPtr; @@ -622,7 +622,7 @@ TkSetFocusWin( } } if (tlFocusPtr == NULL) { - tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + tlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); tlFocusPtr->topLevelPtr = topLevelPtr; tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tlFocusPtr; @@ -807,7 +807,7 @@ TkFocusKeyEvent( void TkFocusDeadWindow( - register TkWindow *winPtr) /* Information about the window that is being + TkWindow *winPtr) /* Information about the window that is being * deleted. */ { ToplevelFocusInfo *tlFocusPtr, *prevPtr; @@ -961,7 +961,7 @@ FocusMapProc( ClientData clientData, /* Toplevel window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; DisplayFocusInfo *displayFocusPtr; if (eventPtr->type == VisibilityNotify) { @@ -1015,7 +1015,7 @@ FindDisplayFocusInfo( * The record doesn't exist yet. Make a new one. */ - displayFocusPtr = ckalloc(sizeof(DisplayFocusInfo)); + displayFocusPtr = (DisplayFocusInfo *)ckalloc(sizeof(DisplayFocusInfo)); displayFocusPtr->dispPtr = dispPtr; displayFocusPtr->focusWinPtr = NULL; displayFocusPtr->focusOnMapPtr = NULL; @@ -1143,7 +1143,7 @@ TkFocusSplit( * Move focus to new toplevel. */ - ToplevelFocusInfo *newTlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + ToplevelFocusInfo *newTlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); newTlFocusPtr->topLevelPtr = winPtr; newTlFocusPtr->focusWinPtr = tlFocusPtr->focusWinPtr; diff --git a/generic/tkFont.c b/generic/tkFont.c index 44e2aad..9112784 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -379,7 +379,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); @@ -472,7 +472,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", @@ -618,7 +618,7 @@ Tk_FontObjCmd( namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string); nfPtr = NULL; /* lint. */ 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; #if defined(MAC_OSX_TK) /* @@ -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,10 +1361,11 @@ Tk_GetFontFromObj( static int SetFontFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ + Tcl_Interp *dummy, /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; + (void)dummy; /* * Free the old internalRep before setting the new one. @@ -1446,14 +1447,14 @@ 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); if ((nfPtr->refCount-- <= 1) && nfPtr->deletePending) { Tcl_DeleteHashEntry(fontPtr->namedHashPtr); ckfree(nfPtr); } } - prevPtr = Tcl_GetHashValue(fontPtr->cacheHashPtr); + prevPtr = (TkFont *)Tcl_GetHashValue(fontPtr->cacheHashPtr); if (prevPtr == fontPtr) { if (fontPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(fontPtr->cacheHashPtr); @@ -1531,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) { if ((fontPtr->objRefCount-- <= 1) && (fontPtr->resourceRefCount == 0)) { @@ -1565,7 +1566,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; @@ -2000,7 +2001,7 @@ Tk_ComputeTextLayout( maxChunks = 1; - layoutPtr = ckalloc(sizeof(TextLayout) + layoutPtr = (TextLayout *)ckalloc(sizeof(TextLayout) + (maxChunks-1) * sizeof(LayoutChunk)); layoutPtr->tkfont = tkfont; layoutPtr->string = string; @@ -3381,6 +3382,7 @@ ConfigAttributesObj( int i, n, index; Tcl_Obj *optionPtr, *valuePtr; const char *value; + (void)tkwin; for (i = 0; i < objc; i += 2) { optionPtr = objv[i]; @@ -3747,7 +3749,7 @@ NewChunk( if (layoutPtr->numChunks == maxChunks) { maxChunks *= 2; s = sizeof(TextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk)); - layoutPtr = ckrealloc(layoutPtr, s); + layoutPtr = (TextLayout *)ckrealloc(layoutPtr, s); *layoutPtrPtr = layoutPtr; *maxPtr = maxChunks; @@ -4210,7 +4212,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"); } diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 746f3eb..8c5ab4c 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -461,7 +461,7 @@ TkCreateFrame( * application. */ { int result, i; - Tcl_Obj **objv = ckalloc((argc+1) * sizeof(Tcl_Obj **)); + Tcl_Obj **objv = (Tcl_Obj **)ckalloc((argc+1) * sizeof(Tcl_Obj **)); for (i=0; itkwin = newWin; @@ -772,7 +773,7 @@ FrameWidgetObjCmd( enum options { FRAME_CGET, FRAME_CONFIGURE }; - register Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; int result = TCL_OK, index; int c, i; TkSizeT length; @@ -891,8 +892,8 @@ static void DestroyFrame( void *memPtr) /* Info about frame widget. */ { - register Frame *framePtr = memPtr; - register Labelframe *labelframePtr = memPtr; + Frame *framePtr = (Frame *)memPtr; + Labelframe *labelframePtr = (Labelframe *)memPtr; if (framePtr->type == TYPE_LABELFRAME) { Tk_FreeTextLayout(labelframePtr->textLayout); @@ -936,7 +937,7 @@ static void DestroyFramePartly( Frame *framePtr) /* Info about frame widget. */ { - register Labelframe *labelframePtr = (Labelframe *) framePtr; + Labelframe *labelframePtr = (Labelframe *) framePtr; if (framePtr->type == TYPE_LABELFRAME && labelframePtr->labelWin != NULL) { Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask, @@ -976,7 +977,7 @@ DestroyFramePartly( static int ConfigureFrame( Tcl_Interp *interp, /* Used for error reporting. */ - register Frame *framePtr, /* Information about widget; may or may not + Frame *framePtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -994,7 +995,7 @@ ConfigureFrame( if (framePtr->menuName == NULL) { oldMenuName = NULL; } else { - oldMenuName = ckalloc(strlen(framePtr->menuName) + 1); + oldMenuName = (char *)ckalloc(strlen(framePtr->menuName) + 1); strcpy(oldMenuName, framePtr->menuName); } @@ -1149,8 +1150,8 @@ static void FrameWorldChanged( ClientData instanceData) /* Information about widget. */ { - Frame *framePtr = instanceData; - Labelframe *labelframePtr = instanceData; + Frame *framePtr = (Frame *)instanceData; + Labelframe *labelframePtr = (Labelframe *)instanceData; Tk_Window tkwin = framePtr->tkwin; XGCValues gcValues; GC gc; @@ -1327,7 +1328,7 @@ FrameWorldChanged( static void ComputeFrameGeometry( - register Frame *framePtr) /* Information about widget. */ + Frame *framePtr) /* Information about widget. */ { int otherWidth, otherHeight, otherWidthT, otherHeightT, padding; int maxWidth, maxHeight; @@ -1476,8 +1477,8 @@ static void DisplayFrame( ClientData clientData) /* Information about widget. */ { - register Frame *framePtr = clientData; - register Tk_Window tkwin = framePtr->tkwin; + Frame *framePtr = (Frame *)clientData; + Tk_Window tkwin = framePtr->tkwin; int bdX1, bdY1, bdX2, bdY2, hlWidth; Pixmap pixmap; TkRegion clipRegion = NULL; @@ -1735,9 +1736,9 @@ TkpDrawFrame( static void FrameEventProc( ClientData clientData, /* Information about window. */ - register XEvent *eventPtr) /* Information about event. */ + XEvent *eventPtr) /* Information about event. */ { - register Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; @@ -1829,7 +1830,7 @@ static void FrameCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; Tk_Window tkwin = framePtr->tkwin; if (framePtr->menuName != NULL) { @@ -1880,7 +1881,7 @@ static void MapFrame( ClientData clientData) /* Pointer to frame structure. */ { - Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; /* * Wait for all other background events to be processed before mapping @@ -1935,7 +1936,7 @@ TkInstallFrameMenu( TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->mainPtr != NULL) { - Frame *framePtr = winPtr->instanceData; + Frame *framePtr = (Frame *)winPtr->instanceData; if (framePtr == NULL) { Tcl_Panic("TkInstallFrameMenu couldn't get frame pointer"); @@ -1968,7 +1969,7 @@ FrameStructureProc( ClientData clientData, /* Pointer to record describing frame. */ XEvent *eventPtr) /* Describes what just happened. */ { - Labelframe *labelframePtr = clientData; + Labelframe *labelframePtr = (Labelframe *)clientData; if (eventPtr->type == DestroyNotify) { /* @@ -2006,7 +2007,8 @@ FrameRequestProc( ClientData clientData, /* Pointer to record for frame. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; + (void)tkwin; FrameWorldChanged(framePtr); } @@ -2034,8 +2036,9 @@ FrameLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - Frame *framePtr = clientData; - Labelframe *labelframePtr = clientData; + Frame *framePtr = (Frame *)clientData; + Labelframe *labelframePtr = (Labelframe *)clientData; + (void)tkwin; /* * This should only happen in a labelframe but it doesn't hurt to be @@ -2058,7 +2061,7 @@ void TkMapTopFrame( Tk_Window tkwin) { - Frame *framePtr = ((TkWindow *) tkwin)->instanceData; + Frame *framePtr = (Frame *)((TkWindow *) tkwin)->instanceData; Tk_OptionTable optionTable; if (Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_FRAME) { @@ -2122,7 +2125,7 @@ TkToplevelWindowForCommand( if (cmdInfo.objProc != FrameWidgetObjCmd) { return NULL; } - framePtr = cmdInfo.objClientData; + framePtr = (Frame *)cmdInfo.objClientData; if (framePtr->type != TYPE_TOPLEVEL) { return NULL; } @@ -2156,7 +2159,14 @@ FrameBgImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; + /* * Changing the background image never alters the dimensions of the frame. diff --git a/generic/tkGC.c b/generic/tkGC.c index 4caa046..47931a6 100644 --- a/generic/tkGC.c +++ b/generic/tkGC.c @@ -66,17 +66,17 @@ static void GCInit(TkDisplay *dispPtr); GC Tk_GetGC( Tk_Window tkwin, /* Window in which GC will be used. */ - register unsigned long valueMask, + unsigned long valueMask, /* 1 bits correspond to values specified in * *valuesPtr; other values are set from * defaults. */ - register XGCValues *valuePtr) + XGCValues *valuePtr) /* Values are specified here for bits set in * valueMask. */ { ValueKey valueKey; Tcl_HashEntry *valueHashPtr, *idHashPtr; - register TkGC *gcPtr; + TkGC *gcPtr; int isNew; Drawable d, freeDrawable; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -218,7 +218,7 @@ Tk_GetGC( valueHashPtr = Tcl_CreateHashEntry(&dispPtr->gcValueTable, (char *) &valueKey, &isNew); if (!isNew) { - gcPtr = Tcl_GetHashValue(valueHashPtr); + gcPtr = (TkGC *)Tcl_GetHashValue(valueHashPtr); gcPtr->refCount++; return gcPtr->gc; } @@ -228,7 +228,7 @@ Tk_GetGC( * and add a new structure to the database. */ - gcPtr = ckalloc(sizeof(TkGC)); + gcPtr = (TkGC *)ckalloc(sizeof(TkGC)); /* * Find or make a drawable to use to specify the screen and depth of the @@ -291,7 +291,7 @@ Tk_FreeGC( GC gc) /* Graphics context to be released. */ { Tcl_HashEntry *idHashPtr; - register TkGC *gcPtr; + TkGC *gcPtr; TkDisplay *dispPtr = TkGetDisplay(display); if (!dispPtr->gcInit) { @@ -311,7 +311,7 @@ Tk_FreeGC( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeGC received unknown gc argument"); } - gcPtr = Tcl_GetHashValue(idHashPtr); + gcPtr = (TkGC *)Tcl_GetHashValue(idHashPtr); if (gcPtr->refCount-- <= 1) { XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); @@ -347,7 +347,7 @@ TkGCCleanup( for (entryPtr = Tcl_FirstHashEntry(&dispPtr->gcIdTable, &search); entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { - gcPtr = Tcl_GetHashValue(entryPtr); + gcPtr = (TkGC *)Tcl_GetHashValue(entryPtr); XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 76752a3..30a57a9 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -90,7 +90,7 @@ Tk_ManageGeometry( ClientData clientData) /* Arbitrary one-word argument to pass to * geometry manager procedures. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if ((winPtr->geomMgrPtr != NULL) && (mgrPtr != NULL) && ((winPtr->geomMgrPtr != mgrPtr) @@ -132,7 +132,7 @@ Tk_GeometryRequest( int reqWidth, int reqHeight)/* Minimum desired dimensions for window, in * pixels. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; /* * X gets very upset if a window requests a width or height of zero, so @@ -182,8 +182,8 @@ Tk_SetInternalBorderEx( int left, int right, /* Width of internal border, in pixels. */ int top, int bottom) { - register TkWindow *winPtr = (TkWindow *) tkwin; - register int changed = 0; + TkWindow *winPtr = (TkWindow *) tkwin; + int changed = 0; if (left < 0) { left = 0; @@ -279,7 +279,7 @@ Tk_SetMinimumRequestSize( Tk_Window tkwin, /* Window that will have internal border. */ int minWidth, int minHeight)/* Minimum requested size, in pixels. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if ((winPtr->minReqWidth == minWidth) && (winPtr->minReqHeight == minHeight)) { @@ -324,7 +324,7 @@ TkSetGeometryMaster( * set. */ const char *master) /* The master identity. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->geomMgrName != NULL && strcmp(winPtr->geomMgrName, master) == 0) { @@ -341,7 +341,7 @@ TkSetGeometryMaster( return TCL_ERROR; } - winPtr->geomMgrName = ckalloc(strlen(master) + 1); + winPtr->geomMgrName = (char *)ckalloc(strlen(master) + 1); strcpy(winPtr->geomMgrName, master); return TCL_OK; } @@ -369,7 +369,7 @@ TkFreeGeometryMaster( * cleared. */ const char *master) /* The master identity. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->geomMgrName != NULL && strcmp(winPtr->geomMgrName, master) != 0) { @@ -419,7 +419,7 @@ Tk_MaintainGeometry( { Tcl_HashEntry *hPtr; MaintainMaster *masterPtr; - register MaintainSlave *slavePtr; + MaintainSlave *slavePtr; int isNew, map; Tk_Window ancestor, parent; TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr; @@ -463,9 +463,9 @@ Tk_MaintainGeometry( hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable, (char *) master, &isNew); if (!isNew) { - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr); } else { - masterPtr = ckalloc(sizeof(MaintainMaster)); + masterPtr = (MaintainMaster *)ckalloc(sizeof(MaintainMaster)); masterPtr->ancestor = master; masterPtr->checkScheduled = 0; masterPtr->slavePtr = NULL; @@ -483,7 +483,7 @@ Tk_MaintainGeometry( goto gotSlave; } } - slavePtr = ckalloc(sizeof(MaintainSlave)); + slavePtr = (MaintainSlave *)ckalloc(sizeof(MaintainSlave)); slavePtr->slave = slave; slavePtr->master = master; slavePtr->nextPtr = masterPtr->slavePtr; @@ -568,7 +568,7 @@ Tk_UnmaintainGeometry( { Tcl_HashEntry *hPtr; MaintainMaster *masterPtr; - register MaintainSlave *slavePtr, *prevPtr; + MaintainSlave *slavePtr, *prevPtr; Tk_Window ancestor; TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr; @@ -596,7 +596,7 @@ Tk_UnmaintainGeometry( if (hPtr == NULL) { return; } - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr); slavePtr = masterPtr->slavePtr; if (slavePtr->slave == slave) { masterPtr->slavePtr = slavePtr->nextPtr; @@ -660,7 +660,7 @@ MaintainMasterProc( * master window. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainMaster *masterPtr = clientData; + MaintainMaster *masterPtr = (MaintainMaster *)clientData; MaintainSlave *slavePtr; int done; @@ -714,7 +714,7 @@ MaintainSlaveProc( * master-slave pair. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainSlave *slavePtr = clientData; + MaintainSlave *slavePtr = (MaintainSlave *)clientData; if (eventPtr->type == DestroyNotify) { Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master); @@ -746,7 +746,7 @@ MaintainCheckProc( ClientData clientData) /* Pointer to MaintainMaster structure for the * master window. */ { - MaintainMaster *masterPtr = clientData; + MaintainMaster *masterPtr = (MaintainMaster *)clientData; MaintainSlave *slavePtr; Tk_Window ancestor, parent; int x, y, map; diff --git a/generic/tkGet.c b/generic/tkGet.c index 6eff3a3..7ca4d17 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.c @@ -493,10 +493,11 @@ Tk_NameOfJustify( static void FreeUidThreadExitProc( - ClientData clientData) /* Not used. */ + ClientData dummy) /* Not used. */ { - ThreadSpecificData *tsdPtr = - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; Tcl_DeleteHashTable(&tsdPtr->uidTable); tsdPtr->initialized = 0; @@ -529,7 +530,7 @@ Tk_GetUid( const char *string) /* String to convert. */ { int dummy; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashTable *tablePtr = &tsdPtr->uidTable; diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 6cab469..6de6865 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -223,7 +223,7 @@ Tk_GrabObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "?-global? window"); return TCL_ERROR; } - tkwin = Tk_NameToWindow(interp, arg, clientData); + tkwin = Tk_NameToWindow(interp, arg, (Tk_Window)clientData); if (tkwin == NULL) { return TCL_ERROR; } @@ -239,7 +239,7 @@ Tk_GrabObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "?-global? window"); return TCL_ERROR; } - tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData); + tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), (Tk_Window)clientData); if (tkwin == NULL) { return TCL_ERROR; } @@ -265,7 +265,7 @@ Tk_GrabObjCmd( } if (objc == 3) { tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - clientData); + (Tk_Window)clientData); if (tkwin == NULL) { return TCL_ERROR; } @@ -294,7 +294,7 @@ Tk_GrabObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "release window"); return TCL_ERROR; } - tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData); + tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), (Tk_Window)clientData); if (tkwin == NULL) { Tcl_ResetResult(interp); } else { @@ -311,7 +311,7 @@ Tk_GrabObjCmd( if (objc == 3) { globalGrab = 0; tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - clientData); + (Tk_Window)clientData); } else { globalGrab = 1; @@ -327,7 +327,7 @@ Tk_GrabObjCmd( return TCL_ERROR; } tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[3]), - clientData); + (Tk_Window)clientData); } if (tkwin == NULL) { return TCL_ERROR; @@ -344,7 +344,7 @@ Tk_GrabObjCmd( return TCL_ERROR; } winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - clientData); + (Tk_Window)clientData); if (winPtr == NULL) { return TCL_ERROR; } @@ -638,7 +638,7 @@ Tk_Ungrab( static void ReleaseButtonGrab( - register TkDisplay *dispPtr)/* Display whose button grab is to be + TkDisplay *dispPtr)/* Display whose button grab is to be * released. */ { unsigned int serial; @@ -684,11 +684,11 @@ ReleaseButtonGrab( int TkPointerEvent( - register XEvent *eventPtr, /* Pointer to the event. */ + XEvent *eventPtr, /* Pointer to the event. */ TkWindow *winPtr) /* Tk's information for window where event was * reported. */ { - register TkWindow *winPtr2; + TkWindow *winPtr2; TkDisplay *dispPtr = winPtr->dispPtr; unsigned int serial; int outsideGrabTree = 0; @@ -907,14 +907,14 @@ TkPointerEvent( void TkChangeEventWindow( - register XEvent *eventPtr, /* Event to retarget. Must have type + XEvent *eventPtr, /* Event to retarget. Must have type * ButtonPress, ButtonRelease, KeyPress, * KeyRelease, MotionNotify, EnterNotify, or * LeaveNotify. */ TkWindow *winPtr) /* New target window for event. */ { int x, y, sameScreen, bd; - register TkWindow *childPtr; + TkWindow *childPtr; eventPtr->xmotion.window = Tk_WindowId(winPtr); if (eventPtr->xmotion.root == @@ -995,7 +995,7 @@ TkInOutEvents( Tcl_QueuePosition position) /* Position at which events are added to the * system event queue. */ { - register TkWindow *winPtr; + TkWindow *winPtr; int upLevels, downLevels, i, j, focus; /* @@ -1188,7 +1188,7 @@ MovePointer2( void TkGrabDeadWindow( - register TkWindow *winPtr) /* Window that is in the process of being + TkWindow *winPtr) /* Window that is in the process of being * deleted. */ { TkDisplay *dispPtr = winPtr->dispPtr; @@ -1278,7 +1278,7 @@ GrabRestrictProc( ClientData arg, XEvent *eventPtr) { - GrabInfo *info = arg; + GrabInfo *info = (GrabInfo *)arg; int mode, diff; /* @@ -1336,7 +1336,7 @@ QueueGrabWindowChange( { NewGrabWinEvent *grabEvPtr; - grabEvPtr = ckalloc(sizeof(NewGrabWinEvent)); + grabEvPtr = (NewGrabWinEvent *)ckalloc(sizeof(NewGrabWinEvent)); grabEvPtr->header.proc = GrabWinEventProc; grabEvPtr->dispPtr = dispPtr; if (grabWinPtr == NULL) { @@ -1376,6 +1376,7 @@ GrabWinEventProc( * right now. */ { NewGrabWinEvent *grabEvPtr = (NewGrabWinEvent *) evPtr; + (void)flags; grabEvPtr->dispPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow( grabEvPtr->dispPtr->display, grabEvPtr->grabWindow); @@ -1416,7 +1417,7 @@ FindCommonAncestor( int *countPtr2) /* Store nesting level of winPtr2 within * common ancestor here. */ { - register TkWindow *winPtr; + TkWindow *winPtr; TkWindow *ancestorPtr; int count1, count2, i; diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 62a0447..b60ed69 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -335,7 +335,7 @@ Tk_GridObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "anchor", "bbox", "columnconfigure", "configure", "forget", "info", "location", "propagate", "remove", @@ -720,7 +720,7 @@ GridInfoCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Gridder *slavePtr; + Gridder *slavePtr; Tk_Window slave; Tcl_Obj *infoObj; @@ -785,7 +785,7 @@ GridLocationCommand( Tk_Window master; Gridder *masterPtr; /* Master grid record. */ GridMaster *gridPtr; /* Pointer to grid data. */ - register SlotInfo *slotPtr; + SlotInfo *slotPtr; int x, y; /* Offset in pixels, from edge of master. */ int i, j; /* Corresponding column and row indeces. */ int endX, endY; /* End of grid. */ @@ -1431,7 +1431,8 @@ GridReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - register Gridder *gridPtr = clientData; + Gridder *gridPtr = (Gridder *)clientData; + (void)tkwin; gridPtr = gridPtr->masterPtr; if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) { @@ -1463,7 +1464,8 @@ GridLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Gridder *slavePtr = clientData; + Gridder *slavePtr = (Gridder *)clientData; + (void)tkwin; if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); @@ -1496,9 +1498,9 @@ static int AdjustOffsets( int size, /* The total layout size (in pixels). */ int slots, /* Number of slots. */ - register SlotInfo *slotPtr) /* Pointer to slot array. */ + SlotInfo *slotPtr) /* Pointer to slot array. */ { - register int slot; /* Current slot. */ + int slot; /* Current slot. */ int diff; /* Extra pixels needed to add to the layout. */ int totalWeight; /* Sum of the weights for all the slots. */ int weight; /* Sum of the weights so far. */ @@ -1721,8 +1723,8 @@ ArrangeGrid( ClientData clientData) /* Structure describing master whose slaves * are to be re-layed out. */ { - register Gridder *masterPtr = clientData; - register Gridder *slavePtr; + Gridder *masterPtr = (Gridder *)clientData; + Gridder *slavePtr; GridMaster *slotPtr = masterPtr->masterDataPtr; int abort; int width, height; /* Requested size of layout, in pixels. */ @@ -1902,8 +1904,8 @@ ResolveConstraints( int maxOffset) /* The actual maximum size of this layout in * pixels, or 0 (not currently used). */ { - register SlotInfo *slotPtr; /* Pointer to row/col constraints. */ - register Gridder *slavePtr; /* List of slave windows in this grid. */ + SlotInfo *slotPtr; /* Pointer to row/col constraints. */ + Gridder *slavePtr; /* List of slave windows in this grid. */ int constraintCount; /* Count of rows or columns that have * constraints. */ int slotCount; /* Last occupied row or column. */ @@ -1955,7 +1957,7 @@ ResolveConstraints( gridCount = MAX(constraintCount, slotCount); if (gridCount >= TYPICAL_SIZE) { - layoutPtr = ckalloc(sizeof(GridLayout) * (1+gridCount)); + layoutPtr = (GridLayout *)ckalloc(sizeof(GridLayout) * (1+gridCount)); } else { layoutPtr = layoutData; } @@ -2077,7 +2079,7 @@ ResolveConstraints( * sizeof(UniformGroup); size_t newSize = (uniformGroupsAlloced + UNIFORM_PREALLOC) * sizeof(UniformGroup); - UniformGroup *newUG = ckalloc(newSize); + UniformGroup *newUG = (UniformGroup *)ckalloc(newSize); UniformGroup *oldUG = uniformGroupPtr; memcpy(newUG, oldUG, oldSize); @@ -2421,7 +2423,7 @@ GetGrid( Tk_Window tkwin) /* Token for window for which grid structure * is desired. */ { - register Gridder *gridPtr; + Gridder *gridPtr; Tcl_HashEntry *hPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -2438,9 +2440,9 @@ GetGrid( hPtr = Tcl_CreateHashEntry(&dispPtr->gridHashTable, (char*) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Gridder *)Tcl_GetHashValue(hPtr); } - gridPtr = ckalloc(sizeof(Gridder)); + gridPtr = (Gridder *)ckalloc(sizeof(Gridder)); gridPtr->tkwin = tkwin; gridPtr->masterPtr = NULL; gridPtr->masterDataPtr = NULL; @@ -2494,7 +2496,7 @@ static void SetGridSize( Gridder *masterPtr) /* The geometry master for this grid. */ { - register Gridder *slavePtr; /* Current slave window. */ + Gridder *slavePtr; /* Current slave window. */ int maxX = 0, maxY = 0; for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; @@ -2650,7 +2652,7 @@ CheckSlotData( int newNumSlot = slot + PREALLOC; size_t oldSize = numSlot * sizeof(SlotInfo); size_t newSize = newNumSlot * sizeof(SlotInfo); - SlotInfo *newSI = ckalloc(newSize); + SlotInfo *newSI = (SlotInfo *)ckalloc(newSize); SlotInfo *oldSI = (slotType == ROW) ? masterPtr->masterDataPtr->rowPtr : masterPtr->masterDataPtr->columnPtr; @@ -2700,17 +2702,17 @@ InitMasterData( Gridder *masterPtr) { if (masterPtr->masterDataPtr == NULL) { - GridMaster *gridPtr = masterPtr->masterDataPtr = + GridMaster *gridPtr = masterPtr->masterDataPtr = (GridMaster *) ckalloc(sizeof(GridMaster)); size_t size = sizeof(SlotInfo) * TYPICAL_SIZE; gridPtr->columnEnd = 0; gridPtr->columnMax = 0; - gridPtr->columnPtr = ckalloc(size); + gridPtr->columnPtr = (SlotInfo *)ckalloc(size); gridPtr->columnSpace = TYPICAL_SIZE; gridPtr->rowEnd = 0; gridPtr->rowMax = 0; - gridPtr->rowPtr = ckalloc(size); + gridPtr->rowPtr = (SlotInfo *)ckalloc(size); gridPtr->rowSpace = TYPICAL_SIZE; gridPtr->startX = 0; gridPtr->startY = 0; @@ -2740,9 +2742,9 @@ InitMasterData( static void Unlink( - register Gridder *slavePtr) /* Window to unlink. */ + Gridder *slavePtr) /* Window to unlink. */ { - register Gridder *masterPtr, *slavePtr2; + Gridder *masterPtr, *slavePtr2; masterPtr = slavePtr->masterPtr; if (masterPtr == NULL) { @@ -2812,7 +2814,7 @@ static void DestroyGrid( void *memPtr) /* Info about window that is now dead. */ { - register Gridder *gridPtr = memPtr; + Gridder *gridPtr = (Gridder *)memPtr; if (gridPtr->masterDataPtr != NULL) { if (gridPtr->masterDataPtr->rowPtr != NULL) { @@ -2853,7 +2855,7 @@ GridStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Gridder *gridPtr = clientData; + Gridder *gridPtr = (Gridder *)clientData; TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr; if (eventPtr->type == ConfigureNotify) { @@ -2871,7 +2873,7 @@ GridStructureProc( } } } else if (eventPtr->type == DestroyNotify) { - register Gridder *slavePtr, *nextPtr; + Gridder *slavePtr, *nextPtr; if (gridPtr->masterPtr != NULL) { Unlink(gridPtr); @@ -2898,7 +2900,7 @@ GridStructureProc( Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } } else if (eventPtr->type == UnmapNotify) { - register Gridder *slavePtr; + Gridder *slavePtr; for (slavePtr = gridPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { diff --git a/generic/tkImage.c b/generic/tkImage.c index ca00d44..afb6f43 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -104,11 +104,12 @@ static void EventuallyDeleteImage(ImageMaster *masterPtr, static void ImageTypeThreadExitProc( - ClientData clientData) /* not used */ + ClientData dummy) /* not used */ { Tk_ImageType *freePtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; while (tsdPtr->oldImageTypeList != NULL) { freePtr = tsdPtr->oldImageTypeList; @@ -149,14 +150,14 @@ Tk_CreateOldImageType( * by caller. */ { Tk_ImageType *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_ImageType)); + copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType)); *copyPtr = *typePtr; copyPtr->nextPtr = tsdPtr->oldImageTypeList; tsdPtr->oldImageTypeList = copyPtr; @@ -170,14 +171,14 @@ Tk_CreateImageType( * by caller. */ { Tk_ImageType *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_ImageType)); + copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType)); *copyPtr = *typePtr; copyPtr->nextPtr = tsdPtr->imageTypeList; tsdPtr->imageTypeList = copyPtr; @@ -215,7 +216,7 @@ Tk_ImageObjCmd( IMAGE_CREATE, IMAGE_DELETE, IMAGE_HEIGHT, IMAGE_INUSE, IMAGE_NAMES, IMAGE_TYPE, IMAGE_TYPES, IMAGE_WIDTH }; - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; int i, isNew, firstOption, index; Tk_ImageType *typePtr; ImageMaster *masterPtr; @@ -226,7 +227,7 @@ Tk_ImageObjCmd( TkDisplay *dispPtr = winPtr->dispPtr; const char *arg, *name; Tcl_Obj *resultObj; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -318,7 +319,7 @@ Tk_ImageObjCmd( hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &isNew); if (isNew) { - masterPtr = ckalloc(sizeof(ImageMaster)); + masterPtr = (ImageMaster *)ckalloc(sizeof(ImageMaster)); masterPtr->typePtr = NULL; masterPtr->masterData = NULL; masterPtr->width = masterPtr->height = 1; @@ -335,7 +336,7 @@ Tk_ImageObjCmd( * from the master. */ - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->typePtr != NULL) { for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { @@ -363,7 +364,7 @@ Tk_ImageObjCmd( if (oldimage) { int i; - args = ckalloc((objc+1) * sizeof(char *)); + args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *)); for (i = 0; i < objc; i++) { args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]); } @@ -390,7 +391,7 @@ Tk_ImageObjCmd( masterPtr->masterData); } Tcl_SetObjResult(interp, Tcl_NewStringObj( - Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); + (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); break; } case IMAGE_DELETE: @@ -400,7 +401,7 @@ Tk_ImageObjCmd( if (hPtr == NULL) { goto alreadyDeleted; } - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { goto alreadyDeleted; } @@ -415,12 +416,12 @@ Tk_ImageObjCmd( hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search); resultObj = Tcl_NewObj(); for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { continue; } Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); + (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); break; @@ -463,7 +464,7 @@ Tk_ImageObjCmd( if (hPtr == NULL) { goto alreadyDeleted; } - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { goto alreadyDeleted; } @@ -572,7 +573,7 @@ Tk_NameOfImage( if (masterPtr->hPtr == NULL) { return NULL; } - return Tcl_GetHashKey(masterPtr->tablePtr, masterPtr->hPtr); + return (const char *)Tcl_GetHashKey(masterPtr->tablePtr, masterPtr->hPtr); } /* @@ -617,14 +618,14 @@ Tk_GetImage( if (hPtr == NULL) { goto noSuchImage; } - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->typePtr == NULL) { goto noSuchImage; } if (masterPtr->deleted) { goto noSuchImage; } - imagePtr = ckalloc(sizeof(Image)); + imagePtr = (Image *)ckalloc(sizeof(Image)); imagePtr->tkwin = tkwin; imagePtr->display = Tk_Display(tkwin); imagePtr->masterPtr = masterPtr; @@ -933,7 +934,7 @@ Tk_DeleteImage( if (hPtr == NULL) { return; } - DeleteImage(Tcl_GetHashValue(hPtr)); + DeleteImage((ImageMaster *)Tcl_GetHashValue(hPtr)); } /* @@ -1045,7 +1046,7 @@ TkDeleteAllImages( for (hPtr = Tcl_FirstHashEntry(&mainPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - EventuallyDeleteImage(Tcl_GetHashValue(hPtr), 1); + EventuallyDeleteImage((ImageMaster *)Tcl_GetHashValue(hPtr), 1); } Tcl_DeleteHashTable(&mainPtr->imageTable); } @@ -1088,7 +1089,7 @@ Tk_GetImageMasterData( *typePtrPtr = NULL; return NULL; } - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { *typePtrPtr = NULL; return NULL; diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index f83f4cc..a47cfab 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -184,7 +184,8 @@ ImgBmapCreate( ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - BitmapMaster *masterPtr = ckalloc(sizeof(BitmapMaster)); + BitmapMaster *masterPtr = (BitmapMaster *)ckalloc(sizeof(BitmapMaster)); + (void)typePtr; masterPtr->tkMaster = master; masterPtr->interp = interp; @@ -239,7 +240,7 @@ ImgBmapConfigureMaster( { BitmapInstance *instancePtr; int maskWidth, maskHeight, dummy1, dummy2; - const char **argv = ckalloc((objc+1) * sizeof(char *)); + const char **argv = (const char **)ckalloc((objc+1) * sizeof(char *)); for (dummy1 = 0; dummy1 < objc; dummy1++) { argv[dummy1] = Tcl_GetString(objv[dummy1]); @@ -620,7 +621,7 @@ TkGetBitmapData( goto error; } numBytes = ((width+7)/8) * height; - data = ckalloc(numBytes); + data = (char *)ckalloc(numBytes); for (p = data; numBytes > 0; p++, numBytes--) { if (NextBitmapWord(&pi) != TCL_OK) { goto error; @@ -757,7 +758,7 @@ ImgBmapCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const bmapOptions[] = {"cget", "configure", NULL}; - BitmapMaster *masterPtr = clientData; + BitmapMaster *masterPtr = (BitmapMaster *)clientData; int index; if (objc < 2) { @@ -819,7 +820,7 @@ ImgBmapGet( ClientData masterData) /* Pointer to our master structure for the * image. */ { - BitmapMaster *masterPtr = masterData; + BitmapMaster *masterPtr = (BitmapMaster *)masterData; BitmapInstance *instancePtr; /* @@ -840,7 +841,7 @@ ImgBmapGet( * the image. */ - instancePtr = ckalloc(sizeof(BitmapInstance)); + instancePtr = (BitmapInstance *)ckalloc(sizeof(BitmapInstance)); instancePtr->refCount = 1; instancePtr->masterPtr = masterPtr; instancePtr->tkwin = tkwin; @@ -894,7 +895,7 @@ ImgBmapDisplay( /* Coordinates within drawable that correspond * to imageX and imageY. */ { - BitmapInstance *instancePtr = clientData; + BitmapInstance *instancePtr = (BitmapInstance *)clientData; int masking; /* @@ -948,7 +949,7 @@ ImgBmapFree( * instance to be displayed. */ Display *display) /* Display containing window that used image. */ { - BitmapInstance *instancePtr = clientData; + BitmapInstance *instancePtr = (BitmapInstance *)clientData; BitmapInstance *prevPtr; if (instancePtr->refCount-- > 1) { @@ -1009,7 +1010,7 @@ ImgBmapDelete( ClientData masterData) /* Pointer to BitmapMaster structure for * image. Must not have any more instances. */ { - BitmapMaster *masterPtr = masterData; + BitmapMaster *masterPtr = (BitmapMaster *)masterData; if (masterPtr->instancePtr != NULL) { Tcl_Panic("tried to delete bitmap image when instances still exist"); @@ -1050,7 +1051,7 @@ ImgBmapCmdDeletedProc( ClientData clientData) /* Pointer to BitmapMaster structure for * image. */ { - BitmapMaster *masterPtr = clientData; + BitmapMaster *masterPtr = (BitmapMaster *)clientData; masterPtr->imageCmd = NULL; if (masterPtr->tkMaster != NULL) { @@ -1197,7 +1198,7 @@ ImgBmapPostscript( int x, int y, int width, int height, int prepass) { - BitmapMaster *masterPtr = clientData; + BitmapMaster *masterPtr = (BitmapMaster *)clientData; Tcl_InterpState interpState; Tcl_Obj *psObj; diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index c16ca11..cece744 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -351,9 +351,12 @@ FileMatchGIF( int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here if the file is a valid raw GIF file. */ - Tcl_Interp *interp) /* not used */ + Tcl_Interp *dummy) /* not used */ { GIFImageConfig gifConf; + (void)fileName; + (void)format; + (void)dummy; memset(&gifConf, 0, sizeof(GIFImageConfig)); return ReadGIFHeader(&gifConf, chan, widthPtr, heightPtr); @@ -597,7 +600,7 @@ FileReadGIF( goto error; } nBytes = fileWidth * fileHeight * 3; - trashBuffer = ckalloc(nBytes); + trashBuffer = (unsigned char *)ckalloc(nBytes); if (trashBuffer) { memset(trashBuffer, 0, nBytes); } @@ -692,7 +695,7 @@ FileReadGIF( goto error; } nBytes = block.pitch * imageHeight; - block.pixelPtr = ckalloc(nBytes); + block.pixelPtr = (unsigned char *)ckalloc(nBytes); if (block.pixelPtr) { memset(block.pixelPtr, 0, nBytes); } @@ -754,11 +757,13 @@ StringMatchGIF( Tcl_Obj *format, /* the image format object, or NULL */ int *widthPtr, /* where to put the string width */ int *heightPtr, /* where to put the string height */ - Tcl_Interp *interp) /* not used */ + Tcl_Interp *dummy) /* not used */ { unsigned char *data, header[10]; TkSizeT got, length; MFile handle; + (void)format; + (void)dummy; data = TkGetByteArrayFromObj(dataObj, &length); @@ -1035,15 +1040,17 @@ ReadImage( { unsigned char initialCodeSize; int xpos = 0, ypos = 0, pass = 0, i, count; - register unsigned char *pixelPtr; + unsigned char *pixelPtr; static const int interlaceStep[] = { 8, 8, 4, 2 }; static const int interlaceStart[] = { 0, 4, 2, 1 }; unsigned short prefix[(1 << MAX_LWZ_BITS)]; unsigned char append[(1 << MAX_LWZ_BITS)]; unsigned char stack[(1 << MAX_LWZ_BITS)*2]; - register unsigned char *top; + unsigned char *top; int codeSize, clearCode, inCode, endCode, oldCode, maxCode; int code, firstCode, v; + (void)srcX; + (void)srcY; /* * Initialize the decoder @@ -1679,7 +1686,7 @@ WriteToChannel( const char *bytes, size_t byteCount) { - Tcl_Channel handle = clientData; + Tcl_Channel handle = (Tcl_Channel)clientData; return Tcl_Write(handle, bytes, byteCount); } @@ -1690,7 +1697,7 @@ WriteToByteArray( const char *bytes, size_t byteCount) { - Tcl_Obj *objPtr = clientData; + Tcl_Obj *objPtr = (Tcl_Obj *)clientData; Tcl_Obj *tmpObj = Tcl_NewByteArrayObj((unsigned char *) bytes, byteCount); Tcl_IncrRefCount(tmpObj); @@ -1712,6 +1719,7 @@ CommonWriteGIF( long width, height, x; unsigned char c; unsigned int top, left; + (void)format; top = 0; left = 0; @@ -2157,9 +2165,9 @@ ClearHashTable( /* Reset code table. */ GIFState_t *statePtr, int hSize) { - register int *hashTablePtr = statePtr->hashTable + hSize; - register long i; - register long m1 = -1; + int *hashTablePtr = statePtr->hashTable + hSize; + long i; + long m1 = -1; i = hSize - 16; do { /* might use Sys V memset(3) here */ diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c index 2b23699..95daf53 100644 --- a/generic/tkImgListFormat.c +++ b/generic/tkImgListFormat.c @@ -196,7 +196,8 @@ ParseFormatOptions( * this struct */ { - int index, optIndex, typeIndex, first; + int index, optIndex, first; + enum ColorFormatType typeIndex; const char *option; first = 1; @@ -257,7 +258,7 @@ ParseFormatOptions( return TCL_ERROR; } if (Tcl_GetIndexFromObj(NULL, objv[index], colorFormatNames, "", - TCL_EXACT, &typeIndex) != TCL_OK + TCL_EXACT, (int *)&typeIndex) != TCL_OK || (typeIndex != COLORFORMAT_LIST && typeIndex != COLORFORMAT_RGB2 && typeIndex != COLORFORMAT_RGBA2) ) { @@ -366,6 +367,7 @@ StringMatchDef( int y, rowCount, colCount, curColCount; unsigned char dummy; Tcl_Obj **rowListPtr, *pixelData; + (void)formatString; /* * See if data can be parsed as a list, if every element is itself a valid @@ -550,7 +552,7 @@ StringReadDef( srcBlock.offset[1] = 1; srcBlock.offset[2] = 2; srcBlock.offset[3] = 3; - srcBlock.pixelPtr = attemptckalloc(srcBlock.pitch * srcBlock.height); + 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); @@ -837,7 +839,7 @@ ParseColor( */ static int ParseColorAsList( - Tcl_Interp *interp, /* not used */ + Tcl_Interp *dummy, /* not used */ const char *colorString, /* the color data to parse */ int colorStrLen, /* length of the color string */ unsigned char *redPtr, /* the result is written to these pointers */ @@ -845,7 +847,6 @@ ParseColorAsList( unsigned char *bluePtr, unsigned char *alphaPtr) { - /* * This is kinda ugly. The code would be certainly nicer if it * used Tcl_ListObjGetElements() and Tcl_GetIntFromObj(). But with @@ -855,6 +856,8 @@ ParseColorAsList( const char *curPos; int values[4]; int i; + (void)dummy; + (void)colorStrLen; curPos = colorString; i = 0; diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index 3331d3d..0c62b58 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -2237,14 +2237,14 @@ ApplyAlpha( PNGImage *pngPtr) { if (pngPtr->alpha != 1.0) { - register unsigned char *p = pngPtr->block.pixelPtr; + unsigned char *p = pngPtr->block.pixelPtr; unsigned char *endPtr = p + pngPtr->blockLen; int offset = pngPtr->block.offset[3]; p += offset; if (16 == pngPtr->bitDepth) { - register unsigned int channel; + unsigned int channel; while (p < endPtr) { channel = (unsigned int) @@ -2520,7 +2520,7 @@ DecodePNG( pngPtr->thisLineObj = Tcl_NewObj(); Tcl_IncrRefCount(pngPtr->thisLineObj); - pngPtr->block.pixelPtr = attemptckalloc(pngPtr->blockLen); + pngPtr->block.pixelPtr = (unsigned char *)attemptckalloc(pngPtr->blockLen); if (!pngPtr->block.pixelPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "memory allocation failed", -1)); @@ -2676,6 +2676,8 @@ FileMatchPNG( { PNGImage png; int match = 0; + (void)fileName; + (void)fmtObj; InitPNGImage(NULL, &png, chan, NULL, TCL_ZLIB_STREAM_INFLATE); @@ -2725,6 +2727,11 @@ FileReadPNG( { PNGImage png; int result = TCL_ERROR; + (void)fileName; + (void)width; + (void)height; + (void)srcX; + (void)srcY; result = InitPNGImage(interp, &png, chan, NULL, TCL_ZLIB_STREAM_INFLATE); @@ -2764,6 +2771,7 @@ StringMatchPNG( { PNGImage png; int match = 0; + (void)fmtObj; InitPNGImage(NULL, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); @@ -2812,6 +2820,10 @@ StringReadPNG( { PNGImage png; int result = TCL_ERROR; + (void)width; + (void)height; + (void)srcX; + (void)srcY; result = InitPNGImage(interp, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); @@ -3459,6 +3471,7 @@ FileWritePNG( Tcl_Channel chan; PNGImage png; int result = TCL_ERROR; + (void)fmtObj; /* * Open a Tcl file channel where the image data will be stored. Tk ought @@ -3529,6 +3542,7 @@ StringWritePNG( Tcl_Obj *resultObj = Tcl_NewObj(); PNGImage png; int result = TCL_ERROR; + (void)fmtObj; /* * Initalize PNGImage instance for encoding. diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index ea49fc2..91d809b 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -103,6 +103,9 @@ FileMatchPPM( Tcl_Interp *interp) /* unused */ { int dummy; + (void)fileName; + (void)format; + (void)interp; return ReadPPMFileHeader(chan, widthPtr, heightPtr, &dummy); } @@ -145,6 +148,7 @@ FileReadPPM( size_t nBytes, count; unsigned char *pixelPtr; Tk_PhotoImageBlock block; + (void)format; type = ReadPPMFileHeader(chan, &fileWidth, &fileHeight, &maxIntensity); if (type == 0) { @@ -212,7 +216,7 @@ FileReadPPM( nLines = 1; } nBytes = nLines * block.pitch; - pixelPtr = ckalloc(nBytes); + pixelPtr = (unsigned char *)ckalloc(nBytes); block.pixelPtr = pixelPtr + srcX * block.pixelSize; for (h = height; h > 0; h -= nLines) { @@ -290,6 +294,7 @@ FileWritePPM( size_t nBytes; unsigned char *pixelPtr, *pixLinePtr; char header[16 + TCL_INTEGER_SPACE * 2]; + (void)format; chan = Tcl_OpenFileChannel(interp, fileName, "w", 0666); if (chan == NULL) { @@ -377,6 +382,7 @@ StringWritePPM( unsigned char *pixLinePtr, *byteArray; char header[16 + TCL_INTEGER_SPACE * 2]; Tcl_Obj *byteArrayObj; + (void)format; sprintf(header, "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height); @@ -454,6 +460,8 @@ StringMatchPPM( Tcl_Interp *interp) /* unused */ { int dummy; + (void)format; + (void)interp; return ReadPPMStringHeader(dataObj, widthPtr, heightPtr, &dummy, NULL, NULL); @@ -494,6 +502,7 @@ StringReadPPM( int nLines, nBytes, h, type, count, dataSize, bytesPerChannel = 1; unsigned char *pixelPtr, *dataBuffer; Tk_PhotoImageBlock block; + (void)format; type = ReadPPMStringHeader(dataObj, &fileWidth, &fileHeight, &maxIntensity, &dataBuffer, &dataSize); @@ -580,7 +589,7 @@ StringReadPPM( nLines = 1; } nBytes = nLines * block.pitch; - pixelPtr = ckalloc(nBytes); + pixelPtr = (unsigned char *)ckalloc(nBytes); block.pixelPtr = pixelPtr + srcX * block.pixelSize; for (h = height; h > 0; h -= nLines) { diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index fde868b..61be9da 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -212,7 +212,7 @@ TkImgPhotoGet( ClientData masterData) /* Pointer to our master structure for the * image. */ { - PhotoMaster *masterPtr = masterData; + PhotoMaster *masterPtr = (PhotoMaster *)masterData; PhotoInstance *instancePtr; Colormap colormap; int mono, nRed, nGreen, nBlue, numVisuals; @@ -278,7 +278,7 @@ TkImgPhotoGet( * a new instance of the image. */ - instancePtr = ckalloc(sizeof(PhotoInstance)); + instancePtr = (PhotoInstance *)ckalloc(sizeof(PhotoInstance)); instancePtr->masterPtr = masterPtr; instancePtr->display = Tk_Display(tkwin); instancePtr->colormap = Tk_Colormap(tkwin); @@ -611,7 +611,7 @@ TkImgPhotoDisplay( int drawableX,int drawableY)/* Coordinates within drawable that correspond * to imageX and imageY. */ { - PhotoInstance *instancePtr = clientData; + PhotoInstance *instancePtr = (PhotoInstance *)clientData; #ifndef TKPUTIMAGE_CAN_BLEND XVisualInfo visInfo = instancePtr->visualInfo; #endif @@ -729,8 +729,9 @@ TkImgPhotoFree( Display *display) /* Display containing window that used * image. */ { - PhotoInstance *instancePtr = clientData; + PhotoInstance *instancePtr = (PhotoInstance *)clientData; ColorTable *colorPtr; + (void)display; if (instancePtr->refCount-- > 1) { return; @@ -829,7 +830,7 @@ TkImgPhotoInstanceSetSize( * such possibility. */ - newError = ckalloc(masterPtr->height * masterPtr->width + newError = (schar *)ckalloc(masterPtr->height * masterPtr->width * 3 * sizeof(schar)); /* @@ -1058,13 +1059,13 @@ GetColorTable( * Re-use the existing entry. */ - colorPtr = Tcl_GetHashValue(entry); + colorPtr = (ColorTable *)Tcl_GetHashValue(entry); } else { /* * No color table currently available; need to make one. */ - colorPtr = ckalloc(sizeof(ColorTable)); + colorPtr = (ColorTable *)ckalloc(sizeof(ColorTable)); /* * The following line of code should not normally be needed due to the @@ -1225,7 +1226,7 @@ AllocateColors( } else { numColors = MAX(MAX(nRed, nGreen), nBlue); } - colors = ckalloc(numColors * sizeof(XColor)); + colors = (XColor *)ckalloc(numColors * sizeof(XColor)); for (i = 0; i < numColors; ++i) { if (igam == 1.0) { @@ -1245,7 +1246,7 @@ AllocateColors( */ numColors = (mono) ? nRed: (nRed * nGreen * nBlue); - colors = ckalloc(numColors * sizeof(XColor)); + colors = (XColor *)ckalloc(numColors * sizeof(XColor)); if (!mono) { /* @@ -1289,7 +1290,7 @@ AllocateColors( * Now try to allocate the colors we've calculated. */ - pixels = ckalloc(numColors * sizeof(unsigned long)); + pixels = (unsigned long *)ckalloc(numColors * sizeof(unsigned long)); for (i = 0; i < numColors; ++i) { if (!XAllocColor(colorPtr->id.display, colorPtr->id.colormap, &colors[i])) { @@ -1449,7 +1450,7 @@ DisposeColorTable( ClientData clientData) /* Pointer to the ColorTable whose * colors are to be released. */ { - ColorTable *colorPtr = clientData; + ColorTable *colorPtr = (ColorTable *)clientData; Tcl_HashEntry *entry; if (colorPtr->pixelMap != NULL) { @@ -1509,7 +1510,7 @@ ReclaimColors( entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch); while (entry != NULL) { - colorPtr = Tcl_GetHashValue(entry); + colorPtr = (ColorTable *)Tcl_GetHashValue(entry); if ((colorPtr->id.display == id->display) && (colorPtr->id.colormap == id->colormap) && (colorPtr->liveRefCount == 0 )&& (colorPtr->numColors != 0) @@ -1538,7 +1539,7 @@ ReclaimColors( entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch); while ((entry != NULL) && (numColors > 0)) { - colorPtr = Tcl_GetHashValue(entry); + colorPtr = (ColorTable *)Tcl_GetHashValue(entry); if ((colorPtr->id.display == id->display) && (colorPtr->id.colormap == id->colormap) && (colorPtr->liveRefCount == 0) && (colorPtr->numColors != 0) @@ -1583,7 +1584,7 @@ TkImgDisposeInstance( ClientData clientData) /* Pointer to the instance whose resources are * to be released. */ { - PhotoInstance *instancePtr = clientData; + PhotoInstance *instancePtr = (PhotoInstance *)clientData; PhotoInstance *prevPtr; if (instancePtr->pixels != None) { @@ -1693,7 +1694,7 @@ TkImgDitherInstance( * recovering from the failure. */ - imagePtr->data = ckalloc(imagePtr->bytes_per_line * nLines); + imagePtr->data = (char *)ckalloc(imagePtr->bytes_per_line * nLines); bigEndian = imagePtr->bitmap_bit_order == MSBFirst; firstBit = bigEndian? (1 << (imagePtr->bitmap_unit - 1)): 1; diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 23ee142..3028c0e 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -219,11 +219,12 @@ static const char * GetExtension(const char *path); static void PhotoFormatThreadExitProc( - ClientData clientData) /* not used */ + ClientData dummy) /* not used */ { Tk_PhotoImageFormat *freePtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; while (tsdPtr->oldFormatList != NULL) { freePtr = tsdPtr->oldFormatList; @@ -265,14 +266,14 @@ Tk_CreateOldPhotoImageFormat( * by caller. */ { Tk_PhotoImageFormat *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat)); + copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; copyPtr->nextPtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = copyPtr; @@ -286,21 +287,21 @@ Tk_CreatePhotoImageFormat( * by caller. */ { Tk_PhotoImageFormat *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat)); + copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; if (isupper((unsigned char) *formatPtr->name)) { copyPtr->nextPtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = copyPtr; } else { /* for compatibility with aMSN: make a copy of formatPtr->name */ - char *name = ckalloc(strlen(formatPtr->name) + 1); + char *name = (char *)ckalloc(strlen(formatPtr->name) + 1); strcpy(name, formatPtr->name); copyPtr->name = name; copyPtr->nextPtr = tsdPtr->formatList; @@ -340,12 +341,13 @@ ImgPhotoCreate( * will be returned in later callbacks. */ { PhotoMaster *masterPtr; + (void)typePtr; /* * Allocate and initialize the photo image master record. */ - masterPtr = ckalloc(sizeof(PhotoMaster)); + masterPtr = (PhotoMaster *)ckalloc(sizeof(PhotoMaster)); memset(masterPtr, 0, sizeof(PhotoMaster)); masterPtr->tkMaster = master; masterPtr->interp = interp; @@ -404,7 +406,7 @@ ImgPhotoCmd( PHOTO_WRITE }; - PhotoMaster *masterPtr = clientData; + PhotoMaster *masterPtr = (PhotoMaster *)clientData; int result, index, x, y, width, height; struct SubcommandOptions options; unsigned char *pixelPtr; @@ -414,7 +416,7 @@ ImgPhotoCmd( int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -1765,7 +1767,7 @@ ImgPhotoConfigureMaster( Tk_PhotoImageFormat *imageFormat; const char **args; - args = ckalloc((objc + 1) * sizeof(char *)); + args = (const char **)ckalloc((objc + 1) * sizeof(char *)); for (i = 0, j = 0; i < objc; i++,j++) { args[j] = TkGetStringFromObj(objv[i], &length); if ((length > 1) && (args[j][0] == '-')) { @@ -2105,7 +2107,7 @@ ImgPhotoDelete( ClientData masterData) /* Pointer to PhotoMaster structure for image. * Must not have any more instances. */ { - PhotoMaster *masterPtr = masterData; + PhotoMaster *masterPtr = (PhotoMaster *)masterData; PhotoInstance *instancePtr; while ((instancePtr = masterPtr->instancePtr) != NULL) { @@ -2157,7 +2159,7 @@ ImgPhotoCmdDeletedProc( ClientData clientData) /* Pointer to PhotoMaster structure for * image. */ { - PhotoMaster *masterPtr = clientData; + PhotoMaster *masterPtr = (PhotoMaster *)clientData; masterPtr->imageCmd = NULL; if (masterPtr->tkMaster != NULL) { @@ -2230,7 +2232,7 @@ ImgPhotoSetSize( if (newPixSize == 0) { newPix32 = NULL; } else { - newPix32 = attemptckalloc(newPixSize); + newPix32 = (unsigned char *)attemptckalloc(newPixSize); if (newPix32 == NULL) { return TCL_ERROR; } @@ -2393,7 +2395,7 @@ MatchFileFormat( { int matched = 0, useoldformat = 0; Tk_PhotoImageFormat *formatPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; @@ -2533,7 +2535,7 @@ MatchStringFormat( { int matched = 0, useoldformat = 0; Tk_PhotoImageFormat *formatPtr, *defaultFormatPtr = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; @@ -2743,7 +2745,7 @@ Tk_PhotoPutBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoMaster *masterPtr = (PhotoMaster *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -2791,7 +2793,7 @@ Tk_PhotoPutBlock( if (sourceBlock.pixelPtr >= masterPtr->pix32 && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width * masterPtr->height * 4) { - sourceBlock.pixelPtr = attemptckalloc(sourceBlock.height + sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(sourceBlock.height * sourceBlock.pitch); if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { @@ -3084,10 +3086,10 @@ Tk_PhotoPutBlock( */ if (!(masterPtr->flags & COMPLEX_ALPHA)) { - register int x1; + int x1; for (x1=x ; x1pix32 + (y*masterPtr->width + x1)*4; newAlpha = destLinePtr[3]; @@ -3169,8 +3171,8 @@ Tk_PhotoPutZoomedBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoMaster *masterPtr = (PhotoMaster *) handle; - register Tk_PhotoImageBlock sourceBlock; + PhotoMaster *masterPtr = (PhotoMaster *) handle; + Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; int wLeft, hLeft, wCopy, hCopy, blockWid, blockHt; @@ -3225,7 +3227,7 @@ Tk_PhotoPutZoomedBlock( if (sourceBlock.pixelPtr >= masterPtr->pix32 && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width * masterPtr->height * 4) { - sourceBlock.pixelPtr = attemptckalloc(sourceBlock.height + sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(sourceBlock.height * sourceBlock.pitch); if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { @@ -3845,7 +3847,7 @@ ImgGetPhoto( if (blockPtr->height > (int)((UINT_MAX/newPixelSize)/blockPtr->width)) { return NULL; } - data = attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height); + data = (char *)attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height); if (data == NULL) { return NULL; } @@ -4027,6 +4029,8 @@ ImgPhotoPostscript( int prepass) /* (unused) */ { Tk_PhotoImageBlock block; + (void)tkwin; + (void)prepass; Tk_PhotoGetImage(clientData, &block); block.pixelPtr += y * block.pitch + x * block.pixelSize; diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c index d51c211..7575f86 100644 --- a/generic/tkImgSVGnano.c +++ b/generic/tkImgSVGnano.c @@ -129,6 +129,7 @@ FileMatchSVG( const char *data; RastOpts ropts; NSVGimage *nsvgImage; + (void)fileName; CleanCache(interp); if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) { @@ -187,6 +188,7 @@ FileReadSVG( const char *data; RastOpts ropts; NSVGimage *nsvgImage = GetCachedSVG(interp, chan, formatObj, &ropts); + (void)fileName; if (nsvgImage == NULL) { Tcl_Obj *dataObj = Tcl_NewObj(); @@ -343,7 +345,7 @@ ParseSVGWithOptions( * therefore first duplicate. */ - inputCopy = attemptckalloc(length+1); + inputCopy = (char *)attemptckalloc(length+1); if (inputCopy == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc data buffer", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); @@ -517,6 +519,8 @@ RasterizeSVG( unsigned char *imgData; Tk_PhotoImageBlock svgblock; double scale; + (void)srcX; + (void)srcY; scale = GetScaleFromParameters(nsvgImage, ropts, &w, &h); @@ -527,7 +531,7 @@ RasterizeSVG( NULL); goto cleanAST; } - imgData = attemptckalloc(w * h *4); + imgData = (unsigned char *)attemptckalloc(w * h *4); if (imgData == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc image buffer", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); @@ -649,9 +653,9 @@ static NSVGcache * GetCachePtr( Tcl_Interp *interp ) { - NSVGcache *cachePtr = Tcl_GetAssocData(interp, "tksvgnano", NULL); + NSVGcache *cachePtr = (NSVGcache *)Tcl_GetAssocData(interp, "tksvgnano", NULL); if (cachePtr == NULL) { - cachePtr = ckalloc(sizeof(NSVGcache)); + cachePtr = (NSVGcache *)ckalloc(sizeof(NSVGcache)); cachePtr->dataOrChan = NULL; Tcl_DStringInit(&cachePtr->formatString); cachePtr->nsvgImage = NULL; @@ -794,7 +798,8 @@ CleanCache(Tcl_Interp *interp) static void FreeCache(ClientData clientData, Tcl_Interp *interp) { - NSVGcache *cachePtr = clientData; + NSVGcache *cachePtr = (NSVGcache *)clientData; + (void)interp; Tcl_DStringFree(&cachePtr->formatString); if (cachePtr->nsvgImage != NULL) { diff --git a/generic/tkImgUtil.c b/generic/tkImgUtil.c index 5487165..6a43fbe 100644 --- a/generic/tkImgUtil.c +++ b/generic/tkImgUtil.c @@ -55,7 +55,7 @@ TkAlignImageData( dataWidth += (alignment - (dataWidth % alignment)); } - data = ckalloc(dataWidth * image->height); + data = (char *)ckalloc(dataWidth * image->height); destPtr = data; for (i = 0; i < image->height; i++) { diff --git a/generic/tkInt.h b/generic/tkInt.h index f916b97..5b51054 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -179,6 +179,8 @@ typedef struct TkCaret { * specific data, since each thread will have its own TkDisplay structure. */ +typedef enum TkLockUsage {LU_IGNORE, LU_CAPS, LU_SHIFT} TkLockUsage; + typedef struct TkDisplay { Display *display; /* Xlib's info about display. */ struct TkDisplay *nextPtr; /* Next in list of all displays. */ @@ -220,7 +222,7 @@ typedef struct TkDisplay { unsigned int altModMask; /* Has one bit set to indicate the modifier * corresponding to the "Meta" key. If no such * modifier, then this is zero. */ - enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage; + TkLockUsage lockUsage; /* Indicates how to interpret lock * modifier. */ int numModKeyCodes; /* Number of entries in modKeyCodes array diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 1264813..7d81db0 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -473,14 +473,15 @@ static const Tk_ClassProcs listboxClass = { int Tk_ListboxObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Listbox *listPtr; + Listbox *listPtr; Tk_Window tkwin; ListboxOptionTables *optionTables; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -493,7 +494,7 @@ Tk_ListboxObjCmd( return TCL_ERROR; } - optionTables = Tcl_GetAssocData(interp, "ListboxOptionTables", NULL); + optionTables = (ListboxOptionTables *)Tcl_GetAssocData(interp, "ListboxOptionTables", NULL); if (optionTables == NULL) { /* * We haven't created the option tables for this widget class yet. Do @@ -501,7 +502,7 @@ Tk_ListboxObjCmd( * command, so future invocations will have access to it. */ - optionTables = ckalloc(sizeof(ListboxOptionTables)); + optionTables = (ListboxOptionTables *)ckalloc(sizeof(ListboxOptionTables)); /* * Set up an exit handler to free the optionTables struct. @@ -526,7 +527,7 @@ Tk_ListboxObjCmd( * already (e.g. resource pointers). */ - listPtr = ckalloc(sizeof(Listbox)); + listPtr = (Listbox *)ckalloc(sizeof(Listbox)); memset(listPtr, 0, sizeof(Listbox)); listPtr->tkwin = tkwin; @@ -537,9 +538,9 @@ Tk_ListboxObjCmd( ListboxCmdDeletedProc); listPtr->optionTable = optionTables->listboxOptionTable; listPtr->itemAttrOptionTable = optionTables->itemAttrOptionTable; - listPtr->selection = ckalloc(sizeof(Tcl_HashTable)); + listPtr->selection = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(listPtr->selection, TCL_ONE_WORD_KEYS); - listPtr->itemAttrTable = ckalloc(sizeof(Tcl_HashTable)); + listPtr->itemAttrTable = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(listPtr->itemAttrTable, TCL_ONE_WORD_KEYS); listPtr->relief = TK_RELIEF_RAISED; listPtr->textGC = NULL; @@ -607,7 +608,7 @@ ListboxWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Arguments as Tcl_Obj's. */ { - register Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; int cmdIndex, index; int result = TCL_OK; Tcl_Obj *objPtr; @@ -1082,7 +1083,7 @@ ListboxBboxSubCmd( Listbox *listPtr, /* Information about the listbox */ int index) /* Index of the element to get bbox info on */ { - register Tk_Window tkwin = listPtr->tkwin; + Tk_Window tkwin = listPtr->tkwin; int lastVisibleIndex; /* @@ -1411,7 +1412,7 @@ ListboxGetItemAttributes( entry = Tcl_CreateHashEntry(listPtr->itemAttrTable, KEY(index), &isNew); if (isNew) { - attrs = ckalloc(sizeof(ItemAttr)); + attrs = (ItemAttr *)ckalloc(sizeof(ItemAttr)); attrs->border = NULL; attrs->selBorder = NULL; attrs->fgColor = NULL; @@ -1420,7 +1421,7 @@ ListboxGetItemAttributes( listPtr->tkwin); Tcl_SetHashValue(entry, attrs); } else { - attrs = Tcl_GetHashValue(entry); + attrs = (ItemAttr *)Tcl_GetHashValue(entry); } return attrs; } @@ -1447,7 +1448,7 @@ static void DestroyListbox( void *memPtr) /* Info about listbox widget. */ { - register Listbox *listPtr = memPtr; + Listbox *listPtr = (Listbox *)memPtr; Tcl_HashEntry *entry; Tcl_HashSearch search; @@ -1527,8 +1528,10 @@ DestroyListbox( static void DestroyListboxOptionTables( ClientData clientData, /* Pointer to the OptionTables struct */ - Tcl_Interp *interp) /* Pointer to the calling interp */ + Tcl_Interp *dummy) /* Pointer to the calling interp */ { + (void)dummy; + ckfree(clientData); return; } @@ -1556,7 +1559,7 @@ DestroyListboxOptionTables( static int ConfigureListbox( Tcl_Interp *interp, /* Used for error reporting. */ - register Listbox *listPtr, /* Information about widget; may or may not + Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -1716,7 +1719,7 @@ ConfigureListbox( static int ConfigureListboxItem( Tcl_Interp *interp, /* Used for error reporting. */ - register Listbox *listPtr, /* Information about widget; may or may not + Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ ItemAttr *attrs, /* Information about the item to configure */ int objc, /* Number of valid entries in argv. */ @@ -1767,7 +1770,7 @@ ListboxWorldChanged( XGCValues gcValues; GC gc; unsigned long mask; - Listbox *listPtr = instanceData; + Listbox *listPtr = (Listbox *)instanceData; if (listPtr->state & STATE_NORMAL) { gcValues.foreground = listPtr->fgColorPtr->pixel; @@ -1838,8 +1841,8 @@ static void DisplayListbox( ClientData clientData) /* Information about window. */ { - register Listbox *listPtr = clientData; - register Tk_Window tkwin = listPtr->tkwin; + Listbox *listPtr = (Listbox *)clientData; + Tk_Window tkwin = listPtr->tkwin; GC gc; int i, limit, x, y, prevSelected, freeGC; TkSizeT stringLen; @@ -1958,7 +1961,7 @@ DisplayListbox( */ if (entry != NULL) { - attrs = Tcl_GetHashValue(entry); + attrs = (ItemAttr *)Tcl_GetHashValue(entry); /* * Default GC has the values from the widget at large. @@ -2039,7 +2042,7 @@ DisplayListbox( */ if (entry != NULL) { - attrs = Tcl_GetHashValue(entry); + attrs = (ItemAttr *)Tcl_GetHashValue(entry); gcValues.foreground = listPtr->fgColorPtr->pixel; gcValues.font = Tk_FontId(listPtr->tkfont); gcValues.graphics_exposures = False; @@ -2320,7 +2323,7 @@ ListboxComputeGeometry( static int ListboxInsertSubCmd( - register Listbox *listPtr, /* Listbox that is to get the new elements. */ + Listbox *listPtr, /* Listbox that is to get the new elements. */ int index, /* Add the new elements before this * element. */ int objc, /* Number of new elements to add. */ @@ -2437,7 +2440,7 @@ ListboxInsertSubCmd( static int ListboxDeleteSubCmd( - register Listbox *listPtr, /* Listbox widget to modify. */ + Listbox *listPtr, /* Listbox widget to modify. */ int first, /* Index of first element to delete. */ int last) /* Index of last element to delete. */ { @@ -2615,7 +2618,7 @@ ListboxEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; if (eventPtr->type == Expose) { EventuallyRedrawRange(listPtr, @@ -2690,7 +2693,7 @@ static void ListboxCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; /* * This procedure could be invoked either because the window was destroyed @@ -2833,7 +2836,7 @@ GetListboxIndex( static void ChangeListboxView( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int index) /* Index of element in listPtr that should now * appear at the top of the listbox. */ { @@ -2868,7 +2871,7 @@ ChangeListboxView( static void ChangeListboxOffset( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int offset) /* Desired new "xOffset" for listbox. */ { int maxOffset; @@ -2916,7 +2919,7 @@ ChangeListboxOffset( static void ListboxScanTo( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int x, /* X-coordinate to use for scan operation. */ int y) /* Y-coordinate to use for scan operation. */ { @@ -2983,7 +2986,7 @@ ListboxScanTo( static int NearestListboxElement( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int y) /* Y-coordinate in listPtr's window. */ { int index; @@ -3024,7 +3027,7 @@ NearestListboxElement( static int ListboxSelect( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int first, /* Index of first element to select or * deselect. */ int last, /* Index of last element to select or @@ -3125,7 +3128,7 @@ ListboxFetchSelection( * not including terminating NULL * character. */ { - register Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; Tcl_DString selection; int count, needNewline, i; TkSizeT length, stringLen; @@ -3202,7 +3205,7 @@ static void ListboxLostSelection( ClientData clientData) /* Information about listbox widget. */ { - register Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; if ((listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp)) && (listPtr->nElements > 0)) { @@ -3254,13 +3257,16 @@ GenerateListboxSelectEvent( static void EventuallyRedrawRange( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int first, /* Index of first element in list that needs * to be redrawn. */ int last) /* Index of last element in list that needs to * be redrawn. May be less than first; these * just bracket a range. */ { + (void)first; + (void)last; + /* * We don't have to register a redraw callback if one is already pending, * or if the window doesn't exist, or if the window isn't mapped. @@ -3297,7 +3303,7 @@ EventuallyRedrawRange( static void ListboxUpdateVScrollbar( - register Listbox *listPtr) /* Information about widget. */ + Listbox *listPtr) /* Information about widget. */ { char firstStr[TCL_DOUBLE_SPACE], lastStr[TCL_DOUBLE_SPACE]; double first, last; @@ -3367,7 +3373,7 @@ ListboxUpdateVScrollbar( static void ListboxUpdateHScrollbar( - register Listbox *listPtr) /* Information about widget. */ + Listbox *listPtr) /* Information about widget. */ { char firstStr[TCL_DOUBLE_SPACE], lastStr[TCL_DOUBLE_SPACE]; int result, windowWidth; @@ -3441,10 +3447,12 @@ ListboxListVarProc( const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { - Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; Tcl_Obj *oldListObj, *varListObj; int oldLength, i; Tcl_HashEntry *entry; + (void)name1; + (void)name2; /* * Bwah hahahaha! Puny mortal, you can't unset a -listvar'd variable! @@ -3648,7 +3656,7 @@ MigrateHashEntries( *---------------------------------------------------------------------- */ static int GetMaxOffset( - register Listbox *listPtr) + Listbox *listPtr) { int maxOffset; diff --git a/generic/tkMacWinMenu.c b/generic/tkMacWinMenu.c index 0417185..40a5ea8 100644 --- a/generic/tkMacWinMenu.c +++ b/generic/tkMacWinMenu.c @@ -43,7 +43,7 @@ PreprocessMenu( TkMenu *menuPtr) { int index, result, finished; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_Preserve(menuPtr); @@ -67,7 +67,7 @@ PreprocessMenu( do { finished = 1; for (index = 0; index < (int)menuPtr->numEntries; index++) { - register TkMenuEntry *entryPtr = menuPtr->entries[index]; + TkMenuEntry *entryPtr = menuPtr->entries[index]; if ((entryPtr->type == CASCADE_ENTRY) && (entryPtr->namePtr != NULL) @@ -129,7 +129,7 @@ int TkPreprocessMenu( TkMenu *menuPtr) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->postCommandGeneration++; diff --git a/generic/tkMain.c b/generic/tkMain.c index ccb624b..68b422a 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -409,9 +409,10 @@ StdinProc( char *cmd; int code; size_t count; - InteractiveState *isPtr = clientData; + InteractiveState *isPtr = (InteractiveState *)clientData; Tcl_Channel chan = isPtr->input; Tcl_Interp *interp = isPtr->interp; + (void)mask; count = (size_t)Tcl_Gets(chan, &isPtr->line); diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 4c58981..34c16f8 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -407,14 +407,14 @@ Tk_MenuObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; Tk_Window newWin; - register TkMenu *menuPtr; + TkMenu *menuPtr; TkMenuReferences *menuRefPtr; int i, index, toplevel; const char *windowName; static const char *const typeStringList[] = {"-type", NULL}; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -449,7 +449,7 @@ Tk_MenuObjCmd( * Tcl_EventuallyFree is called. */ - menuPtr = ckalloc(sizeof(TkMenu)); + menuPtr = (TkMenu *)ckalloc(sizeof(TkMenu)); memset(menuPtr, 0, sizeof(TkMenu)); menuPtr->tkwin = newWin; menuPtr->display = Tk_Display(newWin); @@ -620,11 +620,11 @@ MenuWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register TkMenu *menuPtr = clientData; - register TkMenuEntry *mePtr; + TkMenu *menuPtr = (TkMenu *)clientData; + TkMenuEntry *mePtr; int result = TCL_OK; int option; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -1108,7 +1108,7 @@ DestroyMenuInstance( Tcl_Obj *newObjv[2]; TkMenu *parentMasterMenuPtr; TkMenuEntry *parentMasterEntryPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1391,7 +1391,7 @@ static void DestroyMenuEntry( void *memPtr) /* Pointer to entry to be freed. */ { - register TkMenuEntry *mePtr = memPtr; + TkMenuEntry *mePtr = (TkMenuEntry *)memPtr; TkMenu *menuPtr = mePtr->menuPtr; if (menuPtr->postedCascade == mePtr) { @@ -1491,7 +1491,7 @@ static void MenuWorldChanged( ClientData instanceData) /* Information about widget. */ { - TkMenu *menuPtr = instanceData; + TkMenu *menuPtr = (TkMenu *)instanceData; TkSizeT i; TkMenuConfigureDrawOptions(menuPtr); @@ -1525,7 +1525,7 @@ MenuWorldChanged( static int ConfigureMenu( Tcl_Interp *interp, /* Used for error reporting. */ - register TkMenu *menuPtr, /* Information about widget; may or may not + TkMenu *menuPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -1533,12 +1533,12 @@ ConfigureMenu( int i; TkMenu *menuListPtr, *cleanupPtr; int result; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { - menuListPtr->errorStructPtr = ckalloc(sizeof(Tk_SavedOptions)); + menuListPtr->errorStructPtr = (Tk_SavedOptions *)ckalloc(sizeof(Tk_SavedOptions)); result = Tk_SetOptions(interp, menuListPtr, tsdPtr->menuOptionTable, objc, objv, menuListPtr->tkwin, menuListPtr->errorStructPtr, NULL); @@ -1742,7 +1742,7 @@ PostProcessEntry( name = Tcl_GetString(mePtr->namePtr); if (mePtr->childMenuRefPtr != NULL) { - oldHashKey = Tcl_GetHashKey(TkGetMenuHashTable(menuPtr->interp), + oldHashKey = (char *)Tcl_GetHashKey(TkGetMenuHashTable(menuPtr->interp), mePtr->childMenuRefPtr->hashEntryPtr); if (strcmp(oldHashKey, name) != 0) { UnhookCascadeEntry(mePtr); @@ -1908,7 +1908,7 @@ PostProcessEntry( static int ConfigureMenuEntry( - register TkMenuEntry *mePtr,/* Information about menu entry; may or may + TkMenuEntry *mePtr,/* Information about menu entry; may or may * not already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -1972,7 +1972,7 @@ ConfigureMenuEntry( static int ConfigureMenuCloneEntries( - Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Interp *dummy, /* Used for error reporting. */ TkMenu *menuPtr, /* Information about whole menu. */ int index, /* Index of mePtr within menuPtr's entries. */ int objc, /* Number of valid entries in argv. */ @@ -1984,6 +1984,7 @@ ConfigureMenuCloneEntries( TkMenuReferences *oldCascadeMenuRefPtr, *cascadeMenuRefPtr = NULL; Tcl_Obj *oldCascadePtr = NULL; const char *newCascadeName; + (void)dummy; /* * Cascades are kind of tricky here. This is special case #3 in the @@ -2206,7 +2207,7 @@ static void MenuCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkMenu *menuPtr = clientData; + TkMenu *menuPtr = (TkMenu *)clientData; Tk_Window tkwin = menuPtr->tkwin; /* @@ -2255,14 +2256,14 @@ MenuNewEntry( TkMenuEntry *mePtr; TkMenuEntry **newEntries; TkSizeT i; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * Create a new array of entries with an empty slot for the new entry. */ - newEntries = ckalloc((menuPtr->numEntries+1) * sizeof(TkMenuEntry *)); + newEntries = (TkMenuEntry **)ckalloc((menuPtr->numEntries+1) * sizeof(TkMenuEntry *)); for (i = 0; i < index; i++) { newEntries[i] = menuPtr->entries[i]; } @@ -2275,7 +2276,7 @@ MenuNewEntry( } menuPtr->entries = newEntries; menuPtr->numEntries++; - mePtr = ckalloc(sizeof(TkMenuEntry)); + mePtr = (TkMenuEntry *)ckalloc(sizeof(TkMenuEntry)); menuPtr->entries[index] = mePtr; mePtr->type = type; mePtr->optionTable = tsdPtr->entryOptionTables[type]; @@ -2491,10 +2492,12 @@ MenuVarProc( const char *name2, /* Second part of variable's name. */ int flags) /* Describes what just happened. */ { - TkMenuEntry *mePtr = clientData; + TkMenuEntry *mePtr = (TkMenuEntry *)clientData; TkMenu *menuPtr; const char *value; const char *name, *onValue; + (void)name1; + (void)name2; if (Tcl_InterpDeleted(interp) || (mePtr->namePtr == NULL)) { /* @@ -2596,11 +2599,11 @@ MenuVarProc( int TkActivateMenuEntry( - register TkMenu *menuPtr, /* Menu in which to activate. */ + TkMenu *menuPtr, /* Menu in which to activate. */ TkSizeT index) /* Index of entry to activate, or * TCL_INDEX_NONE to deactivate all entries. */ { - register TkMenuEntry *mePtr; + TkMenuEntry *mePtr; int result = TCL_OK; if (menuPtr->active != TCL_INDEX_NONE) { @@ -3286,7 +3289,7 @@ TkSetWindowMenuBar( * menu. */ - topLevelListPtr = ckalloc(sizeof(TkMenuTopLevelList)); + topLevelListPtr = (TkMenuTopLevelList *)ckalloc(sizeof(TkMenuTopLevelList)); topLevelListPtr->tkwin = tkwin; topLevelListPtr->nextPtr = menuRefPtr->topLevelListPtr; menuRefPtr->topLevelListPtr = topLevelListPtr; @@ -3316,9 +3319,11 @@ TkSetWindowMenuBar( static void DestroyMenuHashTable( ClientData clientData, /* The menu hash table we are destroying. */ - Tcl_Interp *interp) /* The interpreter we are destroying. */ + Tcl_Interp *dummy) /* The interpreter we are destroying. */ { - Tcl_DeleteHashTable(clientData); + (void)dummy; + + Tcl_DeleteHashTable((Tcl_HashTable *)clientData); ckfree(clientData); } @@ -3344,11 +3349,11 @@ Tcl_HashTable * TkGetMenuHashTable( Tcl_Interp *interp) /* The interp we need the hash table in.*/ { - Tcl_HashTable *menuTablePtr = + Tcl_HashTable *menuTablePtr = (Tcl_HashTable *) Tcl_GetAssocData(interp, MENU_HASH_KEY, NULL); if (menuTablePtr == NULL) { - menuTablePtr = ckalloc(sizeof(Tcl_HashTable)); + menuTablePtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(menuTablePtr, TCL_STRING_KEYS); Tcl_SetAssocData(interp, MENU_HASH_KEY, DestroyMenuHashTable, menuTablePtr); @@ -3389,14 +3394,14 @@ TkCreateMenuReferences( hashEntryPtr = Tcl_CreateHashEntry(menuTablePtr, pathName, &newEntry); if (newEntry) { - menuRefPtr = ckalloc(sizeof(TkMenuReferences)); + menuRefPtr = (TkMenuReferences *)ckalloc(sizeof(TkMenuReferences)); menuRefPtr->menuPtr = NULL; menuRefPtr->topLevelListPtr = NULL; menuRefPtr->parentEntryPtr = NULL; menuRefPtr->hashEntryPtr = hashEntryPtr; Tcl_SetHashValue(hashEntryPtr, menuRefPtr); } else { - menuRefPtr = Tcl_GetHashValue(hashEntryPtr); + menuRefPtr = (TkMenuReferences *)Tcl_GetHashValue(hashEntryPtr); } return menuRefPtr; } @@ -3433,7 +3438,7 @@ TkFindMenuReferences( menuTablePtr = TkGetMenuHashTable(interp); hashEntryPtr = Tcl_FindHashEntry(menuTablePtr, pathName); if (hashEntryPtr != NULL) { - menuRefPtr = Tcl_GetHashValue(hashEntryPtr); + menuRefPtr = (TkMenuReferences *)Tcl_GetHashValue(hashEntryPtr); } return menuRefPtr; } @@ -3573,8 +3578,10 @@ DeleteMenuCloneEntries( static void TkMenuCleanup( - ClientData unused) + ClientData dummy) { + (void)dummy; + menusInitialized = 0; } @@ -3598,7 +3605,7 @@ TkMenuCleanup( void TkMenuInit(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!menusInitialized) { diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index 02f5a5b..74ba9ef 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.c @@ -483,8 +483,8 @@ TkRecomputeMenu( void TkEventuallyRedrawMenu( - register TkMenu *menuPtr, /* Information about menu to redraw. */ - register TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the + TkMenu *menuPtr, /* Information about menu to redraw. */ + TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the * entries in the menu. */ { TkSizeT i; @@ -530,7 +530,7 @@ static void ComputeMenuGeometry( ClientData clientData) /* Structure describing menu. */ { - TkMenu *menuPtr = clientData; + TkMenu *menuPtr = (TkMenu *)clientData; if (menuPtr->tkwin == NULL) { return; @@ -586,7 +586,13 @@ TkMenuSelectImageProc( * <=0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkMenuEntry *mePtr = clientData; + TkMenuEntry *mePtr = (TkMenuEntry *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; if ((mePtr->entryFlags & ENTRY_SELECTED) && !(mePtr->menuPtr->menuFlags & REDRAW_PENDING)) { @@ -615,9 +621,9 @@ static void DisplayMenu( ClientData clientData) /* Information about widget. */ { - register TkMenu *menuPtr = clientData; - register TkMenuEntry *mePtr; - register Tk_Window tkwin = menuPtr->tkwin; + TkMenu *menuPtr = (TkMenu *)clientData; + TkMenuEntry *mePtr; + Tk_Window tkwin = menuPtr->tkwin; TkSizeT index; int strictMotif; Tk_Font tkfont; @@ -730,7 +736,7 @@ TkMenuEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkMenu *menuPtr = clientData; + TkMenu *menuPtr = (TkMenu *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkEventuallyRedrawMenu(menuPtr, NULL); @@ -795,7 +801,13 @@ TkMenuImageProc( * <=0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkMenu *menuPtr = ((TkMenuEntry *) clientData)->menuPtr; + TkMenu *menuPtr = (TkMenu *)((TkMenuEntry *) clientData)->menuPtr; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; if ((menuPtr->tkwin != NULL) && !(menuPtr->menuFlags & RESIZE_PENDING)) { menuPtr->menuFlags |= RESIZE_PENDING; @@ -853,8 +865,8 @@ int TkPostSubmenu( Tcl_Interp *interp, /* Used for invoking sub-commands and * reporting errors. */ - register TkMenu *menuPtr, /* Information about menu as a whole. */ - register TkMenuEntry *mePtr)/* Info about submenu that is to be posted. + TkMenu *menuPtr, /* Information about menu as a whole. */ + TkMenuEntry *mePtr)/* Info about submenu that is to be posted. * NULL means make sure that no submenu is * posted. */ { diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 4cf102f..ff1ce6d 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -212,14 +212,15 @@ static void DestroyMenuButton(char *memPtr); int Tk_MenubuttonObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkMenuButton *mbPtr; + TkMenuButton *mbPtr; Tk_OptionTable optionTable; Tk_Window tkwin; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -347,7 +348,7 @@ MenuButtonWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; int result, index; Tcl_Obj *objPtr; @@ -422,7 +423,7 @@ static void DestroyMenuButton( char *memPtr) /* Info about button widget. */ { - register TkMenuButton *mbPtr = (TkMenuButton *) memPtr; + TkMenuButton *mbPtr = (TkMenuButton *) memPtr; TkpDestroyMenuButton(mbPtr); if (mbPtr->flags & REDRAW_PENDING) { @@ -490,7 +491,7 @@ DestroyMenuButton( static int ConfigureMenuButton( Tcl_Interp *interp, /* Used for error reporting. */ - register TkMenuButton *mbPtr, + TkMenuButton *mbPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ @@ -633,7 +634,7 @@ ConfigureMenuButton( if (mbPtr->text != NULL) { ckfree(mbPtr->text); } - mbPtr->text = ckalloc(strlen(value) + 1); + mbPtr->text = (char *)ckalloc(strlen(value) + 1); strcpy(mbPtr->text, value); } Tcl_TraceVar2(interp, mbPtr->textVarName, NULL, @@ -675,7 +676,7 @@ TkMenuButtonWorldChanged( XGCValues gcValues; GC gc; unsigned long mask; - TkMenuButton *mbPtr = instanceData; + TkMenuButton *mbPtr = (TkMenuButton *)instanceData; gcValues.font = Tk_FontId(mbPtr->tkfont); gcValues.foreground = mbPtr->normalFg->pixel; @@ -776,7 +777,7 @@ MenuButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; @@ -835,7 +836,7 @@ static void MenuButtonCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; Tk_Window tkwin = mbPtr->tkwin; /* @@ -877,9 +878,11 @@ MenuButtonTextVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; const char *value; - unsigned len; + size_t len; + (void)name1; + (void)name2; /* * If the variable is unset, then immediately recreate it unless the whole @@ -924,8 +927,8 @@ MenuButtonTextVarProc( if (mbPtr->text != NULL) { ckfree(mbPtr->text); } - len = 1 + (unsigned) strlen(value); - mbPtr->text = ckalloc(len); + len = 1 + strlen(value); + mbPtr->text = (char *)ckalloc(len); memcpy(mbPtr->text, value, len); TkpComputeMenuButtonGeometry(mbPtr); @@ -964,7 +967,13 @@ MenuButtonImageProc( * 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; if (mbPtr->tkwin != NULL) { TkpComputeMenuButtonGeometry(mbPtr); diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 29daf3b..b7e7ea3 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -180,7 +180,7 @@ static void MessageWorldChanged(ClientData instanceData); static void ComputeMessageGeometry(Message *msgPtr); static int ConfigureMessage(Tcl_Interp *interp, Message *msgPtr, int objc, Tcl_Obj *const objv[], int flags); -static void DestroyMessage(char *memPtr); +static void DestroyMessage(void *memPtr); static void DisplayMessage(ClientData clientData); /* @@ -214,14 +214,15 @@ static const Tk_ClassProcs messageClass = { int Tk_MessageObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register Message *msgPtr; + Message *msgPtr; Tk_OptionTable optionTable; Tk_Window tkwin; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -241,7 +242,7 @@ Tk_MessageObjCmd( optionTable = Tk_CreateOptionTable(interp, optionSpecs); - msgPtr = ckalloc(sizeof(Message)); + msgPtr = (Message *)ckalloc(sizeof(Message)); memset(msgPtr, 0, sizeof(Message)); /* @@ -306,7 +307,7 @@ MessageWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register Message *msgPtr = clientData; + Message *msgPtr = (Message *)clientData; static const char *const optionStrings[] = { "cget", "configure", NULL }; enum options { MESSAGE_CGET, MESSAGE_CONFIGURE }; int index; @@ -382,9 +383,9 @@ MessageWidgetObjCmd( static void DestroyMessage( - char *memPtr) /* Info about message widget. */ + void *memPtr) /* Info about message widget. */ { - register Message *msgPtr = (Message *) memPtr; + Message *msgPtr = (Message *) memPtr; msgPtr->flags |= MESSAGE_DELETED; @@ -437,13 +438,14 @@ DestroyMessage( static int ConfigureMessage( Tcl_Interp *interp, /* Used for error reporting. */ - register Message *msgPtr, /* Information about widget; may or may not + Message *msgPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { Tk_SavedOptions savedOptions; + (void)flags; /* * Eliminate any existing trace on a variable monitored by the message. @@ -478,7 +480,7 @@ ConfigureMessage( if (msgPtr->string != NULL) { ckfree(msgPtr->string); } - msgPtr->string = strcpy(ckalloc(strlen(value) + 1), value); + msgPtr->string = strcpy((char *)ckalloc(strlen(value) + 1), value); } Tcl_TraceVar2(interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, @@ -527,7 +529,7 @@ MessageWorldChanged( XGCValues gcValues; GC gc = NULL; Tk_FontMetrics fm; - Message *msgPtr = instanceData; + Message *msgPtr = (Message *)instanceData; if (msgPtr->border != NULL) { Tk_SetBackgroundFromBorder(msgPtr->tkwin, msgPtr->border); @@ -582,7 +584,7 @@ MessageWorldChanged( static void ComputeMessageGeometry( - register Message *msgPtr) /* Information about window. */ + Message *msgPtr) /* Information about window. */ { int width, inc, height; int thisWidth, thisHeight, maxWidth; @@ -666,8 +668,8 @@ static void DisplayMessage( ClientData clientData) /* Information about window. */ { - register Message *msgPtr = clientData; - register Tk_Window tkwin = msgPtr->tkwin; + Message *msgPtr = (Message *)clientData; + Tk_Window tkwin = msgPtr->tkwin; int x, y; int borderWidth = msgPtr->highlightWidth; @@ -742,7 +744,7 @@ MessageEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Message *msgPtr = clientData; + Message *msgPtr = (Message *)clientData; if (((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) || (eventPtr->type == ConfigureNotify)) { @@ -795,7 +797,7 @@ static void MessageCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Message *msgPtr = clientData; + Message *msgPtr = (Message *)clientData; /* * This function could be invoked either because the window was destroyed @@ -835,8 +837,10 @@ MessageTextVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register Message *msgPtr = clientData; + Message *msgPtr = (Message *)clientData; const char *value; + (void)name1; + (void)name2; /* * If the variable is unset, then immediately recreate it unless the whole @@ -882,7 +886,7 @@ MessageTextVarProc( ckfree(msgPtr->string); } msgPtr->numChars = Tcl_NumUtfChars(value, -1); - msgPtr->string = ckalloc(strlen(value) + 1); + msgPtr->string = (char *)ckalloc(strlen(value) + 1); strcpy(msgPtr->string, value); ComputeMessageGeometry(msgPtr); diff --git a/generic/tkObj.c b/generic/tkObj.c index 1a98db6..44efe8f 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -153,7 +153,7 @@ static const Tcl_ObjType windowObjType = { static ThreadSpecificData * GetTypeCache(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->doubleTypePtr == NULL) { @@ -412,8 +412,8 @@ FreePixelInternalRep( static void DupPixelInternalRep( - register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */ - register Tcl_Obj *copyPtr) /* Object with internal rep to set. */ + Tcl_Obj *srcPtr, /* Object with internal rep to copy. */ + Tcl_Obj *copyPtr) /* Object with internal rep to set. */ { copyPtr->typePtr = srcPtr->typePtr; @@ -423,7 +423,7 @@ DupPixelInternalRep( PixelRep *oldPtr, *newPtr; oldPtr = GET_COMPLEXPIXEL(srcPtr); - newPtr = ckalloc(sizeof(PixelRep)); + newPtr = (PixelRep *)ckalloc(sizeof(PixelRep)); newPtr->value = oldPtr->value; newPtr->units = oldPtr->units; newPtr->tkwin = oldPtr->tkwin; @@ -507,7 +507,7 @@ SetPixelFromAny( if ((units < 0) && (i == d)) { SET_SIMPLEPIXEL(objPtr, i); } else { - PixelRep *pixelPtr = ckalloc(sizeof(PixelRep)); + PixelRep *pixelPtr = (PixelRep *)ckalloc(sizeof(PixelRep)); pixelPtr->value = d; pixelPtr->units = units; @@ -568,7 +568,7 @@ Tk_GetMMFromObj( } } - mmPtr = objPtr->internalRep.twoPtrValue.ptr1; + mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1; if (mmPtr->tkwin != tkwin) { d = mmPtr->value; if (mmPtr->units == -1) { @@ -632,14 +632,14 @@ FreeMMInternalRep( static void DupMMInternalRep( - register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */ - register Tcl_Obj *copyPtr) /* Object with internal rep to set. */ + Tcl_Obj *srcPtr, /* Object with internal rep to copy. */ + Tcl_Obj *copyPtr) /* Object with internal rep to set. */ { MMRep *oldPtr, *newPtr; copyPtr->typePtr = srcPtr->typePtr; - oldPtr = srcPtr->internalRep.twoPtrValue.ptr1; - newPtr = ckalloc(sizeof(MMRep)); + oldPtr = (MMRep *)srcPtr->internalRep.twoPtrValue.ptr1; + newPtr = (MMRep *)ckalloc(sizeof(MMRep)); newPtr->value = oldPtr->value; newPtr->units = oldPtr->units; newPtr->tkwin = oldPtr->tkwin; @@ -668,13 +668,13 @@ DupMMInternalRep( static void UpdateStringOfMM( - register Tcl_Obj *objPtr) /* pixel obj with string rep to update. */ + Tcl_Obj *objPtr) /* pixel obj with string rep to update. */ { MMRep *mmPtr; char buffer[TCL_DOUBLE_SPACE]; TkSizeT len; - mmPtr = objPtr->internalRep.twoPtrValue.ptr1; + mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1; /* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */ if ((mmPtr->units != -1) || (objPtr->bytes != NULL)) { Tcl_Panic("UpdateStringOfMM: false precondition"); @@ -683,7 +683,7 @@ UpdateStringOfMM( Tcl_PrintDouble(NULL, mmPtr->value, buffer); len = strlen(buffer); - objPtr->bytes = ckalloc(len + 1); + objPtr->bytes = (char *)ckalloc(len + 1); strcpy(objPtr->bytes, buffer); objPtr->length = len; } @@ -791,7 +791,7 @@ SetMMFromAny( objPtr->typePtr = &mmObjType; - mmPtr = ckalloc(sizeof(MMRep)); + mmPtr = (MMRep *)ckalloc(sizeof(MMRep)); mmPtr->value = d; mmPtr->units = units; mmPtr->tkwin = NULL; @@ -831,7 +831,7 @@ TkGetWindowFromObj( Tk_Window *windowPtr) /* Place to store resulting window. */ { TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr; - register WindowRep *winPtr; + WindowRep *winPtr; if (objPtr->typePtr != &windowObjType) { int result = SetWindowFromAny(interp, objPtr); @@ -840,7 +840,7 @@ TkGetWindowFromObj( } } - winPtr = objPtr->internalRep.twoPtrValue.ptr1; + winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1; if (winPtr->tkwin == NULL || winPtr->mainPtr == NULL || winPtr->mainPtr != mainPtr @@ -886,11 +886,12 @@ TkGetWindowFromObj( static int SetWindowFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ - register Tcl_Obj *objPtr) /* The object to convert. */ + Tcl_Interp *dummy, /* Used for error reporting if not NULL. */ + Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; WindowRep *winPtr; + (void)dummy; /* * Free the old internalRep before setting the new one. @@ -902,7 +903,7 @@ SetWindowFromAny( typePtr->freeIntRepProc(objPtr); } - winPtr = ckalloc(sizeof(WindowRep)); + winPtr = (WindowRep *)ckalloc(sizeof(WindowRep)); winPtr->tkwin = NULL; winPtr->mainPtr = NULL; winPtr->epoch = 0; @@ -933,13 +934,13 @@ SetWindowFromAny( static void DupWindowInternalRep( - register Tcl_Obj *srcPtr, - register Tcl_Obj *copyPtr) + Tcl_Obj *srcPtr, + Tcl_Obj *copyPtr) { - register WindowRep *oldPtr, *newPtr; + WindowRep *oldPtr, *newPtr; - oldPtr = srcPtr->internalRep.twoPtrValue.ptr1; - newPtr = ckalloc(sizeof(WindowRep)); + oldPtr = (WindowRep *)srcPtr->internalRep.twoPtrValue.ptr1; + newPtr = (WindowRep *)ckalloc(sizeof(WindowRep)); newPtr->tkwin = oldPtr->tkwin; newPtr->mainPtr = oldPtr->mainPtr; newPtr->epoch = oldPtr->epoch; @@ -997,11 +998,11 @@ TkNewWindowObj( { Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr; - register WindowRep *winPtr; + WindowRep *winPtr; SetWindowFromAny(NULL, objPtr); - winPtr = objPtr->internalRep.twoPtrValue.ptr1; + winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1; winPtr->tkwin = tkwin; winPtr->mainPtr = mainPtr; winPtr->epoch = mainPtr->deletionEpoch; diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index d83c30b..67ac6e9 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -86,7 +86,7 @@ Tk_ConfigureWidget( * considered. Also, may have * TK_CONFIG_ARGV_ONLY set. */ { - register Tk_ConfigSpec *specPtr, *staticSpecs; + Tk_ConfigSpec *specPtr, *staticSpecs; Tk_Uid value; /* Value of option from database. */ int needFlags; /* Specs must contain this set of flags or * else they are not considered. */ @@ -249,8 +249,8 @@ FindConfigSpec( int hateFlags) /* Flags that must NOT be present in matching * entry. */ { - register Tk_ConfigSpec *specPtr; - register char c; /* First character of current argument. */ + Tk_ConfigSpec *specPtr; + char c; /* First character of current argument. */ Tk_ConfigSpec *matchPtr; /* Matching spec, or NULL. */ size_t length; @@ -380,7 +380,7 @@ DoConfig( if (nullValue) { newStr = NULL; } else { - newStr = ckalloc(strlen(value) + 1); + newStr = (char *)ckalloc(strlen(value) + 1); strcpy(newStr, value); } oldStr = *((char **) ptr); @@ -550,7 +550,7 @@ DoConfig( } case TK_CONFIG_CUSTOM: if (specPtr->customPtr->parseProc(specPtr->customPtr->clientData, - interp, tkwin, value, widgRec, specPtr->offset)!=TCL_OK) { + interp, tkwin, value, (char *)widgRec, specPtr->offset)!=TCL_OK) { return TCL_ERROR; } break; @@ -607,7 +607,7 @@ Tk_ConfigureInfo( * be present in config specs for them to be * considered. */ { - register Tk_ConfigSpec *specPtr, *staticSpecs; + Tk_ConfigSpec *specPtr, *staticSpecs; int needFlags, hateFlags; char *list; const char *leader = "{"; @@ -690,7 +690,7 @@ FormatConfigInfo( Tcl_Interp *interp, /* Interpreter to use for things like * floating-point precision. */ Tk_Window tkwin, /* Window corresponding to widget. */ - register const Tk_ConfigSpec *specPtr, + const Tk_ConfigSpec *specPtr, /* Pointer to information describing * option. */ void *widgRec) /* Pointer to record holding current values of @@ -878,7 +878,7 @@ FormatConfigValue( } case TK_CONFIG_CUSTOM: result = specPtr->customPtr->printProc(specPtr->customPtr->clientData, - tkwin, widgRec, specPtr->offset, freeProcPtr); + tkwin, (char *)widgRec, specPtr->offset, freeProcPtr); break; default: result = "?? unknown type ??"; @@ -988,7 +988,7 @@ Tk_FreeOptions( * be present in config specs for them to be * considered. */ { - register const Tk_ConfigSpec *specPtr; + const Tk_ConfigSpec *specPtr; char *ptr; for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) { @@ -1076,10 +1076,10 @@ GetCachedSpecs( * self-initializing code. */ - specCacheTablePtr = + specCacheTablePtr = (Tcl_HashTable *) Tcl_GetAssocData(interp, "tkConfigSpec.threadTable", NULL); if (specCacheTablePtr == NULL) { - specCacheTablePtr = ckalloc(sizeof(Tcl_HashTable)); + specCacheTablePtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(specCacheTablePtr, TCL_ONE_WORD_KEYS); Tcl_SetAssocData(interp, "tkConfigSpec.threadTable", DeleteSpecCacheTable, specCacheTablePtr); @@ -1093,7 +1093,7 @@ GetCachedSpecs( entryPtr = Tcl_CreateHashEntry(specCacheTablePtr, (char *) staticSpecs, &isNew); if (isNew) { - unsigned int entrySpace = sizeof(Tk_ConfigSpec); + size_t entrySpace = sizeof(Tk_ConfigSpec); const Tk_ConfigSpec *staticSpecPtr; Tk_ConfigSpec *specPtr; @@ -1112,7 +1112,7 @@ GetCachedSpecs( * from the master copy. */ - cachedSpecs = ckalloc(entrySpace); + cachedSpecs = (Tk_ConfigSpec *)ckalloc(entrySpace); memcpy(cachedSpecs, staticSpecs, entrySpace); Tcl_SetHashValue(entryPtr, cachedSpecs); @@ -1136,7 +1136,7 @@ GetCachedSpecs( } } } else { - cachedSpecs = Tcl_GetHashValue(entryPtr); + cachedSpecs = (Tk_ConfigSpec *)Tcl_GetHashValue(entryPtr); } return cachedSpecs; @@ -1162,11 +1162,12 @@ GetCachedSpecs( static void DeleteSpecCacheTable( ClientData clientData, - Tcl_Interp *interp) + Tcl_Interp *dummy) { - Tcl_HashTable *tablePtr = clientData; + Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData; Tcl_HashEntry *entryPtr; Tcl_HashSearch search; + (void)dummy; for (entryPtr = Tcl_FirstHashEntry(tablePtr,&search); entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c index 948883d..50d036d 100644 --- a/generic/tkOldTest.c +++ b/generic/tkOldTest.c @@ -106,9 +106,10 @@ static int ImageObjCmd(ClientData dummy, int TkOldTestInit( - Tcl_Interp *interp) + Tcl_Interp *dummy) { static int initialized = 0; + (void)dummy; if (!initialized) { initialized = 1; @@ -151,6 +152,7 @@ ImageCreate( TImageMaster *timPtr; const char *varName; int i; + (void)typePtr; varName = "log"; for (i = 0; i < argc; i += 2) { @@ -167,14 +169,14 @@ ImageCreate( varName = argv[i+1]; } - timPtr = ckalloc(sizeof(TImageMaster)); + timPtr = (TImageMaster *)ckalloc(sizeof(TImageMaster)); timPtr->master = master; timPtr->interp = interp; timPtr->width = 30; timPtr->height = 15; - timPtr->imageName = ckalloc(strlen(name) + 1); + timPtr->imageName = (char *)ckalloc(strlen(name) + 1); strcpy(timPtr->imageName, name); - timPtr->varName = ckalloc(strlen(varName) + 1); + timPtr->varName = (char *)ckalloc(strlen(varName) + 1); strcpy(timPtr->varName, varName); Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); *clientDataPtr = timPtr; @@ -207,7 +209,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; int x, y, width, height; if (objc < 2) { @@ -262,7 +264,7 @@ ImageGet( * used. */ ClientData clientData) /* Pointer to TImageMaster for image. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -271,7 +273,7 @@ ImageGet( Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - instPtr = ckalloc(sizeof(TImageInstance)); + instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance)); instPtr->masterPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; @@ -309,7 +311,7 @@ ImageDisplay( /* Coordinates in drawable corresponding to * imageX and imageY. */ { - TImageInstance *instPtr = clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200 + TCL_INTEGER_SPACE * 6]; sprintf(buffer, "%s display %d %d %d %d %d %d", @@ -354,7 +356,7 @@ ImageFree( ClientData clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { - TImageInstance *instPtr = clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200]; sprintf(buffer, "%s free", instPtr->masterPtr->imageName); @@ -388,7 +390,7 @@ ImageDelete( * this function is called, no more instances * exist. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); diff --git a/generic/tkOption.c b/generic/tkOption.c index 5754dbf..64832ad 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.c @@ -254,16 +254,16 @@ Tk_AddOption( * TK_MAX_PRIO. */ { TkWindow *winPtr = ((TkWindow *) tkwin)->mainPtr->winPtr; - register ElArray **arrayPtrPtr; - register Element *elPtr; + ElArray **arrayPtrPtr; + Element *elPtr; Element newEl; - register const char *p; + const char *p; const char *field; int count, firstField; size_t length; #define TMP_SIZE 100 char tmp[TMP_SIZE+1]; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->mainPtr->optionRootPtr == NULL) { @@ -407,11 +407,11 @@ Tk_GetOption( { Tk_Uid nameId, classId = NULL; char *masqName; - register Element *elPtr, *bestPtr; - register int count; + Element *elPtr, *bestPtr; + int count; StackLevel *levelPtr; int stackDepth[NUM_STACKS]; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -521,8 +521,8 @@ Tk_GetOption( if (masqName != NULL) { char *masqClass; Tk_Uid nodeId, winClassId, winNameId; - unsigned int classNameLength; - register Element *nodePtr, *leafPtr; + size_t classNameLength; + Element *nodePtr, *leafPtr; static const int searchOrder[] = { EXACT_NODE_NAME, WILDCARD_NODE_NAME, EXACT_NODE_CLASS, WILDCARD_NODE_CLASS, -1 @@ -535,7 +535,7 @@ Tk_GetOption( */ classNameLength = (unsigned) (masqName - name); - masqClass = ckalloc(classNameLength + 1); + masqClass = (char *)ckalloc(classNameLength + 1); strncpy(masqClass, name, classNameLength); masqClass[classNameLength] = '\0'; @@ -615,9 +615,9 @@ Tk_OptionObjCmd( int objc, /* Number of Tcl_Obj arguments. */ Tcl_Obj *const objv[]) /* Tcl_Obj arguments. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int index, result; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); static const char *const optionCmds[] = { "add", "clear", "get", "readfile", NULL @@ -738,9 +738,9 @@ Tk_OptionObjCmd( void TkOptionDeadWindow( - register TkWindow *winPtr) /* Window to be cleaned up. */ + TkWindow *winPtr) /* Window to be cleaned up. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -796,7 +796,7 @@ TkOptionClassChanged( { int i, j, *basePtr; ElArray *arrayPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->optionLevel == -1) { @@ -922,7 +922,7 @@ AddFromString( * TK_INTERACTIVE_PRIO. Must be between 0 and * TK_MAX_PRIO. */ { - register char *src, *dst; + char *src, *dst; char *name, *value; int lineNum; @@ -1150,7 +1150,7 @@ static ElArray * NewArray( int numEls) /* How many elements of space to allocate. */ { - register ElArray *arrayPtr = ckalloc(EL_ARRAY_SIZE(numEls)); + ElArray *arrayPtr = (ElArray *)ckalloc(EL_ARRAY_SIZE(numEls)); arrayPtr->arraySize = numEls; arrayPtr->numUsed = 0; @@ -1177,17 +1177,17 @@ NewArray( static ElArray * ExtendArray( - register ElArray *arrayPtr, /* Array to be extended. */ - register Element *elPtr) /* Element to be copied into array. */ + ElArray *arrayPtr, /* Array to be extended. */ + Element *elPtr) /* Element to be copied into array. */ { /* * If the current array has filled up, make it bigger. */ if (arrayPtr->numUsed >= arrayPtr->arraySize) { - register int newSize = 2*arrayPtr->arraySize; + int newSize = 2*arrayPtr->arraySize; - arrayPtr = ckrealloc(arrayPtr, EL_ARRAY_SIZE(newSize)); + arrayPtr = (ElArray *)ckrealloc(arrayPtr, EL_ARRAY_SIZE(newSize)); arrayPtr->arraySize = newSize; arrayPtr->nextToUse = &arrayPtr->els[arrayPtr->numUsed]; } @@ -1226,9 +1226,9 @@ SetupStacks( { int level, i; const int *iPtr; - register StackLevel *levelPtr; - register ElArray *arrayPtr; - ThreadSpecificData *tsdPtr = + StackLevel *levelPtr; + ElArray *arrayPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1305,7 +1305,7 @@ SetupStacks( */ if (tsdPtr->curLevel >= tsdPtr->numLevels) { - StackLevel *newLevels = + StackLevel *newLevels = (StackLevel *) ckalloc(tsdPtr->numLevels * 2 * sizeof(StackLevel)); memcpy(newLevels, tsdPtr->levels, @@ -1332,7 +1332,7 @@ SetupStacks( */ for (iPtr = searchOrder; *iPtr != -1; iPtr++) { - register Element *elPtr; + Element *elPtr; int count; Tk_Uid id; @@ -1387,9 +1387,9 @@ ExtendStacks( int leaf) /* If zero, then don't copy exact leaf * elements. */ { - register int count; - register Element *elPtr; - ThreadSpecificData *tsdPtr = + int count; + Element *elPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (elPtr = arrayPtr->els, count = arrayPtr->numUsed; @@ -1420,10 +1420,11 @@ ExtendStacks( static void OptionThreadExitProc( - ClientData clientData) /* not used */ + ClientData dummy) /* not used */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; if (tsdPtr->initialized) { int i; @@ -1454,13 +1455,13 @@ OptionThreadExitProc( static void OptionInit( - register TkMainInfo *mainPtr) + TkMainInfo *mainPtr) /* Top-level information about window that * isn't initialized yet. */ { int i; Tcl_Interp *interp; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Element *defaultMatchPtr = &tsdPtr->defaultMatch; @@ -1475,7 +1476,7 @@ OptionInit( tsdPtr->curLevel = -1; tsdPtr->serial = 0; - tsdPtr->levels = ckalloc(5 * sizeof(StackLevel)); + tsdPtr->levels = (StackLevel *)ckalloc(5 * sizeof(StackLevel)); for (i = 0; i < NUM_STACKS; i++) { tsdPtr->stacks[i] = NewArray(10); tsdPtr->levels[0].bases[i] = 0; @@ -1522,7 +1523,7 @@ ClearOptionTree( ElArray *arrayPtr) /* Array of options; delete everything * referred to recursively by this. */ { - register Element *elPtr; + Element *elPtr; int count; for (count = arrayPtr->numUsed, elPtr = arrayPtr->els; count > 0; diff --git a/generic/tkPack.c b/generic/tkPack.c index faa3533..4c41e0f 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -196,7 +196,7 @@ Tk_PackObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; const char *argv2; static const char *const optionStrings[] = { #ifndef TK_NO_DEPRECATED @@ -259,7 +259,7 @@ Tk_PackObjCmd( } case PACK_APPEND: { Packer *masterPtr; - register Packer *prevPtr; + Packer *prevPtr; Tk_Window tkwin2; if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { @@ -276,7 +276,7 @@ Tk_PackObjCmd( } case PACK_BEFORE: { Packer *packPtr, *masterPtr; - register Packer *prevPtr; + Packer *prevPtr; Tk_Window tkwin2; if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { @@ -337,7 +337,7 @@ Tk_PackObjCmd( break; } case PACK_INFO: { - register Packer *slavePtr; + Packer *slavePtr; Tk_Window slave; Tcl_Obj *infoObj; @@ -523,7 +523,8 @@ PackReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - register Packer *packPtr = clientData; + Packer *packPtr = (Packer *)clientData; + (void)tkwin; packPtr = packPtr->masterPtr; if (!(packPtr->flags & REQUESTED_REPACK)) { @@ -556,7 +557,8 @@ PackLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Packer *slavePtr = clientData; + Packer *slavePtr = (Packer *)clientData; + (void)tkwin; if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); @@ -589,8 +591,8 @@ ArrangePacking( ClientData clientData) /* Structure describing master whose slaves * are to be re-layed out. */ { - register Packer *masterPtr = clientData; - register Packer *slavePtr; + Packer *masterPtr = (Packer *)clientData; + Packer *slavePtr; int cavityX, cavityY, cavityWidth, cavityHeight; /* These variables keep track of the * as-yet-unallocated space remaining in the @@ -913,7 +915,7 @@ ArrangePacking( static int XExpansion( - register Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *slavePtr, /* First in list of remaining slaves. */ int cavityWidth) /* Horizontal space left for all remaining * slaves. */ { @@ -979,7 +981,7 @@ XExpansion( static int YExpansion( - register Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *slavePtr, /* First in list of remaining slaves. */ int cavityHeight) /* Vertical space left for all remaining * slaves. */ { @@ -1042,7 +1044,7 @@ GetPacker( Tk_Window tkwin) /* Token for window for which packer structure * is desired. */ { - register Packer *packPtr; + Packer *packPtr; Tcl_HashEntry *hPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -1060,9 +1062,9 @@ GetPacker( hPtr = Tcl_CreateHashEntry(&dispPtr->packerHashTable, (char *) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Packer *)Tcl_GetHashValue(hPtr); } - packPtr = ckalloc(sizeof(Packer)); + packPtr = (Packer *)ckalloc(sizeof(Packer)); packPtr->tkwin = tkwin; packPtr->masterPtr = NULL; packPtr->nextPtr = NULL; @@ -1112,7 +1114,7 @@ PackAfter( * window name and side against which to * pack. */ { - register Packer *packPtr; + Packer *packPtr; Tk_Window tkwin, ancestor, parent; Tcl_Obj **options; int index, optionCount, c; @@ -1340,9 +1342,9 @@ PackAfter( static void Unlink( - register Packer *packPtr) /* Window to unlink. */ + Packer *packPtr) /* Window to unlink. */ { - register Packer *masterPtr, *packPtr2; + Packer *masterPtr, *packPtr2; masterPtr = packPtr->masterPtr; if (masterPtr == NULL) { @@ -1410,7 +1412,7 @@ DestroyPacker( void *memPtr) /* Info about packed window that is now * dead. */ { - register Packer *packPtr = memPtr; + Packer *packPtr = (Packer *)memPtr; ckfree(packPtr); } @@ -1439,7 +1441,7 @@ PackStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Packer *packPtr = clientData; + Packer *packPtr = (Packer *)clientData; if (eventPtr->type == ConfigureNotify) { if ((packPtr->slavePtr != NULL) @@ -1456,7 +1458,7 @@ PackStructureProc( } } } else if (eventPtr->type == DestroyNotify) { - register Packer *slavePtr, *nextPtr; + Packer *slavePtr, *nextPtr; if (packPtr->masterPtr != NULL) { Unlink(packPtr); @@ -1494,7 +1496,7 @@ PackStructureProc( Tcl_DoWhenIdle(ArrangePacking, packPtr); } } else if (eventPtr->type == UnmapNotify) { - register Packer *packPtr2; + Packer *packPtr2; /* * Unmap all of the slaves when the master gets unmapped, so that they diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index a34a372..37bb699 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -383,7 +383,7 @@ static const Tk_OptionSpec slaveOptionSpecs[] = { int Tk_PanedWindowObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ @@ -392,6 +392,7 @@ Tk_PanedWindowObjCmd( Tk_Window tkwin, parent; OptionTables *pwOpts; XSetWindowAttributes atts; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -414,7 +415,7 @@ Tk_PanedWindowObjCmd( * easy access to it in the future. */ - pwOpts = ckalloc(sizeof(OptionTables)); + pwOpts = (OptionTables *)ckalloc(sizeof(OptionTables)); /* * Set up an exit handler to free the optionTables struct. @@ -437,7 +438,7 @@ Tk_PanedWindowObjCmd( * Allocate and initialize the widget record. */ - pwPtr = ckalloc(sizeof(PanedWindow)); + pwPtr = (PanedWindow *)ckalloc(sizeof(PanedWindow)); memset((void *)pwPtr, 0, (sizeof(PanedWindow))); pwPtr->tkwin = tkwin; pwPtr->display = Tk_Display(tkwin); @@ -535,7 +536,7 @@ PanedWindowWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; int result = TCL_OK; static const char *const optionStrings[] = { "add", "cget", "configure", "forget", "identify", "panecget", @@ -903,7 +904,7 @@ ConfigureSlaves( * structures may already have existed, some may be new. */ - inserts = ckalloc(sizeof(Slave *) * (firstOptionArg - 2)); + inserts = (Slave **)ckalloc(sizeof(Slave *) * (firstOptionArg - 2)); insertIndex = 0; /* @@ -970,7 +971,7 @@ ConfigureSlaves( * out with their "natural" dimensions. */ - slavePtr = ckalloc(sizeof(Slave)); + slavePtr = (Slave *)ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); Tk_InitOptions(interp, slavePtr, pwPtr->slaveOpts, pwPtr->tkwin); @@ -1010,7 +1011,7 @@ ConfigureSlaves( */ i = sizeof(Slave *) * (pwPtr->numSlaves + numNewSlaves); - newSlaves = ckalloc(i); + newSlaves = (Slave **)ckalloc(i); memset(newSlaves, 0, i); if (index == -1) { /* @@ -1295,7 +1296,7 @@ PanedWindowWorldChanged( { XGCValues gcValues; GC newGC; - PanedWindow *pwPtr = instanceData; + PanedWindow *pwPtr = (PanedWindow *)instanceData; /* * Allocated a graphics context for drawing the paned window widget @@ -1352,7 +1353,7 @@ PanedWindowEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; int i; if (eventPtr->type == Expose) { @@ -1405,7 +1406,7 @@ static void PanedWindowCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; /* * This function could be invoked either because the window was destroyed @@ -1442,7 +1443,7 @@ static void DisplayPanedWindow( ClientData clientData) /* Information about window. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; Slave *slavePtr; Pixmap pixmap; Tk_Window tkwin = pwPtr->tkwin; @@ -1630,8 +1631,9 @@ PanedWindowReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; + (void)tkwin; if (Tk_IsMapped(pwPtr->tkwin)) { if (!(pwPtr->flags & RESIZE_PENDING)) { @@ -1675,8 +1677,9 @@ PanedWindowLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; + (void)tkwin; if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin); @@ -1714,8 +1717,8 @@ ArrangePanes( ClientData clientData) /* Structure describing parent whose slaves * are to be re-layed out. */ { - register PanedWindow *pwPtr = clientData; - register Slave *slavePtr; + PanedWindow *pwPtr = (PanedWindow *)clientData; + Slave *slavePtr; int i, slaveWidth, slaveHeight, slaveX, slaveY; int paneWidth, paneHeight, paneSize, paneMinSize; int doubleBw; @@ -2014,9 +2017,9 @@ ArrangePanes( static void Unlink( - register Slave *slavePtr) /* Window to unlink. */ + Slave *slavePtr) /* Window to unlink. */ { - register PanedWindow *masterPtr; + PanedWindow *masterPtr; int i, j; masterPtr = slavePtr->masterPtr; @@ -2160,7 +2163,7 @@ SlaveStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; PanedWindow *pwPtr = slavePtr->masterPtr; if (eventPtr->type == DestroyNotify) { @@ -2370,8 +2373,10 @@ ComputeGeometry( static void DestroyOptionTables( ClientData clientData, /* Pointer to the OptionTables struct */ - Tcl_Interp *interp) /* Pointer to the calling interp */ + Tcl_Interp *dummy) /* Pointer to the calling interp */ { + (void)dummy; + ckfree(clientData); } @@ -2394,7 +2399,7 @@ DestroyOptionTables( static Tcl_Obj * GetSticky( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *recordPtr, /* Pointer to widget record. */ int internalOffset) /* Offset within *recordPtr containing the @@ -2403,6 +2408,8 @@ GetSticky( int sticky = *(int *)(recordPtr + internalOffset); char buffer[5]; char *p = &buffer[0]; + (void)dummy; + (void)tkwin; if (sticky & STICK_NORTH) { *p++ = 'n'; @@ -2442,7 +2449,7 @@ GetSticky( static int SetSticky( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, /* Current interp; may be used for errors. */ Tk_Window tkwin, /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. @@ -2458,6 +2465,8 @@ SetSticky( char c; void *internalPtr; const char *string; + (void)dummy; + (void)tkwin; internalPtr = ComputeSlotAddress(recordPtr, internalOffset); @@ -2522,11 +2531,14 @@ SetSticky( static void RestoreSticky( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *internalPtr, /* Pointer to storage for value. */ char *oldInternalPtr) /* Pointer to old value. */ { + (void)dummy; + (void)tkwin; + *(int *)internalPtr = *(int *)oldInternalPtr; } @@ -2755,7 +2767,7 @@ ProxyWindowEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; if (eventPtr->type == Expose) { if (pwPtr->proxywin != NULL &&!(pwPtr->flags & PROXY_REDRAW_PENDING)) { @@ -2787,7 +2799,7 @@ static void DisplayProxyWindow( ClientData clientData) /* Information about window. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; Pixmap pixmap; Tk_Window tkwin = pwPtr->proxywin; pwPtr->flags &= ~PROXY_REDRAW_PENDING; diff --git a/generic/tkPlace.c b/generic/tkPlace.c index a64a64b..00e3f7a 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -208,7 +208,7 @@ Tk_PlaceObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window main_win = clientData; + Tk_Window main_win = (Tk_Window)clientData; Tk_Window tkwin; Slave *slavePtr; TkDisplay *dispPtr; @@ -378,13 +378,13 @@ CreateSlave( Tk_OptionTable table) { Tcl_HashEntry *hPtr; - register Slave *slavePtr; + Slave *slavePtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Slave *)Tcl_GetHashValue(hPtr); } /* @@ -392,7 +392,7 @@ CreateSlave( * populate it with some default values. */ - slavePtr = ckalloc(sizeof(Slave)); + slavePtr = (Slave *)ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); slavePtr->tkwin = tkwin; slavePtr->inTkwin = NULL; @@ -452,14 +452,14 @@ static Slave * FindSlave( Tk_Window tkwin) /* Token for desired slave. */ { - register Tcl_HashEntry *hPtr; + Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, tkwin); if (hPtr == NULL) { return NULL; } - return Tcl_GetHashValue(hPtr); + return (Slave *)Tcl_GetHashValue(hPtr); } /* @@ -483,8 +483,8 @@ static void UnlinkSlave( Slave *slavePtr) /* Slave structure to be unlinked. */ { - register Master *masterPtr; - register Slave *prevPtr; + Master *masterPtr; + Slave *prevPtr; masterPtr = slavePtr->masterPtr; if (masterPtr == NULL) { @@ -532,13 +532,13 @@ CreateMaster( Tk_Window tkwin) /* Token for desired master. */ { Tcl_HashEntry *hPtr; - register Master *masterPtr; + Master *masterPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew); if (isNew) { - masterPtr = ckalloc(sizeof(Master)); + masterPtr = (Master *)ckalloc(sizeof(Master)); masterPtr->tkwin = tkwin; masterPtr->slavePtr = NULL; masterPtr->abortPtr = NULL; @@ -547,7 +547,7 @@ CreateMaster( Tk_CreateEventHandler(masterPtr->tkwin, StructureNotifyMask, MasterStructureProc, masterPtr); } else { - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (Master *)Tcl_GetHashValue(hPtr); } return masterPtr; } @@ -575,14 +575,14 @@ static Master * FindMaster( Tk_Window tkwin) /* Token for desired master. */ { - register Tcl_HashEntry *hPtr; + Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, tkwin); if (hPtr == NULL) { return NULL; } - return Tcl_GetHashValue(hPtr); + return (Master *)Tcl_GetHashValue(hPtr); } /* @@ -612,7 +612,7 @@ ConfigureSlave( int objc, /* Number of config arguments. */ Tcl_Obj *const objv[]) /* Object values for arguments. */ { - register Master *masterPtr; + Master *masterPtr; Tk_SavedOptions savedOptions; int mask; Slave *slavePtr; @@ -863,8 +863,8 @@ static void RecomputePlacement( ClientData clientData) /* Pointer to Master record. */ { - register Master *masterPtr = clientData; - register Slave *slavePtr; + Master *masterPtr = (Master *)clientData; + Slave *slavePtr; int x, y, width, height, tmp; int masterWidth, masterHeight, masterX, masterY; double x1, y1, x2, y2; @@ -1084,8 +1084,8 @@ MasterStructureProc( * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Master *masterPtr = clientData; - register Slave *slavePtr, *nextPtr; + Master *masterPtr = (Master *)clientData; + Slave *slavePtr, *nextPtr; TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr; switch (eventPtr->type) { @@ -1163,7 +1163,7 @@ SlaveStructureProc( * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { @@ -1200,8 +1200,9 @@ PlaceRequestProc( ClientData clientData, /* Pointer to our record for slave. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; Master *masterPtr; + (void)tkwin; if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) && (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) { @@ -1247,7 +1248,7 @@ PlaceLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { diff --git a/generic/tkPointer.c b/generic/tkPointer.c index a8f10ac..9213152 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -125,7 +125,7 @@ GenerateEnterLeave( int state) /* State flags. */ { int crossed = 0; /* 1 if mouse crossed a window boundary */ - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); TkWindow *restrictWinPtr = tsdPtr->restrictWinPtr; TkWindow *lastWinPtr = tsdPtr->lastWinPtr; @@ -218,7 +218,7 @@ Tk_UpdatePointer( int x, int y, /* Pointer location in root coords. */ int state) /* Modifier state mask. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); TkWindow *winPtr = (TkWindow *)tkwin; TkWindow *targetWinPtr; @@ -423,8 +423,15 @@ XGrabPointer( Cursor cursor, Time time) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)owner_events; + (void)event_mask; + (void)pointer_mode; + (void)keyboard_mode; + (void)confine_to; + (void)cursor; + (void)time; display->request++; tsdPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow(display, grab_window); @@ -458,8 +465,9 @@ XUngrabPointer( Display *display, Time time) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)time; display->request++; tsdPtr->grabWinPtr = NULL; @@ -489,7 +497,7 @@ void TkPointerDeadWindow( TkWindow *winPtr) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr == tsdPtr->lastWinPtr) { @@ -536,7 +544,7 @@ UpdateCursor( TkWindow *winPtr) { Cursor cursor = None; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -582,8 +590,9 @@ XDefineCursor( Cursor cursor) { TkWindow *winPtr = (TkWindow *) Tk_IdToWindow(display, w); - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)cursor; if (tsdPtr->cursorWinPtr == winPtr) { UpdateCursor(winPtr); diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index 6b679f8..42dcdb8 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -579,6 +579,7 @@ DeleteRectOval( Display *display) /* Display containing window for canvas. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; + (void)canvas; Tk_DeleteOutline(display, &(rectOvalPtr->outline)); if (rectOvalPtr->fillColor != NULL) { @@ -752,6 +753,10 @@ DisplayRectOval( short x1, y1, x2, y2; Pixmap fillStipple; Tk_State state = itemPtr->state; + (void)x; + (void)y; + (void)width; + (void)height; /* * Compute the screen coordinates of the bounding box for the item. Make @@ -1446,6 +1451,7 @@ RectOvalToPostscript( Pixmap fillStipple; Tk_State state = itemPtr->state; Tcl_InterpState interpState; + (void)prepass; y1 = Tk_CanvasPsY(canvas, rectOvalPtr->bbox[1]); y2 = Tk_CanvasPsY(canvas, rectOvalPtr->bbox[3]); diff --git a/generic/tkScale.c b/generic/tkScale.c index 616d321..055e876 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -161,7 +161,7 @@ static void ComputeFormat(TkScale *scalePtr, int forTicks); static void ComputeScaleGeometry(TkScale *scalePtr); static int ConfigureScale(Tcl_Interp *interp, TkScale *scalePtr, int objc, Tcl_Obj *const objv[]); -static void DestroyScale(char *memPtr); +static void DestroyScale(void *memPtr); static double MaxTickRoundingError(TkScale *scalePtr, double tickResolution); static void ScaleCmdDeletedProc(ClientData clientData); @@ -248,14 +248,15 @@ ScaleRound( int Tk_ScaleObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - register TkScale *scalePtr; + TkScale *scalePtr; Tk_OptionTable optionTable; Tk_Window tkwin; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -385,7 +386,7 @@ ScaleWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TkScale *scalePtr = clientData; + TkScale *scalePtr = (TkScale *)clientData; Tcl_Obj *objPtr; int index, result; @@ -540,9 +541,9 @@ ScaleWidgetObjCmd( static void DestroyScale( - char *memPtr) /* Info about scale widget. */ + void *memPtr) /* Info about scale widget. */ { - register TkScale *scalePtr = (TkScale *) memPtr; + TkScale *scalePtr = (TkScale *) memPtr; scalePtr->flags |= SCALE_DELETED; @@ -599,7 +600,7 @@ DestroyScale( static int ConfigureScale( Tcl_Interp *interp, /* Used for error reporting. */ - register TkScale *scalePtr, /* Information about widget; may or may not + TkScale *scalePtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -769,7 +770,7 @@ ScaleWorldChanged( { XGCValues gcValues; GC gc; - TkScale *scalePtr = instanceData; + TkScale *scalePtr = (TkScale *)instanceData; gcValues.foreground = scalePtr->troughColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues); @@ -1019,7 +1020,7 @@ ComputeFormat( static void ComputeScaleGeometry( - register TkScale *scalePtr) /* Information about widget. */ + TkScale *scalePtr) /* Information about widget. */ { char valueString[TCL_DOUBLE_SPACE]; int tmp, valuePixels, tickPixels, x, y, extraSpace; @@ -1163,7 +1164,7 @@ ScaleEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkScale *scalePtr = clientData; + TkScale *scalePtr = (TkScale *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); @@ -1211,7 +1212,7 @@ static void ScaleCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkScale *scalePtr = clientData; + TkScale *scalePtr = (TkScale *)clientData; Tk_Window tkwin = scalePtr->tkwin; /* @@ -1248,7 +1249,7 @@ ScaleCmdDeletedProc( void TkEventuallyRedrawScale( - register TkScale *scalePtr, /* Information about widget. */ + TkScale *scalePtr, /* Information about widget. */ int what) /* What to redraw: REDRAW_SLIDER or * REDRAW_ALL. */ { @@ -1346,11 +1347,13 @@ ScaleVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkScale *scalePtr = clientData; + TkScale *scalePtr = (TkScale *)clientData; const char *resultStr; double value; Tcl_Obj *valuePtr; int result; + (void)name1; + (void)name2; /* * If the variable is unset, then immediately recreate it unless the whole @@ -1441,7 +1444,7 @@ ScaleVarProc( void TkScaleSetValue( - register TkScale *scalePtr, /* Info about widget. */ + TkScale *scalePtr, /* Info about widget. */ double value, /* New value for scale. Gets adjusted if it's * off the scale. */ int setVar, /* Non-zero means reflect new value through to @@ -1499,7 +1502,7 @@ TkScaleSetValue( static void ScaleSetVariable( - register TkScale *scalePtr) /* Info about widget. */ + TkScale *scalePtr) /* Info about widget. */ { if (scalePtr->varNamePtr != NULL) { char string[TCL_DOUBLE_SPACE]; @@ -1535,7 +1538,7 @@ ScaleSetVariable( double TkScalePixelToValue( - register TkScale *scalePtr, /* Information about widget. */ + TkScale *scalePtr, /* Information about widget. */ int x, int y) /* Coordinates of point within window. */ { double value, pixelRange; @@ -1593,7 +1596,7 @@ TkScalePixelToValue( int TkScaleValueToPixel( - register TkScale *scalePtr, /* Information about widget. */ + TkScale *scalePtr, /* Information about widget. */ double value) /* Reading of the widget. */ { int y, pixelRange; diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 5b0f6af..600c7d7 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -127,8 +127,8 @@ Tk_ScrollbarObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window tkwin = clientData; - register TkScrollbar *scrollPtr; + Tk_Window tkwin = (Tk_Window)clientData; + TkScrollbar *scrollPtr; Tk_Window newWin; if (objc < 2) { @@ -225,7 +225,7 @@ ScrollbarWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; int result = TCL_OK, cmdIndex; TkSizeT length; static const char *const commandNames[] = { @@ -524,7 +524,7 @@ ScrollbarWidgetObjCmd( static int ConfigureScrollbar( Tcl_Interp *interp, /* Used for error reporting. */ - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ @@ -587,7 +587,7 @@ TkScrollbarEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkScrollbarEventuallyRedraw(scrollPtr); @@ -652,7 +652,7 @@ static void ScrollbarCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; Tk_Window tkwin = scrollPtr->tkwin; /* diff --git a/generic/tkSelect.c b/generic/tkSelect.c index d4188b3..93a047f 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; TkSizeT 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(offsetof(CommandInfo, command) + cmdInfoPtr = (CommandInfo *)ckalloc(offsetof(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; @@ -1290,11 +1290,13 @@ static int SelGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ - Tcl_Interp *interp, /* Interpreter used for error reporting (not + Tcl_Interp *dummy, /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { - Tcl_DStringAppend(clientData, portion, -1); + (void)dummy; + + Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1); return TCL_OK; } @@ -1326,7 +1328,7 @@ HandleTclCommand( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - CommandInfo *cmdInfoPtr = clientData; + CommandInfo *cmdInfoPtr = (CommandInfo *)clientData; int length; Tcl_Obj *command; const char *string; @@ -1469,7 +1471,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) { @@ -1482,7 +1484,7 @@ TkSelDefaultSelection( } if (target == dispPtr->targetsAtom) { - register TkSelHandler *selPtr; + TkSelHandler *selPtr; int length; Tcl_DString ds; @@ -1565,7 +1567,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/tkSquare.c b/generic/tkSquare.c index 8421988..8bfa850 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -125,7 +125,7 @@ static int SquareWidgetObjCmd(ClientData clientData, int SquareObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -133,6 +133,7 @@ SquareObjCmd( Square *squarePtr; Tk_Window tkwin; Tk_OptionTable optionTable; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -160,7 +161,7 @@ SquareObjCmd( * just the non-NULL/0 items. */ - squarePtr = ckalloc(sizeof(Square)); + squarePtr = (Square *)ckalloc(sizeof(Square)); memset(squarePtr, 0, sizeof(Square)); squarePtr->tkwin = tkwin; @@ -223,7 +224,7 @@ SquareWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { - Square *squarePtr = clientData; + Square *squarePtr = (Square *)clientData; int result = TCL_OK; static const char *const squareOptions[] = {"cget", "configure", NULL}; enum { @@ -318,12 +319,13 @@ SquareWidgetObjCmd( static int SquareConfigure( - Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Interp *dummy, /* Used for error reporting. */ Square *squarePtr) /* Information about widget. */ { int borderWidth; Tk_3DBorder bgBorder; int doubleBuffer; + (void)dummy; /* * Set the background for the window and create a graphics context for use @@ -383,7 +385,7 @@ SquareObjEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Square *squarePtr = clientData; + Square *squarePtr = (Square *)clientData; if (eventPtr->type == Expose) { if (!squarePtr->updatePending) { @@ -436,7 +438,7 @@ static void SquareDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Square *squarePtr = clientData; + Square *squarePtr = (Square *)clientData; Tk_Window tkwin = squarePtr->tkwin; /* @@ -473,7 +475,7 @@ static void SquareDisplay( ClientData clientData) /* Information about window. */ { - Square *squarePtr = clientData; + Square *squarePtr = (Square *)clientData; Tk_Window tkwin = squarePtr->tkwin; Pixmap pm = None; Drawable d; @@ -556,7 +558,7 @@ static void SquareDestroy( void *memPtr) /* Info about square widget. */ { - Square *squarePtr = memPtr; + Square *squarePtr = (Square *)memPtr; ckfree(squarePtr); } @@ -581,7 +583,7 @@ SquareDestroy( static void KeepInWindow( - register Square *squarePtr) /* Pointer to widget record. */ + Square *squarePtr) /* Pointer to widget record. */ { int i, bd, relief; int borderWidth, size; diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index ce9615f..e6f5fd4 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -30,7 +30,6 @@ #include "tkPlatDecls.h" #include "tkIntXlibDecls.h" -static const TkIntStubs tkIntStubs; MODULE_SCOPE const TkStubs tkStubs; /* @@ -83,12 +82,16 @@ static int TkWinGetPlatformId(void) { int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) { + (void)tkwin; + (void)colormap; + /* dummy implementation, no need to do anything */ return 0; } void TkpSync(Display *display) { + (void)display; /* dummy implementation, no need to do anything */ } @@ -121,22 +124,21 @@ TkCreateXEventSource(void) */ #define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 +#ifdef __cplusplus +extern "C" { +#endif int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); - -void *Tk_GetHINSTANCE() -{ - void *hInstance = NULL; - - GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, - (const char *) &tkIntStubs, &hInstance); - return hInstance; +#ifdef __cplusplus } +#endif void TkSetPixmapColormap( Pixmap pixmap, Colormap colormap) { + (void)pixmap; + (void)colormap; } void @@ -162,6 +164,9 @@ TkPutImage( unsigned int width, unsigned int height) /* Dimensions of subimage. */ { + (void)colors; + (void)ncolors; + return XPutImage(display, d, gc, image, src_x, src_y, dest_x, dest_y, width, height); } @@ -1227,3 +1232,16 @@ const TkStubs tkStubs = { }; /* !END!: Do not edit above this line. */ + + +#ifdef __CYGWIN__ +void *Tk_GetHINSTANCE() +{ + void *hInstance = NULL; + + GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + (const char *) &tkIntStubs, &hInstance); + return hInstance; +} +#endif + diff --git a/generic/tkStyle.c b/generic/tkStyle.c index 393becc..469312b 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -180,8 +180,9 @@ void TkStylePkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)mainPtr; if (tsdPtr->nbInit != 0) { return; @@ -235,12 +236,13 @@ void TkStylePkgFree( TkMainInfo *mainPtr) /* The application being deleted. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashSearch search; Tcl_HashEntry *entryPtr; StyleEngine *enginePtr; int i; + (void)mainPtr; tsdPtr->nbInit--; if (tsdPtr->nbInit != 0) { @@ -264,7 +266,7 @@ TkStylePkgFree( entryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search); while (entryPtr != NULL) { - enginePtr = Tcl_GetHashValue(entryPtr); + enginePtr = (StyleEngine *)Tcl_GetHashValue(entryPtr); FreeStyleEngine(enginePtr); ckfree(enginePtr); entryPtr = Tcl_NextHashEntry(&search); @@ -307,7 +309,7 @@ Tk_RegisterStyleEngine( Tk_StyleEngine parent) /* The engine's parent. NULL means the default * system engine. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; int newEntry; @@ -331,8 +333,8 @@ Tk_RegisterStyleEngine( * Allocate and intitialize a new engine. */ - enginePtr = ckalloc(sizeof(StyleEngine)); - InitStyleEngine(enginePtr, Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr), + enginePtr = (StyleEngine *)ckalloc(sizeof(StyleEngine)); + InitStyleEngine(enginePtr, (const char *)Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr), (StyleEngine *) parent); Tcl_SetHashValue(entryPtr, enginePtr); @@ -364,7 +366,7 @@ InitStyleEngine( StyleEngine *parentPtr) /* The engine's parent. NULL means the default * system engine. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int elementId; @@ -389,7 +391,7 @@ InitStyleEngine( */ if (tsdPtr->nbElements > 0) { - enginePtr->elements = ckalloc( + enginePtr->elements = (StyledElement *)ckalloc( sizeof(StyledElement) * tsdPtr->nbElements); for (elementId = 0; elementId < tsdPtr->nbElements; elementId++) { InitStyledElement(enginePtr->elements+elementId); @@ -419,7 +421,7 @@ static void FreeStyleEngine( StyleEngine *enginePtr) /* The style engine to free. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int elementId; @@ -454,7 +456,7 @@ Tk_GetStyleEngine( const char *name) /* Name of the engine to retrieve. NULL or * empty means the default system engine. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; @@ -467,7 +469,7 @@ Tk_GetStyleEngine( return NULL; } - return Tcl_GetHashValue(entryPtr); + return (Tk_StyleEngine)Tcl_GetHashValue(entryPtr); } /* @@ -523,6 +525,8 @@ static void FreeElement( Element *elementPtr) /* The element to free. */ { + (void)elementPtr; + /* Nothing to do. */ } @@ -604,7 +608,7 @@ CreateElement( * created explicitly (being registered) or * implicitly (by a derived element). */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr, *engineEntryPtr; Tcl_HashSearch search; @@ -642,10 +646,10 @@ CreateElement( * Reallocate element table. */ - tsdPtr->elements = ckrealloc(tsdPtr->elements, + tsdPtr->elements = (Element *)ckrealloc(tsdPtr->elements, sizeof(Element) * tsdPtr->nbElements); InitElement(tsdPtr->elements+elementId, - Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId, + (const char *)Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId, genericId, create); /* @@ -654,9 +658,9 @@ CreateElement( engineEntryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search); while (engineEntryPtr != NULL) { - enginePtr = Tcl_GetHashValue(engineEntryPtr); + enginePtr = (StyleEngine *)Tcl_GetHashValue(engineEntryPtr); - enginePtr->elements = ckrealloc(enginePtr->elements, + enginePtr->elements = (StyledElement *)ckrealloc(enginePtr->elements, sizeof(StyledElement) * tsdPtr->nbElements); InitStyledElement(enginePtr->elements+elementId); @@ -686,7 +690,7 @@ int Tk_GetElementId( const char *name) /* Name of the element. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; int genericId = -1; @@ -759,7 +763,7 @@ Tk_RegisterStyledElement( StyledElement *elementPtr; Tk_ElementSpec *specPtr; int nbOptions; - register Tk_ElementOptionSpec *srcOptions, *dstOptions; + Tk_ElementOptionSpec *srcOptions, *dstOptions; if (templatePtr->version != TK_STYLE_VERSION_1) { /* @@ -786,16 +790,16 @@ Tk_RegisterStyledElement( elementPtr = ((StyleEngine *) engine)->elements+elementId; - specPtr = ckalloc(sizeof(Tk_ElementSpec)); + specPtr = (Tk_ElementSpec *)ckalloc(sizeof(Tk_ElementSpec)); specPtr->version = templatePtr->version; - specPtr->name = ckalloc(strlen(templatePtr->name)+1); + specPtr->name = (char *)ckalloc(strlen(templatePtr->name)+1); strcpy(specPtr->name, templatePtr->name); nbOptions = 0; for (nbOptions = 0, srcOptions = templatePtr->options; srcOptions->name != NULL; nbOptions++, srcOptions++) { /* empty body */ } - specPtr->options = + specPtr->options = (Tk_ElementOptionSpec *) ckalloc(sizeof(Tk_ElementOptionSpec) * (nbOptions+1)); for (srcOptions = templatePtr->options, dstOptions = specPtr->options; /* End condition within loop */; srcOptions++, dstOptions++) { @@ -804,7 +808,7 @@ Tk_RegisterStyledElement( break; } - dstOptions->name = ckalloc(strlen(srcOptions->name)+1); + dstOptions->name = (char *)ckalloc(strlen(srcOptions->name)+1); strcpy(dstOptions->name, srcOptions->name); dstOptions->type = srcOptions->type; } @@ -844,7 +848,7 @@ GetStyledElement( int elementId) /* Unique element ID */ { StyledElement *elementPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); StyleEngine *enginePtr2; @@ -924,7 +928,7 @@ InitWidgetSpec( */ widgetSpecPtr->optionsPtr = - ckalloc(sizeof(Tk_OptionSpec *) * nbOptions); + (const Tk_OptionSpec **)ckalloc(sizeof(Tk_OptionSpec *) * nbOptions); for (i = 0, elementOptionPtr = elementPtr->specPtr->options; i < nbOptions; i++, elementOptionPtr++) { widgetOptionPtr = TkGetOptionSpec(elementOptionPtr->name, optionTable); @@ -1008,7 +1012,7 @@ GetWidgetSpec( */ i = elementPtr->nbWidgetSpecs++; - elementPtr->widgetSpecs = ckrealloc(elementPtr->widgetSpecs, + elementPtr->widgetSpecs = (StyledWidgetSpec *)ckrealloc(elementPtr->widgetSpecs, sizeof(StyledWidgetSpec) * elementPtr->nbWidgetSpecs); widgetSpecPtr = elementPtr->widgetSpecs+i; InitWidgetSpec(widgetSpecPtr, elementPtr, optionTable); @@ -1090,7 +1094,7 @@ Tk_GetElementSize( StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element; widgetSpecPtr->elementPtr->specPtr->getSize(stylePtr->clientData, - recordPtr, widgetSpecPtr->optionsPtr, tkwin, width, height, inner, + (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin, width, height, inner, widthPtr, heightPtr); } @@ -1133,7 +1137,7 @@ Tk_GetElementBox( StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element; widgetSpecPtr->elementPtr->specPtr->getBox(stylePtr->clientData, - recordPtr, widgetSpecPtr->optionsPtr, tkwin, x, y, width, height, + (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin, x, y, width, height, inner, xPtr, yPtr, widthPtr, heightPtr); } @@ -1166,7 +1170,7 @@ Tk_GetElementBorderWidth( StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element; return widgetSpecPtr->elementPtr->specPtr->getBorderWidth( - stylePtr->clientData, recordPtr, widgetSpecPtr->optionsPtr, tkwin); + stylePtr->clientData, (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin); } /* @@ -1201,7 +1205,7 @@ Tk_DrawElement( StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element; widgetSpecPtr->elementPtr->specPtr->draw(stylePtr->clientData, - recordPtr, widgetSpecPtr->optionsPtr, tkwin, d, x, y, width, + (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin, d, x, y, width, height, state); } @@ -1229,7 +1233,7 @@ Tk_CreateStyle( Tk_StyleEngine engine, /* The style engine. */ ClientData clientData) /* Private data passed as is to engine code. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; int newEntry; @@ -1253,8 +1257,8 @@ Tk_CreateStyle( * Allocate and intitialize a new style. */ - stylePtr = ckalloc(sizeof(Style)); - InitStyle(stylePtr, Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr), + stylePtr = (Style *)ckalloc(sizeof(Style)); + InitStyle(stylePtr, (const char *)Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr), (engine!=NULL ? (StyleEngine*) engine : tsdPtr->defaultEnginePtr), clientData); Tcl_SetHashValue(entryPtr, stylePtr); @@ -1344,10 +1348,9 @@ Tk_GetStyle( const char *name) /* Name of the style to retrieve. NULL or empty * means the default system style. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; - Style *stylePtr; /* * Search for a corresponding entry in the style table. @@ -1362,9 +1365,7 @@ Tk_GetStyle( } return NULL; } - stylePtr = Tcl_GetHashValue(entryPtr); - - return (Tk_Style) stylePtr; + return (Tk_Style)Tcl_GetHashValue(entryPtr); } /* @@ -1381,6 +1382,7 @@ void Tk_FreeStyle( Tk_Style style) { + (void)style; } /* @@ -1410,7 +1412,7 @@ Tk_AllocStyleFromObj( return NULL; } } - return objPtr->internalRep.twoPtrValue.ptr1; + return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1; } /* diff --git a/generic/tkTest.c b/generic/tkTest.c index e697bf3..1f69027 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -48,7 +48,14 @@ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLEXPORT +#ifdef __cplusplus +extern "C" { +#endif EXTERN int Tktest_Init(Tcl_Interp *interp); +#ifdef __cplusplus +} +#endif + /* * The following data structure represents the master for a test image: */ @@ -340,6 +347,7 @@ TestbitmapObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "bitmap"); @@ -375,6 +383,7 @@ TestborderObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "border"); @@ -410,6 +419,8 @@ TestcolorObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)clientData; + if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "color"); return TCL_ERROR; @@ -444,6 +455,8 @@ TestcursorObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)clientData; + if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "cursor"); return TCL_ERROR; @@ -480,6 +493,10 @@ TestdeleteappsObjCmd( Tcl_Obj *const objv[]) /* Argument strings. */ { NewApp *nextPtr; + (void)clientData; + (void)interp; + (void)objc; + (void)objv; while (newAppPtr != NULL) { nextPtr = newAppPtr->nextPtr; @@ -537,7 +554,7 @@ TestobjconfigObjCmd( CustomOptionFree, INT2PTR(1) }; - Tk_Window mainWin = clientData; + Tk_Window mainWin = (Tk_Window)clientData; Tk_Window tkwin; int index, result = TCL_OK; @@ -651,14 +668,14 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, typesSpecs); tables[index] = optionTable; - tkwin = Tk_CreateWindowFromPath(interp, clientData, + tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(TypesRecord)); + recordPtr = (TypesRecord *)ckalloc(sizeof(TypesRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -706,7 +723,7 @@ TestobjconfigObjCmd( Tk_Window tkwin; Tk_OptionTable optionTable; - tkwin = Tk_CreateWindowFromPath(interp, clientData, + tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; @@ -715,7 +732,7 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, baseSpecs); tables[index] = optionTable; - recordPtr = ckalloc(sizeof(ExtensionWidgetRecord)); + recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -759,7 +776,7 @@ TestobjconfigObjCmd( Tk_Window tkwin; Tk_OptionTable optionTable; - tkwin = Tk_CreateWindowFromPath(interp, clientData, + tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; @@ -768,7 +785,7 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, extensionSpecs); tables[index] = optionTable; - recordPtr = ckalloc(sizeof(ExtensionWidgetRecord)); + recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -929,14 +946,14 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, internalSpecs); tables[index] = optionTable; - tkwin = Tk_CreateWindowFromPath(interp, clientData, + tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(InternalRecord)); + recordPtr = (InternalRecord *)ckalloc(sizeof(InternalRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -1009,7 +1026,7 @@ TestobjconfigObjCmd( return TCL_ERROR; } - recordPtr = ckalloc(sizeof(FiveRecord)); + recordPtr = (FiveRecord *)ckalloc(sizeof(FiveRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = Tk_CreateOptionTable(interp, smallSpecs); @@ -1081,14 +1098,14 @@ TestobjconfigObjCmd( {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_Window tkwin = Tk_CreateWindowFromPath(interp, - clientData, Tcl_GetString(objv[2]), NULL); + (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(SlaveRecord)); + recordPtr = (SlaveRecord *)ckalloc(sizeof(SlaveRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = Tk_CreateOptionTable(interp, slaveSpecs); @@ -1158,7 +1175,7 @@ TrivialConfigObjCmd( }; Tcl_Obj *resultObjPtr; int index, mask; - TrivialCommandHeader *headerPtr = clientData; + TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; Tk_Window tkwin = headerPtr->tkwin; Tk_SavedOptions saved; @@ -1253,7 +1270,7 @@ static void TrivialCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TrivialCommandHeader *headerPtr = clientData; + TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; Tk_Window tkwin = headerPtr->tkwin; if (tkwin != NULL) { @@ -1292,7 +1309,7 @@ TrivialEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TrivialCommandHeader *headerPtr = clientData; + TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; if (eventPtr->type == DestroyNotify) { if (headerPtr->tkwin != NULL) { @@ -1338,7 +1355,7 @@ TestfontObjCmd( Tk_Window tkwin; Tk_Font tkfont; - tkwin = clientData; + tkwin = (Tk_Window)clientData; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option fontName"); @@ -1402,6 +1419,7 @@ ImageCreate( TImageMaster *timPtr; const char *varName; int i; + (void)typePtr; varName = "log"; for (i = 0; i < objc; i += 2) { @@ -1418,14 +1436,14 @@ ImageCreate( varName = Tcl_GetString(objv[i+1]); } - timPtr = ckalloc(sizeof(TImageMaster)); + timPtr = (TImageMaster *)ckalloc(sizeof(TImageMaster)); timPtr->master = master; timPtr->interp = interp; timPtr->width = 30; timPtr->height = 15; - timPtr->imageName = ckalloc(strlen(name) + 1); + timPtr->imageName = (char *)ckalloc(strlen(name) + 1); strcpy(timPtr->imageName, name); - timPtr->varName = ckalloc(strlen(varName) + 1); + timPtr->varName = (char *)ckalloc(strlen(varName) + 1); strcpy(timPtr->varName, varName); Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); *clientDataPtr = timPtr; @@ -1458,7 +1476,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; int x, y, width, height; if (objc < 2) { @@ -1513,7 +1531,7 @@ ImageGet( * used. */ ClientData clientData) /* Pointer to TImageMaster for image. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -1522,7 +1540,7 @@ ImageGet( Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - instPtr = ckalloc(sizeof(TImageInstance)); + instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance)); instPtr->masterPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; @@ -1560,7 +1578,7 @@ ImageDisplay( /* Coordinates in drawable corresponding to * imageX and imageY. */ { - TImageInstance *instPtr = clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200 + TCL_INTEGER_SPACE * 6]; /* @@ -1635,7 +1653,7 @@ ImageFree( ClientData clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { - TImageInstance *instPtr = clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200]; sprintf(buffer, "%s free", instPtr->masterPtr->imageName); @@ -1669,7 +1687,7 @@ ImageDelete( * this function is called, no more instances * exist. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); @@ -1708,7 +1726,7 @@ TestmakeexistObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window mainWin = clientData; + Tk_Window mainWin = (Tk_Window)clientData; int i; Tk_Window tkwin; @@ -1811,13 +1829,14 @@ TestmenubarObjCmd( #if defined(_WIN32) static int TestmetricsObjCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { char buf[TCL_INTEGER_SPACE]; int val; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1864,7 +1883,7 @@ TestpropObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window mainWin = clientData; + Tk_Window mainWin = (Tk_Window)clientData; int result, actualFormat; unsigned long bytesAfter, length, value; Atom actualType, propName; @@ -1936,7 +1955,7 @@ TestpropObjCmd( /* ARGSUSED */ static int TestprintfObjCmd( - ClientData clientData, /* Not used */ + ClientData dummy, /* Not used */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -1948,6 +1967,7 @@ TestprintfObjCmd( #else long long longLongInt; #endif + (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "wideint"); @@ -2050,7 +2070,7 @@ TestwrapperObjCmd( static int CustomOptionSet( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, @@ -2061,6 +2081,8 @@ CustomOptionSet( { int objEmpty; char *newStr, *string, *internalPtr; + (void)dummy; + (void)tkwin; objEmpty = 0; @@ -2097,7 +2119,7 @@ CustomOptionSet( if (internalPtr != NULL) { if (*value != NULL) { string = Tcl_GetString(*value); - newStr = ckalloc((*value)->length + 1); + newStr = (char *)ckalloc((*value)->length + 1); strcpy(newStr, string); } else { newStr = NULL; @@ -2111,31 +2133,40 @@ CustomOptionSet( static Tcl_Obj * CustomOptionGet( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *recordPtr, int internalOffset) { + (void)dummy; + (void)tkwin; + return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), -1)); } static void CustomOptionRestore( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *internalPtr, char *saveInternalPtr) { + (void)dummy; + (void)tkwin; + *(char **)internalPtr = *(char **)saveInternalPtr; return; } static void CustomOptionFree( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *internalPtr) { + (void)dummy; + (void)tkwin; + if (*(char **)internalPtr != NULL) { ckfree(*(char **)internalPtr); } @@ -2172,6 +2203,7 @@ TestPhotoStringMatchCmd( Tcl_Obj *dummy = NULL; Tcl_Obj *resultObj[2]; int width, height; + (void)clientData; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "imageData"); diff --git a/generic/tkText.c b/generic/tkText.c index f810010..0d7dcb1 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -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; @@ -1125,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. @@ -1153,7 +1153,7 @@ TextWidgetObjCmd( COUNT_INDICES); objc++; } - useIdx = ckalloc(objc); + useIdx = (char *)ckalloc(objc); memset(useIdx, 0, objc); /* @@ -1607,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; @@ -1977,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) { @@ -2009,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 @@ -2075,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. */ @@ -2378,7 +2378,7 @@ static void TextWorldChangedCallback( ClientData instanceData) /* Information about widget. */ { - TkText *textPtr = instanceData; + TkText *textPtr = (TkText *)instanceData; TextWorldChanged(textPtr, TK_TEXT_LINE_GEOMETRY); } @@ -2467,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) { @@ -2578,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; /* @@ -2663,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; } @@ -2961,7 +2961,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; @@ -3200,9 +3200,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); } /* @@ -3236,7 +3234,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; } @@ -3425,7 +3423,7 @@ TextFetchSelection( * not including terminating NULL * character. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TkTextIndex eof; int count, chunkSize, offsetInSeg; TkTextSearch search; @@ -3556,7 +3554,7 @@ void TkTextLostSelection( ClientData clientData) /* Information about text widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; if (TkpAlwaysShowSelection(textPtr->tkwin)) { TkTextIndex start, end; @@ -3641,7 +3639,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; @@ -4021,7 +4019,7 @@ TextSearchGetLineIndex( { const TkTextIndex *indexPtr; int line; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; indexPtr = TkTextGetIndexFromObj(interp, textPtr, objPtr); if (indexPtr == NULL) { @@ -4086,7 +4084,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; @@ -4156,7 +4154,7 @@ TextSearchAddNextLine( TkTextLine *linePtr, *thisLinePtr; TkTextIndex curIndex; TkTextSegment *segPtr; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; int nothingYet = 1; /* @@ -4278,7 +4276,7 @@ TextSearchFoundMatch( TkTextIndex curIndex, foundIndex; TkTextSegment *segPtr; TkTextLine *linePtr; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; if (lineNum == searchSpecPtr->stopLine) { /* @@ -4329,7 +4327,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); @@ -4539,7 +4537,7 @@ TkTextGetTabs( * Parse the elements of the list one at a time to fill in the array. */ - tabArrayPtr = ckalloc(sizeof(TkTextTabArray) + tabArrayPtr = (TkTextTabArray *)ckalloc(sizeof(TkTextTabArray) + (count - 1) * sizeof(TkTextTab)); tabArrayPtr->numTabs = 0; prevStop = 0.0; @@ -4666,7 +4664,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 @@ -4903,7 +4901,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'; @@ -4934,7 +4932,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) { @@ -5064,6 +5062,7 @@ DumpSegment( { char buffer[TK_POS_CHARS]; Tcl_Obj *values[3], *tuple; + (void)what; TkTextPrintIndex(textPtr, index, buffer); values[0] = Tcl_NewStringObj(key, -1); @@ -5604,7 +5603,7 @@ void TkTextRunAfterSyncCmd( ClientData clientData) /* Information about text widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; int code; if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { @@ -5678,7 +5677,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) { @@ -6520,7 +6519,7 @@ SearchCore( * matches on the heap. */ - TkSizeT *newArray = + TkSizeT *newArray = (TkSizeT *) ckalloc(4 * matchNum * sizeof(TkSizeT)); memcpy(newArray, storeMatch, matchNum*sizeof(TkSizeT)); memcpy(newArray + 2*matchNum, storeLength, @@ -6781,13 +6780,15 @@ SearchCore( static Tcl_Obj * GetLineStartEnd( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *recordPtr, /* Pointer to widget record. */ int internalOffset) /* Offset within *recordPtr containing the * line value. */ { TkTextLine *linePtr = *(TkTextLine **)(recordPtr + internalOffset); + (void)dummy; + (void)tkwin; if (linePtr == NULL) { return Tcl_NewObj(); @@ -6816,7 +6817,7 @@ GetLineStartEnd( static int SetLineStartEnd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, /* Current interp; may be used for errors. */ Tk_Window tkwin, /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. @@ -6831,6 +6832,8 @@ SetLineStartEnd( TkTextLine *linePtr = NULL; char *internalPtr; TkText *textPtr = (TkText *) recordPtr; + (void)dummy; + (void)tkwin; if (internalOffset >= 0) { internalPtr = (char *)recordPtr + internalOffset; @@ -6875,11 +6878,14 @@ SetLineStartEnd( static void RestoreLineStartEnd( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *internalPtr, /* Pointer to storage for value. */ char *oldInternalPtr) /* Pointer to old value. */ { + (void)dummy; + (void)tkwin; + *(TkTextLine **)internalPtr = *(TkTextLine **)oldInternalPtr; } @@ -6934,17 +6940,18 @@ ObjectIsEmpty( int TkpTesttextCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TkText *textPtr; - TkSizeT len; + size_t len; int lineIndex, byteIndex, byteOffset; TkTextIndex index; char buf[64]; Tcl_CmdInfo info; + (void)dummy; if (objc < 3) { return TCL_ERROR; @@ -6953,7 +6960,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/tkTextBTree.c b/generic/tkTextBTree.c index 07c3bbd..ced1e2e 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -261,10 +261,10 @@ TkTextBTree TkBTreeCreate( TkSharedText *sharedTextPtr) { - register BTree *treePtr; - register Node *rootPtr; - register TkTextLine *linePtr, *linePtr2; - register TkTextSegment *segPtr; + BTree *treePtr; + Node *rootPtr; + TkTextLine *linePtr, *linePtr2; + TkTextSegment *segPtr; /* * The tree will initially have two empty lines. The second line isn't @@ -273,9 +273,9 @@ TkBTreeCreate( * of the tree. */ - rootPtr = ckalloc(sizeof(Node)); - linePtr = ckalloc(sizeof(TkTextLine)); - linePtr2 = ckalloc(sizeof(TkTextLine)); + rootPtr = (Node *)ckalloc(sizeof(Node)); + linePtr = (TkTextLine *)ckalloc(sizeof(TkTextLine)); + linePtr2 = (TkTextLine *)ckalloc(sizeof(TkTextLine)); rootPtr->parentPtr = NULL; rootPtr->nextPtr = NULL; @@ -296,7 +296,7 @@ TkBTreeCreate( linePtr->parentPtr = rootPtr; linePtr->nextPtr = linePtr2; - segPtr = ckalloc(CSEG_SIZE(1)); + segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(1)); linePtr->segPtr = segPtr; segPtr->typePtr = &tkTextCharType; segPtr->nextPtr = NULL; @@ -306,7 +306,7 @@ TkBTreeCreate( linePtr2->parentPtr = rootPtr; linePtr2->nextPtr = NULL; - segPtr = ckalloc(CSEG_SIZE(1)); + segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(1)); linePtr2->segPtr = segPtr; segPtr->typePtr = &tkTextCharType; segPtr->nextPtr = NULL; @@ -314,7 +314,7 @@ TkBTreeCreate( segPtr->body.chars[0] = '\n'; segPtr->body.chars[1] = 0; - treePtr = ckalloc(sizeof(BTree)); + treePtr = (BTree *)ckalloc(sizeof(BTree)); treePtr->sharedTextPtr = sharedTextPtr; treePtr->rootPtr = rootPtr; treePtr->clients = 0; @@ -366,7 +366,7 @@ TkBTreeAddClient( int defaultHeight) /* Default line height for the new client, or * -1 if no pixel heights are to be kept. */ { - register BTree *treePtr = (BTree *) tree; + BTree *treePtr = (BTree *) tree; if (treePtr == NULL) { Tcl_Panic("NULL treePtr in TkBTreeAddClient"); @@ -632,9 +632,9 @@ AdjustStartEndRefs( i++; } treePtr->startEndCount = count; - treePtr->startEnd = ckrealloc(treePtr->startEnd, + treePtr->startEnd = (TkTextLine **)ckrealloc(treePtr->startEnd, sizeof(TkTextLine *) * count); - treePtr->startEndRef = ckrealloc(treePtr->startEndRef, + treePtr->startEndRef = (TkText **)ckrealloc(treePtr->startEndRef, sizeof(TkText *) * count); } if ((action & TEXT_ADD_REFS) @@ -650,9 +650,9 @@ AdjustStartEndRefs( count = treePtr->startEndCount; - treePtr->startEnd = ckrealloc(treePtr->startEnd, + treePtr->startEnd = (TkTextLine **)ckrealloc(treePtr->startEnd, sizeof(TkTextLine *) * count); - treePtr->startEndRef = ckrealloc(treePtr->startEndRef, + treePtr->startEndRef = (TkText **)ckrealloc(treePtr->startEndRef, sizeof(TkText *) * count); if (textPtr->start != NULL) { @@ -725,7 +725,7 @@ AdjustPixelClient( loopPtr = loopPtr->nextPtr; } } else { - register TkTextLine *linePtr = nodePtr->children.linePtr; + TkTextLine *linePtr = nodePtr->children.linePtr; while (linePtr != NULL) { if (!*counting && (linePtr == start)) { @@ -735,7 +735,7 @@ AdjustPixelClient( *counting = 0; } if (newPixelReferences != treePtr->pixelReferences) { - linePtr->pixels = ckrealloc(linePtr->pixels, + linePtr->pixels = (int *)ckrealloc(linePtr->pixels, sizeof(int) * 2 * newPixelReferences); } @@ -752,7 +752,7 @@ AdjustPixelClient( } } if (newPixelReferences != treePtr->pixelReferences) { - nodePtr->numPixels = ckrealloc(nodePtr->numPixels, + nodePtr->numPixels = (int *)ckrealloc(nodePtr->numPixels, sizeof(int) * newPixelReferences); } nodePtr->numPixels[useReference] = pixelCount; @@ -802,7 +802,7 @@ RemovePixelClient( ckfree(nodePtr->numPixels); nodePtr->numPixels = NULL; } else { - nodePtr->numPixels = ckrealloc(nodePtr->numPixels, + nodePtr->numPixels = (int *)ckrealloc(nodePtr->numPixels, sizeof(int) * (treePtr->pixelReferences - 1)); } if (nodePtr->level != 0) { @@ -812,7 +812,7 @@ RemovePixelClient( nodePtr = nodePtr->nextPtr; } } else { - register TkTextLine *linePtr = nodePtr->children.linePtr; + TkTextLine *linePtr = nodePtr->children.linePtr; while (linePtr != NULL) { if (overwriteWithLast != -1) { linePtr->pixels[2*overwriteWithLast] = @@ -823,7 +823,7 @@ RemovePixelClient( if (treePtr->pixelReferences == 1) { linePtr->pixels = NULL; } else { - linePtr->pixels = ckrealloc(linePtr->pixels, + linePtr->pixels = (int *)ckrealloc(linePtr->pixels, sizeof(int) * 2 * (treePtr->pixelReferences-1)); } linePtr = linePtr->nextPtr; @@ -850,7 +850,7 @@ RemovePixelClient( static void DestroyNode( - register Node *nodePtr) /* Destroy from this node downwards. */ + Node *nodePtr) /* Destroy from this node downwards. */ { if (nodePtr->level == 0) { TkTextLine *linePtr; @@ -868,7 +868,7 @@ DestroyNode( ckfree(linePtr); } } else { - register Node *childPtr; + Node *childPtr; while (nodePtr->children.nodePtr != NULL) { childPtr = nodePtr->children.nodePtr; @@ -900,10 +900,10 @@ DestroyNode( static void DeleteSummaries( - register Summary *summaryPtr) + Summary *summaryPtr) /* First in list of node's tag summaries. */ { - register Summary *nextPtr; + Summary *nextPtr; while (summaryPtr != NULL) { nextPtr = summaryPtr->nextPtr; @@ -932,7 +932,7 @@ DeleteSummaries( int TkBTreeAdjustPixelHeight( const TkText *textPtr, /* Client of the B-tree. */ - register TkTextLine *linePtr, + TkTextLine *linePtr, /* The logical line to update. */ int newPixelHeight, /* The line's known height in pixels. */ int mergedLogicalLines) /* The number of extra logical lines which @@ -942,7 +942,7 @@ TkBTreeAdjustPixelHeight( * height associated with the given * linePtr. */ { - register Node *nodePtr; + Node *nodePtr; int changeToPixelCount; /* Counts change to total number of pixels in * file. */ int pixelReference = textPtr->pixelReference; @@ -1001,7 +1001,7 @@ TkBTreeAdjustPixelHeight( void TkBTreeInsertChars( TkTextBTree tree, /* Tree to insert into. */ - register TkTextIndex *indexPtr, + TkTextIndex *indexPtr, /* Indicates where to insert text. When the * function returns, this index is no longer * valid because of changes to the segment @@ -1009,8 +1009,8 @@ TkBTreeInsertChars( const char *string) /* Pointer to bytes to insert (may contain * newlines, must be null-terminated). */ { - register Node *nodePtr; - register TkTextSegment *prevPtr; + Node *nodePtr; + TkTextSegment *prevPtr; /* The segment just before the first new * segment (NULL means new segment is at * beginning of line). */ @@ -1019,10 +1019,10 @@ TkBTreeInsertChars( * insert at beginning of line. */ TkTextLine *linePtr; /* Current line (new segments are added to * this line). */ - register TkTextSegment *segPtr; + TkTextSegment *segPtr; TkTextLine *newLinePtr; size_t chunkSize; /* # characters in current chunk. */ - register const char *eol; /* Pointer to character just after last one in + const char *eol; /* Pointer to character just after last one in * current chunk. */ int changeToLineCount; /* Counts change to total number of lines in * file. */ @@ -1044,7 +1044,7 @@ TkBTreeInsertChars( changeToLineCount = 0; if (treePtr->pixelReferences > PIXEL_CLIENTS) { - changeToPixelCount = ckalloc(sizeof(int) * treePtr->pixelReferences); + changeToPixelCount = (int *)ckalloc(sizeof(int) * treePtr->pixelReferences); } else { changeToPixelCount = pixels; } @@ -1060,7 +1060,7 @@ TkBTreeInsertChars( } } chunkSize = eol-string; - segPtr = ckalloc(CSEG_SIZE(chunkSize)); + segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(chunkSize)); segPtr->typePtr = &tkTextCharType; if (curPtr == NULL) { segPtr->nextPtr = linePtr->segPtr; @@ -1082,8 +1082,8 @@ TkBTreeInsertChars( * the remainder of the old line to it. */ - newLinePtr = ckalloc(sizeof(TkTextLine)); - newLinePtr->pixels = + newLinePtr = (TkTextLine *)ckalloc(sizeof(TkTextLine)); + newLinePtr->pixels = (int *) ckalloc(sizeof(int) * 2 * treePtr->pixelReferences); newLinePtr->parentPtr = linePtr->parentPtr; @@ -1312,10 +1312,10 @@ CleanupLine( void TkBTreeDeleteIndexRange( TkTextBTree tree, /* Tree to delete from. */ - register TkTextIndex *index1Ptr, + TkTextIndex *index1Ptr, /* Indicates first character that is to be * deleted. */ - register TkTextIndex *index2Ptr) + TkTextIndex *index2Ptr) /* Indicates character just after the last one * that is to be deleted. */ { @@ -1596,8 +1596,8 @@ TkBTreeFindLine( int line) /* Index of desired line. */ { BTree *treePtr = (BTree *) tree; - register Node *nodePtr; - register TkTextLine *linePtr; + Node *nodePtr; + TkTextLine *linePtr; if (treePtr == NULL) { treePtr = (BTree *) textPtr->sharedTextPtr->tree; @@ -1686,8 +1686,8 @@ TkBTreeFindPixelLine( int *pixelOffset) /* Used to return offset. */ { BTree *treePtr = (BTree *) tree; - register Node *nodePtr; - register TkTextLine *linePtr; + Node *nodePtr; + TkTextLine *linePtr; int pixelReference = textPtr->pixelReference; nodePtr = treePtr->rootPtr; @@ -1755,10 +1755,10 @@ TkBTreeFindPixelLine( TkTextLine * TkBTreeNextLine( const TkText *textPtr, /* Next line in the context of this client. */ - register TkTextLine *linePtr) + TkTextLine *linePtr) /* Pointer to existing line in B-tree. */ { - register Node *nodePtr; + Node *nodePtr; if (linePtr->nextPtr != NULL) { if (textPtr != NULL && (linePtr == textPtr->end)) { @@ -1811,12 +1811,12 @@ TkBTreeNextLine( TkTextLine * TkBTreePreviousLine( TkText *textPtr, /* Relative to this client of the B-tree. */ - register TkTextLine *linePtr) + TkTextLine *linePtr) /* Pointer to existing line in B-tree. */ { - register Node *nodePtr; - register Node *node2Ptr; - register TkTextLine *prevPtr; + Node *nodePtr; + Node *node2Ptr; + TkTextLine *prevPtr; if (textPtr != NULL && textPtr->start == linePtr) { return NULL; @@ -1895,8 +1895,8 @@ TkBTreePixelsTo( const TkText *textPtr, /* Relative to this client of the B-tree. */ TkTextLine *linePtr) /* Pointer to existing line in B-tree. */ { - register TkTextLine *linePtr2; - register Node *nodePtr, *parentPtr; + TkTextLine *linePtr2; + Node *nodePtr, *parentPtr; int index; int pixelReference = textPtr->pixelReference; @@ -1921,7 +1921,7 @@ TkBTreePixelsTo( for (parentPtr = nodePtr->parentPtr ; parentPtr != NULL; nodePtr = parentPtr, parentPtr = parentPtr->parentPtr) { - register Node *nodePtr2; + Node *nodePtr2; for (nodePtr2 = parentPtr->children.nodePtr; nodePtr2 != nodePtr; nodePtr2 = nodePtr2->nextPtr) { @@ -1957,8 +1957,8 @@ TkBTreeLinesTo( const TkText *textPtr, /* Relative to this client of the B-tree. */ TkTextLine *linePtr) /* Pointer to existing line in B-tree. */ { - register TkTextLine *linePtr2; - register Node *nodePtr, *parentPtr, *nodePtr2; + TkTextLine *linePtr2; + Node *nodePtr, *parentPtr, *nodePtr2; int index; /* @@ -2046,7 +2046,7 @@ TkBTreeLinkSegment( TkTextIndex *indexPtr) /* Where to add segment: it gets linked in * just before the segment indicated here. */ { - register TkTextSegment *prevPtr; + TkTextSegment *prevPtr; prevPtr = SplitSeg(indexPtr); if (prevPtr == NULL) { @@ -2086,7 +2086,7 @@ TkBTreeUnlinkSegment( TkTextSegment *segPtr, /* Segment to be unlinked. */ TkTextLine *linePtr) /* Line that currently contains segment. */ { - register TkTextSegment *prevPtr; + TkTextSegment *prevPtr; if (linePtr->segPtr == segPtr) { linePtr->segPtr = segPtr->nextPtr; @@ -2135,9 +2135,9 @@ TkBTreeUnlinkSegment( int TkBTreeTag( - register TkTextIndex *index1Ptr, + TkTextIndex *index1Ptr, /* Indicates first character in range. */ - register TkTextIndex *index2Ptr, + TkTextIndex *index2Ptr, /* Indicates character just after the last one * in range. */ TkTextTag *tagPtr, /* Tag to add or remove. */ @@ -2157,7 +2157,7 @@ TkBTreeTag( oldState = TkBTreeCharTagged(index1Ptr, tagPtr); if ((add != 0) ^ oldState) { - segPtr = ckalloc(TSEG_SIZE); + segPtr = (TkTextSegment *)ckalloc(TSEG_SIZE); segPtr->typePtr = (add) ? &tkTextToggleOnType : &tkTextToggleOffType; prevPtr = SplitSeg(index1Ptr); if (prevPtr == NULL) { @@ -2228,7 +2228,7 @@ TkBTreeTag( } } if ((add != 0) ^ oldState) { - segPtr = ckalloc(TSEG_SIZE); + segPtr = (TkTextSegment *)ckalloc(TSEG_SIZE); segPtr->typePtr = (add) ? &tkTextToggleOffType : &tkTextToggleOnType; prevPtr = SplitSeg(index2Ptr); if (prevPtr == NULL) { @@ -2285,14 +2285,14 @@ TkBTreeTag( static void ChangeNodeToggleCount( - register Node *nodePtr, /* Node whose toggle count for a tag must be + Node *nodePtr, /* Node whose toggle count for a tag must be * changed. */ TkTextTag *tagPtr, /* Information about tag. */ int delta) /* Amount to add to current toggle count for * tag (may be negative). */ { - register Summary *summaryPtr, *prevPtr; - register Node *node2Ptr; + Summary *summaryPtr, *prevPtr; + Node *node2Ptr; int rootLevel; /* Level of original tag root. */ tagPtr->toggleCount += delta; @@ -2372,7 +2372,7 @@ ChangeNodeToggleCount( Node *rootNodePtr = tagPtr->tagRootPtr; - summaryPtr = ckalloc(sizeof(Summary)); + summaryPtr = (Summary *)ckalloc(sizeof(Summary)); summaryPtr->tagPtr = tagPtr; summaryPtr->toggleCount = tagPtr->toggleCount - delta; summaryPtr->nextPtr = rootNodePtr->summaryPtr; @@ -2381,7 +2381,7 @@ ChangeNodeToggleCount( rootLevel = rootNodePtr->level; tagPtr->tagRootPtr = rootNodePtr; } - summaryPtr = ckalloc(sizeof(Summary)); + summaryPtr = (Summary *)ckalloc(sizeof(Summary)); summaryPtr->tagPtr = tagPtr; summaryPtr->toggleCount = delta; summaryPtr->nextPtr = nodePtr->summaryPtr; @@ -2471,10 +2471,10 @@ FindTagStart( TkTextTag *tagPtr, /* Tag to search for. */ TkTextIndex *indexPtr) /* Return - index information. */ { - register Node *nodePtr; - register TkTextLine *linePtr; - register TkTextSegment *segPtr; - register Summary *summaryPtr; + Node *nodePtr; + TkTextLine *linePtr; + TkTextSegment *segPtr; + Summary *summaryPtr; int offset; nodePtr = tagPtr->tagRootPtr; @@ -2556,10 +2556,10 @@ FindTagEnd( TkTextTag *tagPtr, /* Tag to search for. */ TkTextIndex *indexPtr) /* Return - index information. */ { - register Node *nodePtr, *lastNodePtr; - register TkTextLine *linePtr ,*lastLinePtr; - register TkTextSegment *segPtr, *lastSegPtr, *last2SegPtr; - register Summary *summaryPtr; + Node *nodePtr, *lastNodePtr; + TkTextLine *linePtr ,*lastLinePtr; + TkTextSegment *segPtr, *lastSegPtr, *last2SegPtr; + Summary *summaryPtr; int lastoffset, lastoffset2, offset; nodePtr = tagPtr->tagRootPtr; @@ -2652,7 +2652,7 @@ TkBTreeStartSearch( * position *will* be returned. */ TkTextTag *tagPtr, /* Tag to search for. NULL means search for * any tag. */ - register TkTextSearch *searchPtr) + TkTextSearch *searchPtr) /* Where to store information about search's * progress. */ { @@ -2748,7 +2748,7 @@ TkBTreeStartSearchBack( * position *will* be returned. */ TkTextTag *tagPtr, /* Tag to search for. NULL means search for * any tag. */ - register TkTextSearch *searchPtr) + TkTextSearch *searchPtr) /* Where to store information about search's * progress. */ { @@ -2849,14 +2849,14 @@ TkBTreeStartSearchBack( int TkBTreeNextTag( - register TkTextSearch *searchPtr) + TkTextSearch *searchPtr) /* Information about search in progress; must * have been set up by call to * TkBTreeStartSearch. */ { - register TkTextSegment *segPtr; - register Node *nodePtr; - register Summary *summaryPtr; + TkTextSegment *segPtr; + Node *nodePtr; + Summary *summaryPtr; if (searchPtr->linesLeft <= 0) { goto searchOver; @@ -3014,15 +3014,15 @@ TkBTreeNextTag( int TkBTreePrevTag( - register TkTextSearch *searchPtr) + TkTextSearch *searchPtr) /* Information about search in progress; must * have been set up by call to * TkBTreeStartSearch. */ { - register TkTextSegment *segPtr, *prevPtr; - register TkTextLine *linePtr, *prevLinePtr; - register Node *nodePtr, *node2Ptr, *prevNodePtr; - register Summary *summaryPtr; + TkTextSegment *segPtr, *prevPtr; + TkTextLine *linePtr, *prevLinePtr; + Node *nodePtr, *node2Ptr, *prevNodePtr; + Summary *summaryPtr; int byteIndex, linesSkipped; int pastLast; /* Saw last marker during scan. */ @@ -3232,9 +3232,9 @@ TkBTreeCharTagged( * check for a tag. */ TkTextTag *tagPtr) /* Tag of interest. */ { - register Node *nodePtr; - register TkTextLine *siblingLinePtr; - register TkTextSegment *segPtr; + Node *nodePtr; + TkTextLine *siblingLinePtr; + TkTextSegment *segPtr; TkTextSegment *toggleSegPtr; int toggles, index; @@ -3288,8 +3288,8 @@ TkBTreeCharTagged( toggles = 0; for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL; nodePtr = nodePtr->parentPtr) { - register Node *siblingPtr; - register Summary *summaryPtr; + Node *siblingPtr; + Summary *summaryPtr; for (siblingPtr = nodePtr->parentPtr->children.nodePtr; siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) { @@ -3347,9 +3347,9 @@ TkBTreeGetTags( int *numTagsPtr) /* Store number of tags found at this * location. */ { - register Node *nodePtr; - register TkTextLine *siblingLinePtr; - register TkTextSegment *segPtr; + Node *nodePtr; + TkTextLine *siblingLinePtr; + TkTextSegment *segPtr; TkTextLine *linePtr; int src, dst, index; TagInfo tagInfo; @@ -3357,8 +3357,8 @@ TkBTreeGetTags( tagInfo.numTags = 0; tagInfo.arraySize = NUM_TAG_INFOS; - tagInfo.tagPtrs = ckalloc(NUM_TAG_INFOS * sizeof(TkTextTag *)); - tagInfo.counts = ckalloc(NUM_TAG_INFOS * sizeof(int)); + tagInfo.tagPtrs = (TkTextTag **)ckalloc(NUM_TAG_INFOS * sizeof(TkTextTag *)); + tagInfo.counts = (int *)ckalloc(NUM_TAG_INFOS * sizeof(int)); /* * Record tag toggles within the line of indexPtr but preceding indexPtr. @@ -3410,8 +3410,8 @@ TkBTreeGetTags( for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL; nodePtr = nodePtr->parentPtr) { - register Node *siblingPtr; - register Summary *summaryPtr; + Node *siblingPtr; + Summary *summaryPtr; for (siblingPtr = nodePtr->parentPtr->children.nodePtr; siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) { @@ -3492,17 +3492,17 @@ TkTextIsElided( * indexPtr's elide state will be stored and * returned. */ { - register Node *nodePtr; - register TkTextLine *siblingLinePtr; - register TkTextSegment *segPtr; - register TkTextTag *tagPtr = NULL; - register int i, index; - register TkTextElideInfo *infoPtr; + Node *nodePtr; + TkTextLine *siblingLinePtr; + TkTextSegment *segPtr; + TkTextTag *tagPtr = NULL; + int i, index; + TkTextElideInfo *infoPtr; TkTextLine *linePtr; int elide; if (elideInfo == NULL) { - infoPtr = ckalloc(sizeof(TkTextElideInfo)); + infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo)); } else { infoPtr = elideInfo; } @@ -3517,8 +3517,8 @@ TkTextIsElided( */ if (LOTSA_TAGS < infoPtr->numTags) { - infoPtr->tagCnts = ckalloc(sizeof(int) * infoPtr->numTags); - infoPtr->tagPtrs = ckalloc(sizeof(TkTextTag *) * infoPtr->numTags); + infoPtr->tagCnts = (int *)ckalloc(sizeof(int) * infoPtr->numTags); + infoPtr->tagPtrs = (TkTextTag **)ckalloc(sizeof(TkTextTag *) * infoPtr->numTags); } for (i=0; inumTags; i++) { @@ -3591,8 +3591,8 @@ TkTextIsElided( for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL; nodePtr = nodePtr->parentPtr) { - register Node *siblingPtr; - register Summary *summaryPtr; + Node *siblingPtr; + Summary *summaryPtr; for (siblingPtr = nodePtr->parentPtr->children.nodePtr; siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) { @@ -3697,7 +3697,7 @@ IncCount( TagInfo *tagInfoPtr) /* Holds cumulative information about tags; * increment count here. */ { - register TkTextTag **tagPtrPtr; + TkTextTag **tagPtrPtr; int count; for (tagPtrPtr = tagInfoPtr->tagPtrs, count = tagInfoPtr->numTags; @@ -3718,12 +3718,12 @@ IncCount( int *newCounts, newSize; newSize = 2 * tagInfoPtr->arraySize; - newTags = ckalloc(newSize * sizeof(TkTextTag *)); + newTags = (TkTextTag **)ckalloc(newSize * sizeof(TkTextTag *)); memcpy(newTags, tagInfoPtr->tagPtrs, tagInfoPtr->arraySize * sizeof(TkTextTag *)); ckfree(tagInfoPtr->tagPtrs); tagInfoPtr->tagPtrs = newTags; - newCounts = ckalloc(newSize * sizeof(int)); + newCounts = (int *)ckalloc(newSize * sizeof(int)); memcpy(newCounts, tagInfoPtr->counts, tagInfoPtr->arraySize * sizeof(int)); ckfree(tagInfoPtr->counts); @@ -3759,11 +3759,11 @@ TkBTreeCheck( TkTextBTree tree) /* Tree to check. */ { BTree *treePtr = (BTree *) tree; - register Summary *summaryPtr; - register Node *nodePtr; - register TkTextLine *linePtr; - register TkTextSegment *segPtr; - register TkTextTag *tagPtr; + Summary *summaryPtr; + Node *nodePtr; + TkTextLine *linePtr; + TkTextSegment *segPtr; + TkTextTag *tagPtr; Tcl_HashEntry *entryPtr; Tcl_HashSearch search; int count; @@ -3774,7 +3774,7 @@ TkBTreeCheck( for (entryPtr=Tcl_FirstHashEntry(&treePtr->sharedTextPtr->tagTable,&search); entryPtr != NULL ; entryPtr = Tcl_NextHashEntry(&search)) { - tagPtr = Tcl_GetHashValue(entryPtr); + tagPtr = (TkTextTag *)Tcl_GetHashValue(entryPtr); nodePtr = tagPtr->tagRootPtr; if (nodePtr == NULL) { if (tagPtr->toggleCount != 0) { @@ -3898,14 +3898,14 @@ TkBTreeCheck( static void CheckNodeConsistency( - register Node *nodePtr, /* Node whose subtree should be checked. */ + Node *nodePtr, /* Node whose subtree should be checked. */ int references) /* Number of referring widgets which have * pixel counts. */ { - register Node *childNodePtr; - register Summary *summaryPtr, *summaryPtr2; - register TkTextLine *linePtr; - register TkTextSegment *segPtr; + Node *childNodePtr; + Summary *summaryPtr, *summaryPtr2; + TkTextLine *linePtr; + TkTextSegment *segPtr; int numChildren, numLines, toggleCount, minChildren, i; int *numPixels; int pixels[PIXEL_CLIENTS]; @@ -3926,7 +3926,7 @@ CheckNodeConsistency( numChildren = 0; numLines = 0; if (references > PIXEL_CLIENTS) { - numPixels = ckalloc(sizeof(int) * references); + numPixels = (int *)ckalloc(sizeof(int) * references); } else { numPixels = pixels; } @@ -4087,7 +4087,7 @@ CheckNodeConsistency( static void Rebalance( BTree *treePtr, /* Tree that is being rebalanced. */ - register Node *nodePtr) /* Node that may be out of balance. */ + Node *nodePtr) /* Node that may be out of balance. */ { /* * Loop over the entire ancestral chain of the node, working up through @@ -4095,8 +4095,8 @@ Rebalance( */ for ( ; nodePtr != NULL; nodePtr = nodePtr->parentPtr) { - register Node *newPtr, *childPtr; - register TkTextLine *linePtr; + Node *newPtr, *childPtr; + TkTextLine *linePtr; int i; /* @@ -4114,7 +4114,7 @@ Rebalance( */ if (nodePtr->parentPtr == NULL) { - newPtr = ckalloc(sizeof(Node)); + newPtr = (Node *)ckalloc(sizeof(Node)); newPtr->parentPtr = NULL; newPtr->nextPtr = NULL; newPtr->summaryPtr = NULL; @@ -4122,7 +4122,7 @@ Rebalance( newPtr->children.nodePtr = nodePtr; newPtr->numChildren = 1; newPtr->numLines = nodePtr->numLines; - newPtr->numPixels = + newPtr->numPixels = (int *) ckalloc(sizeof(int) * treePtr->pixelReferences); for (i=0; ipixelReferences; i++) { newPtr->numPixels[i] = nodePtr->numPixels[i]; @@ -4130,8 +4130,8 @@ Rebalance( RecomputeNodeCounts(treePtr, newPtr); treePtr->rootPtr = newPtr; } - newPtr = ckalloc(sizeof(Node)); - newPtr->numPixels = + newPtr = (Node *)ckalloc(sizeof(Node)); + newPtr->numPixels = (int *) ckalloc(sizeof(int) * treePtr->pixelReferences); for (i=0; ipixelReferences; i++) { newPtr->numPixels[i] = 0; @@ -4170,7 +4170,7 @@ Rebalance( } while (nodePtr->numChildren < MIN_CHILDREN) { - register Node *otherPtr; + Node *otherPtr; Node *halfwayNodePtr = NULL; /* Initialization needed only */ TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */ int totalChildren, firstChildren, i; @@ -4234,7 +4234,7 @@ Rebalance( otherPtr->children.linePtr = NULL; } if (nodePtr->level == 0) { - register TkTextLine *linePtr; + TkTextLine *linePtr; for (linePtr = nodePtr->children.linePtr, i = 1; linePtr->nextPtr != NULL; @@ -4250,7 +4250,7 @@ Rebalance( i++; } } else { - register Node *childPtr; + Node *childPtr; for (childPtr = nodePtr->children.nodePtr, i = 1; childPtr->nextPtr != NULL; @@ -4326,14 +4326,14 @@ Rebalance( static void RecomputeNodeCounts( - register BTree *treePtr, /* The whole B-tree. */ - register Node *nodePtr) /* Node whose tag summary information must be + BTree *treePtr, /* The whole B-tree. */ + Node *nodePtr) /* Node whose tag summary information must be * recomputed. */ { - register Summary *summaryPtr, *summaryPtr2; - register Node *childPtr; - register TkTextLine *linePtr; - register TkTextSegment *segPtr; + Summary *summaryPtr, *summaryPtr2; + Node *childPtr; + TkTextLine *linePtr; + TkTextSegment *segPtr; TkTextTag *tagPtr; int ref; @@ -4377,7 +4377,7 @@ RecomputeNodeCounts( for (summaryPtr = nodePtr->summaryPtr; ; summaryPtr = summaryPtr->nextPtr) { if (summaryPtr == NULL) { - summaryPtr = ckalloc(sizeof(Summary)); + summaryPtr = (Summary *)ckalloc(sizeof(Summary)); summaryPtr->tagPtr = tagPtr; summaryPtr->toggleCount = 1; summaryPtr->nextPtr = nodePtr->summaryPtr; @@ -4405,7 +4405,7 @@ RecomputeNodeCounts( for (summaryPtr = nodePtr->summaryPtr; ; summaryPtr = summaryPtr->nextPtr) { if (summaryPtr == NULL) { - summaryPtr = ckalloc(sizeof(Summary)); + summaryPtr = (Summary *)ckalloc(sizeof(Summary)); summaryPtr->tagPtr = summaryPtr2->tagPtr; summaryPtr->toggleCount = summaryPtr2->toggleCount; summaryPtr->nextPtr = nodePtr->summaryPtr; @@ -4558,8 +4558,8 @@ CharSplitProc( { TkTextSegment *newPtr1, *newPtr2; - newPtr1 = ckalloc(CSEG_SIZE(index)); - newPtr2 = ckalloc(CSEG_SIZE(segPtr->size - index)); + newPtr1 = (TkTextSegment *)ckalloc(CSEG_SIZE(index)); + newPtr2 = (TkTextSegment *)ckalloc(CSEG_SIZE(segPtr->size - index)); newPtr1->typePtr = &tkTextCharType; newPtr1->nextPtr = newPtr2; newPtr1->size = index; @@ -4600,12 +4600,13 @@ CharCleanupProc( TkTextLine *linePtr) /* Line containing segments (not used). */ { TkTextSegment *segPtr2, *newPtr; + (void)linePtr; segPtr2 = segPtr->nextPtr; if ((segPtr2 == NULL) || (segPtr2->typePtr != &tkTextCharType)) { return segPtr; } - newPtr = ckalloc(CSEG_SIZE(segPtr->size + segPtr2->size)); + newPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(segPtr->size + segPtr2->size)); newPtr->typePtr = &tkTextCharType; newPtr->nextPtr = segPtr2->nextPtr; newPtr->size = segPtr->size + segPtr2->size; @@ -4642,6 +4643,9 @@ CharDeleteProc( * deleted, so everything must get cleaned * up. */ { + (void)linePtr; + (void)treeGone; + ckfree(segPtr); return 0; } @@ -4669,6 +4673,8 @@ CharCheckProc( TkTextSegment *segPtr, /* Segment to check. */ TkTextLine *linePtr) /* Line containing segment. */ { + (void)linePtr; + /* * Make sure that the segment contains the number of characters indicated * by its header, and that the last segment in a line ends in a newline. @@ -4858,7 +4864,7 @@ ToggleCheckProc( TkTextSegment *segPtr, /* Segment to check. */ TkTextLine *linePtr) /* Line containing segment. */ { - register Summary *summaryPtr; + Summary *summaryPtr; int needSummary; if (segPtr->size != 0) { diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 33b9720..7bcaed9 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -654,10 +654,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; @@ -713,7 +713,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 @@ -769,7 +769,7 @@ GetStyle( * information is wanted. */ { TkTextTag **tagPtrs; - register TkTextTag *tagPtr; + TkTextTag *tagPtr; StyleValues styleValues; TextStyle *stylePtr; Tcl_HashEntry *hPtr; @@ -998,7 +998,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; } @@ -1007,7 +1007,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; @@ -1065,7 +1065,7 @@ GetStyle( static void FreeStyle( TkText *textPtr, /* Information about overall widget. */ - register TextStyle *stylePtr) + TextStyle *stylePtr) /* Information about style to free. */ { if (stylePtr->refCount-- <= 1) { @@ -1127,7 +1127,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. */ @@ -1181,7 +1181,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; @@ -1430,7 +1430,7 @@ LayoutDLine( continue; } if (chunkPtr == NULL) { - chunkPtr = ckalloc(sizeof(TkTextDispChunk)); + chunkPtr = (TkTextDispChunk *)ckalloc(sizeof(TkTextDispChunk)); chunkPtr->nextPtr = NULL; chunkPtr->clientData = NULL; } @@ -1828,8 +1828,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; @@ -1866,7 +1866,7 @@ UpdateDisplayInfo( y = dInfoPtr->y - dInfoPtr->newTopPixelOffset; maxY = dInfoPtr->maxY; while (1) { - register DLine *newPtr; + DLine *newPtr; if (index.linePtr == lastLinePtr) { break; @@ -1977,7 +1977,7 @@ UpdateDisplayInfo( */ if (index.linePtr != prevPtr->index.linePtr) { - register DLine *nextPtr; + DLine *nextPtr; nextPtr = dlPtr; while ((nextPtr != NULL) @@ -2346,7 +2346,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). */ @@ -2359,8 +2359,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++; @@ -2379,7 +2379,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) { @@ -2427,14 +2427,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; @@ -2606,7 +2606,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 @@ -3002,7 +3002,7 @@ static void AsyncUpdateLineMetrics( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TextDInfo *dInfoPtr = textPtr->dInfoPtr; int lineNum; @@ -4160,9 +4160,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; @@ -4246,7 +4246,7 @@ DisplayText( */ for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL; dlPtr = dlPtr->nextPtr) { - register DLine *dlPtr2; + DLine *dlPtr2; int offset, height, y, oldY; TkRegion damageRgn; @@ -4544,7 +4544,7 @@ DisplayText( * proc of embedded windows only. */ #endif - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL); chunkPtr = chunkPtr->nextPtr) { @@ -4746,7 +4746,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; @@ -5004,7 +5004,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; @@ -5344,7 +5344,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; @@ -6350,7 +6350,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 @@ -6836,7 +6836,7 @@ static void AsyncUpdateYScrollbar( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; textPtr->dInfoPtr->scrollbarTimer = NULL; @@ -6871,7 +6871,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. */ { @@ -7041,7 +7041,7 @@ TkTextPixelIndex( * border of the widget). */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register DLine *dlPtr, *validDlPtr; + DLine *dlPtr, *validDlPtr; int nearby = 0; /* @@ -7143,7 +7143,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 @@ -7271,7 +7271,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) { @@ -7341,7 +7341,7 @@ TkTextIndexBbox( { TextDInfo *dInfoPtr = textPtr->dInfoPtr; DLine *dlPtr; - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; int byteCount; /* @@ -7550,6 +7550,11 @@ ElideBboxProc( int *heightPtr) /* Gets filled in with height of character, in * pixels. */ { + (void)textPtr; + (void)index; + (void)lineHeight; + (void)baseline; + *xPtr = chunkPtr->x; *yPtr = y; *widthPtr = *heightPtr = 0; @@ -7565,6 +7570,9 @@ ElideMeasureProc( int x) /* X-coordinate, in same coordinate system as * chunkPtr->x. */ { + (void)chunkPtr; + (void)x; + return 0 /*chunkPtr->numBytes - 1*/; } @@ -7606,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. */ @@ -7623,6 +7631,8 @@ TkTextCharLayoutProc( BaseCharInfo *bciPtr; Tcl_DString *baseString; #endif + (void)textPtr; + (void)indexPtr; /* * Figure out how many characters will fit in the space we've got. Include @@ -7757,7 +7767,7 @@ TkTextCharLayoutProc( chunkPtr->breakIndex = -1; #if !TK_LAYOUT_WITH_BASE_CHUNKS - ciPtr = ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit); + ciPtr = (CharInfo *)ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit); chunkPtr->clientData = ciPtr; memcpy(ciPtr->chars, p, bytesThatFit); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ @@ -7870,7 +7880,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) { @@ -7959,7 +7969,7 @@ CharDisplayProc( int screenY) /* 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; @@ -7967,6 +7977,9 @@ CharDisplayProc( #if TK_DRAW_IN_CONTEXT BaseCharInfo *bciPtr; #endif /* TK_DRAW_IN_CONTEXT */ + (void)textPtr; + (void)height; + (void)screenY; if ((x + chunkPtr->width) <= 0) { /* @@ -8110,7 +8123,8 @@ CharUndisplayProc( TkText *textPtr, /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { - CharInfo *ciPtr = chunkPtr->clientData; + CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; + (void)textPtr; if (ciPtr) { #if TK_LAYOUT_WITH_BASE_CHUNKS @@ -8213,8 +8227,10 @@ CharBboxProc( int *heightPtr) /* Gets filled in with height of character, in * pixels. */ { - CharInfo *ciPtr = chunkPtr->clientData; + CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; int maxX; + (void)textPtr; + (void)lineHeight; maxX = chunkPtr->width + chunkPtr->x; CharChunkMeasureChars(chunkPtr, NULL, 0, 0, byteIndex, @@ -8376,7 +8392,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; @@ -8397,7 +8413,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); diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 3384a1f..9cb43c4 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -117,7 +117,7 @@ static const Tk_OptionSpec optionSpecs[] = { int TkTextImageCmd( - 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 @@ -125,7 +125,7 @@ TkTextImageCmd( * objv[1] is "image". */ { int idx; - register TkTextSegment *eiPtr; + TkTextSegment *eiPtr; TkTextIndex index; static const char *const optionStrings[] = { "cget", "configure", "create", "names", NULL @@ -242,7 +242,7 @@ TkTextImageCmd( * Create the new image segment and initialize it. */ - eiPtr = ckalloc(EI_SEG_SIZE); + eiPtr = (TkTextSegment *)ckalloc(EI_SEG_SIZE); eiPtr->typePtr = &tkTextEmbImageType; eiPtr->size = 1; eiPtr->body.ei.sharedTextPtr = textPtr->sharedTextPtr; @@ -287,7 +287,7 @@ TkTextImageCmd( for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), + (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); @@ -389,7 +389,7 @@ EmbImageConfigure( len = strlen(name); for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - char *haveName = + char *haveName = (char *) Tcl_GetHashKey(&textPtr->sharedTextPtr->imageTable, hPtr); if (strncmp(name, haveName, len) == 0) { @@ -419,7 +419,7 @@ EmbImageConfigure( &dummy); Tcl_SetHashValue(hPtr, eiPtr); Tcl_SetObjResult(textPtr->interp, Tcl_NewStringObj(name, -1)); - eiPtr->body.ei.name = ckalloc(Tcl_DStringLength(&newName) + 1); + eiPtr->body.ei.name = (char *)ckalloc(Tcl_DStringLength(&newName) + 1); strcpy(eiPtr->body.ei.name, name); Tcl_DStringFree(&newName); @@ -454,6 +454,8 @@ EmbImageDeleteProc( * up. */ { Tcl_HashEntry *hPtr; + (void)linePtr; + (void)treeGone; if (eiPtr->body.ei.image != NULL) { hPtr = Tcl_FindHashEntry(&eiPtr->body.ei.sharedTextPtr->imageTable, @@ -544,12 +546,15 @@ EmbImageLayoutProc( TkWrapMode wrapMode, /* Wrap mode to use for line: * 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. */ { int width, height; + (void)indexPtr; + (void)maxChars; + (void)wrapMode; if (offset != 0) { Tcl_Panic("Non-zero offset in EmbImageLayoutProc"); @@ -621,6 +626,8 @@ EmbImageCheckProc( TkTextSegment *eiPtr, /* Segment to check. */ TkTextLine *linePtr) /* Line containing segment. */ { + (void)linePtr; + if (eiPtr->nextPtr == NULL) { Tcl_Panic("EmbImageCheckProc: embedded image is last segment in line"); } @@ -665,9 +672,11 @@ EmbImageDisplayProc( int screenY) /* Y-coordinate in text window that * corresponds to y. */ { - TkTextSegment *eiPtr = chunkPtr->clientData; + TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData; int lineX, imageX, imageY, width, height; Tk_Image image; + (void)display; + (void)screenY; image = eiPtr->body.ei.image; if (image == NULL) { @@ -729,8 +738,10 @@ EmbImageBboxProc( int *heightPtr) /* Gets filled in with height of image, in * pixels. */ { - TkTextSegment *eiPtr = chunkPtr->clientData; + TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData; Tk_Image image; + (void)textPtr; + (void)index; image = eiPtr->body.ei.image; if (image != NULL) { @@ -794,7 +805,7 @@ TkTextImageIndex( if (hPtr == NULL) { return 0; } - eiPtr = Tcl_GetHashValue(hPtr); + eiPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = eiPtr->body.ei.linePtr; indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr); @@ -828,8 +839,14 @@ EmbImageProc( int imgWidth, int imgHeight)/* New dimensions of image. */ { - TkTextSegment *eiPtr = clientData; + TkTextSegment *eiPtr = (TkTextSegment *)clientData; TkTextIndex index; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; index.tree = eiPtr->body.ei.sharedTextPtr->tree; index.linePtr = eiPtr->body.ei.linePtr; diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 523a8cb..1db1208 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -107,7 +107,7 @@ DupTextIndexInternalRep( TkSizeT epoch; TkTextIndex *dupIndexPtr, *indexPtr; - dupIndexPtr = ckalloc(sizeof(TkTextIndex)); + dupIndexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex)); indexPtr = GET_TEXTINDEX(srcPtr); epoch = GET_INDEXEPOCH(srcPtr); @@ -139,7 +139,7 @@ UpdateStringOfTextIndex( len = TkTextPrintIndex(indexPtr->textPtr, indexPtr, buffer); - objPtr->bytes = ckalloc(len + 1); + objPtr->bytes = (char *)ckalloc(len + 1); strcpy(objPtr->bytes, buffer); objPtr->length = len; } @@ -176,7 +176,7 @@ MakeObjIndex( * position. */ const TkTextIndex *origPtr) /* Pointer to index. */ { - TkTextIndex *indexPtr = ckalloc(sizeof(TkTextIndex)); + TkTextIndex *indexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex)); indexPtr->tree = origPtr->tree; indexPtr->linePtr = origPtr->linePtr; @@ -477,7 +477,7 @@ TkTextMakeCharIndex( int charIndex, /* Index of desired character. */ TkTextIndex *indexPtr) /* Structure to fill in. */ { - register TkTextSegment *segPtr; + TkTextSegment *segPtr; char *p, *start, *end; int index, offset; int ch; @@ -816,7 +816,7 @@ GetIndex( hPtr = Tcl_FindHashEntry(&sharedPtr->tagTable, tagName); *p = '.'; if (hPtr != NULL) { - tagPtr = Tcl_GetHashValue(hPtr); + tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr); } } @@ -832,7 +832,7 @@ GetIndex( if (tagPtr == textPtr->selTagPtr) { tagName = "sel"; } else if (hPtr != NULL) { - tagName = Tcl_GetHashKey(&sharedPtr->tagTable, hPtr); + tagName = (const char *)Tcl_GetHashKey(&sharedPtr->tagTable, hPtr); } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "text doesn't contain any characters tagged with \"%s\"", @@ -1151,7 +1151,7 @@ ForwBack( * or "-" that starts modifier. */ TkTextIndex *indexPtr) /* Index to update as specified in string. */ { - register const char *p, *units; + const char *p, *units; char *end; int count, lineIndex, modifier; size_t length; @@ -1499,7 +1499,7 @@ TkTextIndexForwChars( return; } if (checkElided) { - infoPtr = ckalloc(sizeof(TkTextElideInfo)); + infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo)); elide = TkTextIsElided(textPtr, srcPtr, infoPtr); } @@ -1767,7 +1767,7 @@ TkTextIndexCount( seg2Ptr = TkTextIndexToSeg(indexPtr2, &maxBytes); if (checkElided) { - infoPtr = ckalloc(sizeof(TkTextElideInfo)); + infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo)); elide = TkTextIsElided(textPtr, indexPtr1, infoPtr); } @@ -1844,9 +1844,9 @@ TkTextIndexCount( if (segPtr->typePtr == &tkTextCharType) { int byteLen = segPtr->size - byteOffset; - register unsigned char *str = (unsigned char *) + unsigned char *str = (unsigned char *) segPtr->body.chars + byteOffset; - register int i; + int i; if (segPtr == seg2Ptr) { if (byteLen > (maxBytes - byteOffset)) { @@ -2025,7 +2025,7 @@ TkTextIndexBackChars( return; } if (checkElided) { - infoPtr = ckalloc(sizeof(TkTextElideInfo)); + infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo)); elide = TkTextIsElided(textPtr, srcPtr, infoPtr); } @@ -2225,7 +2225,7 @@ StartEnd( { const char *p; size_t length; - register TkTextSegment *segPtr; + TkTextSegment *segPtr; int modifier; /* diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index c516697..90af324 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -93,7 +93,7 @@ const Tk_SegType tkTextLeftMarkType = { int TkTextMarkCmd( - 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 @@ -147,7 +147,7 @@ TkTextMarkCmd( NULL); return TCL_ERROR; } - markPtr = Tcl_GetHashValue(hPtr); + markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); } if (objc == 4) { const char *typeStr; @@ -194,7 +194,7 @@ TkTextMarkCmd( for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->markTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), + (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); @@ -229,7 +229,7 @@ TkTextMarkCmd( hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, Tcl_GetString(objv[i])); if (hPtr != NULL) { - markPtr = Tcl_GetHashValue(hPtr); + markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); /* * Special case not needed with peer widgets. @@ -290,7 +290,7 @@ TkTextSetMark( widgetSpecific = 0; hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->markTable, name, &isNew); - markPtr = Tcl_GetHashValue(hPtr); + markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); } if (!isNew) { /* @@ -330,7 +330,7 @@ TkTextSetMark( } TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr); } else { - markPtr = ckalloc(MSEG_SIZE); + markPtr = (TkTextSegment *)ckalloc(MSEG_SIZE); markPtr->typePtr = &tkTextRightMarkType; markPtr->size = 0; markPtr->body.mark.textPtr = textPtr; @@ -452,7 +452,7 @@ TkTextMarkNameToIndex( if (hPtr == NULL) { return TCL_ERROR; } - segPtr = Tcl_GetHashValue(hPtr); + segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); } TkTextMarkSegToIndex(textPtr, segPtr, indexPtr); @@ -508,6 +508,10 @@ MarkDeleteProc( * deleted, so everything must get cleaned * up. */ { + (void)segPtr; + (void)linePtr; + (void)treeGone; + return 1; } @@ -570,11 +574,18 @@ MarkLayoutProc( int noCharsYet, /* Non-zero means no characters have been * assigned to this line yet. */ TkWrapMode wrapMode, /* Not used. */ - register TkTextDispChunk *chunkPtr) + TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been * set by the caller. */ { + (void)indexPtr; + (void)offset; + (void)maxX; + (void)maxChars; + (void)noCharsYet; + (void)wrapMode; + if (segPtr != textPtr->insertMarkPtr) { return -1; } @@ -641,6 +652,9 @@ TkTextInsertDisplayProc( int halfWidth = textPtr->insertWidth/2; int rightSideWidth; int ix = 0, iy = 0, iw = 0, ih = 0, charWidth = 0; + (void)chunkPtr; + (void)baseline; + (void)display; if (textPtr->insertCursorType) { TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index); @@ -727,6 +741,9 @@ InsertUndisplayProc( TkText *textPtr, /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { + (void)textPtr; + (void)chunkPtr; + return; } @@ -809,7 +826,7 @@ MarkFindNext( { TkTextIndex index; Tcl_HashEntry *hPtr; - register TkTextSegment *segPtr; + TkTextSegment *segPtr; int offset; const char *string = Tcl_GetString(obj); @@ -830,7 +847,7 @@ MarkFindNext( * position. */ - segPtr = Tcl_GetHashValue(hPtr); + segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); TkTextMarkSegToIndex(textPtr, segPtr, &index); segPtr = segPtr->nextPtr; } else { @@ -900,7 +917,7 @@ MarkFindPrev( { TkTextIndex index; Tcl_HashEntry *hPtr; - register TkTextSegment *segPtr, *seg2Ptr, *prevPtr; + TkTextSegment *segPtr, *seg2Ptr, *prevPtr; int offset; const char *string = Tcl_GetString(obj); @@ -919,7 +936,7 @@ MarkFindPrev( * position. */ - segPtr = Tcl_GetHashValue(hPtr); + segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); TkTextMarkSegToIndex(textPtr, segPtr, &index); } else { /* @@ -1012,7 +1029,7 @@ GetMarkName( return NULL; } else { - markName = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, + markName = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, segPtr->body.mark.hPtr); } return Tcl_NewStringObj(markName, -1); diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 7b89fd9..5d2acb0 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -137,7 +137,7 @@ static void TagBindEvent(TkText *textPtr, XEvent *eventPtr, int TkTextTagCmd( - 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 @@ -154,7 +154,7 @@ TkTextTagCmd( TAG_REMOVE }; int optionIndex, i; - register TkTextTag *tagPtr; + TkTextTag *tagPtr; TkTextIndex index1, index2; if (objc < 3) { @@ -584,7 +584,7 @@ TkTextTagCmd( continue; } - tagPtr = Tcl_GetHashValue(hPtr); + tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr); if (tagPtr == textPtr->selTagPtr) { continue; } @@ -645,12 +645,12 @@ TkTextTagCmd( Tcl_HashSearch search; Tcl_HashEntry *hPtr; - arrayPtr = ckalloc(textPtr->sharedTextPtr->numTags + arrayPtr = (TkTextTag **)ckalloc(textPtr->sharedTextPtr->numTags * sizeof(TkTextTag *)); for (i=0, hPtr = Tcl_FirstHashEntry( &textPtr->sharedTextPtr->tagTable, &search); hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) { - arrayPtr[i] = Tcl_GetHashValue(hPtr); + arrayPtr[i] = (TkTextTag *)Tcl_GetHashValue(hPtr); } /* @@ -986,7 +986,7 @@ TkTextCreateTag( int *newTag) /* If non-NULL, then return 1 if new, or 0 if * already exists. */ { - register TkTextTag *tagPtr; + TkTextTag *tagPtr; Tcl_HashEntry *hPtr = NULL; int isNew; const char *name; @@ -1009,9 +1009,9 @@ TkTextCreateTag( *newTag = isNew; } if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (TkTextTag *)Tcl_GetHashValue(hPtr); } - name = Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr); + name = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr); } /* @@ -1019,7 +1019,7 @@ TkTextCreateTag( * to it to the hash table entry. */ - tagPtr = ckalloc(sizeof(TkTextTag)); + tagPtr = (TkTextTag *)ckalloc(sizeof(TkTextTag)); tagPtr->name = name; tagPtr->textPtr = NULL; tagPtr->toggleCount = 0; @@ -1118,7 +1118,7 @@ FindTag( hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable, Tcl_GetString(tagName)); if (hPtr != NULL) { - return Tcl_GetHashValue(hPtr); + return (TkTextTag *)Tcl_GetHashValue(hPtr); } if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -1158,7 +1158,7 @@ FindTag( void TkTextDeleteTag( TkText *textPtr, /* Info about overall widget. */ - register TkTextTag *tagPtr) /* Tag being deleted. */ + TkTextTag *tagPtr) /* Tag being deleted. */ { TkTextIndex first, last; @@ -1216,7 +1216,7 @@ TkTextDeleteTag( void TkTextFreeTag( TkText *textPtr, /* Info about overall widget. */ - register TkTextTag *tagPtr) /* Tag being deleted. */ + TkTextTag *tagPtr) /* Tag being deleted. */ { int i; @@ -1295,7 +1295,7 @@ SortTags( TkTextTag **tagArrayPtr) /* Pointer to array of pointers. */ { int i, j, prio; - register TkTextTag **tagPtrPtr; + TkTextTag **tagPtrPtr; TkTextTag **maxPtrPtr, *tmp; if (numTags < 2) { @@ -1379,7 +1379,7 @@ ChangeTagPriority( int prio) /* New priority for tag. */ { int low, high, delta; - register TkTextTag *tagPtr2; + TkTextTag *tagPtr2; Tcl_HashEntry *hPtr; Tcl_HashSearch search; @@ -1412,7 +1412,7 @@ ChangeTagPriority( } for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->tagTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - tagPtr2 = Tcl_GetHashValue(hPtr); + tagPtr2 = (TkTextTag *)Tcl_GetHashValue(hPtr); if ((tagPtr2->priority >= low) && (tagPtr2->priority <= high)) { tagPtr2->priority += delta; } @@ -1443,7 +1443,7 @@ TkTextBindProc( ClientData clientData, /* Pointer to canvas structure. */ XEvent *eventPtr) /* Pointer to X event that just happened. */ { - TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; int repick = 0; textPtr->refCount++; @@ -1529,7 +1529,7 @@ TkTextBindProc( void TkTextPickCurrent( - register TkText *textPtr, /* Text widget in which to select current + TkText *textPtr, /* Text widget in which to select current * character. */ XEvent *eventPtr) /* Event describing location of mouse cursor. * Must be EnterWindow, LeaveWindow, @@ -1633,7 +1633,7 @@ TkTextPickCurrent( SortTags(textPtr->numCurTags, textPtr->curTagArrayPtr); if (numNewTags > 0) { size = numNewTags * sizeof(TkTextTag *); - copyArrayPtr = ckalloc(size); + copyArrayPtr = (TkTextTag **)ckalloc(size); memcpy(copyArrayPtr, newArrayPtr, size); for (i = 0; i < textPtr->numCurTags; i++) { for (j = 0; j < numNewTags; j++) { @@ -1737,7 +1737,7 @@ TagBindEvent( */ if (numTags > NUM_BIND_TAGS) { - nameArrPtr = ckalloc(numTags * sizeof(const char *)); + nameArrPtr = (const char **)ckalloc(numTags * sizeof(const char *)); } else { nameArrPtr = nameArray; } diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index 191c86c..2df4342 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -133,7 +133,7 @@ static const Tk_OptionSpec optionSpecs[] = { int TkTextWindowCmd( - 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 @@ -147,7 +147,7 @@ TkTextWindowCmd( enum windOptions { WIND_CGET, WIND_CONFIGURE, WIND_CREATE, WIND_NAMES }; - register TkTextSegment *ewPtr; + TkTextSegment *ewPtr; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?"); @@ -290,7 +290,7 @@ TkTextWindowCmd( * Create the new window segment and initialize it. */ - ewPtr = ckalloc(EW_SEG_SIZE); + ewPtr = (TkTextSegment *)ckalloc(EW_SEG_SIZE); ewPtr->typePtr = &tkTextEmbWindowType; ewPtr->size = 1; ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr; @@ -302,7 +302,7 @@ TkTextWindowCmd( ewPtr->body.ew.stretch = 0; ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs); - client = ckalloc(sizeof(TkTextEmbWindowClient)); + client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient)); client->next = NULL; client->textPtr = textPtr; client->tkwin = NULL; @@ -345,7 +345,7 @@ TkTextWindowCmd( for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->windowTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), + (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); @@ -467,7 +467,7 @@ EmbWinConfigure( * Have to make the new client. */ - client = ckalloc(sizeof(TkTextEmbWindowClient)); + client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient)); client->next = ewPtr->body.ew.clients; client->textPtr = textPtr; client->tkwin = NULL; @@ -526,7 +526,7 @@ EmbWinStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; Tcl_HashEntry *hPtr; @@ -579,9 +579,10 @@ EmbWinRequestProc( ClientData clientData, /* Pointer to record for window item. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; + (void)tkwin; index.tree = ewPtr->body.ew.sharedTextPtr->tree; index.linePtr = ewPtr->body.ew.linePtr; @@ -616,7 +617,7 @@ EmbWinLostSlaveProc( Tk_Window tkwin) /* Window that was claimed away by another * geometry manager. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; Tcl_HashEntry *hPtr; @@ -747,6 +748,8 @@ EmbWinDeleteProc( { TkTextEmbWindowClient *client; client = ewPtr->body.ew.clients; + (void)linePtr; + (void)treeGone; while (client != NULL) { TkTextEmbWindowClient *next = client->next; @@ -833,13 +836,16 @@ EmbWinLayoutProc( TkWrapMode wrapMode, /* Wrap mode to use for line: * 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. */ { int width, height; TkTextEmbWindowClient *client; + (void)indexPtr; + (void)maxChars; + (void)wrapMode; if (offset != 0) { Tcl_Panic("Non-zero offset in EmbWinLayoutProc"); @@ -959,7 +965,7 @@ EmbWinLayoutProc( * now need to add to our client list. */ - client = ckalloc(sizeof(TkTextEmbWindowClient)); + client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient)); client->next = ewPtr->body.ew.clients; client->textPtr = textPtr; client->tkwin = NULL; @@ -1054,6 +1060,8 @@ EmbWinCheckProc( TkTextSegment *ewPtr, /* Segment to check. */ TkTextLine *linePtr) /* Line containing segment. */ { + (void)linePtr; + if (ewPtr->nextPtr == NULL) { Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line"); } @@ -1100,8 +1108,11 @@ TkTextEmbWinDisplayProc( { int lineX, windowX, windowY, width, height; Tk_Window tkwin; - TkTextSegment *ewPtr = chunkPtr->clientData; + TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); + (void)y; + (void)display; + (void)dst; if (client == NULL) { return; @@ -1180,7 +1191,7 @@ EmbWinUndisplayProc( TkText *textPtr, /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { - TkTextSegment *ewPtr = chunkPtr->clientData; + TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); if (client == NULL) { @@ -1243,8 +1254,9 @@ EmbWinBboxProc( * pixels. */ { Tk_Window tkwin; - TkTextSegment *ewPtr = chunkPtr->clientData; + TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); + (void)index; if (client == NULL) { tkwin = NULL; @@ -1305,7 +1317,7 @@ static void EmbWinDelayedUnmap( ClientData clientData) /* Token for the window to be unmapped. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; if (!client->displayed && (client->tkwin != NULL)) { if (client->textPtr->tkwin != Tk_Parent(client->tkwin)) { @@ -1353,7 +1365,7 @@ TkTextWindowIndex( return 0; } - ewPtr = Tcl_GetHashValue(hPtr); + ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = ewPtr->body.ew.linePtr; indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr); diff --git a/generic/tkTrig.c b/generic/tkTrig.c index a2bf456..101f09b 100644 --- a/generic/tkTrig.c +++ b/generic/tkTrig.c @@ -440,7 +440,7 @@ TkPolygonToPoint( * intersect a ray extending vertically * upwards from the point to infinity. */ int count; - register double *pPtr; + double *pPtr; /* * Iterate through all of the edges in the polygon, updating bestDist and @@ -588,7 +588,7 @@ TkPolygonToArea( * polygon: x0, y0, x1, y1, ... The polygon * may be self-intersecting. */ int numPoints, /* Total number of points at *polyPtr. */ - register double *rectPtr) /* Points to coords for rectangle, in the + double *rectPtr) /* Points to coords for rectangle, in the * order x1, y1, x2, y2. X1 and y1 must be * lower-left corner. */ { @@ -596,7 +596,7 @@ TkPolygonToArea( * outside, 1 means inside, won't ever be * 0). */ int count; - register double *pPtr; + double *pPtr; /* * Iterate over all of the edges of the polygon and test them against the @@ -751,11 +751,11 @@ TkOvalToPoint( int TkOvalToArea( - register double *ovalPtr, /* Points to coordinates defining the + double *ovalPtr, /* Points to coordinates defining the * bounding rectangle for the oval: x1, y1, * x2, y2. X1 must be less than x2 and y1 less * than y2. */ - register double *rectPtr) /* Points to coords for rectangle, in the + double *rectPtr) /* Points to coords for rectangle, in the * order x1, y1, x2, y2. X1 and y1 must be * lower-left corner. */ { @@ -870,7 +870,7 @@ TkOvalToArea( /* ARGSUSED */ void TkIncludePoint( - register Tk_Item *itemPtr, /* Item whose bounding box is being + Tk_Item *itemPtr, /* Item whose bounding box is being * calculated. */ double *pointPtr) /* Address of two doubles giving x and y * coordinates of point. */ @@ -919,7 +919,7 @@ TkBezierScreenPoints( double control[], /* Array of coordinates for four control * points: x0, y0, x1, y1, ... x3 y3. */ int numSteps, /* Number of curve points to generate. */ - register XPoint *xPointPtr) /* Where to put new points. */ + XPoint *xPointPtr) /* Where to put new points. */ { int i; double u, u2, u3, t, t2, t3; @@ -965,7 +965,7 @@ TkBezierPoints( double control[], /* Array of coordinates for four control * points: x0, y0, x1, y1, ... x3 y3. */ int numSteps, /* Number of curve points to generate. */ - register double *coordPtr) /* Where to put new points. */ + double *coordPtr) /* Where to put new points. */ { int i; double u, u2, u3, t, t2, t3; diff --git a/generic/tkUndo.c b/generic/tkUndo.c index c66905d..7494332 100644 --- a/generic/tkUndo.c +++ b/generic/tkUndo.c @@ -94,7 +94,7 @@ TkUndoInsertSeparator( TkUndoAtom *separator; if (*stack!=NULL && (*stack)->type!=TK_UNDO_SEPARATOR) { - separator = ckalloc(sizeof(TkUndoAtom)); + separator = (TkUndoAtom *)ckalloc(sizeof(TkUndoAtom)); separator->type = TK_UNDO_SEPARATOR; TkUndoPushStack(stack,separator); return 1; @@ -181,7 +181,7 @@ TkUndoPushAction( { TkUndoAtom *atom; - atom = ckalloc(sizeof(TkUndoAtom)); + atom = (TkUndoAtom *)ckalloc(sizeof(TkUndoAtom)); atom->type = TK_UNDO_ACTION; atom->apply = apply; atom->revert = revert; @@ -237,7 +237,7 @@ TkUndoMakeCmdSubAtom( Tcl_Panic("NULL command and actionScript in TkUndoMakeCmdSubAtom"); } - atom = ckalloc(sizeof(TkUndoSubAtom)); + atom = (TkUndoSubAtom *)ckalloc(sizeof(TkUndoSubAtom)); atom->command = command; atom->funcPtr = NULL; atom->clientData = NULL; @@ -299,7 +299,7 @@ TkUndoMakeSubAtom( Tcl_Panic("NULL funcPtr in TkUndoMakeSubAtom"); } - atom = ckalloc(sizeof(TkUndoSubAtom)); + atom = (TkUndoSubAtom *)ckalloc(sizeof(TkUndoSubAtom)); atom->command = NULL; atom->funcPtr = funcPtr; atom->clientData = clientData; @@ -341,7 +341,7 @@ TkUndoInitStack( { TkUndoRedoStack *stack; /* An Undo/Redo stack */ - stack = ckalloc(sizeof(TkUndoRedoStack)); + stack = (TkUndoRedoStack *)ckalloc(sizeof(TkUndoRedoStack)); stack->undoStack = NULL; stack->redoStack = NULL; stack->interp = interp; diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 89f68be..ed0480b 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -57,8 +57,8 @@ TkStateParseProc( int flags = PTR2INT(clientData); size_t length; Tcl_Obj *msgObj; - - register Tk_State *statePtr = (Tk_State *) (widgRec + offset); + Tk_State *statePtr = (Tk_State *) (widgRec + offset); + (void)tkwin; if (value == NULL || *value == 0) { *statePtr = TK_STATE_NULL; @@ -126,7 +126,7 @@ TkStateParseProc( const char * TkStatePrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ @@ -134,7 +134,10 @@ TkStatePrintProc( * information about how to reclaim storage * for return string. */ { - register Tk_State *statePtr = (Tk_State *) (widgRec + offset); + Tk_State *statePtr = (Tk_State *) (widgRec + offset); + (void)dummy; + (void)tkwin; + (void)freeProcPtr; switch (*statePtr) { case TK_STATE_NORMAL: @@ -170,7 +173,7 @@ TkStatePrintProc( int TkOrientParseProc( - ClientData clientData, /* some flags.*/ + ClientData dummy, /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option. */ @@ -179,8 +182,9 @@ TkOrientParseProc( { int c; size_t length; - - register int *orientPtr = (int *) (widgRec + offset); + int *orientPtr = (int *) (widgRec + offset); + (void)dummy; + (void)tkwin; if (value == NULL || *value == 0) { *orientPtr = 0; @@ -229,7 +233,7 @@ TkOrientParseProc( const char * TkOrientPrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ @@ -237,7 +241,10 @@ TkOrientPrintProc( * information about how to reclaim storage * for return string. */ { - register int *statePtr = (int *) (widgRec + offset); + int *statePtr = (int *) (widgRec + offset); + (void)dummy; + (void)tkwin; + (void)freeProcPtr; if (*statePtr) { return "vertical"; @@ -410,7 +417,7 @@ TkOffsetParseProc( const char * TkOffsetPrintProc( - ClientData clientData, /* not used */ + ClientData dummy, /* not used */ Tk_Window tkwin, /* not used */ char *widgRec, /* Widget structure record */ int offset, /* Offset of tile in record */ @@ -418,12 +425,14 @@ TkOffsetPrintProc( { Tk_TSOffset *offsetPtr = (Tk_TSOffset *) (widgRec + offset); char *p, *q; + (void)dummy; + (void)tkwin; if (offsetPtr->flags & TK_OFFSET_INDEX) { if (offsetPtr->flags >= INT_MAX) { return "end"; } - p = ckalloc(32); + p = (char *)ckalloc(32); sprintf(p, "%d", offsetPtr->flags & ~TK_OFFSET_INDEX); *freeProcPtr = TCL_DYNAMIC; return p; @@ -453,7 +462,7 @@ TkOffsetPrintProc( return "se"; } } - q = p = ckalloc(32); + q = p = (char *)ckalloc(32); if (offsetPtr->flags & TK_OFFSET_RELATIVE) { *q++ = '#'; } @@ -511,14 +520,16 @@ TkPixelParseProc( const char * TkPixelPrintProc( - ClientData clientData, /* not used */ + ClientData dummy, /* not used */ Tk_Window tkwin, /* not used */ char *widgRec, /* Widget structure record */ int offset, /* Offset of tile in record */ Tcl_FreeProc **freeProcPtr) /* not used */ { double *doublePtr = (double *) (widgRec + offset); - char *p = ckalloc(24); + char *p = (char *)ckalloc(24); + (void)dummy; + (void)tkwin; Tcl_PrintDouble(NULL, *doublePtr, p); *freeProcPtr = TCL_DYNAMIC; @@ -1086,7 +1097,7 @@ TkBackgroundEvalObjv( Tcl_Command TkMakeEnsemble( Tcl_Interp *interp, - const char *namespace, + const char *namesp, const char *name, ClientData clientData, const TkEnsemble map[]) @@ -1103,11 +1114,11 @@ TkMakeEnsemble( Tcl_DStringInit(&ds); - namespacePtr = Tcl_FindNamespace(interp, namespace, NULL, 0); + namespacePtr = Tcl_FindNamespace(interp, namesp, NULL, 0); if (namespacePtr == NULL) { - namespacePtr = Tcl_CreateNamespace(interp, namespace, NULL, NULL); + namespacePtr = Tcl_CreateNamespace(interp, namesp, NULL, NULL); if (namespacePtr == NULL) { - Tcl_Panic("failed to create namespace \"%s\"", namespace); + Tcl_Panic("failed to create namespace \"%s\"", namesp); } } @@ -1123,8 +1134,8 @@ TkMakeEnsemble( } Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, namespace, -1); - if (!(strlen(namespace) == 2 && namespace[1] == ':')) { + Tcl_DStringAppend(&ds, namesp, -1); + if (!(strlen(namesp) == 2 && namesp[1] == ':')) { Tcl_DStringAppend(&ds, "::", -1); } Tcl_DStringAppend(&ds, name, -1); @@ -1176,7 +1187,7 @@ TkSendVirtualEvent( const char *eventName, Tcl_Obj *detail) { - union {XEvent general; XVirtualEvent virtual;} event; + union {XEvent general; XVirtualEvent virt;} event; memset(&event, 0, sizeof(event)); event.general.xany.type = VirtualEvent; @@ -1184,9 +1195,9 @@ TkSendVirtualEvent( event.general.xany.send_event = False; event.general.xany.window = Tk_WindowId(target); event.general.xany.display = Tk_Display(target); - event.virtual.name = Tk_GetUid(eventName); + event.virt.name = Tk_GetUid(eventName); if (detail != NULL) { - event.virtual.user_data = detail; + event.virt.user_data = detail; } Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 51ae3be..04afcbc 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -96,7 +96,7 @@ Tk_GetVisual( * Tk_FreeColormap. */ { Tk_Window tkwin2; - XVisualInfo template, *visInfoList, *bestPtr; + XVisualInfo templ, *visInfoList, *bestPtr; long mask; Visual *visual; size_t length; @@ -144,13 +144,13 @@ Tk_GetVisual( } return visual; } - template.depth = Tk_Depth(tkwin2); - template.c_class = visual->c_class; - template.red_mask = visual->red_mask; - template.green_mask = visual->green_mask; - template.blue_mask = visual->blue_mask; - template.colormap_size = visual->map_entries; - template.bits_per_rgb = visual->bits_per_rgb; + templ.depth = Tk_Depth(tkwin2); + templ.c_class = visual->c_class; + templ.red_mask = visual->red_mask; + templ.green_mask = visual->green_mask; + templ.blue_mask = visual->blue_mask; + templ.colormap_size = visual->map_entries; + templ.bits_per_rgb = visual->bits_per_rgb; mask = VisualDepthMask|VisualClassMask|VisualRedMaskMask |VisualGreenMaskMask|VisualBlueMaskMask|VisualColormapSizeMask |VisualBitsPerRGBMask; @@ -178,7 +178,7 @@ Tk_GetVisual( Tcl_SetErrorCode(interp, "TK", "VALUE", "VISUALID", NULL); return NULL; } - template.visualid = visualId; + templ.visualid = visualId; mask = VisualIDMask; } else { /* @@ -192,15 +192,15 @@ Tk_GetVisual( } } length = p - string; - template.c_class = -1; + templ.c_class = -1; for (dictPtr = visualNames; dictPtr->minLength; dictPtr++) { if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength) && (strncmp(string, dictPtr->name, length) == 0)) { - template.c_class = dictPtr->c_class; + templ.c_class = dictPtr->c_class; break; } } - if (template.c_class == -1) { + if (templ.c_class == -1) { Tcl_Obj *msgObj = Tcl_ObjPrintf( "unknown or ambiguous visual name \"%s\": class must be ", string); @@ -217,8 +217,8 @@ Tk_GetVisual( p++; } if (*p == 0) { - template.depth = 10000; - } else if (Tcl_GetInt(interp, p, &template.depth) != TCL_OK) { + templ.depth = 10000; + } else if (Tcl_GetInt(interp, p, &templ.depth) != TCL_OK) { return NULL; } if (c == 'b') { @@ -233,9 +233,9 @@ Tk_GetVisual( * an error if there are none that match. */ - template.screen = Tk_ScreenNumber(tkwin); + templ.screen = Tk_ScreenNumber(tkwin); mask |= VisualScreenMask; - visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &template, + visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &templ, &numVisuals); if (visInfoList == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -285,11 +285,11 @@ Tk_GetVisual( goto newBest; } if (visInfoList[i].depth < bestPtr->depth) { - if (visInfoList[i].depth >= template.depth) { + if (visInfoList[i].depth >= templ.depth) { goto newBest; } } else if (visInfoList[i].depth > bestPtr->depth) { - if (bestPtr->depth < template.depth) { + if (bestPtr->depth < templ.depth) { goto newBest; } } else { @@ -327,7 +327,7 @@ Tk_GetVisual( goto done; } } - cmapPtr = ckalloc(sizeof(TkColormap)); + cmapPtr = (TkColormap *)ckalloc(sizeof(TkColormap)); cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), visual, AllocNone); @@ -382,7 +382,7 @@ Tk_GetColormap( */ if (strcmp(string, "new") == 0) { - cmapPtr = ckalloc(sizeof(TkColormap)); + cmapPtr = (TkColormap *)ckalloc(sizeof(TkColormap)); cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), Tk_Visual(tkwin), AllocNone); diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 1b24477..2990791 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -316,10 +316,10 @@ CreateTopLevelWindow( * parent. */ unsigned int flags) /* Additional flags to set on the window. */ { - register TkWindow *winPtr; - register TkDisplay *dispPtr; + TkWindow *winPtr; + TkDisplay *dispPtr; int screenId; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { @@ -419,11 +419,11 @@ GetScreen( * DISPLAY envariable. */ int *screenPtr) /* Where to store screen number. */ { - register TkDisplay *dispPtr; + TkDisplay *dispPtr; const char *p; int screenId; size_t length; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -487,7 +487,7 @@ GetScreen( Tcl_InitHashTable(&dispPtr->winTable, TCL_ONE_WORD_KEYS); - dispPtr->name = ckalloc(length + 1); + dispPtr->name = (char *)ckalloc(length + 1); strncpy(dispPtr->name, screenName, length); dispPtr->name[length] = '\0'; break; @@ -530,7 +530,7 @@ TkGetDisplay( Display *display) /* X's display pointer */ { TkDisplay *dispPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (dispPtr = tsdPtr->displayList; dispPtr != NULL; @@ -563,7 +563,7 @@ TkGetDisplay( TkDisplay * TkGetDisplayList(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->displayList; @@ -590,7 +590,7 @@ TkGetDisplayList(void) TkMainInfo * TkGetMainInfoList(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->mainWindowList; @@ -620,7 +620,7 @@ TkAllocWindow( * inherit visual information. NULL means use * screen defaults instead of inheriting. */ { - register TkWindow *winPtr = ckalloc(sizeof(TkWindow)); + TkWindow *winPtr = (TkWindow *)ckalloc(sizeof(TkWindow)); winPtr->display = dispPtr->display; winPtr->dispPtr = dispPtr; @@ -699,7 +699,7 @@ TkAllocWindow( static int NameWindow( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - register TkWindow *winPtr, /* Window that is to be named and inserted. */ + TkWindow *winPtr, /* Window that is to be named and inserted. */ TkWindow *parentPtr, /* Pointer to logical parent for winPtr (used * for naming, options, etc.). */ const char *name) /* Name for winPtr; must be unique among @@ -769,7 +769,7 @@ NameWindow( if ((length1 + length2 + 2) <= FIXED_SIZE) { pathName = staticSpace; } else { - pathName = ckalloc(length1 + length2 + 2); + pathName = (char *)ckalloc(length1 + length2 + 2); } if (length1 == 1) { pathName[0] = '.'; @@ -791,7 +791,7 @@ NameWindow( return TCL_ERROR; } Tcl_SetHashValue(hPtr, winPtr); - winPtr->pathName = Tcl_GetHashKey(&parentPtr->mainPtr->nameTable, hPtr); + winPtr->pathName = (char *)Tcl_GetHashKey(&parentPtr->mainPtr->nameTable, hPtr); return TCL_OK; } @@ -830,11 +830,11 @@ TkCreateMainWindow( Tk_Window tkwin; int dummy, isSafe; Tcl_HashEntry *hPtr; - register TkMainInfo *mainPtr; - register TkWindow *winPtr; - register const TkCmd *cmdPtr; + TkMainInfo *mainPtr; + TkWindow *winPtr; + const TkCmd *cmdPtr; ClientData clientData; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -862,7 +862,7 @@ TkCreateMainWindow( */ winPtr = (TkWindow *) tkwin; - mainPtr = ckalloc(sizeof(TkMainInfo)); + mainPtr = (TkMainInfo *)ckalloc(sizeof(TkMainInfo)); mainPtr->winPtr = winPtr; mainPtr->refCount = 1; mainPtr->interp = interp; @@ -895,7 +895,7 @@ TkCreateMainWindow( winPtr->mainPtr = mainPtr; hPtr = Tcl_CreateHashEntry(&mainPtr->nameTable, ".", &dummy); Tcl_SetHashValue(hPtr, winPtr); - winPtr->pathName = Tcl_GetHashKey(&mainPtr->nameTable, hPtr); + winPtr->pathName = (char *)Tcl_GetHashKey(&mainPtr->nameTable, hPtr); Tcl_InitHashTable(&mainPtr->busyTable, TCL_ONE_WORD_KEYS); /* @@ -1153,7 +1153,7 @@ Tk_CreateWindowFromPath( } numChars = p-pathName; if (numChars > FIXED_SPACE) { - p = ckalloc(numChars + 1); + p = (char *)ckalloc(numChars + 1); } else { p = fixedSpace; } @@ -1238,7 +1238,7 @@ Tk_DestroyWindow( TkDisplay *dispPtr = winPtr->dispPtr; XEvent event; TkHalfdeadWindow *halfdeadPtr, *prev_halfdeadPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->flags & TK_ALREADY_DEAD) { @@ -1261,7 +1261,7 @@ Tk_DestroyWindow( (tsdPtr->halfdeadWindowList->winPtr == winPtr)) { halfdeadPtr = tsdPtr->halfdeadWindowList; } else { - halfdeadPtr = ckalloc(sizeof(TkHalfdeadWindow)); + halfdeadPtr = (TkHalfdeadWindow *)ckalloc(sizeof(TkHalfdeadWindow)); halfdeadPtr->flags = 0; halfdeadPtr->winPtr = winPtr; halfdeadPtr->nextPtr = tsdPtr->halfdeadWindowList; @@ -1484,7 +1484,7 @@ Tk_DestroyWindow( winPtr->mainPtr->deletionEpoch++; } if (winPtr->mainPtr->refCount-- <= 1) { - register const TkCmd *cmdPtr; + const TkCmd *cmdPtr; /* * We just deleted the last window in the application. Delete the @@ -1671,7 +1671,7 @@ void Tk_MakeWindowExist( Tk_Window tkwin) /* Token for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkWindow *winPtr2; Window parent; Tcl_HashEntry *hPtr; @@ -1780,7 +1780,7 @@ void Tk_UnmapWindow( Tk_Window tkwin) /* Token for window to unmap. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (!(winPtr->flags & TK_MAPPED) || (winPtr->flags & TK_ALREADY_DEAD)) { return; @@ -1817,7 +1817,7 @@ Tk_ConfigureWindow( * are to be used. */ XWindowChanges *valuePtr) /* New values. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (valueMask & CWX) { winPtr->changes.x = valuePtr->x; @@ -1853,7 +1853,7 @@ Tk_MoveWindow( Tk_Window tkwin, /* Window to move. */ int x, int y) /* New location for window (within parent). */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.x = x; winPtr->changes.y = y; @@ -1871,7 +1871,7 @@ Tk_ResizeWindow( Tk_Window tkwin, /* Window to resize. */ int width, int height) /* New dimensions for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.width = (unsigned) width; winPtr->changes.height = (unsigned) height; @@ -1891,7 +1891,7 @@ Tk_MoveResizeWindow( int x, int y, /* New location for window (within parent). */ int width, int height) /* New dimensions for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.x = x; winPtr->changes.y = y; @@ -1912,7 +1912,7 @@ Tk_SetWindowBorderWidth( Tk_Window tkwin, /* Window to modify. */ int width) /* New border width for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.border_width = width; if (winPtr->window != None) { @@ -1930,10 +1930,10 @@ Tk_ChangeWindowAttributes( Tk_Window tkwin, /* Window to manipulate. */ unsigned long valueMask, /* OR'ed combination of bits, indicating which * fields of *attsPtr are to be used. */ - register XSetWindowAttributes *attsPtr) + XSetWindowAttributes *attsPtr) /* New values for some attributes. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (valueMask & CWBackPixmap) { winPtr->atts.background_pixmap = attsPtr->background_pixmap; @@ -1996,7 +1996,7 @@ Tk_SetWindowBackground( unsigned long pixel) /* Pixel value to use for window's * background. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.background_pixel = pixel; @@ -2013,7 +2013,7 @@ Tk_SetWindowBackgroundPixmap( Tk_Window tkwin, /* Window to manipulate. */ Pixmap pixmap) /* Pixmap to use for window's background. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.background_pixmap = pixmap; @@ -2031,7 +2031,7 @@ Tk_SetWindowBorder( Tk_Window tkwin, /* Window to manipulate. */ unsigned long pixel) /* Pixel value to use for window's border. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.border_pixel = pixel; @@ -2048,7 +2048,7 @@ Tk_SetWindowBorderPixmap( Tk_Window tkwin, /* Window to manipulate. */ Pixmap pixmap) /* Pixmap to use for window's border. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.border_pixmap = pixmap; @@ -2066,7 +2066,7 @@ Tk_DefineCursor( Tk_Window tkwin, /* Window to manipulate. */ Tk_Cursor cursor) /* Cursor to use for window (may be None). */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.cursor = (Cursor) cursor; @@ -2089,7 +2089,7 @@ Tk_SetWindowColormap( Tk_Window tkwin, /* Window to manipulate. */ Colormap colormap) /* Colormap to use for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.colormap = colormap; @@ -2131,7 +2131,7 @@ Tk_SetWindowVisual( int depth, /* New depth for window. */ Colormap colormap) /* An appropriate colormap for the visual. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->window != None) { /* Too late! */ @@ -2174,7 +2174,7 @@ Tk_SetWindowVisual( void TkDoConfigureNotify( - register TkWindow *winPtr) /* Window whose configuration was just + TkWindow *winPtr) /* Window whose configuration was just * changed. */ { XEvent event; @@ -2220,7 +2220,7 @@ Tk_SetClass( Tk_Window tkwin, /* Token for window to assign class. */ const char *className) /* New class for tkwin. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->classUid = Tk_GetUid(className); if (winPtr->flags & TK_WIN_MANAGED) { @@ -2253,7 +2253,7 @@ Tk_SetClassProcs( const Tk_ClassProcs *procs, /* Class procs structure. */ ClientData instanceData) /* Data to be passed to class functions. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->classProcsPtr = procs; winPtr->instanceData = instanceData; @@ -2312,7 +2312,7 @@ Tk_NameToWindow( } return NULL; } - return Tcl_GetHashValue(hPtr); + return (Tk_Window)Tcl_GetHashValue(hPtr); } /* @@ -2358,7 +2358,7 @@ Tk_IdToWindow( if (hPtr == NULL) { return NULL; } - return Tcl_GetHashValue(hPtr); + return (Tk_Window)Tcl_GetHashValue(hPtr); } /* @@ -2616,7 +2616,7 @@ Tk_MainWindow( return NULL; } #endif - tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (mainPtr = tsdPtr->mainWindowList; mainPtr != NULL; mainPtr = mainPtr->nextPtr) { @@ -2686,7 +2686,7 @@ Tk_GetNumMainWindows(void) } #endif - tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->numMainWindows; } @@ -2744,7 +2744,7 @@ DeleteWindowsExitProc( { TkDisplay *dispPtr, *nextPtr; Tcl_Interp *interp; - ThreadSpecificData *tsdPtr = clientData; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *)clientData; if (tsdPtr == NULL) { return; @@ -3007,6 +3007,8 @@ CopyValue( Tcl_Obj *objPtr, void *dstPtr) { + (void)dummy; + *(Tcl_Obj **)dstPtr = objPtr; return 1; } @@ -3033,17 +3035,17 @@ Initialize( const Tcl_ArgvInfo table[] = { {TCL_ARGV_CONSTANT, "-sync", INT2PTR(1), &sync, "Use synchronous mode for display server", NULL}, - {TCL_ARGV_FUNC, "-colormap", CopyValue, &colorMapObj, + {TCL_ARGV_FUNC, "-colormap", (void *)CopyValue, &colorMapObj, "Colormap for main window", NULL}, - {TCL_ARGV_FUNC, "-display", CopyValue, &displayObj, + {TCL_ARGV_FUNC, "-display", (void *)CopyValue, &displayObj, "Display to use", NULL}, - {TCL_ARGV_FUNC, "-geometry", CopyValue, &geometryObj, + {TCL_ARGV_FUNC, "-geometry", (void *)CopyValue, &geometryObj, "Initial geometry for window", NULL}, - {TCL_ARGV_FUNC, "-name", CopyValue, &nameObj, + {TCL_ARGV_FUNC, "-name", (void *)CopyValue, &nameObj, "Name to use for application", NULL}, - {TCL_ARGV_FUNC, "-visual", CopyValue, &visualObj, + {TCL_ARGV_FUNC, "-visual", (void *)CopyValue, &visualObj, "Visual for main window", NULL}, - {TCL_ARGV_FUNC, "-use", CopyValue, &useObj, + {TCL_ARGV_FUNC, "-use", (void *)CopyValue, &useObj, "Id of window in which to embed application", NULL}, TCL_ARGV_AUTO_REST, TCL_ARGV_AUTO_HELP, TCL_ARGV_TABLE_END }; @@ -3068,7 +3070,7 @@ Initialize( TkRegisterObjTypes(); - tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * We start by resetting the result because it might not be clean. diff --git a/generic/ttk/ttk.decls b/generic/ttk/ttk.decls index e668a2a..ef2a535 100644 --- a/generic/ttk/ttk.decls +++ b/generic/ttk/ttk.decls @@ -144,7 +144,7 @@ declare 35 { # Utilities. # declare 40 { - int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient) + int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *orient) } diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c index 484e66b..dcd342c 100644 --- a/generic/ttk/ttkBlink.c +++ b/generic/ttk/ttkBlink.c @@ -34,9 +34,11 @@ typedef struct /* CursorManagerDeleteProc -- * InterpDeleteProc for cursor manager. */ -static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *interp) +static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *dummy) { CursorManager *cm = (CursorManager*)clientData; + (void)dummy; + if (cm->timer) { Tcl_DeleteTimerHandler(cm->timer); } @@ -49,10 +51,10 @@ static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *interp) static CursorManager *GetCursorManager(Tcl_Interp *interp) { static const char *cm_key = "ttk::CursorManager"; - CursorManager *cm = Tcl_GetAssocData(interp, cm_key,0); + CursorManager *cm = (CursorManager *)Tcl_GetAssocData(interp, cm_key,0); if (!cm) { - cm = ckalloc(sizeof(*cm)); + cm = (CursorManager *)ckalloc(sizeof(*cm)); cm->timer = 0; cm->owner = 0; cm->onTime = DEF_CURSOR_ON_TIME; @@ -68,7 +70,7 @@ static CursorManager *GetCursorManager(Tcl_Interp *interp) static void CursorBlinkProc(ClientData clientData) { - CursorManager *cm = clientData; + CursorManager *cm = (CursorManager *)clientData; int blinkTime; if (cm->owner->flags & CURSOR_ON) { diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index 47e704c..db6e353 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -106,7 +106,7 @@ static Tk_OptionSpec BaseOptionSpecs[] = */ static void TextVariableChanged(void *clientData, const char *value) { - Base *basePtr = clientData; + Base *basePtr = (Base *)clientData; Tcl_Obj *newText; if (WidgetDestroyed(&basePtr->core)) { @@ -123,9 +123,11 @@ static void TextVariableChanged(void *clientData, const char *value) } static void -BaseInitialize(Tcl_Interp *interp, void *recordPtr) +BaseInitialize(Tcl_Interp *dummy, void *recordPtr) { - Base *basePtr = recordPtr; + Base *basePtr = (Base *)recordPtr; + (void)dummy; + basePtr->base.textVariableTrace = 0; basePtr->base.imageSpec = NULL; } @@ -133,7 +135,7 @@ BaseInitialize(Tcl_Interp *interp, void *recordPtr) static void BaseCleanup(void *recordPtr) { - Base *basePtr = recordPtr; + Base *basePtr = (Base *)recordPtr; if (basePtr->base.textVariableTrace) Ttk_UntraceVariable(basePtr->base.textVariableTrace); if (basePtr->base.imageSpec) @@ -146,12 +148,19 @@ BaseImageChanged( int imageWidth, int imageHeight) { Base *basePtr = (Base *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imageWidth; + (void)imageHeight; + TtkResizeWidget(&basePtr->core); } static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Base *basePtr = recordPtr; + Base *basePtr = (Base *)recordPtr; Tcl_Obj *textVarName = basePtr->base.textVariableObj; Ttk_TraceHandle *vt = 0; Ttk_ImageSpec *imageSpec = NULL; @@ -194,10 +203,12 @@ error: } static int -BasePostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) +BasePostConfigure(Tcl_Interp *dummy, void *recordPtr, int mask) { - Base *basePtr = recordPtr; + Base *basePtr = (Base *)recordPtr; int status = TCL_OK; + (void)dummy; + (void)mask; if (basePtr->base.textVariableTrace) { status = Ttk_FireTrace(basePtr->base.textVariableTrace); @@ -327,7 +338,7 @@ static Tk_OptionSpec ButtonOptionSpecs[] = static int ButtonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Button *buttonPtr = recordPtr; + Button *buttonPtr = (Button *)recordPtr; if (BaseConfigure(interp, recordPtr, mask) != TCL_OK) { return TCL_ERROR; @@ -355,7 +366,7 @@ static int ButtonInvokeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Button *buttonPtr = recordPtr; + Button *buttonPtr = (Button *)recordPtr; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "invoke"); return TCL_ERROR; @@ -447,7 +458,7 @@ static Tk_OptionSpec CheckbuttonOptionSpecs[] = */ static void CheckbuttonVariableChanged(void *clientData, const char *value) { - Checkbutton *checkPtr = clientData; + Checkbutton *checkPtr = (Checkbutton *)clientData; if (WidgetDestroyed(&checkPtr->core)) { return; @@ -469,7 +480,7 @@ static void CheckbuttonVariableChanged(void *clientData, const char *value) static void CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr) { - Checkbutton *checkPtr = recordPtr; + Checkbutton *checkPtr = (Checkbutton *)recordPtr; Tcl_Obj *variableObj; /* default -variable is the widget name: @@ -483,7 +494,7 @@ CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr) static void CheckbuttonCleanup(void *recordPtr) { - Checkbutton *checkPtr = recordPtr; + Checkbutton *checkPtr = (Checkbutton *)recordPtr; Ttk_UntraceVariable(checkPtr->checkbutton.variableTrace); checkPtr->checkbutton.variableTrace = 0; BaseCleanup(recordPtr); @@ -492,7 +503,7 @@ CheckbuttonCleanup(void *recordPtr) static int CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Checkbutton *checkPtr = recordPtr; + Checkbutton *checkPtr = (Checkbutton *)recordPtr; Tcl_Obj *varName = checkPtr->checkbutton.variableObj; Ttk_TraceHandle *vt = NULL; @@ -520,7 +531,7 @@ CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) static int CheckbuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Checkbutton *checkPtr = recordPtr; + Checkbutton *checkPtr = (Checkbutton *)recordPtr; int status = TCL_OK; if (checkPtr->checkbutton.variableTrace) @@ -538,7 +549,7 @@ static int CheckbuttonInvokeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Checkbutton *checkPtr = recordPtr; + Checkbutton *checkPtr = (Checkbutton *)recordPtr; WidgetCore *corePtr = &checkPtr->core; Tcl_Obj *newValue; @@ -653,7 +664,7 @@ static Tk_OptionSpec RadiobuttonOptionSpecs[] = static void RadiobuttonVariableChanged(void *clientData, const char *value) { - Radiobutton *radioPtr = clientData; + Radiobutton *radioPtr = (Radiobutton *)clientData; if (WidgetDestroyed(&radioPtr->core)) { return; @@ -675,7 +686,7 @@ RadiobuttonVariableChanged(void *clientData, const char *value) static void RadiobuttonCleanup(void *recordPtr) { - Radiobutton *radioPtr = recordPtr; + Radiobutton *radioPtr = (Radiobutton *)recordPtr; Ttk_UntraceVariable(radioPtr->radiobutton.variableTrace); radioPtr->radiobutton.variableTrace = 0; BaseCleanup(recordPtr); @@ -684,7 +695,7 @@ RadiobuttonCleanup(void *recordPtr) static int RadiobuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Radiobutton *radioPtr = recordPtr; + Radiobutton *radioPtr = (Radiobutton *)recordPtr; Ttk_TraceHandle *vt = Ttk_TraceVariable( interp, radioPtr->radiobutton.variableObj, RadiobuttonVariableChanged, radioPtr); @@ -707,7 +718,7 @@ RadiobuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) static int RadiobuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Radiobutton *radioPtr = recordPtr; + Radiobutton *radioPtr = (Radiobutton *)recordPtr; int status = TCL_OK; if (radioPtr->radiobutton.variableTrace) @@ -725,7 +736,7 @@ static int RadiobuttonInvokeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Radiobutton *radioPtr = recordPtr; + Radiobutton *radioPtr = (Radiobutton *)recordPtr; WidgetCore *corePtr = &radioPtr->core; if (objc > 2) { diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c index c29007c..9059c55 100644 --- a/generic/ttk/ttkCache.c +++ b/generic/ttk/ttkCache.c @@ -48,7 +48,7 @@ struct Ttk_ResourceCache_ { */ Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *interp) { - Ttk_ResourceCache cache = ckalloc(sizeof(*cache)); + Ttk_ResourceCache cache = (Ttk_ResourceCache)ckalloc(sizeof(*cache)); cache->tkwin = NULL; /* initialized later */ cache->interp = interp; @@ -75,7 +75,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache) */ entryPtr = Tcl_FirstHashEntry(&cache->fontTable, &search); while (entryPtr != NULL) { - Tcl_Obj *fontObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *fontObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); if (fontObj) { Tk_FreeFontFromObj(cache->tkwin, fontObj); Tcl_DecrRefCount(fontObj); @@ -90,7 +90,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache) */ entryPtr = Tcl_FirstHashEntry(&cache->colorTable, &search); while (entryPtr != NULL) { - Tcl_Obj *colorObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *colorObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); if (colorObj) { Tk_FreeColorFromObj(cache->tkwin, colorObj); Tcl_DecrRefCount(colorObj); @@ -105,7 +105,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache) */ entryPtr = Tcl_FirstHashEntry(&cache->borderTable, &search); while (entryPtr != NULL) { - Tcl_Obj *borderObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *borderObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); if (borderObj) { Tk_Free3DBorderFromObj(cache->tkwin, borderObj); Tcl_DecrRefCount(borderObj); @@ -120,7 +120,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache) */ entryPtr = Tcl_FirstHashEntry(&cache->imageTable, &search); while (entryPtr != NULL) { - Tk_Image image = Tcl_GetHashValue(entryPtr); + Tk_Image image = (Tk_Image)Tcl_GetHashValue(entryPtr); if (image) { Tk_FreeImage(image); } @@ -153,7 +153,7 @@ void Ttk_FreeResourceCache(Ttk_ResourceCache cache) */ entryPtr = Tcl_FirstHashEntry(&cache->namedColors, &search); while (entryPtr != NULL) { - Tcl_Obj *colorNameObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *colorNameObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(colorNameObj); entryPtr = Tcl_NextHashEntry(&search); } @@ -168,7 +168,7 @@ void Ttk_FreeResourceCache(Ttk_ResourceCache cache) */ static void CacheWinEventHandler(ClientData clientData, XEvent *eventPtr) { - Ttk_ResourceCache cache = clientData; + Ttk_ResourceCache cache = (Ttk_ResourceCache)clientData; if (eventPtr->type != DestroyNotify) { return; @@ -216,7 +216,7 @@ void Ttk_RegisterNamedColor( entryPtr = Tcl_CreateHashEntry(&cache->namedColors, colorName, &newEntry); if (!newEntry) { - Tcl_Obj *oldColor = Tcl_GetHashValue(entryPtr); + Tcl_Obj *oldColor = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(oldColor); } @@ -234,7 +234,7 @@ static Tcl_Obj *CheckNamedColor(Ttk_ResourceCache cache, Tcl_Obj *objPtr) Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&cache->namedColors, Tcl_GetString(objPtr)); if (entryPtr) { /* Use named color instead */ - objPtr = Tcl_GetHashValue(entryPtr); + objPtr = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); } return objPtr; } @@ -257,7 +257,7 @@ static Tcl_Obj *Ttk_Use( Tcl_Obj *cacheObj; if (!newEntry) { - return Tcl_GetHashValue(entryPtr); + return (Tcl_Obj *)Tcl_GetHashValue(entryPtr); } cacheObj = Tcl_DuplicateObj(objPtr); @@ -314,9 +314,17 @@ Tcl_Obj *Ttk_UseBorder( * Tk_ImageChangedProc for Ttk_UseImage */ -static void NullImageChanged(ClientData clientData, +static void NullImageChanged(ClientData dummy, int x, int y, int width, int height, int imageWidth, int imageHeight) -{ /* No-op */ } +{ /* No-op */ + (void)dummy; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imageWidth; + (void)imageHeight; +} /* * Ttk_UseImage -- @@ -333,7 +341,7 @@ Tk_Image Ttk_UseImage(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) InitCacheWindow(cache, tkwin); if (!newEntry) { - return Tcl_GetHashValue(entryPtr); + return (Tk_Image)Tcl_GetHashValue(entryPtr); } image = Tk_GetImage(cache->interp, tkwin, imageName, NullImageChanged,0); diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index 8657fba..1f1b01a 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -117,7 +117,7 @@ static Ttk_ElementOptionSpec BorderElementOptions[] = { offsetof(BorderElement,reliefObj), "flat" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(BorderElement,borderWidthObj), "2" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* @@ -129,24 +129,30 @@ static Ttk_ElementOptionSpec BorderElementOptions[] = { */ static void BorderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { BorderElement *border = (BorderElement*)elementRecord; int borderWidth = 2; + (void)dummy; + (void)widthPtr; + (void)heightPtr; + Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth); if (borderWidth == 1) ++borderWidth; *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void BorderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { - BorderElement *border = elementRecord; + BorderElement *border = (BorderElement *)elementRecord; int relief = TK_RELIEF_FLAT; int borderWidth = 2; Tcl_Obj *outer = 0, *upper = 0, *lower = 0; + (void)dummy; + (void)state; Tk_GetReliefFromObj(NULL, border->reliefObj, &relief); Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth); @@ -205,25 +211,33 @@ static Ttk_ElementOptionSpec FieldElementOptions[] = { offsetof(FieldElement,darkColorObj), DARK_COLOR }, { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,backgroundObj), "white" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + *paddingPtr = Ttk_UniformPadding(2); } static void FieldElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { - FieldElement *field = elementRecord; + FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj); Ttk_Box f = Ttk_PadBox(b, Ttk_UniformPadding(2)); Tcl_Obj *outer = field->borderColorObj, *inner = field->lightColorObj; + (void)dummy; + (void)state; DrawSmoothBorder(tkwin, d, b, outer, inner, inner); Tk_Fill3DRectangle( @@ -246,7 +260,7 @@ static void ComboboxFieldElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { - FieldElement *field = elementRecord; + FieldElement *field = (FieldElement *)elementRecord; GC gc = Ttk_GCForColor(tkwin,field->borderColorObj,d); ++b.width; @@ -291,16 +305,19 @@ static Ttk_ElementOptionSpec IndicatorElementOptions[] = { offsetof(IndicatorElement,upperColorObj), DARKEST_COLOR }, { "-lowerbordercolor", TK_OPTION_COLOR, offsetof(IndicatorElement,lowerColorObj), DARK_COLOR }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void IndicatorElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - IndicatorElement *indicator = elementRecord; + IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding margins; int size = 10; + (void)dummy; + (void)paddingPtr; + Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); *widthPtr = size + Ttk_PaddingWidth(margins); @@ -308,15 +325,16 @@ static void IndicatorElementSize( } static void RadioIndicatorElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { - IndicatorElement *indicator = elementRecord; + IndicatorElement *indicator = (IndicatorElement *)elementRecord; GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d); GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d); GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d); GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d); Ttk_Padding padding; + (void)dummy; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); @@ -336,17 +354,19 @@ static void RadioIndicatorElementDraw( } static void CheckIndicatorElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { Display *display = Tk_Display(tkwin); - IndicatorElement *indicator = elementRecord; + IndicatorElement *indicator = (IndicatorElement *)elementRecord; + GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d); GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d); GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d); GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d); Ttk_Padding padding; const int w = WIN32_XDRAWLINE_HACK; + (void)dummy; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); @@ -410,16 +430,19 @@ static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { "-arrowpadding",TK_OPTION_STRING, offsetof(MenuIndicatorElement,paddingObj), "3" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void MenuIndicatorElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - MenuIndicatorElement *indicator = elementRecord; + MenuIndicatorElement *indicator = (MenuIndicatorElement *)elementRecord; Ttk_Padding margins; int size = MENUBUTTON_ARROW_SIZE; + (void)dummy; + (void)paddingPtr; + Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); Ttk_GetPaddingFromObj(NULL, tkwin, indicator->paddingObj, &margins); TtkArrowSize(size, ARROW_DOWN, widthPtr, heightPtr); @@ -428,14 +451,16 @@ static void MenuIndicatorElementSize( } static void MenuIndicatorElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - MenuIndicatorElement *indicator = elementRecord; + MenuIndicatorElement *indicator = (MenuIndicatorElement *)elementRecord; XColor *arrowColor = Tk_GetColorFromObj(tkwin, indicator->colorObj); GC gc = Tk_GCForColor(arrowColor, d); int size = MENUBUTTON_ARROW_SIZE; int width, height; + (void)dummy; + (void)state; Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); @@ -476,7 +501,7 @@ static Ttk_ElementOptionSpec GripElementOptions[] = { offsetof(GripElement,borderColorObj), DARKEST_COLOR }, { "-gripcount", TK_OPTION_INT, offsetof(GripElement,gripCountObj), "5" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void GripElementSize( @@ -484,8 +509,10 @@ static void GripElementSize( int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL; - GripElement *grip = elementRecord; + GripElement *grip = (GripElement *)elementRecord; int gripCount = 0; + (void)tkwin; + (void)paddingPtr; Tcl_GetIntFromObj(NULL, grip->gripCountObj, &gripCount); if (horizontal) { @@ -501,11 +528,12 @@ static void GripElementDraw( { const int w = WIN32_XDRAWLINE_HACK; int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL; - GripElement *grip = elementRecord; + GripElement *grip = (GripElement *)elementRecord; GC lightGC = Ttk_GCForColor(tkwin,grip->lightColorObj,d); GC darkGC = Ttk_GCForColor(tkwin,grip->borderColorObj,d); int gripPad = 1, gripCount = 0; int i; + (void)state; Tcl_GetIntFromObj(NULL, grip->gripCountObj, &gripCount); @@ -575,16 +603,19 @@ static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { offsetof(ScrollbarElement,gripCountObj), "5" }, { "-sliderlength", TK_OPTION_INT, offsetof(ScrollbarElement,sliderlengthObj), "30" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TroughElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { - ScrollbarElement *sb = elementRecord; + ScrollbarElement *sb = (ScrollbarElement *)elementRecord; GC gcb = Ttk_GCForColor(tkwin,sb->borderColorObj,d); GC gct = Ttk_GCForColor(tkwin,sb->troughColorObj,d); + (void)dummy; + (void)state; + XFillRectangle(Tk_Display(tkwin), d, gct, b.x, b.y, b.width-1, b.height-1); XDrawRectangle(Tk_Display(tkwin), d, gcb, b.x, b.y, b.width-1, b.height-1); } @@ -598,24 +629,31 @@ static Ttk_ElementSpec TroughElementSpec = { }; static void ThumbElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ScrollbarElement *sb = elementRecord; + ScrollbarElement *sb = (ScrollbarElement *)elementRecord; int size = SCROLLBAR_THICKNESS; + (void)dummy; + (void)tkwin; + (void)paddingPtr; + Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &size); *widthPtr = *heightPtr = size; } static void ThumbElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { - ScrollbarElement *sb = elementRecord; - int gripCount = 0, orient = TTK_ORIENT_HORIZONTAL; + ScrollbarElement *sb = (ScrollbarElement *)elementRecord; + int gripCount = 0; + Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; GC lightGC, darkGC; int x1, y1, x2, y2, dx, dy, i; const int w = WIN32_XDRAWLINE_HACK; + (void)dummy; + (void)state; DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); @@ -663,11 +701,14 @@ static Ttk_ElementSpec ThumbElementSpec = { * +++ Slider element. */ static void SliderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ScrollbarElement *sb = elementRecord; - int length, thickness, orient; + ScrollbarElement *sb = (ScrollbarElement *)elementRecord; + int length, thickness; + Ttk_Orient orient; + (void)dummy; + (void)paddingPtr; length = thickness = SCROLLBAR_THICKNESS; Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); @@ -706,10 +747,12 @@ static void PbarElementSize( } static void PbarElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { - ScrollbarElement *sb = elementRecord; + ScrollbarElement *sb = (ScrollbarElement *)elementRecord; + (void)dummy; + (void)state; b = Ttk_PadBox(b, Ttk_UniformPadding(2)); if (b.width > 4 && b.height > 4) { @@ -736,11 +779,15 @@ static Ttk_ElementSpec PbarElementSpec = { static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT }; static void ArrowElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ScrollbarElement *sb = elementRecord; + ScrollbarElement *sb = (ScrollbarElement *)elementRecord; int size = SCROLLBAR_THICKNESS; + (void)dummy; + (void)tkwin; + (void)paddingPtr; + Tcl_GetIntFromObj(NULL, sb->arrowSizeObj, &size); *widthPtr = *heightPtr = size; } @@ -750,9 +797,10 @@ static void ArrowElementDraw( Drawable d, Ttk_Box b, unsigned state) { ArrowDirection dir = *(ArrowDirection*)clientData; - ScrollbarElement *sb = elementRecord; + ScrollbarElement *sb = (ScrollbarElement *)elementRecord; GC gc = Ttk_GCForColor(tkwin,sb->arrowColorObj, d); int h, cx, cy; + (void)state; DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); @@ -801,29 +849,36 @@ static Ttk_ElementOptionSpec NotebookElementOptions[] = { offsetof(NotebookElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, offsetof(NotebookElement,darkColorObj), DARK_COLOR }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TabElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int borderWidth = 2; + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + paddingPtr->top = paddingPtr->left = paddingPtr->right = borderWidth; paddingPtr->bottom = 0; } static void TabElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - NotebookElement *tab = elementRecord; + NotebookElement *tab = (NotebookElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj); Display *display = Tk_Display(tkwin); int borderWidth = 2, dh = 0; int x1,y1,x2,y2; GC gc; const int w = WIN32_XDRAWLINE_HACK; + (void)dummy; if (state & TTK_STATE_SELECTED) { dh = borderWidth; @@ -860,20 +915,28 @@ static Ttk_ElementSpec TabElementSpec = }; static void ClientElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int borderWidth = 2; + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void ClientElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - NotebookElement *ce = elementRecord; + NotebookElement *ce = (NotebookElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, ce->backgroundObj); int borderWidth = 2; + (void)dummy; + (void)state; Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth,TK_RELIEF_FLAT); diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index b22e5d5..2c49e83 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -26,27 +26,34 @@ static Ttk_ElementOptionSpec HighlightElementOptions[] = { offsetof(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND }, { "-highlightthickness",TK_OPTION_PIXELS, offsetof(HighlightElement,highlightThicknessObj), "0" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void HighlightElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - HighlightElement *hl = elementRecord; + HighlightElement *hl = (HighlightElement *)elementRecord; int highlightThickness = 0; + (void)dummy; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness); *paddingPtr = Ttk_UniformPadding((short)highlightThickness); } static void HighlightElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - HighlightElement *hl = elementRecord; + HighlightElement *hl = (HighlightElement *)elementRecord; int highlightThickness = 0; XColor *highlightColor = Tk_GetColorFromObj(tkwin, hl->highlightColorObj); + (void)dummy; + (void)b; + (void)state; Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness); if (highlightColor && highlightThickness > 0) { @@ -91,16 +98,20 @@ static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = offsetof(ButtonBorderElement,reliefObj), "flat" }, { "-default", TK_OPTION_ANY, offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ButtonBorderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ButtonBorderElement *bd = elementRecord; + ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; int borderWidth = 0; + (void)dummy; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); @@ -117,14 +128,16 @@ static void ButtonBorderElementSize( * when the button is active.) */ static void ButtonBorderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ButtonBorderElement *bd = elementRecord; + ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord; Tk_3DBorder border = NULL; int borderWidth = 1, relief = TK_RELIEF_FLAT; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; int inset = 0; + (void)dummy; + (void)state; /* * Get option values. @@ -204,15 +217,17 @@ static Ttk_ElementOptionSpec ArrowElementOptions[] = { "-borderwidth", TK_OPTION_PIXELS, offsetof(ArrowElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, offsetof(ArrowElement,reliefObj),"raised" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ArrowElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ArrowElement *arrow = elementRecord; + ArrowElement *arrow = (ArrowElement *)elementRecord; int size = 12; + (void)dummy; + (void)paddingPtr; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); *widthPtr = *heightPtr = size; @@ -223,12 +238,13 @@ static void ArrowElementDraw( Drawable d, Ttk_Box b, unsigned int state) { int direction = *(int *)clientData; - ArrowElement *arrow = elementRecord; + ArrowElement *arrow = (ArrowElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); int borderWidth = 2; int relief = TK_RELIEF_RAISED; int size = b.width < b.height ? b.width : b.height; XPoint points[3]; + (void)state; Tk_GetPixelsFromObj(NULL, tkwin, arrow->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief); @@ -316,16 +332,17 @@ static Ttk_ElementOptionSpec SashOptions[] = { offsetof(SashElement,handleSizeObj), "8" }, { "-handlepad", TK_OPTION_PIXELS, offsetof(SashElement,handlePadObj), "8" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SashElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - SashElement *sash = elementRecord; + SashElement *sash = (SashElement *)elementRecord; int sashPad = 2, sashThickness = 6, handleSize = 8; int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL; + (void)paddingPtr; Tk_GetPixelsFromObj(NULL, tkwin, sash->sashThicknessObj, &sashThickness); Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize); @@ -344,13 +361,14 @@ static void SashElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - SashElement *sash = elementRecord; + SashElement *sash = (SashElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, sash->borderObj); GC gc1,gc2; int relief = TK_RELIEF_RAISED; int handleSize = 8, handlePad = 8; int horizontal = *((Ttk_Orient*)clientData) == TTK_ORIENT_HORIZONTAL; Ttk_Box hb; + (void)state; Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize); Tk_GetPixelsFromObj(NULL, tkwin, sash->handlePadObj, &handlePad); diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h index 6701724..7a742da 100644 --- a/generic/ttk/ttkDecls.h +++ b/generic/ttk/ttkDecls.h @@ -131,7 +131,7 @@ TTKAPI Tcl_Obj * Ttk_NewBoxObj(Ttk_Box box); /* Slot 39 is reserved */ /* 40 */ TTKAPI int Ttk_GetOrientFromObj(Tcl_Interp *interp, - Tcl_Obj *objPtr, int *orient); + Tcl_Obj *objPtr, Ttk_Orient *orient); typedef struct TtkStubs { int magic; @@ -179,7 +179,7 @@ typedef struct TtkStubs { void (*reserved37)(void); void (*reserved38)(void); void (*reserved39)(void); - int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); /* 40 */ + int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *orient); /* 40 */ } TtkStubs; extern const TtkStubs *ttkStubsPtr; diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index 002448b..0fc438b 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -37,7 +37,7 @@ static const int WIN32_XDRAWLINE_HACK = 0; enum BorderColor { FLAT = 1, LITE = 2, DARK = 3, BRDR = 4 }; /* top-left outer, top-left inner, bottom-right inner, bottom-right outer */ -static int const shadowColors[6][4] = { +static const enum BorderColor shadowColors[6][4] = { { FLAT, FLAT, FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/ { DARK, LITE, DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/ { LITE, FLAT, DARK, BRDR }, /* TK_RELIEF_RAISED = 2*/ @@ -47,7 +47,7 @@ static int const shadowColors[6][4] = { }; /* top-left, bottom-right */ -static int const thinShadowColors[6][4] = { +static const enum BorderColor thinShadowColors[6][4] = { { FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/ { DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/ { LITE, DARK }, /* TK_RELIEF_RAISED = 2*/ @@ -116,7 +116,7 @@ static void DrawBorder( /* Alternate shadow colors for entry fields: * NOTE: FLAT color is normally white, and the LITE color is a darker shade. */ -static int fieldShadowColors[4] = { DARK, BRDR, LITE, FLAT }; +static enum BorderColor fieldShadowColors[4] = { DARK, BRDR, LITE, FLAT }; static void DrawFieldBorder( Tk_Window tkwin, Drawable d, Tk_3DBorder border, XColor *borderColor, @@ -255,16 +255,20 @@ static Ttk_ElementOptionSpec BorderElementOptions[] = { STRINGIFY(BORDERWIDTH) }, { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void BorderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - BorderElement *bd = elementRecord; + BorderElement *bd = (BorderElement *)elementRecord; int borderWidth = 0; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; + (void)dummy; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); @@ -277,15 +281,17 @@ static void BorderElementSize( } static void BorderElementDraw( - void *clientData, void *elementRecord, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - BorderElement *bd = elementRecord; + BorderElement *bd = (BorderElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, bd->borderColorObj); int borderWidth = 2; int relief = TK_RELIEF_FLAT; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; + (void)dummy; + (void)state; /* * Get option values. @@ -329,23 +335,31 @@ static Ttk_ElementOptionSpec FieldElementOptions[] = { "white" }, { "-bordercolor",TK_OPTION_COLOR, offsetof(FieldElement,borderColorObj), "black" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + *paddingPtr = Ttk_UniformPadding(2); } static void FieldElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - FieldElement *field = elementRecord; + FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, field->borderColorObj); + (void)dummy; + (void)state; Tk_Fill3DRectangle( tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_SUNKEN); @@ -480,16 +494,18 @@ static Ttk_ElementOptionSpec IndicatorElementOptions[] = { offsetof(IndicatorElement,borderColorObj), "black" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(IndicatorElement,marginObj), "0 2 4 2" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void IndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - IndicatorSpec *spec = clientData; - IndicatorElement *indicator = elementRecord; + IndicatorSpec *spec = (IndicatorSpec *)clientData; + IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding margins; + (void)paddingPtr; + Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); *widthPtr = spec->width + Ttk_PaddingWidth(margins); *heightPtr = spec->height + Ttk_PaddingHeight(margins); @@ -499,8 +515,8 @@ static void IndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - IndicatorSpec *spec = clientData; - IndicatorElement *indicator = elementRecord; + IndicatorSpec *spec = (IndicatorSpec *)clientData; + IndicatorElement *indicator = (IndicatorElement *)elementRecord; Display *display = Tk_Display(tkwin); Ttk_Padding padding; XColor *fgColor, *frameColor, *shadeColor, *indicatorColor, *borderColor; @@ -663,7 +679,7 @@ static Ttk_ElementOptionSpec ArrowElementOptions[] = { offsetof(ArrowElement,reliefObj),"raised"}, { "-arrowcolor", TK_OPTION_COLOR, offsetof(ArrowElement,colorObj),"black"}, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* @@ -677,9 +693,10 @@ static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ArrowElement *arrow = elementRecord; - int direction = *(int *)clientData; + ArrowElement *arrow = (ArrowElement *)elementRecord; + ArrowDirection direction = *(ArrowDirection *)clientData; int width = SCROLLBAR_WIDTH; + (void)paddingPtr; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &width); width -= Ttk_PaddingWidth(ArrowPadding); @@ -692,13 +709,14 @@ static void ArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - int direction = *(int *)clientData; - ArrowElement *arrow = elementRecord; + ArrowDirection direction = *(ArrowDirection *)clientData; + ArrowElement *arrow = (ArrowElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, arrow->borderColorObj); XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); int relief = TK_RELIEF_RAISED; int borderWidth = 2; + (void)state; Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief); @@ -743,17 +761,20 @@ static Ttk_ElementOptionSpec MenubuttonArrowElementOptions[] = { offsetof(MenubuttonArrowElement,sizeObj), STRINGIFY(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor",TK_OPTION_COLOR, offsetof(MenubuttonArrowElement,colorObj), "black"}, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static Ttk_Padding MenubuttonArrowPadding = { 3, 0, 3, 0 }; static void MenubuttonArrowElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - MenubuttonArrowElement *arrow = elementRecord; + MenubuttonArrowElement *arrow = (MenubuttonArrowElement *)elementRecord; int size = MENUBUTTON_ARROW_SIZE; + (void)dummy; + (void)paddingPtr; + Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); *widthPtr = *heightPtr = 2 * size + 1; *widthPtr += Ttk_PaddingWidth(MenubuttonArrowPadding); @@ -761,16 +782,18 @@ static void MenubuttonArrowElementSize( } static void MenubuttonArrowElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - MenubuttonArrowElement *arrow = elementRecord; + MenubuttonArrowElement *arrow = (MenubuttonArrowElement *)elementRecord; XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); GC gc = Tk_GCForColor(arrowColor, d); int size = MENUBUTTON_ARROW_SIZE; int postDirection = POST_BELOW; ArrowDirection arrowDirection = ARROW_DOWN; int width = 0, height = 0; + (void)dummy; + (void)state; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); Tcl_GetIndexFromObjStruct(NULL, arrow->directionObj, directionStrings, @@ -831,15 +854,18 @@ static Ttk_ElementOptionSpec TroughElementOptions[] = { offsetof(TroughElement,reliefObj), "sunken" }, { "-groovewidth", TK_OPTION_PIXELS, offsetof(TroughElement,grooveWidthObj), "-1" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TroughElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TroughElement *troughPtr = elementRecord; + TroughElement *troughPtr = (TroughElement *)elementRecord; int borderWidth = 2, grooveWidth = 0; + (void)dummy; + (void)widthPtr; + (void)heightPtr; Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &grooveWidth); @@ -850,12 +876,15 @@ static void TroughElementSize( } static void TroughElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - TroughElement *troughPtr = elementRecord; + TroughElement *troughPtr = (TroughElement *)elementRecord; Tk_3DBorder border = NULL; - int borderWidth = 2, relief = TK_RELIEF_SUNKEN, groove = -1, orient; + int borderWidth = 2, relief = TK_RELIEF_SUNKEN, groove = -1; + Ttk_Orient orient; + (void)dummy; + (void)state; border = Tk_Get3DBorderFromObj(tkwin, troughPtr->colorObj); Ttk_GetOrientFromObj(NULL, troughPtr->orientObj, &orient); @@ -909,15 +938,19 @@ static Ttk_ElementOptionSpec ThumbElementOptions[] = { "black" }, { "-relief", TK_OPTION_RELIEF, offsetof(ThumbElement,reliefObj),"raised" }, { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ThumbElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ThumbElement *thumb = elementRecord; - int orient, size; + ThumbElement *thumb = (ThumbElement *)elementRecord; + Ttk_Orient orient; + int size; + (void)dummy; + (void)paddingPtr; + Tk_GetPixelsFromObj(NULL, tkwin, thumb->sizeObj, &size); Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient); @@ -931,14 +964,16 @@ static void ThumbElementSize( } static void ThumbElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ThumbElement *thumb = elementRecord; + ThumbElement *thumb = (ThumbElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, thumb->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, thumb->borderColorObj); int relief = TK_RELIEF_RAISED; int borderWidth = 2; + (void)dummy; + (void)state; /* * Don't draw the thumb if we are disabled. @@ -998,15 +1033,18 @@ static Ttk_ElementOptionSpec SliderElementOptions[] = { "black" }, { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SliderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - SliderElement *slider = elementRecord; - int orient, length, thickness, borderWidth; + SliderElement *slider = (SliderElement *)elementRecord; + Ttk_Orient orient; + int length, thickness, borderWidth; + (void)dummy; + (void)paddingPtr; Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); @@ -1027,13 +1065,15 @@ static void SliderElementSize( } static void SliderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - SliderElement *slider = elementRecord; + SliderElement *slider = (SliderElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, slider->borderColorObj); int relief = TK_RELIEF_RAISED, borderWidth = 2; + (void)dummy; + (void)state; Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief); @@ -1072,16 +1112,18 @@ static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { offsetof(TreeitemIndicator,diameterObj), "9" }, { "-indicatormargins", TK_OPTION_STRING, offsetof(TreeitemIndicator,marginObj), "2 2 4 2" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TreeitemIndicatorSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TreeitemIndicator *indicator = elementRecord; + TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; int diameter = 0; Ttk_Padding margins; + (void)dummy; + (void)paddingPtr; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter); @@ -1090,15 +1132,16 @@ static void TreeitemIndicatorSize( } static void TreeitemIndicatorDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - TreeitemIndicator *indicator = elementRecord; + TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; XColor *color = Tk_GetColorFromObj(tkwin, indicator->colorObj); GC gc = Tk_GCForColor(color, d); Ttk_Padding padding = Ttk_UniformPadding(0); int w = WIN32_XDRAWLINE_HACK; int cx, cy; + (void)dummy; if (state & TTK_STATE_LEAF) { /* don't draw anything ... */ diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index b6bc1fd..fbdf82e 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -19,20 +19,32 @@ * and may be used in other engines. */ -/* public */ Ttk_ElementOptionSpec TtkNullElementOptions[] = { { NULL, 0, 0, NULL } }; +/* public */ Ttk_ElementOptionSpec TtkNullElementOptions[] = { { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* public */ void TtkNullElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + (void)paddingPtr; } /* public */ void TtkNullElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)d; + (void)b; + (void)state; } /* public */ Ttk_ElementSpec ttkNullElementSpec = { @@ -59,15 +71,17 @@ typedef struct { static Ttk_ElementOptionSpec BackgroundElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FillElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - BackgroundElement *bg = elementRecord; + BackgroundElement *bg = (BackgroundElement *)elementRecord; Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,bg->backgroundObj); + (void)dummy; + (void)state; XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), @@ -78,6 +92,8 @@ static void BackgroundElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { + (void)b; + FillElementDraw( clientData, elementRecord, tkwin, d, Ttk_WinBox(tkwin), state); @@ -116,26 +132,33 @@ static Ttk_ElementOptionSpec BorderElementOptions[] = { offsetof(BorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void BorderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - BorderElement *bd = elementRecord; + BorderElement *bd = (BorderElement *)elementRecord; int borderWidth = 0; + (void)dummy; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void BorderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - BorderElement *bd = elementRecord; + BorderElement *bd = (BorderElement *)elementRecord; Tk_3DBorder border = NULL; int borderWidth = 1, relief = TK_RELIEF_FLAT; + (void)dummy; + (void)state; border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj); Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); @@ -169,26 +192,32 @@ static Ttk_ElementOptionSpec FieldElementOptions[] = { offsetof(FieldElement,borderObj), "white" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(FieldElement,borderWidthObj), "2" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - FieldElement *field = elementRecord; + FieldElement *field = (FieldElement *)elementRecord; int borderWidth = 2; + (void)dummy; + (void)widthPtr; + (void)heightPtr; + Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void FieldElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - FieldElement *field = elementRecord; + FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj); int borderWidth = 2; + (void)dummy; + (void)state; Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, d, border, @@ -227,17 +256,20 @@ static Ttk_ElementOptionSpec PaddingElementOptions[] = { offsetof(PaddingElement,reliefObj), "flat" }, { "-shiftrelief", TK_OPTION_INT, offsetof(PaddingElement,shiftreliefObj), "0" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void PaddingElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - PaddingElement *padding = elementRecord; + PaddingElement *padding = (PaddingElement *)elementRecord; int shiftRelief = 0; int relief = TK_RELIEF_FLAT; Ttk_Padding pad; + (void)dummy; + (void)widthPtr; + (void)heightPtr; Tk_GetReliefFromObj(NULL, padding->reliefObj, &relief); Tcl_GetIntFromObj(NULL, padding->shiftreliefObj, &shiftRelief); @@ -291,26 +323,31 @@ static Ttk_ElementOptionSpec FocusElementOptions[] = { offsetof(FocusElement,focusColorObj), "black" }, { "-focusthickness",TK_OPTION_PIXELS, offsetof(FocusElement,focusThicknessObj), "1" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FocusElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - FocusElement *focus = elementRecord; + FocusElement *focus = (FocusElement *)elementRecord; int focusThickness = 0; + (void)dummy; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; Tcl_GetIntFromObj(NULL, focus->focusThicknessObj, &focusThickness); *paddingPtr = Ttk_UniformPadding((short)focusThickness); } static void FocusElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - FocusElement *focus = elementRecord; + FocusElement *focus = (FocusElement *)elementRecord; int focusThickness = 0; + (void)dummy; if (state & TTK_STATE_FOCUS) { Tcl_GetIntFromObj(NULL,focus->focusThicknessObj,&focusThickness); @@ -343,37 +380,46 @@ static Ttk_ElementOptionSpec SeparatorElementOptions[] = { offsetof(SeparatorElement, orientObj), "horizontal" }, { "-background", TK_OPTION_BORDER, offsetof(SeparatorElement,borderObj), DEFAULT_BACKGROUND }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SeparatorElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)paddingPtr; + *widthPtr = *heightPtr = 2; } static void HorizontalSeparatorElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - SeparatorElement *separator = elementRecord; + SeparatorElement *separator = (SeparatorElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, separator->borderObj); GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); + (void)dummy; + (void)state; XDrawLine(Tk_Display(tkwin), d, darkGC, b.x, b.y, b.x + b.width, b.y); XDrawLine(Tk_Display(tkwin), d, lightGC, b.x, b.y+1, b.x + b.width, b.y+1); } static void VerticalSeparatorElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - SeparatorElement *separator = elementRecord; + SeparatorElement *separator = (SeparatorElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, separator->borderObj); GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); + (void)dummy; + (void)state; XDrawLine(Tk_Display(tkwin), d, darkGC, b.x, b.y, b.x, b.y + b.height); XDrawLine(Tk_Display(tkwin), d, lightGC, b.x+1, b.y, b.x+1, b.y+b.height); @@ -383,8 +429,8 @@ static void GeneralSeparatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - SeparatorElement *separator = elementRecord; - int orient; + SeparatorElement *separator = (SeparatorElement *)elementRecord; + Ttk_Orient orient; Ttk_GetOrientFromObj(NULL, separator->orientObj, &orient); switch (orient) { case TTK_ORIENT_HORIZONTAL: @@ -433,27 +479,34 @@ typedef struct { static Ttk_ElementOptionSpec SizegripOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(SizegripElement,backgroundObj), DEFAULT_BACKGROUND }, - {0,0,0,0} + {0,TK_OPTION_BOOLEAN,0,0} }; static void SizegripSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int gripCount = 3, gripSpace = 2, gripThickness = 3; + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)paddingPtr; + *widthPtr = *heightPtr = gripCount * (gripSpace + gripThickness); } static void SizegripDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - SizegripElement *grip = elementRecord; + SizegripElement *grip = (SizegripElement *)elementRecord; int gripCount = 3, gripSpace = 2; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, grip->backgroundObj); GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); int x1 = b.x + b.width-1, y1 = b.y + b.height-1, x2 = x1, y2 = y1; + (void)dummy; + (void)state; while (gripCount--) { x1 -= gripSpace; y2 -= gripSpace; @@ -504,19 +557,22 @@ static Ttk_ElementOptionSpec IndicatorElementOptions[] = { offsetof(IndicatorElement,marginObj), "0 2 4 2" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(IndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* * Checkbutton indicators (default): 3-D square. */ static void SquareIndicatorElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - IndicatorElement *indicator = elementRecord; + IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding margins; int diameter = 0; + (void)dummy; + (void)paddingPtr; + Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter); *widthPtr = diameter + Ttk_PaddingWidth(margins); @@ -524,15 +580,17 @@ static void SquareIndicatorElementSize( } static void SquareIndicatorElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - IndicatorElement *indicator = elementRecord; + IndicatorElement *indicator = (IndicatorElement *)elementRecord; Tk_3DBorder border = 0, interior = 0; int relief = TK_RELIEF_RAISED; Ttk_Padding padding; int borderWidth = 2; int diameter; + (void)dummy; + (void)state; interior = Tk_Get3DBorderFromObj(tkwin, indicator->colorObj); border = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj); @@ -553,12 +611,15 @@ static void SquareIndicatorElementDraw( * Radiobutton indicators: 3-D diamond. */ static void DiamondIndicatorElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - IndicatorElement *indicator = elementRecord; + IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding margins; int diameter = 0; + (void)dummy; + (void)paddingPtr; + Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->diameterObj, &diameter); *widthPtr = diameter + 3 + Ttk_PaddingWidth(margins); @@ -566,16 +627,18 @@ static void DiamondIndicatorElementSize( } static void DiamondIndicatorElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - IndicatorElement *indicator = elementRecord; + IndicatorElement *indicator = (IndicatorElement *)elementRecord; Tk_3DBorder border = 0, interior = 0; int borderWidth = 2; int relief = TK_RELIEF_RAISED; int diameter, radius; XPoint points[4]; Ttk_Padding padding; + (void)dummy; + (void)state; interior = Tk_Get3DBorderFromObj(tkwin, indicator->colorObj); border = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj); @@ -650,15 +713,18 @@ static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { offsetof(MenuIndicatorElement,reliefObj),"raised" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(MenuIndicatorElement,marginObj), "5 0" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void MenuIndicatorElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - MenuIndicatorElement *mi = elementRecord; + MenuIndicatorElement *mi = (MenuIndicatorElement *)elementRecord; Ttk_Padding margins; + (void)dummy; + (void)paddingPtr; + Tk_GetPixelsFromObj(NULL, tkwin, mi->widthObj, widthPtr); Tk_GetPixelsFromObj(NULL, tkwin, mi->heightObj, heightPtr); Ttk_GetPaddingFromObj(NULL,tkwin,mi->marginObj, &margins); @@ -667,13 +733,15 @@ static void MenuIndicatorElementSize( } static void MenuIndicatorElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - MenuIndicatorElement *mi = elementRecord; + MenuIndicatorElement *mi = (MenuIndicatorElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, mi->backgroundObj); Ttk_Padding margins; int borderWidth = 2; + (void)dummy; + (void)state; Ttk_GetPaddingFromObj(NULL,tkwin,mi->marginObj,&margins); b = Ttk_PadBox(b, margins); @@ -697,7 +765,7 @@ static Ttk_ElementSpec MenuIndicatorElementSpec = { * clientData is an enum ArrowDirection pointer. */ -static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT }; +static ArrowDirection ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT }; typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; @@ -717,7 +785,7 @@ static Ttk_ElementOptionSpec ArrowElementOptions[] = { offsetof(ArrowElement,colorObj),"black"}, { "-arrowsize", TK_OPTION_PIXELS, offsetof(ArrowElement,sizeObj), "14" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static Ttk_Padding ArrowMargins = { 3,3,3,3 }; @@ -726,9 +794,10 @@ static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ArrowElement *arrow = elementRecord; - int direction = *(int *)clientData; + ArrowElement *arrow = (ArrowElement *)elementRecord; + ArrowDirection direction = *(ArrowDirection *)clientData; int width = 14; + (void)paddingPtr; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &width); width -= Ttk_PaddingWidth(ArrowMargins); @@ -741,12 +810,13 @@ static void ArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - int direction = *(int *)clientData; - ArrowElement *arrow = elementRecord; + ArrowDirection direction = *(ArrowDirection *)clientData; + ArrowElement *arrow = (ArrowElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); int relief = TK_RELIEF_RAISED; int borderWidth = 1; + (void)state; Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief); @@ -784,27 +854,32 @@ static Ttk_ElementOptionSpec TroughElementOptions[] = { offsetof(TroughElement,colorObj), DEFAULT_BACKGROUND }, { "-troughrelief",TK_OPTION_RELIEF, offsetof(TroughElement,reliefObj), "sunken" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TroughElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TroughElement *troughPtr = elementRecord; + TroughElement *troughPtr = (TroughElement *)elementRecord; int borderWidth = 2; + (void)dummy; + (void)widthPtr; + (void)heightPtr; Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void TroughElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - TroughElement *troughPtr = elementRecord; + TroughElement *troughPtr = (TroughElement *)elementRecord; Tk_3DBorder border = NULL; int borderWidth = 2, relief = TK_RELIEF_SUNKEN; + (void)dummy; + (void)state; border = Tk_Get3DBorderFromObj(tkwin, troughPtr->colorObj); Tk_GetReliefFromObj(NULL, troughPtr->reliefObj, &relief); @@ -848,15 +923,18 @@ static Ttk_ElementOptionSpec ThumbElementOptions[] = { offsetof(ThumbElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(ThumbElement,borderWidthObj), DEFAULT_BORDERWIDTH }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ThumbElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ThumbElement *thumb = elementRecord; - int orient, thickness; + ThumbElement *thumb = (ThumbElement *)elementRecord; + Ttk_Orient orient; + int thickness; + (void)dummy; + (void)paddingPtr; Tk_GetPixelsFromObj(NULL, tkwin, thumb->thicknessObj, &thickness); Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient); @@ -871,12 +949,14 @@ static void ThumbElementSize( } static void ThumbElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ThumbElement *thumb = elementRecord; + ThumbElement *thumb = (ThumbElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, thumb->borderObj); int borderWidth = 2, relief = TK_RELIEF_RAISED; + (void)dummy; + (void)state; Tk_GetPixelsFromObj(NULL, tkwin, thumb->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, thumb->reliefObj, &relief); @@ -921,15 +1001,18 @@ static Ttk_ElementOptionSpec SliderElementOptions[] = { DEFAULT_BACKGROUND }, { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SliderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - SliderElement *slider = elementRecord; - int orient, length, thickness; + SliderElement *slider = (SliderElement *)elementRecord; + Ttk_Orient orient; + int length, thickness; + (void)dummy; + (void)paddingPtr; Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->lengthObj, &length); @@ -949,12 +1032,15 @@ static void SliderElementSize( } static void SliderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - SliderElement *slider = elementRecord; + SliderElement *slider = (SliderElement *)elementRecord; Tk_3DBorder border = NULL; - int relief = TK_RELIEF_RAISED, borderWidth = 2, orient; + int relief = TK_RELIEF_RAISED, borderWidth = 2; + Ttk_Orient orient; + (void)dummy; + (void)state; border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); @@ -1032,15 +1118,18 @@ static Ttk_ElementOptionSpec PbarElementOptions[] = { DEFAULT_BORDERWIDTH }, { "-background", TK_OPTION_BORDER, offsetof(PbarElement,borderObj), DEFAULT_BACKGROUND }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void PbarElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - PbarElement *pbar = elementRecord; - int orient, thickness = 15, length = 30, borderWidth = 2; + PbarElement *pbar = (PbarElement *)elementRecord; + Ttk_Orient orient; + int thickness = 15, length = 30, borderWidth = 2; + (void)dummy; + (void)paddingPtr; Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, pbar->thicknessObj, &thickness); @@ -1060,12 +1149,14 @@ static void PbarElementSize( } static void PbarElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - PbarElement *pbar = elementRecord; + PbarElement *pbar = (PbarElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, pbar->borderObj); int relief = TK_RELIEF_RAISED, borderWidth = 2; + (void)dummy; + (void)state; Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, pbar->reliefObj, &relief); @@ -1097,30 +1188,35 @@ static Ttk_ElementOptionSpec TabElementOptions[] = { offsetof(TabElement,borderWidthObj),"1" }, { "-background", TK_OPTION_BORDER, offsetof(TabElement,backgroundObj), DEFAULT_BACKGROUND }, - {0,0,0,0} + {0,TK_OPTION_BOOLEAN,0,0} }; static void TabElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TabElement *tab = elementRecord; + TabElement *tab = (TabElement *)elementRecord; int borderWidth = 1; + (void)dummy; + (void)widthPtr; + (void)heightPtr; + Tk_GetPixelsFromObj(0, tkwin, tab->borderWidthObj, &borderWidth); paddingPtr->top = paddingPtr->left = paddingPtr->right = borderWidth; paddingPtr->bottom = 0; } static void TabElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - TabElement *tab = elementRecord; + TabElement *tab = (TabElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj); int borderWidth = 1; int cut = 2; XPoint pts[6]; int n = 0; + (void)dummy; Tcl_GetIntFromObj(NULL, tab->borderWidthObj, &borderWidth); @@ -1179,12 +1275,14 @@ typedef TabElement ClientElement; #define ClientElementOptions TabElementOptions static void ClientElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ClientElement *ce = elementRecord; + ClientElement *ce = (ClientElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, ce->backgroundObj); int borderWidth = 1; + (void)dummy; + (void)state; Tcl_GetIntFromObj(NULL, ce->borderWidthObj, &borderWidth); @@ -1193,11 +1291,15 @@ static void ClientElementDraw( } static void ClientElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ClientElement *ce = elementRecord; + ClientElement *ce = (ClientElement *)elementRecord; int borderWidth = 1; + (void)dummy; + (void)widthPtr; + (void)heightPtr; + Tk_GetPixelsFromObj(0, tkwin, ce->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); } diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 37b4dbc..72cf54e 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -298,7 +298,7 @@ static char *EntryDisplayString(const char *showChar, int numChars) TkUtfToUniChar(showChar, &ch); size = TkUniCharToUtf(ch, buf); - p = displayString = ckalloc(numChars * size + 1); + p = displayString = (char *)ckalloc(numChars * size + 1); while (numChars--) { memcpy(p, buf, size); @@ -354,7 +354,7 @@ static int EntryFetchSelection( ClientData clientData, int offset, char *buffer, int maxBytes) { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; int byteCount; const char *string; const char *selStart, *selEnd; @@ -387,7 +387,7 @@ EntryFetchSelection( */ static void EntryLostSelection(ClientData clientData) { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; entryPtr->core.flags &= ~GOT_SELECTION; entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1; TtkRedisplayWidget(&entryPtr->core); @@ -419,8 +419,8 @@ static void EntryOwnSelection(Entry *entryPtr) static void ExpandPercents( Entry *entryPtr, /* Entry that needs validation. */ - const char *template, /* Script template */ - const char *new, /* Potential new value of entry string */ + const char *templ, /* Script template */ + const char *newValue, /* Potential new value of entry string */ int index, /* index of insert/delete */ int count, /* #changed characters */ VREASON reason, /* Reason for change */ @@ -433,28 +433,28 @@ ExpandPercents( int ch; char numStorage[2*TCL_INTEGER_SPACE]; - while (*template) { + while (*templ) { /* Find everything up to the next % character and append it * to the result string. */ - string = Tcl_UtfFindFirst(template, '%'); + string = Tcl_UtfFindFirst(templ, '%'); if (string == NULL) { /* No more %-sequences to expand. * Copy the rest of the template. */ - Tcl_DStringAppend(dsPtr, template, -1); + Tcl_DStringAppend(dsPtr, templ, -1); return; } - if (string != template) { - Tcl_DStringAppend(dsPtr, template, string - template); - template = string; + if (string != templ) { + Tcl_DStringAppend(dsPtr, templ, string - templ); + templ = string; } /* There's a percent sequence here. Process it. */ - ++template; /* skip over % */ - if (*template != '\0') { - template += TkUtfToUniChar(template, &ch); + ++templ; /* skip over % */ + if (*templ != '\0') { + templ += TkUtfToUniChar(templ, &ch); } else { ch = '%'; } @@ -477,14 +477,14 @@ ExpandPercents( string = numStorage; break; case 'P': /* 'Peeked' new value of the string */ - string = new; + string = newValue; break; case 's': /* Current string value */ string = entryPtr->entry.string; break; case 'S': /* string to be inserted/deleted, if any */ if (reason == VALIDATE_INSERT) { - string = Tcl_UtfAtIndex(new, index); + string = Tcl_UtfAtIndex(newValue, index); stringLength = Tcl_UtfAtIndex(string, count) - string; } else if (reason == VALIDATE_DELETE) { string = Tcl_UtfAtIndex(entryPtr->entry.string, index); @@ -528,9 +528,9 @@ ExpandPercents( static int RunValidationScript( Tcl_Interp *interp, /* Interpreter to use */ Entry *entryPtr, /* Entry being validated */ - const char *template, /* Script template */ + const char *templ, /* Script template */ const char *optionName, /* "-validatecommand", "-invalidcommand" */ - const char *new, /* Potential new value of entry string */ + const char *newValue, /* Potential new value of entry string */ int index, /* index of insert/delete */ int count, /* #changed characters */ VREASON reason) /* Reason for change */ @@ -539,7 +539,7 @@ static int RunValidationScript( int code; Tcl_DStringInit(&script); - ExpandPercents(entryPtr, template, new, index, count, reason, &script); + ExpandPercents(entryPtr, templ, newValue, index, count, reason, &script); code = Tcl_EvalEx(interp, Tcl_DStringValue(&script), Tcl_DStringLength(&script), TCL_EVAL_GLOBAL); @@ -656,10 +656,11 @@ done: * Returns: * TCL_OK if valid, TCL_BREAK if invalid, TCL_ERROR on error. */ -static int EntryRevalidate(Tcl_Interp *interp, Entry *entryPtr, VREASON reason) +static int EntryRevalidate(Tcl_Interp *dummy, Entry *entryPtr, VREASON reason) { int code = EntryValidateChange( entryPtr, entryPtr->entry.string, -1,0, reason); + (void)dummy; if (code == TCL_BREAK) { TtkWidgetChangeState(&entryPtr->core, TTK_STATE_INVALID, 0); @@ -747,7 +748,7 @@ EntryStoreValue(Entry *entryPtr, const char *value) /* Store new value: */ - entryPtr->entry.string = ckalloc(numBytes + 1); + entryPtr->entry.string = (char *)ckalloc(numBytes + 1); strcpy(entryPtr->entry.string, value); entryPtr->entry.numBytes = numBytes; entryPtr->entry.numChars = numChars; @@ -804,7 +805,7 @@ static int EntrySetValue(Entry *entryPtr, const char *value) */ static void EntryTextVariableTrace(void *recordPtr, const char *value) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (WidgetDestroyed(&entryPtr->core)) { return; @@ -838,29 +839,29 @@ InsertChars( size_t byteCount = strlen(value); int charsAdded = Tcl_NumUtfChars(value, byteCount); size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1; - char *new; + char *newBytes; int code; if (byteCount == 0) { return TCL_OK; } - new = ckalloc(newByteCount); - memcpy(new, string, byteIndex); - strcpy(new + byteIndex, value); - strcpy(new + byteIndex + byteCount, string + byteIndex); + newBytes = (char *)ckalloc(newByteCount); + memcpy(newBytes, string, byteIndex); + strcpy(newBytes + byteIndex, value); + strcpy(newBytes + byteIndex + byteCount, string + byteIndex); code = EntryValidateChange( - entryPtr, new, index, charsAdded, VALIDATE_INSERT); + entryPtr, newBytes, index, charsAdded, VALIDATE_INSERT); if (code == TCL_OK) { AdjustIndices(entryPtr, index, charsAdded); - code = EntrySetValue(entryPtr, new); + code = EntrySetValue(entryPtr, newBytes); } else if (code == TCL_BREAK) { code = TCL_OK; } - ckfree(new); + ckfree(newBytes); return code; } @@ -875,7 +876,7 @@ DeleteChars( { char *string = entryPtr->entry.string; size_t byteIndex, byteCount, newByteCount; - char *new; + char *newBytes; int code; if (index < 0) { @@ -892,20 +893,20 @@ DeleteChars( byteCount = Tcl_UtfAtIndex(string+byteIndex, count) - (string+byteIndex); newByteCount = entryPtr->entry.numBytes + 1 - byteCount; - new = ckalloc(newByteCount); - memcpy(new, string, byteIndex); - strcpy(new + byteIndex, string + byteIndex + byteCount); + newBytes = (char *)ckalloc(newByteCount); + memcpy(newBytes, string, byteIndex); + strcpy(newBytes + byteIndex, string + byteIndex + byteCount); code = EntryValidateChange( - entryPtr, new, index, count, VALIDATE_DELETE); + entryPtr, newBytes, index, count, VALIDATE_DELETE); if (code == TCL_OK) { AdjustIndices(entryPtr, index, -count); - code = EntrySetValue(entryPtr, new); + code = EntrySetValue(entryPtr, newBytes); } else if (code == TCL_BREAK) { code = TCL_OK; } - ckfree(new); + ckfree(newBytes); return code; } @@ -922,7 +923,7 @@ DeleteChars( static void EntryEventProc(ClientData clientData, XEvent *eventPtr) { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; Tcl_Preserve(clientData); switch (eventPtr->type) { @@ -945,9 +946,10 @@ EntryEventProc(ClientData clientData, XEvent *eventPtr) */ static void -EntryInitialize(Tcl_Interp *interp, void *recordPtr) +EntryInitialize(Tcl_Interp *dummy, void *recordPtr) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; + (void)dummy; Tk_CreateEventHandler( entryPtr->core.tkwin, EntryEventMask, EntryEventProc, entryPtr); @@ -955,7 +957,7 @@ EntryInitialize(Tcl_Interp *interp, void *recordPtr) EntryFetchSelection, (ClientData) entryPtr, XA_STRING); TtkBlinkCursor(&entryPtr->core); - entryPtr->entry.string = ckalloc(1); + entryPtr->entry.string = (char *)ckalloc(1); *entryPtr->entry.string = '\0'; entryPtr->entry.displayString = entryPtr->entry.string; entryPtr->entry.textVariableTrace = 0; @@ -974,7 +976,7 @@ EntryInitialize(Tcl_Interp *interp, void *recordPtr) static void EntryCleanup(void *recordPtr) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (entryPtr->entry.textVariableTrace) Ttk_UntraceVariable(entryPtr->entry.textVariableTrace); @@ -996,7 +998,7 @@ EntryCleanup(void *recordPtr) */ static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; Tcl_Obj *textVarName = entryPtr->entry.textVariableObj; Ttk_TraceHandle *vt = 0; @@ -1060,10 +1062,11 @@ static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask) /* EntryPostConfigure -- * Post-configuration hook for entry widgets. */ -static int EntryPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) +static int EntryPostConfigure(Tcl_Interp *dummy, void *recordPtr, int mask) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int status = TCL_OK; + (void)dummy; if ((mask & TEXTVAR_CHANGED) && entryPtr->entry.textVariableTrace != NULL) { status = Ttk_FireTrace(entryPtr->entry.textVariableTrace); @@ -1101,7 +1104,7 @@ EntryCharPosition(Entry *entryPtr, int index) static void EntryDoLayout(void *recordPtr) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; WidgetCore *corePtr = &entryPtr->core; Tk_TextLayout textLayout = entryPtr->entry.textLayout; int leftIndex = entryPtr->entry.xscroll.first; @@ -1188,7 +1191,7 @@ static GC EntryGetGC(Entry *entryPtr, Tcl_Obj *colorObj, TkRegion clip) */ static void EntryDisplay(void *clientData, Drawable d) { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; Tk_Window tkwin = entryPtr->core.tkwin; int leftIndex = entryPtr->entry.xscroll.first, rightIndex = entryPtr->entry.xscroll.last + 1, @@ -1444,7 +1447,7 @@ static int EntryBBoxCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; Ttk_Box b; int index; @@ -1474,7 +1477,7 @@ static int EntryDeleteCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int first, last; if ((objc < 3) || (objc > 4)) { @@ -1503,7 +1506,7 @@ static int EntryGetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; @@ -1519,7 +1522,7 @@ static int EntryICursorCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pos"); return TCL_ERROR; @@ -1539,7 +1542,7 @@ static int EntryIndexCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int index; if (objc != 3) { @@ -1561,7 +1564,7 @@ static int EntryInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int index; if (objc != 4) { @@ -1583,7 +1586,7 @@ EntryInsertCommand( static int EntrySelectionClearCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); @@ -1600,7 +1603,7 @@ static int EntrySelectionClearCommand( static int EntrySelectionPresentCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; @@ -1616,7 +1619,7 @@ static int EntrySelectionPresentCommand( static int EntrySelectionRangeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int start, end; if (objc != 5) { Tcl_WrongNumArgs(interp, 3, objv, "start end"); @@ -1654,7 +1657,7 @@ static const Ttk_Ensemble EntrySelectionCommands[] = { static int EntrySetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "value"); return TCL_ERROR; @@ -1670,7 +1673,7 @@ static int EntrySetCommand( static int EntryValidateCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int code; if (objc != 2) { @@ -1692,7 +1695,7 @@ static int EntryValidateCommand( static int EntryXViewCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc == 3) { int newFirst; if (EntryIndex(interp, entryPtr, objv[2], &newFirst) != TCL_OK) { @@ -1787,7 +1790,7 @@ static Tk_OptionSpec ComboboxOptionSpecs[] = { static void ComboboxInitialize(Tcl_Interp *interp, void *recordPtr) { - Combobox *cb = recordPtr; + Combobox *cb = (Combobox *)recordPtr; cb->combobox.currentIndex = -1; TtkTrackElementState(&cb->core); @@ -1800,7 +1803,7 @@ ComboboxInitialize(Tcl_Interp *interp, void *recordPtr) static int ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Combobox *cbPtr = recordPtr; + Combobox *cbPtr = (Combobox *)recordPtr; int unused; /* Make sure -values is a valid list: @@ -1820,7 +1823,7 @@ ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) static int ComboboxCurrentCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Combobox *cbPtr = recordPtr; + Combobox *cbPtr = (Combobox *)recordPtr; int currentIndex = cbPtr->combobox.currentIndex; const char *currentValue = cbPtr->entry.string; int nValues; @@ -1891,7 +1894,7 @@ static int ComboboxCurrentCommand( cbPtr->combobox.currentIndex = currentIndex; - return EntrySetValue(recordPtr, Tcl_GetString(values[currentIndex])); + return EntrySetValue((Entry *)recordPtr, Tcl_GetString(values[currentIndex])); } else { Tcl_WrongNumArgs(interp, 2, objv, "?newIndex?"); return TCL_ERROR; @@ -1993,7 +1996,7 @@ static Tk_OptionSpec SpinboxOptionSpecs[] = { static void SpinboxInitialize(Tcl_Interp *interp, void *recordPtr) { - Spinbox *sb = recordPtr; + Spinbox *sb = (Spinbox *)recordPtr; TtkTrackElementState(&sb->core); EntryInitialize(interp, recordPtr); } @@ -2004,7 +2007,7 @@ SpinboxInitialize(Tcl_Interp *interp, void *recordPtr) static int SpinboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Spinbox *sb = recordPtr; + Spinbox *sb = (Spinbox *)recordPtr; int unused; /* Make sure -values is a valid list: @@ -2066,18 +2069,20 @@ static Ttk_ElementOptionSpec TextareaElementOptions[] = { offsetof(TextareaElement,fontObj), DEF_ENTRY_FONT }, { "-width", TK_OPTION_INT, offsetof(TextareaElement,widthObj), "20" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TextareaElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TextareaElement *textarea = elementRecord; + TextareaElement *textarea = (TextareaElement *)elementRecord; Tk_Font font = Tk_GetFontFromObj(tkwin, textarea->fontObj); int avgWidth = Tk_TextWidth(font, "0", 1); Tk_FontMetrics fm; int prefWidth = 1; + (void)dummy; + (void)paddingPtr; Tk_GetFontMetrics(font, &fm); Tcl_GetIntFromObj(NULL, textarea->widthObj, &prefWidth); diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index bb3dd35..714b16e 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -90,7 +90,10 @@ static Ttk_Padding FrameMargins(Frame *framePtr) */ static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr) { - Frame *framePtr = recordPtr; + Frame *framePtr = (Frame *)recordPtr; + (void)widthPtr; + (void)heightPtr; + Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr)); return 0; } @@ -111,7 +114,7 @@ static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr) static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Frame *framePtr = recordPtr; + Frame *framePtr = (Frame *)recordPtr; int width, height; /* @@ -339,11 +342,13 @@ LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr) */ static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; Ttk_Padding margins; LabelframeStyle style; int labelWidth, labelHeight; + (void)widthPtr; + (void)heightPtr; LabelframeStyleOptions(lframePtr, &style); @@ -384,7 +389,7 @@ static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr) static Ttk_Layout LabelframeGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Labelframe *lf = recordPtr; + Labelframe *lf = (Labelframe *)recordPtr; Ttk_Layout frameLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout labelLayout; @@ -415,7 +420,7 @@ static Ttk_Layout LabelframeGetLayout( static void LabelframeDoLayout(void *recordPtr) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; int lw, lh; /* Label width and height */ LabelframeStyle style; @@ -461,7 +466,7 @@ static void LabelframeDoLayout(void *recordPtr) static void LabelframeDisplay(void *recordPtr, Drawable d) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; Ttk_DrawLayout(lframePtr->core.layout, lframePtr->core.state, d); if (lframePtr->label.labelLayout) { Ttk_DrawLayout(lframePtr->label.labelLayout, lframePtr->core.state, d); @@ -476,7 +481,7 @@ static void LabelframeDisplay(void *recordPtr, Drawable d) */ static void LabelframePlaceSlaves(void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; if (Ttk_NumberSlaves(lframe->label.mgr) == 1) { Ttk_Box b; @@ -489,6 +494,11 @@ static void LabelframePlaceSlaves(void *recordPtr) static int LabelRequest(void *managerData, int index, int width, int height) { + (void)managerData; + (void)index; + (void)width; + (void)height; + return 1; } @@ -501,7 +511,9 @@ static int LabelRequest(void *managerData, int index, int width, int height) */ static void LabelRemoved(void *managerData, int slaveIndex) { - Labelframe *lframe = managerData; + Labelframe *lframe = (Labelframe *)managerData; + (void)slaveIndex; + lframe->label.labelWidget = 0; } @@ -516,9 +528,10 @@ static Ttk_ManagerSpec LabelframeManagerSpec = { /* LabelframeInitialize -- * Initialization hook. */ -static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) +static void LabelframeInitialize(Tcl_Interp *dummy, void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; + (void)dummy; lframe->label.mgr = Ttk_CreateManager( &LabelframeManagerSpec, lframe, lframe->core.tkwin); @@ -532,7 +545,7 @@ static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) */ static void LabelframeCleanup(void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; Ttk_DeleteManager(lframe->label.mgr); if (lframe->label.labelLayout) { Ttk_FreeLayout(lframe->label.labelLayout); @@ -563,7 +576,7 @@ static void RaiseLabelWidget(Labelframe *lframe) */ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; Tk_Window labelWidget = lframePtr->label.labelWidget; Ttk_PositionSpec unused; diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index 002a753..e924fd1 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -31,9 +31,17 @@ struct TtkImageSpec { /* NullImageChanged -- * Do-nothing Tk_ImageChangedProc. */ -static void NullImageChanged(ClientData clientData, +static void NullImageChanged(ClientData dummy, int x, int y, int width, int height, int imageWidth, int imageHeight) -{ /* No-op */ } +{ /* No-op */ + (void)dummy; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imageWidth; + (void)imageHeight; +} /* ImageSpecImageChanged -- * Image changes should trigger a repaint. @@ -74,7 +82,7 @@ TtkGetImageSpecEx(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int i = 0, n = 0, objc; Tcl_Obj **objv; - imageSpec = ckalloc(sizeof(*imageSpec)); + imageSpec = (Ttk_ImageSpec *)ckalloc(sizeof(*imageSpec)); imageSpec->baseImage = 0; imageSpec->mapCount = 0; imageSpec->states = 0; @@ -97,8 +105,8 @@ TtkGetImageSpecEx(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, } n = (objc - 1) / 2; - imageSpec->states = ckalloc(n * sizeof(Ttk_StateSpec)); - imageSpec->images = ckalloc(n * sizeof(Tk_Image *)); + imageSpec->states = (Ttk_StateSpec *)ckalloc(n * sizeof(Ttk_StateSpec)); + imageSpec->images = (Tk_Image *)ckalloc(n * sizeof(Tk_Image)); /* Get base image: */ @@ -205,6 +213,7 @@ static void Ttk_Fill( int dr = dst.x + dst.width; int db = dst.y + dst.height; int x,y; + (void)tkwin; if (!(src.width && src.height && dst.width && dst.height)) return; @@ -262,7 +271,7 @@ typedef struct { /* ClientData for image elements */ static void FreeImageData(void *clientData) { - ImageData *imageData = clientData; + ImageData *imageData = (ImageData *)clientData; if (imageData->imageSpec) { TtkFreeImageSpec(imageData->imageSpec); } #if TILE_07_COMPAT if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); } @@ -274,8 +283,10 @@ static void ImageElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ImageData *imageData = clientData; + ImageData *imageData = (ImageData *)clientData; Tk_Image image = imageData->imageSpec->baseImage; + (void)elementRecord; + (void)tkwin; if (image) { Tk_SizeOfImage(image, widthPtr, heightPtr); @@ -294,10 +305,11 @@ static void ImageElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ImageData *imageData = clientData; + ImageData *imageData = (ImageData *)clientData; Tk_Image image = 0; int imgWidth, imgHeight; Ttk_Box src, dst; + (void)elementRecord; #if TILE_07_COMPAT if (imageData->imageMap) { @@ -339,7 +351,7 @@ static Ttk_ElementSpec ImageElementSpec = static int Ttk_CreateImageElement( Tcl_Interp *interp, - void *clientData, + void *dummy, Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *const objv[]) @@ -352,6 +364,7 @@ Ttk_CreateImageElement( ImageData *imageData = 0; int padding_specified = 0; int i; + (void)dummy; if (objc <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -365,7 +378,7 @@ Ttk_CreateImageElement( return TCL_ERROR; } - imageData = ckalloc(sizeof(*imageData)); + imageData = (ImageData *)ckalloc(sizeof(*imageData)); imageData->imageSpec = imageSpec; imageData->minWidth = imageData->minHeight = -1; imageData->sticky = TTK_FILL_BOTH; diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index 63df71d..5e20a83 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -50,11 +50,11 @@ const char *ttkOrientStrings[] = { }; int Ttk_GetOrientFromObj( - Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr) + Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *resultPtr) { *resultPtr = TTK_ORIENT_HORIZONTAL; return Tcl_GetIndexFromObjStruct(interp, objPtr, ttkOrientStrings, - sizeof(char *), "orientation", 0, resultPtr); + sizeof(char *), "orientation", 0, (int *)resultPtr); } /* @@ -114,7 +114,7 @@ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr) */ void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName) { - union {XEvent general; XVirtualEvent virtual;} event; + union {XEvent general; XVirtualEvent virt;} event; memset(&event, 0, sizeof(event)); event.general.xany.type = VirtualEvent; @@ -122,7 +122,7 @@ void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName) event.general.xany.send_event = False; event.general.xany.window = Tk_WindowId(tgtWin); event.general.xany.display = Tk_Display(tgtWin); - event.virtual.name = Tk_GetUid(eventName); + event.virt.name = Tk_GetUid(eventName); Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } @@ -148,7 +148,7 @@ int TtkEnumerateOptions( if (specPtr->type == TK_OPTION_END && specPtr->clientData != NULL) { /* Chain to next option spec array: */ - specPtr = specPtr->clientData; + specPtr = (const Tk_OptionSpec *)specPtr->clientData; } } Tcl_SetObjResult(interp, result); diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 2367f99..1004e12 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -65,7 +65,7 @@ static Ttk_ElementOptionSpec TextElementOptions[] = { offsetof(TextElement,wrapLengthObj), "0" }, { "-embossed", TK_OPTION_INT, offsetof(TextElement,embossedObj), "0"}, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static int TextSetup(TextElement *text, Tk_Window tkwin) @@ -193,10 +193,12 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) } static void TextElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TextElement *text = elementRecord; + TextElement *text = (TextElement *)elementRecord; + (void)dummy; + (void)paddingPtr; if (!TextSetup(text, tkwin)) return; @@ -210,10 +212,13 @@ static void TextElementSize( } static void TextElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - TextElement *text = elementRecord; + TextElement *text = (TextElement *)elementRecord; + (void)dummy; + (void)state; + if (TextSetup(text, tkwin)) { TextDraw(text, tkwin, d, b); TextCleanup(text); @@ -253,7 +258,7 @@ static Ttk_ElementOptionSpec ImageElementOptions[] = { offsetof(ImageElement,stippleObj), "gray50" }, { "-background", TK_OPTION_COLOR, offsetof(ImageElement,backgroundObj), DEFAULT_BACKGROUND }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* @@ -360,10 +365,12 @@ static void ImageDraw( } static void ImageElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ImageElement *image = elementRecord; + ImageElement *image = (ImageElement *)elementRecord; + (void)dummy; + (void)paddingPtr; if (ImageSetup(image, tkwin, 0)) { *widthPtr = image->width; @@ -373,10 +380,11 @@ static void ImageElementSize( } static void ImageElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - ImageElement *image = elementRecord; + ImageElement *image = (ImageElement *)elementRecord; + (void)dummy; if (ImageSetup(image, tkwin, state)) { ImageDraw(image, tkwin, d, b, state); @@ -477,7 +485,7 @@ static Ttk_ElementOptionSpec LabelElementOptions[] = { offsetof(LabelElement,image.stippleObj), "gray50" }, { "-background", TK_OPTION_COLOR, offsetof(LabelElement,image.backgroundObj), DEFAULT_BACKGROUND }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* @@ -561,11 +569,13 @@ static void LabelCleanup(LabelElement *c) } static void LabelElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - LabelElement *label = elementRecord; + LabelElement *label = (LabelElement *)elementRecord; int textReqWidth = 0; + (void)dummy; + (void)paddingPtr; LabelSetup(label, tkwin, 0); @@ -607,7 +617,7 @@ static void LabelElementSize( */ static void DrawCompound( LabelElement *l, Ttk_Box b, Tk_Window tkwin, Drawable d, Ttk_State state, - int imageSide, int textSide) + Ttk_Side imageSide, Ttk_Side textSide) { Ttk_Box imageBox = Ttk_PlaceBox(&b, l->image.width, l->image.height, imageSide, 0); @@ -618,11 +628,12 @@ static void DrawCompound( } static void LabelElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - LabelElement *l = elementRecord; + LabelElement *l = (LabelElement *)elementRecord; Tk_Anchor anchor = TK_ANCHOR_CENTER; + (void)dummy; LabelSetup(l, tkwin, state); diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index 795ffb5..5e8c69c 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -524,7 +524,7 @@ struct Ttk_LayoutNode_ static Ttk_LayoutNode *Ttk_NewLayoutNode( unsigned flags, Ttk_ElementClass *elementClass) { - Ttk_LayoutNode *node = ckalloc(sizeof(*node)); + Ttk_LayoutNode *node = (Ttk_LayoutNode *)ckalloc(sizeof(*node)); node->flags = flags; node->eclass = elementClass; @@ -557,8 +557,8 @@ struct Ttk_TemplateNode_ { static Ttk_TemplateNode *Ttk_NewTemplateNode(const char *name, unsigned flags) { - Ttk_TemplateNode *op = ckalloc(sizeof(*op)); - op->name = ckalloc(strlen(name) + 1); strcpy(op->name, name); + Ttk_TemplateNode *op = (Ttk_TemplateNode *)ckalloc(sizeof(*op)); + op->name = (char *)ckalloc(strlen(name) + 1); strcpy(op->name, name); op->flags = flags; op->next = op->child = 0; return op; @@ -843,7 +843,7 @@ static Ttk_Layout TTKNewLayout( void *recordPtr,Tk_OptionTable optionTable, Tk_Window tkwin, Ttk_LayoutNode *root) { - Ttk_Layout layout = ckalloc(sizeof(*layout)); + Ttk_Layout layout = (Ttk_Layout)ckalloc(sizeof(*layout)); layout->style = style; layout->recordPtr = recordPtr; layout->optionTable = optionTable; diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index bf93699..3390805 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -115,7 +115,7 @@ static void RecomputeLayout(Ttk_Manager *mgr) */ static void ManagerIdleProc(ClientData clientData) { - Ttk_Manager *mgr = clientData; + Ttk_Manager *mgr = (Ttk_Manager *)clientData; mgr->flags &= ~MGR_UPDATE_PENDING; if (mgr->flags & MGR_RESIZE_REQUIRED) { @@ -141,7 +141,7 @@ static void ManagerIdleProc(ClientData clientData) static const int ManagerEventMask = StructureNotifyMask; static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) { - Ttk_Manager *mgr = clientData; + Ttk_Manager *mgr = (Ttk_Manager *)clientData; int i; switch (eventPtr->type) @@ -173,7 +173,7 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) static const unsigned SlaveEventMask = StructureNotifyMask; static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) { - Ttk_Slave *slave = clientData; + Ttk_Slave *slave = (Ttk_Slave *)clientData; if (eventPtr->type == DestroyNotify) { slave->manager->managerSpec->tkGeomMgr.lostSlaveProc( slave->manager, slave->slaveWindow); @@ -187,7 +187,7 @@ static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) static Ttk_Slave *NewSlave( Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData) { - Ttk_Slave *slave = ckalloc(sizeof(*slave)); + Ttk_Slave *slave = (Ttk_Slave *)ckalloc(sizeof(*slave)); slave->slaveWindow = slaveWindow; slave->manager = mgr; @@ -209,7 +209,7 @@ static void DeleteSlave(Ttk_Slave *slave) Ttk_Manager *Ttk_CreateManager( Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow) { - Ttk_Manager *mgr = ckalloc(sizeof(*mgr)); + Ttk_Manager *mgr = (Ttk_Manager *)ckalloc(sizeof(*mgr)); mgr->managerSpec = managerSpec; mgr->managerData = managerData; @@ -251,7 +251,7 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, int index) { int endIndex = mgr->nSlaves++; - mgr->slaves = ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *)); + mgr->slaves = (Ttk_Slave **)ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *)); while (endIndex > index) { mgr->slaves[endIndex] = mgr->slaves[endIndex - 1]; @@ -313,7 +313,7 @@ static void RemoveSlave(Ttk_Manager *mgr, int index) void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow) { - Ttk_Manager *mgr = clientData; + Ttk_Manager *mgr = (Ttk_Manager *)clientData; int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow); int reqWidth = Tk_ReqWidth(slaveWindow); int reqHeight= Tk_ReqHeight(slaveWindow); @@ -327,7 +327,7 @@ void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow) void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow) { - Ttk_Manager *mgr = clientData; + Ttk_Manager *mgr = (Ttk_Manager *)clientData; int index = Ttk_SlaveIndex(mgr, slaveWindow); /* ASSERT: index >= 0 */ diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index e167374..7997f3c 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -190,7 +190,7 @@ static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle) static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window slaveWindow) { Tk_OptionTable optionTable = nb->notebook.paneOptionTable; - void *record = ckalloc(sizeof(Tab)); + Tab *record = (Tab *)ckalloc(sizeof(Tab)); memset(record, 0, sizeof(Tab)); if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { @@ -258,7 +258,7 @@ static int IdentifyTab(Notebook *nb, int x, int y) { int index; for (index = 0; index < Ttk_NumberSlaves(nb->notebook.mgr); ++index) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,index); if ( tab->state != TAB_STATE_HIDDEN && Ttk_BoxContains(tab->parcel, x,y)) { @@ -290,7 +290,7 @@ static void ActivateTab(Notebook *nb, int index) static Ttk_State TabState(Notebook *nb, int index) { Ttk_State state = nb->core.state; - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); int i = 0; if (index == nb->notebook.currentIndex) { @@ -303,7 +303,7 @@ static Ttk_State TabState(Notebook *nb, int index) state |= TTK_STATE_ACTIVE; } for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } @@ -313,7 +313,7 @@ static Ttk_State TabState(Notebook *nb, int index) break; } for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i >= 0; --i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } @@ -354,7 +354,7 @@ static void TabrowSize( int i; for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb,i); Ttk_RebindSublayout(tabLayout, tab); @@ -384,7 +384,7 @@ static void TabrowSize( static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; NotebookStyle nbstyle; Ttk_Padding padding; Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client"); @@ -399,7 +399,7 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) */ for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, i); - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); int slaveWidth = Tk_ReqWidth(slaveWindow) + Ttk_PaddingWidth(tab->padding); int slaveHeight @@ -470,7 +470,7 @@ static void SqueezeTabs( int i; for (i = 0; i < nTabs; ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr,i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,i); double ad = slack + tab->width * delta; tab->width += (int)ad; slack = ad - (int)ad; @@ -489,7 +489,7 @@ static void PlaceTabs( int i; for (i = 0; i < nTabs; ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb, i); if (tab->state != TAB_STATE_HIDDEN) { @@ -517,7 +517,7 @@ static void PlaceTabs( */ static void NotebookDoLayout(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Tk_Window nbwin = nb->core.tkwin; Ttk_Box cavity = Ttk_WinBox(nbwin); int tabrowWidth = 0, tabrowHeight = 0; @@ -573,7 +573,7 @@ static void NotebookDoLayout(void *recordPtr) */ static void NotebookPlaceSlave(Notebook *nb, int slaveIndex) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, slaveIndex); Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, slaveIndex); Ttk_Box slaveBox = Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding), @@ -588,7 +588,7 @@ static void NotebookPlaceSlave(Notebook *nb, int slaveIndex) */ static void NotebookPlaceSlaves(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int currentIndex = nb->notebook.currentIndex; if (currentIndex >= 0) { NotebookDoLayout(nb); @@ -602,7 +602,7 @@ static void NotebookPlaceSlaves(void *recordPtr) */ static void SelectTab(Notebook *nb, int index) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,index); int currentIndex = nb->notebook.currentIndex; if (index == currentIndex) { @@ -647,7 +647,7 @@ static int NextTab(Notebook *nb, int index) /* Scan forward for following usable tab: */ for (nextIndex = index + 1; nextIndex < nTabs; ++nextIndex) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } @@ -656,7 +656,7 @@ static int NextTab(Notebook *nb, int index) /* Not found -- scan backwards. */ for (nextIndex = index - 1; nextIndex >= 0; --nextIndex) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } @@ -697,8 +697,8 @@ static void SelectNearestTab(Notebook *nb) */ static void TabRemoved(void *managerData, int index) { - Notebook *nb = managerData; - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + Notebook *nb = (Notebook *)managerData; + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -715,6 +715,11 @@ static void TabRemoved(void *managerData, int index) static int TabRequest(void *managerData, int index, int width, int height) { + (void)managerData; + (void)index; + (void)width; + (void)height; + return 1; } @@ -785,7 +790,7 @@ static const int NotebookEventMask ; static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; if (eventPtr->type == DestroyNotify) { /* Remove self */ Tk_DeleteEventHandler(nb->core.tkwin, @@ -881,7 +886,7 @@ static int GetTabIndex( static int NotebookAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index = Ttk_NumberSlaves(nb->notebook.mgr); Tk_Window slaveWindow; int slaveIndex; @@ -902,7 +907,7 @@ static int NotebookAddCommand( return AddTab(interp, nb, index, slaveWindow, objc-3,objv+3); } - tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex); + tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, slaveIndex); if (tab->state == TAB_STATE_HIDDEN) { tab->state = TAB_STATE_NORMAL; } @@ -921,7 +926,7 @@ static int NotebookAddCommand( static int NotebookInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int current = nb->notebook.currentIndex; int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); int srcIndex, destIndex; @@ -961,7 +966,7 @@ static int NotebookInsertCommand( /* Move existing slave: */ if (ConfigureTab(interp, nb, - Ttk_SlaveData(nb->notebook.mgr,srcIndex), + (Tab *)Ttk_SlaveData(nb->notebook.mgr,srcIndex), Ttk_SlaveWindow(nb->notebook.mgr,srcIndex), objc-4,objv+4) != TCL_OK) { @@ -995,7 +1000,7 @@ static int NotebookInsertCommand( static int NotebookForgetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index; if (objc != 3) { @@ -1019,7 +1024,7 @@ static int NotebookForgetCommand( static int NotebookHideCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index; Tab *tab; @@ -1032,7 +1037,7 @@ static int NotebookHideCommand( return TCL_ERROR; } - tab = Ttk_SlaveData(nb->notebook.mgr, index); + tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); tab->state = TAB_STATE_HIDDEN; if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -1052,7 +1057,7 @@ static int NotebookIdentifyCommand( static const char *const whatTable[] = { "element", "tab", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_TAB }; int what = IDENTIFY_ELEMENT; - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Element element = NULL; int x, y, tabIndex; @@ -1071,7 +1076,7 @@ static int NotebookIdentifyCommand( tabIndex = IdentifyTab(nb, x, y); if (tabIndex >= 0) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, tabIndex); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, tabIndex); Ttk_State state = TabState(nb, tabIndex); Ttk_Layout tabLayout = nb->notebook.tabLayout; @@ -1106,7 +1111,7 @@ static int NotebookIdentifyCommand( static int NotebookIndexCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index, status; if (objc != 3) { @@ -1138,7 +1143,7 @@ static int NotebookIndexCommand( static int NotebookSelectCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; if (objc == 2) { if (nb->notebook.currentIndex >= 0) { @@ -1164,7 +1169,7 @@ static int NotebookSelectCommand( static int NotebookTabsCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; Tcl_Obj *result; int i; @@ -1189,7 +1194,7 @@ static int NotebookTabsCommand( static int NotebookTabCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; int index; Tk_Window slaveWindow; @@ -1204,7 +1209,7 @@ static int NotebookTabCommand( return TCL_ERROR; } - tab = Ttk_SlaveData(mgr, index); + tab = (Tab *)Ttk_SlaveData(mgr, index); slaveWindow = Ttk_SlaveWindow(mgr, index); if (objc == 3) { @@ -1254,7 +1259,7 @@ static const Ttk_Ensemble NotebookCommands[] = { static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; nb->notebook.mgr = Ttk_CreateManager( &NotebookManagerSpec, recordPtr, nb->core.tkwin); @@ -1274,7 +1279,7 @@ static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr) static void NotebookCleanup(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_DeleteManager(nb->notebook.mgr); if (nb->notebook.tabLayout) @@ -1283,7 +1288,7 @@ static void NotebookCleanup(void *recordPtr) static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; /* * Error-checks: @@ -1307,7 +1312,7 @@ static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask) static Ttk_Layout NotebookGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Layout notebookLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout tabLayout; @@ -1335,7 +1340,7 @@ static Ttk_Layout NotebookGetLayout( static void DisplayTab(Notebook *nb, int index, Drawable d) { Ttk_Layout tabLayout = nb->notebook.tabLayout; - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); Ttk_State state = TabState(nb, index); if (tab->state != TAB_STATE_HIDDEN) { @@ -1347,7 +1352,7 @@ static void DisplayTab(Notebook *nb, int index, Drawable d) static void NotebookDisplay(void *clientData, Drawable d) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); int index; diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 1b6ff3d..544e0cc 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -111,7 +111,7 @@ static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window slaveWindow) { Tk_OptionTable optionTable = pw->paned.paneOptionTable; void *record = ckalloc(sizeof(Pane)); - Pane *pane = record; + Pane *pane = (Pane *)record; memset(record, 0, sizeof(Pane)); if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { @@ -188,14 +188,14 @@ error: static int ShoveUp(Paned *pw, int i, int pos) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, i); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, i); int sashThickness = pw->paned.sashThickness; if (i == 0) { if (pos < 0) pos = 0; } else { - Pane *prevPane = Ttk_SlaveData(pw->paned.mgr, i-1); + Pane *prevPane = (Pane *)Ttk_SlaveData(pw->paned.mgr, i-1); if (pos < prevPane->sashPos + sashThickness) pos = ShoveUp(pw, i-1, pos - sashThickness) + sashThickness; } @@ -208,13 +208,13 @@ static int ShoveUp(Paned *pw, int i, int pos) */ static int ShoveDown(Paned *pw, int i, int pos) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr,i); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i); int sashThickness = pw->paned.sashThickness; if (i == Ttk_NumberSlaves(pw->paned.mgr) - 1) { pos = pane->sashPos; /* Sentinel value == master window size */ } else { - Pane *nextPane = Ttk_SlaveData(pw->paned.mgr,i+1); + Pane *nextPane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i+1); if (pos + sashThickness > nextPane->sashPos) pos = ShoveDown(pw, i+1, pos + sashThickness) - sashThickness; } @@ -229,7 +229,7 @@ static int ShoveDown(Paned *pw, int i, int pos) */ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int nPanes = Ttk_NumberSlaves(pw->paned.mgr); int nSashes = nPanes - 1; int sashThickness = pw->paned.sashThickness; @@ -238,7 +238,7 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) if (pw->paned.orient == TTK_ORIENT_HORIZONTAL) { for (index = 0; index < nPanes; ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); if (height < Tk_ReqHeight(slaveWindow)) @@ -248,7 +248,7 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) width += nSashes * sashThickness; } else { for (index = 0; index < nPanes; ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); if (width < Tk_ReqWidth(slaveWindow)) @@ -278,7 +278,7 @@ static void AdjustPanes(Paned *pw) int index; for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); int size = pane->sashPos - pos; pane->reqSize = size >= 0 ? size : 0; pos = pane->sashPos + sashThickness; @@ -316,7 +316,7 @@ static void PlaceSashes(Paned *pw, int width, int height) /* Compute total required size and total available weight: */ for (i = 0; i < nPanes; ++i) { - Pane *pane = Ttk_SlaveData(mgr, i); + Pane *pane = (Pane *)Ttk_SlaveData(mgr, i); reqSize += pane->reqSize; totalWeight += pane->weight * (pane->reqSize != 0); } @@ -340,7 +340,7 @@ static void PlaceSashes(Paned *pw, int width, int height) */ pos = 0; for (i = 0; i < nPanes; ++i) { - Pane *pane = Ttk_SlaveData(mgr, i); + Pane *pane = (Pane *)Ttk_SlaveData(mgr, i); int weight = pane->weight * (pane->reqSize != 0); int size = pane->reqSize + delta * weight; @@ -375,7 +375,7 @@ static void PlacePanes(Paned *pw) int index; for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); int size = pane->sashPos - pos; if (size > 0) { @@ -398,15 +398,15 @@ static void PlacePanes(Paned *pw) static void PanedPlaceSlaves(void *managerData) { - Paned *pw = managerData; + Paned *pw = (Paned *)managerData; PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin)); PlacePanes(pw); } static void PaneRemoved(void *managerData, int index) { - Paned *pw = managerData; - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Paned *pw = (Paned *)managerData; + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); DestroyPane(pw, pane); } @@ -447,8 +447,8 @@ static int AddPane( */ static int PaneRequest(void *managerData, int index, int width, int height) { - Paned *pw = managerData; - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Paned *pw = (Paned *)managerData; + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; @@ -482,7 +482,7 @@ static Ttk_ManagerSpec PanedManagerSpec = { static const unsigned PanedEventMask = LeaveWindowMask; static void PanedEventProc(ClientData clientData, XEvent *eventPtr) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; if ( eventPtr->type == LeaveNotify && eventPtr->xcrossing.detail == NotifyInferior) { @@ -496,7 +496,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr) static void PanedInitialize(Tcl_Interp *interp, void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Tk_CreateEventHandler(pw->core.tkwin, PanedEventMask, PanedEventProc, recordPtr); @@ -508,7 +508,7 @@ static void PanedInitialize(Tcl_Interp *interp, void *recordPtr) static void PanedCleanup(void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; if (pw->paned.sashLayout) Ttk_FreeLayout(pw->paned.sashLayout); @@ -519,9 +519,10 @@ static void PanedCleanup(void *recordPtr) /* Post-configuration hook. */ -static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask) +static int PanedPostConfigure(Tcl_Interp *dummy, void *clientData, int mask) { - Paned *pw = clientData; + Paned *pw = (Paned *)clientData; + (void)dummy; if (mask & GEOMETRY_CHANGED) { /* User has changed -width or -height. @@ -542,7 +543,7 @@ static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask) static Ttk_Layout PanedGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); if (panedLayout) { @@ -580,7 +581,7 @@ static Ttk_Layout PanedGetLayout( */ static Ttk_Layout SashLayout(Paned *pw, int index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); int thickness = pw->paned.sashThickness, height = Tk_Height(pw->core.tkwin), width = Tk_Width(pw->core.tkwin), @@ -602,7 +603,7 @@ static void DrawSash(Paned *pw, int index, Drawable d) static void PanedDisplay(void *recordPtr, Drawable d) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int i, nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1; TtkWidgetDisplay(recordPtr, d); @@ -620,7 +621,7 @@ static void PanedDisplay(void *recordPtr, Drawable d) static int PanedAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Tk_Window slaveWindow; if (objc < 3) { @@ -645,7 +646,7 @@ static int PanedAddCommand( static int PanedInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int nSlaves = Ttk_NumberSlaves(pw->paned.mgr); int srcIndex, destIndex; Tk_Window slaveWindow; @@ -680,7 +681,7 @@ static int PanedInsertCommand( return objc == 4 ? TCL_OK : ConfigurePane(interp, pw, - Ttk_SlaveData(pw->paned.mgr, destIndex), + (Pane *)Ttk_SlaveData(pw->paned.mgr, destIndex), Ttk_SlaveWindow(pw->paned.mgr, destIndex), objc-4,objv+4); } @@ -690,7 +691,7 @@ static int PanedInsertCommand( static int PanedForgetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int paneIndex; if (objc != 3) { @@ -717,7 +718,7 @@ static int PanedIdentifyCommand( static const char *const whatTable[] = { "element", "sash", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_SASH }; int what = IDENTIFY_SASH; - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int sashThickness = pw->paned.sashThickness; int nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1; int x, y, pos; @@ -738,7 +739,7 @@ static int PanedIdentifyCommand( pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y; for (index = 0; index < nSashes; ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) { /* Found it. */ switch (what) { @@ -768,7 +769,7 @@ static int PanedIdentifyCommand( static int PanedPaneCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int paneIndex; Tk_Window slaveWindow; Pane *pane; @@ -784,7 +785,7 @@ static int PanedPaneCommand( return TCL_ERROR; } - pane = Ttk_SlaveData(pw->paned.mgr, paneIndex); + pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, paneIndex); slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, paneIndex); switch (objc) { @@ -805,7 +806,7 @@ static int PanedPaneCommand( static int PanedPanesCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Ttk_Manager *mgr = pw->paned.mgr; Tcl_Obj *panes; int i; @@ -832,7 +833,7 @@ static int PanedPanesCommand( static int PanedSashposCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int sashIndex, position = -1; Pane *pane; @@ -850,7 +851,7 @@ static int PanedSashposCommand( return TCL_ERROR; } - pane = Ttk_SlaveData(pw->paned.mgr, sashIndex); + pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, sashIndex); if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos)); @@ -923,15 +924,19 @@ typedef struct { static Ttk_ElementOptionSpec SashElementOptions[] = { { "-sashthickness", TK_OPTION_INT, offsetof(SashElement,thicknessObj), "5" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SashElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - SashElement *sash = elementRecord; + SashElement *sash = (SashElement *)elementRecord; int thickness = DEFAULT_SASH_THICKNESS; + (void)dummy; + (void)tkwin; + (void)paddingPtr; + Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness); *widthPtr = *heightPtr = thickness; } diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index f1dbb2f..a288c41 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -122,7 +122,7 @@ static int AnimationEnabled(Progressbar *pb) */ static void AnimateProgressProc(ClientData clientData) { - Progressbar *pb = clientData; + Progressbar *pb = (Progressbar *)clientData; pb->progress.timer = 0; @@ -175,7 +175,7 @@ static void CheckAnimation(Progressbar *pb) static void VariableChanged(void *recordPtr, const char *value) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; Tcl_Obj *newValue; double scratch; @@ -208,16 +208,18 @@ static void VariableChanged(void *recordPtr, const char *value) * +++ Widget class methods: */ -static void ProgressbarInitialize(Tcl_Interp *interp, void *recordPtr) +static void ProgressbarInitialize(Tcl_Interp *dummy, void *recordPtr) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; + (void)dummy; + pb->progress.variableTrace = 0; pb->progress.timer = 0; } static void ProgressbarCleanup(void *recordPtr) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; if (pb->progress.variableTrace) Ttk_UntraceVariable(pb->progress.variableTrace); if (pb->progress.timer) @@ -231,7 +233,7 @@ static void ProgressbarCleanup(void *recordPtr) */ static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; Tcl_Obj *varName = pb->progress.variableObj; Ttk_TraceHandle *vt = 0; @@ -257,10 +259,12 @@ static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask) * Post-configuration hook: */ static int ProgressbarPostConfigure( - Tcl_Interp *interp, void *recordPtr, int mask) + Tcl_Interp *dummy, void *recordPtr, int mask) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; int status = TCL_OK; + (void)dummy; + (void)mask; if (pb->progress.variableTrace) { status = Ttk_FireTrace(pb->progress.variableTrace); @@ -288,8 +292,9 @@ static int ProgressbarPostConfigure( */ static int ProgressbarSize(void *recordPtr, int *widthPtr, int *heightPtr) { - Progressbar *pb = recordPtr; - int length = 100, orient = TTK_ORIENT_HORIZONTAL; + Progressbar *pb = (Progressbar *)recordPtr; + int length = 100; + Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; TtkWidgetSize(recordPtr, widthPtr, heightPtr); @@ -356,11 +361,11 @@ static void ProgressbarIndeterminateLayout( static void ProgressbarDoLayout(void *recordPtr) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; WidgetCore *corePtr = &pb->core; Ttk_Element pbar = Ttk_FindElement(corePtr->layout, "pbar"); double value = 0.0, maximum = 100.0; - int orient = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); @@ -388,7 +393,7 @@ static void ProgressbarDoLayout(void *recordPtr) static Ttk_Layout ProgressbarGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; Ttk_Layout layout = TtkWidgetGetOrientedLayout( interp, theme, recordPtr, pb->progress.orientObj); @@ -418,7 +423,7 @@ static Ttk_Layout ProgressbarGetLayout( static int ProgressbarStepCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; double value = 0.0, stepAmount = 1.0; Tcl_Obj *newValueObj; @@ -494,6 +499,8 @@ static int ProgressbarStartStopCommand( static int ProgressbarStartCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { + (void)recordPtr; + return ProgressbarStartStopCommand( interp, "::ttk::progressbar::start", objc, objv); } @@ -501,6 +508,8 @@ static int ProgressbarStartCommand( static int ProgressbarStopCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { + (void)recordPtr; + return ProgressbarStartStopCommand( interp, "::ttk::progressbar::stop", objc, objv); } diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index 0e20621..b02faa8 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -92,7 +92,7 @@ static double PointToValue(Scale *scalePtr, int x, int y); */ static void ScaleVariableChanged(void *recordPtr, const char *value) { - Scale *scale = recordPtr; + Scale *scale = (Scale *)recordPtr; double v; if (value == NULL || Tcl_GetDouble(0, value, &v) != TCL_OK) { @@ -110,15 +110,17 @@ static void ScaleVariableChanged(void *recordPtr, const char *value) /* ScaleInitialize -- * Scale widget initialization hook. */ -static void ScaleInitialize(Tcl_Interp *interp, void *recordPtr) +static void ScaleInitialize(Tcl_Interp *dummy, void *recordPtr) { - Scale *scalePtr = recordPtr; + Scale *scalePtr = (Scale *)recordPtr; + (void)dummy; + TtkTrackElementState(&scalePtr->core); } static void ScaleCleanup(void *recordPtr) { - Scale *scale = recordPtr; + Scale *scale = (Scale *)recordPtr; if (scale->scale.variableTrace) { Ttk_UntraceVariable(scale->scale.variableTrace); @@ -131,7 +133,7 @@ static void ScaleCleanup(void *recordPtr) */ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Scale *scale = recordPtr; + Scale *scale = (Scale *)recordPtr; Tcl_Obj *varName = scale->scale.variableObj; Ttk_TraceHandle *vt = 0; @@ -161,10 +163,12 @@ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask) * Post-configuration hook. */ static int ScalePostConfigure( - Tcl_Interp *interp, void *recordPtr, int mask) + Tcl_Interp *dummy, void *recordPtr, int mask) { - Scale *scale = recordPtr; + Scale *scale = (Scale *)recordPtr; int status = TCL_OK; + (void)dummy; + (void)mask; if (scale->scale.variableTrace) { status = Ttk_FireTrace(scale->scale.variableTrace); @@ -190,7 +194,7 @@ static int ScalePostConfigure( static Ttk_Layout ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Scale *scalePtr = recordPtr; + Scale *scalePtr = (Scale *)recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, scalePtr->scale.orientObj); } @@ -258,7 +262,7 @@ static int ScaleGetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scale *scalePtr = recordPtr; + Scale *scalePtr = (Scale *)recordPtr; int x, y, r = TCL_OK; double value = 0; @@ -286,7 +290,7 @@ static int ScaleSetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scale *scalePtr = recordPtr; + Scale *scalePtr = (Scale *)recordPtr; double from = 0.0, to = 1.0, value; int result = TCL_OK; @@ -354,7 +358,7 @@ static int ScaleCoordsCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scale *scalePtr = recordPtr; + Scale *scalePtr = (Scale *)recordPtr; double value; int r = TCL_OK; @@ -381,7 +385,7 @@ ScaleCoordsCommand( static void ScaleDoLayout(void *clientData) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; Ttk_Element slider = Ttk_FindElement(corePtr->layout, "slider"); Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); @@ -389,7 +393,7 @@ static void ScaleDoLayout(void *clientData) /* Adjust the slider position: */ if (slider) { - Scale *scalePtr = clientData; + Scale *scalePtr = (Scale *)clientData; Ttk_Box troughBox = TroughBox(scalePtr); Ttk_Box sliderBox = Ttk_ElementParcel(slider); double value = 0.0; @@ -416,8 +420,8 @@ static void ScaleDoLayout(void *clientData) */ static int ScaleSize(void *clientData, int *widthPtr, int *heightPtr) { - WidgetCore *corePtr = clientData; - Scale *scalePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; + Scale *scalePtr = (Scale *)clientData; int length; Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr); diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index 47db6ac..a351d91 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -55,7 +55,7 @@ struct ScrollHandleRec */ ScrollHandle TtkCreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr) { - ScrollHandle h = ckalloc(sizeof(*h)); + ScrollHandle h = (ScrollHandle)ckalloc(sizeof(*h)); h->flags = 0; h->corePtr = corePtr; diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 2825c54..e5b33af 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -50,9 +50,11 @@ static Tk_OptionSpec ScrollbarOptionSpecs[] = */ static void -ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) +ScrollbarInitialize(Tcl_Interp *dummy, void *recordPtr) { - Scrollbar *sb = recordPtr; + Scrollbar *sb = (Scrollbar *)recordPtr; + (void)dummy; + sb->scrollbar.first = 0.0; sb->scrollbar.last = 1.0; @@ -62,7 +64,7 @@ ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) static Ttk_Layout ScrollbarGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Scrollbar *sb = recordPtr; + Scrollbar *sb = (Scrollbar *)recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, sb->scrollbar.orientObj); } @@ -76,7 +78,7 @@ static Ttk_Layout ScrollbarGetLayout( */ static void ScrollbarDoLayout(void *recordPtr) { - Scrollbar *sb = recordPtr; + Scrollbar *sb = (Scrollbar *)recordPtr; WidgetCore *corePtr = &sb->core; Ttk_Element thumb; Ttk_Box thumbBox; @@ -132,7 +134,7 @@ static int ScrollbarSetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scrollbar *scrollbar = recordPtr; + Scrollbar *scrollbar = (Scrollbar *)recordPtr; Tcl_Obj *firstObj, *lastObj; double first, last; @@ -183,7 +185,7 @@ static int ScrollbarGetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scrollbar *scrollbar = recordPtr; + Scrollbar *scrollbar = (Scrollbar *)recordPtr; Tcl_Obj *result[2]; if (objc != 2) { @@ -206,7 +208,7 @@ static int ScrollbarDeltaCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scrollbar *sb = recordPtr; + Scrollbar *sb = (Scrollbar *)recordPtr; double dx, dy; double delta = 0.0; @@ -246,7 +248,7 @@ static int ScrollbarFractionCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scrollbar *sb = recordPtr; + Scrollbar *sb = (Scrollbar *)recordPtr; Ttk_Box b = sb->scrollbar.troughBox; int minSize = sb->scrollbar.minSize; double x, y; diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c index f7bacdc..2ddf0e7 100644 --- a/generic/ttk/ttkSeparator.c +++ b/generic/ttk/ttkSeparator.c @@ -39,7 +39,7 @@ static Tk_OptionSpec SeparatorOptionSpecs[] = { static Ttk_Layout SeparatorGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Separator *sep = recordPtr; + Separator *sep = (Separator *)recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, sep->separator.orientObj); } diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c index b82faa2..4cae06d 100644 --- a/generic/ttk/ttkSquare.c +++ b/generic/ttk/ttkSquare.c @@ -109,7 +109,7 @@ SquareDoLayout(void *clientData) */ if (squareNode) { - Square *squarePtr = clientData; + Square *squarePtr = (Square *)clientData; Tk_Anchor anchor = TK_ANCHOR_CENTER; Ttk_Box b; @@ -188,7 +188,7 @@ static Ttk_ElementOptionSpec SquareElementOptions[] = "raised" }, { "-width", TK_OPTION_PIXELS, offsetof(SquareElement,widthObj), "20"}, { "-height", TK_OPTION_PIXELS, offsetof(SquareElement,heightObj), "20"}, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* @@ -198,11 +198,12 @@ static Ttk_ElementOptionSpec SquareElementOptions[] = */ static void SquareElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - SquareElement *square = elementRecord; + SquareElement *square = (SquareElement *)elementRecord; int borderWidth = 0; + (void)dummy; Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); @@ -215,12 +216,14 @@ static void SquareElementSize( */ static void SquareElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - SquareElement *square = elementRecord; + SquareElement *square = (SquareElement *)elementRecord; Tk_3DBorder foreground = NULL; int borderWidth = 1, relief = TK_RELIEF_FLAT; + (void)dummy; + (void)state; foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj); Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth); diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c index 9e5cf4b..ff73ebe 100644 --- a/generic/ttk/ttkState.c +++ b/generic/ttk/ttkState.c @@ -145,14 +145,14 @@ static void StateSpecUpdateString(Tcl_Obj *objPtr) len = Tcl_DStringLength(&result); if (len) { /* 'len' includes extra trailing ' ' */ - objPtr->bytes = ckalloc(len); + objPtr->bytes = (char *)ckalloc(len); objPtr->length = len-1; strncpy(objPtr->bytes, Tcl_DStringValue(&result), len-1); objPtr->bytes[len-1] = '\0'; } else { /* empty string */ objPtr->length = 0; - objPtr->bytes = ckalloc(1); + objPtr->bytes = (char *)ckalloc(1); *objPtr->bytes = '\0'; } diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c index f0354d8..5ad4d1d 100644 --- a/generic/ttk/ttkTagSet.c +++ b/generic/ttk/ttkTagSet.c @@ -31,7 +31,7 @@ struct TtkTagTable { */ static Ttk_Tag NewTag(Ttk_TagTable tagTable, const char *tagName) { - Ttk_Tag tag = ckalloc(sizeof(*tag)); + Ttk_Tag tag = (Ttk_Tag)ckalloc(sizeof(*tag)); tag->tagRecord = ckalloc(tagTable->recordSize); memset(tag->tagRecord, 0, tagTable->recordSize); /* Don't need Tk_InitOptions() here, all defaults should be NULL. */ @@ -55,7 +55,7 @@ Ttk_TagTable Ttk_CreateTagTable( Tcl_Interp *interp, Tk_Window tkwin, Tk_OptionSpec optionSpecs[], int recordSize) { - Ttk_TagTable tagTable = ckalloc(sizeof(*tagTable)); + Ttk_TagTable tagTable = (Ttk_TagTable)ckalloc(sizeof(*tagTable)); tagTable->tkwin = tkwin; tagTable->optionSpecs = optionSpecs; tagTable->optionTable = Tk_CreateOptionTable(interp, optionSpecs); @@ -72,7 +72,7 @@ void Ttk_DeleteTagTable(Ttk_TagTable tagTable) entryPtr = Tcl_FirstHashEntry(&tagTable->tags, &search); while (entryPtr != NULL) { - DeleteTag(tagTable, Tcl_GetHashValue(entryPtr)); + DeleteTag(tagTable, (Ttk_Tag)Tcl_GetHashValue(entryPtr)); entryPtr = Tcl_NextHashEntry(&search); } @@ -87,10 +87,10 @@ Ttk_Tag Ttk_GetTag(Ttk_TagTable tagTable, const char *tagName) &tagTable->tags, tagName, &isNew); if (isNew) { - tagName = Tcl_GetHashKey(&tagTable->tags, entryPtr); + tagName = (char *)Tcl_GetHashKey(&tagTable->tags, entryPtr); Tcl_SetHashValue(entryPtr, NewTag(tagTable,tagName)); } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Tag)Tcl_GetHashValue(entryPtr); } Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr) @@ -113,7 +113,7 @@ Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr) Ttk_TagSet Ttk_GetTagSetFromObj( Tcl_Interp *interp, Ttk_TagTable tagTable, Tcl_Obj *objPtr) { - Ttk_TagSet tagset = ckalloc(sizeof(*tagset)); + Ttk_TagSet tagset = (Ttk_TagSet)ckalloc(sizeof(*tagset)); Tcl_Obj **objv; int i, objc; @@ -128,7 +128,7 @@ Ttk_TagSet Ttk_GetTagSetFromObj( return NULL; } - tagset->tags = ckalloc((objc+1) * sizeof(Ttk_Tag)); + tagset->tags = (Ttk_Tag *)ckalloc((objc+1) * sizeof(Ttk_Tag)); for (i=0; itags[i] = Ttk_GetTagFromObj(tagTable, objv[i]); } @@ -185,7 +185,7 @@ int Ttk_TagSetAdd(Ttk_TagSet tagset, Ttk_Tag tag) return 0; } } - tagset->tags = ckrealloc(tagset->tags, + tagset->tags = (Ttk_Tag *)ckrealloc(tagset->tags, (tagset->nTags+1)*sizeof(tagset->tags[0])); tagset->tags[tagset->nTags++] = tag; return 1; diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 9cb1b92..a67dd56 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -37,7 +37,7 @@ typedef struct Ttk_Style_ static Style *NewStyle() { - Style *stylePtr = ckalloc(sizeof(Style)); + Style *stylePtr = (Style *)ckalloc(sizeof(Style)); stylePtr->styleName = NULL; stylePtr->parentStyle = NULL; @@ -56,7 +56,7 @@ static void FreeStyle(Style *stylePtr) entryPtr = Tcl_FirstHashEntry(&stylePtr->settingsTable, &search); while (entryPtr != NULL) { - Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr); + Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(stateMap); entryPtr = Tcl_NextHashEntry(&search); } @@ -64,7 +64,7 @@ static void FreeStyle(Style *stylePtr) entryPtr = Tcl_FirstHashEntry(&stylePtr->defaultsTable, &search); while (entryPtr != NULL) { - Tcl_Obj *defaultValue = Tcl_GetHashValue(entryPtr); + Tcl_Obj *defaultValue = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(defaultValue); entryPtr = Tcl_NextHashEntry(&search); } @@ -85,7 +85,7 @@ Tcl_Obj *Ttk_StyleMap(Ttk_Style style, const char *optionName, Ttk_State state) Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&style->settingsTable, optionName); if (entryPtr) { - Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr); + Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr); return Ttk_StateMapLookup(NULL, stateMap, state); } style = style->parentStyle; @@ -103,7 +103,7 @@ Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName) Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&style->defaultsTable, optionName); if (entryPtr) - return Tcl_GetHashValue(entryPtr); + return (Tcl_Obj *)Tcl_GetHashValue(entryPtr); style= style->parentStyle; } return 0; @@ -176,7 +176,7 @@ static const Tk_OptionSpec *TTKGetOptionSpec( static OptionMap BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) { - OptionMap optionMap = ckalloc( + OptionMap optionMap = (OptionMap)ckalloc( sizeof(const Tk_OptionSpec) * elementClass->nResources + 1); int i; @@ -204,7 +204,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) optionMap = BuildOptionMap(elementClass, optionTable); Tcl_SetHashValue(entryPtr, optionMap); } else { - optionMap = Tcl_GetHashValue(entryPtr); + optionMap = (OptionMap)Tcl_GetHashValue(entryPtr); } return optionMap; @@ -218,7 +218,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) static Ttk_ElementClass * NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) { - Ttk_ElementClass *elementClass = ckalloc(sizeof(Ttk_ElementClass)); + Ttk_ElementClass *elementClass = (Ttk_ElementClass *)ckalloc(sizeof(Ttk_ElementClass)); int i; elementClass->name = name; @@ -234,7 +234,7 @@ NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) /* Initialize default values: */ - elementClass->defaultValues = + elementClass->defaultValues = (Tcl_Obj **) ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1); for (i=0; i < elementClass->nResources; ++i) { const char *defaultValue = specPtr->options[i].defaultValue; @@ -291,8 +291,14 @@ static void FreeElementClass(Ttk_ElementClass *elementClass) * +++ Themes. */ -static int ThemeEnabled(Ttk_Theme theme, void *clientData) { return 1; } +static int ThemeEnabled(Ttk_Theme theme, void *dummy) +{ + (void)theme; + (void)dummy; + /* Default ThemeEnabledProc -- always return true */ + return 1; +} typedef struct Ttk_Theme_ { @@ -307,7 +313,7 @@ typedef struct Ttk_Theme_ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) { - Theme *themePtr = ckalloc(sizeof(Theme)); + Theme *themePtr = (Theme *)ckalloc(sizeof(Theme)); Tcl_HashEntry *entryPtr; int unused; @@ -324,7 +330,7 @@ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) entryPtr = Tcl_CreateHashEntry(&themePtr->styleTable, ".", &unused); themePtr->rootStyle = NewStyle(); themePtr->rootStyle->styleName = - Tcl_GetHashKey(&themePtr->styleTable, entryPtr); + (const char *)Tcl_GetHashKey(&themePtr->styleTable, entryPtr); themePtr->rootStyle->cache = themePtr->cache; Tcl_SetHashValue(entryPtr, themePtr->rootStyle); @@ -341,7 +347,7 @@ static void FreeTheme(Theme *themePtr) */ entryPtr = Tcl_FirstHashEntry(&themePtr->elementTable, &search); while (entryPtr != NULL) { - Ttk_ElementClass *elementClass = Tcl_GetHashValue(entryPtr); + Ttk_ElementClass *elementClass = (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); FreeElementClass(elementClass); entryPtr = Tcl_NextHashEntry(&search); } @@ -352,7 +358,7 @@ static void FreeTheme(Theme *themePtr) */ entryPtr = Tcl_FirstHashEntry(&themePtr->styleTable, &search); while (entryPtr != NULL) { - Style *stylePtr = Tcl_GetHashValue(entryPtr); + Style *stylePtr = (Style *)Tcl_GetHashValue(entryPtr); FreeStyle(stylePtr); entryPtr = Tcl_NextHashEntry(&search); } @@ -403,12 +409,13 @@ static void ThemeChangedProc(ClientData); /* Forward */ /* Ttk_StylePkgFree -- * Cleanup procedure for StylePackageData. */ -static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) +static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *dummy) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr; Cleanup *cleanup; + (void)dummy; /* * Cancel any pending ThemeChanged calls: @@ -422,7 +429,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) */ entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); while (entryPtr != NULL) { - Theme *themePtr = Tcl_GetHashValue(entryPtr); + Theme *themePtr = (Theme *)Tcl_GetHashValue(entryPtr); FreeTheme(themePtr); entryPtr = Tcl_NextHashEntry(&search); } @@ -464,7 +471,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) static StylePackageData *GetStylePackageData(Tcl_Interp *interp) { - return Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL); + return (StylePackageData *)Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL); } /* @@ -479,8 +486,8 @@ static StylePackageData *GetStylePackageData(Tcl_Interp *interp) void Ttk_RegisterCleanup( Tcl_Interp *interp, ClientData clientData, Ttk_CleanupProc *cleanupProc) { - StylePackageData *pkgPtr = GetStylePackageData(interp); - Cleanup *cleanup = ckalloc(sizeof(*cleanup)); + StylePackageData *pkgPtr = (StylePackageData *)GetStylePackageData(interp); + Cleanup *cleanup = (Cleanup *)ckalloc(sizeof(*cleanup)); cleanup->clientData = clientData; cleanup->cleanupProc = cleanupProc; @@ -503,7 +510,7 @@ void Ttk_RegisterCleanup( static void ThemeChangedProc(ClientData clientData) { static char ThemeChangedScript[] = "ttk::ThemeChanged"; - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; int code = Tcl_EvalEx(pkgPtr->interp, ThemeChangedScript, -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { @@ -599,7 +606,7 @@ static Ttk_Theme LookupTheme( return NULL; } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Theme)Tcl_GetHashValue(entryPtr); } /* @@ -707,12 +714,12 @@ Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName) stylePtr->parentStyle = themePtr->rootStyle; } - stylePtr->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr); + stylePtr->styleName = (const char *)Tcl_GetHashKey(&themePtr->styleTable, entryPtr); stylePtr->cache = stylePtr->parentStyle->cache; Tcl_SetHashValue(entryPtr, stylePtr); return stylePtr; } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Style)Tcl_GetHashValue(entryPtr); } /* FindLayoutTemplate -- @@ -758,7 +765,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) */ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, elementName); if (entryPtr) { - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } /* @@ -769,7 +776,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, dot); } if (entryPtr) { - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } /* @@ -785,7 +792,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) */ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, ""); /* ASSERT: entryPtr != 0 */ - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } const char *Ttk_ElementClassName(Ttk_ElementClass *elementClass) @@ -802,7 +809,7 @@ int Ttk_RegisterElementFactory( Ttk_ElementFactory factory, void *clientData) { StylePackageData *pkgPtr = GetStylePackageData(interp); - FactoryRec *recPtr = ckalloc(sizeof(*recPtr)); + FactoryRec *recPtr = (FactoryRec *)ckalloc(sizeof(*recPtr)); Tcl_HashEntry *entryPtr; int newEntry; @@ -823,12 +830,13 @@ int Ttk_RegisterElementFactory( * (style element create $name) "from" $theme ?$element? */ static int Ttk_CloneElement( - Tcl_Interp *interp, void *clientData, + Tcl_Interp *interp, void *dummy, Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *const objv[]) { Ttk_Theme fromTheme; Ttk_ElementClass *fromElement; + (void)dummy; if (objc <= 0 || objc > 2) { Tcl_WrongNumArgs(interp, 0, objv, "theme ?element?"); @@ -898,7 +906,7 @@ Ttk_ElementClass *Ttk_RegisterElement( return 0; } - name = Tcl_GetHashKey(&theme->elementTable, entryPtr); + name = (char *)Tcl_GetHashKey(&theme->elementTable, entryPtr); elementClass = NewElementClass(name, specPtr, clientData); Tcl_SetHashValue(entryPtr, elementClass); @@ -1137,7 +1145,7 @@ int TtkEnumerateHashTable(Tcl_Interp *interp, Tcl_HashTable *ht) Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { - Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1); + Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1); Tcl_ListObjAppendElement(interp, result, nameObj); entryPtr = Tcl_NextHashEntry(&search); } @@ -1157,8 +1165,8 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht) Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { - Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1); - Tcl_Obj *valueObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1); + Tcl_Obj *valueObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_ListObjAppendElement(NULL, result, nameObj); Tcl_ListObjAppendElement(NULL, result, valueObj); entryPtr = Tcl_NextHashEntry(&search); @@ -1179,7 +1187,7 @@ StyleMapCmd( int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; @@ -1243,7 +1251,7 @@ usage: static int StyleConfigureCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; @@ -1298,7 +1306,7 @@ usage: static int StyleLookupCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; Ttk_Style style = NULL; const char *optionName; @@ -1340,7 +1348,7 @@ static int StyleLookupCmd( static int StyleThemeCurrentCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr = NULL; const char *name = NULL; @@ -1352,9 +1360,9 @@ static int StyleThemeCurrentCmd( entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); while (entryPtr != NULL) { - Theme *ptr = Tcl_GetHashValue(entryPtr); + Theme *ptr = (Theme *)Tcl_GetHashValue(entryPtr); if (ptr == pkgPtr->currentTheme) { - name = Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr); + name = (char *)Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr); break; } entryPtr = Tcl_NextHashEntry(&search); @@ -1376,7 +1384,7 @@ static int StyleThemeCurrentCmd( static int StyleThemeCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; static const char *const optStrings[] = { "-parent", "-settings", NULL }; enum { OP_PARENT, OP_SETTINGS }; @@ -1440,7 +1448,10 @@ static int StyleThemeCreateCmd( static int StyleThemeNamesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; + (void)objc; + (void)objv; + return TtkEnumerateHashTable(interp, &pkgPtr->themeTable); } @@ -1456,7 +1467,7 @@ StyleThemeSettingsCmd( int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme oldTheme = pkgPtr->currentTheme; Ttk_Theme newTheme; int status; @@ -1482,7 +1493,7 @@ StyleThemeSettingsCmd( static int StyleElementCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName, *factoryName; Tcl_HashEntry *entryPtr; @@ -1505,7 +1516,7 @@ static int StyleElementCreateCmd( return TCL_ERROR; } - recPtr = Tcl_GetHashValue(entryPtr); + recPtr = (FactoryRec *)Tcl_GetHashValue(entryPtr); return recPtr->factory(interp, recPtr->clientData, theme, elementName, objc - 5, objv + 5); @@ -1517,7 +1528,7 @@ static int StyleElementCreateCmd( static int StyleElementNamesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; if (objc != 3) { @@ -1533,7 +1544,7 @@ static int StyleElementNamesCmd( static int StyleElementOptionsCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName; Ttk_ElementClass *elementClass; @@ -1571,7 +1582,7 @@ static int StyleElementOptionsCmd( static int StyleLayoutCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *layoutName; Ttk_LayoutTemplate layoutTemplate; @@ -1614,7 +1625,7 @@ StyleThemeUseCmd( int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme; if (objc < 3 || objc > 4) { @@ -1709,7 +1720,7 @@ void Ttk_StylePkgInit(Tcl_Interp *interp) { Tcl_Namespace *nsPtr; - StylePackageData *pkgPtr = ckalloc(sizeof(StylePackageData)); + StylePackageData *pkgPtr = (StylePackageData *)ckalloc(sizeof(StylePackageData)); pkgPtr->interp = interp; Tcl_InitHashTable(&pkgPtr->themeTable, TCL_STRING_KEYS); diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c index f7cdf43..7e02b58 100644 --- a/generic/ttk/ttkTrace.c +++ b/generic/ttk/ttkTrace.c @@ -30,9 +30,11 @@ VarTraceProc( const char *name2, /* (unused) */ int flags) /* Information about what happened. */ { - Ttk_TraceHandle *tracePtr = clientData; + Ttk_TraceHandle *tracePtr = (Ttk_TraceHandle *)clientData; const char *name, *value; Tcl_Obj *valuePtr; + (void)name1; + (void)name2; if (Tcl_InterpDeleted(interp)) { return NULL; @@ -85,7 +87,7 @@ Ttk_TraceHandle *Ttk_TraceVariable( Ttk_TraceProc callback, void *clientData) { - Ttk_TraceHandle *h = ckalloc(sizeof(*h)); + Ttk_TraceHandle *h = (Ttk_TraceHandle *)ckalloc(sizeof(*h)); int status; h->interp = interp; diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c index fa2a7e0..6cedfd2 100644 --- a/generic/ttk/ttkTrack.c +++ b/generic/ttk/ttkTrack.c @@ -118,7 +118,7 @@ static const unsigned ElementStateMask = static void ElementStateEventProc(ClientData clientData, XEvent *ev) { - ElementStateTracker *es = clientData; + ElementStateTracker *es = (ElementStateTracker *)clientData; Ttk_Layout layout = es->corePtr->layout; Ttk_Element element; @@ -173,7 +173,7 @@ ElementStateEventProc(ClientData clientData, XEvent *ev) void TtkTrackElementState(WidgetCore *corePtr) { - ElementStateTracker *es = ckalloc(sizeof(*es)); + ElementStateTracker *es = (ElementStateTracker *)ckalloc(sizeof(*es)); es->corePtr = corePtr; es->tracking = 0; es->activeElement = es->pressedElement = 0; diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index a11389b..dbed6c0 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -84,7 +84,7 @@ static Tk_OptionSpec ItemOptionSpecs[] = { */ static TreeItem *NewItem(void) { - TreeItem *item = ckalloc(sizeof(*item)); + TreeItem *item = (TreeItem *)ckalloc(sizeof(*item)); item->entryPtr = 0; item->parent = item->children = item->next = item->prev = NULL; @@ -119,7 +119,7 @@ static void FreeItem(TreeItem *item) ckfree(item); } -static void FreeItemCB(void *clientData) { FreeItem(clientData); } +static void FreeItemCB(void *clientData) { FreeItem((TreeItem *)clientData); } /* + DetachItem -- * Unlink an item from the tree. @@ -525,7 +525,7 @@ static TreeColumn *GetColumn( entryPtr = Tcl_FindHashEntry( &tv->tree.columnNames, Tcl_GetString(columnIDObj)); if (entryPtr) { - return Tcl_GetHashValue(entryPtr); + return (TreeColumn *)Tcl_GetHashValue(entryPtr); } /* Check for number: @@ -586,7 +586,7 @@ static TreeItem *FindItem( Tcl_SetErrorCode(interp, "TTK", "TREE", "ITEM", NULL); return 0; } - return Tcl_GetHashValue(entryPtr); + return (TreeItem *)Tcl_GetHashValue(entryPtr); } /* + GetItemListFromObj -- @@ -607,7 +607,7 @@ static TreeItem **GetItemListFromObj( return NULL; } - items = ckalloc((nElements + 1)*sizeof(TreeItem*)); + items = (TreeItem **)ckalloc((nElements + 1)*sizeof(TreeItem*)); for (i = 0; i < nElements; ++i) { items[i] = FindItem(interp, tv, elements[i]); if (!items[i]) { @@ -624,7 +624,7 @@ static TreeItem **GetItemListFromObj( */ static const char *ItemName(Treeview *tv, TreeItem *item) { - return Tcl_GetHashKey(&tv->tree.items, item->entryPtr); + return (const char *)Tcl_GetHashKey(&tv->tree.items, item->entryPtr); } /* + ItemID -- @@ -682,7 +682,7 @@ static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv) * Initialize columns array and columnNames hash table: */ tv->tree.nColumns = ncols; - tv->tree.columns = ckalloc(tv->tree.nColumns * sizeof(TreeColumn)); + tv->tree.columns = (TreeColumn *)ckalloc(tv->tree.nColumns * sizeof(TreeColumn)); for (i = 0; i < ncols; ++i) { int isNew; @@ -727,12 +727,12 @@ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv) if (!strcmp(Tcl_GetString(tv->tree.displayColumnsObj), "#all")) { ndcols = tv->tree.nColumns; - displayColumns = ckalloc((ndcols+1) * sizeof(TreeColumn*)); + displayColumns = (TreeColumn **)ckalloc((ndcols+1) * sizeof(TreeColumn*)); for (index = 0; index < ndcols; ++index) { displayColumns[index+1] = tv->tree.columns + index; } } else { - displayColumns = ckalloc((ndcols+1) * sizeof(TreeColumn*)); + displayColumns = (TreeColumn **)ckalloc((ndcols+1) * sizeof(TreeColumn*)); for (index = 0; index < ndcols; ++index) { displayColumns[index+1] = GetColumn(interp, tv, dcolumns[index]); if (!displayColumns[index+1]) { @@ -930,7 +930,7 @@ static const unsigned long TreeviewBindEventMask = static void TreeviewBindEventProc(void *clientData, XEvent *event) { - Treeview *tv = clientData; + Treeview *tv = (Treeview *)clientData; TreeItem *item = NULL; Ttk_TagSet tagset; @@ -982,7 +982,7 @@ static void TreeviewBindEventProc(void *clientData, XEvent *event) static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; int unused; tv->tree.itemOptionTable = @@ -1049,7 +1049,7 @@ static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr) static void TreeviewCleanup(void *recordPtr) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Tk_DeleteEventHandler(tv->core.tkwin, TreeviewBindEventMask, TreeviewBindEventProc, tv); @@ -1082,7 +1082,7 @@ static void TreeviewCleanup(void *recordPtr) static int TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; unsigned showFlags = tv->tree.showFlags; if (mask & COLUMNS_CHANGED) { @@ -1561,7 +1561,7 @@ static Ttk_Layout GetSublayout( static Ttk_Layout TreeviewGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Ttk_Layout treeLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); Tcl_Obj *objPtr; int unused; @@ -1610,7 +1610,7 @@ static Ttk_Layout TreeviewGetLayout( */ static void TreeviewDoLayout(void *clientData) { - Treeview *tv = clientData; + Treeview *tv = (Treeview *)clientData; int visibleRows; Ttk_PlaceLayout(tv->core.layout,tv->core.state,Ttk_WinBox(tv->core.tkwin)); @@ -1644,7 +1644,7 @@ static void TreeviewDoLayout(void *clientData) */ static int TreeviewSize(void *clientData, int *widthPtr, int *heightPtr) { - Treeview *tv = clientData; + Treeview *tv = (Treeview *)clientData; int nRows, padHeight, padWidth; Ttk_LayoutSize(tv->core.layout, tv->core.state, &padWidth, &padHeight); @@ -1832,7 +1832,7 @@ static int DrawForest( */ static void TreeviewDisplay(void *clientData, Drawable d) { - Treeview *tv = clientData; + Treeview *tv = (Treeview *)clientData; Ttk_DrawLayout(tv->core.layout, tv->core.state, d); if (tv->tree.showFlags & SHOW_HEADINGS) { @@ -1946,7 +1946,7 @@ static TreeItem *DeleteItems(TreeItem *item, TreeItem *delq) static int TreeviewChildrenCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; Tcl_Obj *result; @@ -2026,7 +2026,7 @@ static int TreeviewChildrenCommand( static int TreeviewParentCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc != 3) { @@ -2054,7 +2054,7 @@ static int TreeviewParentCommand( static int TreeviewNextCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc != 3) { @@ -2079,7 +2079,7 @@ static int TreeviewNextCommand( static int TreeviewPrevCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc != 3) { @@ -2104,7 +2104,7 @@ static int TreeviewPrevCommand( static int TreeviewIndexCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; int index = 0; @@ -2132,7 +2132,7 @@ static int TreeviewIndexCommand( static int TreeviewExistsCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Tcl_HashEntry *entryPtr; if (objc != 3) { @@ -2151,7 +2151,7 @@ static int TreeviewExistsCommand( static int TreeviewBBoxCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item = 0; TreeColumn *column = 0; Ttk_Box bbox; @@ -2194,6 +2194,7 @@ static int TreeviewHorribleIdentify( int dColumnNumber; char dcolbuf[16]; int x, y, x1; + (void)objc; /* ASSERT: objc == 4 */ @@ -2267,7 +2268,7 @@ static int TreeviewIdentifyCommand( { "region", "item", "column", "row", "element", NULL }; enum { I_REGION, I_ITEM, I_COLUMN, I_ROW, I_ELEMENT }; - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; int submethod; int x, y; @@ -2369,7 +2370,7 @@ static int TreeviewIdentifyCommand( static int TreeviewItemCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc < 3) { @@ -2397,7 +2398,7 @@ static int TreeviewItemCommand( static int TreeviewColumnCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeColumn *column; if (objc < 3) { @@ -2425,7 +2426,7 @@ static int TreeviewColumnCommand( static int TreeviewHeadingCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Tk_OptionTable optionTable = tv->tree.headingOptionTable; Tk_Window tkwin = tv->core.tkwin; TreeColumn *column; @@ -2455,7 +2456,7 @@ static int TreeviewHeadingCommand( static int TreeviewSetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; TreeColumn *column; int columnNumber; @@ -2549,7 +2550,7 @@ static int TreeviewSetCommand( static int TreeviewInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *parent, *sibling, *newItem; Tcl_HashEntry *entryPtr; int isNew; @@ -2630,7 +2631,7 @@ static int TreeviewInsertCommand( static int TreeviewDetachCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem **items; int i; @@ -2677,7 +2678,7 @@ static int TreeviewDetachCommand( static int TreeviewDeleteCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem **items, *delq; int i, selItemDeleted = 0; @@ -2738,7 +2739,7 @@ static int TreeviewDeleteCommand( static int TreeviewMoveCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item, *parent; TreeItem *sibling; @@ -2801,14 +2802,14 @@ static int TreeviewMoveCommand( static int TreeviewXViewCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; return TtkScrollviewCommand(interp, objc, objv, tv->tree.xscrollHandle); } static int TreeviewYViewCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; return TtkScrollviewCommand(interp, objc, objv, tv->tree.yscrollHandle); } @@ -2818,7 +2819,7 @@ static int TreeviewYViewCommand( static int TreeviewSeeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item, *parent; int rowNumber; @@ -2865,7 +2866,7 @@ static int TreeviewSeeCommand( static int TreeviewDragCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; int left = tv->tree.treeArea.x - tv->tree.xscroll.first; int i = FirstColumn(tv); TreeColumn *column; @@ -2902,7 +2903,7 @@ static int TreeviewDragCommand( static int TreeviewDropCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "drop"); @@ -2922,7 +2923,7 @@ static int TreeviewDropCommand( static int TreeviewFocusCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; if (objc == 2) { if (tv->tree.focus) { @@ -2954,7 +2955,7 @@ static int TreeviewSelectionCommand( "set", "add", "remove", "toggle", NULL }; - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; int selop, i; TreeItem *item, **items; @@ -3023,7 +3024,7 @@ static int TreeviewSelectionCommand( static int TreeviewTagBindCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Ttk_TagTable tagTable = tv->tree.tagTable; Tk_BindingTable bindingTable = tv->tree.bindingTable; Ttk_Tag tag; @@ -3076,7 +3077,7 @@ static int TreeviewTagBindCommand( static int TreeviewTagConfigureCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Ttk_TagTable tagTable = tv->tree.tagTable; Ttk_Tag tag; @@ -3107,7 +3108,7 @@ static int TreeviewTagConfigureCommand( static int TreeviewTagHasCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; if (objc == 4) { /* Return list of all items with tag */ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); @@ -3143,7 +3144,7 @@ static int TreeviewTagHasCommand( static int TreeviewTagNamesCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, ""); @@ -3167,7 +3168,7 @@ static void AddTag(TreeItem *item, Ttk_Tag tag) static int TreeviewTagAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Ttk_Tag tag; TreeItem **items; int i; @@ -3207,7 +3208,7 @@ static void RemoveTag(TreeItem *item, Ttk_Tag tag) static int TreeviewTagRemoveCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Ttk_Tag tag; if (objc < 4) { @@ -3355,16 +3356,18 @@ static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { offsetof(TreeitemIndicator,sizeObj), "12" }, { "-indicatormargins", TK_OPTION_STRING, offsetof(TreeitemIndicator,marginsObj), "2 2 4 2" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TreeitemIndicatorSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TreeitemIndicator *indicator = elementRecord; + TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; Ttk_Padding margins; int size = 0; + (void)dummy; + (void)paddingPtr; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginsObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); @@ -3374,15 +3377,16 @@ static void TreeitemIndicatorSize( } static void TreeitemIndicatorDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - TreeitemIndicator *indicator = elementRecord; + TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; ArrowDirection direction = (state & TTK_STATE_OPEN) ? ARROW_DOWN : ARROW_RIGHT; Ttk_Padding margins; XColor *borderColor = Tk_GetColorFromObj(tkwin, indicator->colorObj); XGCValues gcvalues; GC gc; unsigned mask; + (void)dummy; if (state & TTK_STATE_LEAF) /* don't draw anything */ return; @@ -3422,16 +3426,19 @@ static Ttk_ElementOptionSpec RowElementOptions[] = { offsetof(RowElement,backgroundObj), DEFAULT_BACKGROUND }, { "-rownumber", TK_OPTION_INT, offsetof(RowElement,rowNumberObj), "0" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void RowElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - RowElement *row = elementRecord; + RowElement *row = (RowElement *)elementRecord; XColor *color = Tk_GetColorFromObj(tkwin, row->backgroundObj); GC gc = Tk_GCForColor(color, d); + (void)dummy; + (void)state; + XFillRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width, b.height); } diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index a7f7e55..8cbcdff 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -93,7 +93,7 @@ static void EndDrawing(Tk_Window tkwin, Drawable d) { } */ static void DrawWidget(ClientData recordPtr) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; corePtr->flags &= ~REDISPLAY_PENDING; if (Tk_IsMapped(corePtr->tkwin)) { @@ -152,7 +152,7 @@ static int WidgetInstanceObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; const Ttk_Ensemble *commands = corePtr->widgetSpec->commands; int status; @@ -187,7 +187,7 @@ WidgetInstanceObjCmd( static void WidgetInstanceObjCmdDeleted(ClientData clientData) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; corePtr->widgetCmd = NULL; if (corePtr->tkwin != NULL) Tk_DestroyWindow(corePtr->tkwin); @@ -262,7 +262,7 @@ static const unsigned CoreEventMask static void CoreEventProc(ClientData clientData, XEvent *eventPtr) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; switch (eventPtr->type) { @@ -329,7 +329,7 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr) */ static void WidgetWorldChanged(ClientData clientData) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; SizeChanged(corePtr); TtkRedisplayWidget(corePtr); } @@ -349,7 +349,7 @@ static const Tk_ClassProcs widgetClassProcs = { int TtkWidgetConstructorObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetSpec *widgetSpec = clientData; + WidgetSpec *widgetSpec = (WidgetSpec *)clientData; const char *className = widgetSpec->className; Tk_OptionTable optionTable = Tk_CreateOptionTable(interp, widgetSpec->optionSpecs); @@ -385,7 +385,7 @@ int TtkWidgetConstructorObjCmd( */ recordPtr = ckalloc(widgetSpec->recordSize); memset(recordPtr, 0, widgetSpec->recordSize); - corePtr = recordPtr; + corePtr = (WidgetCore *)recordPtr; corePtr->tkwin = tkwin; corePtr->interp = interp; @@ -460,7 +460,7 @@ error: Ttk_Layout TtkWidgetGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; const char *styleName = 0; if (corePtr->styleObj) @@ -482,10 +482,10 @@ Ttk_Layout TtkWidgetGetLayout( Ttk_Layout TtkWidgetGetOrientedLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr, Tcl_Obj *orientObj) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; const char *baseStyleName = 0; Tcl_DString styleName; - int orient = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; Ttk_Layout layout; Tcl_DStringInit(&styleName); @@ -522,6 +522,8 @@ Ttk_Layout TtkWidgetGetOrientedLayout( */ void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr) { + (void)interp; + (void)recordPtr; } /* TtkNullPostConfigure -- @@ -529,6 +531,10 @@ void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr) */ int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask) { + (void)interp; + (void)clientData; + (void)mask; + return TCL_OK; } @@ -538,7 +544,7 @@ int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask) */ int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; int status = TCL_OK; if (mask & STYLE_CHANGED) { @@ -553,6 +559,7 @@ int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask) */ void TtkNullCleanup(void *recordPtr) { + (void)recordPtr; return; } @@ -561,7 +568,7 @@ void TtkNullCleanup(void *recordPtr) */ void TtkWidgetDoLayout(void *clientData) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); } @@ -570,7 +577,7 @@ void TtkWidgetDoLayout(void *clientData) */ void TtkWidgetDisplay(void *recordPtr, Drawable d) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_DrawLayout(corePtr->layout, corePtr->state, d); } @@ -579,7 +586,7 @@ void TtkWidgetDisplay(void *recordPtr, Drawable d) */ int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr); return 1; } @@ -593,7 +600,7 @@ int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr) int TtkWidgetCgetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Tcl_Obj *result; if (objc != 3) { @@ -613,7 +620,7 @@ int TtkWidgetCgetCommand( int TtkWidgetConfigureCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Tcl_Obj *result; if (objc == 2) { @@ -683,7 +690,7 @@ int TtkWidgetConfigureCommand( int TtkWidgetStateCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_StateSpec spec; int status; Ttk_State oldState, changed; @@ -723,7 +730,7 @@ int TtkWidgetStateCommand( int TtkWidgetInstateCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_State state = corePtr->state; Ttk_StateSpec spec; int status = TCL_OK; @@ -754,7 +761,7 @@ int TtkWidgetInstateCommand( int TtkWidgetIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_Element element; static const char *const whatTable[] = { "element", NULL }; int x, y, what; diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 52534ce..e937328 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -2089,7 +2089,7 @@ static void TrackElementDraw( { TrackElementData *data = clientData; TrackElement *elem = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; double from = 0, to = 100, value = 0, factor; Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation); @@ -2227,7 +2227,7 @@ static void PbarElementDraw( Ttk_State state) { PbarElement *pbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL, phase = 0; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL, phase = 0; double value = 0, maximum = 100, factor; Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation); @@ -2302,7 +2302,7 @@ static void TroughElementSize( Ttk_Padding *paddingPtr) { ScrollbarElement *scrollbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; SInt32 thickness = 15; Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); @@ -2343,7 +2343,7 @@ static void TroughElementDraw( Ttk_State state) { ScrollbarElement *scrollbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; CGRect bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *troughColor; @@ -2385,7 +2385,7 @@ static void ThumbElementSize( Ttk_Padding *paddingPtr) { ScrollbarElement *scrollbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); if (orientation == TTK_ORIENT_VERTICAL) { @@ -2406,7 +2406,7 @@ static void ThumbElementDraw( Ttk_State state) { ScrollbarElement *scrollbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c index 91dcba7..9e6c112 100644 --- a/unix/tkAppInit.c +++ b/unix/tkAppInit.c @@ -17,7 +17,13 @@ #include "tk.h" #ifdef TK_TEST +#ifdef __cplusplus +extern "C" { +#endif extern Tcl_PackageInitProc Tktest_Init; +#ifdef __cplusplus +} +#endif #endif /* TK_TEST */ /* diff --git a/unix/tkUnix.c b/unix/tkUnix.c index c6fff82..df70cb0 100644 --- a/unix/tkUnix.c +++ b/unix/tkUnix.c @@ -108,6 +108,11 @@ Tk_UpdatePointer( int x, int y, /* Pointer location in root coords. */ int state) /* Modifier state mask. */ { + (void)tkwin; + (void)x; + (void)y; + (void)state; + /* * This function intentionally left blank */ diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c index 7ea67a1..dfa08fb 100644 --- a/unix/tkUnix3d.c +++ b/unix/tkUnix3d.c @@ -46,7 +46,7 @@ typedef struct { TkBorder * TkpGetBorder(void) { - UnixBorder *borderPtr = ckalloc(sizeof(UnixBorder)); + UnixBorder *borderPtr = (UnixBorder *)ckalloc(sizeof(UnixBorder)); borderPtr->solidGC = NULL; return (TkBorder *) borderPtr; diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c index 24ac8cc..8d13db7 100644 --- a/unix/tkUnixButton.c +++ b/unix/tkUnixButton.c @@ -173,7 +173,7 @@ TkpDrawCheckIndicator( * Sanity check. */ - if (tkwin == NULL || display == None || d == None || bgBorder == NULL + if (tkwin == NULL || display == NULL || d == None || bgBorder == NULL || indicatorColor == NULL) { return; } @@ -328,9 +328,9 @@ TkButton * TkpCreateButton( Tk_Window tkwin) { - UnixButton *butPtr = ckalloc(sizeof(UnixButton)); + (void)tkwin; - return (TkButton *) butPtr; + return (TkButton *)ckalloc(sizeof(UnixButton)); } /* @@ -396,7 +396,7 @@ void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c index 96e8937..a909fb3 100644 --- a/unix/tkUnixColor.c +++ b/unix/tkUnixColor.c @@ -185,7 +185,7 @@ TkpGetColor( } } - tkColPtr = ckalloc(sizeof(TkColor)); + tkColPtr = (TkColor *)ckalloc(sizeof(TkColor)); tkColPtr->color = color; return tkColPtr; @@ -220,7 +220,7 @@ TkpGetColorByValue( { Display *display = Tk_Display(tkwin); Colormap colormap = Tk_Colormap(tkwin); - TkColor *tkColPtr = ckalloc(sizeof(TkColor)); + TkColor *tkColPtr = (TkColor *)ckalloc(sizeof(TkColor)); tkColPtr->color.red = colorPtr->red; tkColPtr->color.green = colorPtr->green; @@ -269,7 +269,7 @@ FindClosestColor( XColor *colorPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; Colormap colormap = Tk_Colormap(tkwin); - XVisualInfo template, *visInfoPtr; + XVisualInfo templ, *visInfoPtr; /* * Find the TkStressedCmap structure for this colormap, or create a new @@ -278,19 +278,19 @@ FindClosestColor( for (stressPtr = dispPtr->stressPtr; ; stressPtr = stressPtr->nextPtr) { if (stressPtr == NULL) { - stressPtr = ckalloc(sizeof(TkStressedCmap)); + stressPtr = (TkStressedCmap *)ckalloc(sizeof(TkStressedCmap)); stressPtr->colormap = colormap; - template.visualid = XVisualIDFromVisual(Tk_Visual(tkwin)); + templ.visualid = XVisualIDFromVisual(Tk_Visual(tkwin)); visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), - VisualIDMask, &template, &numFound); + VisualIDMask, &templ, &numFound); if (numFound < 1) { Tcl_Panic("FindClosestColor couldn't lookup visual"); } stressPtr->numColors = visInfoPtr->colormap_size; XFree((char *) visInfoPtr); - stressPtr->colorPtr = + stressPtr->colorPtr = (XColor *) ckalloc(stressPtr->numColors * sizeof(XColor)); for (i = 0; i < stressPtr->numColors; i++) { stressPtr->colorPtr[i].pixel = (unsigned long) i; diff --git a/unix/tkUnixConfig.c b/unix/tkUnixConfig.c index 3584494..acd8bb5 100644 --- a/unix/tkUnixConfig.c +++ b/unix/tkUnixConfig.c @@ -38,6 +38,10 @@ TkpGetSystemDefault( const char *dbName, /* The option database name. */ const char *className) /* The name of the option class. */ { + (void)tkwin; + (void)dbName; + (void)className; + return NULL; } diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c index 4c58adf..bcd7cc3 100644 --- a/unix/tkUnixCursor.c +++ b/unix/tkUnixCursor.c @@ -338,7 +338,7 @@ TkGetCursorByName( } if (cursor != None) { - cursorPtr = ckalloc(sizeof(TkUnixCursor)); + cursorPtr = (TkUnixCursor *)ckalloc(sizeof(TkUnixCursor)); cursorPtr->info.cursor = (Tk_Cursor) cursor; cursorPtr->display = display; } @@ -608,7 +608,7 @@ TkCreateCursorFromData( Tk_FreePixmap(display, maskPixmap); if (cursor != None) { - cursorPtr = ckalloc(sizeof(TkUnixCursor)); + cursorPtr = (TkUnixCursor *)ckalloc(sizeof(TkUnixCursor)); cursorPtr->info.cursor = (Tk_Cursor) cursor; cursorPtr->display = display; } diff --git a/unix/tkUnixDraw.c b/unix/tkUnixDraw.c index e6886e8..fec05ee 100644 --- a/unix/tkUnixDraw.c +++ b/unix/tkUnixDraw.c @@ -202,6 +202,8 @@ TkpDrawHighlightBorder( int highlightWidth, Drawable drawable) { + (void)bgGC; + TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0); } diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c index 5653b75..d4654a8 100644 --- a/unix/tkUnixEmbed.c +++ b/unix/tkUnixEmbed.c @@ -106,7 +106,7 @@ TkpUseWindow( Tk_ErrorHandler handler; Container *containerPtr; XWindowAttributes parentAtts; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->window != None) { @@ -178,7 +178,7 @@ TkpUseWindow( } } if (containerPtr == NULL) { - containerPtr = ckalloc(sizeof(Container)); + containerPtr = (Container *)ckalloc(sizeof(Container)); containerPtr->parent = parent; containerPtr->parentRoot = parentAtts.root; containerPtr->parentPtr = NULL; @@ -216,7 +216,7 @@ TkpMakeWindow( * the window is to be created. */ { Container *containerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->flags & TK_EMBEDDED) { @@ -272,7 +272,7 @@ TkpMakeContainer( { TkWindow *winPtr = (TkWindow *) tkwin; Container *containerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -281,7 +281,7 @@ TkpMakeContainer( */ Tk_MakeWindowExist(tkwin); - containerPtr = ckalloc(sizeof(Container)); + containerPtr = (Container *)ckalloc(sizeof(Container)); containerPtr->parent = Tk_WindowId(tkwin); containerPtr->parentRoot = RootWindowOfScreen(Tk_Screen(tkwin)); containerPtr->parentPtr = winPtr; @@ -332,7 +332,8 @@ EmbedErrorProc( XErrorEvent *errEventPtr) /* Points to information about error (not * used). */ { - int *iPtr = clientData; + int *iPtr = (int *)clientData; + (void)errEventPtr; *iPtr = 1; return 0; @@ -362,7 +363,7 @@ EmbeddedEventProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; if (eventPtr->type == DestroyNotify) { EmbedWindowDeleted(winPtr); @@ -394,10 +395,10 @@ ContainerEventProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; Container *containerPtr; Tk_ErrorHandler errHandler; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -499,7 +500,7 @@ EmbedStructureProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - Container *containerPtr = clientData; + Container *containerPtr = (Container *)clientData; Tk_ErrorHandler errHandler; if (eventPtr->type == ConfigureNotify) { @@ -507,7 +508,7 @@ EmbedStructureProc( * Send a ConfigureNotify to the embedded application. */ - if (containerPtr->embeddedPtr != None) { + if (containerPtr->embeddedPtr != NULL) { TkDoConfigureNotify(containerPtr->embeddedPtr); } if (containerPtr->wrapper != None) { @@ -554,7 +555,7 @@ EmbedFocusProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - Container *containerPtr = clientData; + Container *containerPtr = (Container *)clientData; Tk_ErrorHandler errHandler; Display *display; @@ -712,7 +713,7 @@ TkpGetOtherWindow( * window. */ { Container *containerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (containerPtr = tsdPtr->firstContainerPtr; @@ -758,7 +759,7 @@ TkpRedirectKeyEvent( { Container *containerPtr; Window saved; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -830,7 +831,7 @@ TkpClaimFocus( { XEvent event; Container *containerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!(topLevelPtr->flags & TK_EMBEDDED)) { @@ -872,7 +873,7 @@ TkpClaimFocus( int TkpTestembedCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -882,8 +883,9 @@ TkpTestembedCmd( Tcl_DString dString; char buffer[50]; Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) { all = 1; @@ -967,7 +969,7 @@ EmbedWindowDeleted( * deleted. */ { Container *containerPtr, *prevPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1025,7 +1027,7 @@ TkUnixContainerId( TkWindow *winPtr) /* Tk's structure for an embedded window. */ { Container *containerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (containerPtr = tsdPtr->firstContainerPtr; @@ -1178,6 +1180,7 @@ TkpCreateBusy( { Window root, parent, *dummy; unsigned int count; + (void)busy; if (winPtr->flags & TK_REPARENTED) { /* diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 90dcd61..896a627 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.c @@ -92,10 +92,11 @@ TkCreateXEventSource(void) static void DisplayExitHandler( - ClientData clientData) /* Not used. */ + ClientData dummy) /* Not used. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; Tcl_DeleteEventSource(DisplaySetupProc, DisplayCheckProc, NULL); tsdPtr->initialized = 0; @@ -175,7 +176,7 @@ TkpOpenDisplay( if (display == NULL) { return NULL; } - dispPtr = ckalloc(sizeof(TkDisplay)); + dispPtr = (TkDisplay *)ckalloc(sizeof(TkDisplay)); memset(dispPtr, 0, sizeof(TkDisplay)); dispPtr->display = display; dispPtr->flags |= use_xkb; @@ -311,11 +312,12 @@ TkClipCleanup( static void DisplaySetupProc( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ int flags) { TkDisplay *dispPtr; static Tcl_Time blockTime = { 0, 0 }; + (void)dummy; if (!(flags & TCL_WINDOW_EVENTS)) { return; @@ -449,10 +451,11 @@ TransferXEventsToTcl( static void DisplayCheckProc( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ int flags) { TkDisplay *dispPtr; + (void)dummy; if (!(flags & TCL_WINDOW_EVENTS)) { return; @@ -487,9 +490,10 @@ DisplayFileProc( ClientData clientData, /* The display pointer. */ int flags) /* Should be TCL_READABLE. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; Display *display = dispPtr->display; int numFound; + (void)flags; XFlush(display); numFound = XEventsQueued(display, QueuedAfterReading); @@ -514,9 +518,9 @@ DisplayFileProc( * nice (?!) message. */ - void (*oldHandler)(); + void (*oldHandler)(int); - oldHandler = (void (*)()) signal(SIGPIPE, SIG_IGN); + oldHandler = (void (*)(int)) signal(SIGPIPE, SIG_IGN); XNoOp(display); XFlush(display); (void) signal(SIGPIPE, oldHandler); @@ -700,6 +704,8 @@ InstantiateIMCallback( XPointer call_data) { TkDisplay *dispPtr; + (void)display; + (void)call_data; dispPtr = (TkDisplay *) client_data; OpenIM(dispPtr); @@ -714,6 +720,8 @@ DestroyIMCallback( XPointer call_data) { TkDisplay *dispPtr; + (void)im; + (void)call_data; dispPtr = (TkDisplay *) client_data; dispPtr->inputMethod = NULL; diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index f448da7..c1e9264 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -266,10 +266,11 @@ static int UtfToUcs2beProc(ClientData clientData, const char*src, static void FontPkgCleanup( - ClientData clientData) + ClientData dummy) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; if (tsdPtr->controlFamily.encoding != NULL) { FontFamily *familyPtr = &tsdPtr->controlFamily; @@ -307,11 +308,12 @@ void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); SubFont dummy; int i; Tcl_Encoding ucs2; + (void)mainPtr; if (tsdPtr->controlFamily.encoding == NULL) { @@ -361,7 +363,7 @@ TkpFontPkgInit( static int ControlUtfProc( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ @@ -394,6 +396,9 @@ ControlUtfProc( 0, 0, 0, 0, 0, 0, 0, 'a', 'b', 't', 'n', 'v', 'f', 'r' }; + (void)dummy; + (void)flags; + (void)statePtr; result = TCL_OK; @@ -459,7 +464,7 @@ ControlUtfProc( static int Ucs2beToUtfProc( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ const char *src, /* Source string in Unicode. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ @@ -488,6 +493,8 @@ Ucs2beToUtfProc( const char *dstEnd, *dstStart; int result, numChars, charLimit = INT_MAX; unsigned short ch; + (void)dummy; + (void)statePtr; if (flags & TCL_ENCODING_CHAR_LIMIT) { charLimit = *dstCharsPtr; @@ -555,7 +562,7 @@ Ucs2beToUtfProc( static int UtfToUcs2beProc( - ClientData clientData, /* TableEncodingData that specifies + ClientData dummy, /* TableEncodingData that specifies * encoding. */ const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ @@ -584,6 +591,8 @@ UtfToUcs2beProc( const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd; int result, numChars; int ch; + (void)dummy; + (void)statePtr; srcStart = src; srcEnd = src + srcLen; @@ -719,7 +728,7 @@ TkpGetNativeFont( } fontStructPtr = CreateClosestFont(tkwin, &fa.fa, &fa.xa); } - fontPtr = ckalloc(sizeof(UnixFont)); + fontPtr = (UnixFont *)ckalloc(sizeof(UnixFont)); InitFont(tkwin, fontStructPtr, fontPtr); return (TkFont *) fontPtr; @@ -775,7 +784,7 @@ TkpGetFontFromAttributes( fontPtr = (UnixFont *) tkFontPtr; if (fontPtr == NULL) { - fontPtr = ckalloc(sizeof(UnixFont)); + fontPtr = (UnixFont *)ckalloc(sizeof(UnixFont)); } else { ReleaseFont(fontPtr); } @@ -838,7 +847,7 @@ TkpGetFontFamilies( Tcl_Interp *interp, /* Interp to hold result. */ Tk_Window tkwin) /* For display to query. */ { - int i, new, numNames; + int i, isNew, numNames; char *family, **nameList; Tcl_HashTable familyTable; Tcl_HashEntry *hPtr; @@ -867,14 +876,14 @@ TkpGetFontFamilies( continue; /* See comment above. */ } *familyEnd = '\0'; - Tcl_CreateHashEntry(&familyTable, family, &new); + Tcl_CreateHashEntry(&familyTable, family, &isNew); } XFreeFontNames(nameList); hPtr = Tcl_FirstHashEntry(&familyTable, &search); resultPtr = Tcl_NewObj(); while (hPtr != NULL) { - strPtr = Tcl_NewStringObj(Tcl_GetHashKey(&familyTable, hPtr), -1); + strPtr = Tcl_NewStringObj((const char *)Tcl_GetHashKey(&familyTable, hPtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); hPtr = Tcl_NextHashEntry(&search); } @@ -1574,7 +1583,7 @@ InitFont( UnixFont *fontPtr) /* Filled with information constructed from * the above arguments. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); unsigned long value; int minHi, maxHi, minLo, maxLo, fixed, width, limit, i, n; @@ -1827,8 +1836,9 @@ AllocFontFamily( FontFamily *familyPtr; FontAttributes fa; Tcl_Encoding encoding; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)base; GetFontAttributes(display, fontStructPtr, &fa); encoding = Tcl_GetEncoding(NULL, GetEncodingAlias(fa.xa.charset)); @@ -1846,7 +1856,7 @@ AllocFontFamily( } } - familyPtr = ckalloc(sizeof(FontFamily)); + familyPtr = (FontFamily *)ckalloc(sizeof(FontFamily)); memset(familyPtr, 0, sizeof(FontFamily)); familyPtr->nextPtr = tsdPtr->fontFamilyList; tsdPtr->fontFamilyList = familyPtr; @@ -1903,7 +1913,7 @@ FreeFontFamily( FontFamily *familyPtr) /* The FontFamily to delete. */ { FontFamily **familyPtrPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int i; @@ -2216,10 +2226,10 @@ FontMapLoadPage( Tcl_Encoding encoding; XFontStruct *fontStructPtr; XCharStruct *widths; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - subFontPtr->fontMap[row] = ckalloc(FONTMAP_BITSPERPAGE / 8); + subFontPtr->fontMap[row] = (char *)ckalloc(FONTMAP_BITSPERPAGE / 8); memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8); if (subFontPtr->familyPtr == &tsdPtr->controlFamily) { @@ -2551,7 +2561,7 @@ CanUseFallback( * make a copy. */ - nameList = ckalloc(numNames * sizeof(char *)); + nameList = (char **)ckalloc(numNames * sizeof(char *)); memcpy(nameList, nameListOrig, numNames * sizeof(char *)); } nameList[nameIdx] = NULL; @@ -2596,7 +2606,7 @@ CanUseFallback( if (fontPtr->numSubFonts >= SUBFONT_SPACE) { SubFont *newPtr; - newPtr = ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1)); + newPtr = (SubFont *)ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1)); memcpy(newPtr, fontPtr->subFontArray, fontPtr->numSubFonts * sizeof(SubFont)); if (fixSubFontPtrPtr != NULL) { diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c index b0aa2fa..6fa7970 100644 --- a/unix/tkUnixInit.c +++ b/unix/tkUnixInit.c @@ -37,8 +37,10 @@ static int GetLibraryPath(Tcl_Interp *interp); int TkpInit( - Tcl_Interp *interp) + Tcl_Interp *dummy) { + (void)dummy; + TkCreateXEventSource(); GetLibraryPath(interp); return TCL_OK; diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c index fa93edc..89e8d0a 100644 --- a/unix/tkUnixKey.c +++ b/unix/tkUnixKey.c @@ -229,7 +229,7 @@ TkpGetString( */ done: - kePtr->charValuePtr = ckalloc(len + 1); + kePtr->charValuePtr = (char *)ckalloc(len + 1); kePtr->charValueLen = len; memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), len + 1); return Tcl_DStringValue(dsPtr); @@ -279,9 +279,9 @@ TkpSetKeycodeAndState( mincode = 0; maxcode = -1; XDisplayKeycodes(dispPtr->display, &mincode, &maxcode); - if (keycode < mincode) { + if (keycode < (KeyCode)mincode) { keycode = mincode; - } else if (keycode > maxcode) { + } else if (keycode > (KeyCode)maxcode) { keycode = maxcode; } @@ -486,7 +486,7 @@ TkpInitKeymapInfo( } dispPtr->numModKeyCodes = 0; arraySize = KEYCODE_ARRAY_SIZE; - dispPtr->modKeyCodes = ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode)); + dispPtr->modKeyCodes = (KeyCode *)ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode)); for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) { if (*codePtr == 0) { continue; @@ -513,7 +513,7 @@ TkpInitKeymapInfo( */ arraySize *= 2; - newCodes = ckalloc(arraySize * sizeof(KeyCode)); + newCodes = (KeyCode *)ckalloc(arraySize * sizeof(KeyCode)); memcpy(newCodes, dispPtr->modKeyCodes, dispPtr->numModKeyCodes * sizeof(KeyCode)); ckfree(dispPtr->modKeyCodes); diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 6abb2fd..095af3b 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -147,6 +147,8 @@ void TkpDestroyMenu( TkMenu *menuPtr) { + (void)menuPtr; + /* * Nothing to do. */ @@ -173,6 +175,8 @@ void TkpDestroyMenuEntry( TkMenuEntry *mEntryPtr) { + (void)mEntryPtr; + /* * Nothing to do. */ @@ -241,6 +245,8 @@ int TkpMenuNewEntry( TkMenuEntry *mePtr) { + (void)mePtr; + return TCL_OK; } @@ -296,6 +302,10 @@ TkpSetMainMenubar( Tk_Window tkwin, const char *menuName) { + (void)interp; + (void)tkwin; + (void)menuName; + /* * Nothing to do. */ @@ -329,6 +339,8 @@ GetMenuIndicatorGeometry( int *heightPtr) /* The resulting height */ { int borderWidth; + (void)tkfont; + (void)fmPtr; if ((mePtr->type == CHECK_BUTTON_ENTRY) || (mePtr->type == RADIO_BUTTON_ENTRY)) { @@ -560,6 +572,10 @@ DrawMenuEntryIndicator( int width, /* Width of menu entry */ int height) /* Height of menu entry */ { + (void)tkfont; + (void)fmPtr; + (void)width; + /* * Draw check-button indicator. */ @@ -632,6 +648,10 @@ DrawMenuSeparator( { XPoint points[2]; Tk_3DBorder border; + (void)mePtr; + (void)gc; + (void)tkfont; + (void)fmPtr; if (menuPtr->menuType == MENUBAR) { return; @@ -789,7 +809,7 @@ DrawMenuEntryLabel( imageHeight, d, leftEdge + imageXOffset, (int) (y + (mePtr->height-imageHeight)/2 + imageYOffset)); } - } else if (mePtr->bitmapPtr != None) { + } else if (mePtr->bitmapPtr != NULL) { Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr); XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0, @@ -817,7 +837,7 @@ DrawMenuEntryLabel( XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y, (unsigned) width, (unsigned) height); } else if ((mePtr->image != NULL) - && (menuPtr->disabledImageGC != None)) { + && (menuPtr->disabledImageGC != NULL)) { XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC, leftEdge + imageXOffset, (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), @@ -853,6 +873,8 @@ DrawMenuUnderline( int x, int y, int width, int height) { + (void)width; + if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; @@ -930,13 +952,14 @@ TkpPostMenu( int TkpPostTearoffMenu( - Tcl_Interp *interp, /* The interpreter of the menu */ + Tcl_Interp *dummy, /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The root X,Y coordinates where the * specified entry will be posted */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; + (void)dummy; if (index >= (int)menuPtr->numEntries) { index = menuPtr->numEntries - 1; @@ -1027,6 +1050,10 @@ GetMenuSeparatorGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { + (void)menuPtr; + (void)mePtr; + (void)tkfont; + *widthPtr = 0; *heightPtr = fmPtr->linespace; } @@ -1056,6 +1083,8 @@ GetTearoffEntryGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { + (void)mePtr; + if (menuPtr->menuType != MASTER_MENU) { *heightPtr = 0; *widthPtr = 0; @@ -1279,6 +1308,10 @@ DrawTearoffEntry( XPoint points[2]; int segmentWidth, maxX; Tk_3DBorder border; + (void)mePtr; + (void)gc; + (void)tkfont; + (void)fmPtr; if (menuPtr->menuType != MASTER_MENU) { return; @@ -1327,6 +1360,9 @@ TkpInitializeMenuBindings( Tk_BindingTable bindingTable) /* The table to add to. */ { + (void)interp; + (void)bindingTable; + /* * Nothing to do. */ @@ -1375,7 +1411,7 @@ SetHelpMenu( && (cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin != NULL) && (menuPtr->masterMenuPtr->tkwin != NULL)) { TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr; - char *helpMenuName = ckalloc(strlen(Tk_PathName( + char *helpMenuName = (char *)ckalloc(strlen(Tk_PathName( masterMenuPtr->tkwin)) + strlen(".help") + 1); strcpy(helpMenuName, Tk_PathName(masterMenuPtr->tkwin)); @@ -1851,9 +1887,12 @@ TkpComputeStandardMenuGeometry( void TkpMenuNotifyToplevelCreate( - Tcl_Interp *interp, /* The interp the menu lives in. */ + Tcl_Interp *dummy, /* The interp the menu lives in. */ const char *menuName) /* The name of the menu to reconfigure. */ { + (void)dummy; + (void)menuName; + /* * Nothing to do. */ diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 37b2f95..3ab223b 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -87,6 +87,7 @@ void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { + (void)mainPtr; } static XftFont * @@ -272,7 +273,7 @@ InitFont( int i, iWidth; if (!fontPtr) { - fontPtr = ckalloc(sizeof(UnixFtFont)); + fontPtr = (UnixFtFont *)ckalloc(sizeof(UnixFtFont)); } FcConfigSubstitute(0, pattern, FcMatchPattern); @@ -290,7 +291,7 @@ InitFont( fontPtr->fontset = set; fontPtr->pattern = pattern; - fontPtr->faces = ckalloc(set->nfont * sizeof(UnixFtFace)); + fontPtr->faces = (UnixFtFace *)ckalloc(set->nfont * sizeof(UnixFtFace)); fontPtr->nfaces = set->nfont; /* @@ -639,6 +640,7 @@ TkpGetFontAttrsForChar( /* UCS-4 character to map */ XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0); /* Actual font used to render the character */ + (void)tkwin; GetTkFontAttributes(ftFont, faPtr); faPtr->underline = fontPtr->font.fa.underline; @@ -898,7 +900,7 @@ Tk_DrawChars( } XGetGCValues(display, gc, GCForeground, &values); xftcolor = LookUpColor(display, fontPtr, values.foreground); - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; @@ -948,7 +950,7 @@ Tk_DrawChars( } doUnderlineStrikeout: - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, NULL); } if (fontPtr->font.fa.underline != 0) { @@ -1142,7 +1144,7 @@ TkDrawAngledChars( } XGetGCValues(display, gc, GCForeground, &values); xftcolor = LookUpColor(display, fontPtr, values.foreground); - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; @@ -1194,7 +1196,7 @@ TkDrawAngledChars( #endif /* XFT_HAS_FIXED_ROTATED_PLACEMENT */ doUnderlineStrikeout: - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, NULL); } if (fontPtr->font.fa.underline || fontPtr->font.fa.overstrike) { diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c index c51aa18..69843db 100644 --- a/unix/tkUnixScrlbr.c +++ b/unix/tkUnixScrlbr.c @@ -63,7 +63,7 @@ TkScrollbar * TkpCreateScrollbar( Tk_Window tkwin) { - UnixScrollbar *scrollPtr = ckalloc(sizeof(UnixScrollbar)); + UnixScrollbar *scrollPtr = (UnixScrollbar *)ckalloc(sizeof(UnixScrollbar)); scrollPtr->troughGC = NULL; scrollPtr->copyGC = NULL; @@ -97,7 +97,7 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; Tk_Window tkwin = scrollPtr->tkwin; XPoint points[7]; Tk_3DBorder border; @@ -399,17 +399,17 @@ TkpConfigureScrollbar( * already have values for some fields. */ { XGCValues gcValues; - GC new; + GC newGC; UnixScrollbar *unixScrollPtr = (UnixScrollbar *) scrollPtr; Tk_SetBackgroundFromBorder(scrollPtr->tkwin, scrollPtr->bgBorder); gcValues.foreground = scrollPtr->troughColorPtr->pixel; - new = Tk_GetGC(scrollPtr->tkwin, GCForeground, &gcValues); + newGC = Tk_GetGC(scrollPtr->tkwin, GCForeground, &gcValues); if (unixScrollPtr->troughGC != NULL) { Tk_FreeGC(scrollPtr->display, unixScrollPtr->troughGC); } - unixScrollPtr->troughGC = new; + unixScrollPtr->troughGC = newGC; if (unixScrollPtr->copyGC == NULL) { gcValues.graphics_exposures = False; unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin, diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index 11161b7..58c3abc 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -250,7 +250,7 @@ TkSelPropProc( long buffer[TK_SEL_WORDS_AT_ONCE]; TkDisplay *dispPtr = TkGetDisplay(eventPtr->xany.display); Tk_ErrorHandler errorHandler; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -356,7 +356,7 @@ TkSelPropProc( ((char *) buffer)[numItems] = 0; errorHandler = Tk_CreateErrorHandler(eventPtr->xproperty.display, - -1, -1, -1, (int (*)()) NULL, NULL); + -1, -1, -1, NULL, NULL); /* * Encode the data using the proper format for each type. @@ -649,7 +649,7 @@ TkSelEventProc( } if (propInfo[numItems] != '\0') { - propData = ckalloc(numItems + 1); + propData = (char *)ckalloc(numItems + 1); strcpy(propData, propInfo); propData[numItems] = '\0'; } @@ -742,7 +742,7 @@ static void SelTimeoutProc( ClientData clientData) /* Information about retrieval in progress. */ { - TkSelRetrievalInfo *retrPtr = clientData; + TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData; /* * Make sure that the retrieval is still in progress. Then see how long @@ -813,11 +813,11 @@ ConvertSelection( Tk_ErrorHandler errorHandler; TkSelectionInfo *infoPtr; TkSelInProgress ip; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,-1, - (int (*)()) NULL, NULL); + errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1, + -1, NULL, NULL); /* * Initialize the reply event. @@ -893,7 +893,7 @@ ConvertSelection( * below). */ - incr.converts = ckalloc(incr.numConversions * sizeof(ConvertInfo)); + incr.converts = (ConvertInfo *)ckalloc(incr.numConversions * sizeof(ConvertInfo)); incr.numIncrs = 0; for (i = 0; i < incr.numConversions; i++) { Atom target, property, type; @@ -1064,7 +1064,7 @@ ConvertSelection( } Tcl_DeleteTimerHandler(incr.timeout); errorHandler = Tk_CreateErrorHandler(winPtr->display, - -1, -1, -1, (int (*)()) NULL, NULL); + -1, -1, -1, NULL, NULL); XSelectInput(reply.xsel.display, reply.xsel.requestor, 0L); Tk_DeleteErrorHandler(errorHandler); if (tsdPtr->pendingIncrs == &incr) { @@ -1126,7 +1126,7 @@ SelRcvIncrProc( ClientData clientData, /* Information about retrieval. */ XEvent *eventPtr) /* X PropertyChange event. */ { - TkSelRetrievalInfo *retrPtr = clientData; + TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData; char *propInfo, **propInfoPtr = &propInfo; Atom type; int format, result; @@ -1374,7 +1374,7 @@ IncrTimeoutProc( * retrieval for which we are selection * owner. */ { - IncrInfo *incrPtr = clientData; + IncrInfo *incrPtr = (IncrInfo *)clientData; incrPtr->idleTime++; if (incrPtr->idleTime >= 5) { @@ -1435,7 +1435,7 @@ SelCvtToX( if (Tcl_SplitList(NULL, string, &numFields, &field) != TCL_OK) { return NULL; } - propPtr = ckalloc(numFields * sizeof(long)); + propPtr = (long *)ckalloc(numFields * sizeof(long)); /* * Convert the fields one-by-one. @@ -1528,6 +1528,9 @@ SelCvtFromX8( Tk_Window tkwin, /* Window to use for atom conversion. */ Tcl_DString *dsPtr) /* Where to store the converted string. */ { + (void)type; + (void)tkwin; + /* * Convert each long in the property to a string value, which is a * hexadecimal string. We build the list in a Tcl_DString because this is diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 4a24a89..ca588df 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.c @@ -269,7 +269,7 @@ RegOpen( handler = Tk_CreateErrorHandler(dispPtr->display, -1, -1, -1, NULL, NULL); - regPtr = ckalloc(sizeof(NameRegistry)); + regPtr = (NameRegistry *)ckalloc(sizeof(NameRegistry)); regPtr->dispPtr = dispPtr; regPtr->locked = 0; regPtr->modified = 0; @@ -479,7 +479,7 @@ RegAddName( sprintf(id, "%x ", (unsigned) commWindow); idLength = strlen(id); newBytes = idLength + strlen(name) + 1; - newProp = ckalloc(regPtr->propLength + newBytes); + newProp = (char *)ckalloc(regPtr->propLength + newBytes); strcpy(newProp, id); strcpy(newProp+idLength, name); if (regPtr->property != NULL) { @@ -808,7 +808,7 @@ Tk_SetAppName( const char *actualName; Tcl_DString dString; int offset, i; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); interp = winPtr->mainPtr->interp; @@ -830,7 +830,7 @@ Tk_SetAppName( * the "send" command to the interpreter. */ - riPtr = ckalloc(sizeof(RegisteredInterp)); + riPtr = (RegisteredInterp *)ckalloc(sizeof(RegisteredInterp)); riPtr->interp = interp; riPtr->dispPtr = winPtr->dispPtr; riPtr->nextPtr = tsdPtr->interpListPtr; @@ -914,7 +914,7 @@ Tk_SetAppName( RegAddName(regPtr, actualName, Tk_WindowId(dispPtr->commTkwin)); RegClose(regPtr); - riPtr->name = ckalloc(strlen(actualName) + 1); + riPtr->name = (char *)ckalloc(strlen(actualName) + 1); strcpy(riPtr->name, actualName); if (actualName != name) { Tcl_DStringFree(&dString); @@ -943,7 +943,7 @@ Tk_SetAppName( int Tk_SendObjCmd( - ClientData clientData, /* Information about sender (only dispPtr + ClientData dummy, /* Information about sender (only dispPtr * field is used). */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -967,10 +967,11 @@ Tk_SendObjCmd( Tcl_Time timeout; NameRegistry *regPtr; Tcl_DString request; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_Interp *localInterp; /* Used when the interpreter to send the * command to is within the same process. */ + (void)dummy; /* * Process options, if any. @@ -1175,7 +1176,7 @@ Tk_SendObjCmd( msg = "target application died"; } pending.code = TCL_ERROR; - pending.result = ckalloc(strlen(msg) + 1); + pending.result = (char *)ckalloc(strlen(msg) + 1); strcpy(pending.result, msg); pending.gotResponse = 1; } else { @@ -1356,12 +1357,13 @@ TkSendCleanup( static int SendInit( - Tcl_Interp *interp, /* Interpreter to use for error reporting (no + Tcl_Interp *dummy, /* Interpreter to use for error reporting (no * errors are ever returned, but the * interpreter is needed anyway). */ TkDisplay *dispPtr) /* Display to initialize. */ { XSetWindowAttributes atts; + (void)dummy; /* * Create the window used for communication, and set up an event handler @@ -1419,14 +1421,14 @@ SendEventProc( ClientData clientData, /* Display information. */ XEvent *eventPtr) /* Information about event. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; char *propInfo, **propInfoPtr = &propInfo; const char *p; int result, actualFormat; unsigned long numItems, bytesAfter; Atom actualType; Tcl_Interp *remoteInterp; /* Interp in which to execute the command. */ - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if ((eventPtr->xproperty.atom != dispPtr->commProperty) @@ -1698,16 +1700,16 @@ SendEventProc( } pcPtr->code = code; if (resultString != NULL) { - pcPtr->result = ckalloc(strlen(resultString) + 1); + pcPtr->result = (char *)ckalloc(strlen(resultString) + 1); strcpy(pcPtr->result, resultString); } if (code == TCL_ERROR) { if (errorInfo != NULL) { - pcPtr->errorInfo = ckalloc(strlen(errorInfo) + 1); + pcPtr->errorInfo = (char *)ckalloc(strlen(errorInfo) + 1); strcpy(pcPtr->errorInfo, errorInfo); } if (errorCode != NULL) { - pcPtr->errorCode = ckalloc(strlen(errorCode) + 1); + pcPtr->errorCode = (char *)ckalloc(strlen(errorCode) + 1); strcpy(pcPtr->errorCode, errorCode); } } @@ -1780,10 +1782,11 @@ AppendErrorProc( ClientData clientData, /* Command to mark complete, or NULL. */ XErrorEvent *errorPtr) /* Information about error. */ { - PendingCommand *pendingPtr = clientData; + PendingCommand *pendingPtr = (PendingCommand *)clientData; PendingCommand *pcPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)errorPtr; if (pendingPtr == NULL) { return 0; @@ -1796,7 +1799,7 @@ AppendErrorProc( for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL; pcPtr = pcPtr->nextPtr) { if ((pcPtr == pendingPtr) && (pcPtr->result == NULL)) { - pcPtr->result = ckalloc(strlen(pcPtr->target) + 50); + pcPtr->result = (char *)ckalloc(strlen(pcPtr->target) + 50); sprintf(pcPtr->result, "no application named \"%s\"", pcPtr->target); pcPtr->code = TCL_ERROR; @@ -1829,10 +1832,10 @@ DeleteProc( ClientData clientData) /* Info about registration, passed as * ClientData. */ { - RegisteredInterp *riPtr = clientData; + RegisteredInterp *riPtr = (RegisteredInterp *)clientData; RegisteredInterp *riPtr2; NameRegistry *regPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); regPtr = RegOpen(riPtr->interp, riPtr->dispPtr, 1); @@ -1877,10 +1880,11 @@ DeleteProc( /* ARGSUSED */ static Tk_RestrictAction SendRestrictProc( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ XEvent *eventPtr) /* Event that just arrived. */ { TkDisplay *dispPtr; + (void)dummy; if (eventPtr->type != PropertyNotify) { return TK_DEFER_EVENT; @@ -1921,7 +1925,7 @@ UpdateCommWindow( { Tcl_DString names; RegisteredInterp *riPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DStringInit(&names); @@ -1968,7 +1972,7 @@ TkpTestsendCmd( static const char *const testsendOptions[] = { "bogus", "prop", "serial", NULL }; - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; Tk_ErrorHandler handler; int index; diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 490a1ea..65cfceb 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -567,7 +567,7 @@ TkWmNewWindow( WmInfo *wmPtr; TkDisplay *dispPtr = winPtr->dispPtr; - wmPtr = ckalloc(sizeof(WmInfo)); + wmPtr = (WmInfo *)ckalloc(sizeof(WmInfo)); memset(wmPtr, 0, sizeof(WmInfo)); wmPtr->winPtr = winPtr; wmPtr->reparent = None; @@ -1013,7 +1013,7 @@ Tk_WmObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", @@ -1190,6 +1190,7 @@ WmAspectCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; + (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -1392,6 +1393,7 @@ WmAttributesCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int attribute = 0; + (void)tkwin; if (objc == 3) { /* wm attributes $win */ Tcl_Obj *result = Tcl_NewListObj(0,0); @@ -1400,7 +1402,7 @@ WmAttributesCmd( Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(WmAttributeNames[attribute], -1)); Tcl_ListObjAppendElement(interp, result, - WmGetAttribute(winPtr, attribute)); + WmGetAttribute(winPtr, (WmAttribute)attribute)); } Tcl_SetObjResult(interp, result); return TCL_OK; @@ -1409,7 +1411,7 @@ WmAttributesCmd( sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } - Tcl_SetObjResult(interp, WmGetAttribute(winPtr, attribute)); + Tcl_SetObjResult(interp, WmGetAttribute(winPtr, (WmAttribute)attribute)); return TCL_OK; } else if ((objc - 3) % 2 == 0) { /* wm attributes $win -att value... */ int i; @@ -1419,7 +1421,7 @@ WmAttributesCmd( sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } - if (WmSetAttribute(winPtr,interp,attribute,objv[i+1]) != TCL_OK) { + if (WmSetAttribute(winPtr,interp,(WmAttribute)attribute,objv[i+1]) != TCL_OK) { return TCL_ERROR; } } @@ -1457,6 +1459,7 @@ WmClientCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name?"); @@ -1485,7 +1488,7 @@ WmClientCmd( if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); } - wmPtr->clientMachine = ckalloc(objv[3]->length + 1); + wmPtr->clientMachine = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->clientMachine, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; @@ -1583,7 +1586,7 @@ WmColormapwindowsCmd( != TCL_OK) { return TCL_ERROR; } - cmapList = ckalloc((windowObjc+1) * sizeof(Window)); + cmapList = (Window *)ckalloc((windowObjc+1) * sizeof(Window)); gotToplevel = 0; for (i = 0; i < windowObjc; i++) { Tk_Window mapWin; @@ -1645,6 +1648,7 @@ WmCommandCmd( const char *argv3; int cmdArgc; const char **cmdArgv; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); @@ -1711,6 +1715,7 @@ WmDeiconifyCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1766,6 +1771,7 @@ WmFocusmodelCmd( enum options { OPT_ACTIVE, OPT_PASSIVE }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?"); @@ -1816,6 +1822,10 @@ WmForgetCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; + (void)tkwin; + (void)interp; + (void)objc; + (void)objv; if (Tk_IsTopLevel(frameWin)) { TkFocusJoin(winPtr); @@ -1871,6 +1881,7 @@ WmFrameCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; Window window; char buf[TCL_INTEGER_SPACE]; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1914,6 +1925,7 @@ WmGeometryCmd( char xSign, ySign; int width, height; const char *argv3; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?"); @@ -1972,6 +1984,7 @@ WmGridCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; + (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -2112,7 +2125,7 @@ WmGroupCmd( } wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr); wmPtr->hints.flags |= WindowGroupHint; - wmPtr->leaderName = ckalloc(objv[3]->length + 1); + wmPtr->leaderName = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->leaderName, argv3); } UpdateHints(winPtr); @@ -2147,6 +2160,7 @@ WmIconbitmapCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; + (void)tkwin; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?"); @@ -2205,6 +2219,7 @@ WmIconifyCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -2334,6 +2349,7 @@ WmIconnameCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; + (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); @@ -2349,7 +2365,7 @@ WmIconnameCmd( ckfree(wmPtr->iconName); } argv3 = Tcl_GetString(objv[3]); - wmPtr->iconName = ckalloc(objv[3]->length + 1); + wmPtr->iconName = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->iconName, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { UpdateTitle(winPtr); @@ -2388,6 +2404,7 @@ WmIconphotoCmd( Tk_PhotoImageBlock block; int i, size = 0, width, height, index = 0, x, y, isDefault = 0; unsigned long *iconPropertyData; + (void)tkwin; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, @@ -2434,7 +2451,7 @@ WmIconphotoCmd( * defines CARD32 arrays to use. [Bug 2902814] */ - iconPropertyData = attemptckalloc(sizeof(unsigned long) * size); + iconPropertyData = (unsigned long *)attemptckalloc(sizeof(unsigned long) * size); if (iconPropertyData == NULL) { return TCL_ERROR; } @@ -2535,6 +2552,7 @@ WmIconpositionCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); @@ -2712,6 +2730,9 @@ WmManageCmd( { Tk_Window frameWin = (Tk_Window) winPtr; WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; + (void)objc; + (void)objv; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -2774,6 +2795,7 @@ WmMaxsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -2833,6 +2855,7 @@ WmMinsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -2884,6 +2907,7 @@ WmOverrideredirectCmd( { int boolean, curValue; XSetWindowAttributes atts; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -2946,6 +2970,7 @@ WmPositionfromCmd( enum options { OPT_PROGRAM, OPT_USER }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?"); @@ -3012,6 +3037,7 @@ WmProtocolCmd( Atom protocol; const char *cmd; TkSizeT cmdLength; + (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); @@ -3079,7 +3105,7 @@ WmProtocolCmd( } cmd = TkGetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { - protPtr = ckalloc(HANDLER_SIZE(cmdLength)); + protPtr = (ProtocolHandler *)ckalloc(HANDLER_SIZE(cmdLength)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; @@ -3119,6 +3145,7 @@ WmResizableCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -3182,6 +3209,7 @@ WmSizefromCmd( enum options { OPT_PROGRAM, OPT_USER }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?"); @@ -3374,6 +3402,7 @@ WmStateCmd( enum options { OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN }; int index; + (void)tkwin; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?state?"); @@ -3476,6 +3505,7 @@ WmTitleCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; + (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); @@ -3492,7 +3522,7 @@ WmTitleCmd( ckfree(wmPtr->title); } argv3 = Tcl_GetString(objv[3]); - wmPtr->title = ckalloc(objv[3]->length + 1); + wmPtr->title = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->title, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { @@ -3677,6 +3707,7 @@ WmWithdrawCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3725,7 +3756,7 @@ WmWaitMapProc( ClientData clientData, /* Pointer to window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr; if (masterPtr == NULL) { @@ -4414,7 +4445,7 @@ WrapperEventProc( ClientData clientData, /* Information about toplevel window. */ XEvent *eventPtr) /* Event that just happened. */ { - WmInfo *wmPtr = clientData; + WmInfo *wmPtr = (WmInfo *)clientData; XEvent mapEvent; TkDisplay *dispPtr = wmPtr->winPtr->dispPtr; @@ -4502,6 +4533,7 @@ TopLevelReqProc( { TkWindow *winPtr = (TkWindow *) tkwin; WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)dummy; if (wmPtr == NULL) { return; @@ -4564,7 +4596,7 @@ static void UpdateGeometryInfo( ClientData clientData) /* Pointer to the window's record. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, min, max; unsigned long serial; @@ -5303,7 +5335,7 @@ WaitRestrictProc( ClientData clientData, /* Pointer to WaitRestrictInfo structure. */ XEvent *eventPtr) /* Event that is about to be handled. */ { - WaitRestrictInfo *infoPtr = clientData; + WaitRestrictInfo *infoPtr = (WaitRestrictInfo *)clientData; if (eventPtr->type == ReparentNotify) { return TK_PROCESS_EVENT; @@ -5459,7 +5491,7 @@ SetNetWmType( } if (objc > 0) { - atoms = ckalloc(sizeof(Atom) * objc); + atoms = (Atom *)ckalloc(sizeof(Atom) * objc); } for (n = 0; n < objc; ++n) { @@ -6242,7 +6274,7 @@ UpdateWmProtocols( protPtr = protPtr->nextPtr, count++) { /* Empty loop body; we're just counting the handlers. */ } - arrayPtr = ckalloc(count * sizeof(Atom)); + arrayPtr = (Atom *)ckalloc(count * sizeof(Atom)); deleteWindowAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr, "WM_DELETE_WINDOW"); pingAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr, "_NET_WM_PING"); @@ -6433,7 +6465,7 @@ TkWmStackorderToplevel( Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); - window_ptr = windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *)); + window_ptr = windows = (TkWindow **)ckalloc((table.numEntries+1) * sizeof(TkWindow *)); if (windows == NULL) { return NULL; } @@ -6449,7 +6481,7 @@ TkWmStackorderToplevel( goto done; case 1: hPtr = Tcl_FirstHashEntry(&table, &search); - windows[0] = Tcl_GetHashValue(hPtr); + windows[0] = (TkWindow *)Tcl_GetHashValue(hPtr); windows[1] = NULL; goto done; } @@ -6467,7 +6499,7 @@ TkWmStackorderToplevel( for (i = 0; i < numChildren; i++) { hPtr = Tcl_FindHashEntry(&table, children[i]); if (hPtr != NULL) { - childWinPtr = Tcl_GetHashValue(hPtr); + childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); *window_ptr++ = childWinPtr; } } @@ -6640,7 +6672,7 @@ TkWmAddToColormapWindows( * add the toplevel itself as the last element of the list. */ - newPtr = ckalloc((count+2) * sizeof(Window)); + newPtr = (Window *)ckalloc((count+2) * sizeof(Window)); for (i = 0; i < count; i++) { newPtr[i] = oldPtr[i]; } @@ -6875,7 +6907,7 @@ GetMaxSize( static void TkSetTransientFor(Tk_Window tkwin, Tk_Window parent) { - if (parent == None) { + if (parent == NULL) { parent = Tk_Parent(tkwin); while (!Tk_IsTopLevel(parent)) parent = Tk_Parent(parent); @@ -6993,7 +7025,7 @@ CreateWrapper( TkWindow *winPtr, *wrapperPtr; Window parent; Tcl_HashEntry *hPtr; - int new; + int isNew; winPtr = wmPtr->winPtr; if (winPtr->window == None) { @@ -7037,7 +7069,7 @@ CreateWrapper( InputOutput, wrapperPtr->visual, wrapperPtr->dirtyAtts|CWOverrideRedirect, &wrapperPtr->atts); hPtr = Tcl_CreateHashEntry(&wrapperPtr->dispPtr->winTable, - (char *) wrapperPtr->window, &new); + (char *) wrapperPtr->window, &isNew); Tcl_SetHashValue(hPtr, wrapperPtr); wrapperPtr->mainPtr = winPtr->mainPtr; wrapperPtr->mainPtr->refCount++; @@ -7256,7 +7288,7 @@ MenubarReqProc( * for tkwin's toplevel. */ Tk_Window tkwin) /* Handle for menubar window. */ { - WmInfo *wmPtr = clientData; + WmInfo *wmPtr = (WmInfo *)clientData; wmPtr->menuHeight = Tk_ReqHeight(tkwin); if (wmPtr->menuHeight <= 0) { @@ -7338,8 +7370,8 @@ UpdateCommand( * entire DString is done. */ - cmdArgv = ckalloc(sizeof(char *) * wmPtr->cmdArgc); - offsets = ckalloc(sizeof(int) * wmPtr->cmdArgc); + cmdArgv = (char **)ckalloc(sizeof(char *) * wmPtr->cmdArgc); + offsets = (int *)ckalloc(sizeof(int) * wmPtr->cmdArgc); Tcl_DStringInit(&cmds); for (i = 0; i < wmPtr->cmdArgc; i++) { Tcl_UtfToExternalDString(NULL, wmPtr->cmdArgv[i], -1, &ds); diff --git a/win/stubs.c b/win/stubs.c index 1796e17..faeac08 100644 --- a/win/stubs.c +++ b/win/stubs.c @@ -8,6 +8,8 @@ int _XInitImageFuncPtrs( XImage *image) { + (void)image; + return Success; } @@ -21,6 +23,9 @@ XSetWMClientMachine( Window w, XTextProperty *text_prop) { + (void)display; + (void)w; + (void)text_prop; } Status @@ -29,6 +34,10 @@ XStringListToTextProperty( int count, XTextProperty *text_prop_return) { + (void)list; + (void)count; + (void)text_prop_return; + return Success; } @@ -47,12 +56,22 @@ XChangeProperty( _Xconst unsigned char *data, int nelements) { + (void)display; + (void)w; + (void)property; + (void)type; + (void)format; + (void)mode; + (void)data; + (void)nelements; + return Success; } XIC XCreateIC(XIM xim, ...) { + (void)xim; return NULL; } @@ -62,6 +81,10 @@ XDeleteProperty( Window w, Atom property) { + (void)display; + (void)w; + (void)property; + return Success; } @@ -70,6 +93,9 @@ XFilterEvent( XEvent *event, Window window) { + (void)event; + (void)window; + return 0; } @@ -78,6 +104,9 @@ XForceScreenSaver( Display *display, int mode) { + (void)display; + (void)mode; + return Success; } @@ -86,6 +115,9 @@ XFreeCursor( Display *display, Cursor cursor) { + (void)display; + (void)cursor; + return Success; } @@ -93,6 +125,8 @@ GContext XGContextFromGC( GC gc) { + (void)gc; + return (GContext) NULL; } @@ -101,6 +135,9 @@ XGetAtomName( Display *display, Atom atom) { + (void)display; + (void)atom; + return NULL; } @@ -110,6 +147,10 @@ XGetWindowAttributes( Window w, XWindowAttributes *window_attributes_return) { + (void)display; + (void)w; + (void)window_attributes_return; + return Success; } @@ -120,6 +161,11 @@ XGetWMColormapWindows( Window **windows_return, int *count_return) { + (void)display; + (void)w; + (void)windows_return; + (void)count_return; + return Success; } @@ -129,6 +175,10 @@ XIconifyWindow( Window w, int screen_number) { + (void)display; + (void)w; + (void)screen_number; + return Success; } @@ -138,6 +188,10 @@ XListHosts( int *nhosts_return, Bool *state_return) { + (void)display; + (void)nhosts_return; + (void)state_return; + return NULL; } @@ -149,6 +203,12 @@ XLookupColor( XColor *exact_def_return, XColor *screen_def_return) { + (void)display; + (void)colormap; + (void)color_name; + (void)exact_def_return; + (void)screen_def_return; + return Success; } @@ -157,6 +217,9 @@ XNextEvent( Display *display, XEvent *event_return) { + (void)display; + (void)event_return; + return Success; } @@ -165,6 +228,9 @@ XPutBackEvent( Display *display, XEvent *event) { + (void)display; + (void)event; + return Success; } @@ -175,6 +241,11 @@ XQueryColors( XColor *defs_in_out, int ncolors) { + (void)display; + (void)colormap; + (void)defs_in_out; + (void)ncolors; + return Success; } @@ -187,6 +258,13 @@ XQueryTree( Window **children_return, unsigned int *nchildren_return) { + (void)display; + (void)w; + (void)root_return; + (void)parent_return; + (void)children_return; + (void)nchildren_return; + return Success; } @@ -194,6 +272,8 @@ int XRefreshKeyboardMapping( XMappingEvent *event_map) { + (void)event_map; + return Success; } @@ -202,6 +282,9 @@ XRootWindow( Display *display, int screen_number) { + (void)display; + (void)screen_number; + return (Window) NULL; } @@ -211,6 +294,10 @@ XSelectInput( Window w, long event_mask) { + (void)display; + (void)w; + (void)event_mask; + return Success; } @@ -222,6 +309,12 @@ XSendEvent( long event_mask, XEvent *event_send) { + (void)display; + (void)w; + (void)propagate; + (void)event_mask; + (void)event_send; + return Success; } @@ -232,6 +325,11 @@ XSetCommand( char **argv, int argc) { + (void)display; + (void)w; + (void)argv; + (void)argc; + return Success; } @@ -239,6 +337,8 @@ XErrorHandler XSetErrorHandler( XErrorHandler handler) { + (void)handler; + return NULL; } @@ -248,6 +348,10 @@ XSetIconName( Window w, _Xconst char *icon_name) { + (void)display; + (void)w; + (void)icon_name; + return Success; } @@ -257,6 +361,10 @@ XSetWindowBackground( Window w, unsigned long background_pixel) { + (void)display; + (void)w; + (void)background_pixel; + return Success; } @@ -266,6 +374,10 @@ XSetWindowBackgroundPixmap( Window w, Pixmap background_pixmap) { + (void)display; + (void)w; + (void)background_pixmap; + return Success; } @@ -275,6 +387,10 @@ XSetWindowBorder( Window w, unsigned long border_pixel) { + (void)display; + (void)w; + (void)border_pixel; + return Success; } @@ -284,6 +400,10 @@ XSetWindowBorderPixmap( Window w, Pixmap border_pixmap) { + (void)display; + (void)w; + (void)border_pixmap; + return Success; } @@ -293,6 +413,10 @@ XSetWindowBorderWidth( Window w, unsigned int width) { + (void)display; + (void)w; + (void)width; + return Success; } @@ -302,6 +426,10 @@ XSetWindowColormap( Window w, Colormap colormap) { + (void)display; + (void)w; + (void)colormap; + return Success; } @@ -316,6 +444,15 @@ XTranslateCoordinates( int *dest_y_return, Window *child_return) { + (void)display; + (void)src_w; + (void)dest_w; + (void)src_x; + (void)src_y; + (void)dest_x_return; + (void)dest_y_return; + (void)child_return; + return 0; } @@ -326,6 +463,11 @@ XWindowEvent( long event_mask, XEvent *event_return) { + (void)display; + (void)w; + (void)event_mask; + (void)event_return; + return Success; } @@ -335,6 +477,10 @@ XWithdrawWindow( Window w, int screen_number) { + (void)display; + (void)w; + (void)screen_number; + return Success; } @@ -347,6 +493,13 @@ XmbLookupString( KeySym *keysym_return, Status *status_return) { + (void)ic; + (void)event; + (void)buffer_return; + (void)bytes_buffer; + (void)keysym_return; + (void)status_return; + return Success; } @@ -357,7 +510,7 @@ XGetWindowProperty( Atom property, long long_offset, long long_length, - Bool delete, + Bool del, Atom req_type, Atom *actual_type_return, int *actual_format_return, @@ -365,6 +518,14 @@ XGetWindowProperty( unsigned long *bytes_after_return, unsigned char **prop_return) { + (void)display; + (void)w; + (void)property; + (void)long_offset; + (void)long_length; + (void)del; + (void)req_type; + *actual_type_return = None; *actual_format_return = 0; *nitems_return = 0; @@ -381,6 +542,8 @@ int XFlush( Display *display) { + (void)display; + return 0; } @@ -388,6 +551,8 @@ int XGrabServer( Display *display) { + (void)display; + return 0; } @@ -395,6 +560,8 @@ int XUngrabServer( Display *display) { + (void)display; + return 0; } @@ -421,6 +588,8 @@ XSynchronize( Display *display, Bool onoff) { + (void)onoff; + display->request++; return NULL; } @@ -430,6 +599,8 @@ XSync( Display *display, Bool discard) { + (void)discard; + display->request++; return 0; } @@ -447,5 +618,9 @@ XOffsetRegion( int dx, int dy) { + (void)rgn; + (void)dx; + (void)dy; + return 0; } diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 7bea983..739d71f 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -1746,7 +1746,7 @@ AllocFontFamily( Tcl_DString faceString; Tcl_Encoding encoding; WCHAR buf[LF_FACESIZE]; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); (void)base; @@ -2421,7 +2421,7 @@ CanUseFallback( if (fontPtr->numSubFonts >= SUBFONT_SPACE) { SubFont *newPtr; - newPtr = ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1)); + newPtr = (SubFont *)ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1)); memcpy(newPtr, fontPtr->subFontArray, fontPtr->numSubFonts * sizeof(SubFont)); if (fontPtr->subFontArray != fontPtr->staticSubFonts) { diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index f3adb26..5f5b215 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -388,7 +388,7 @@ TkpDestroyMenu( if (menuPtr->menuFlags & MENU_SYSTEM_MENU) { TkMenuEntry *searchEntryPtr; Tcl_HashTable *tablePtr = TkGetMenuHashTable(menuPtr->interp); - char *menuName = Tcl_GetHashKey(tablePtr, + char *menuName = (char *)Tcl_GetHashKey(tablePtr, menuPtr->menuRefPtr->hashEntryPtr); /* @@ -492,16 +492,16 @@ GetEntryText( char *itemText; if (mePtr->type == TEAROFF_ENTRY) { - itemText = ckalloc(sizeof("(Tear-off)")); + itemText = (char *)ckalloc(sizeof("(Tear-off)")); strcpy(itemText, "(Tear-off)"); } else if (mePtr->imagePtr != NULL) { - itemText = ckalloc(sizeof("(Image)")); + itemText = (char *)ckalloc(sizeof("(Image)")); strcpy(itemText, "(Image)"); } else if (mePtr->bitmapPtr != NULL) { - itemText = ckalloc(sizeof("(Pixmap)")); + itemText = (char *)ckalloc(sizeof("(Pixmap)")); strcpy(itemText, "(Pixmap)"); } else if (mePtr->labelPtr == NULL || mePtr->labelLength == 0) { - itemText = ckalloc(sizeof("( )")); + itemText = (char *)ckalloc(sizeof("( )")); strcpy(itemText, "( )"); } else { int i; @@ -541,7 +541,7 @@ GetEntryText( } } - itemText = ckalloc(Tcl_DStringLength(&itemString) + 1); + itemText = (char *)ckalloc(Tcl_DStringLength(&itemString) + 1); strcpy(itemText, Tcl_DStringValue(&itemString)); Tcl_DStringFree(&itemString); } @@ -569,7 +569,7 @@ static void ReconfigureWindowsMenu( ClientData clientData) /* The menu we are rebuilding */ { - TkMenu *menuPtr = clientData; + TkMenu *menuPtr = (TkMenu *)clientData; TkMenuEntry *mePtr; HMENU winMenuHdl = (HMENU) menuPtr->platformData; char *itemText = NULL; @@ -729,7 +729,7 @@ ReconfigureWindowsMenu( if ((menuPtr->menuType == MENUBAR) && (menuPtr->parentTopLevelPtr != NULL)) { - HANDLE bar = TkWinGetWrapperWindow(menuPtr->parentTopLevelPtr); + HWND bar = TkWinGetWrapperWindow(menuPtr->parentTopLevelPtr); if (bar) { DrawMenuBar(bar); @@ -760,7 +760,7 @@ ReconfigureWindowsMenu( int TkpPostMenu( - Tcl_Interp *interp, + Tcl_Interp *dummy, TkMenu *menuPtr, int x, int y, int index) { @@ -770,8 +770,9 @@ TkpPostMenu( POINT point; Tk_Window parentWindow = Tk_Parent(menuPtr->tkwin); int oldServiceMode = Tcl_GetServiceMode(); - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; tsdPtr->inPostMenu++; CallPendingReconfigureImmediately(menuPtr); @@ -870,13 +871,14 @@ TkpPostMenu( int TkpPostTearoffMenu( - Tcl_Interp *interp, /* The interpreter of the menu */ + Tcl_Interp *dummy, /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The root X,Y coordinates where we are * posting */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; + (void)dummy; if (index >= (int)menuPtr->numEntries) { index = menuPtr->numEntries - 1; @@ -1065,7 +1067,7 @@ TkWinEmbeddedMenuProc( { static int nIdles = 0; LRESULT lResult = 1; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); switch(message) { @@ -1141,15 +1143,16 @@ TkWinHandleMenuEvent( int returnResult = 0; TkMenu *menuPtr; TkMenuEntry *mePtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)phwnd; switch (*pMessage) { case WM_UNINITMENUPOPUP: hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *pwParam); if (hashEntryPtr != NULL) { - menuPtr = Tcl_GetHashValue(hashEntryPtr); + menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); if ((menuPtr->menuRefPtr != NULL) && (menuPtr->menuRefPtr->parentEntryPtr != NULL)) { TkPostSubmenu(menuPtr->interp, @@ -1164,7 +1167,7 @@ TkWinHandleMenuEvent( *pwParam); if (hashEntryPtr != NULL) { tsdPtr->oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); - menuPtr = Tcl_GetHashValue(hashEntryPtr); + menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); tsdPtr->modalMenuPtr = menuPtr; CallPendingReconfigureImmediately(menuPtr); RecursivelyClearActiveMenu(menuPtr); @@ -1200,7 +1203,7 @@ TkWinHandleMenuEvent( if (hashEntryPtr == NULL) { break; } - mePtr = Tcl_GetHashValue(hashEntryPtr); + mePtr = (TkMenuEntry *)Tcl_GetHashValue(hashEntryPtr); if (mePtr != NULL) { TkMenuReferences *menuRefPtr; TkMenuEntry *parentEntryPtr; @@ -1255,7 +1258,7 @@ TkWinHandleMenuEvent( Tcl_DString ds; *plResult = 0; - menuPtr = Tcl_GetHashValue(hashEntryPtr); + menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); /* * Assume we have something directly convertable to Tcl_UniChar. * True at least for wide systems. @@ -1327,7 +1330,7 @@ TkWinHandleMenuEvent( } mePtr = (TkMenuEntry *) itemPtr->itemData; menuPtr = mePtr->menuPtr; - twdPtr = ckalloc(sizeof(TkWinDrawable)); + twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable)); twdPtr->type = TWD_WINDC; twdPtr->winDC.hdc = itemPtr->hDC; @@ -1393,7 +1396,7 @@ TkWinHandleMenuEvent( hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *plParam); if (hashEntryPtr != NULL) { - menuPtr = Tcl_GetHashValue(hashEntryPtr); + menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); } } @@ -1418,7 +1421,7 @@ TkWinHandleMenuEvent( hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable, INT2PTR(entryIndex)); if (hashEntryPtr != NULL) { - mePtr = Tcl_GetHashValue(hashEntryPtr); + mePtr = (TkMenuEntry *)Tcl_GetHashValue(hashEntryPtr); } } } @@ -1507,7 +1510,7 @@ TkpSetWindowMenuBar( TkMenu *menuPtr) /* The menu we are inserting */ { HMENU winMenuHdl; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (menuPtr != NULL) { @@ -1555,6 +1558,10 @@ TkpSetMainMenubar( const char *menuName) /* The name of the menu to put in front. If * NULL, use the default menu bar. */ { + (void)interp; + (void)tkwin; + (void)menuName; + /* * Nothing to do. */ @@ -1585,6 +1592,10 @@ GetMenuIndicatorGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { + (void)menuPtr; + (void)tkfont; + (void)fmPtr; + *heightPtr = indicatorDimensions[0]; if (mePtr->hideMargin) { *widthPtr = 0; @@ -1668,6 +1679,9 @@ GetTearoffEntryGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { + (void)mePtr; + (void)tkfont; + if (menuPtr->menuType != MASTER_MENU) { *heightPtr = 0; } else { @@ -1701,6 +1715,10 @@ GetMenuSeparatorGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { + (void)menuPtr; + (void)mePtr; + (void)tkfont; + *widthPtr = 0; *heightPtr = fmPtr->linespace - (2 * fmPtr->descent); } @@ -1814,6 +1832,11 @@ DrawMenuEntryIndicator( int width, int height) { + (void)tkfont; + (void)fmPtr; + (void)width; + (void)height; + if ((mePtr->type == CHECK_BUTTON_ENTRY) || (mePtr->type == RADIO_BUTTON_ENTRY)) { if (mePtr->indicatorOn && (mePtr->entryFlags & ENTRY_SELECTED)) { @@ -1894,6 +1917,9 @@ DrawMenuEntryAccelerator( int baseline; int leftEdge = x + mePtr->indicatorSpace + mePtr->labelWidth; const char *accel; + (void)activeBorder; + (void)width; + (void)height; if (menuPtr->menuType == MENUBAR) { return; @@ -1967,6 +1993,8 @@ DrawMenuEntryArrow( COLORREF oldFgColor; COLORREF oldBgColor; RECT rect; + (void)gc; + (void)activeBorder; if (!drawArrow || (mePtr->type != CASCADE_ENTRY)) { return; @@ -2037,6 +2065,10 @@ DrawMenuSeparator( { XPoint points[2]; Tk_3DBorder border; + (void)mePtr; + (void)gc; + (void)tkfont; + (void)fmPtr; points[0].x = x; points[0].y = y + height / 2; @@ -2076,6 +2108,9 @@ DrawMenuUnderline( int width, /* Width of entry */ int height) /* Height of entry */ { + (void)fmPtr; + (void)width; + if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; @@ -2115,7 +2150,7 @@ DrawMenuUnderline( static int TkWinMenuKeyObjCmd( - ClientData clientData, /* Unused. */ + ClientData dummy, /* Unused. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2127,6 +2162,7 @@ TkWinMenuKeyObjCmd( TkWindow *winPtr; KeySym keySym; int i; + (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "window keySym"); @@ -2538,6 +2574,10 @@ DrawTearoffEntry( XPoint points[2]; int segmentWidth, maxX; Tk_3DBorder border; + (void)mePtr; + (void)gc; + (void)tkfont; + (void)fmPtr; if (menuPtr->menuType != MASTER_MENU) { return; @@ -2645,7 +2685,7 @@ TkpDrawMenuEntry( menuDc = TkWinGetDrawableDC(menuPtr->display, menuDrawable, &dcState); memDc = CreateCompatibleDC(menuDc); - oldBitmap = SelectObject(memDc, + oldBitmap = (HBITMAP)SelectObject(memDc, CreateCompatibleBitmap(menuDc, width, height) ); memWinDraw.type = TWD_WINDC; @@ -3203,8 +3243,9 @@ HWND Tk_GetMenuHWND( Tk_Window tkwin) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)tkwin; TkMenuInit(); return tsdPtr->embeddedMenuHWND; @@ -3228,8 +3269,10 @@ Tk_GetMenuHWND( static void MenuExitHandler( - ClientData clientData) /* Not used */ + ClientData dummy) /* Not used */ { + (void)dummy; + UnregisterClassW(MENU_CLASS_NAME, Tk_GetHINSTANCE()); UnregisterClassW(EMBEDDED_MENU_CLASS_NAME, Tk_GetHINSTANCE()); } @@ -3253,10 +3296,11 @@ MenuExitHandler( static void MenuThreadExitHandler( - ClientData clientData) /* Not used */ + ClientData dummy) /* Not used */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; DestroyWindow(tsdPtr->menuHWND); DestroyWindow(tsdPtr->embeddedMenuHWND); @@ -3293,6 +3337,8 @@ TkWinGetMenuSystemDefault( const char *className) /* The name of the option class. */ { Tcl_Obj *valuePtr = NULL; + (void)tkwin; + (void)className; if ((strcmp(dbName, "activeBorderWidth") == 0) || (strcmp(dbName, "borderWidth") == 0)) { @@ -3491,7 +3537,7 @@ TkpMenuInit(void) void TkpMenuThreadInit(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->menuHWND = CreateWindowW(MENU_CLASS_NAME, L"MenuWindow", WS_POPUP, diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c index e28f348..d189245 100644 --- a/win/tkWinPixmap.c +++ b/win/tkWinPixmap.c @@ -42,7 +42,7 @@ Tk_GetPixmap( display->request++; - newTwdPtr = ckalloc(sizeof(TkWinDrawable)); + newTwdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable)); newTwdPtr->type = TWD_BITMAP; newTwdPtr->bitmap.depth = depth; twdPtr = (TkWinDrawable *) d; @@ -208,6 +208,12 @@ XGetGeometry( unsigned int *depth_return) { TkWinDrawable *twdPtr = (TkWinDrawable *)d; + (void)display; + (void)root_return; + (void)x_return; + (void)y_return; + (void)border_width_return; + (void)depth_return; if (twdPtr->type == TWD_BITMAP) { HDC dc; diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index 06cbe67..a983ec4 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -179,6 +179,12 @@ XGrabKeyboard( int keyboard_mode, Time time) { + (void)display; + (void)owner_events; + (void)pointer_mode; + (void)keyboard_mode; + (void)time; + keyboardWinPtr = TkWinGetWinPtr(grab_window); return GrabSuccess; } @@ -204,6 +210,9 @@ XUngrabKeyboard( Display *display, Time time) { + (void)display; + (void)time; + keyboardWinPtr = NULL; return Success; } @@ -226,9 +235,10 @@ XUngrabKeyboard( void MouseTimerProc( - ClientData clientData) + ClientData dummy) { POINT pos; + (void)dummy; mouseTimerSet = 0; @@ -290,6 +300,7 @@ TkGetPointerCoords( int *xPtr, int *yPtr) /* Store pointer coordinates here. */ { POINT point; + (void)tkwin; GetCursorPos(&point); *xPtr = point.x; @@ -327,6 +338,12 @@ XQueryPointer( int *win_y_return, unsigned int *mask_return) { + (void)w; + (void)root_return; + (void)child_return; + (void)win_x_return; + (void)win_y_return; + display->request++; TkGetPointerCoords(NULL, root_x_return, root_y_return); *mask_return = TkWinGetModifierState(); @@ -401,6 +418,12 @@ XWarpPointer( int dest_y) { RECT r; + (void)display; + (void)src_w; + (void)src_x; + (void)src_y; + (void)src_width; + (void)src_height; GetWindowRect(Tk_GetHWND(dest_w), &r); TkSetCursorPos(r.left+dest_x, r.top+dest_y); @@ -475,6 +498,9 @@ XSetInputFocus( int revert_to, Time time) { + (void)revert_to; + (void)time; + display->request++; if (focus != None) { SetFocus(Tk_GetHWND(focus)); diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 40f7186..9f8c636 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -82,7 +82,7 @@ const Tk_ClassProcs tkpScrollbarProcs = { static void WinScrollbarEventProc(ClientData clientData, XEvent *eventPtr) { - WinScrollbar *scrollPtr = clientData; + WinScrollbar *scrollPtr = (WinScrollbar *)clientData; if (eventPtr->type == ButtonPress) { ModalLoop(scrollPtr, eventPtr); @@ -121,7 +121,7 @@ TkpCreateScrollbar( Tcl_MutexUnlock(&winScrlbrMutex); } - scrollPtr = ckalloc(sizeof(WinScrollbar)); + scrollPtr = (WinScrollbar *)ckalloc(sizeof(WinScrollbar)); scrollPtr->winFlags = 0; scrollPtr->hwnd = NULL; @@ -275,7 +275,7 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - WinScrollbar *scrollPtr = clientData; + WinScrollbar *scrollPtr = (WinScrollbar *)clientData; Tk_Window tkwin = scrollPtr->info.tkwin; scrollPtr->info.flags &= ~REDRAW_PENDING; @@ -595,6 +595,7 @@ TkpConfigureScrollbar( /* Information about widget; may or may not * already have values for some fields. */ { + (void)scrollPtr; } /* diff --git a/win/tkWinSend.c b/win/tkWinSend.c index 8acc568..0841df1 100644 --- a/win/tkWinSend.c +++ b/win/tkWinSend.c @@ -121,6 +121,8 @@ Tk_SetAppName( * be globally unique. */ { #ifndef TK_SEND_ENABLED_ON_WINDOWS + (void)tkwin; + /* * Temporarily disabled for bug #858822 */ @@ -213,6 +215,8 @@ TkGetInterpNames( * lookup. */ { #ifndef TK_SEND_ENABLED_ON_WINDOWS + (void)interp; + (void)tkwin; /* * Temporarily disabled for bug #858822 */ @@ -735,7 +739,7 @@ Send( * object. */ Tcl_Interp *interp, /* The local interpreter. */ int async, /* Flag for the calling style. */ - ClientData clientData, /* The RegisteredInterp structure for this + ClientData dummy, /* The RegisteredInterp structure for this * interp. */ int objc, /* Number of arguments to be sent. */ Tcl_Obj *const objv[]) /* The arguments to be sent. */ @@ -749,6 +753,7 @@ Send( DISPID dispid; Tcl_DString ds; const char *src; + (void)dummy; cmd = Tcl_ConcatObj(objc, objv); @@ -926,7 +931,7 @@ TkWinSend_QueueCommand( TRACE("SendQueueCommand()\n"); - evPtr = ckalloc(sizeof(SendEvent)); + evPtr = (SendEvent *)ckalloc(sizeof(SendEvent)); evPtr->header.proc = SendEventProc; evPtr->header.nextPtr = NULL; evPtr->interp = interp; @@ -968,6 +973,7 @@ SendEventProc( int flags) { SendEvent *evPtr = (SendEvent *)eventPtr; + (void)flags; TRACE("SendEventProc\n"); diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c index 2422300..536c6c1 100644 --- a/win/tkWinSendCom.c +++ b/win/tkWinSendCom.c @@ -166,17 +166,17 @@ WinSendCom_QueryInterface( void **ppvObject) { HRESULT hr = E_NOINTERFACE; - TkWinSendCom *this = (TkWinSendCom *) This; + TkWinSendCom *sendCom = (TkWinSendCom *) This; *ppvObject = NULL; if (memcmp(riid, &IID_IUnknown, sizeof(IID)) == 0 || memcmp(riid, &IID_IDispatch, sizeof(IID)) == 0) { - *ppvObject = (void **) this; - this->lpVtbl->AddRef(This); + *ppvObject = (void **) sendCom; + sendCom->lpVtbl->AddRef(This); hr = S_OK; } else if (memcmp(riid, &IID_ISupportErrorInfo, sizeof(IID)) == 0) { - *ppvObject = (void **) (this + 1); - this->lpVtbl2->AddRef((ISupportErrorInfo *) (this + 1)); + *ppvObject = (void **) (sendCom + 1); + sendCom->lpVtbl2->AddRef((ISupportErrorInfo *) (sendCom + 1)); hr = S_OK; } return hr; @@ -186,9 +186,9 @@ static STDMETHODIMP_(ULONG) WinSendCom_AddRef( IDispatch *This) { - TkWinSendCom *this = (TkWinSendCom*)This; + TkWinSendCom *sendCom = (TkWinSendCom*)This; - return InterlockedIncrement(&this->refcount); + return InterlockedIncrement(&sendCom->refcount); } static STDMETHODIMP_(ULONG) @@ -196,9 +196,9 @@ WinSendCom_Release( IDispatch *This) { long r = 0; - TkWinSendCom *this = (TkWinSendCom*)This; + TkWinSendCom *sendCom = (TkWinSendCom*)This; - if ((r = InterlockedDecrement(&this->refcount)) == 0) { + if ((r = InterlockedDecrement(&sendCom->refcount)) == 0) { TkWinSendCom_Destroy(This); } return r; @@ -210,6 +210,7 @@ WinSendCom_GetTypeInfoCount( UINT *pctinfo) { HRESULT hr = E_POINTER; + (void)This; if (pctinfo != NULL) { *pctinfo = 0; @@ -226,6 +227,9 @@ WinSendCom_GetTypeInfo( ITypeInfo **ppTI) { HRESULT hr = E_POINTER; + (void)This; + (void)iTInfo; + (void)lcid; if (ppTI) { *ppTI = NULL; @@ -244,6 +248,10 @@ WinSendCom_GetIDsOfNames( DISPID *rgDispId) { HRESULT hr = E_POINTER; + (void)This; + (void)riid; + (void)cNames; + (void)lcid; if (rgDispId) { hr = DISP_E_UNKNOWNNAME; @@ -269,7 +277,9 @@ WinSendCom_Invoke( UINT *puArgErr) { HRESULT hr = DISP_E_MEMBERNOTFOUND; - TkWinSendCom *this = (TkWinSendCom*)This; + TkWinSendCom *sendCom = (TkWinSendCom*)This; + (void)riid; + (void)lcid; switch (dispidMember) { case TKWINSENDCOM_DISPID_SEND: @@ -277,7 +287,7 @@ WinSendCom_Invoke( if (pDispParams->cArgs != 1) { hr = DISP_E_BADPARAMCOUNT; } else { - hr = Send(this, pDispParams->rgvarg[0], pvarResult, + hr = Send(sendCom, pDispParams->rgvarg[0], pvarResult, pExcepInfo, puArgErr); } } @@ -288,7 +298,7 @@ WinSendCom_Invoke( if (pDispParams->cArgs != 1) { hr = DISP_E_BADPARAMCOUNT; } else { - hr = Async(this, pDispParams->rgvarg[0], pExcepInfo, puArgErr); + hr = Async(sendCom, pDispParams->rgvarg[0], pExcepInfo, puArgErr); } } break; @@ -313,27 +323,27 @@ ISupportErrorInfo_QueryInterface( REFIID riid, void **ppvObject) { - TkWinSendCom *this = (TkWinSendCom *)(This - 1); + TkWinSendCom *sendCom = (TkWinSendCom *)(This - 1); - return this->lpVtbl->QueryInterface((IDispatch *) this, riid, ppvObject); + return sendCom->lpVtbl->QueryInterface((IDispatch *) sendCom, riid, ppvObject); } static STDMETHODIMP_(ULONG) ISupportErrorInfo_AddRef( ISupportErrorInfo *This) { - TkWinSendCom *this = (TkWinSendCom *)(This - 1); + TkWinSendCom *sendCom = (TkWinSendCom *)(This - 1); - return InterlockedIncrement(&this->refcount); + return InterlockedIncrement(&sendCom->refcount); } static STDMETHODIMP_(ULONG) ISupportErrorInfo_Release( ISupportErrorInfo *This) { - TkWinSendCom *this = (TkWinSendCom *)(This - 1); + TkWinSendCom *sendCom = (TkWinSendCom *)(This - 1); - return this->lpVtbl->Release((IDispatch *) this); + return sendCom->lpVtbl->Release((IDispatch *) sendCom); } static STDMETHODIMP @@ -341,7 +351,10 @@ ISupportErrorInfo_InterfaceSupportsErrorInfo( ISupportErrorInfo *This, REFIID riid) { - /*TkWinSendCom *this = (TkWinSendCom*)(This - 1);*/ + (void)This; + (void)riid; + + /*TkWinSendCom *sendCom = (TkWinSendCom*)(This - 1);*/ return S_OK; /* or S_FALSE */ } @@ -371,6 +384,7 @@ Async( HRESULT hr = S_OK; VARIANT vCmd; Tcl_DString ds; + (void)puArgErr; VariantInit(&vCmd); @@ -430,6 +444,7 @@ Send( Tcl_Interp *interp = obj->interp; Tcl_Obj *scriptPtr; Tcl_DString ds; + (void)puArgErr; if (interp == NULL) { return S_OK; diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 613eda3..c419be8 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -231,6 +231,8 @@ SetSelectionResult( Tcl_Interp *interp, const char *selection) { + (void)dummy; + Tcl_AppendResult(interp, selection, NULL); return TCL_OK; } @@ -242,7 +244,7 @@ TestclipboardObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -271,7 +273,7 @@ TestclipboardObjCmd( static int TestwineventObjCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -304,6 +306,7 @@ TestwineventObjCmd( {WM_COMMAND, "WM_COMMAND"}, {-1, NULL} }; + (void)dummy; if ((objc == 3) && (strcmp(Tcl_GetString(objv[1]), "debug") == 0)) { int b; @@ -319,7 +322,7 @@ TestwineventObjCmd( return TCL_ERROR; } - hwnd = INT2PTR(strtol(Tcl_GetString(objv[1]), &rest, 0)); + hwnd = (HWND)INT2PTR(strtol(Tcl_GetString(objv[1]), &rest, 0)); if (rest == Tcl_GetString(objv[1])) { hwnd = FindWindowA(NULL, Tcl_GetString(objv[1])); if (hwnd == NULL) { @@ -439,7 +442,7 @@ TestwineventObjCmd( static int TestfindwindowObjCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -449,6 +452,7 @@ TestfindwindowObjCmd( HWND hwnd = NULL; int r = TCL_OK; DWORD myPid; + (void)dummy; Tcl_DStringInit(&classString); Tcl_DStringInit(&titleString); @@ -511,7 +515,7 @@ EnumChildrenProc( static int TestgetwindowinfoObjCmd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -522,6 +526,7 @@ TestgetwindowinfoObjCmd( WCHAR buf[512]; int cch, cchBuf = 256; Tcl_DString ds; + (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "hwnd"); @@ -531,7 +536,7 @@ TestgetwindowinfoObjCmd( if (Tcl_GetWideIntFromObj(interp, objv[1], &hwnd) != TCL_OK) return TCL_ERROR; - cch = GetClassNameW(INT2PTR(hwnd), buf, cchBuf); + cch = GetClassNameW((HWND)INT2PTR(hwnd), buf, cchBuf); if (cch == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to get class name: ", -1)); AppendSystemError(interp, GetLastError()); @@ -548,7 +553,7 @@ TestgetwindowinfoObjCmd( Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2), Tcl_NewWideIntObj(GetWindowLongPtr((HWND)(size_t)hwnd, GWL_ID))); - cch = GetWindowTextW(INT2PTR(hwnd), buf, cchBuf); + cch = GetWindowTextW((HWND)INT2PTR(hwnd), buf, cchBuf); Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(buf, cch, &ds); textObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); @@ -568,11 +573,13 @@ TestgetwindowinfoObjCmd( static int TestwinlocaleObjCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { + (void)dummy; + if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index ff916b7..f868a06 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -49,7 +49,7 @@ Tk_AttachHWND( Tk_Window tkwin, HWND hwnd) { - int new; + int isNew; Tcl_HashEntry *entryPtr; TkWinDrawable *twdPtr = (TkWinDrawable *) Tk_WindowId(tkwin); ThreadSpecificData *tsdPtr = (ThreadSpecificData *) @@ -66,7 +66,7 @@ Tk_AttachHWND( */ if (twdPtr == NULL) { - twdPtr = ckalloc(sizeof(TkWinDrawable)); + twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable)); twdPtr->type = TWD_WINDOW; twdPtr->window.winPtr = (TkWindow *) tkwin; } else if (twdPtr->window.handle != NULL) { @@ -80,7 +80,7 @@ Tk_AttachHWND( */ twdPtr->window.handle = hwnd; - entryPtr = Tcl_CreateHashEntry(&tsdPtr->windowTable, (char *)hwnd, &new); + entryPtr = Tcl_CreateHashEntry(&tsdPtr->windowTable, (char *)hwnd, &isNew); Tcl_SetHashValue(entryPtr, tkwin); return (Window)twdPtr; diff --git a/win/tkWinWm.c b/win/tkWinWm.c index e6a0a4b..08e8882 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -856,7 +856,7 @@ static int InitWindowClass( WinIconPtr titlebaricon) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { @@ -1117,7 +1117,7 @@ TkWinGetIcon( { WmInfo *wmPtr; HICON icon; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->iconPtr != NULL) { @@ -1260,7 +1260,7 @@ ReadIconFromFile( size = sizeof(BlockOfIconImages) + ((res != 0) ? sizeof(ICONIMAGE) : 0); - lpIR = ckalloc(size); + lpIR = (BlockOfIconImagesPtr)ckalloc(size); if (lpIR == NULL) { if (res != 0) { DestroyIcon(sfi.hIcon); @@ -1291,7 +1291,7 @@ ReadIconFromFile( Tcl_DStringFree(&ds2); } if (lpIR != NULL) { - titlebaricon = ckalloc(sizeof(WinIconInstance)); + titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; } @@ -1367,7 +1367,7 @@ GetIconFromPixmap( return NULL; } - lpIR = ckalloc(sizeof(BlockOfIconImages)); + lpIR = (BlockOfIconImagesPtr)ckalloc(sizeof(BlockOfIconImages)); if (lpIR == NULL) { DestroyIcon(hIcon); return NULL; @@ -1388,7 +1388,7 @@ GetIconFromPixmap( lpIR->IconImages[0].lpXOR = 0; lpIR->IconImages[0].lpAND = 0; - titlebaricon = ckalloc(sizeof(WinIconInstance)); + titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; return titlebaricon; @@ -1593,7 +1593,7 @@ ReadIconOrCursorFromFile( * Allocate memory for the resource structure */ - lpIR = ckalloc(sizeof(BlockOfIconImages)); + lpIR = (BlockOfIconImagesPtr)ckalloc(sizeof(BlockOfIconImages)); /* * Read in the header @@ -1611,14 +1611,14 @@ ReadIconOrCursorFromFile( * Adjust the size of the struct to account for the images. */ - lpIR = ckrealloc(lpIR, sizeof(BlockOfIconImages) + lpIR = (BlockOfIconImagesPtr)ckrealloc(lpIR, sizeof(BlockOfIconImages) + (lpIR->nNumImages - 1) * sizeof(ICONIMAGE)); /* * Allocate enough memory for the icon directory entries. */ - lpIDE = ckalloc(lpIR->nNumImages * sizeof(ICONDIRENTRY)); + lpIDE = (LPICONDIRENTRY)ckalloc(lpIR->nNumImages * sizeof(ICONDIRENTRY)); /* * Read in the icon directory entries. @@ -1653,7 +1653,7 @@ ReadIconOrCursorFromFile( * Allocate memory for the resource. */ - lpIR->IconImages[i].lpBits = ckalloc(lpIDE[i].dwBytesInRes); + lpIR->IconImages[i].lpBits = (LPBYTE)ckalloc(lpIDE[i].dwBytesInRes); lpIR->IconImages[i].dwNumBytes = lpIDE[i].dwBytesInRes; /* @@ -1732,7 +1732,7 @@ static TkWindow * GetTopLevel( HWND hwnd) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1874,7 +1874,7 @@ TkWinWmCleanup( } initialized = 0; - tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { return; @@ -1905,7 +1905,7 @@ void TkWmNewWindow( TkWindow *winPtr) /* Newly-created top-level window. */ { - WmInfo *wmPtr = ckalloc(sizeof(WmInfo)); + WmInfo *wmPtr = (WmInfo *)ckalloc(sizeof(WmInfo)); /* * Initialize full structure, then set what isn't NULL @@ -1999,7 +1999,7 @@ UpdateWrapper( HICON hBigIcon = NULL; Tcl_DString titleString; int *childStateInfo = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->window == None) { @@ -2209,7 +2209,7 @@ UpdateWrapper( WmInfo *wmPtr2; - childStateInfo = ckalloc(wmPtr->numTransients * sizeof(int)); + childStateInfo = (int *)ckalloc(wmPtr->numTransients * sizeof(int)); state = 0; for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL; wmPtr2 = wmPtr2->nextPtr) { @@ -2356,7 +2356,7 @@ TkWmMapWindow( * mapped. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { @@ -2742,6 +2742,8 @@ void TkWmSetClass( TkWindow *winPtr) /* Newly-created top-level window. */ { + (void)winPtr; + /* Do nothing */ return; } @@ -2771,7 +2773,7 @@ Tk_WmObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", "frame", @@ -2953,6 +2955,7 @@ WmAspectCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; + (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -3320,6 +3323,7 @@ WmClientCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name?"); @@ -3347,7 +3351,7 @@ WmClientCmd( if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); } - wmPtr->clientMachine = ckalloc(length + 1); + wmPtr->clientMachine = (char *)ckalloc(length + 1); memcpy(wmPtr->clientMachine, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; @@ -3414,7 +3418,7 @@ WmColormapwindowsCmd( != TCL_OK) { return TCL_ERROR; } - cmapList = ckalloc((windowObjc + 1) * sizeof(TkWindow*)); + cmapList = (TkWindow**)ckalloc((windowObjc + 1) * sizeof(TkWindow*)); gotToplevel = 0; for (i = 0; i < windowObjc; i++) { if (TkGetWindowFromObj(interp, tkwin, windowObjv[i], @@ -3485,6 +3489,7 @@ WmCommandCmd( const char *argv3; int cmdArgc; const char **cmdArgv; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); @@ -3551,6 +3556,7 @@ WmDeiconifyCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3610,6 +3616,7 @@ WmFocusmodelCmd( OPT_ACTIVE, OPT_PASSIVE }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?"); @@ -3654,11 +3661,15 @@ static int WmForgetCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ - Tcl_Interp *interp, /* Current interpreter. */ + Tcl_Interp *dummy, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; + (void)tkwin; + (void)dummy; + (void)objc; + (void)objv; if (Tk_IsTopLevel(frameWin)) { Tk_UnmapWindow(frameWin); @@ -3709,6 +3720,7 @@ WmFrameCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; HWND hwnd; char buf[TCL_INTEGER_SPACE]; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3755,6 +3767,7 @@ WmGeometryCmd( char xSign, ySign; int width, height; const char *argv3; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?"); @@ -3821,6 +3834,7 @@ WmGridCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; + (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -3949,7 +3963,7 @@ WmGroupCmd( } wmPtr->hints.window_group = Tk_WindowId(tkwin2); wmPtr->hints.flags |= WindowGroupHint; - wmPtr->leaderName = ckalloc(length + 1); + wmPtr->leaderName = (char *)ckalloc(length + 1); memcpy(wmPtr->leaderName, argv3, length + 1); } return TCL_OK; @@ -3983,6 +3997,7 @@ WmIconbitmapCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ const char *string; + (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? ?image?"); @@ -4117,6 +4132,8 @@ WmIconifyCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; + if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; @@ -4242,6 +4259,7 @@ WmIconnameCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; + (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); @@ -4256,7 +4274,7 @@ WmIconnameCmd( ckfree(wmPtr->iconName); } argv3 = TkGetStringFromObj(objv[3], &length); - wmPtr->iconName = ckalloc(length + 1); + wmPtr->iconName = (char *)ckalloc(length + 1); memcpy(wmPtr->iconName, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName); @@ -4302,6 +4320,7 @@ WmIconphotoCmd( unsigned size; BITMAPINFO bmInfo; ICONINFO iconInfo; + (void)tkwin; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, @@ -4339,7 +4358,7 @@ WmIconphotoCmd( */ size = sizeof(BlockOfIconImages) + (sizeof(ICONIMAGE) * (objc-startObj-1)); - lpIR = attemptckalloc(size); + lpIR = (BlockOfIconImagesPtr)attemptckalloc(size); if (lpIR == NULL) { return TCL_ERROR; } @@ -4444,7 +4463,7 @@ WmIconphotoCmd( lpIR->IconImages[i-startObj].hIcon = hIcon; } - titlebaricon = ckalloc(sizeof(WinIconInstance)); + titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; if (WinSetIcon(interp, titlebaricon, (Tk_Window) useWinPtr) != TCL_OK) { @@ -4485,6 +4504,7 @@ WmIconpositionCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); @@ -4651,6 +4671,9 @@ WmManageCmd( { Tk_Window frameWin = (Tk_Window) winPtr; WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; + (void)objc; + (void)objv; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -4705,6 +4728,7 @@ WmMaxsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -4756,6 +4780,7 @@ WmMinsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -4808,6 +4833,7 @@ WmOverrideredirectCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; int boolean, curValue; XSetWindowAttributes atts; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -4885,6 +4911,7 @@ WmPositionfromCmd( OPT_PROGRAM, OPT_USER }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?"); @@ -4951,6 +4978,7 @@ WmProtocolCmd( const char *cmd; TkSizeT cmdLength; Tcl_Obj *resultObj; + (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); @@ -5006,7 +5034,7 @@ WmProtocolCmd( } cmd = TkGetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { - protPtr = ckalloc(HANDLER_SIZE(cmdLength)); + protPtr = (ProtocolHandler *)ckalloc(HANDLER_SIZE(cmdLength)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; @@ -5043,6 +5071,7 @@ WmResizableCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -5111,6 +5140,7 @@ WmSizefromCmd( OPT_PROGRAM, OPT_USER }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?"); @@ -5308,6 +5338,7 @@ WmStateCmd( OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED }; int index; + (void)tkwin; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?state?"); @@ -5444,6 +5475,7 @@ WmTitleCmd( const char *argv3; TkSizeT length; HWND wrapper; + (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); @@ -5477,7 +5509,7 @@ WmTitleCmd( ckfree(wmPtr->title); } argv3 = TkGetStringFromObj(objv[3], &length); - wmPtr->title = ckalloc(length + 1); + wmPtr->title = (char *)ckalloc(length + 1); memcpy(wmPtr->title, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED) && wmPtr->wrapper != NULL) { @@ -5646,6 +5678,7 @@ WmWithdrawCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -5696,7 +5729,7 @@ WmWaitVisibilityOrMapProc( ClientData clientData, /* Pointer to window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr; if (masterPtr == NULL) @@ -5913,7 +5946,7 @@ TopLevelEventProc( ClientData clientData, /* Window for which event occurred. */ XEvent *eventPtr) /* Event that just happened. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; if (eventPtr->type == DestroyNotify) { Tk_ErrorHandler handler; @@ -5961,6 +5994,7 @@ TopLevelReqProc( { TkWindow *winPtr = (TkWindow *) tkwin; WmInfo *wmPtr; + (void)dummy; wmPtr = winPtr->wmInfoPtr; if (wmPtr) { @@ -6004,7 +6038,7 @@ UpdateGeometryInfo( int width, height; /* Size of client area. */ int min, max; RECT rect; - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; WmInfo *wmPtr = winPtr->wmInfoPtr; wmPtr->flags &= ~WM_UPDATE_PENDING; @@ -6514,6 +6548,8 @@ Tk_GetVRootGeometry( int *widthPtr, int *heightPtr) /* Store dimensions of virtual root here. */ { + (void)tkwin; + *xPtr = GetSystemMetrics(SM_XVIRTUALSCREEN); *yPtr = GetSystemMetrics(SM_YVIRTUALSCREEN); *widthPtr = GetSystemMetrics(SM_CXVIRTUALSCREEN); @@ -6675,7 +6711,7 @@ TkWmStackorderToplevelEnumProc( hPtr = Tcl_FindHashEntry(pair->table, hwnd); if (hPtr != NULL) { - childWinPtr = Tcl_GetHashValue(hPtr); + childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); /* * Double check that same HWND does not get passed twice. @@ -6775,7 +6811,7 @@ TkWmStackorderToplevel( Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); - windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *)); + windows = (TkWindow **)ckalloc((table.numEntries+1) * sizeof(TkWindow *)); /* * Special cases: If zero or one toplevels were mapped there is no need to @@ -6788,7 +6824,7 @@ TkWmStackorderToplevel( goto done; case 1: hPtr = Tcl_FirstHashEntry(&table, &search); - windows[0] = Tcl_GetHashValue(hPtr); + windows[0] = (TkWindow *)Tcl_GetHashValue(hPtr); windows[1] = NULL; goto done; } @@ -6951,7 +6987,7 @@ TkWmAddToColormapWindows( * Automatically add the toplevel itself as the last element of the list. */ - newPtr = ckalloc((count+2) * sizeof(TkWindow *)); + newPtr = (TkWindow **)ckalloc((count+2) * sizeof(TkWindow *)); if (count > 0) { memcpy(newPtr, oldPtr, count * sizeof(TkWindow*)); } @@ -8247,7 +8283,7 @@ TkpGetWrapperWindow( static void GenerateActivateEvent(TkWindow * winPtr, const int *flagPtr) { - ActivateEvent *eventPtr = ckalloc(sizeof(ActivateEvent)); + ActivateEvent *eventPtr = (ActivateEvent *)ckalloc(sizeof(ActivateEvent)); eventPtr->ev.proc = ActivateWindow; eventPtr->winPtr = winPtr; diff --git a/win/tkWinX.c b/win/tkWinX.c index 7b2d004..8124e50 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -125,9 +125,10 @@ TkGetServerInfo( { static char buffer[32]; /* Empty string means not initialized yet. */ OSVERSIONINFOW os; + (void)tkwin; if (!buffer[0]) { - HANDLE handle = GetModuleHandleW(L"NTDLL"); + HMODULE handle = GetModuleHandleW(L"NTDLL"); int(__stdcall *getversion)(void *) = (int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion"); os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); @@ -259,7 +260,7 @@ TkWinXInit( if (GetLocaleInfoW(LANGIDFROMLCID(PTR2INT(GetKeyboardLayout(0))), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (LPWSTR) &lpCP, sizeof(lpCP)/sizeof(WCHAR)) - && TranslateCharsetInfo(INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) { + && TranslateCharsetInfo((DWORD *)INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) { UpdateInputLanguage((int) lpCs.ciCharset); } @@ -290,7 +291,7 @@ void TkWinXCleanup( ClientData clientData) { - HINSTANCE hInstance = clientData; + HINSTANCE hInstance = (HINSTANCE)clientData; /* * Clean up our own class. @@ -390,9 +391,11 @@ TkWinGetPlatformTheme(void) const char * TkGetDefaultScreenName( - Tcl_Interp *interp, /* Not used. */ + Tcl_Interp *dummy, /* Not used. */ const char *screenName) /* If NULL, use default string. */ { + (void)dummy; + if ((screenName == NULL) || (screenName[0] == '\0')) { screenName = winScreenName; } @@ -445,13 +448,13 @@ TkWinDisplayChanged( * the HWND and we'll just get blank spots copied onto the screen. */ - screen->ext_data = INT2PTR(GetDeviceCaps(dc, PLANES)); + screen->ext_data = (XExtData *)INT2PTR(GetDeviceCaps(dc, PLANES)); screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * PTR2INT(screen->ext_data); if (screen->root_visual != NULL) { ckfree(screen->root_visual); } - screen->root_visual = ckalloc(sizeof(Visual)); + screen->root_visual = (Visual *)ckalloc(sizeof(Visual)); screen->root_visual->visualid = 0; if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) { screen->root_visual->map_entries = GetDeviceCaps(dc, SIZEPALETTE); @@ -518,7 +521,7 @@ TkpOpenDisplay( Screen *screen; TkWinDrawable *twdPtr; Display *display; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); DWORD initialWheelTick; @@ -530,10 +533,10 @@ TkpOpenDisplay( } } - display = ckalloc(sizeof(Display)); + display = (Display *)ckalloc(sizeof(Display)); ZeroMemory(display, sizeof(Display)); - display->display_name = ckalloc(strlen(display_name) + 1); + display->display_name = (char *)ckalloc(strlen(display_name) + 1); strcpy(display->display_name, display_name); display->cursor_font = 1; @@ -541,7 +544,7 @@ TkpOpenDisplay( display->request = 1; display->qlen = 0; - screen = ckalloc(sizeof(Screen)); + screen = (Screen *)ckalloc(sizeof(Screen)); ZeroMemory(screen, sizeof(Screen)); screen->display = display; @@ -549,7 +552,7 @@ TkpOpenDisplay( * Set up the root window. */ - twdPtr = ckalloc(sizeof(TkWinDrawable)); + twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable)); if (twdPtr == NULL) { return NULL; } @@ -572,7 +575,7 @@ TkpOpenDisplay( TkWinDisplayChanged(display); - tsdPtr->winDisplay = ckalloc(sizeof(TkDisplay)); + tsdPtr->winDisplay =(TkDisplay *) ckalloc(sizeof(TkDisplay)); ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay)); tsdPtr->winDisplay->display = display; tsdPtr->updatingClipboard = FALSE; @@ -701,6 +704,9 @@ XBell( Display *display, int percent) { + (void)display; + (void)percent; + MessageBeep(MB_OK); return Success; } @@ -1485,7 +1491,7 @@ UpdateInputLanguage( if (keyInputCharset == charset) { return; } - if (TranslateCharsetInfo(INT2PTR(charset), &charsetInfo, + if (TranslateCharsetInfo((DWORD*)INT2PTR(charset), &charsetInfo, TCI_SRCCHARSET) == 0) { /* * Some mysterious failure. @@ -1930,6 +1936,7 @@ Tk_GetUserInactiveTime( Display *dpy) /* Ignored on Windows */ { LASTINPUTINFO li; + (void)dpy; li.cbSize = sizeof(li); if (!GetLastInputInfo(&li)) { @@ -1965,6 +1972,7 @@ Tk_ResetUserInactiveTime( Display *dpy) { INPUT inp; + (void)dpy; inp.type = INPUT_MOUSE; inp.mi.dx = 0; diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index ad3c94e..ae88006 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -147,9 +147,13 @@ static void FrameControlElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - FrameControlElementData *p = clientData; + FrameControlElementData *p = (FrameControlElementData *)clientData; int cx = GETMETRIC(p->cxId); int cy = GETMETRIC(p->cyId); + (void)elementRecord; + (void)tkwin; + (void)paddingPtr; + if (p->cxId & _HALFMETRIC) cx /= 2; if (p->cyId & _HALFMETRIC) cy /= 2; *widthPtr = cx + Ttk_PaddingWidth(p->margins); @@ -160,10 +164,11 @@ static void FrameControlElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - FrameControlElementData *elementData = clientData; + FrameControlElementData *elementData = (FrameControlElementData *)clientData; RECT rc = BoxToRect(Ttk_PadBox(b, elementData->margins)); TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); + (void)elementRecord; DrawFrameControl(hdc, &rc, elementData->classId, @@ -189,26 +194,34 @@ typedef struct { static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-relief",TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, - {NULL, 0, 0, NULL} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void BorderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void BorderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - BorderElement *border = elementRecord; + BorderElement *border = (BorderElement *)elementRecord; RECT rc = BoxToRect(b); int relief = TK_RELIEF_FLAT; TkWinDCState dcState; HDC hdc; + (void)dummy; + (void)state; Tk_GetReliefFromObj(NULL, border->reliefObj, &relief); @@ -240,26 +253,34 @@ typedef struct { static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,backgroundObj), "white" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void FieldElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - FieldElement *field = elementRecord; + FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj); RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; + (void)dummy; + (void)state; Tk_Fill3DRectangle( tkwin, d, bg, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT); @@ -295,17 +316,21 @@ static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { offsetof(ButtonBorderElement,highlightColorObj), "black" }, { "-default", TK_OPTION_ANY, offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, - {NULL, 0, 0, NULL} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void ButtonBorderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ButtonBorderElement *bd = elementRecord; + ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord; int relief = TK_RELIEF_RAISED; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; short int cx, cy; + (void)dummy; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); @@ -327,15 +352,16 @@ static void ButtonBorderElementSize( } static void ButtonBorderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ButtonBorderElement *bd = elementRecord; + ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord; int relief = TK_RELIEF_FLAT; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; TkWinDCState dcState; HDC hdc; RECT rc; + (void)dummy; Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); @@ -381,16 +407,25 @@ static Ttk_ElementSpec ButtonBorderElementSpec = { */ static void FocusElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + *paddingPtr = Ttk_UniformPadding(1); } static void FocusElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { + (void)dummy; + (void)elementRecord; + if (state & TTK_STATE_FOCUS) { RECT rc = BoxToRect(b); TkWinDCState dcState; @@ -419,15 +454,17 @@ typedef struct { static Ttk_ElementOptionSpec FillFocusElementOptions[] = { { "-focusfill", TK_OPTION_COLOR, offsetof(FillFocusElement,fillColorObj), "white" }, - {NULL, 0, 0, NULL} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; /* @@@ FIX THIS */ static void FillFocusElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - FillFocusElement *focus = elementRecord; + FillFocusElement *focus = (FillFocusElement *)elementRecord; + (void)dummy; + if (state & TTK_STATE_FOCUS) { RECT rc = BoxToRect(b); TkWinDCState dcState; @@ -482,7 +519,7 @@ static const WORD Pattern[] = { static void TroughClientDataDeleteProc(void *clientData) { - TroughClientData *cd = clientData; + TroughClientData *cd = (TroughClientData *)clientData; DeleteObject(cd->PatternBrush); DeleteObject(cd->PatternBitmap); ckfree(clientData); @@ -490,7 +527,7 @@ static void TroughClientDataDeleteProc(void *clientData) static TroughClientData *TroughClientDataInit(Tcl_Interp *interp) { - TroughClientData *cd = ckalloc(sizeof(*cd)); + TroughClientData *cd = (TroughClientData *)ckalloc(sizeof(*cd)); cd->PatternBitmap = CreateBitmap(8, 8, 1, 1, Pattern); cd->PatternBrush = CreatePatternBrush(cd->PatternBitmap); Ttk_RegisterCleanup(interp, cd, TroughClientDataDeleteProc); @@ -501,13 +538,15 @@ static void TroughElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - TroughClientData *cd = clientData; + TroughClientData *cd = (TroughClientData *)clientData; TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); HBRUSH hbr; COLORREF bk, oldbk, oldtxt; + (void)elementRecord; + (void)state; - hbr = SelectObject(hdc, GetSysColorBrush(COLOR_SCROLLBAR)); + hbr = (HBRUSH)SelectObject(hdc, GetSysColorBrush(COLOR_SCROLLBAR)); bk = GetSysColor(COLOR_3DHIGHLIGHT); oldtxt = SetTextColor(hdc, GetSysColor(COLOR_3DFACE)); oldbk = SetBkColor(hdc, bk); @@ -543,15 +582,18 @@ typedef struct { static Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ThumbElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ThumbElement *thumbPtr = elementRecord; - int orient; + ThumbElement *thumbPtr = (ThumbElement *)elementRecord; + Ttk_Orient orient; + (void)dummy; + (void)tkwin; + (void)paddingPtr; Ttk_GetOrientFromObj(NULL, thumbPtr->orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { @@ -564,12 +606,14 @@ static void ThumbElementSize( } static void ThumbElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; + (void)dummy; + (void)elementRecord; /* Windows doesn't show a thumb when the scrollbar is disabled */ if (state & TTK_STATE_DISABLED) @@ -600,15 +644,18 @@ typedef struct { static Ttk_ElementOptionSpec SliderElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SliderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - SliderElement *slider = elementRecord; - int orient; + SliderElement *slider = (SliderElement *)elementRecord; + Ttk_Orient orient; + (void)dummy; + (void)tkwin; + (void)paddingPtr; Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { @@ -621,12 +668,15 @@ static void SliderElementSize( } static void SliderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; + (void)dummy; + (void)elementRecord; + (void)state; hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_MIDDLE); @@ -646,20 +696,30 @@ static Ttk_ElementSpec SliderElementSpec = { */ static void ClientElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void ClientElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); + (void)dummy; + (void)elementRecord; + (void)state; + DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_SOFT); TkWinReleaseDrawableDC(d, hdc, &dcState); } @@ -699,6 +759,7 @@ int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd) { Ttk_Theme themePtr, parentPtr; FrameControlElementData *fce = FrameControlElements; + (void)hwnd; parentPtr = Ttk_GetTheme(interp, "alt"); themePtr = Ttk_CreateTheme(interp, "winnative", parentPtr); diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 784a96d..f0ce5ab 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -102,7 +102,7 @@ LoadXPThemeProcs(HINSTANCE *phlib) * We have successfully loaded the library. Proceed in storing the * addresses of the functions we want to use. */ - XPThemeProcs *procs = ckalloc(sizeof(XPThemeProcs)); + XPThemeProcs *procs = (XPThemeProcs *)ckalloc(sizeof(XPThemeProcs)); #define LOADPROC(name) \ (0 != (procs->name = (name ## Proc *)GetProcAddress(handle, #name) )) @@ -134,7 +134,7 @@ LoadXPThemeProcs(HINSTANCE *phlib) static void XPThemeDeleteProc(void *clientData) { - XPThemeData *themeData = clientData; + XPThemeData *themeData = (XPThemeData *)clientData; FreeLibrary(themeData->hlibrary); ckfree(clientData); } @@ -142,9 +142,11 @@ XPThemeDeleteProc(void *clientData) static int XPThemeEnabled(Ttk_Theme theme, void *clientData) { - XPThemeData *themeData = clientData; + XPThemeData *themeData = (XPThemeData *)clientData; int active = themeData->procs->IsThemeActive(); int themed = themeData->procs->IsAppThemed(); + (void)theme; + return (active && themed); } @@ -409,7 +411,7 @@ typedef struct static ElementData * NewElementData(XPThemeProcs *procs, ElementInfo *info) { - ElementData *elementData = ckalloc(sizeof(ElementData)); + ElementData *elementData = (ElementData *)ckalloc(sizeof(ElementData)); elementData->procs = procs; elementData->info = info; @@ -425,7 +427,7 @@ NewElementData(XPThemeProcs *procs, ElementInfo *info) */ static void DestroyElementData(void *clientData) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; if (elementData->info->flags & HEAP_ELEMENT) { ckfree(elementData->info->statemap); ckfree((char *)elementData->info->className); @@ -493,9 +495,10 @@ static void GenericElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; HRESULT result; SIZE size; + (void)elementRecord; if (!InitElementData(elementData, tkwin, 0)) return; @@ -529,8 +532,9 @@ static void GenericElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; RECT rc; + (void)elementRecord; if (!InitElementData(elementData, tkwin, d)) { return; @@ -574,7 +578,7 @@ GenericSizedElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; if (!InitElementData(elementData, tkwin, 0)) return; @@ -610,7 +614,7 @@ SpinboxArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; if (!InitElementData(elementData, tkwin, 0)) return; @@ -639,9 +643,10 @@ static void ThumbElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; unsigned stateId = Ttk_StateTableLookup(elementData->info->statemap, state); RECT rc = BoxToRect(b); + (void)elementRecord; /* * Don't draw the thumb if we are disabled. @@ -678,7 +683,7 @@ static void PbarElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; int nBars = 3; GenericElementSize(clientData, elementRecord, tkwin, @@ -718,9 +723,10 @@ static void TabElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ElementData *elementData = clientData; + ElementData *elementData = (ElementData *)clientData; int partId = elementData->info->partId; RECT rc = BoxToRect(b); + (void)elementRecord; if (!InitElementData(elementData, tkwin, d)) return; @@ -1108,7 +1114,7 @@ Ttk_CreateVsapiElement( int objc, Tcl_Obj *const objv[]) { - XPThemeData *themeData = clientData; + XPThemeData *themeData = (XPThemeData *)clientData; ElementInfo *elementPtr = NULL; ClientData elementData; LPCWSTR className; @@ -1215,7 +1221,7 @@ Ttk_CreateVsapiElement( if (Tcl_ListObjGetElements(interp, objv[2], &count, &specs) != TCL_OK) goto retErr; /* we over-allocate to ensure there is a terminating entry */ - stateTable = ckalloc(sizeof(Ttk_StateTable) * (count + 1)); + stateTable = (Ttk_StateTable *)ckalloc(sizeof(Ttk_StateTable) * (count + 1)); memset(stateTable, 0, sizeof(Ttk_StateTable) * (count + 1)); for (n = 0, j = 0; status == TCL_OK && n < count; n += 2, ++j) { Ttk_StateSpec spec = {0,0}; @@ -1233,11 +1239,11 @@ Ttk_CreateVsapiElement( return status; } } else { - stateTable = ckalloc(sizeof(Ttk_StateTable)); + stateTable = (Ttk_StateTable *)ckalloc(sizeof(Ttk_StateTable)); memset(stateTable, 0, sizeof(Ttk_StateTable)); } - elementPtr = ckalloc(sizeof(ElementInfo)); + elementPtr = (ElementInfo *)ckalloc(sizeof(ElementInfo)); elementPtr->elementSpec = elementSpec; elementPtr->partId = partId; elementPtr->statemap = stateTable; @@ -1245,12 +1251,12 @@ Ttk_CreateVsapiElement( elementPtr->flags = HEAP_ELEMENT | flags; /* set the element name to an allocated copy */ - name = ckalloc(strlen(elementName) + 1); + name = (char *)ckalloc(strlen(elementName) + 1); strcpy(name, elementName); elementPtr->elementName = name; /* set the class name to an allocated copy */ - wname = ckalloc(Tcl_DStringLength(&classBuf) + sizeof(WCHAR)); + wname = (LPWSTR)ckalloc(Tcl_DStringLength(&classBuf) + sizeof(WCHAR)); wcscpy(wname, className); elementPtr->className = wname; @@ -1302,7 +1308,7 @@ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) * Set theme data and cleanup proc */ - themeData = ckalloc(sizeof(XPThemeData)); + themeData = (XPThemeData *)ckalloc(sizeof(XPThemeData)); themeData->procs = procs; themeData->hlibrary = hlibrary; diff --git a/win/winMain.c b/win/winMain.c index f1d671f..a89c899 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -25,7 +25,13 @@ int _CRT_glob = 0; #endif /* __GNUC__ */ #ifdef TK_TEST +#ifdef __cplusplus +extern "C" { +#endif extern Tcl_PackageInitProc Tktest_Init; +#ifdef __cplusplus +} +#endif #endif /* TK_TEST */ #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES -- cgit v0.12 From 25fc9b01d247c1a32fc662dfb85bafe051ae167b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 20 Dec 2019 14:58:46 +0000 Subject: more WIP for MaxOS --- generic/ttk/ttkWidget.c | 2 +- macosx/tkMacOSXBitmap.c | 3 ++- macosx/tkMacOSXButton.c | 9 +++++++++ macosx/tkMacOSXClipboard.c | 4 ++++ macosx/tkMacOSXColor.c | 16 ++++++++++++++++ macosx/tkMacOSXConfig.c | 4 ++++ macosx/tkMacOSXCursor.c | 11 +++++++++++ macosx/tkMacOSXDialog.c | 13 ++++++++++--- 8 files changed, 57 insertions(+), 5 deletions(-) diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 8cbcdff..be05dee 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -85,7 +85,7 @@ static void EndDrawing(Tk_Window tkwin, Drawable d) #else /* No double-buffering: draw directly into the window. */ static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_WindowId(tkwin); } -static void EndDrawing(Tk_Window tkwin, Drawable d) { } +static void EndDrawing(Tk_Window tkwin, Drawable d) { (void)tkwin; (void)d;} #endif /* DrawWidget -- diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c index 615192b..0731de3 100644 --- a/macosx/tkMacOSXBitmap.c +++ b/macosx/tkMacOSXBitmap.c @@ -344,7 +344,7 @@ TkpGetNativeAppBitmap( int TkMacOSXIconBitmapObjCmd( - ClientData clientData, /* Unused. */ + ClientData dummy, /* Unused. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -353,6 +353,7 @@ TkMacOSXIconBitmapObjCmd( int i = 1, len, isNew, result = TCL_ERROR; const char *name, *value; IconBitmap ib, *iconBitmap; + (void)dummy; if (objc != 6) { Tcl_WrongNumArgs(interp, 1, objv, "name width height " diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 8a121ee..ec1ccf2 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -737,6 +737,7 @@ TkMacOSXDrawButton( TkMacOSXDrawingContext dc; DrawParams *dpPtr = &mbPtr->drawParams; int useNewerHITools = 1; + (void)gc; TkMacOSXComputeButtonParams(butPtr, &mbPtr->btnkind, &mbPtr->drawinfo); @@ -822,6 +823,9 @@ ButtonBackgroundDrawCB( Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; int usehlborder = 0; + (void)btnbounds; + (void)depth; + (void)isColorDev; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; @@ -873,6 +877,11 @@ ButtonContentDrawCB ( { TkButton *butPtr = (TkButton *) ptr; Tk_Window tkwin = butPtr->tkwin; + (void)btnbounds; + (void)kind; + (void)drawinfo; + (void)depth; + (void)isColorDev; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index 88a0d93..a5665c7 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -185,6 +185,7 @@ XSetSelectionOwner( Time time) /* The current time? */ { TkDisplay *dispPtr = TkGetDisplayList(); + (void)time; if (dispPtr && selection == dispPtr->clipboardAtom) { clipboardOwner = owner ? Tk_IdToWindow(display, owner) : NULL; @@ -247,6 +248,8 @@ TkSelUpdateClipboard( /* Info about the content. */ { NSPasteboard *pb = [NSPasteboard generalPasteboard]; + (void)winPtr; + (void)targetPtr; changeCount = [pb addTypes:[NSArray arrayWithObject:NSStringPboardType] owner:NSApp]; @@ -301,6 +304,7 @@ void TkSelPropProc( XEvent *eventPtr) /* X PropertyChange event. */ { + (void)eventPtr; } /* diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 9b72732..3c40cfb 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -827,6 +827,7 @@ TkpGetColorByValue( * desired color. */ { TkColor *tkColPtr = ckalloc(sizeof(TkColor)); + (void)tkwin; tkColPtr->color.red = colorPtr->red; tkColPtr->color.green = colorPtr->green; @@ -858,6 +859,8 @@ XAllocColor( Colormap map, /* Not used. */ XColor *colorPtr) /* XColor struct to modify. */ { + (void)map; + display->request++; colorPtr->pixel = TkpGetPixel(colorPtr); return 1; @@ -871,6 +874,10 @@ XCreateColormap( int alloc) /* Not used. */ { static Colormap index = 1; + (void)display; + (void)window; + (void)visual; + (void)alloc; /* * Just return a new value each time. @@ -883,6 +890,9 @@ XFreeColormap( Display* display, /* Display. */ Colormap colormap) /* Colormap. */ { + (void)display; + (void)colormap; + return Success; } @@ -894,6 +904,12 @@ XFreeColors( int npixels, /* Number of pixels. */ unsigned long planes) /* Number of pixel planes. */ { + (void)display; + (void)colormap; + (void)pixels; + (void)npixels; + (void)planes; + /* * The Macintosh version of Tk uses TrueColor. Nothing * needs to be done to release colors as there really is diff --git a/macosx/tkMacOSXConfig.c b/macosx/tkMacOSXConfig.c index 841fc54..34a1fc9 100644 --- a/macosx/tkMacOSXConfig.c +++ b/macosx/tkMacOSXConfig.c @@ -39,6 +39,10 @@ TkpGetSystemDefault( const char *dbName, /* The option database name. */ const char *className) /* The name of the option class. */ { + (void)tkwin; + (void)dbName; + (void)className; + return NULL; } diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 894a44d..d5faa37 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -382,6 +382,7 @@ TkGetCursorByName( TkMacOSXCursor *macCursorPtr = NULL; const char **argv = NULL; int argc; + (void)tkwin; /* * All cursor names are valid lists of one element (for @@ -437,6 +438,16 @@ TkCreateCursorFromData( XColor fgColor, /* Foreground color for cursor. */ XColor bgColor) /* Background color for cursor. */ { + (void)tkwin; + (void)source; + (void)mask; + (void)width; + (void)height; + (void)xHot; + (void)yHot; + (void)fgColor; + (void)bgColor; + return NULL; } diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index c5681b3..e6fa179 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -1986,6 +1986,8 @@ FontchooserShowCmd( { FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); + (void)objc; + (void)objv; if (fcdPtr->parent == None) { fcdPtr->parent = (Tk_Window) clientData; @@ -2027,12 +2029,16 @@ FontchooserShowCmd( static int FontchooserHideCmd( - ClientData clientData, /* Main window */ + ClientData dummy, /* Main window */ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { NSFontPanel *fp = [[NSFontManager sharedFontManager] fontPanel:NO]; + (void)dummy; + (void)interp; + (void)objc; + (void)objv; if ([fp isVisible]) { [fp orderOut:NSApp]; @@ -2129,9 +2135,10 @@ DeleteFontchooserData( MODULE_SCOPE int TkInitFontchooser( Tcl_Interp *interp, - ClientData clientData) + ClientData dummy) { - FontchooserData *fcdPtr = ckalloc(sizeof(FontchooserData)); + FontchooserData *fcdPtr = (FontchooserData *)ckalloc(sizeof(FontchooserData)); + (void)dummy; bzero(fcdPtr, sizeof(FontchooserData)); Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteFontchooserData, -- cgit v0.12 From acc6394e5a4fbf9ef36bfb62571d38fca6f8a41b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 17 Feb 2020 14:47:19 +0000 Subject: Make internal _XInitImageFuncPtrs() prototype work with C++ on all platforms (prevent conflict with tkIntXlibDecls.h) --- generic/tkImgPhInstance.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index 40d9ee7..ddbdb9e 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -26,8 +26,15 @@ /* * Declaration for internal Xlib function used here: */ - -EXTERN int _XInitImageFuncPtrs(XImage *image); +#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) +#ifdef __cplusplus +extern "C" { +#endif +extern int _XInitImageFuncPtrs(XImage *image); +#ifdef __cplusplus +} +#endif +#endif /* * Forward declarations -- cgit v0.12