summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-03-12 17:45:37 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-03-12 17:45:37 (GMT)
commita9b80c492179a73f008fd8cc5aa7e8a7b9e87bf9 (patch)
tree08a6b50f74f697e9ebc1f689f06d7318c0aa83a2 /unix
parentd27c3b360cd9cb780be362ed6ce435776ca42fc1 (diff)
downloadtk-a9b80c492179a73f008fd8cc5aa7e8a7b9e87bf9.zip
tk-a9b80c492179a73f008fd8cc5aa7e8a7b9e87bf9.tar.gz
tk-a9b80c492179a73f008fd8cc5aa7e8a7b9e87bf9.tar.bz2
Remove casts from uses of ckalloc/ckfree/... now that Tcl declares them to be
using useful casts internally.
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnix3d.c3
-rw-r--r--unix/tkUnixButton.c3
-rw-r--r--unix/tkUnixColor.c14
-rw-r--r--unix/tkUnixCursor.c8
-rw-r--r--unix/tkUnixDialog.c4
-rw-r--r--unix/tkUnixEmbed.c6
-rw-r--r--unix/tkUnixEvent.c2
-rw-r--r--unix/tkUnixFont.c25
-rw-r--r--unix/tkUnixKey.c12
-rw-r--r--unix/tkUnixMenubu.c2
-rw-r--r--unix/tkUnixRFont.c8
-rw-r--r--unix/tkUnixScale.c2
-rw-r--r--unix/tkUnixScrlbr.c3
-rw-r--r--unix/tkUnixSelect.c13
-rw-r--r--unix/tkUnixSend.c28
-rw-r--r--unix/tkUnixWm.c85
16 files changed, 105 insertions, 113 deletions
diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c
index b4efbf8..f9be640 100644
--- a/unix/tkUnix3d.c
+++ b/unix/tkUnix3d.c
@@ -48,7 +48,8 @@ typedef struct {
TkBorder *
TkpGetBorder(void)
{
- UnixBorder *borderPtr = (UnixBorder *) ckalloc(sizeof(UnixBorder));
+ UnixBorder *borderPtr = ckalloc(sizeof(UnixBorder));
+
borderPtr->solidGC = None;
return (TkBorder *) borderPtr;
}
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index c4c9c44..de6cf2a 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -330,7 +330,8 @@ TkButton *
TkpCreateButton(
Tk_Window tkwin)
{
- UnixButton *butPtr = (UnixButton *) ckalloc(sizeof(UnixButton));
+ UnixButton *butPtr = ckalloc(sizeof(UnixButton));
+
return (TkButton *) butPtr;
}
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c
index 4e872ed..38434e9 100644
--- a/unix/tkUnixColor.c
+++ b/unix/tkUnixColor.c
@@ -178,7 +178,7 @@ TkpGetColor(
}
}
- tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
+ tkColPtr = ckalloc(sizeof(TkColor));
tkColPtr->color = color;
return tkColPtr;
@@ -213,7 +213,7 @@ TkpGetColorByValue(
{
Display *display = Tk_Display(tkwin);
Colormap colormap = Tk_Colormap(tkwin);
- TkColor *tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
+ TkColor *tkColPtr = ckalloc(sizeof(TkColor));
tkColPtr->color.red = colorPtr->red;
tkColPtr->color.green = colorPtr->green;
@@ -271,7 +271,7 @@ FindClosestColor(
for (stressPtr = dispPtr->stressPtr; ; stressPtr = stressPtr->nextPtr) {
if (stressPtr == NULL) {
- stressPtr = (TkStressedCmap *) ckalloc(sizeof(TkStressedCmap));
+ stressPtr = ckalloc(sizeof(TkStressedCmap));
stressPtr->colormap = colormap;
template.visualid = XVisualIDFromVisual(Tk_Visual(tkwin));
@@ -283,8 +283,8 @@ FindClosestColor(
stressPtr->numColors = visInfoPtr->colormap_size;
XFree((char *) visInfoPtr);
- stressPtr->colorPtr = (XColor *) ckalloc((unsigned)
- (stressPtr->numColors * sizeof(XColor)));
+ stressPtr->colorPtr =
+ ckalloc(stressPtr->numColors * sizeof(XColor));
for (i = 0; i < stressPtr->numColors; i++) {
stressPtr->colorPtr[i].pixel = (unsigned long) i;
}
@@ -392,8 +392,8 @@ DeleteStressedCmap(
} else {
prevPtr->nextPtr = stressPtr->nextPtr;
}
- ckfree((char *) stressPtr->colorPtr);
- ckfree((char *) stressPtr);
+ ckfree(stressPtr->colorPtr);
+ ckfree(stressPtr);
return;
}
}
diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c
index 59c415a..fbb4148 100644
--- a/unix/tkUnixCursor.c
+++ b/unix/tkUnixCursor.c
@@ -334,20 +334,20 @@ TkGetCursorByName(
}
if (cursor != None) {
- cursorPtr = (TkUnixCursor *) ckalloc(sizeof(TkUnixCursor));
+ cursorPtr = ckalloc(sizeof(TkUnixCursor));
cursorPtr->info.cursor = (Tk_Cursor) cursor;
cursorPtr->display = display;
}
cleanup:
if (argv != NULL) {
- ckfree((char *) argv);
+ ckfree(argv);
}
return (TkCursor *) cursorPtr;
badString:
if (argv) {
- ckfree((char *) argv);
+ ckfree(argv);
}
Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
return NULL;
@@ -594,7 +594,7 @@ TkCreateCursorFromData(
Tk_FreePixmap(display, maskPixmap);
if (cursor != None) {
- cursorPtr = (TkUnixCursor *) ckalloc(sizeof(TkUnixCursor));
+ cursorPtr = ckalloc(sizeof(TkUnixCursor));
cursorPtr->info.cursor = (Tk_Cursor) cursor;
cursorPtr->display = display;
}
diff --git a/unix/tkUnixDialog.c b/unix/tkUnixDialog.c
index 851edf3..7cddcbd 100644
--- a/unix/tkUnixDialog.c
+++ b/unix/tkUnixDialog.c
@@ -49,14 +49,14 @@ EvalObjv(
cmdObj = Tcl_NewStringObj(cmdName, -1);
Tcl_IncrRefCount(cmdObj);
- objs = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj*) * (unsigned)(objc+1));
+ objs = ckalloc(sizeof(Tcl_Obj *) * (objc+1));
objs[0] = cmdObj;
memcpy(objs+1, objv, sizeof(Tcl_Obj *) * (unsigned)objc);
result = Tcl_EvalObjv(interp, objc+1, objs, 0);
Tcl_DecrRefCount(cmdObj);
- ckfree((char *) objs);
+ ckfree(objs);
return result;
}
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index 206beb2..cd09974 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -179,7 +179,7 @@ TkpUseWindow(
}
}
if (containerPtr == NULL) {
- containerPtr = (Container *) ckalloc(sizeof(Container));
+ containerPtr = ckalloc(sizeof(Container));
containerPtr->parent = parent;
containerPtr->parentRoot = parentAtts.root;
containerPtr->parentPtr = NULL;
@@ -282,7 +282,7 @@ TkpMakeContainer(
*/
Tk_MakeWindowExist(tkwin);
- containerPtr = (Container *) ckalloc(sizeof(Container));
+ containerPtr = ckalloc(sizeof(Container));
containerPtr->parent = Tk_WindowId(tkwin);
containerPtr->parentRoot = RootWindowOfScreen(Tk_Screen(tkwin));
containerPtr->parentPtr = winPtr;
@@ -975,7 +975,7 @@ EmbedWindowDeleted(
} else {
prevPtr->nextPtr = containerPtr->nextPtr;
}
- ckfree((char *) containerPtr);
+ ckfree(containerPtr);
}
}
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index 390c72a..5c13762 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -123,7 +123,7 @@ TkpOpenDisplay(
if (display == NULL) {
return NULL;
}
- dispPtr = (TkDisplay *) ckalloc(sizeof(TkDisplay));
+ dispPtr = ckalloc(sizeof(TkDisplay));
memset(dispPtr, 0, sizeof(TkDisplay));
dispPtr->display = display;
#ifdef TK_USE_INPUT_METHODS
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 62f594b..c168622 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -721,7 +721,7 @@ TkpGetNativeFont(
}
fontStructPtr = CreateClosestFont(tkwin, &fa.fa, &fa.xa);
}
- fontPtr = (UnixFont *) ckalloc(sizeof(UnixFont));
+ fontPtr = ckalloc(sizeof(UnixFont));
InitFont(tkwin, fontStructPtr, fontPtr);
return (TkFont *) fontPtr;
@@ -777,7 +777,7 @@ TkpGetFontFromAttributes(
fontPtr = (UnixFont *) tkFontPtr;
if (fontPtr == NULL) {
- fontPtr = (UnixFont *) ckalloc(sizeof(UnixFont));
+ fontPtr = ckalloc(sizeof(UnixFont));
} else {
ReleaseFont(fontPtr);
}
@@ -1729,7 +1729,7 @@ ReleaseFont(
ReleaseSubFont(fontPtr->display, &fontPtr->subFontArray[i]);
}
if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
- ckfree((char *) fontPtr->subFontArray);
+ ckfree(fontPtr->subFontArray);
}
}
@@ -1846,7 +1846,7 @@ AllocFontFamily(
}
}
- familyPtr = (FontFamily *) ckalloc(sizeof(FontFamily));
+ familyPtr = ckalloc(sizeof(FontFamily));
memset(familyPtr, 0, sizeof(FontFamily));
familyPtr->nextPtr = tsdPtr->fontFamilyList;
tsdPtr->fontFamilyList = familyPtr;
@@ -1933,7 +1933,7 @@ FreeFontFamily(
familyPtrPtr = &(*familyPtrPtr)->nextPtr;
}
- ckfree((char *) familyPtr);
+ ckfree(familyPtr);
}
/*
@@ -2213,7 +2213,7 @@ FontMapLoadPage(
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- subFontPtr->fontMap[row] = (char *) ckalloc(FONTMAP_BITSPERPAGE / 8);
+ subFontPtr->fontMap[row] = ckalloc(FONTMAP_BITSPERPAGE / 8);
memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8);
if (subFontPtr->familyPtr == &tsdPtr->controlFamily) {
@@ -2545,7 +2545,7 @@ CanUseFallback(
* make a copy.
*/
- nameList = (char **) ckalloc(numNames * sizeof(char *));
+ nameList = ckalloc(numNames * sizeof(char *));
memcpy(nameList, nameListOrig, numNames * sizeof(char *));
}
nameList[nameIdx] = NULL;
@@ -2563,7 +2563,7 @@ CanUseFallback(
if (fontStructPtr == NULL) {
if (nameList != nameListOrig) {
- ckfree((char *) nameList);
+ ckfree(nameList);
}
XFreeFontNames(nameListOrig);
return NULL;
@@ -2583,16 +2583,15 @@ CanUseFallback(
goto retry;
}
if (nameList != nameListOrig) {
- ckfree((char *) nameList);
+ ckfree(nameList);
}
XFreeFontNames(nameListOrig);
if (fontPtr->numSubFonts >= SUBFONT_SPACE) {
SubFont *newPtr;
- newPtr = (SubFont *)
- ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
- memcpy((char *) newPtr, fontPtr->subFontArray,
+ newPtr = ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
+ memcpy(newPtr, fontPtr->subFontArray,
fontPtr->numSubFonts * sizeof(SubFont));
if (fixSubFontPtrPtr != NULL) {
register SubFont *fixSubFontPtr = *fixSubFontPtrPtr;
@@ -2603,7 +2602,7 @@ CanUseFallback(
}
}
if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
- ckfree((char *) fontPtr->subFontArray);
+ ckfree(fontPtr->subFontArray);
}
fontPtr->subFontArray = newPtr;
}
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index 47646b5..a1afffa 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -204,7 +204,7 @@ TkpGetString(
* from having to reenter the XIM engine. [Bug 1373712]
*/
- kePtr->charValuePtr = ckalloc((unsigned) len + 1);
+ kePtr->charValuePtr = ckalloc(len + 1);
kePtr->charValueLen = len;
memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), (unsigned) len + 1);
return Tcl_DStringValue(dsPtr);
@@ -417,12 +417,11 @@ TkpInitKeymapInfo(
*/
if (dispPtr->modKeyCodes != NULL) {
- ckfree((char *) dispPtr->modKeyCodes);
+ ckfree(dispPtr->modKeyCodes);
}
dispPtr->numModKeyCodes = 0;
arraySize = KEYCODE_ARRAY_SIZE;
- dispPtr->modKeyCodes = (KeyCode *)
- ckalloc((unsigned) (KEYCODE_ARRAY_SIZE * sizeof(KeyCode)));
+ dispPtr->modKeyCodes = ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode));
for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) {
if (*codePtr == 0) {
continue;
@@ -449,11 +448,10 @@ TkpInitKeymapInfo(
*/
arraySize *= 2;
- newCodes = (KeyCode *)
- ckalloc((unsigned) (arraySize * sizeof(KeyCode)));
+ newCodes = ckalloc(arraySize * sizeof(KeyCode));
memcpy(newCodes, dispPtr->modKeyCodes,
dispPtr->numModKeyCodes * sizeof(KeyCode));
- ckfree((char *) dispPtr->modKeyCodes);
+ ckfree(dispPtr->modKeyCodes);
dispPtr->modKeyCodes = newCodes;
}
dispPtr->modKeyCodes[dispPtr->numModKeyCodes] = *codePtr;
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index 790d804..04769fd 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -36,7 +36,7 @@ TkMenuButton *
TkpCreateMenuButton(
Tk_Window tkwin)
{
- return (TkMenuButton *)ckalloc(sizeof(TkMenuButton));
+ return ckalloc(sizeof(TkMenuButton));
}
/*
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index d77ee5f..ba19303 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -240,7 +240,7 @@ InitFont(
int i, iWidth;
if (!fontPtr) {
- fontPtr = (UnixFtFont *) ckalloc(sizeof(UnixFtFont));
+ fontPtr = ckalloc(sizeof(UnixFtFont));
}
FcConfigSubstitute(0, pattern, FcMatchPattern);
@@ -252,13 +252,13 @@ InitFont(
set = FcFontSort(0, pattern, FcTrue, NULL, &result);
if (!set) {
- ckfree((char *) fontPtr);
+ ckfree(fontPtr);
return NULL;
}
fontPtr->fontset = set;
fontPtr->pattern = pattern;
- fontPtr->faces = (UnixFtFace *) ckalloc(set->nfont * sizeof(UnixFtFace));
+ fontPtr->faces = ckalloc(set->nfont * sizeof(UnixFtFace));
fontPtr->nfaces = set->nfont;
/*
@@ -357,7 +357,7 @@ FinishedWithFont(
}
}
if (fontPtr->faces) {
- ckfree((char *) fontPtr->faces);
+ ckfree(fontPtr->faces);
}
if (fontPtr->pattern) {
FcPatternDestroy(fontPtr->pattern);
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index 7e06b3f..102e03f 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.c
@@ -48,7 +48,7 @@ TkScale *
TkpCreateScale(
Tk_Window tkwin)
{
- return (TkScale *) ckalloc(sizeof(TkScale));
+ return ckalloc(sizeof(TkScale));
}
/*
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c
index 2af22b8..122c906 100644
--- a/unix/tkUnixScrlbr.c
+++ b/unix/tkUnixScrlbr.c
@@ -65,8 +65,7 @@ TkScrollbar *
TkpCreateScrollbar(
Tk_Window tkwin)
{
- UnixScrollbar *scrollPtr = (UnixScrollbar *)
- ckalloc(sizeof(UnixScrollbar));
+ UnixScrollbar *scrollPtr = ckalloc(sizeof(UnixScrollbar));
scrollPtr->troughGC = None;
scrollPtr->copyGC = None;
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 6e39ee4..6dd5008 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -644,14 +644,14 @@ TkSelEventProc(
}
if (propInfo[numItems] != '\0') {
- propData = ckalloc((size_t) numItems + 1);
+ propData = ckalloc(numItems + 1);
strcpy(propData, propInfo);
propData[numItems] = '\0';
}
retrPtr->result = retrPtr->proc(retrPtr->clientData,
retrPtr->interp, propData);
if (propData != propInfo) {
- ckfree((char *) propData);
+ ckfree(propData);
}
} else if (type == dispPtr->incrAtom) {
@@ -886,8 +886,7 @@ ConvertSelection(
* below).
*/
- incr.converts = (ConvertInfo *)
- ckalloc((unsigned) incr.numConversions * sizeof(ConvertInfo));
+ incr.converts = ckalloc(incr.numConversions * sizeof(ConvertInfo));
incr.numIncrs = 0;
for (i = 0; i < incr.numConversions; i++) {
Atom target, property, type;
@@ -1075,7 +1074,7 @@ ConvertSelection(
* All done. Cleanup and return.
*/
- ckfree((char *) incr.converts);
+ ckfree(incr.converts);
if (multiple) {
XFree((char *) incr.multAtoms);
}
@@ -1426,7 +1425,7 @@ SelCvtToX(
if (Tcl_SplitList(NULL, string, &numFields, &field) != TCL_OK) {
return NULL;
}
- propPtr = (long *) ckalloc((unsigned) numFields*sizeof(long));
+ propPtr = ckalloc(numFields * sizeof(long));
/*
* Convert the fields one-by-one.
@@ -1451,7 +1450,7 @@ SelCvtToX(
* Release the parsed list.
*/
- ckfree((char *) field);
+ ckfree(field);
*numLongsPtr = i;
return propPtr;
}
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index 515be11..36069e0 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -268,7 +268,7 @@ RegOpen(
SendInit(interp, dispPtr);
}
- regPtr = (NameRegistry *) ckalloc(sizeof(NameRegistry));
+ regPtr = ckalloc(sizeof(NameRegistry));
regPtr->dispPtr = dispPtr;
regPtr->locked = 0;
regPtr->modified = 0;
@@ -475,7 +475,7 @@ RegAddName(
sprintf(id, "%x ", (unsigned) commWindow);
idLength = strlen(id);
newBytes = idLength + strlen(name) + 1;
- newProp = ckalloc((unsigned) (regPtr->propLength + newBytes));
+ newProp = ckalloc(regPtr->propLength + newBytes);
strcpy(newProp, id);
strcpy(newProp+idLength, name);
if (regPtr->property != NULL) {
@@ -549,7 +549,7 @@ RegClose(
ckfree(regPtr->property);
}
}
- ckfree((char *) regPtr);
+ ckfree(regPtr);
}
/*
@@ -635,7 +635,7 @@ ValidateName(
break;
}
}
- ckfree((char *) argv);
+ ckfree(argv);
}
} else {
result = 0;
@@ -819,7 +819,7 @@ Tk_SetAppName(
* the "send" command to the interpreter.
*/
- riPtr = (RegisteredInterp *) ckalloc(sizeof(RegisteredInterp));
+ riPtr = ckalloc(sizeof(RegisteredInterp));
riPtr->interp = interp;
riPtr->dispPtr = winPtr->dispPtr;
riPtr->nextPtr = tsdPtr->interpListPtr;
@@ -903,7 +903,7 @@ Tk_SetAppName(
RegAddName(regPtr, actualName, Tk_WindowId(dispPtr->commTkwin));
RegClose(regPtr);
- riPtr->name = (char *) ckalloc((unsigned) (strlen(actualName) + 1));
+ riPtr->name = ckalloc(strlen(actualName) + 1);
strcpy(riPtr->name, actualName);
if (actualName != name) {
Tcl_DStringFree(&dString);
@@ -1159,7 +1159,7 @@ Tk_SendCmd(
msg = "target application died";
}
pending.code = TCL_ERROR;
- pending.result = (char *) ckalloc((unsigned) (strlen(msg) + 1));
+ pending.result = ckalloc(strlen(msg) + 1);
strcpy(pending.result, msg);
pending.gotResponse = 1;
} else {
@@ -1681,19 +1681,16 @@ SendEventProc(
}
pcPtr->code = code;
if (resultString != NULL) {
- pcPtr->result =
- ckalloc((unsigned) (strlen(resultString) + 1));
+ pcPtr->result = ckalloc(strlen(resultString) + 1);
strcpy(pcPtr->result, resultString);
}
if (code == TCL_ERROR) {
if (errorInfo != NULL) {
- pcPtr->errorInfo =
- ckalloc((unsigned) (strlen(errorInfo) + 1));
+ pcPtr->errorInfo = ckalloc(strlen(errorInfo) + 1);
strcpy(pcPtr->errorInfo, errorInfo);
}
if (errorCode != NULL) {
- pcPtr->errorCode =
- ckalloc((unsigned) (strlen(errorCode) + 1));
+ pcPtr->errorCode = ckalloc(strlen(errorCode) + 1);
strcpy(pcPtr->errorCode, errorCode);
}
}
@@ -1782,8 +1779,7 @@ AppendErrorProc(
for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL;
pcPtr = pcPtr->nextPtr) {
if ((pcPtr == pendingPtr) && (pcPtr->result == NULL)) {
- pcPtr->result = (char *) ckalloc((unsigned)
- (strlen(pcPtr->target) + 50));
+ pcPtr->result = ckalloc(strlen(pcPtr->target) + 50);
sprintf(pcPtr->result, "no application named \"%s\"",
pcPtr->target);
pcPtr->code = TCL_ERROR;
@@ -1837,7 +1833,7 @@ DeleteProc(
}
}
}
- ckfree((char *) riPtr->name);
+ ckfree(riPtr->name);
riPtr->interp = NULL;
UpdateCommWindow(riPtr->dispPtr);
Tcl_EventuallyFree(riPtr, TCL_DYNAMIC);
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 61b94a7..4143efa 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -497,7 +497,7 @@ void TkWmCleanup(
ckfree(wmPtr->iconName);
}
if (wmPtr->iconDataPtr != NULL) {
- ckfree((char *) wmPtr->iconDataPtr);
+ ckfree(wmPtr->iconDataPtr);
}
if (wmPtr->leaderName != NULL) {
ckfree(wmPtr->leaderName);
@@ -515,15 +515,15 @@ void TkWmCleanup(
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);
}
- ckfree((char *) wmPtr);
+ ckfree(wmPtr);
}
if (dispPtr->iconDataPtr != NULL) {
- ckfree((char *) dispPtr->iconDataPtr);
+ ckfree(dispPtr->iconDataPtr);
dispPtr->iconDataPtr = NULL;
}
}
@@ -552,7 +552,7 @@ TkWmNewWindow(
register WmInfo *wmPtr;
TkDisplay *dispPtr = winPtr->dispPtr;
- wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo));
+ wmPtr = ckalloc(sizeof(WmInfo));
memset(wmPtr, 0, sizeof(WmInfo));
wmPtr->winPtr = winPtr;
wmPtr->reparent = None;
@@ -842,7 +842,7 @@ TkWmDeadWindow(
ckfree(wmPtr->iconName);
}
if (wmPtr->iconDataPtr != NULL) {
- ckfree((char *) wmPtr->iconDataPtr);
+ ckfree(wmPtr->iconDataPtr);
}
if (wmPtr->hints.flags & IconPixmapHint) {
Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
@@ -887,10 +887,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) {
Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr);
@@ -935,7 +935,7 @@ TkWmDeadWindow(
StructureNotifyMask, WmWaitMapProc, winPtr);
wmPtr->masterPtr = NULL;
}
- ckfree((char *) wmPtr);
+ ckfree(wmPtr);
winPtr->wmInfoPtr = NULL;
}
@@ -1459,7 +1459,7 @@ 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;
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XDeleteProperty(winPtr->display, wmPtr->wrapperPtr->window,
@@ -1470,9 +1470,9 @@ WmClientCmd(
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);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
@@ -1569,14 +1569,14 @@ WmColormapwindowsCmd(
!= TCL_OK) {
return TCL_ERROR;
}
- cmapList = (Window *) ckalloc((unsigned) (windowObjc+1) * sizeof(Window));
+ cmapList = ckalloc((windowObjc+1) * sizeof(Window));
gotToplevel = 0;
for (i = 0; i < windowObjc; i++) {
Tk_Window mapWin;
if (TkGetWindowFromObj(interp, tkwin, windowObjv[i],
&mapWin) != TCL_OK) {
- ckfree((char *) cmapList);
+ ckfree(cmapList);
return TCL_ERROR;
}
winPtr2 = (TkWindow *) mapWin;
@@ -1598,7 +1598,7 @@ WmColormapwindowsCmd(
wmPtr->flags |= WM_COLORMAPS_EXPLICIT;
XSetWMColormapWindows(winPtr->display, wmPtr->wrapperPtr->window,
cmapList, windowObjc);
- ckfree((char *) cmapList);
+ ckfree(cmapList);
return TCL_OK;
}
@@ -1647,7 +1647,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;
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XDeleteProperty(winPtr->display, wmPtr->wrapperPtr->window,
@@ -1660,7 +1660,7 @@ WmCommandCmd(
return TCL_ERROR;
}
if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
+ ckfree(wmPtr->cmdArgv);
}
wmPtr->cmdArgc = cmdArgc;
wmPtr->cmdArgv = cmdArgv;
@@ -2083,7 +2083,7 @@ WmGroupCmd(
}
wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr);
wmPtr->hints.flags |= WindowGroupHint;
- wmPtr->leaderName = ckalloc((unsigned) length + 1);
+ wmPtr->leaderName = ckalloc(length + 1);
strcpy(wmPtr->leaderName, argv3);
}
UpdateHints(winPtr);
@@ -2310,10 +2310,10 @@ WmIconnameCmd(
return TCL_OK;
} else {
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)) {
UpdateTitle(winPtr);
@@ -2396,8 +2396,7 @@ WmIconphotoCmd(
* defines CARD32 arrays to use. [Bug 2902814]
*/
- iconPropertyData = (unsigned long *)
- attemptckalloc(sizeof(unsigned long) * size);
+ iconPropertyData = attemptckalloc(sizeof(unsigned long) * size);
if (iconPropertyData == NULL) {
return TCL_ERROR;
}
@@ -2448,12 +2447,12 @@ WmIconphotoCmd(
}
}
if (wmPtr->iconDataPtr != NULL) {
- ckfree((char *) wmPtr->iconDataPtr);
+ ckfree(wmPtr->iconDataPtr);
wmPtr->iconDataPtr = NULL;
}
if (isDefault) {
if (winPtr->dispPtr->iconDataPtr != NULL) {
- ckfree((char *) winPtr->dispPtr->iconDataPtr);
+ ckfree(winPtr->dispPtr->iconDataPtr);
}
winPtr->dispPtr->iconDataPtr = (unsigned char *) iconPropertyData;
winPtr->dispPtr->iconDataSize = size;
@@ -3023,7 +3022,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;
@@ -3205,7 +3204,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 {
@@ -3257,7 +3256,7 @@ WmStackorderCmd(
}
}
/* ASSERT: index1 != -1 && index2 != -2 [Bug 1789819] */
- ckfree((char *) windows);
+ ckfree(windows);
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
&index) != TCL_OK) {
@@ -3408,10 +3407,10 @@ WmTitleCmd(
return TCL_OK;
} else {
if (wmPtr->title != NULL) {
- ckfree((char *) wmPtr->title);
+ ckfree(wmPtr->title);
}
argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->title = ckalloc((unsigned) length + 1);
+ wmPtr->title = ckalloc(length + 1);
strcpy(wmPtr->title, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -5381,13 +5380,14 @@ SetNetWmType(TkWindow *winPtr, Tcl_Obj *typePtr)
}
if (objc > 0) {
- atoms = (Atom *)ckalloc(sizeof(Atom) * objc);
+ atoms = ckalloc(sizeof(Atom) * objc);
}
for (n = 0; n < objc; ++n) {
Tcl_DString ds, dsName;
int len;
char *name = Tcl_GetStringFromObj(objv[n], &len);
+
Tcl_UtfToUpper(name);
Tcl_UtfToExternalDString(NULL, name, len, &dsName);
Tcl_DStringInit(&ds);
@@ -5409,7 +5409,7 @@ SetNetWmType(TkWindow *winPtr, Tcl_Obj *typePtr)
XChangeProperty(Tk_Display(tkwin), wrapperPtr->window, typeAtom,
XA_ATOM, 32, PropModeReplace, (unsigned char *) atoms, objc);
- ckfree((char *)atoms);
+ ckfree(atoms);
return TCL_OK;
}
@@ -6127,7 +6127,7 @@ UpdateWmProtocols(
protPtr = protPtr->nextPtr, count++) {
/* Empty loop body; we're just counting the handlers. */
}
- arrayPtr = (Atom *) ckalloc((unsigned) count * sizeof(Atom));
+ arrayPtr = ckalloc(count * sizeof(Atom));
deleteWindowAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr,
"WM_DELETE_WINDOW");
pingAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr, "_NET_WM_PING");
@@ -6144,7 +6144,7 @@ UpdateWmProtocols(
Tk_InternAtom((Tk_Window) wmPtr->winPtr, "WM_PROTOCOLS"),
XA_ATOM, 32, PropModeReplace, (unsigned char *) arrayPtr,
atomPtr-arrayPtr);
- ckfree((char *) arrayPtr);
+ ckfree(arrayPtr);
}
/*
@@ -6320,8 +6320,7 @@ TkWmStackorderToplevel(
Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS);
TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table);
- window_ptr = windows = (TkWindow **)
- ckalloc((table.numEntries+1) * sizeof(TkWindow *));
+ window_ptr = windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *));
/*
* Special cases: If zero or one toplevels were mapped there is no need to
@@ -6346,7 +6345,7 @@ TkWmStackorderToplevel(
if (XQueryTree(parentPtr->display, vRoot, &dummy1, &dummy2,
&children, &numChildren) == 0) {
- ckfree((char *) windows);
+ ckfree(windows);
windows = NULL;
} else {
for (i = 0; i < numChildren; i++) {
@@ -6522,7 +6521,7 @@ TkWmAddToColormapWindows(
* add the toplevel itself as the last element of the list.
*/
- newPtr = (Window *) ckalloc((unsigned) (count+2) * sizeof(Window));
+ newPtr = ckalloc((count+2) * sizeof(Window));
for (i = 0; i < count; i++) {
newPtr[i] = oldPtr[i];
}
@@ -6533,7 +6532,7 @@ TkWmAddToColormapWindows(
newPtr[count] = topPtr->window;
XSetWMColormapWindows(topPtr->display, wrapperPtr->window, newPtr,
count+1);
- ckfree((char *) newPtr);
+ ckfree(newPtr);
if (oldPtr != NULL) {
XFree((char *) oldPtr);
}
@@ -7213,8 +7212,8 @@ UpdateCommand(
* entire DString is done.
*/
- cmdArgv = (char **) ckalloc(sizeof(char *) * wmPtr->cmdArgc);
- offsets = (int *) ckalloc( sizeof(int) * wmPtr->cmdArgc);
+ cmdArgv = ckalloc(sizeof(char *) * wmPtr->cmdArgc);
+ offsets = ckalloc(sizeof(int) * wmPtr->cmdArgc);
Tcl_DStringInit(&cmds);
for (i = 0; i < wmPtr->cmdArgc; i++) {
Tcl_UtfToExternalDString(NULL, wmPtr->cmdArgv[i], -1, &ds);
@@ -7231,8 +7230,8 @@ UpdateCommand(
XSetCommand(winPtr->display, wmPtr->wrapperPtr->window,
cmdArgv, wmPtr->cmdArgc);
Tcl_DStringFree(&cmds);
- ckfree((char *) cmdArgv);
- ckfree((char *) offsets);
+ ckfree(cmdArgv);
+ ckfree(offsets);
}
/*