From 184a85e83b869a1c03e6ff7e4531ff0c96330c7d Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 30 May 2017 08:46:12 +0000 Subject: small code review: resolves several warning on some compilers --- generic/tclClock.c | 6 +++--- generic/tclClockFmt.c | 8 ++++---- generic/tclDate.h | 2 +- generic/tclStrIdxTree.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index c980a27..0895bbb 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -606,7 +606,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) if (opts->localeObj == NULL) { Tcl_SetResult(opts->interp, - "locale not specified and no default locale set", TCL_STATIC); + (char*)"locale not specified and no default locale set", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badOption", NULL); return NULL; } @@ -3080,7 +3080,7 @@ ClockParseFmtScnArgs( if ((saw & (1 << CLC_ARGS_GMT)) && (saw & (1 << CLC_ARGS_TIMEZONE))) { - Tcl_SetResult(interp, "cannot use -gmt and -timezone in same call", TCL_STATIC); + Tcl_SetResult(interp, (char*)"cannot use -gmt and -timezone in same call", TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); return TCL_ERROR; } @@ -3335,7 +3335,7 @@ ClockScanObjCmd( /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ if (opts.localeObj != NULL) { Tcl_SetResult(interp, - "legacy [clock scan] does not support -locale", TCL_STATIC); + (char*)"legacy [clock scan] does not support -locale", TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index d923ede..0ec8817 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -607,7 +607,7 @@ static void ClockFmtObj_UpdateString(objPtr) Tcl_Obj *objPtr; { - char *name = "UNKNOWN"; + const char *name = "UNKNOWN"; int len; ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); @@ -1450,7 +1450,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, val = 7; } if (val > 7) { - Tcl_SetResult(opts->interp, "day of week is greater than 7", + Tcl_SetResult(opts->interp, (char*)"day of week is greater than 7", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); return TCL_ERROR; @@ -2400,14 +2400,14 @@ ClockScan( overflow: - Tcl_SetResult(opts->interp, "requested date too large to represent", + Tcl_SetResult(opts->interp, (char*)"requested date too large to represent", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); goto done; not_match: - Tcl_SetResult(opts->interp, "input string does not match supplied format", + Tcl_SetResult(opts->interp, (char*)"input string does not match supplied format", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badInputString", NULL); diff --git a/generic/tclDate.h b/generic/tclDate.h index e614f9d..abc231b 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -370,7 +370,7 @@ typedef struct ClockScanTokenMap { unsigned short int maxSize; unsigned short int offs; ClockScanTokenProc *parser; - void *data; + const void *data; } ClockScanTokenMap; typedef struct ClockScanToken { diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index 291e481..0045ea5 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -469,7 +469,7 @@ TclStrIdxTreeTestObjCmd( int optionIndex; if (objc < 2) { - Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + Tcl_SetResult(interp, (char*)"wrong # args", TCL_STATIC); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], options, @@ -481,7 +481,7 @@ TclStrIdxTreeTestObjCmd( switch (optionIndex) { case O_FINDEQUAL: if (objc < 4) { - Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + Tcl_SetResult(interp, (char*)"wrong # args", TCL_STATIC); return TCL_ERROR; } cs = TclGetString(objv[2]); -- cgit v0.12