From 45c244cd8dcd109d144858140ce8c0c070c79f7e Mon Sep 17 00:00:00 2001 From: nijtmans Date: Tue, 14 Oct 2008 22:37:53 +0000 Subject: * generic/tclCmdAH.c: Fix minor compiler warnings when compiling * generic/tclCmdMZ.c: with -Wwrite-strings * generic/tclIndexObj.c: * generic/tclProc.c: * generic/tclStubLib.c: * generic/tclUtil.c: --- ChangeLog | 9 +++++++++ generic/tclCmdAH.c | 14 +++++++------- generic/tclCmdMZ.c | 19 ++++++++++--------- generic/tclIndexObj.c | 6 +++--- generic/tclProc.c | 6 +++--- generic/tclStubLib.c | 4 ++-- generic/tclUtil.c | 10 +++++----- 7 files changed, 39 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ee3eb9..d6fb10f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-10-14 Jan Nijtmans + + * generic/tclCmdAH.c: Fix minor compiler warnings when compiling + * generic/tclCmdMZ.c: with -Wwrite-strings + * generic/tclIndexObj.c: + * generic/tclProc.c: + * generic/tclStubLib.c: + * generic/tclUtil.c: + 2008-10-14 Donal K. Fellows * doc/binary.n: Formatting fix. diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 19a743b..342188e 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.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: tclCmdAH.c,v 1.105 2008/09/24 19:31:28 dgp Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.106 2008/10/14 22:37:53 nijtmans Exp $ */ #include "tclInt.h" @@ -51,7 +51,7 @@ static inline void ForeachCleanup(Tcl_Interp *interp, struct ForeachState *statePtr); static int GetStatBuf(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_FSStatProc *statProc, Tcl_StatBuf *statPtr); -static char * GetTypeFromMode(int mode); +static const char *GetTypeFromMode(int mode); static int StoreStatData(Tcl_Interp *interp, Tcl_Obj *varName, Tcl_StatBuf *statPtr); static Tcl_NRPostProc CatchObjCmdCallback; @@ -487,7 +487,7 @@ Tcl_EncodingObjCmd( { int index; - static const char *optionStrings[] = { + static const char *const optionStrings[] = { "convertfrom", "convertto", "dirs", "names", "system", NULL }; @@ -884,7 +884,7 @@ Tcl_FileObjCmd( * This list of constants should match the fileOption string array below. */ - static const char *fileOptions[] = { + static const char *const fileOptions[] = { "atime", "attributes", "channels", "copy", "delete", "dirname", "executable", "exists", "extension", @@ -1101,7 +1101,7 @@ Tcl_FileObjCmd( * We have a '-linktype' argument. */ - static const char *linkTypes[] = { + static const char *const linkTypes[] = { "-symbolic", "-hard", NULL }; if (Tcl_GetIndexFromObj(interp, objv[2], linkTypes, "switch", @@ -1346,7 +1346,7 @@ Tcl_FileObjCmd( return TCL_ERROR; } if (objc == 2) { - char *separator = NULL; /* lint */ + const char *separator = NULL; /* lint */ switch (tclPlatform) { case TCL_PLATFORM_UNIX: @@ -1608,7 +1608,7 @@ StoreStatData( *---------------------------------------------------------------------- */ -static char * +static const char * GetTypeFromMode( int mode) { diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index dfeb59c..794b75b 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.170 2008/09/29 08:20:34 dkf Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.171 2008/10/14 22:37:53 nijtmans Exp $ */ #include "tclInt.h" @@ -101,7 +101,7 @@ Tcl_RegexpObjCmd( Tcl_RegExp regExpr; Tcl_Obj *objPtr, *startIndex = NULL, *resultPtr = NULL; Tcl_RegExpInfo info; - static const char *options[] = { + static const char *const options[] = { "-all", "-about", "-indices", "-inline", "-expanded", "-line", "-linestop", "-lineanchor", "-nocase", "-start", "--", NULL @@ -453,7 +453,7 @@ Tcl_RegsubObjCmd( Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL; Tcl_UniChar ch, *wsrc, *wfirstChar, *wstring, *wsubspec, *wend; - static const char *options[] = { + static const char *const options[] = { "-all", "-nocase", "-expanded", "-line", "-linestop", "-lineanchor", "-start", "--", NULL @@ -949,7 +949,7 @@ Tcl_SourceObjCmd( fileName = objv[objc-1]; if (objc == 4) { - static const char *options[] = { + static const char *const options[] = { "-encoding", NULL }; int index; @@ -990,7 +990,8 @@ Tcl_SplitObjCmd( { Tcl_UniChar ch; int len; - char *splitChars, *stringPtr, *end; + const char *splitChars; + char *stringPtr, *end; int splitCharLen, stringLen; Tcl_Obj *listPtr, *objPtr; @@ -1068,7 +1069,7 @@ Tcl_SplitObjCmd( TclNewStringObj(objPtr, stringPtr, end - stringPtr); Tcl_ListObjAppendElement(NULL, listPtr, objPtr); } else { - char *element, *p, *splitEnd; + const char *element, *p, *splitEnd; int splitLen; Tcl_UniChar splitChar; @@ -1401,7 +1402,7 @@ StringIsCmd( Tcl_Obj *objPtr, *failVarObj = NULL; Tcl_WideInt w; - static const char *isOptions[] = { + static const char *const isOptions[] = { "alnum", "alpha", "ascii", "control", "boolean", "digit", "double", "false", "graph", "integer", "list", "lower", @@ -3363,7 +3364,7 @@ Tcl_SubstObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - static const char *substOptions[] = { + static const char *const substOptions[] = { "-nobackslashes", "-nocommands", "-novariables", NULL }; enum substOptions { @@ -3459,7 +3460,7 @@ Tcl_SwitchObjCmd( * -glob, you *must* fix TclCompileSwitchCmd's option parser as well. */ - static const char *options[] = { + static const char *const options[] = { "-exact", "-glob", "-indexvar", "-matchvar", "-nocase", "-regexp", "--", NULL }; diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index bb9078b..f04db71 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIndexObj.c,v 1.45 2008/10/10 04:02:00 das Exp $ + * RCS: @(#) $Id: tclIndexObj.c,v 1.46 2008/10/14 22:37:53 nijtmans Exp $ */ #include "tclInt.h" @@ -42,7 +42,7 @@ static void PrintUsage(Tcl_Interp *interp, * that can be invoked by generic object code. */ -static Tcl_ObjType indexType = { +static const Tcl_ObjType indexType = { "index", /* name */ FreeIndex, /* freeIntRepProc */ DupIndex, /* dupIntRepProc */ @@ -559,7 +559,7 @@ PrefixMatchObjCmd( int flags = 0, result, index; int dummyLength, i, errorLength; Tcl_Obj *errorPtr = NULL; - char *message = "option"; + const char *message = "option"; Tcl_Obj *tablePtr, *objPtr, *resultPtr; static const char *const matchOptions[] = { "-error", "-exact", "-message", NULL diff --git a/generic/tclProc.c b/generic/tclProc.c index bfe5891..423eb3b 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclProc.c,v 1.163 2008/08/23 18:53:12 msofer Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.164 2008/10/14 22:37:53 nijtmans Exp $ */ #include "tclInt.h" @@ -83,7 +83,7 @@ Tcl_ObjType tclProcBodyType = { * rep; it's just a cache type. */ -static Tcl_ObjType levelReferenceType = { +static const Tcl_ObjType levelReferenceType = { "levelReference", NULL, NULL, NULL, NULL }; @@ -97,7 +97,7 @@ static Tcl_ObjType levelReferenceType = { * will execute within. */ -static Tcl_ObjType lambdaType = { +static const Tcl_ObjType lambdaType = { "lambdaExpr", /* name */ FreeLambdaInternalRep, /* freeIntRepProc */ DupLambdaInternalRep, /* dupIntRepProc */ diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index 9b8f390..62869d4 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.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: tclStubLib.c,v 1.27 2008/10/02 20:59:45 dgp Exp $ + * RCS: @(#) $Id: tclStubLib.c,v 1.28 2008/10/14 22:37:53 nijtmans Exp $ */ /* @@ -47,7 +47,7 @@ HasStubSupport( } iPtr->result = - "This interpreter does not support stubs-enabled extensions."; + (char *)"This interpreter does not support stubs-enabled extensions."; iPtr->freeProc = TCL_STATIC; return NULL; } diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 1a93a32..71978d7 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.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: tclUtil.c,v 1.104 2008/10/02 20:59:45 dgp Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.105 2008/10/14 22:37:53 nijtmans Exp $ */ #include "tclInt.h" @@ -2423,13 +2423,13 @@ TclPrecTraceProc( */ if (Tcl_IsSafe(interp)) { - return "can't modify precision from a safe interpreter"; + return (char *)"can't modify precision from a safe interpreter"; } value = Tcl_GetVar2Ex(interp, name1, name2, flags & TCL_GLOBAL_ONLY); if (value == NULL || Tcl_GetIntFromObj((Tcl_Interp*) NULL, value, &prec) != TCL_OK || prec < 0 || prec > TCL_MAX_PREC) { - return "improper value for precision"; + return (char *)"improper value for precision"; } *precisionPtr = prec; return NULL; @@ -3269,8 +3269,8 @@ TclReToGlob( int *exactPtr) { int anchorLeft, anchorRight, lastIsStar; - char *dsStr, *dsStrStart, *msg; - const char *p, *strEnd; + char *dsStr, *dsStrStart; + const char *msg, *p, *strEnd; strEnd = reStr + reStrLen; Tcl_DStringInit(dsPtr); -- cgit v0.12