diff options
author | dgp <dgp@users.sourceforge.net> | 2001-10-16 05:10:34 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2001-10-16 05:10:34 (GMT) |
commit | 15c387a97b11f816847a8836a2f60e091b7ff7ff (patch) | |
tree | 3bc613c0232ee4ef5707b1a11feecf8e83636bd6 | |
parent | 4833f0f4df984e373b6500a7a707a63f36f2fc1d (diff) | |
download | tcl-15c387a97b11f816847a8836a2f60e091b7ff7ff.zip tcl-15c387a97b11f816847a8836a2f60e091b7ff7ff.tar.gz tcl-15c387a97b11f816847a8836a2f60e091b7ff7ff.tar.bz2 |
* Added test to demonstrate memory corruption problems. [Bug 219393].
-rw-r--r-- | generic/tcl.decls | 18 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 10 | ||||
-rw-r--r-- | generic/tclDecls.h | 31 | ||||
-rw-r--r-- | generic/tclFileName.c | 6 | ||||
-rw-r--r-- | generic/tclIO.c | 4 | ||||
-rw-r--r-- | generic/tclRegexp.c | 6 | ||||
-rw-r--r-- | generic/tclUtf.c | 24 |
7 files changed, 50 insertions, 49 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls index d999073..d30f761 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -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: tcl.decls,v 1.63 2001/09/28 01:21:53 dgp Exp $ +# RCS: @(#) $Id: tcl.decls,v 1.64 2001/10/16 05:10:34 dgp Exp $ library tcl @@ -759,8 +759,8 @@ declare 214 generic { int Tcl_RegExpMatch(Tcl_Interp *interp, char *str, char *pattern) } declare 215 generic { - void Tcl_RegExpRange(Tcl_RegExp regexp, int index, char **startPtr, \ - char **endPtr) + void Tcl_RegExpRange(Tcl_RegExp regexp, int index, \ + CONST char **startPtr, CONST char **endPtr) } declare 216 generic { void Tcl_Release(ClientData clientData) @@ -1151,7 +1151,7 @@ declare 324 generic { int Tcl_UniCharToUtf(int ch, char *buf) } declare 325 generic { - char * Tcl_UtfAtIndex(CONST char *src, int index) + CONST char * Tcl_UtfAtIndex(CONST char *src, int index) } declare 326 generic { int Tcl_UtfCharComplete(CONST char *src, int len) @@ -1160,16 +1160,16 @@ declare 327 generic { int Tcl_UtfBackslash(CONST char *src, int *readPtr, char *dst) } declare 328 generic { - char * Tcl_UtfFindFirst(CONST char *src, int ch) + CONST char * Tcl_UtfFindFirst(CONST char *src, int ch) } declare 329 generic { - char * Tcl_UtfFindLast(CONST char *src, int ch) + CONST char * Tcl_UtfFindLast(CONST char *src, int ch) } declare 330 generic { - char * Tcl_UtfNext(CONST char *src) + CONST char * Tcl_UtfNext(CONST char *src) } declare 331 generic { - char * Tcl_UtfPrev(CONST char *src, CONST char *start) + CONST char * Tcl_UtfPrev(CONST char *src, CONST char *start) } declare 332 generic { int Tcl_UtfToExternal(Tcl_Interp *interp, Tcl_Encoding encoding, \ @@ -1236,7 +1236,7 @@ declare 351 generic { int Tcl_UniCharIsWordChar(int ch) } declare 352 generic { - int Tcl_UniCharLen(Tcl_UniChar *str) + int Tcl_UniCharLen(CONST Tcl_UniChar *str) } declare 353 generic { int Tcl_UniCharNcmp(CONST Tcl_UniChar *cs, CONST Tcl_UniChar *ct,\ diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index abf08b9..b3bfdb1 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.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: tclCmdMZ.c,v 1.46 2001/10/01 15:31:51 msofer Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.47 2001/10/16 05:10:34 dgp Exp $ */ #include "tclInt.h" @@ -2029,7 +2029,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) Tcl_SetObjLength(resultPtr, length1); } else { int first, last; - char *start, *end; + CONST char *start, *end; length1 = Tcl_NumUtfChars(string1, length1) - 1; if (TclGetIntForIndex(interp, objv[3], length1, @@ -2073,7 +2073,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) case STR_TRIM: { Tcl_UniChar ch, trim; - register char *p, *end; + register CONST char *p, *end; char *check, *checkEnd; int offset; @@ -2162,7 +2162,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) case STR_WORDEND: { int cur; Tcl_UniChar ch; - char *p, *end; + CONST char *p, *end; int numChars; if (objc != 4) { @@ -2200,7 +2200,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) case STR_WORDSTART: { int cur; Tcl_UniChar ch; - char *p; + CONST char *p; int numChars; if (objc != 4) { diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 06e90cf..dc8bb9c 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDecls.h,v 1.63 2001/09/28 01:21:53 dgp Exp $ + * RCS: @(#) $Id: tclDecls.h,v 1.64 2001/10/16 05:10:34 dgp Exp $ */ #ifndef _TCLDECLS @@ -700,7 +700,8 @@ EXTERN int Tcl_RegExpMatch _ANSI_ARGS_((Tcl_Interp * interp, char * str, char * pattern)); /* 215 */ EXTERN void Tcl_RegExpRange _ANSI_ARGS_((Tcl_RegExp regexp, - int index, char ** startPtr, char ** endPtr)); + int index, CONST char ** startPtr, + CONST char ** endPtr)); /* 216 */ EXTERN void Tcl_Release _ANSI_ARGS_((ClientData clientData)); /* 217 */ @@ -1038,7 +1039,7 @@ EXTERN Tcl_UniChar Tcl_UniCharToUpper _ANSI_ARGS_((int ch)); /* 324 */ EXTERN int Tcl_UniCharToUtf _ANSI_ARGS_((int ch, char * buf)); /* 325 */ -EXTERN char * Tcl_UtfAtIndex _ANSI_ARGS_((CONST char * src, +EXTERN CONST char * Tcl_UtfAtIndex _ANSI_ARGS_((CONST char * src, int index)); /* 326 */ EXTERN int Tcl_UtfCharComplete _ANSI_ARGS_((CONST char * src, @@ -1047,15 +1048,15 @@ EXTERN int Tcl_UtfCharComplete _ANSI_ARGS_((CONST char * src, EXTERN int Tcl_UtfBackslash _ANSI_ARGS_((CONST char * src, int * readPtr, char * dst)); /* 328 */ -EXTERN char * Tcl_UtfFindFirst _ANSI_ARGS_((CONST char * src, +EXTERN CONST char * Tcl_UtfFindFirst _ANSI_ARGS_((CONST char * src, int ch)); /* 329 */ -EXTERN char * Tcl_UtfFindLast _ANSI_ARGS_((CONST char * src, +EXTERN CONST char * Tcl_UtfFindLast _ANSI_ARGS_((CONST char * src, int ch)); /* 330 */ -EXTERN char * Tcl_UtfNext _ANSI_ARGS_((CONST char * src)); +EXTERN CONST char * Tcl_UtfNext _ANSI_ARGS_((CONST char * src)); /* 331 */ -EXTERN char * Tcl_UtfPrev _ANSI_ARGS_((CONST char * src, +EXTERN CONST char * Tcl_UtfPrev _ANSI_ARGS_((CONST char * src, CONST char * start)); /* 332 */ EXTERN int Tcl_UtfToExternal _ANSI_ARGS_((Tcl_Interp * interp, @@ -1108,7 +1109,7 @@ EXTERN int Tcl_UniCharIsUpper _ANSI_ARGS_((int ch)); /* 351 */ EXTERN int Tcl_UniCharIsWordChar _ANSI_ARGS_((int ch)); /* 352 */ -EXTERN int Tcl_UniCharLen _ANSI_ARGS_((Tcl_UniChar * str)); +EXTERN int Tcl_UniCharLen _ANSI_ARGS_((CONST Tcl_UniChar * str)); /* 353 */ EXTERN int Tcl_UniCharNcmp _ANSI_ARGS_((CONST Tcl_UniChar * cs, CONST Tcl_UniChar * ct, unsigned long n)); @@ -1781,7 +1782,7 @@ typedef struct TclStubs { Tcl_RegExp (*tcl_RegExpCompile) _ANSI_ARGS_((Tcl_Interp * interp, char * string)); /* 212 */ int (*tcl_RegExpExec) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_RegExp regexp, CONST char * str, CONST char * start)); /* 213 */ int (*tcl_RegExpMatch) _ANSI_ARGS_((Tcl_Interp * interp, char * str, char * pattern)); /* 214 */ - void (*tcl_RegExpRange) _ANSI_ARGS_((Tcl_RegExp regexp, int index, char ** startPtr, char ** endPtr)); /* 215 */ + void (*tcl_RegExpRange) _ANSI_ARGS_((Tcl_RegExp regexp, int index, CONST char ** startPtr, CONST char ** endPtr)); /* 215 */ void (*tcl_Release) _ANSI_ARGS_((ClientData clientData)); /* 216 */ void (*tcl_ResetResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 217 */ int (*tcl_ScanElement) _ANSI_ARGS_((CONST char * str, int * flagPtr)); /* 218 */ @@ -1891,13 +1892,13 @@ typedef struct TclStubs { Tcl_UniChar (*tcl_UniCharToTitle) _ANSI_ARGS_((int ch)); /* 322 */ Tcl_UniChar (*tcl_UniCharToUpper) _ANSI_ARGS_((int ch)); /* 323 */ int (*tcl_UniCharToUtf) _ANSI_ARGS_((int ch, char * buf)); /* 324 */ - char * (*tcl_UtfAtIndex) _ANSI_ARGS_((CONST char * src, int index)); /* 325 */ + CONST char * (*tcl_UtfAtIndex) _ANSI_ARGS_((CONST char * src, int index)); /* 325 */ int (*tcl_UtfCharComplete) _ANSI_ARGS_((CONST char * src, int len)); /* 326 */ int (*tcl_UtfBackslash) _ANSI_ARGS_((CONST char * src, int * readPtr, char * dst)); /* 327 */ - char * (*tcl_UtfFindFirst) _ANSI_ARGS_((CONST char * src, int ch)); /* 328 */ - char * (*tcl_UtfFindLast) _ANSI_ARGS_((CONST char * src, int ch)); /* 329 */ - char * (*tcl_UtfNext) _ANSI_ARGS_((CONST char * src)); /* 330 */ - char * (*tcl_UtfPrev) _ANSI_ARGS_((CONST char * src, CONST char * start)); /* 331 */ + CONST char * (*tcl_UtfFindFirst) _ANSI_ARGS_((CONST char * src, int ch)); /* 328 */ + CONST char * (*tcl_UtfFindLast) _ANSI_ARGS_((CONST char * src, int ch)); /* 329 */ + CONST char * (*tcl_UtfNext) _ANSI_ARGS_((CONST char * src)); /* 330 */ + CONST char * (*tcl_UtfPrev) _ANSI_ARGS_((CONST char * src, CONST char * start)); /* 331 */ int (*tcl_UtfToExternal) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Encoding encoding, CONST char * src, int srcLen, int flags, Tcl_EncodingState * statePtr, char * dst, int dstLen, int * srcReadPtr, int * dstWrotePtr, int * dstCharsPtr)); /* 332 */ char * (*tcl_UtfToExternalDString) _ANSI_ARGS_((Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 333 */ int (*tcl_UtfToLower) _ANSI_ARGS_((char * src)); /* 334 */ @@ -1918,7 +1919,7 @@ typedef struct TclStubs { int (*tcl_UniCharIsSpace) _ANSI_ARGS_((int ch)); /* 349 */ int (*tcl_UniCharIsUpper) _ANSI_ARGS_((int ch)); /* 350 */ int (*tcl_UniCharIsWordChar) _ANSI_ARGS_((int ch)); /* 351 */ - int (*tcl_UniCharLen) _ANSI_ARGS_((Tcl_UniChar * str)); /* 352 */ + int (*tcl_UniCharLen) _ANSI_ARGS_((CONST Tcl_UniChar * str)); /* 352 */ int (*tcl_UniCharNcmp) _ANSI_ARGS_((CONST Tcl_UniChar * cs, CONST Tcl_UniChar * ct, unsigned long n)); /* 353 */ char * (*tcl_UniCharToUtfDString) _ANSI_ARGS_((CONST Tcl_UniChar * string, int numChars, Tcl_DString * dsPtr)); /* 354 */ Tcl_UniChar * (*tcl_UtfToUniCharDString) _ANSI_ARGS_((CONST char * string, int length, Tcl_DString * dsPtr)); /* 355 */ diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 3f50cf3..72f5a5c 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.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: tclFileName.c,v 1.23 2001/10/15 17:36:29 hobbs Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.24 2001/10/16 05:10:34 dgp Exp $ */ #include "tclInt.h" @@ -382,7 +382,7 @@ TclpGetNativePathType(pathObjPtr, driveNameLengthPtr, driveNameRef) if (!Tcl_RegExpExec(NULL, re, path, path)) { type = TCL_PATH_RELATIVE; } else { - char *root, *end; + CONST char *root, *end; Tcl_RegExpRange(re, 2, &root, &end); if (root != NULL) { type = TCL_PATH_RELATIVE; @@ -814,7 +814,7 @@ SplitMacPath(path) re = Tcl_GetRegExpFromObj(NULL, tsdPtr->macRootPatternPtr, REG_ADVANCED); if (Tcl_RegExpExec(NULL, re, path, path) == 1) { - char *start, *end; + CONST char *start, *end; Tcl_Obj *nextElt; /* diff --git a/generic/tclIO.c b/generic/tclIO.c index 871a8c7..549d1d3 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.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: tclIO.c,v 1.38 2001/09/28 16:06:12 kennykb Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.39 2001/10/16 05:10:34 dgp Exp $ */ #include "tclInt.h" @@ -4689,7 +4689,7 @@ ReadChars(statePtr, objPtr, charsToRead, offsetPtr, factorPtr) * Got too many chars. */ - char *eof; + CONST char *eof; eof = Tcl_UtfAtIndex(dst, toRead); statePtr->inputEncodingState = oldState; diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index 2a32675..34e5f6f 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.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: tclRegexp.c,v 1.11 2001/05/21 22:32:01 hobbs Exp $ + * RCS: @(#) $Id: tclRegexp.c,v 1.12 2001/10/16 05:10:34 dgp Exp $ */ #include "tclInt.h" @@ -243,9 +243,9 @@ Tcl_RegExpRange(re, index, startPtr, endPtr) int index; /* 0 means give the range of the entire * match, > 0 means give the range of * a matching subrange. */ - char **startPtr; /* Store address of first character in + CONST char **startPtr; /* Store address of first character in * (sub-) range here. */ - char **endPtr; /* Store address of character just after last + CONST char **endPtr; /* Store address of character just after last * in (sub-) range here. */ { TclRegexp *regexpPtr = (TclRegexp *) re; diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 66c89a2..b6a793d 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtf.c,v 1.17 2001/09/13 19:31:04 hobbs Exp $ + * RCS: @(#) $Id: tclUtf.c,v 1.18 2001/10/16 05:10:34 dgp Exp $ */ #include "tclInt.h" @@ -536,7 +536,7 @@ Tcl_NumUtfChars(str, len) * *--------------------------------------------------------------------------- */ -char * +CONST char * Tcl_UtfFindFirst(string, ch) CONST char *string; /* The UTF-8 string to be searched. */ int ch; /* The Tcl_UniChar to search for. */ @@ -547,7 +547,7 @@ Tcl_UtfFindFirst(string, ch) while (1) { len = Tcl_UtfToUniChar(string, &find); if (find == ch) { - return (char *) string; + return string; } if (*string == '\0') { return NULL; @@ -576,7 +576,7 @@ Tcl_UtfFindFirst(string, ch) *--------------------------------------------------------------------------- */ -char * +CONST char * Tcl_UtfFindLast(string, ch) CONST char *string; /* The UTF-8 string to be searched. */ int ch; /* The Tcl_UniChar to search for. */ @@ -596,7 +596,7 @@ Tcl_UtfFindLast(string, ch) } string += len; } - return (char *) last; + return last; } /* @@ -619,13 +619,13 @@ Tcl_UtfFindLast(string, ch) *--------------------------------------------------------------------------- */ -char * +CONST char * Tcl_UtfNext(str) CONST char *str; /* The current location in the string. */ { Tcl_UniChar ch; - return (char *) str + Tcl_UtfToUniChar(str, &ch); + return str + Tcl_UtfToUniChar(str, &ch); } /* @@ -649,7 +649,7 @@ Tcl_UtfNext(str) *--------------------------------------------------------------------------- */ -char * +CONST char * Tcl_UtfPrev(str, start) CONST char *str; /* The current location in the string. */ CONST char *start; /* Pointer to the beginning of the @@ -677,7 +677,7 @@ Tcl_UtfPrev(str, start) } look--; } - return (char *) str; + return str; } /* @@ -728,7 +728,7 @@ Tcl_UniCharAtIndex(src, index) *--------------------------------------------------------------------------- */ -char * +CONST char * Tcl_UtfAtIndex(src, index) register CONST char *src; /* The UTF-8 string. */ register int index; /* The position of the desired character. */ @@ -739,7 +739,7 @@ Tcl_UtfAtIndex(src, index) index--; src += Tcl_UtfToUniChar(src, &ch); } - return (char *) src; + return src; } /* @@ -1272,7 +1272,7 @@ Tcl_UniCharToTitle(ch) int Tcl_UniCharLen(str) - Tcl_UniChar *str; /* Unicode string to find length of. */ + CONST Tcl_UniChar *str; /* Unicode string to find length of. */ { int len = 0; |