diff options
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | generic/tkFont.c | 38 | ||||
-rw-r--r-- | generic/tkFont.h | 10 | ||||
-rw-r--r-- | generic/ttk/ttkDefaultTheme.c | 24 | ||||
-rw-r--r-- | generic/ttk/ttkState.c | 6 | ||||
-rw-r--r-- | generic/ttk/ttkTheme.h | 6 | ||||
-rw-r--r-- | macosx/tkMacOSXFont.c | 6 | ||||
-rw-r--r-- | unix/tkUnixFont.c | 28 |
8 files changed, 75 insertions, 58 deletions
@@ -1,3 +1,14 @@ +2008-11-02 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tkFont.h: more internal -Wwrite-strings warning fixes + * generic/tkFont.c + * generic/ttk/ttkTheme.h + * generic/ttk/ttkDefaultTheme.c + * generic/ttk/ttkState.c + * macosx/tkMacOSXFont.c + * unix/tkUnixFont.c + * win/tkWinFont.c + 2008-11-01 Donal K. Fellows <dkf@users.sf.net> TIP #97 IMPLEMENTATION @@ -32,8 +43,8 @@ 2008-10-30 Jan Nijtmans <nijtmans@users.sf.net> * generic/tkAtom.c: more internal -Wwrite-strings warning fixes - * generic/tkBusy.c (thanks, Joe, for fixing tkAtom.c, but this - * generic/tkButton.c is how it should have been fixed) + * generic/tkBusy.c + * generic/tkButton.c * generic/tkCanvPoly.c * generic/tkCanvText.c * generic/tkCmds.c diff --git a/generic/tkFont.c b/generic/tkFont.c index 4caace0..a0fac74 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFont.c,v 1.47 2008/10/15 06:41:06 nijtmans Exp $ + * RCS: @(#) $Id: tkFont.c,v 1.48 2008/11/02 09:54:02 nijtmans Exp $ */ #include "tkInt.h" @@ -190,27 +190,27 @@ static const char *const fontOpt[] = { * the alias list are also automatically tried. */ -static char *timesAliases[] = { +static const char *const timesAliases[] = { "Times", /* Unix. */ "Times New Roman", /* Windows. */ "New York", /* Mac. */ NULL }; -static char *helveticaAliases[] = { +static const char *const helveticaAliases[] = { "Helvetica", /* Unix. */ "Arial", /* Windows. */ "Geneva", /* Mac. */ NULL }; -static char *courierAliases[] = { +static const char *const courierAliases[] = { "Courier", /* Unix and Mac. */ "Courier New", /* Windows. */ NULL }; -static char *minchoAliases[] = { +static const char *const minchoAliases[] = { "mincho", /* Unix. */ "\357\274\255\357\274\263 \346\230\216\346\234\235", /* Windows (MS mincho). */ @@ -219,7 +219,7 @@ static char *minchoAliases[] = { NULL }; -static char *gothicAliases[] = { +static const char *const gothicAliases[] = { "gothic", /* Unix. */ "\357\274\255\357\274\263 \343\202\264\343\202\267\343\203\203\343\202\257", /* Windows (MS goshikku). */ @@ -228,7 +228,7 @@ static char *gothicAliases[] = { NULL }; -static char *dingbatsAliases[] = { +static const char *const dingbatsAliases[] = { "dingbats", "zapfdingbats", "itc zapfdingbats", /* Unix. */ /* Windows. */ @@ -236,7 +236,7 @@ static char *dingbatsAliases[] = { NULL }; -static char **fontAliases[] = { +static const char *const *const fontAliases[] = { timesAliases, helveticaAliases, courierAliases, @@ -252,7 +252,7 @@ static char **fontAliases[] = { * be examined also. */ -static char *systemClass[] = { +static const char *const systemClass[] = { "fixed", /* Unix. */ /* Windows. */ "chicago", "osaka", "sistemny", @@ -260,7 +260,7 @@ static char *systemClass[] = { NULL }; -static char *serifClass[] = { +static const char *const serifClass[] = { "times", "palatino", "mincho", /* All platforms. */ "song ti", /* Unix. */ @@ -270,7 +270,7 @@ static char *serifClass[] = { NULL }; -static char *sansClass[] = { +static const char *const sansClass[] = { "helvetica", "gothic", /* All platforms. */ /* Unix. */ "ms sans serif", "traditional arabic", @@ -279,7 +279,7 @@ static char *sansClass[] = { NULL }; -static char *monoClass[] = { +static const char *const monoClass[] = { "courier", "gothic", /* All platforms. */ "fangsong ti", /* Unix. */ "simplified arabic fixed", /* Windows. */ @@ -287,11 +287,11 @@ static char *monoClass[] = { NULL }; -static char *symbolClass[] = { +static const char *const symbolClass[] = { "symbol", "dingbats", "wingdings", NULL }; -static char **fontFallbacks[] = { +static const char *const *const fontFallbacks[] = { systemClass, serifClass, sansClass, @@ -306,7 +306,7 @@ static char **fontFallbacks[] = { * found, all font families in the system are examined. */ -static char *globalFontClass[] = { +static const char *const globalFontClass[] = { "symbol", /* All platforms. */ /* Unix. */ "lucida sans unicode", /* Windows. */ @@ -3674,7 +3674,7 @@ TkFontGetPoints( *------------------------------------------------------------------------- */ -char ** +const char *const * TkFontGetAliasList( const char *faceName) /* Font name to test for aliases. */ { @@ -3707,7 +3707,7 @@ TkFontGetAliasList( *------------------------------------------------------------------------- */ -char *** +const char *const *const * TkFontGetFallbacks(void) { return fontFallbacks; @@ -3732,7 +3732,7 @@ TkFontGetFallbacks(void) *------------------------------------------------------------------------- */ -char ** +const char *const * TkFontGetGlobalClass(void) { return globalFontClass; @@ -3755,7 +3755,7 @@ TkFontGetGlobalClass(void) *------------------------------------------------------------------------- */ -char ** +const char *const * TkFontGetSymbolClass(void) { return symbolClass; diff --git a/generic/tkFont.h b/generic/tkFont.h index 1253700..078e151 100644 --- a/generic/tkFont.h +++ b/generic/tkFont.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFont.h,v 1.11 2008/05/02 10:28:18 dkf Exp $ + * RCS: @(#) $Id: tkFont.h,v 1.12 2008/11/02 09:54:02 nijtmans Exp $ */ #ifndef _TKFONT @@ -197,12 +197,12 @@ typedef struct TkXLFDAttributes { MODULE_SCOPE int TkFontParseXLFD(const char *string, TkFontAttributes *faPtr, TkXLFDAttributes *xaPtr); -MODULE_SCOPE char ** TkFontGetAliasList(const char *faceName); -MODULE_SCOPE char *** TkFontGetFallbacks(void); +MODULE_SCOPE CONST86 char *CONST86 * TkFontGetAliasList(const char *faceName); +MODULE_SCOPE CONST86 char *CONST86 *CONST86 * TkFontGetFallbacks(void); MODULE_SCOPE int TkFontGetPixels(Tk_Window tkwin, int size); MODULE_SCOPE int TkFontGetPoints(Tk_Window tkwin, int size); -MODULE_SCOPE char ** TkFontGetGlobalClass(void); -MODULE_SCOPE char ** TkFontGetSymbolClass(void); +MODULE_SCOPE CONST86 char *CONST86 * TkFontGetGlobalClass(void); +MODULE_SCOPE CONST86 char *CONST86 * TkFontGetSymbolClass(void); MODULE_SCOPE int TkCreateNamedFont(Tcl_Interp *interp, Tk_Window tkwin, const char *name, TkFontAttributes *faPtr); MODULE_SCOPE int TkDeleteNamedFont(Tcl_Interp *interp, diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index c8558af..95b4e38 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -1,4 +1,4 @@ -/* $Id: ttkDefaultTheme.c,v 1.12 2008/07/04 19:05:04 jenglish Exp $ +/* $Id: ttkDefaultTheme.c,v 1.13 2008/11/02 09:54:02 nijtmans Exp $ * * Copyright (c) 2003, Joe English * @@ -39,7 +39,7 @@ static const int WIN32_XDRAWLINE_HACK = 0; enum BorderColor { FLAT = 1, LITE = 2, DARK = 3, BRDR = 4 }; /* top-left outer, top-left inner, bottom-right inner, bottom-right outer */ -static int shadowColors[6][4] = +static int const shadowColors[6][4] = { { FLAT, FLAT, FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/ { DARK, LITE, DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/ @@ -50,7 +50,7 @@ static int shadowColors[6][4] = }; /* top-left, bottom-right */ -static int thinShadowColors[6][4] = +static int const thinShadowColors[6][4] = { { FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/ { DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/ @@ -204,7 +204,7 @@ void TtkArrowSize(int h, ArrowDirection dir, int *widthPtr, int *heightPtr) * TtkDrawArrow, TtkFillArrow -- * Draw an arrow in the indicated direction inside the specified box. */ -/*public*/ +/*public*/ void TtkFillArrow( Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir) { @@ -214,7 +214,7 @@ void TtkFillArrow( XDrawLines(display, d, gc, points, 4, CoordModeOrigin); } -/*public*/ +/*public*/ void TtkDrawArrow( Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir) { @@ -296,7 +296,7 @@ static void BorderElementDraw( if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { GC gc = Tk_GCForColor(borderColor, d); - XDrawRectangle(Tk_Display(tkwin), d, gc, + XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); } if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { @@ -379,13 +379,13 @@ typedef struct int width; /* Width of each image */ int height; /* Height of each image */ int nimages; /* #images / row */ - char **pixels; /* array[height] of char[width*nimage] */ + const char *const *pixels; /* array[height] of char[width*nimage] */ Ttk_StateTable *map;/* used to look up image index by state */ } IndicatorSpec; #if 0 /*XPM*/ -static char *button_images[] = { +static const char *const button_images[] = { /* width height ncolors chars_per_pixel */ "52 26 7 1", /* colors */ @@ -408,7 +408,7 @@ static Ttk_StateTable checkbutton_states[] = { 3, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0 }, { 0, 0, 0 } }; -static char *checkbutton_pixels[] = { +static const char *const checkbutton_pixels[] = { "AAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAAB", "AEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECB", "AEDDDDDDDDDCBAEDDDDDDDDDCBAEFFFFFFFFFCBAEFFFFFFFFFCB", @@ -440,7 +440,7 @@ static Ttk_StateTable radiobutton_states[] = { 0, 0, 0 } }; -static char *radiobutton_pixels[] = { +static const char *const radiobutton_pixels[] = { "FFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFF", "FFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFF", "FAEEDDDDECBFFFAEEDDDDECBFFFAEEFFFFECBFFFAEEFFFFECBFF", @@ -621,9 +621,9 @@ static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) }, - { "-background", TK_OPTION_BORDER, + { "-background", TK_OPTION_BORDER, Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND }, - { "-bordercolor", TK_OPTION_COLOR, + { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(ArrowElement,borderColorObj), "black" }, { "-relief", TK_OPTION_RELIEF, Tk_Offset(ArrowElement,reliefObj),"raised"}, diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c index 8923fa6..29a526d 100644 --- a/generic/ttk/ttkState.c +++ b/generic/ttk/ttkState.c @@ -1,5 +1,5 @@ /* - * $Id: ttkState.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkState.c,v 1.2 2008/11/02 09:54:02 nijtmans Exp $ * * Tk widget state utilities. * @@ -16,7 +16,7 @@ * Table of state names. Must be kept in sync with TTK_STATE_* * #defines in ttkTheme.h. */ -static const char *stateNames[] = +static const char *const stateNames[] = { "active", /* Mouse cursor is over widget or element */ "disabled", /* Widget is disabled */ @@ -219,7 +219,7 @@ Tcl_Obj *Ttk_StateMapLookup( /* Ttk_GetStateMapFromObj -- * Returns a Ttk_StateMap from a Tcl_Obj*. - * Since a Ttk_StateMap is just a specially-formatted Tcl_Obj, + * Since a Ttk_StateMap is just a specially-formatted Tcl_Obj, * this basically just checks for errors. */ Ttk_StateMap Ttk_GetStateMapFromObj( diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h index c5de39b..f054181 100644 --- a/generic/ttk/ttkTheme.h +++ b/generic/ttk/ttkTheme.h @@ -1,4 +1,4 @@ -/* $Id: ttkTheme.h,v 1.14 2008/05/23 20:20:05 jenglish Exp $ +/* $Id: ttkTheme.h,v 1.15 2008/11/02 09:54:02 nijtmans Exp $ * Copyright (c) 2003 Joe English. Freely redistributable. * * Declarations for Tk theme engine. @@ -236,10 +236,10 @@ typedef void (Ttk_ElementDrawProc)(void *clientData, void *elementRecord, typedef struct Ttk_ElementOptionSpec { - char *optionName; /* Command-line name of the widget option */ + const char *optionName; /* Command-line name of the widget option */ Tk_OptionType type; /* Accepted option types */ int offset; /* Offset of Tcl_Obj* field in element record */ - char *defaultValue; /* Default value to used if resource missing */ + const char *defaultValue; /* Default value to used if resource missing */ } Ttk_ElementOptionSpec; #define TK_OPTION_ANY TK_OPTION_STRING diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 1d4b357..921cf93 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -35,7 +35,7 @@ * that such fonts can not be used for controls, because controls * definitely require a family id (this assertion needs testing). * - * RCS: @(#) $Id: tkMacOSXFont.c,v 1.39 2008/08/19 00:17:44 das Exp $ + * RCS: @(#) $Id: tkMacOSXFont.c,v 1.40 2008/11/02 09:54:02 nijtmans Exp $ */ #include "tkMacOSXPrivate.h" @@ -1930,7 +1930,7 @@ FindFontFamilyOrAlias( const char *name) /* Name or alias name of the font to find. */ { const MacFontFamily * familyPtr; - char ** aliases; + const char *const * aliases; int i; familyPtr = FindFontFamily(name); @@ -1956,7 +1956,7 @@ FindFontFamilyOrAliasOrFallback( { const MacFontFamily * familyPtr; const char * fallback; - char *** fallbacks; + const char *const *const * fallbacks; int i, j; familyPtr = FindFontFamilyOrAlias(name); diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 55cc2f3..b5feb2c 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixFont.c,v 1.36 2008/10/17 23:18:53 nijtmans Exp $ + * RCS: @(#) $Id: tkUnixFont.c,v 1.37 2008/11/02 09:54:02 nijtmans Exp $ */ #include "tkUnixInt.h" @@ -139,9 +139,9 @@ typedef struct UnixFont { */ typedef struct EncodingAlias { - char *realName; /* The real name of the encoding to load if + const char *realName; /* The real name of the encoding to load if * the provided name matched the pattern. */ - char *aliasPattern; /* Pattern for encoding name, of the form that + const char *aliasPattern; /* Pattern for encoding name, of the form that * is acceptable to Tcl_StringMatch. */ } EncodingAlias; @@ -210,7 +210,7 @@ static SubFont * CanUseFallback(UnixFont *fontPtr, const char *fallbackName, int ch, SubFont **fixSubFontPtrPtr); static SubFont * CanUseFallbackWithAliases(UnixFont *fontPtr, - char *fallbackName, int ch, + const char *fallbackName, int ch, Tcl_DString *nameTriedPtr, SubFont **fixSubFontPtrPtr); static int ControlUtfProc(ClientData clientData, const char *src, @@ -628,7 +628,7 @@ UtfToUcs2beProc( return result; } #endif /* WORDS_BIGENDIAN */ - + /* *--------------------------------------------------------------------------- * @@ -1483,9 +1483,9 @@ CreateClosestFont( nameList = ListFontOrAlias(display, want.fa.family, &numNames); if (numNames == 0) { - char ***fontFallbacks; + const char *const *const *fontFallbacks; int i, j; - char *fallback; + const char *fallback; fontFallbacks = TkFontGetFallbacks(); for (i = 0; fontFallbacks[i] != NULL; i++) { @@ -1969,7 +1969,11 @@ FindSubFontForChar( { int i, j, k, numNames; Tk_Uid faceName; - char *fallback, **aliases, **nameList, **anyFallbacks, ***fontFallbacks; + const char *fallback; + const char *const *aliases; + const char *const *nameList; + const char *const *anyFallbacks; + const char *const *const *fontFallbacks; SubFont *subFontPtr; Tcl_DString ds; @@ -2287,7 +2291,7 @@ static SubFont * CanUseFallbackWithAliases( UnixFont *fontPtr, /* The font object that will own the new * screen font. */ - char *faceName, /* Desired face name for new screen font. */ + const char *faceName, /* Desired face name for new screen font. */ int ch, /* The Unicode character that the new screen * font must be able to display. */ Tcl_DString *nameTriedPtr, /* Records face names that have already been @@ -2298,7 +2302,7 @@ CanUseFallbackWithAliases( * reallocate our subfont table. */ { SubFont *subFontPtr; - char **aliases; + const char *const *aliases; int i; if (SeenName(faceName, nameTriedPtr) == 0) { @@ -2402,7 +2406,9 @@ CanUseFallback( Tk_Uid hateFoundry; const char *charset, *hateCharset; unsigned bestScore[2]; - char **nameList, **nameListOrig, src[TCL_UTF_MAX]; + const char *const *nameList; + const char *const *nameListOrig; + char src[TCL_UTF_MAX]; FontAttributes want, got; Display *display; SubFont subFont; |