summaryrefslogtreecommitdiffstats
path: root/generic/tkVisual.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkVisual.c')
-rw-r--r--generic/tkVisual.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/generic/tkVisual.c b/generic/tkVisual.c
index ec8be11..3602088 100644
--- a/generic/tkVisual.c
+++ b/generic/tkVisual.c
@@ -20,12 +20,12 @@
*/
typedef struct VisualDictionary {
- char *name; /* Textual name of class. */
+ const char *name; /* Textual name of class. */
int minLength; /* Minimum # characters that must be specified
* for an unambiguous match. */
int class; /* X symbol for class. */
} VisualDictionary;
-static VisualDictionary visualNames[] = {
+static const VisualDictionary visualNames[] = {
{"best", 1, 0},
{"directcolor", 2, DirectColor},
{"grayscale", 1, GrayScale},
@@ -86,7 +86,7 @@ Visual *
Tk_GetVisual(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
Tk_Window tkwin, /* Window in which visual will be used. */
- CONST char *string, /* String describing visual. See manual entry
+ const char *string, /* String describing visual. See manual entry
* for details. */
int *depthPtr, /* The depth of the returned visual is stored
* here. */
@@ -101,8 +101,8 @@ Tk_GetVisual(
Visual *visual;
ptrdiff_t length;
int c, numVisuals, prio, bestPrio, i;
- CONST char *p;
- VisualDictionary *dictPtr;
+ const char *p;
+ const VisualDictionary *dictPtr;
TkColormap *cmapPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -301,6 +301,7 @@ Tk_GetVisual(
bestPtr = &visInfoList[i];
bestPrio = prio;
}
+ CLANG_ASSERT(bestPtr);
*depthPtr = bestPtr->depth;
visual = bestPtr->visual;
XFree((char *) visInfoList);
@@ -324,7 +325,7 @@ Tk_GetVisual(
goto done;
}
}
- cmapPtr = (TkColormap *) ckalloc(sizeof(TkColormap));
+ cmapPtr = ckalloc(sizeof(TkColormap));
cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin),
RootWindowOfScreen(Tk_Screen(tkwin)), visual,
AllocNone);
@@ -366,7 +367,7 @@ Colormap
Tk_GetColormap(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
Tk_Window tkwin, /* Window where colormap will be used. */
- CONST char *string) /* String that identifies colormap: either
+ const char *string) /* String that identifies colormap: either
* "new" or the name of another window. */
{
Colormap colormap;
@@ -379,7 +380,7 @@ Tk_GetColormap(
*/
if (strcmp(string, "new") == 0) {
- cmapPtr = (TkColormap *) ckalloc(sizeof(TkColormap));
+ cmapPtr = ckalloc(sizeof(TkColormap));
cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin),
RootWindowOfScreen(Tk_Screen(tkwin)), Tk_Visual(tkwin),
AllocNone);
@@ -478,7 +479,7 @@ Tk_FreeColormap(
} else {
prevPtr->nextPtr = cmapPtr->nextPtr;
}
- ckfree((char *) cmapPtr);
+ ckfree(cmapPtr);
}
return;
}