diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-03-12 17:45:37 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-03-12 17:45:37 (GMT) |
commit | e0b895874d5fa39f6d4134b407e930b80ee3ecd7 (patch) | |
tree | 08a6b50f74f697e9ebc1f689f06d7318c0aa83a2 /macosx | |
parent | 77d7867fd5b20233f0fa9163bd8a44d2ac274b0e (diff) | |
download | tk-e0b895874d5fa39f6d4134b407e930b80ee3ecd7.zip tk-e0b895874d5fa39f6d4134b407e930b80ee3ecd7.tar.gz tk-e0b895874d5fa39f6d4134b407e930b80ee3ecd7.tar.bz2 |
Remove casts from uses of ckalloc/ckfree/... now that Tcl declares them to be
using useful casts internally.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXBitmap.c | 6 | ||||
-rw-r--r-- | macosx/tkMacOSXButton.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXColor.c | 8 | ||||
-rw-r--r-- | macosx/tkMacOSXCursor.c | 6 | ||||
-rw-r--r-- | macosx/tkMacOSXDialog.c | 34 | ||||
-rw-r--r-- | macosx/tkMacOSXEmbed.c | 27 | ||||
-rw-r--r-- | macosx/tkMacOSXEvent.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXFont.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXHLEvents.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXKeyboard.c | 8 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXMenubutton.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXScale.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXScrlbr.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXSend.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 10 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 56 | ||||
-rw-r--r-- | macosx/tkMacOSXXStubs.c | 18 |
18 files changed, 94 insertions, 105 deletions
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c index 70900a9..ce16da4 100644 --- a/macosx/tkMacOSXBitmap.c +++ b/macosx/tkMacOSXBitmap.c @@ -99,8 +99,8 @@ TkpDefineNativeBitmaps(void) name = Tk_GetUid(builtInPtr->name); predefHashPtr = Tcl_CreateHashEntry(tablePtr, name, &isNew); if (isNew) { - TkPredefBitmap *predefPtr = (TkPredefBitmap *) - ckalloc(sizeof(TkPredefBitmap)); + TkPredefBitmap *predefPtr = ckalloc(sizeof(TkPredefBitmap)); + predefPtr->source = UINT2PTR(builtInPtr->iconType); predefPtr->width = builtInIconSize; predefPtr->height = builtInIconSize; @@ -438,7 +438,7 @@ TkMacOSXIconBitmapObjCmd( iconBitmap = Tcl_GetHashValue(hPtr); ckfree(iconBitmap->value); } else { - iconBitmap = (IconBitmap *) ckalloc(sizeof(IconBitmap)); + iconBitmap = ckalloc(sizeof(IconBitmap)); Tcl_SetHashValue(hPtr, iconBitmap); } *iconBitmap = ib; diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 41edd9b..a033990 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -106,7 +106,7 @@ TkButton * TkpCreateButton( Tk_Window tkwin) { - MacButton *macButtonPtr = (MacButton *) ckalloc(sizeof(MacButton)); + MacButton *macButtonPtr = ckalloc(sizeof(MacButton)); macButtonPtr->button = nil; macButtonPtr->image = nil; diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index b5a4a87..5906ced 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -595,7 +595,7 @@ TkpGetColor( color.red = color.green = color.blue = rgba[0] * 65535.0; break; default: - Tcl_Panic("CGColor with %d components", n); + Tcl_Panic("CGColor with %d components", (int) n); } color.pixel = ((((((pixelCode << 8) | ((color.red >> 8) & 0xff)) << 8) @@ -609,11 +609,11 @@ TkpGetColor( } if (XParseColor(display, colormap, name, &color) == 0) { - return (TkColor *) NULL; + return NULL; } validXColor: - tkColPtr = (TkColor *) ckalloc(sizeof(TkColor)); + tkColPtr = ckalloc(sizeof(TkColor)); tkColPtr->color = color; return tkColPtr; @@ -647,7 +647,7 @@ TkpGetColorByValue( XColor *colorPtr) /* Red, green, and blue fields indicate * desired color. */ { - TkColor *tkColPtr = (TkColor *) ckalloc(sizeof(TkColor)); + TkColor *tkColPtr = ckalloc(sizeof(TkColor)); tkColPtr->color.red = colorPtr->red; tkColPtr->color.green = colorPtr->green; diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 1312fbd..56ac364 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -383,19 +383,19 @@ TkGetCursorByName( if (Tcl_SplitList(interp, string, &argc, &argv) == TCL_OK) { if (argc) { - macCursorPtr = (TkMacOSXCursor *) ckalloc(sizeof(TkMacOSXCursor)); + macCursorPtr = ckalloc(sizeof(TkMacOSXCursor)); macCursorPtr->info.cursor = (Tk_Cursor) macCursorPtr; macCursorPtr->macCursor = nil; macCursorPtr->type = 0; FindCursorByName(macCursorPtr, argv[0]); } - ckfree((char *) argv); + ckfree(argv); } if (!macCursorPtr || (!macCursorPtr->macCursor && macCursorPtr->type != NONE)) { Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL); if (macCursorPtr) { - ckfree((char *)macCursorPtr); + ckfree(macCursorPtr); macCursorPtr = NULL; } } diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 8d07996..e1f0fd8 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -162,12 +162,12 @@ static const short alertNativeButtonIndexAndTypeToButtonIndex[][3] = { callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { - tmpv = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); + tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = resultObj; TkBackgroundEvalObjv(callbackInfo->interp, objc + 1, tmpv, TCL_EVAL_GLOBAL); - ckfree((char *)tmpv); + ckfree(tmpv); } } else { Tcl_SetObjResult(callbackInfo->interp, resultObj); @@ -180,7 +180,7 @@ static const short alertNativeButtonIndexAndTypeToButtonIndex[][3] = { } if (callbackInfo->cmdObj) { Tcl_DecrRefCount(callbackInfo->cmdObj); - ckfree((char*) callbackInfo); + ckfree(callbackInfo); } } @@ -200,12 +200,12 @@ static const short alertNativeButtonIndexAndTypeToButtonIndex[][3] = { callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { - tmpv = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); + tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = resultObj; TkBackgroundEvalObjv(callbackInfo->interp, objc + 1, tmpv, TCL_EVAL_GLOBAL); - ckfree((char *)tmpv); + ckfree(tmpv); } } else { Tcl_SetObjResult(callbackInfo->interp, resultObj); @@ -216,7 +216,7 @@ static const short alertNativeButtonIndexAndTypeToButtonIndex[][3] = { } if (callbackInfo->cmdObj) { Tcl_DecrRefCount(callbackInfo->cmdObj); - ckfree((char*) callbackInfo); + ckfree(callbackInfo); } } @end @@ -472,8 +472,7 @@ Tk_GetOpenFileObjCmd( } [panel setAllowsMultipleSelection:multiple]; if (cmdObj) { - callbackInfo = (FilePanelCallbackInfo *) - ckalloc(sizeof(FilePanelCallbackInfo)); + callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } @@ -647,8 +646,7 @@ Tk_GetSaveFileObjCmd( [panel setCanSelectHiddenExtension:YES]; [panel setExtensionHidden:NO]; if (cmdObj) { - callbackInfo = (FilePanelCallbackInfo *) - ckalloc(sizeof(FilePanelCallbackInfo)); + callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } @@ -769,8 +767,7 @@ Tk_ChooseDirectoryObjCmd( [panel setCanChooseDirectories:YES]; [panel setCanCreateDirectories:!mustexist]; if (cmdObj) { - callbackInfo = (FilePanelCallbackInfo *) - ckalloc(sizeof(FilePanelCallbackInfo)); + callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } @@ -1042,8 +1039,7 @@ Tk_MessageBoxObjCmd( [[buttons objectAtIndex: defaultNativeButtonIndex-1] setKeyEquivalent: @"\r"]; if (cmdObj) { - callbackInfo = (AlertCallbackInfo *) - ckalloc(sizeof(AlertCallbackInfo)); + callbackInfo = ckalloc(sizeof(AlertCallbackInfo)); if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } @@ -1220,13 +1216,12 @@ FontchooserEvent( result = Tcl_ListObjGetElements(fontchooserInterp, fcdPtr->cmdObj, &objc, &objv); if (result == TCL_OK) { - tmpv = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj *) * - (unsigned)(objc + 2)); + tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = fontObj; TkBackgroundEvalObjv(fontchooserInterp, objc + 1, tmpv, TCL_EVAL_GLOBAL); - ckfree((char *)tmpv); + ckfree(tmpv); } } TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged"); @@ -1602,7 +1597,7 @@ DeleteFontchooserData( if (fcdPtr->cmdObj) { Tcl_DecrRefCount(fcdPtr->cmdObj); } - ckfree((char *)fcdPtr); + ckfree(fcdPtr); if (fontchooserInterp == interp) { fontchooserInterp = NULL; @@ -1631,8 +1626,7 @@ TkInitFontchooser( Tcl_Interp *interp, ClientData clientData) { - FontchooserData *fcdPtr = (FontchooserData*) - ckalloc(sizeof(FontchooserData)); + FontchooserData *fcdPtr = ckalloc(sizeof(FontchooserData)); bzero(fcdPtr, sizeof(FontchooserData)); Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteFontchooserData, diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index fd1bae6..f29d752 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -92,8 +92,7 @@ Tk_MacOSXSetEmbedHandler( Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc) { if (tkMacOSXEmbedHandler == NULL) { - tkMacOSXEmbedHandler = (TkMacOSXEmbedHandler *) - ckalloc(sizeof(TkMacOSXEmbedHandler)); + tkMacOSXEmbedHandler = ckalloc(sizeof(TkMacOSXEmbedHandler)); } tkMacOSXEmbedHandler->registerWinProc = registerWinProc; tkMacOSXEmbedHandler->getPortProc = getPortProc; @@ -137,7 +136,7 @@ TkpMakeWindow( * Allocate sub window */ - macWin = (MacDrawable *) ckalloc(sizeof(MacDrawable)); + macWin = ckalloc(sizeof(MacDrawable)); if (macWin == NULL) { winPtr->privatePtr = NULL; return None; @@ -263,7 +262,7 @@ TkpUseWindow( * Make the embedded window. */ - macWin = (MacDrawable *) ckalloc(sizeof(MacDrawable)); + macWin = ckalloc(sizeof(MacDrawable)); if (macWin == NULL) { winPtr->privatePtr = NULL; return TCL_ERROR; @@ -318,15 +317,15 @@ TkpUseWindow( Tcl_AppendResult(interp, "The window ID ", string, " does not correspond to a valid Tk Window.", NULL); return TCL_ERROR; - } else { - containerPtr = (Container *) ckalloc(sizeof(Container)); - - containerPtr->parentPtr = NULL; - containerPtr->embedded = (Window) macWin; - containerPtr->embeddedPtr = macWin->winPtr; - containerPtr->nextPtr = firstContainerPtr; - firstContainerPtr = containerPtr; } + + containerPtr = ckalloc(sizeof(Container)); + + containerPtr->parentPtr = NULL; + containerPtr->embedded = (Window) macWin; + containerPtr->embeddedPtr = macWin->winPtr; + containerPtr->nextPtr = firstContainerPtr; + firstContainerPtr = containerPtr; } else { /* * The window is embedded in another Tk window. @@ -392,7 +391,7 @@ TkpMakeContainer( */ Tk_MakeWindowExist(tkwin); - containerPtr = (Container *) ckalloc(sizeof(Container)); + containerPtr = ckalloc(sizeof(Container)); containerPtr->parent = Tk_WindowId(tkwin); containerPtr->parentPtr = winPtr; containerPtr->embedded = None; @@ -1117,7 +1116,7 @@ EmbedWindowDeleted( } else { prevPtr->nextPtr = containerPtr->nextPtr; } - ckfree((char *) containerPtr); + ckfree(containerPtr); } } diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c index 37d4efe..d8d71d7 100644 --- a/macosx/tkMacOSXEvent.c +++ b/macosx/tkMacOSXEvent.c @@ -135,7 +135,7 @@ TkMacOSXFlushWindows(void) NSCountWindows(&windowCount); if(windowCount) { - windowNumbers = (NSInteger *) ckalloc(windowCount * sizeof(NSInteger)); + windowNumbers = ckalloc(windowCount * sizeof(NSInteger)); NSWindowList(windowCount, windowNumbers); for (NSInteger index = 0; index < windowCount; index++) { NSWindow *w = [NSApp windowWithWindowNumber:windowNumbers[index]]; @@ -143,7 +143,7 @@ TkMacOSXFlushWindows(void) [w flushWindow]; } } - ckfree((char*) windowNumbers); + ckfree(windowNumbers); } } diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 7548ace..5bd9265 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -453,7 +453,7 @@ TkpGetNativeFont( ctFont = CTFontCreateUIFontForLanguage(HIThemeGetUIFontType( themeFontId), 0, NULL); if (ctFont) { - fontPtr = (MacFont *) ckalloc(sizeof(MacFont)); + fontPtr = ckalloc(sizeof(MacFont)); InitFont((NSFont*) ctFont, NULL, fontPtr); } @@ -522,7 +522,7 @@ TkpGetFontFromAttributes( Tcl_Panic("Could not deternmine NSFont from TkFontAttributes"); } if (tkFontPtr == NULL) { - fontPtr = (MacFont *) ckalloc(sizeof(MacFont)); + fontPtr = ckalloc(sizeof(MacFont)); } else { fontPtr = (MacFont *) tkFontPtr; TkpDeleteFont(tkFontPtr); diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index 6157d48..11ac7e6 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -188,7 +188,7 @@ QuitHandler( * quickly as possible. */ - eventPtr = (KillEvent *) ckalloc(sizeof(KillEvent)); + eventPtr = ckalloc(sizeof(KillEvent)); eventPtr->header.proc = ReallyKillMe; eventPtr->interp = interp; diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index a12273e..bd9d008 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -460,7 +460,7 @@ XGetModifierMapping( * don't generate them either. So there is no modifier map. */ - modmap = (XModifierKeymap *) ckalloc(sizeof(XModifierKeymap)); + modmap = ckalloc(sizeof(XModifierKeymap)); modmap->max_keypermod = 0; modmap->modifiermap = NULL; return modmap; @@ -487,9 +487,9 @@ XFreeModifiermap( XModifierKeymap *modmap) { if (modmap->modifiermap != NULL) { - ckfree((char *) modmap->modifiermap); + ckfree(modmap->modifiermap); } - ckfree((char *) modmap); + ckfree(modmap); } /* @@ -899,7 +899,7 @@ TkpInitKeymapInfo( */ if (dispPtr->modKeyCodes != NULL) { - ckfree((char *) dispPtr->modKeyCodes); + ckfree(dispPtr->modKeyCodes); } dispPtr->numModKeyCodes = 0; dispPtr->modKeyCodes = NULL; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 42064ae..dcb4a3f 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -1424,10 +1424,10 @@ TkpMenuInit(void) [NSMenuItem setUsesUserKeyEquivalents:NO]; tkColPtr = TkpGetColor(None, DEF_MENU_BG_COLOR); defaultBg = tkColPtr->color.pixel; - ckfree((char *) tkColPtr); + ckfree(tkColPtr); tkColPtr = TkpGetColor(None, DEF_MENU_FG); defaultFg = tkColPtr->color.pixel; - ckfree((char *) tkColPtr); + ckfree(tkColPtr); ChkErr(GetThemeMetric, kThemeMetricMenuMarkColumnWidth, &menuMarkColumnWidth); diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index 4b0e0be..dafbb25 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -89,11 +89,9 @@ TkMenuButton * TkpCreateMenuButton( Tk_Window tkwin) { - MacMenuButton *macButtonPtr = - (MacMenuButton *) ckalloc(sizeof(MacMenuButton)); + MacMenuButton *macButtonPtr = ckalloc(sizeof(MacMenuButton)); macButtonPtr->button = nil; - Tk_CreateEventHandler(tkwin, ActivateMask, MenuButtonEventProc, (ClientData) macButtonPtr); return (TkMenuButton *) macButtonPtr; diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c index 02a6832..9a4c03e 100644 --- a/macosx/tkMacOSXScale.c +++ b/macosx/tkMacOSXScale.c @@ -78,7 +78,7 @@ TkScale * TkpCreateScale( Tk_Window tkwin) { - MacScale *macScalePtr = (MacScale *) ckalloc(sizeof(MacScale)); + MacScale *macScalePtr = ckalloc(sizeof(MacScale)); macScalePtr->scaleHandle = NULL; if (scaleActionProc == NULL) { diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index aabc719..0d18695 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -227,7 +227,7 @@ TkScrollbar * TkpCreateScrollbar( Tk_Window tkwin) { - MacScrollbar *scrollPtr = (MacScrollbar *) ckalloc(sizeof(MacScrollbar)); + MacScrollbar *scrollPtr = ckalloc(sizeof(MacScrollbar)); scrollPtr->scroller = nil; Tk_CreateEventHandler(tkwin, StructureNotifyMask|FocusChangeMask| diff --git a/macosx/tkMacOSXSend.c b/macosx/tkMacOSXSend.c index 3ba434a..4734faf 100644 --- a/macosx/tkMacOSXSend.c +++ b/macosx/tkMacOSXSend.c @@ -283,7 +283,7 @@ Tk_SetAppName( * We have found a unique name. Now add it to the registry. */ - riPtr = (RegisteredInterp *) ckalloc(sizeof(RegisteredInterp)); + riPtr = ckalloc(sizeof(RegisteredInterp)); riPtr->interp = interp; riPtr->name = ckalloc(strlen(actualName) + 1); riPtr->nextPtr = interpListPtr; diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 0f13aae..4107450 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -83,9 +83,9 @@ XDestroyWindow( } if (macWin->toplevel->referenceCount == 0) { - ckfree((char *) macWin->toplevel); + ckfree(macWin->toplevel); } - ckfree((char *) macWin); + ckfree(macWin); return; } if (macWin->visRgn) { @@ -105,7 +105,7 @@ XDestroyWindow( */ if (macWin->toplevel->referenceCount == 0) { - ckfree((char *) macWin->toplevel); + ckfree(macWin->toplevel); } } @@ -1290,7 +1290,7 @@ Tk_GetPixmap( if (display != NULL) { display->request++; } - macPix = (MacDrawable *) ckalloc(sizeof(MacDrawable)); + macPix = ckalloc(sizeof(MacDrawable)); macPix->winPtr = NULL; macPix->xOff = 0; macPix->yOff = 0; @@ -1339,7 +1339,7 @@ Tk_FreePixmap( } CFRelease(macPix->context); } - ckfree((char *) macPix); + ckfree(macPix); } /* diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index fa1839f..4df82fe 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -468,7 +468,7 @@ FrontWindowAtPoint( NSCountWindows(&windowCount); if (windowCount) { - windowNumbers = (NSInteger *) ckalloc(windowCount * sizeof(NSInteger)); + windowNumbers = ckalloc(windowCount * sizeof(NSInteger)); NSWindowList(windowCount, windowNumbers); for (NSInteger index = 0; index < windowCount; index++) { NSWindow *w = [NSApp windowWithWindowNumber:windowNumbers[index]]; @@ -477,7 +477,7 @@ FrontWindowAtPoint( break; } } - ckfree((char *) windowNumbers); + ckfree(windowNumbers); } return (win ? TkMacOSXGetTkWindow(win) : NULL); } @@ -504,7 +504,7 @@ void TkWmNewWindow( TkWindow *winPtr) /* Newly-created top-level window. */ { - WmInfo *wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo)); + WmInfo *wmPtr = ckalloc(sizeof(WmInfo)); wmPtr->winPtr = winPtr; wmPtr->reparent = None; @@ -761,10 +761,10 @@ TkWmDeadWindow( Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); } if (wmPtr->cmdArgv != NULL) { - ckfree((char *) wmPtr->cmdArgv); + ckfree(wmPtr->cmdArgv); } if (wmPtr->clientMachine != NULL) { - ckfree((char *) wmPtr->clientMachine); + ckfree(wmPtr->clientMachine); } if (wmPtr->flags & WM_UPDATE_PENDING) { Tk_CancelIdleCall(UpdateGeometryInfo, winPtr); @@ -788,7 +788,7 @@ TkWmDeadWindow( TkMacOSXMakeCollectableAndRelease(wmPtr->window); } - ckfree((char *) wmPtr); + ckfree(wmPtr); winPtr->wmInfoPtr = NULL; } @@ -1351,15 +1351,15 @@ WmClientCmd( argv3 = Tcl_GetStringFromObj(objv[3], &length); if (argv3[0] == 0) { if (wmPtr->clientMachine != NULL) { - ckfree((char *) wmPtr->clientMachine); + ckfree(wmPtr->clientMachine); wmPtr->clientMachine = NULL; } return TCL_OK; } if (wmPtr->clientMachine != NULL) { - ckfree((char *) wmPtr->clientMachine); + ckfree(wmPtr->clientMachine); } - wmPtr->clientMachine = ckalloc((unsigned) length + 1); + wmPtr->clientMachine = ckalloc(length + 1); strcpy(wmPtr->clientMachine, argv3); return TCL_OK; } @@ -1414,12 +1414,11 @@ WmColormapwindowsCmd( != TCL_OK) { return TCL_ERROR; } - cmapList = (TkWindow **) ckalloc((unsigned) - ((windowObjc+1) * sizeof(TkWindow*))); + cmapList = ckalloc((windowObjc+1) * sizeof(TkWindow*)); for (i = 0; i < windowObjc; i++) { if (TkGetWindowFromObj(interp, tkwin, windowObjv[i], (Tk_Window *) &winPtr2) != TCL_OK) { - ckfree((char *) cmapList); + ckfree(cmapList); return TCL_ERROR; } if (winPtr2 == winPtr) { @@ -1439,7 +1438,7 @@ WmColormapwindowsCmd( } wmPtr->flags |= WM_COLORMAPS_EXPLICIT; if (wmPtr->cmapList != NULL) { - ckfree((char *) wmPtr->cmapList); + ckfree(wmPtr->cmapList); } wmPtr->cmapList = cmapList; wmPtr->cmapCount = windowObjc; @@ -1497,7 +1496,7 @@ WmCommandCmd( argv3 = Tcl_GetString(objv[3]); if (argv3[0] == 0) { if (wmPtr->cmdArgv != NULL) { - ckfree((char *) wmPtr->cmdArgv); + ckfree(wmPtr->cmdArgv); wmPtr->cmdArgv = NULL; } return TCL_OK; @@ -1506,7 +1505,7 @@ WmCommandCmd( return TCL_ERROR; } if (wmPtr->cmdArgv != NULL) { - ckfree((char *) wmPtr->cmdArgv); + ckfree(wmPtr->cmdArgv); } wmPtr->cmdArgc = cmdArgc; wmPtr->cmdArgv = cmdArgv; @@ -1927,7 +1926,7 @@ WmGroupCmd( } wmPtr->hints.window_group = Tk_WindowId(tkwin2); wmPtr->hints.flags |= WindowGroupHint; - wmPtr->leaderName = ckalloc((unsigned) (length + 1)); + wmPtr->leaderName = ckalloc(length + 1); strcpy(wmPtr->leaderName, argv3); } return TCL_OK; @@ -2153,10 +2152,10 @@ WmIconnameCmd( } if (wmPtr->iconName != NULL) { - ckfree((char *) wmPtr->iconName); + ckfree(wmPtr->iconName); } argv3 = Tcl_GetStringFromObj(objv[3], &length); - wmPtr->iconName = ckalloc((unsigned) length + 1); + wmPtr->iconName = ckalloc(length + 1); strcpy(wmPtr->iconName, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName); @@ -2731,7 +2730,7 @@ WmProtocolCmd( } cmd = Tcl_GetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { - protPtr = (ProtocolHandler *) ckalloc(HANDLER_SIZE(cmdLength)); + protPtr = ckalloc(HANDLER_SIZE(cmdLength)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; @@ -2928,7 +2927,7 @@ WmStackorderCmd( for (window_ptr = windows; *window_ptr ; window_ptr++) { Tcl_AppendElement(interp, (*window_ptr)->pathName); } - ckfree((char *) windows); + ckfree(windows); return TCL_OK; } else { TkWindow *winPtr2; @@ -2983,7 +2982,7 @@ WmStackorderCmd( Tcl_Panic("winPtr2 window not found"); } - ckfree((char *) windows); + ckfree(windows); if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0, &index) != TCL_OK) { @@ -3231,7 +3230,7 @@ WmTransientCmd( if (wmPtr->masterWindowName != NULL) { ckfree(wmPtr->masterWindowName); } - wmPtr->masterWindowName = ckalloc((unsigned) length+1); + wmPtr->masterWindowName = ckalloc(length+1); strcpy(wmPtr->masterWindowName, masterWindowName); } ApplyMasterOverrideChanges(winPtr, NULL); @@ -4542,7 +4541,7 @@ TkWmAddToColormapWindows( * add the toplevel itself as the last element of the list. */ - newPtr = (TkWindow **) ckalloc((unsigned) (count+2)*sizeof(TkWindow *)); + newPtr = ckalloc((count+2) * sizeof(TkWindow *)); if (count > 0) { memcpy(newPtr, oldPtr, count * sizeof(TkWindow *)); } @@ -4552,7 +4551,7 @@ TkWmAddToColormapWindows( newPtr[count-1] = winPtr; newPtr[count] = topPtr; if (oldPtr != NULL) { - ckfree((char *) oldPtr); + ckfree(oldPtr); } topPtr->wmInfoPtr->cmapList = newPtr; @@ -5945,8 +5944,7 @@ TkWmStackorderToplevel( Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); - windows = (TkWindow **) - ckalloc((table.numEntries+1) * sizeof(TkWindow *)); + windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *)); /* * Special cases: If zero or one toplevels were mapped there is no need to @@ -5966,12 +5964,12 @@ TkWmStackorderToplevel( NSCountWindows(&windowCount); if (!windowCount) { - ckfree((char *) windows); + ckfree(windows); windows = NULL; } else { window_ptr = windows + table.numEntries; *window_ptr-- = NULL; - windowNumbers = (NSInteger *) ckalloc(windowCount * sizeof(NSInteger)); + windowNumbers = ckalloc(windowCount * sizeof(NSInteger)); NSWindowList(windowCount, windowNumbers); for (NSInteger index = 0; index < windowCount; index++) { NSWindow *w = [NSApp windowWithWindowNumber:windowNumbers[index]]; @@ -5988,7 +5986,7 @@ TkWmStackorderToplevel( Tcl_Panic("num matched toplevel windows does not equal num " "children"); } - ckfree((char *) windowNumbers); + ckfree(windowNumbers); } done: diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 8bef50d..70f8e39 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -153,8 +153,8 @@ TkpOpenDisplay( } } - display = (Display *) ckalloc(sizeof(Display)); - screen = (Screen *) ckalloc(sizeof(Screen)); + display = ckalloc(sizeof(Display)); + screen = ckalloc(sizeof(Screen)); bzero(display, sizeof(Display)); bzero(screen, sizeof(Screen)); @@ -194,7 +194,7 @@ TkpOpenDisplay( screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24; screen->ext_data = (XExtData *) &maxBounds; - screen->root_visual = (Visual *) ckalloc(sizeof(Visual)); + screen->root_visual = ckalloc(sizeof(Visual)); screen->root_visual->visualid = 0; screen->root_visual->class = TrueColor; screen->root_visual->red_mask = 0x00FF0000; @@ -209,7 +209,7 @@ TkpOpenDisplay( TkMacOSXDisplayChanged(display); - gMacDisplay = (TkDisplay *) ckalloc(sizeof(TkDisplay)); + gMacDisplay = ckalloc(sizeof(TkDisplay)); /* * This is the quickest way to make sure that all the *Init flags get @@ -251,11 +251,11 @@ TkpCloseDisplay( gMacDisplay = NULL; if (display->screens != NULL) { if (display->screens->root_visual != NULL) { - ckfree((char *) display->screens->root_visual); + ckfree(display->screens->root_visual); } - ckfree((char *) display->screens); + ckfree(display->screens); } - ckfree((char *) display); + ckfree(display); } /* @@ -784,7 +784,7 @@ XCreateImage( XImage *ximage; display->request++; - ximage = (XImage *) ckalloc(sizeof(XImage)); + ximage = ckalloc(sizeof(XImage)); ximage->height = height; ximage->width = width; @@ -946,7 +946,7 @@ DestroyImage( } else if (image->data) { ckfree(image->data); } - ckfree((char*) image); + ckfree(image); } return 0; } |