summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2006-11-02 16:39:06 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2006-11-02 16:39:06 (GMT)
commitd21c1ef27faf5fb3983ceaa6fb2f9e4d92fd79fc (patch)
treed9e4c3e04a4263f92044201ab69aa5f301ba18f5
parente1cbc16cc15897f437b3072919403624a0d79ec0 (diff)
downloadtcl-d21c1ef27faf5fb3983ceaa6fb2f9e4d92fd79fc.zip
tcl-d21c1ef27faf5fb3983ceaa6fb2f9e4d92fd79fc.tar.gz
tcl-d21c1ef27faf5fb3983ceaa6fb2f9e4d92fd79fc.tar.bz2
Silence compiler grumbles.
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclBasic.c4
-rw-r--r--generic/tclCmdMZ.c73
-rw-r--r--generic/tclInterp.c13
-rw-r--r--generic/tclProc.c4
5 files changed, 51 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index edd11ee..f68bcd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-11-02 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tclBasic.c, generic/tclInterp.c, generic/tclProc.c: Silence
+ warnings from gcc over signed/unsigned and TclStackAlloc().
+ * generic/tclCmdMZ.c: Update to more compact and clearer coding style.
+
2006-11-02 Don Porter <dgp@users.sourceforge.net>
* generic/tclBasic.c: Further revised TclAppendPrintToObj() and
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 964c477..71fa572 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.213 2006/11/02 15:58:04 dgp Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.214 2006/11/02 16:39:06 dkf Exp $
*/
#include "tclInt.h"
@@ -3354,7 +3354,7 @@ TclEvalObjvInternal(
&handlerObjc, &handlerObjv);
newObjc = objc + handlerObjc;
newObjv = (Tcl_Obj **) TclStackAlloc(interp,
- sizeof(Tcl_Obj *) * (unsigned)newObjc);
+ (int) sizeof(Tcl_Obj *) * newObjc);
/*
* Copy command prefix from unknown handler and add on the real
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index d9084cf..4a47d0f 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.137 2006/11/02 15:58:07 dgp Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.138 2006/11/02 16:39:06 dkf Exp $
*/
#include "tclInt.h"
@@ -95,7 +95,7 @@ Tcl_RegexpObjCmd(dummy, interp, objc, objv)
static CONST char *options[] = {
"-all", "-about", "-indices", "-inline",
"-expanded", "-line", "-linestop", "-lineanchor",
- "-nocase", "-start", "--", (char *) NULL
+ "-nocase", "-start", "--", NULL
};
enum options {
REGEXP_ALL, REGEXP_ABOUT, REGEXP_INDICES, REGEXP_INLINE,
@@ -188,7 +188,7 @@ Tcl_RegexpObjCmd(dummy, interp, objc, objv)
if (doinline && ((objc - 2) != 0)) {
Tcl_AppendResult(interp, "regexp match variables not allowed",
- " when using -inline", (char *) NULL);
+ " when using -inline", NULL);
goto optionError;
}
@@ -368,7 +368,7 @@ Tcl_RegexpObjCmd(dummy, interp, objc, objv)
valuePtr = Tcl_ObjSetVar2(interp, objv[i], NULL, newPtr, 0);
if (valuePtr == NULL) {
Tcl_AppendResult(interp, "couldn't set variable \"",
- TclGetString(objv[i]), "\"", (char *) NULL);
+ TclGetString(objv[i]), "\"", NULL);
return TCL_ERROR;
}
}
@@ -792,7 +792,7 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv)
if (objc == 4) {
if (Tcl_ObjSetVar2(interp, objv[3], NULL, resultPtr, 0) == NULL) {
Tcl_AppendResult(interp, "couldn't set variable \"",
- TclGetString(objv[3]), "\"", (char *) NULL);
+ TclGetString(objv[3]), "\"", NULL);
result = TCL_ERROR;
} else {
/*
@@ -945,12 +945,12 @@ Tcl_SourceObjCmd(dummy, interp, objc, objv)
if (objc == 4) {
static CONST char *options[] = {
- "-encoding", (char *) NULL
+ "-encoding", NULL
};
int index;
- if (TCL_ERROR == Tcl_GetIndexFromObj(interp, objv[1],
- options, "option", TCL_EXACT, &index)) {
+ if (TCL_ERROR == Tcl_GetIndexFromObj(interp, objv[1], options,
+ "option", TCL_EXACT, &index)) {
return TCL_ERROR;
}
encodingName = TclGetString(objv[2]);
@@ -1041,7 +1041,7 @@ Tcl_SplitObjCmd(dummy, interp, objc, objv)
Tcl_SetHashValue(hPtr, (ClientData) objPtr);
} else {
- objPtr = (Tcl_Obj*) Tcl_GetHashValue(hPtr);
+ objPtr = (Tcl_Obj *) Tcl_GetHashValue(hPtr);
}
Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
}
@@ -1135,7 +1135,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
"map", "match", "range", "repeat",
"replace", "tolower", "toupper", "totitle",
"trim", "trimleft", "trimright",
- "wordend", "wordstart", (char *) NULL
+ "wordend", "wordstart", NULL
};
enum options {
STR_BYTELENGTH, STR_COMPARE, STR_EQUAL, STR_FIRST,
@@ -1193,7 +1193,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
}
} else {
Tcl_AppendResult(interp, "bad option \"", string2,
- "\": must be -nocase or -length", (char *) NULL);
+ "\": must be -nocase or -length", NULL);
return TCL_ERROR;
}
}
@@ -1223,8 +1223,8 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
* reason... :^)
*/
- string1 = (char*) Tcl_GetByteArrayFromObj(objv[0], &length1);
- string2 = (char*) Tcl_GetByteArrayFromObj(objv[1], &length2);
+ string1 = (char *) Tcl_GetByteArrayFromObj(objv[0], &length1);
+ string2 = (char *) Tcl_GetByteArrayFromObj(objv[1], &length2);
strCmpFn = (strCmpFn_t) memcmp;
} else if ((objv[0]->typePtr == &tclStringType)
&& (objv[1]->typePtr == &tclStringType)) {
@@ -1235,8 +1235,8 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
* operations.
*/
- string1 = (char*) Tcl_GetUnicodeFromObj(objv[0], &length1);
- string2 = (char*) Tcl_GetUnicodeFromObj(objv[1], &length2);
+ string1 = (char *) Tcl_GetUnicodeFromObj(objv[0], &length1);
+ string2 = (char *) Tcl_GetUnicodeFromObj(objv[1], &length2);
strCmpFn = (strCmpFn_t)
(nocase ? Tcl_UniCharNcasecmp : Tcl_UniCharNcmp);
} else {
@@ -1247,8 +1247,8 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
* we are case-sensitive and no specific length was requested.
*/
- string1 = (char*) Tcl_GetStringFromObj(objv[0], &length1);
- string2 = (char*) Tcl_GetStringFromObj(objv[1], &length2);
+ string1 = (char *) Tcl_GetStringFromObj(objv[0], &length1);
+ string2 = (char *) Tcl_GetStringFromObj(objv[1], &length2);
if ((reqlength < 0) && !nocase) {
strCmpFn = (strCmpFn_t) TclpUtfNcmp2;
} else {
@@ -1425,7 +1425,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
"boolean", "digit", "double", "false",
"graph", "integer", "lower", "print",
"punct", "space", "true", "upper",
- "wideinteger", "wordchar", "xdigit", (char *) NULL
+ "wideinteger", "wordchar", "xdigit", NULL
};
enum isOptions {
STR_IS_ALNUM, STR_IS_ALPHA, STR_IS_ASCII, STR_IS_CONTROL,
@@ -1460,7 +1460,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
failVarObj = objv[++i];
} else {
Tcl_AppendResult(interp, "bad option \"", string2,
- "\": must be -strict or -failindex", (char *)NULL);
+ "\": must be -strict or -failindex", NULL);
return TCL_ERROR;
}
}
@@ -1531,15 +1531,15 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
/* TODO */
if ((objPtr->typePtr == &tclDoubleType) ||
- (objPtr->typePtr == &tclIntType) ||
+ (objPtr->typePtr == &tclIntType) ||
#ifndef NO_WIDE_TYPE
- (objPtr->typePtr == &tclWideIntType) ||
+ (objPtr->typePtr == &tclWideIntType) ||
#endif
- (objPtr->typePtr == &tclBignumType)) {
+ (objPtr->typePtr == &tclBignumType)) {
break;
}
- if (TclParseNumber( NULL, objPtr, NULL, NULL, -1,
- (CONST char**) &stop, 0 ) != TCL_OK) {
+ if (TclParseNumber(NULL, objPtr, NULL, NULL, -1,
+ (const char **) &stop, 0) != TCL_OK) {
result = 0;
failat = 0;
} else {
@@ -1740,9 +1740,8 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
* Scan backwards to find the first character.
*/
- if ((*p == *ustring1) &&
- (memcmp((char *) ustring1, (char *) p, (size_t)
- (length1 * sizeof(Tcl_UniChar))) == 0)) {
+ if ((*p == *ustring1) && !memcmp(ustring1, p,
+ sizeof(Tcl_UniChar) * (size_t)length1)) {
match = p - ustring2;
break;
}
@@ -1795,7 +1794,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
nocase = 1;
} else {
Tcl_AppendResult(interp, "bad option \"", string2,
- "\": must be -nocase", (char *) NULL);
+ "\": must be -nocase", NULL);
return TCL_ERROR;
}
}
@@ -2040,8 +2039,8 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
strncmp(string2, "-nocase", (size_t) length2) == 0) {
nocase = 1;
} else {
- Tcl_AppendResult(interp, "bad option \"",
- string2, "\": must be -nocase", (char *) NULL);
+ Tcl_AppendResult(interp, "bad option \"", string2,
+ "\": must be -nocase", NULL);
return TCL_ERROR;
}
}
@@ -2066,7 +2065,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
*/
if (objv[2]->typePtr == &tclByteArrayType) {
- string1 = (char *)Tcl_GetByteArrayFromObj(objv[2], &length1);
+ string1 = (char *) Tcl_GetByteArrayFromObj(objv[2], &length1);
length1--;
} else {
/*
@@ -2456,7 +2455,7 @@ Tcl_SubstObjCmd(dummy, interp, objc, objv)
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
static CONST char *substOptions[] = {
- "-nobackslashes", "-nocommands", "-novariables", (char *) NULL
+ "-nobackslashes", "-nocommands", "-novariables", NULL
};
enum substOptions {
SUBST_NOBACKSLASHES, SUBST_NOCOMMANDS, SUBST_NOVARS
@@ -2584,7 +2583,7 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv)
if (i == objc) {
Tcl_AppendResult(interp,
"missing variable name argument to -indexvar option",
- (char *) NULL);
+ NULL);
return TCL_ERROR;
}
indexVarObj = objv[i];
@@ -2594,7 +2593,7 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv)
if (i == objc) {
Tcl_AppendResult(interp,
"missing variable name argument to -matchvar option",
- (char *) NULL);
+ NULL);
return TCL_ERROR;
}
matchVarObj = objv[i];
@@ -2610,7 +2609,7 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv)
Tcl_AppendResult(interp, "bad option \"",
TclGetString(objv[i]), "\": ", options[mode],
- " option already found", (char *) NULL);
+ " option already found", NULL);
return TCL_ERROR;
}
foundmode = 1;
@@ -2625,12 +2624,12 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv)
}
if (indexVarObj != NULL && mode != OPT_REGEXP) {
Tcl_AppendResult(interp,
- "-indexvar option requires -regexp option", (char *) NULL);
+ "-indexvar option requires -regexp option", NULL);
return TCL_ERROR;
}
if (matchVarObj != NULL && mode != OPT_REGEXP) {
Tcl_AppendResult(interp,
- "-matchvar option requires -regexp option", (char *) NULL);
+ "-matchvar option requires -regexp option", NULL);
return TCL_ERROR;
}
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index a6f3e6c..ccdef95 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.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: tclInterp.c,v 1.68 2006/11/02 13:54:46 dkf Exp $
+ * RCS: @(#) $Id: tclInterp.c,v 1.69 2006/11/02 16:39:06 dkf Exp $
*/
#include "tclInt.h"
@@ -1691,7 +1691,7 @@ AliasObjCmd(
Tcl_Obj *CONST objv[]) /* Argument vector. */
{
#define ALIAS_CMDV_PREALLOC 10
- Alias *aliasPtr = (Alias *) clientData;
+ Alias *aliasPtr = clientData;
Tcl_Interp *targetInterp = aliasPtr->targetInterp;
int result, prefc, cmdc, i;
Tcl_Obj **prefv, **cmdv;
@@ -1710,15 +1710,12 @@ AliasObjCmd(
if (cmdc <= ALIAS_CMDV_PREALLOC) {
cmdv = cmdArr;
} else {
- cmdv = (Tcl_Obj **) TclStackAlloc(interp,
- (unsigned) (cmdc * sizeof(Tcl_Obj *)));
+ cmdv = (Tcl_Obj **) TclStackAlloc(interp, cmdc*(int)sizeof(Tcl_Obj*));
}
prefv = &aliasPtr->objPtr;
- memcpy((VOID *) cmdv, (VOID *) prefv,
- (size_t) (prefc * sizeof(Tcl_Obj *)));
- memcpy((VOID *) (cmdv+prefc), (VOID *) (objv+1),
- (size_t) ((objc-1) * sizeof(Tcl_Obj *)));
+ memcpy(cmdv, prefv, (size_t) (prefc * sizeof(Tcl_Obj *)));
+ memcpy(cmdv+prefc, objv+1, (size_t) ((objc-1) * sizeof(Tcl_Obj *)));
Tcl_ResetResult(targetInterp);
diff --git a/generic/tclProc.c b/generic/tclProc.c
index ffdd121..cb92d30 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.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: tclProc.c,v 1.104 2006/11/02 15:58:08 dgp Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.105 2006/11/02 16:39:07 dkf Exp $
*/
#include "tclInt.h"
@@ -1346,7 +1346,7 @@ TclObjInterpProcCore(
*/
desiredObjs = (Tcl_Obj **) TclStackAlloc(interp,
- sizeof(Tcl_Obj *) * (unsigned)(numArgs+1));
+ (int) sizeof(Tcl_Obj *) * (numArgs+1));
#ifdef AVOID_HACKS_FOR_ITCL
desiredObjs[0] = framePtr->objv[skip-1];