diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinMenu.c | 73 | ||||
-rw-r--r-- | win/tkWinWindow.c | 6 | ||||
-rw-r--r-- | win/tkWinWm.c | 30 |
3 files changed, 51 insertions, 58 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 3d95ff5..08b143f 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinMenu.c,v 1.54 2007/02/22 13:56:34 dkf Exp $ + * RCS: @(#) $Id: tkWinMenu.c,v 1.55 2007/02/23 14:15:34 dkf Exp $ */ #define OEMRESOURCE @@ -169,30 +169,25 @@ static LRESULT CALLBACK TkWinEmbeddedMenuProc(HWND hwnd, UINT message, * Allocates a new menu id and marks it in use. * * Results: - * Returns TCL_OK if succesful; TCL_ERROR if there are no more - * ids of the appropriate type to allocate. menuIDPtr contains - * the new id if succesful. + * Returns TCL_OK if succesful; TCL_ERROR if there are no more ids of the + * appropriate type to allocate. menuIDPtr contains the new id if + * succesful. * * Side effects: - * An entry is created for the menu in the command hash table, - * and the hash entry is stored in the appropriate field in the - * menu data structure. + * An entry is created for the menu in the command hash table, and the + * hash entry is stored in the appropriate field in the menu data + * structure. * *---------------------------------------------------------------------- */ static int GetNewID( - TkMenuEntry *mePtr, /* The menu we are working with */ - WORD *menuIDPtr) /* The resulting id */ + TkMenuEntry *mePtr, /* The menu we are working with. */ + WORD *menuIDPtr) /* The resulting id. */ { - int found = 0; - int newEntry; - Tcl_HashEntry *commandEntryPtr; - WORD returnID; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - WORD curID = tsdPtr->lastCommandID + 1; /* @@ -201,24 +196,20 @@ GetNewID( */ while (curID != tsdPtr->lastCommandID) { + Tcl_HashEntry *commandEntryPtr; + int newEntry; + commandEntryPtr = Tcl_CreateHashEntry(&tsdPtr->commandTable, - (char *) curID, &newEntry); + ((char *) NULL) + curID, &newEntry); if (newEntry == 1) { - found = 1; - returnID = curID; - break; + Tcl_SetHashValue(commandEntryPtr, (char *) mePtr); + *menuIDPtr = curID; + tsdPtr->lastCommandID = curID; + return TCL_OK; } curID++; } - - if (found) { - Tcl_SetHashValue(commandEntryPtr, (char *) mePtr); - *menuIDPtr = returnID; - tsdPtr->lastCommandID = returnID; - return TCL_OK; - } else { - return TCL_ERROR; - } + return TCL_ERROR; } /* @@ -250,7 +241,7 @@ FreeID( if (tsdPtr->menuHWND != NULL) { Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable, - (char *) commandID); + ((char *) NULL) + commandID); if (entryPtr != NULL) { Tcl_DeleteHashEntry(entryPtr); } @@ -418,7 +409,7 @@ TkpDestroyMenuEntry( Tcl_DoWhenIdle(ReconfigureWindowsMenu, (ClientData) menuPtr); } } - FreeID((WORD) mePtr->platformEntryData); + FreeID((WORD) (UINT) mePtr->platformEntryData); mePtr->platformEntryData = NULL; } @@ -851,7 +842,7 @@ TkpMenuNewEntry( Tcl_DoWhenIdle(ReconfigureWindowsMenu, (ClientData) menuPtr); } - mePtr->platformEntryData = (TkMenuPlatformEntryData) commandID; + mePtr->platformEntryData = (TkMenuPlatformEntryData) (UINT) commandID; return TCL_OK; } @@ -1060,7 +1051,7 @@ TkWinHandleMenuEvent( break; } hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable, - (char *) LOWORD(*pwParam)); + ((char *) NULL) + LOWORD(*pwParam)); if (hashEntryPtr == NULL) { break; } @@ -1123,14 +1114,16 @@ TkWinHandleMenuEvent( underline = menuPtr->entries[i]->underline; labelPtr = menuPtr->entries[i]->labelPtr; if ((underline >= 0) && (labelPtr != NULL)) { - /* do the unicode call just to prevent overruns */ + /* + * Do the unicode call just to prevent overruns. + */ + Tcl_GetUnicodeFromObj(labelPtr, &len); if (underline < len) { - char *label; - label = Tcl_GetStringFromObj(labelPtr, NULL); - if (CharUpper((LPTSTR) menuChar) - == CharUpper((LPTSTR) - *Tcl_UtfAtIndex(label, underline))) { + char *label = Tcl_GetString(labelPtr); + + if (CharUpper((LPTSTR) menuChar) == CharUpper((LPTSTR) + *Tcl_UtfAtIndex(label, underline))) { *plResult = (2 << 16) | i; returnResult = 1; break; @@ -1256,7 +1249,7 @@ TkWinHandleMenuEvent( mePtr = menuPtr->entries[entryIndex]; } else { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable, - (char *) entryIndex); + ((char *) NULL) + entryIndex); if (hashEntryPtr != NULL) { mePtr = (TkMenuEntry *) Tcl_GetHashValue(hashEntryPtr); @@ -3238,8 +3231,8 @@ TkpMenuInit(void) * * TkpMenuThreadInit -- * - * Sets up the thread-local hash tables used by the menu module. - * Assumes that TkpMenuInit has been called. + * Sets up the thread-local hash tables used by the menu module. Assumes + * that TkpMenuInit has been called. * * Results: * None. diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index 016fbb7..e7a25af 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWindow.c,v 1.14 2007/02/22 13:56:35 dkf Exp $ + * RCS: @(#) $Id: tkWinWindow.c,v 1.15 2007/02/23 14:15:34 dkf Exp $ */ #include "tkWinInt.h" @@ -208,7 +208,7 @@ TkpScanWindowId( Window *idPtr) /* Place to store converted result. */ { Tk_Window tkwin; - Window number; + Window number, *numberPtr = &number; /* * We want sscanf for the 64-bit check, but if that doesn't work, then @@ -219,7 +219,7 @@ TkpScanWindowId( #ifdef _WIN64 (sscanf(string, "0x%p", &number) != 1) && #endif - Tcl_GetInt(interp, string, (int *) &number) != TCL_OK) { + Tcl_GetInt(interp, string, (int *) numberPtr) != TCL_OK) { return TCL_ERROR; } diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 0935afb..2a0df7d 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWm.c,v 1.114 2007/02/22 13:56:35 dkf Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.115 2007/02/23 14:15:34 dkf Exp $ */ #include "tkWinInt.h" @@ -76,10 +76,9 @@ typedef struct TkWmStackorderToplevelPair { /* * This structure represents the contents of a icon, in terms of its image. - * The HICON is an internal Windows format. Most of these - * icon-specific-structures originated with the Winico extension. We stripped - * out unused parts of that code, and integrated the code more naturally with - * Tcl. + * The HICON is an internal Windows format. Most of these icon-specific + * structures originated with the Winico extension. We stripped out unused + * parts of that code, and integrated the code more naturally with Tcl. */ typedef struct { @@ -1611,6 +1610,7 @@ GetIcon( return NULL; } +#if 0 /* UNUSED */ static HCURSOR TclWinReadCursorFromFile( Tcl_Interp* interp, @@ -1629,6 +1629,7 @@ TclWinReadCursorFromFile( FreeIconBlock(lpIR); return res; } +#endif /* *---------------------------------------------------------------------- @@ -2934,7 +2935,7 @@ Tk_WmObjCmd( }; int index, length; char *argv1; - TkWindow *winPtr; + TkWindow *winPtr, **winPtrPtr = &winPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; if (objc < 2) { @@ -2978,7 +2979,7 @@ Tk_WmObjCmd( goto wrongNumArgs; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) &winPtr) + if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) winPtrPtr) != TCL_OK) { return TCL_ERROR; } @@ -3494,7 +3495,7 @@ WmColormapwindowsCmd( { register WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow **cmapList; - TkWindow *winPtr2; + TkWindow *winPtr2, **winPtr2Ptr = &winPtr2; int i, windowObjc, gotToplevel; Tcl_Obj **windowObjv; @@ -3522,7 +3523,7 @@ WmColormapwindowsCmd( gotToplevel = 0; for (i = 0; i < windowObjc; i++) { if (TkGetWindowFromObj(interp, tkwin, windowObjv[i], - (Tk_Window *) &winPtr2) != TCL_OK) { + (Tk_Window *) winPtr2Ptr) != TCL_OK) { ckfree((char *) cmapList); return TCL_ERROR; } @@ -4323,7 +4324,6 @@ WmIconphotoCmd( int objc, /* Number of arguments. */ Tcl_Obj *CONST objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ Tk_PhotoHandle photo; Tk_PhotoImageBlock block; @@ -5085,11 +5085,11 @@ WmStackorderCmd( return TCL_OK; } } else { - TkWindow *winPtr2; + TkWindow *winPtr2, **winPtr2Ptr = &winPtr2; int index1=-1, index2=-1, result; - if (TkGetWindowFromObj(interp, tkwin, objv[4], (Tk_Window *) &winPtr2) - != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[4], + (Tk_Window *) winPtr2Ptr) != TCL_OK) { return TCL_ERROR; } @@ -5397,7 +5397,7 @@ WmTransientCmd( Tcl_Obj *CONST objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - TkWindow *masterPtr = wmPtr->masterPtr; + TkWindow *masterPtr = wmPtr->masterPtr, **masterPtrPtr = &masterPtr; WmInfo *wmPtr2; if ((objc != 3) && (objc != 4)) { @@ -5426,7 +5426,7 @@ WmTransientCmd( wmPtr->masterPtr = NULL; } else { if (TkGetWindowFromObj(interp, tkwin, objv[3], - (Tk_Window *) &masterPtr) != TCL_OK) { + (Tk_Window *) masterPtrPtr) != TCL_OK) { return TCL_ERROR; } while (!Tk_TopWinHierarchy(masterPtr)) { |