diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-02 12:36:00 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-02 12:36:00 (GMT) |
commit | bbcad39d045031d99788b54b4334d511b14acb3a (patch) | |
tree | 786830fb405dcff6a00f2429bc3cfd641bdee893 /win | |
parent | d684ccf62f782e4cfe05e658485e3011f5f6b27e (diff) | |
download | tk-bbcad39d045031d99788b54b4334d511b14acb3a.zip tk-bbcad39d045031d99788b54b4334d511b14acb3a.tar.gz tk-bbcad39d045031d99788b54b4334d511b14acb3a.tar.bz2 |
Code cleanup (more TCL_UNUSED, more type-casts, eol-spacing)
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinColor.c | 40 | ||||
-rw-r--r-- | win/tkWinKey.c | 28 | ||||
-rw-r--r-- | win/tkWinWindow.c | 12 |
3 files changed, 40 insertions, 40 deletions
diff --git a/win/tkWinColor.c b/win/tkWinColor.c index fa3f233..1312bcb 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; @@ -274,7 +274,7 @@ int TkWinIndexOfColor( XColor *colorPtr) { - register WinColor *winColPtr = (WinColor *) colorPtr; + WinColor *winColPtr = (WinColor *) colorPtr; if (winColPtr->info.magic == COLOR_MAGIC) { return winColPtr->index; } @@ -300,7 +300,7 @@ TkWinIndexOfColor( int XAllocColor( - Display *display, + TCL_UNUSED(Display *), Colormap colormap, XColor *color) { @@ -316,7 +316,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,13 +358,13 @@ 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; } - Tcl_SetHashValue(entryPtr, (void *)refCount); + Tcl_SetHashValue(entryPtr, INT2PTR(refCount)); } else { /* * Determine what color will actually be used on non-colormap systems. @@ -400,11 +400,11 @@ XAllocColor( int XFreeColors( - Display *display, + TCL_UNUSED(Display *), Colormap colormap, unsigned long *pixels, int npixels, - unsigned long planes) + TCL_UNUSED(unsigned long)) { TkWinColormap *cmap = (TkWinColormap *) colormap; COLORREF cref; @@ -436,7 +436,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); @@ -446,7 +446,7 @@ XFreeColors( } Tcl_DeleteHashEntry(entryPtr); } else { - Tcl_SetHashValue(entryPtr, (size_t)refCount); + Tcl_SetHashValue(entryPtr, INT2PTR(refCount)); } } } @@ -472,17 +472,17 @@ XFreeColors( Colormap XCreateColormap( - Display *display, - Window w, - Visual *visual, - int alloc) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Visual *), + TCL_UNUSED(int)) { char logPalBuf[sizeof(LOGPALETTE) + 256 * sizeof(PALETTEENTRY)]; LOGPALETTE *logPalettePtr; PALETTEENTRY *entryPtr; TkWinColormap *cmap; Tcl_HashEntry *hashPtr; - int new; + int isNew; UINT i; HPALETTE sysPal; @@ -496,7 +496,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 +509,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)); } @@ -535,7 +535,7 @@ XCreateColormap( int XFreeColormap( - Display *display, + TCL_UNUSED(Display *), Colormap colormap) { TkWinColormap *cmap = (TkWinColormap *) colormap; diff --git a/win/tkWinKey.c b/win/tkWinKey.c index 0cd086c..e1ec558 100644 --- a/win/tkWinKey.c +++ b/win/tkWinKey.c @@ -90,7 +90,7 @@ static KeySym KeycodeToKeysym(unsigned int keycode, const char * TkpGetString( - TkWindow *winPtr, /* Window where event occurred: needed to get + TCL_UNUSED(TkWindow *), /* Window where event occurred: needed to get * input context. */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Uninitialized or empty string to hold @@ -151,7 +151,7 @@ TkpGetString( KeySym XKeycodeToKeysym( - Display *display, + TCL_UNUSED(Display *), unsigned int keycode, int index) { @@ -505,7 +505,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; @@ -521,18 +521,18 @@ TkpInitKeymapInfo( } } if (dispPtr->numModKeyCodes >= arraySize) { - KeyCode *new; + KeyCode *newKey; /* * Ran out of space in the array; grow it. */ arraySize *= 2; - new = ckalloc(arraySize * sizeof(KeyCode)); - memcpy(new, dispPtr->modKeyCodes, + newKey = (KeyCode *)ckalloc(arraySize * sizeof(KeyCode)); + memcpy(newKey, dispPtr->modKeyCodes, dispPtr->numModKeyCodes * sizeof(KeyCode)); ckfree(dispPtr->modKeyCodes); - dispPtr->modKeyCodes = new; + dispPtr->modKeyCodes = newKey; } dispPtr->modKeyCodes[dispPtr->numModKeyCodes] = *codePtr; dispPtr->numModKeyCodes++; @@ -549,7 +549,7 @@ TkpInitKeymapInfo( void TkpSetKeycodeAndState( - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), KeySym keySym, XEvent *eventPtr) { @@ -607,7 +607,7 @@ TkpSetKeycodeAndState( KeyCode XKeysymToKeycode( - Display *display, + TCL_UNUSED(Display *), KeySym keysym) { int i; @@ -655,12 +655,12 @@ XKeysymToKeycode( XModifierKeymap * XGetModifierMapping( - Display *display) + TCL_UNUSED(Display *)) { - XModifierKeymap *map = ckalloc(sizeof(XModifierKeymap)); + XModifierKeymap *map = (XModifierKeymap *)ckalloc(sizeof(XModifierKeymap)); map->max_keypermod = 1; - map->modifiermap = ckalloc(sizeof(KeyCode) * 8); + map->modifiermap = (KeyCode *)ckalloc(sizeof(KeyCode) * 8); map->modifiermap[ShiftMapIndex] = VK_SHIFT; map->modifiermap[LockMapIndex] = VK_CAPITAL; map->modifiermap[ControlMapIndex] = VK_CONTROL; @@ -716,7 +716,7 @@ XFreeModifiermap( KeySym XStringToKeysym( - _Xconst char *string) + TCL_UNUSED(_Xconst char *)) { return NoSymbol; } @@ -739,7 +739,7 @@ XStringToKeysym( char * XKeysymToString( - KeySym keysym) + TCL_UNUSED(KeySym)) { return NULL; } diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index 56fc87c..e5990e5 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,12 +66,12 @@ 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) { entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, - (char *)twdPtr->window.handle); + twdPtr->window.handle); Tcl_DeleteHashEntry(entryPtr); } @@ -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; @@ -115,7 +115,7 @@ Tk_HWNDToWindow( Tcl_InitHashTable(&tsdPtr->windowTable, TCL_ONE_WORD_KEYS); tsdPtr->initialized = 1; } - entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, (char *) hwnd); + entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, hwnd); if (entryPtr != NULL) { return (Tk_Window) Tcl_GetHashValue(entryPtr); } @@ -314,7 +314,7 @@ XDestroyWindow( TkPointerDeadWindow(winPtr); - entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, (char*)hwnd); + entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, hwnd); if (entryPtr != NULL) { Tcl_DeleteHashEntry(entryPtr); } |