diff options
Diffstat (limited to 'generic/tkVisual.c')
-rw-r--r-- | generic/tkVisual.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 1b880d1..8b43e6e 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkVisual.c,v 1.10 2007/12/13 15:24:21 dgp Exp $ + * RCS: @(#) $Id: tkVisual.c,v 1.13 2009/09/07 07:29:04 das Exp $ */ #include "tkInt.h" @@ -22,12 +22,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}, @@ -88,7 +88,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. */ @@ -103,8 +103,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; @@ -303,6 +303,7 @@ Tk_GetVisual( bestPtr = &visInfoList[i]; bestPrio = prio; } + CLANG_ASSERT(bestPtr); *depthPtr = bestPtr->depth; visual = bestPtr->visual; XFree((char *) visInfoList); @@ -326,7 +327,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); @@ -368,7 +369,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; @@ -381,7 +382,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); @@ -480,7 +481,7 @@ Tk_FreeColormap( } else { prevPtr->nextPtr = cmapPtr->nextPtr; } - ckfree((char *) cmapPtr); + ckfree(cmapPtr); } return; } |