diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-11-16 17:23:36 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-11-16 17:23:36 (GMT) |
commit | cf70e6008387b33216ee5e5fb190f30c7210c027 (patch) | |
tree | ebde0873bc51ecead0109312bc8879f16d672f75 | |
parent | 9b574d970ef5ac69747d616b78b517202c6ae6f5 (diff) | |
parent | 4b2f989a91ca6c4e96629e02662706b61fc8e9f6 (diff) | |
download | tcl-cf70e6008387b33216ee5e5fb190f30c7210c027.zip tcl-cf70e6008387b33216ee5e5fb190f30c7210c027.tar.gz tcl-cf70e6008387b33216ee5e5fb190f30c7210c027.tar.bz2 |
merge Jan's contribution
53 files changed, 458 insertions, 421 deletions
diff --git a/doc/TCL_MEM_DEBUG.3 b/doc/TCL_MEM_DEBUG.3 index 05d4564..5a3e08a 100644 --- a/doc/TCL_MEM_DEBUG.3 +++ b/doc/TCL_MEM_DEBUG.3 @@ -26,7 +26,7 @@ version of \fBTcl_InitMemory\fR to add the \fBmemory\fR command to Tcl. \fBTCL_MEM_DEBUG\fR must be either left defined for all modules or undefined for all modules that are going to be linked together. If they are not, link errors will occur, with either \fBTcl_DbCkfree\fR and \fBTcl_DbCkalloc\fR or -\fBTcl_Ckalloc\fR and \fBTcl_Ckfree\fR being undefined. +\fBTcl_Alloc\fR and \fBTcl_Free\fR being undefined. .PP Once memory debugging support has been compiled into Tcl, the C functions \fBTcl_ValidateAllMemory\fR, and \fBTcl_DumpActiveMemory\fR, diff --git a/generic/regcustom.h b/generic/regcustom.h index 1c970ea..309203a 100644 --- a/generic/regcustom.h +++ b/generic/regcustom.h @@ -63,9 +63,6 @@ #ifdef __REG_VOID_T #undef __REG_VOID_T #endif -#ifdef __REG_CONST -#undef __REG_CONST -#endif #ifdef __REG_NOFRONT #undef __REG_NOFRONT #endif @@ -76,7 +73,6 @@ #define __REG_WIDE_T Tcl_UniChar #define __REG_REGOFF_T long /* Not really right, but good enough... */ #define __REG_VOID_T void -#define __REG_CONST const /* Names and declarations */ #define __REG_WIDE_COMPILE TclReComp #define __REG_WIDE_EXEC TclReExec diff --git a/generic/regex.h b/generic/regex.h index d6d46ce..d09857c 100644 --- a/generic/regex.h +++ b/generic/regex.h @@ -95,9 +95,6 @@ extern "C" { #ifdef __REG_VOID_T #undef __REG_VOID_T #endif -#ifdef __REG_CONST -#undef __REG_CONST -#endif #ifdef __REG_NOFRONT #undef __REG_NOFRONT #endif @@ -108,7 +105,6 @@ extern "C" { #define __REG_WIDE_T Tcl_UniChar #define __REG_REGOFF_T long /* not really right, but good enough... */ #define __REG_VOID_T void -#define __REG_CONST const /* names and declarations */ #define __REG_WIDE_COMPILE TclReComp #define __REG_WIDE_EXEC TclReExec @@ -144,16 +140,6 @@ typedef void re_void; #endif /* - * Also for benefit of old compilers, <sys/types.h> can supply a macro which - * expands to a substitute for `const'. - */ -#ifndef __REG_CONST -#define __REG_CONST const -#endif - - - -/* * other interface types */ @@ -197,13 +183,13 @@ typedef struct { /* * compilation ^ #ifndef __REG_NOCHAR - ^ int re_comp(regex_t *, __REG_CONST char *, size_t, int); + ^ int re_comp(regex_t *, const char *, size_t, int); ^ #endif ^ #ifndef __REG_NOFRONT - ^ int regcomp(regex_t *, __REG_CONST char *, int); + ^ int regcomp(regex_t *, const char *, int); ^ #endif ^ #ifdef __REG_WIDE_T - ^ int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int); + ^ int __REG_WIDE_COMPILE(regex_t *, const __REG_WIDE_T *, size_t, int); ^ #endif */ #define REG_BASIC 000000 /* BREs (convenience) */ @@ -228,14 +214,14 @@ typedef struct { /* * execution ^ #ifndef __REG_NOCHAR - ^ int re_exec(regex_t *, __REG_CONST char *, size_t, + ^ int re_exec(regex_t *, const char *, size_t, ^ rm_detail_t *, size_t, regmatch_t [], int); ^ #endif ^ #ifndef __REG_NOFRONT - ^ int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int); + ^ int regexec(regex_t *, const char *, size_t, regmatch_t [], int); ^ #endif ^ #ifdef __REG_WIDE_T - ^ int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, + ^ int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, ^ rm_detail_t *, size_t, regmatch_t [], int); ^ #endif */ @@ -260,7 +246,7 @@ typedef struct { * of character is used for error reports is independent of what kind is used * in matching. * - ^ extern size_t regerror(int, __REG_CONST regex_t *, char *, size_t); + ^ extern size_t regerror(int, const regex_t *, char *, size_t); */ #define REG_OKAY 0 /* no errors detected */ #define REG_NOMATCH 1 /* failed to match */ @@ -292,25 +278,25 @@ typedef struct { /* automatically gathered by fwd; do not hand-edit */ /* === regproto.h === */ #ifndef __REG_NOCHAR -int re_comp(regex_t *, __REG_CONST char *, size_t, int); +int re_comp(regex_t *, const char *, size_t, int); #endif #ifndef __REG_NOFRONT -int regcomp(regex_t *, __REG_CONST char *, int); +int regcomp(regex_t *, const char *, int); #endif #ifdef __REG_WIDE_T -MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int); +MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, const __REG_WIDE_T *, size_t, int); #endif #ifndef __REG_NOCHAR -int re_exec(regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmatch_t [], int); +int re_exec(regex_t *, const char *, size_t, rm_detail_t *, size_t, regmatch_t [], int); #endif #ifndef __REG_NOFRONT -int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int); +int regexec(regex_t *, const char *, size_t, regmatch_t [], int); #endif #ifdef __REG_WIDE_T -MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int); +MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int); #endif MODULE_SCOPE re_void regfree(regex_t *); -MODULE_SCOPE size_t regerror(int, __REG_CONST regex_t *, char *, size_t); +MODULE_SCOPE size_t regerror(int, const regex_t *, char *, size_t); /* automatically gathered by fwd; do not hand-edit */ /* =====^!^===== end forwards =====^!^===== */ diff --git a/generic/tcl.decls b/generic/tcl.decls index 79323c2..2bddb23 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -287,7 +287,7 @@ declare 76 { void Tcl_BackgroundError(Tcl_Interp *interp) } declare 77 { - char Tcl_Backslash(const char *src, unsigned int *readPtr) + char Tcl_Backslash(const char *src, size_t *readPtr) } declare 78 { int Tcl_BadChannelOption(Tcl_Interp *interp, const char *optionName, @@ -1127,7 +1127,7 @@ declare 312 { size_t Tcl_NumUtfChars(const char *src, size_t length) } declare 313 { - int Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, int charsToRead, + size_t Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, size_t charsToRead, int appendFlag) } declare 314 { @@ -1172,7 +1172,7 @@ declare 326 { int Tcl_UtfCharComplete(const char *src, size_t length) } declare 327 { - int Tcl_UtfBackslash(const char *src, int *readPtr, char *dst) + int Tcl_UtfBackslash(const char *src, size_t *readPtr, char *dst) } declare 328 { const char *Tcl_UtfFindFirst(const char *src, int ch) @@ -1285,7 +1285,7 @@ declare 360 { Tcl_Parse *parsePtr, int append, const char **termPtr) } declare 361 { - int Tcl_ParseCommand(Tcl_Interp *interp, const char *start, int numBytes, + int Tcl_ParseCommand(Tcl_Interp *interp, const char *start, size_t numBytes, int nested, Tcl_Parse *parsePtr) } declare 362 { @@ -1344,23 +1344,23 @@ declare 377 { void Tcl_RegExpGetInfo(Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr) } declare 378 { - Tcl_Obj *Tcl_NewUnicodeObj(const Tcl_UniChar *unicode, int numChars) + Tcl_Obj *Tcl_NewUnicodeObj(const Tcl_UniChar *unicode, size_t numChars) } declare 379 { void Tcl_SetUnicodeObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode, - int numChars) + size_t numChars) } declare 380 { size_t Tcl_GetCharLength(Tcl_Obj *objPtr) } declare 381 { - Tcl_UniChar Tcl_GetUniChar(Tcl_Obj *objPtr, int index) + Tcl_UniChar Tcl_GetUniChar(Tcl_Obj *objPtr, size_t index) } declare 382 { Tcl_UniChar *Tcl_GetUnicode(Tcl_Obj *objPtr) } declare 383 { - Tcl_Obj *Tcl_GetRange(Tcl_Obj *objPtr, int first, int last) + Tcl_Obj *Tcl_GetRange(Tcl_Obj *objPtr, size_t first, size_t last) } declare 384 { void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode, @@ -1394,15 +1394,15 @@ declare 392 { } declare 393 { int Tcl_CreateThread(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, - ClientData clientData, int stackSize, int flags) + ClientData clientData, size_t stackSize, int flags) } # Introduced in 8.3.2 declare 394 { - int Tcl_ReadRaw(Tcl_Channel chan, char *dst, int bytesToRead) + size_t Tcl_ReadRaw(Tcl_Channel chan, char *dst, size_t bytesToRead) } declare 395 { - int Tcl_WriteRaw(Tcl_Channel chan, const char *src, int srcLen) + size_t Tcl_WriteRaw(Tcl_Channel chan, const char *src, size_t srcLen) } declare 396 { Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan) @@ -1490,7 +1490,7 @@ declare 418 { } declare 419 { int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, - unsigned long numChars) + size_t numChars) } declare 420 { int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr, @@ -2097,7 +2097,7 @@ declare 574 { } declare 575 { void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr, const char *bytes, - size_t length, int limit, const char *ellipsis) + size_t length, size_t limit, const char *ellipsis) } declare 576 { Tcl_Obj *Tcl_Format(Tcl_Interp *interp, const char *format, size_t objc, diff --git a/generic/tcl.h b/generic/tcl.h index 5b4dae9..25b038a 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -149,11 +149,6 @@ extern "C" { */ #include <stdarg.h> -#ifndef TCL_NO_DEPRECATED -# define TCL_VARARGS(type, name) (type name, ...) -# define TCL_VARARGS_DEF(type, name) (type name, ...) -# define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) -#endif #if defined(__GNUC__) && (__GNUC__ > 2) # define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b))) #else @@ -244,19 +239,6 @@ extern "C" { #endif /* - * The following _ANSI_ARGS_ macro is to support old extensions - * written for older versions of Tcl where it permitted support - * for compilers written in the pre-prototype era of C. - * - * New code should use prototypes. - */ - -#ifndef TCL_NO_DEPRECATED -# undef _ANSI_ARGS_ -# define _ANSI_ARGS_(x) x -#endif - -/* * Definitions that allow this header file to be used either with or without * ANSI C features. */ @@ -469,39 +451,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; * accessed with Tcl_GetObjResult() and Tcl_SetObjResult(). */ -typedef struct Tcl_Interp -#ifndef TCL_NO_DEPRECATED -{ - /* TIP #330: Strongly discourage extensions from using the string - * result. */ -#ifdef USE_INTERP_RESULT - char *result TCL_DEPRECATED_API("use Tcl_GetResult/Tcl_SetResult"); - /* If the last command returned a string - * result, this points to it. */ - void (*freeProc) (char *blockPtr) - TCL_DEPRECATED_API("use Tcl_GetResult/Tcl_SetResult"); - /* Zero means the string result is statically - * allocated. TCL_DYNAMIC means it was - * allocated with ckalloc and should be freed - * with ckfree. Other values give the address - * of function to invoke to free the result. - * Tcl_Eval must free it before executing next - * command. */ -#else - char *resultDontUse; /* Don't use in extensions! */ - void (*freeProcDontUse) (char *); /* Don't use in extensions! */ -#endif -#ifdef USE_INTERP_ERRORLINE - int errorLine TCL_DEPRECATED_API("use Tcl_GetErrorLine/Tcl_SetErrorLine"); - /* When TCL_ERROR is returned, this gives the - * line number within the command where the - * error occurred (1 if first line). */ -#else - int errorLineDontUse; /* Don't use in extensions! */ -#endif -} -#endif /* TCL_NO_DEPRECATED */ -Tcl_Interp; +typedef struct Tcl_Interp Tcl_Interp; typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; typedef struct Tcl_Channel_ *Tcl_Channel; @@ -1104,17 +1054,6 @@ typedef struct Tcl_DString { #define TCL_ALLOW_INLINE_COMPILATION 0x20000 /* - * The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now - * always parsed whenever the part2 is NULL. (This is to avoid a common error - * when converting code to use the new object based APIs and forgetting to - * give the flag) - */ - -#ifndef TCL_NO_DEPRECATED -# define TCL_PARSE_PART1 0x400 -#endif - -/* * Types for linked variables: */ @@ -1469,9 +1408,9 @@ typedef int (Tcl_DriverCloseProc) (ClientData instanceData, Tcl_Interp *interp); typedef int (Tcl_DriverClose2Proc) (ClientData instanceData, Tcl_Interp *interp, int flags); -typedef int (Tcl_DriverInputProc) (ClientData instanceData, char *buf, +typedef ssize_t (Tcl_DriverInputProc) (ClientData instanceData, char *buf, size_t toRead, int *errorCodePtr); -typedef int (Tcl_DriverOutputProc) (ClientData instanceData, +typedef ssize_t (Tcl_DriverOutputProc) (ClientData instanceData, const char *buf, size_t toWrite, int *errorCodePtr); typedef int (Tcl_DriverSeekProc) (ClientData instanceData, long offset, int mode, int *errorCodePtr); @@ -2587,18 +2526,6 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); # define Tcl_GlobalEvalObj(interp,objPtr) \ Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL) -/* - * These function have been renamed. The old names are deprecated, but we - * define these macros for backwards compatibilty. - */ - -# define Tcl_Ckalloc Tcl_Alloc -# define Tcl_Ckfree Tcl_Free -# define Tcl_Ckrealloc Tcl_Realloc -# define Tcl_Return Tcl_SetResult -# define Tcl_TildeSubst Tcl_TranslateFileName -# define panic Tcl_Panic -# define panicVA Tcl_PanicVA #endif /* !TCL_NO_DEPRECATED */ /* diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index edc9c0e..9896e0d 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -130,6 +130,143 @@ Tcl_BreakObjCmd( /* *---------------------------------------------------------------------- * + * Tcl_CaseObjCmd -- + * + * This procedure is invoked to process the "case" Tcl command. See the + * user documentation for details on what it does. THIS COMMAND IS + * OBSOLETE AND DEPRECATED. SLATED FOR REMOVAL IN TCL 9.0. + * + * Results: + * A standard Tcl object result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_CaseObjCmd( + ClientData dummy, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + register int i; + int body, result, caseObjc; + const char *stringPtr, *arg; + Tcl_Obj *const *caseObjv; + Tcl_Obj *armPtr; + + if (objc < 3) { + Tcl_WrongNumArgs(interp, 1, objv, + "string ?in? ?pattern body ...? ?default body?"); + return TCL_ERROR; + } + + stringPtr = TclGetString(objv[1]); + body = -1; + + arg = TclGetString(objv[2]); + if (strcmp(arg, "in") == 0) { + i = 3; + } else { + i = 2; + } + caseObjc = objc - i; + caseObjv = objv + i; + + /* + * If all of the pattern/command pairs are lumped into a single argument, + * split them out again. + */ + + if (caseObjc == 1) { + Tcl_Obj **newObjv; + + TclListObjGetElements(interp, caseObjv[0], &caseObjc, &newObjv); + caseObjv = newObjv; + } + + for (i = 0; i < caseObjc; i += 2) { + int patObjc, j; + const char **patObjv; + const char *pat; + unsigned char *p; + + if (i == caseObjc-1) { + Tcl_ResetResult(interp); + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "extra case pattern with no body", -1)); + return TCL_ERROR; + } + + /* + * Check for special case of single pattern (no list) with no + * backslash sequences. + */ + + pat = TclGetString(caseObjv[i]); + for (p = (unsigned char *) pat; *p != '\0'; p++) { + if (isspace(*p) || (*p == '\\')) { /* INTL: ISO space, UCHAR */ + break; + } + } + if (*p == '\0') { + if ((*pat == 'd') && (strcmp(pat, "default") == 0)) { + body = i + 1; + } + if (Tcl_StringMatch(stringPtr, pat)) { + body = i + 1; + goto match; + } + continue; + } + + /* + * Break up pattern lists, then check each of the patterns in the + * list. + */ + + result = Tcl_SplitList(interp, pat, &patObjc, &patObjv); + if (result != TCL_OK) { + return result; + } + for (j = 0; j < patObjc; j++) { + if (Tcl_StringMatch(stringPtr, patObjv[j])) { + body = i + 1; + break; + } + } + ckfree(patObjv); + if (j < patObjc) { + break; + } + } + + match: + if (body != -1) { + armPtr = caseObjv[body - 1]; + result = Tcl_EvalObjEx(interp, caseObjv[body], 0); + if (result == TCL_ERROR) { + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (\"%.50s\" arm line %d)", + TclGetString(armPtr), Tcl_GetErrorLine(interp))); + } + return result; + } + + /* + * Nothing matched: return nothing. + */ + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * * Tcl_CatchObjCmd -- * * This object-based procedure is invoked to process the "catch" Tcl diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 91c22f4..24b4edf 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1552,9 +1552,9 @@ TclCompileScript( * serves as context for finding and compiling * commands. May not be NULL. */ const char *script, /* The source script to compile. */ - size_t numBytes, /* Number of bytes in script. If < 0, the - * script consists of all bytes up to the - * first null character. */ + size_t numBytes, /* Number of bytes in script. If this is equal + * to TCL_STRLEN, the script consists of all + * bytes up to the first null character. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { Interp *iPtr = (Interp *) interp; @@ -1578,7 +1578,7 @@ TclCompileScript( Tcl_DStringInit(&ds); - if (numBytes < 0) { + if (numBytes == TCL_STRLEN) { numBytes = strlen(script); } Tcl_ResetResult(interp); diff --git a/generic/tclDecls.h b/generic/tclDecls.h index b4cd208..a6e33fe 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -251,7 +251,7 @@ EXTERN int Tcl_AsyncReady(void); /* 76 */ EXTERN void Tcl_BackgroundError(Tcl_Interp *interp); /* 77 */ -EXTERN char Tcl_Backslash(const char *src, unsigned int *readPtr); +EXTERN char Tcl_Backslash(const char *src, size_t *readPtr); /* 78 */ EXTERN int Tcl_BadChannelOption(Tcl_Interp *interp, const char *optionName, @@ -921,8 +921,8 @@ EXTERN void Tcl_ConditionWait(Tcl_Condition *condPtr, /* 312 */ EXTERN size_t Tcl_NumUtfChars(const char *src, size_t length); /* 313 */ -EXTERN int Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, - int charsToRead, int appendFlag); +EXTERN size_t Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, + size_t charsToRead, int appendFlag); /* 314 */ EXTERN void Tcl_RestoreResult(Tcl_Interp *interp, Tcl_SavedResult *statePtr); @@ -956,7 +956,7 @@ EXTERN const char * Tcl_UtfAtIndex(const char *src, int index); /* 326 */ EXTERN int Tcl_UtfCharComplete(const char *src, size_t length); /* 327 */ -EXTERN int Tcl_UtfBackslash(const char *src, int *readPtr, +EXTERN int Tcl_UtfBackslash(const char *src, size_t *readPtr, char *dst); /* 328 */ EXTERN const char * Tcl_UtfFindFirst(const char *src, int ch); @@ -1045,8 +1045,8 @@ EXTERN int Tcl_ParseBraces(Tcl_Interp *interp, const char **termPtr); /* 361 */ EXTERN int Tcl_ParseCommand(Tcl_Interp *interp, - const char *start, int numBytes, int nested, - Tcl_Parse *parsePtr); + const char *start, size_t numBytes, + int nested, Tcl_Parse *parsePtr); /* 362 */ EXTERN int Tcl_ParseExpr(Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr); @@ -1093,18 +1093,19 @@ EXTERN void Tcl_RegExpGetInfo(Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr); /* 378 */ EXTERN Tcl_Obj * Tcl_NewUnicodeObj(const Tcl_UniChar *unicode, - int numChars); + size_t numChars); /* 379 */ EXTERN void Tcl_SetUnicodeObj(Tcl_Obj *objPtr, - const Tcl_UniChar *unicode, int numChars); + const Tcl_UniChar *unicode, size_t numChars); /* 380 */ EXTERN size_t Tcl_GetCharLength(Tcl_Obj *objPtr); /* 381 */ -EXTERN Tcl_UniChar Tcl_GetUniChar(Tcl_Obj *objPtr, int index); +EXTERN Tcl_UniChar Tcl_GetUniChar(Tcl_Obj *objPtr, size_t index); /* 382 */ EXTERN Tcl_UniChar * Tcl_GetUnicode(Tcl_Obj *objPtr); /* 383 */ -EXTERN Tcl_Obj * Tcl_GetRange(Tcl_Obj *objPtr, int first, int last); +EXTERN Tcl_Obj * Tcl_GetRange(Tcl_Obj *objPtr, size_t first, + size_t last); /* 384 */ EXTERN void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode, size_t length); @@ -1131,14 +1132,14 @@ EXTERN void Tcl_MutexFinalize(Tcl_Mutex *mutex); /* 393 */ EXTERN int Tcl_CreateThread(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, - ClientData clientData, int stackSize, + ClientData clientData, size_t stackSize, int flags); /* 394 */ -EXTERN int Tcl_ReadRaw(Tcl_Channel chan, char *dst, - int bytesToRead); +EXTERN size_t Tcl_ReadRaw(Tcl_Channel chan, char *dst, + size_t bytesToRead); /* 395 */ -EXTERN int Tcl_WriteRaw(Tcl_Channel chan, const char *src, - int srcLen); +EXTERN size_t Tcl_WriteRaw(Tcl_Channel chan, const char *src, + size_t srcLen); /* 396 */ EXTERN Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan); /* 397 */ @@ -1201,8 +1202,7 @@ EXTERN void Tcl_ClearChannelHandlers(Tcl_Channel channel); EXTERN int Tcl_IsChannelExisting(const char *channelName); /* 419 */ EXTERN int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs, - const Tcl_UniChar *uct, - unsigned long numChars); + const Tcl_UniChar *uct, size_t numChars); /* 420 */ EXTERN int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr, const Tcl_UniChar *uniPattern, int nocase); @@ -1649,8 +1649,8 @@ EXTERN void Tcl_AppendObjToErrorInfo(Tcl_Interp *interp, Tcl_Obj *objPtr); /* 575 */ EXTERN void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr, - const char *bytes, size_t length, int limit, - const char *ellipsis); + const char *bytes, size_t length, + size_t limit, const char *ellipsis); /* 576 */ EXTERN Tcl_Obj * Tcl_Format(Tcl_Interp *interp, const char *format, size_t objc, Tcl_Obj *const objv[]); @@ -1811,7 +1811,7 @@ EXTERN void Tcl_ZlibStreamSetCompressionDictionary( Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); -typedef struct TclStubHooks { +typedef struct { const struct TclPlatStubs *tclPlatStubs; const struct TclIntStubs *tclIntStubs; const struct TclIntPlatStubs *tclIntPlatStubs; @@ -1819,7 +1819,7 @@ typedef struct TclStubHooks { typedef struct TclStubs { int magic; - const struct TclStubHooks *hooks; + const TclStubHooks *hooks; int (*tcl_PkgProvideEx) (Tcl_Interp *interp, const char *name, const char *version, const void *clientData); /* 0 */ const char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 1 */ @@ -1914,7 +1914,7 @@ typedef struct TclStubs { void (*tcl_AsyncMark) (Tcl_AsyncHandler async); /* 74 */ int (*tcl_AsyncReady) (void); /* 75 */ void (*tcl_BackgroundError) (Tcl_Interp *interp); /* 76 */ - char (*tcl_Backslash) (const char *src, unsigned int *readPtr); /* 77 */ + char (*tcl_Backslash) (const char *src, size_t *readPtr); /* 77 */ int (*tcl_BadChannelOption) (Tcl_Interp *interp, const char *optionName, const char *optionList); /* 78 */ void (*tcl_CallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 79 */ void (*tcl_CancelIdleCall) (Tcl_IdleProc *idleProc, ClientData clientData); /* 80 */ @@ -2158,7 +2158,7 @@ typedef struct TclStubs { void (*tcl_ConditionNotify) (Tcl_Condition *condPtr); /* 310 */ void (*tcl_ConditionWait) (Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr, const Tcl_Time *timePtr); /* 311 */ size_t (*tcl_NumUtfChars) (const char *src, size_t length); /* 312 */ - int (*tcl_ReadChars) (Tcl_Channel channel, Tcl_Obj *objPtr, int charsToRead, int appendFlag); /* 313 */ + size_t (*tcl_ReadChars) (Tcl_Channel channel, Tcl_Obj *objPtr, size_t charsToRead, int appendFlag); /* 313 */ void (*tcl_RestoreResult) (Tcl_Interp *interp, Tcl_SavedResult *statePtr); /* 314 */ void (*tcl_SaveResult) (Tcl_Interp *interp, Tcl_SavedResult *statePtr); /* 315 */ int (*tcl_SetSystemEncoding) (Tcl_Interp *interp, const char *name); /* 316 */ @@ -2172,7 +2172,7 @@ typedef struct TclStubs { int (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */ const char * (*tcl_UtfAtIndex) (const char *src, int index); /* 325 */ int (*tcl_UtfCharComplete) (const char *src, size_t length); /* 326 */ - int (*tcl_UtfBackslash) (const char *src, int *readPtr, char *dst); /* 327 */ + int (*tcl_UtfBackslash) (const char *src, size_t *readPtr, char *dst); /* 327 */ const char * (*tcl_UtfFindFirst) (const char *src, int ch); /* 328 */ const char * (*tcl_UtfFindLast) (const char *src, int ch); /* 329 */ const char * (*tcl_UtfNext) (const char *src); /* 330 */ @@ -2206,7 +2206,7 @@ typedef struct TclStubs { void (*tcl_FreeParse) (Tcl_Parse *parsePtr); /* 358 */ void (*tcl_LogCommandInfo) (Tcl_Interp *interp, const char *script, const char *command, size_t length); /* 359 */ int (*tcl_ParseBraces) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, const char **termPtr); /* 360 */ - int (*tcl_ParseCommand) (Tcl_Interp *interp, const char *start, int numBytes, int nested, Tcl_Parse *parsePtr); /* 361 */ + int (*tcl_ParseCommand) (Tcl_Interp *interp, const char *start, size_t numBytes, int nested, Tcl_Parse *parsePtr); /* 361 */ int (*tcl_ParseExpr) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr); /* 362 */ int (*tcl_ParseQuotedString) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, const char **termPtr); /* 363 */ int (*tcl_ParseVarName) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append); /* 364 */ @@ -2223,12 +2223,12 @@ typedef struct TclStubs { int (*tcl_UniCharIsPunct) (int ch); /* 375 */ int (*tcl_RegExpExecObj) (Tcl_Interp *interp, Tcl_RegExp regexp, Tcl_Obj *textObj, int offset, int nmatches, int flags); /* 376 */ void (*tcl_RegExpGetInfo) (Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr); /* 377 */ - Tcl_Obj * (*tcl_NewUnicodeObj) (const Tcl_UniChar *unicode, int numChars); /* 378 */ - void (*tcl_SetUnicodeObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int numChars); /* 379 */ + Tcl_Obj * (*tcl_NewUnicodeObj) (const Tcl_UniChar *unicode, size_t numChars); /* 378 */ + void (*tcl_SetUnicodeObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, size_t numChars); /* 379 */ size_t (*tcl_GetCharLength) (Tcl_Obj *objPtr); /* 380 */ - Tcl_UniChar (*tcl_GetUniChar) (Tcl_Obj *objPtr, int index); /* 381 */ + Tcl_UniChar (*tcl_GetUniChar) (Tcl_Obj *objPtr, size_t index); /* 381 */ Tcl_UniChar * (*tcl_GetUnicode) (Tcl_Obj *objPtr); /* 382 */ - Tcl_Obj * (*tcl_GetRange) (Tcl_Obj *objPtr, int first, int last); /* 383 */ + Tcl_Obj * (*tcl_GetRange) (Tcl_Obj *objPtr, size_t first, size_t last); /* 383 */ void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, size_t length); /* 384 */ int (*tcl_RegExpMatchObj) (Tcl_Interp *interp, Tcl_Obj *textObj, Tcl_Obj *patternObj); /* 385 */ void (*tcl_SetNotifier) (Tcl_NotifierProcs *notifierProcPtr); /* 386 */ @@ -2238,9 +2238,9 @@ typedef struct TclStubs { int (*tcl_ProcObjCmd) (ClientData clientData, Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[]); /* 390 */ void (*tcl_ConditionFinalize) (Tcl_Condition *condPtr); /* 391 */ void (*tcl_MutexFinalize) (Tcl_Mutex *mutex); /* 392 */ - int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, ClientData clientData, int stackSize, int flags); /* 393 */ - int (*tcl_ReadRaw) (Tcl_Channel chan, char *dst, int bytesToRead); /* 394 */ - int (*tcl_WriteRaw) (Tcl_Channel chan, const char *src, int srcLen); /* 395 */ + int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, ClientData clientData, size_t stackSize, int flags); /* 393 */ + size_t (*tcl_ReadRaw) (Tcl_Channel chan, char *dst, size_t bytesToRead); /* 394 */ + size_t (*tcl_WriteRaw) (Tcl_Channel chan, const char *src, size_t srcLen); /* 395 */ Tcl_Channel (*tcl_GetTopChannel) (Tcl_Channel chan); /* 396 */ int (*tcl_ChannelBuffered) (Tcl_Channel chan); /* 397 */ const char * (*tcl_ChannelName) (const Tcl_ChannelType *chanTypePtr); /* 398 */ @@ -2264,7 +2264,7 @@ typedef struct TclStubs { void (*tcl_SpliceChannel) (Tcl_Channel channel); /* 416 */ void (*tcl_ClearChannelHandlers) (Tcl_Channel channel); /* 417 */ int (*tcl_IsChannelExisting) (const char *channelName); /* 418 */ - int (*tcl_UniCharNcasecmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 419 */ + int (*tcl_UniCharNcasecmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, size_t numChars); /* 419 */ int (*tcl_UniCharCaseMatch) (const Tcl_UniChar *uniStr, const Tcl_UniChar *uniPattern, int nocase); /* 420 */ Tcl_HashEntry * (*tcl_FindHashEntry) (Tcl_HashTable *tablePtr, const void *key); /* 421 */ Tcl_HashEntry * (*tcl_CreateHashEntry) (Tcl_HashTable *tablePtr, const void *key, int *newPtr); /* 422 */ @@ -2420,7 +2420,7 @@ typedef struct TclStubs { const char * (*tcl_GetEncodingNameFromEnvironment) (Tcl_DString *bufPtr); /* 572 */ int (*tcl_PkgRequireProc) (Tcl_Interp *interp, const char *name, size_t objc, Tcl_Obj *const objv[], void *clientDataPtr); /* 573 */ void (*tcl_AppendObjToErrorInfo) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 574 */ - void (*tcl_AppendLimitedToObj) (Tcl_Obj *objPtr, const char *bytes, size_t length, int limit, const char *ellipsis); /* 575 */ + void (*tcl_AppendLimitedToObj) (Tcl_Obj *objPtr, const char *bytes, size_t length, size_t limit, const char *ellipsis); /* 575 */ Tcl_Obj * (*tcl_Format) (Tcl_Interp *interp, const char *format, size_t objc, Tcl_Obj *const objv[]); /* 576 */ int (*tcl_AppendFormatToObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *format, size_t objc, Tcl_Obj *const objv[]); /* 577 */ Tcl_Obj * (*tcl_ObjPrintf) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 578 */ diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 0b585b6..924c59f 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1593,7 +1593,7 @@ Tcl_CreateThread( Tcl_ThreadId *idPtr, /* Return, the ID of the thread */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread */ ClientData clientData, /* The one argument to Main() */ - int stackSize, /* Size of stack for the new thread */ + size_t stackSize, /* Size of stack for the new thread */ int flags) /* Flags controlling behaviour of the new * thread. */ { diff --git a/generic/tclExecute.c b/generic/tclExecute.c index cf8f9e7..54eb2c3 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -702,7 +702,7 @@ static void FreeExprCodeInternalRep(Tcl_Obj *objPtr); static ExceptionRange * GetExceptRangeForPc(const unsigned char *pc, int catchOnly, ByteCode *codePtr); static const char * GetSrcInfoForPc(const unsigned char *pc, - ByteCode *codePtr, int *lengthPtr, + ByteCode *codePtr, size_t *lengthPtr, const unsigned char **pcBeg); static Tcl_Obj ** GrowEvaluationStack(ExecEnv *eePtr, int growth, int move); @@ -1282,7 +1282,7 @@ void * TclStackRealloc( Tcl_Interp *interp, void *ptr, - int numBytes) + size_t numBytes) { Interp *iPtr = (Interp *) interp; ExecEnv *eePtr; @@ -8621,7 +8621,7 @@ IllegalExprOperandType( const char * TclGetSrcInfoForCmd( Interp *iPtr, - int *lenPtr) + size_t *lenPtr) { CmdFrame *cfPtr = iPtr->cmdFramePtr; ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; @@ -8696,7 +8696,7 @@ GetSrcInfoForPc( * in codePtr's code. */ ByteCode *codePtr, /* The bytecode sequence in which to look up * the command source for the pc. */ - int *lengthPtr, /* If non-NULL, the location where the length + size_t *lengthPtr, /* If non-NULL, the location where the length * of the command's source should be stored. * If NULL, no length is stored. */ const unsigned char **pcBeg)/* If non-NULL, the bytecode location diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 5d4702b..b971533 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -381,7 +381,7 @@ Tcl_GetPathType( Tcl_PathType TclpGetNativePathType( Tcl_Obj *pathPtr, /* Native path of interest */ - int *driveNameLengthPtr, /* Returns length of drive, if non-NULL and + size_t *driveNameLengthPtr, /* Returns length of drive, if non-NULL and * path was absolute */ Tcl_Obj **driveNameRef) { @@ -494,7 +494,7 @@ TclpGetNativePathType( Tcl_Obj * TclpNativeSplitPath( Tcl_Obj *pathPtr, /* Path to split. */ - int *lenPtr) /* int to store number of path elements. */ + size_t *lenPtr) /* int to store number of path elements. */ { Tcl_Obj *resultPtr = NULL; /* Needed only to prevent gcc warnings. */ @@ -1895,7 +1895,7 @@ TclGlob( if (pathPrefix == NULL) { int driveNameLen; Tcl_Obj *driveName; - if (TclFSNonnativePathType(tail, (int) strlen(tail), NULL, + if (TclFSNonnativePathType(tail, strlen(tail), NULL, &driveNameLen, &driveName) == TCL_PATH_ABSOLUTE) { pathPrefix = driveName; tail += driveNameLen; diff --git a/generic/tclFileSystem.h b/generic/tclFileSystem.h index 6be3e03..c5539b0 100644 --- a/generic/tclFileSystem.h +++ b/generic/tclFileSystem.h @@ -48,13 +48,13 @@ MODULE_SCOPE const Tcl_Filesystem tclNativeFilesystem; MODULE_SCOPE Tcl_PathType TclFSGetPathType(Tcl_Obj *pathPtr, const Tcl_Filesystem **filesystemPtrPtr, - int *driveNameLengthPtr); + size_t *driveNameLengthPtr); MODULE_SCOPE Tcl_PathType TclFSNonnativePathType(const char *pathPtr, - int pathLen, const Tcl_Filesystem **filesystemPtrPtr, - int *driveNameLengthPtr, Tcl_Obj **driveNameRef); + size_t pathLen, const Tcl_Filesystem **filesystemPtrPtr, + size_t *driveNameLengthPtr, Tcl_Obj **driveNameRef); MODULE_SCOPE Tcl_PathType TclGetPathType(Tcl_Obj *pathPtr, const Tcl_Filesystem **filesystemPtrPtr, - int *driveNameLengthPtr, Tcl_Obj **driveNameRef); + size_t *driveNameLengthPtr, Tcl_Obj **driveNameRef); MODULE_SCOPE int TclFSEpochOk(int filesystemEpoch); MODULE_SCOPE int TclFSCwdIsNative(void); MODULE_SCOPE Tcl_Obj * TclWinVolumeRelativeNormalize(Tcl_Interp *interp, diff --git a/generic/tclIO.c b/generic/tclIO.c index 0cb9fa9..1061b71 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -81,9 +81,9 @@ static void DiscardInputQueued(ChannelState *statePtr, static void DiscardOutputQueued(ChannelState *chanPtr); static int DoRead(Channel *chanPtr, char *srcPtr, int slen, int allowShortReads); static int DoWrite(Channel *chanPtr, const char *src, int srcLen); -static int DoReadChars(Channel *chan, Tcl_Obj *objPtr, int toRead, +static size_t DoReadChars(Channel *chan, Tcl_Obj *objPtr, size_t toRead, int appendFlag); -static int DoWriteChars(Channel *chan, const char *src, int len); +static size_t DoWriteChars(Channel *chan, const char *src, size_t len); static int FilterInputBytes(Channel *chanPtr, GetsState *statePtr); static int FlushChannel(Tcl_Interp *interp, Channel *chanPtr, @@ -3679,7 +3679,7 @@ Tcl_Write( * No encoding conversions are applied to the bytes being read. * * Results: - * The number of bytes written or -1 in case of error. If -1, + * The number of bytes written or (size_t)-1 in case of error. If (size_t)-1, * Tcl_GetErrno will return the error code. * * Side effects: @@ -3689,11 +3689,11 @@ Tcl_Write( *---------------------------------------------------------------------- */ -int +size_t Tcl_WriteRaw( Tcl_Channel chan, /* The channel to buffer output for. */ const char *src, /* Data to queue in output buffer. */ - int srcLen) /* Length of data in bytes, or < 0 for + size_t srcLen) /* Length of data in bytes, or (size_t)-1 for * strlen(). */ { Channel *chanPtr = ((Channel *) chan); @@ -3702,7 +3702,7 @@ Tcl_WriteRaw( int errorCode, written; if (CheckChannelErrors(statePtr, TCL_WRITABLE | CHANNEL_RAW_MODE) != 0) { - return -1; + return (size_t)-1; } if (srcLen < 0) { @@ -3787,12 +3787,12 @@ Tcl_WriteChars( *---------------------------------------------------------------------- */ -static int +static size_t DoWriteChars( Channel *chanPtr, /* The channel to buffer output for. */ const char *src, /* UTF-8 characters to queue in output * buffer. */ - int len) /* Length of string in bytes, or < 0 for + size_t len) /* Length of string in bytes, or < 0 for * strlen(). */ { /* @@ -3804,7 +3804,7 @@ DoWriteChars( statePtr = chanPtr->state; chanPtr = statePtr->topChanPtr; - if (len < 0) { + if (len != (size_t)-1) { len = strlen(src); } if (statePtr->encoding == NULL) { @@ -5511,16 +5511,16 @@ Tcl_Read( *---------------------------------------------------------------------- */ -int +size_t Tcl_ReadRaw( Tcl_Channel chan, /* The channel from which to read. */ char *bufPtr, /* Where to store input read. */ - int bytesToRead) /* Maximum number of bytes to read. */ + size_t bytesToRead) /* Maximum number of bytes to read. */ { Channel *chanPtr = (Channel *) chan; ChannelState *statePtr = chanPtr->state; /* State info for channel */ - int nread, result, copied, copiedNow; + size_t nread, result, copied, copiedNow; /* * The check below does too much because it will reject a call to this @@ -5535,7 +5535,7 @@ Tcl_ReadRaw( */ if (CheckChannelErrors(statePtr, TCL_READABLE | CHANNEL_RAW_MODE) != 0) { - return -1; + return (size_t)-1; } /* @@ -5574,7 +5574,7 @@ Tcl_ReadRaw( * available. */ - nread = -1; + nread = (size_t)-1; result = EWOULDBLOCK; } else #endif /* TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING */ @@ -5634,7 +5634,7 @@ Tcl_ReadRaw( } Tcl_SetErrno(result); - return -1; + return (size_t)-1; } return copied + nread; @@ -5667,12 +5667,12 @@ Tcl_ReadRaw( *--------------------------------------------------------------------------- */ -int +size_t Tcl_ReadChars( Tcl_Channel chan, /* The channel to read. */ Tcl_Obj *objPtr, /* Input data is stored in this object. */ - int toRead, /* Maximum number of characters to store, or - * -1 to read all available data (up to EOF or + size_t toRead, /* Maximum number of characters to store, or + * (size_t)-1 to read all available data (up to EOF or * when channel blocks). */ int appendFlag) /* If non-zero, data read from the channel * will be appended to the object. Otherwise, @@ -5696,7 +5696,7 @@ Tcl_ReadChars( */ UpdateInterest(chanPtr); - return -1; + return (size_t)-1; } return DoReadChars(chanPtr, objPtr, toRead, appendFlag); @@ -5714,7 +5714,7 @@ Tcl_ReadChars( * object. * * Results: - * The number of characters read, or -1 on error. Use Tcl_GetErrno() to + * The number of characters read, or (size_t)-1 on error. Use Tcl_GetErrno() to * retrieve the error code for the error that occurred. * * Side effects: @@ -5723,11 +5723,11 @@ Tcl_ReadChars( *--------------------------------------------------------------------------- */ -static int +static size_t DoReadChars( Channel *chanPtr, /* The channel to read. */ Tcl_Obj *objPtr, /* Input data is stored in this object. */ - int toRead, /* Maximum number of characters to store, or + size_t toRead, /* Maximum number of characters to store, or * -1 to read all available data (up to EOF or * when channel blocks). */ int appendFlag) /* If non-zero, data read from the channel @@ -5738,7 +5738,8 @@ DoReadChars( ChannelState *statePtr = chanPtr->state; /* State info for channel */ ChannelBuffer *bufPtr; - int offset, factor, copied, copiedNow, result; + size_t offset, copied, copiedNow; + int result, factor; Tcl_Encoding encoding; #define UTF_EXPANSION_FACTOR 1024 @@ -5773,8 +5774,8 @@ DoReadChars( } } - for (copied = 0; (unsigned) toRead > 0; ) { - copiedNow = -1; + for (copied = 0; toRead > 0; ) { + copiedNow = (size_t)-1; if (statePtr->inQueueHead != NULL) { if (encoding == NULL) { copiedNow = ReadBytes(statePtr, objPtr, toRead, &offset); @@ -5799,7 +5800,7 @@ DoReadChars( } } - if (copiedNow < 0) { + if (copiedNow == (size_t)-1) { if (GotFlag(statePtr, CHANNEL_EOF)) { break; } diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index ab08353..276e0a3 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -3985,7 +3985,7 @@ TclGetPathType( /* If absolute path and this is not NULL, then * set to the filesystem which claims this * path. */ - int *driveNameLengthPtr, /* If the path is absolute, and this is + size_t *driveNameLengthPtr, /* If the path is absolute, and this is * non-NULL, then set to the length of the * driveName. */ Tcl_Obj **driveNameRef) /* If the path is absolute, and this is @@ -4036,12 +4036,12 @@ TclGetPathType( Tcl_PathType TclFSNonnativePathType( const char *path, /* Path to determine type for. */ - int pathLen, /* Length of the path. */ + size_t pathLen, /* Length of the path. */ const Tcl_Filesystem **filesystemPtrPtr, /* If absolute path and this is not NULL, then * set to the filesystem which claims this * path. */ - int *driveNameLengthPtr, /* If the path is absolute, and this is + size_t *driveNameLengthPtr, /* If the path is absolute, and this is * non-NULL, then set to the length of the * driveName. */ Tcl_Obj **driveNameRef) /* If the path is absolute, and this is diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 19daa85..80e9290 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -42,14 +42,14 @@ declare 3 { # int TclChdir(Tcl_Interp *interp, char *dirName) # } declare 5 { - int TclCleanupChildren(Tcl_Interp *interp, size_t numPids, + int TclCleanupChildren(Tcl_Interp *interp, int numPids, Tcl_Pid *pidPtr, Tcl_Channel errorChan) } declare 6 { void TclCleanupCommand(Command *cmdPtr) } declare 7 { - int TclCopyAndCollapse(int count, const char *src, char *dst) + int TclCopyAndCollapse(size_t count, const char *src, char *dst) } declare 8 { int TclCopyChannelOld(Tcl_Interp *interp, Tcl_Channel inChan, @@ -315,10 +315,10 @@ declare 76 { unsigned long TclpGetSeconds(void) } -# deprecated -declare 77 { - void TclpGetTime(Tcl_Time *time) -} +# Removed in 9.0: +#declare 77 { +# void TclpGetTime(Tcl_Time *time) +#} # Removed in 8.6: #declare 78 { # int TclpGetTimeZone(unsigned long time) @@ -1200,14 +1200,13 @@ declare 9 unix { declare 10 unix { Tcl_DirEntry *TclpReaddir(DIR *dir) } -# Slots 11 and 12 are forwarders for functions that were promoted to -# generic Stubs -declare 11 unix { - struct tm *TclpLocaltime_unix(const time_t *clock) -} -declare 12 unix { - struct tm *TclpGmtime_unix(const time_t *clock) -} +# Removed in Tcl 9.0 +#declare 11 unix { +# struct tm *TclpLocaltime_unix(const time_t *clock) +#} +#declare 12 unix { +# struct tm *TclpGmtime_unix(const time_t *clock) +#} declare 13 unix { char *TclpInetNtoa(struct in_addr addr) } diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 09f76e7..c6052e5 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -62,13 +62,12 @@ EXTERN void TclAllocateFreeObjects(void); /* Slot 4 is reserved */ /* 5 */ -EXTERN int TclCleanupChildren(Tcl_Interp *interp, - size_t numPids, Tcl_Pid *pidPtr, - Tcl_Channel errorChan); +EXTERN int TclCleanupChildren(Tcl_Interp *interp, int numPids, + Tcl_Pid *pidPtr, Tcl_Channel errorChan); /* 6 */ EXTERN void TclCleanupCommand(Command *cmdPtr); /* 7 */ -EXTERN int TclCopyAndCollapse(int count, const char *src, +EXTERN int TclCopyAndCollapse(size_t count, const char *src, char *dst); /* 8 */ EXTERN int TclCopyChannelOld(Tcl_Interp *interp, @@ -214,8 +213,7 @@ EXTERN void TclpFree(char *ptr); EXTERN unsigned long TclpGetClicks(void); /* 76 */ EXTERN unsigned long TclpGetSeconds(void); -/* 77 */ -EXTERN void TclpGetTime(Tcl_Time *time); +/* Slot 77 is reserved */ /* Slot 78 is reserved */ /* Slot 79 is reserved */ /* Slot 80 is reserved */ @@ -604,16 +602,16 @@ EXTERN void TclSetSlaveCancelFlags(Tcl_Interp *interp, int flags, typedef struct TclIntStubs { int magic; - const struct TclIntStubHooks *hooks; + void *hooks; void (*reserved0)(void); void (*reserved1)(void); void (*reserved2)(void); void (*tclAllocateFreeObjects) (void); /* 3 */ void (*reserved4)(void); - int (*tclCleanupChildren) (Tcl_Interp *interp, size_t numPids, Tcl_Pid *pidPtr, Tcl_Channel errorChan); /* 5 */ + int (*tclCleanupChildren) (Tcl_Interp *interp, int numPids, Tcl_Pid *pidPtr, Tcl_Channel errorChan); /* 5 */ void (*tclCleanupCommand) (Command *cmdPtr); /* 6 */ - int (*tclCopyAndCollapse) (int count, const char *src, char *dst); /* 7 */ + int (*tclCopyAndCollapse) (size_t count, const char *src, char *dst); /* 7 */ int (*tclCopyChannelOld) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr); /* 8 */ int (*tclCreatePipeline) (Tcl_Interp *interp, size_t argc, const char **argv, Tcl_Pid **pidArrayPtr, TclFile *inPipePtr, TclFile *outPipePtr, TclFile *errFilePtr); /* 9 */ int (*tclCreateProc) (Tcl_Interp *interp, Namespace *nsPtr, const char *procName, Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr, Proc **procPtrPtr); /* 10 */ @@ -683,7 +681,7 @@ typedef struct TclIntStubs { void (*tclpFree) (char *ptr); /* 74 */ unsigned long (*tclpGetClicks) (void); /* 75 */ unsigned long (*tclpGetSeconds) (void); /* 76 */ - void (*tclpGetTime) (Tcl_Time *time); /* 77 */ + void (*reserved77)(void); void (*reserved78)(void); void (*reserved79)(void); void (*reserved80)(void); @@ -993,8 +991,7 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclpGetClicks) /* 75 */ #define TclpGetSeconds \ (tclIntStubsPtr->tclpGetSeconds) /* 76 */ -#define TclpGetTime \ - (tclIntStubsPtr->tclpGetTime) /* 77 */ +/* Slot 77 is reserved */ /* Slot 78 is reserved */ /* Slot 79 is reserved */ /* Slot 80 is reserved */ diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 811c8cc..16fb0a1 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -69,10 +69,8 @@ EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); EXTERN TclFile TclpCreateTempFile(const char *contents); /* 10 */ EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir); -/* 11 */ -EXTERN struct tm * TclpLocaltime_unix(const time_t *clock); -/* 12 */ -EXTERN struct tm * TclpGmtime_unix(const time_t *clock); +/* Slot 11 is reserved */ +/* Slot 12 is reserved */ /* 13 */ EXTERN char * TclpInetNtoa(struct in_addr addr); /* 14 */ @@ -198,10 +196,8 @@ EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); EXTERN TclFile TclpCreateTempFile(const char *contents); /* 10 */ EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir); -/* 11 */ -EXTERN struct tm * TclpLocaltime_unix(const time_t *clock); -/* 12 */ -EXTERN struct tm * TclpGmtime_unix(const time_t *clock); +/* Slot 11 is reserved */ +/* Slot 12 is reserved */ /* 13 */ EXTERN char * TclpInetNtoa(struct in_addr addr); /* 14 */ @@ -246,7 +242,7 @@ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); typedef struct TclIntPlatStubs { int magic; - const struct TclIntPlatStubHooks *hooks; + void *hooks; #if !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */ @@ -260,8 +256,8 @@ typedef struct TclIntPlatStubs { int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */ TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */ Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ - struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */ - struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */ + void (*reserved11)(void); + void (*reserved12)(void); char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */ int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */ void (*reserved15)(void); @@ -324,8 +320,8 @@ typedef struct TclIntPlatStubs { int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */ TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */ Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ - struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */ - struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */ + void (*reserved11)(void); + void (*reserved12)(void); char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */ int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */ int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */ @@ -382,10 +378,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ #define TclpReaddir \ (tclIntPlatStubsPtr->tclpReaddir) /* 10 */ -#define TclpLocaltime_unix \ - (tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */ -#define TclpGmtime_unix \ - (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ +/* Slot 11 is reserved */ +/* Slot 12 is reserved */ #define TclpInetNtoa \ (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ #define TclUnixCopyFile \ @@ -490,10 +484,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ #define TclpReaddir \ (tclIntPlatStubsPtr->tclpReaddir) /* 10 */ -#define TclpLocaltime_unix \ - (tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */ -#define TclpGmtime_unix \ - (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ +/* Slot 11 is reserved */ +/* Slot 12 is reserved */ #define TclpInetNtoa \ (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ #define TclUnixCopyFile \ diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index 441ea91..efdefb9 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -172,7 +172,7 @@ TclCreateLiteral( Interp *iPtr, char *bytes, /* The start of the string. Note that this is * not a NUL-terminated string. */ - int length, /* Number of bytes in the string. */ + size_t length, /* Number of bytes in the string. */ unsigned hash, /* The string's hash. If -1, it will be * computed here. */ int *newPtr, diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 02d517f..3a386a0 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -4840,7 +4840,7 @@ TclLogCommandInfo( * command (must be <= command). */ const char *command, /* First character in command that generated * the error. */ - int length, /* Number of bytes in command (-1 means use + size_t length, /* Number of bytes in command ((size_t)-1 means use * all bytes up to first null byte). */ const unsigned char *pc, /* Current pc of bytecode execution context */ Tcl_Obj **tosPtr) /* Current stack of bytecode execution @@ -4872,7 +4872,7 @@ TclLogCommandInfo( } } - if (length < 0) { + if (length == (size_t)-1) { length = strlen(command); } overflow = (length > limit); @@ -4997,7 +4997,7 @@ void TclErrorStackResetIf( Tcl_Interp *interp, const char *msg, - int length) + size_t length) { Interp *iPtr = (Interp *) interp; @@ -5052,7 +5052,7 @@ Tcl_LogCommandInfo( * command (must be <= command). */ const char *command, /* First character in command that generated * the error. */ - int length) /* Number of bytes in command (-1 means use + size_t length) /* Number of bytes in command (-1 means use * all bytes up to first null byte). */ { TclLogCommandInfo(interp, script, command, length, NULL, NULL); diff --git a/generic/tclOODecls.h b/generic/tclOODecls.h index 6316303..58871c6 100644 --- a/generic/tclOODecls.h +++ b/generic/tclOODecls.h @@ -100,13 +100,13 @@ TCLOOAPI void Tcl_ClassSetDestructor(Tcl_Interp *interp, TCLOOAPI Tcl_Obj * Tcl_GetObjectName(Tcl_Interp *interp, Tcl_Object object); -typedef struct TclOOStubHooks { +typedef struct { const struct TclOOIntStubs *tclOOIntStubs; } TclOOStubHooks; typedef struct TclOOStubs { int magic; - const struct TclOOStubHooks *hooks; + const TclOOStubHooks *hooks; Tcl_Object (*tcl_CopyObjectInstance) (Tcl_Interp *interp, Tcl_Object sourceObject, const char *targetName, const char *targetNamespaceName); /* 0 */ Tcl_Object (*tcl_GetClassAsObject) (Tcl_Class clazz); /* 1 */ diff --git a/generic/tclOOIntDecls.h b/generic/tclOOIntDecls.h index c751838..acafb18 100644 --- a/generic/tclOOIntDecls.h +++ b/generic/tclOOIntDecls.h @@ -90,7 +90,7 @@ TCLOOAPI void TclOOClassSetMixins(Tcl_Interp *interp, typedef struct TclOOIntStubs { int magic; - const struct TclOOIntStubHooks *hooks; + void *hooks; Tcl_Object (*tclOOGetDefineCmdContext) (Tcl_Interp *interp); /* 0 */ Tcl_Method (*tclOOMakeProcInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, const Tcl_MethodType *typePtr, ClientData clientData, Proc **procPtrPtr); /* 1 */ diff --git a/generic/tclObj.c b/generic/tclObj.c index 74cb29e..def095f 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1668,7 +1668,7 @@ char * Tcl_GetStringFromObj( register Tcl_Obj *objPtr, /* Object whose string rep byte pointer should * be returned. */ - register int *lengthPtr) /* If non-NULL, the location where the string + register size_t *lengthPtr) /* If non-NULL, the location where the string * rep's byte array length should * be stored. * If NULL, no length is stored. */ { diff --git a/generic/tclParse.c b/generic/tclParse.c index 309e232..e043684 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -160,11 +160,11 @@ const char charTypeTable[] = { */ static inline int CommandComplete(const char *script, int numBytes); -static int ParseComment(const char *src, int numBytes, +static int ParseComment(const char *src, size_t numBytes, Tcl_Parse *parsePtr); -static int ParseTokens(const char *src, int numBytes, int mask, +static int ParseTokens(const char *src, size_t numBytes, int mask, int flags, Tcl_Parse *parsePtr); -static int ParseWhiteSpace(const char *src, int numBytes, +static int ParseWhiteSpace(const char *src, size_t numBytes, int *incompletePtr, char *typePtr); /* @@ -187,7 +187,7 @@ void TclParseInit( Tcl_Interp *interp, /* Interpreter to use for error reporting */ const char *start, /* Start of string to be parsed. */ - int numBytes, /* Total number of bytes in string. If < 0, + size_t numBytes, /* Total number of bytes in string. If (size_t)-1, * the script consists of all bytes up to the * first null character. */ Tcl_Parse *parsePtr) /* Points to struct to initialize */ @@ -233,7 +233,7 @@ Tcl_ParseCommand( * NULL, then no error message is provided. */ const char *start, /* First character of string containing one or * more Tcl commands. */ - register int numBytes, /* Total number of bytes in string. If < 0, + register size_t numBytes, /* Total number of bytes in string. If (size_t)-1, * the script consists of all bytes up to the * first null character. */ int nested, /* Non-zero means this is a nested command: @@ -263,7 +263,7 @@ Tcl_ParseCommand( } return TCL_ERROR; } - if (numBytes < 0) { + if (numBytes == (size_t)-1) { numBytes = strlen(start); } TclParseInit(interp, start, numBytes, parsePtr); @@ -640,7 +640,7 @@ TclIsSpaceProc( static int ParseWhiteSpace( const char *src, /* First character to parse. */ - register int numBytes, /* Max number of bytes to scan. */ + register size_t numBytes, /* Max number of bytes to scan. */ int *incompletePtr, /* Set this boolean memory to true if parsing * indicates an incomplete command. */ char *typePtr) /* Points to location to store character type @@ -694,7 +694,7 @@ ParseWhiteSpace( int TclParseAllWhiteSpace( const char *src, /* First character to parse. */ - int numBytes) /* Max number of byes to scan */ + size_t numBytes) /* Max number of byes to scan */ { int dummy; char type; @@ -734,7 +734,7 @@ TclParseAllWhiteSpace( int TclParseHex( const char *src, /* First character to parse. */ - int numBytes, /* Max number of byes to scan */ + size_t numBytes, /* Max number of byes to scan */ int *resultPtr) /* Points to storage provided by caller where * the character resulting from the * conversion is to be written. */ @@ -790,7 +790,7 @@ int TclParseBackslash( const char *src, /* Points to the backslash character of a a * backslash sequence. */ - int numBytes, /* Max number of bytes to scan. */ + size_t numBytes, /* Max number of bytes to scan. */ int *readPtr, /* NULL, or points to storage where the number * of bytes scanned should be written. */ char *dst) /* NULL, or points to buffer where the UTF-8 @@ -973,7 +973,7 @@ TclParseBackslash( static int ParseComment( const char *src, /* First character to parse. */ - register int numBytes, /* Max number of bytes to scan. */ + register size_t numBytes, /* Max number of bytes to scan. */ Tcl_Parse *parsePtr) /* Information about parse in progress. * Updated if parsing indicates an incomplete * command. */ @@ -1058,7 +1058,7 @@ ParseComment( static int ParseTokens( register const char *src, /* First character to parse. */ - register int numBytes, /* Max number of bytes to scan. */ + register size_t numBytes, /* Max number of bytes to scan. */ int mask, /* Specifies when to stop parsing. The parse * stops at the first unquoted character whose * CHAR_TYPE contains any of the bits in @@ -1909,12 +1909,12 @@ void TclSubstParse( Tcl_Interp *interp, const char *bytes, - int numBytes, + size_t numBytes, int flags, Tcl_Parse *parsePtr, Tcl_InterpState *statePtr) { - int length = numBytes; + size_t length = numBytes; const char *p = bytes; TclParseInit(interp, p, length, parsePtr); @@ -2517,7 +2517,7 @@ TclObjCommandComplete( int TclIsLocalScalar( const char *src, - int len) + size_t len) { const char *p; const char *lastChar = src + (len - 1); diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 2b9ff87..802ba65 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -495,7 +495,7 @@ Tcl_PathType TclFSGetPathType( Tcl_Obj *pathPtr, const Tcl_Filesystem **filesystemPtrPtr, - int *driveNameLengthPtr) + size_t *driveNameLengthPtr) { FsPath *fsPathPtr; @@ -1260,7 +1260,7 @@ Tcl_Obj * TclNewFSPathObj( Tcl_Obj *dirPtr, const char *addStrRep, - int len) + size_t len) { FsPath *fsPathPtr; Tcl_Obj *pathPtr; diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index 48ad390..e9b92fe 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -69,7 +69,7 @@ EXTERN int Tcl_MacOSXOpenVersionedBundleResources( typedef struct TclPlatStubs { int magic; - const struct TclPlatStubHooks *hooks; + void *hooks; #if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ TCHAR * (*tcl_WinUtfToTChar) (const char *str, int len, Tcl_DString *dsPtr); /* 0 */ diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 1a47304..78d020b 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -478,7 +478,7 @@ TclParseNumber( * ("integer", "boolean value", etc.). */ const char *bytes, /* Pointer to the start of the string to * scan. */ - int numBytes, /* Maximum number of bytes to scan, see + size_t numBytes, /* Maximum number of bytes to scan, see * above. */ const char **endPtrPtr, /* Place to store pointer to the character * that terminated the scan. */ diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 04cf4ee..d5d25a0 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -73,8 +73,8 @@ static void GrowStringBuffer(Tcl_Obj *objPtr, int needed, int flag); static void GrowUnicodeBuffer(Tcl_Obj *objPtr, int needed); static int SetStringFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void SetUnicodeObj(Tcl_Obj *objPtr, - const Tcl_UniChar *unicode, int numChars); -static int UnicodeLength(const Tcl_UniChar *unicode); + const Tcl_UniChar *unicode, size_t numChars); +static size_t UnicodeLength(const Tcl_UniChar *unicode); static void UpdateStringOfString(Tcl_Obj *objPtr); /* @@ -315,9 +315,9 @@ Tcl_Obj * Tcl_NewStringObj( const char *bytes, /* Points to the first of the length bytes * used to initialize the new object. */ - int length) /* The number of bytes to copy from "bytes" + size_t length) /* The number of bytes to copy from "bytes" * when initializing the new object. If - * negative, use bytes up to the first NUL + * (size_t)-1, use bytes up to the first NUL * byte. */ { return Tcl_DbNewStringObj(bytes, length, "unknown", 0); @@ -327,14 +327,14 @@ Tcl_Obj * Tcl_NewStringObj( const char *bytes, /* Points to the first of the length bytes * used to initialize the new object. */ - int length) /* The number of bytes to copy from "bytes" + size_t length) /* The number of bytes to copy from "bytes" * when initializing the new object. If * negative, use bytes up to the first NUL * byte. */ { Tcl_Obj *objPtr; - if (length < 0) { + if (length == (size_t)-1) { length = (bytes? strlen(bytes) : 0); } TclNewStringObj(objPtr, bytes, length); @@ -376,7 +376,7 @@ Tcl_Obj * Tcl_DbNewStringObj( const char *bytes, /* Points to the first of the length bytes * used to initialize the new object. */ - int length, /* The number of bytes to copy from "bytes" + size_t length, /* The number of bytes to copy from "bytes" * when initializing the new object. If * negative, use bytes up to the first NUL * byte. */ @@ -387,7 +387,7 @@ Tcl_DbNewStringObj( { Tcl_Obj *objPtr; - if (length < 0) { + if (length == (size_t)-1) { length = (bytes? strlen(bytes) : 0); } TclDbNewObj(objPtr, file, line); @@ -399,7 +399,7 @@ Tcl_Obj * Tcl_DbNewStringObj( const char *bytes, /* Points to the first of the length bytes * used to initialize the new object. */ - int length, /* The number of bytes to copy from "bytes" + size_t length, /* The number of bytes to copy from "bytes" * when initializing the new object. If * negative, use bytes up to the first NUL * byte. */ @@ -435,7 +435,7 @@ Tcl_Obj * Tcl_NewUnicodeObj( const Tcl_UniChar *unicode, /* The unicode string used to initialize the * new object. */ - int numChars) /* Number of characters in the unicode + size_t numChars) /* Number of characters in the unicode * string. */ { Tcl_Obj *objPtr; @@ -462,13 +462,13 @@ Tcl_NewUnicodeObj( *---------------------------------------------------------------------- */ -int +size_t Tcl_GetCharLength( Tcl_Obj *objPtr) /* The String object to get the num chars * of. */ { String *stringPtr; - int numChars; + size_t numChars; /* * Optimize the case where we're really dealing with a bytearray object @@ -477,7 +477,7 @@ Tcl_GetCharLength( */ if (TclIsPureByteArray(objPtr)) { - int length; + size_t length; (void) Tcl_GetByteArrayFromObj(objPtr, &length); return length; @@ -495,7 +495,7 @@ Tcl_GetCharLength( * If numChars is unknown, compute it. */ - if (numChars == -1) { + if (numChars == (size_t)-1) { TclNumUtfChars(numChars, objPtr->bytes, objPtr->length); stringPtr->numChars = numChars; @@ -535,7 +535,7 @@ Tcl_UniChar Tcl_GetUniChar( Tcl_Obj *objPtr, /* The object to get the Unicode charater * from. */ - int index) /* Get the index'th Unicode character. */ + size_t index) /* Get the index'th Unicode character. */ { String *stringPtr; @@ -625,7 +625,7 @@ Tcl_UniChar * Tcl_GetUnicodeFromObj( Tcl_Obj *objPtr, /* The object to find the unicode string * for. */ - int *lengthPtr) /* If non-NULL, the location where the string + size_t *lengthPtr) /* If non-NULL, the location where the string * rep's unichar length should be stored. If * NULL, no length is stored. */ { @@ -667,8 +667,8 @@ Tcl_GetUnicodeFromObj( Tcl_Obj * Tcl_GetRange( Tcl_Obj *objPtr, /* The Tcl object to find the range of. */ - int first, /* First index of the range. */ - int last) /* Last index of the range. */ + size_t first, /* First index of the range. */ + size_t last) /* Last index of the range. */ { Tcl_Obj *newObjPtr; /* The Tcl object to find the range of. */ String *stringPtr; @@ -697,7 +697,7 @@ Tcl_GetRange( * If numChars is unknown, compute it. */ - if (stringPtr->numChars == -1) { + if (stringPtr->numChars == (size_t)-1) { TclNumUtfChars(stringPtr->numChars, objPtr->bytes, objPtr->length); } if (stringPtr->numChars == objPtr->length) { @@ -745,7 +745,7 @@ Tcl_SetStringObj( Tcl_Obj *objPtr, /* Object whose internal rep to init. */ const char *bytes, /* Points to the first of the length bytes * used to initialize the object. */ - int length) /* The number of bytes to copy from "bytes" + size_t length) /* The number of bytes to copy from "bytes" * when initializing the object. If negative, * use bytes up to the first NUL byte.*/ { @@ -765,7 +765,7 @@ Tcl_SetStringObj( */ TclInvalidateStringRep(objPtr); - if (length < 0) { + if (length == (size_t)-1) { length = (bytes? strlen(bytes) : 0); } TclInitStringRep(objPtr, bytes, length); @@ -798,13 +798,13 @@ void Tcl_SetObjLength( Tcl_Obj *objPtr, /* Pointer to object. This object must not * currently be shared. */ - int length) /* Number of bytes desired for string + size_t length) /* Number of bytes desired for string * representation of object, not including * terminating null byte. */ { String *stringPtr; - if (length < 0) { + if (length == (size_t)-1) { /* * Setting to a negative length is nonsense. This is probably the * result of overflowing the signed integer range. @@ -847,7 +847,7 @@ Tcl_SetObjLength( * Invalidate the unicode data. */ - stringPtr->numChars = -1; + stringPtr->numChars = (size_t)-1; stringPtr->hasUnicode = 0; } else { /* @@ -903,13 +903,13 @@ int Tcl_AttemptSetObjLength( Tcl_Obj *objPtr, /* Pointer to object. This object must not * currently be shared. */ - int length) /* Number of bytes desired for string + size_t length) /* Number of bytes desired for string * representation of object, not including * terminating null byte. */ { String *stringPtr; - if (length < 0) { + if (length == (size_t)-1) { /* * Setting to a negative length is nonsense. This is probably the * result of overflowing the signed integer range. @@ -957,7 +957,7 @@ Tcl_AttemptSetObjLength( * Invalidate the unicode data. */ - stringPtr->numChars = -1; + stringPtr->numChars = (size_t)-1; stringPtr->hasUnicode = 0; } else { /* @@ -1013,7 +1013,7 @@ Tcl_SetUnicodeObj( Tcl_Obj *objPtr, /* The object to set the string of. */ const Tcl_UniChar *unicode, /* The unicode string used to initialize the * object. */ - int numChars) /* Number of characters in the unicode + size_t numChars) /* Number of characters in the unicode * string. */ { if (Tcl_IsShared(objPtr)) { @@ -1023,11 +1023,11 @@ Tcl_SetUnicodeObj( SetUnicodeObj(objPtr, unicode, numChars); } -static int +static size_t UnicodeLength( const Tcl_UniChar *unicode) { - int numChars = 0; + size_t numChars = 0; if (unicode) { while (numChars >= 0 && unicode[numChars] != 0) { @@ -1043,12 +1043,12 @@ SetUnicodeObj( Tcl_Obj *objPtr, /* The object to set the string of. */ const Tcl_UniChar *unicode, /* The unicode string used to initialize the * object. */ - int numChars) /* Number of characters in the unicode + size_t numChars) /* Number of characters in the unicode * string. */ { String *stringPtr; - if (numChars < 0) { + if (numChars == (size_t)-1) { numChars = UnicodeLength(unicode); } @@ -1094,10 +1094,10 @@ Tcl_AppendLimitedToObj( Tcl_Obj *objPtr, /* Points to the object to append to. */ const char *bytes, /* Points to the bytes to append to the * object. */ - int length, /* The number of bytes available to be + size_t length, /* The number of bytes available to be * appended from "bytes". If < 0, then all * bytes up to a NUL byte are available. */ - int limit, /* The maximum number of bytes to append to + size_t limit, /* The maximum number of bytes to append to * the object. */ const char *ellipsis) /* Ellipsis marker string, appended to the * object to indicate not all available bytes @@ -1175,8 +1175,8 @@ Tcl_AppendToObj( Tcl_Obj *objPtr, /* Points to the object to append to. */ const char *bytes, /* Points to the bytes to append to the * object. */ - int length) /* The number of bytes to append from "bytes". - * If < 0, then append all bytes up to NUL + size_t length) /* The number of bytes to append from "bytes". + * If (size_t)-1, then append all bytes up to NUL * byte. */ { Tcl_AppendLimitedToObj(objPtr, bytes, length, INT_MAX, NULL); @@ -1204,7 +1204,7 @@ Tcl_AppendUnicodeToObj( Tcl_Obj *objPtr, /* Points to the object to append to. */ const Tcl_UniChar *unicode, /* The unicode string to append to the * object. */ - int length) /* Number of chars in "unicode". */ + size_t length) /* Number of chars in "unicode". */ { String *stringPtr; @@ -1260,7 +1260,7 @@ Tcl_AppendObjToObj( Tcl_Obj *appendObjPtr) /* Object to append. */ { String *stringPtr; - int length, numChars, appendNumChars = -1; + size_t length, numChars, appendNumChars = (size_t)-1; const char *bytes; /* @@ -1350,7 +1350,7 @@ Tcl_AppendObjToObj( AppendUtfToUtfRep(objPtr, bytes, length); - if (numChars >= 0 && appendNumChars >= 0 + if (numChars != (size_t)-1 && appendNumChars != (size_t)-1 #if COMPAT && appendNumChars == length #endif diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 0bede56..7063b89 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -265,7 +265,7 @@ static const TclIntStubs tclIntStubs = { TclpFree, /* 74 */ TclpGetClicks, /* 75 */ TclpGetSeconds, /* 76 */ - TclpGetTime, /* 77 */ + 0, /* 77 */ 0, /* 78 */ 0, /* 79 */ 0, /* 80 */ @@ -456,8 +456,8 @@ static const TclIntPlatStubs tclIntPlatStubs = { TclUnixWaitForFile, /* 8 */ TclpCreateTempFile, /* 9 */ TclpReaddir, /* 10 */ - TclpLocaltime_unix, /* 11 */ - TclpGmtime_unix, /* 12 */ + 0, /* 11 */ + 0, /* 12 */ TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ 0, /* 15 */ @@ -520,8 +520,8 @@ static const TclIntPlatStubs tclIntPlatStubs = { TclUnixWaitForFile, /* 8 */ TclpCreateTempFile, /* 9 */ TclpReaddir, /* 10 */ - TclpLocaltime_unix, /* 11 */ - TclpGmtime_unix, /* 12 */ + 0, /* 11 */ + 0, /* 12 */ TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ TclMacOSXGetFileAttribute, /* 15 */ diff --git a/generic/tclTest.c b/generic/tclTest.c index 22e3747..5c32c2b 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -190,9 +190,9 @@ static int DelCmdProc(ClientData clientData, static void DelDeleteProc(ClientData clientData); static void EncodingFreeProc(ClientData clientData); static int EncodingToUtfProc(ClientData clientData, - const char *src, int srcLen, int flags, + const char *src, size_t srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, - int dstLen, int *srcReadPtr, int *dstWrotePtr, + size_t dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); static int EncodingFromUtfProc(ClientData clientData, const char *src, int srcLen, int flags, @@ -415,7 +415,7 @@ static int TestInterpResolverCmd(ClientData clientData, #if defined(HAVE_CPUID) || defined(__WIN32__) static int TestcpuidCmd(ClientData dummy, Tcl_Interp* interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); #endif static const Tcl_Filesystem testReportingFilesystem = { @@ -1959,11 +1959,11 @@ static int EncodingToUtfProc( ClientData clientData, /* TclEncoding structure. */ const char *src, /* Source string in specified encoding. */ - int srcLen, /* Source string length in bytes. */ + size_t srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ Tcl_EncodingState *statePtr,/* Current state. */ char *dst, /* Output buffer. */ - int dstLen, /* The maximum length of output buffer. */ + size_t dstLen, /* The maximum length of output buffer. */ int *srcReadPtr, /* Filled with number of bytes read. */ int *dstWrotePtr, /* Filled with number of bytes stored. */ int *dstCharsPtr) /* Filled with number of chars stored. */ diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 4f6c3bf..ef22153 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -278,7 +278,7 @@ EXTERN int TclBN_mp_cnt_lsb(const mp_int *a); typedef struct TclTomMathStubs { int magic; - const struct TclTomMathStubHooks *hooks; + void *hooks; int (*tclBN_epoch) (void); /* 0 */ int (*tclBN_revision) (void); /* 1 */ diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 4b5b37b..2eed07c 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -232,7 +232,7 @@ Tcl_UniCharToUtf( char * Tcl_UniCharToUtfDString( const Tcl_UniChar *uniStr, /* Unicode string to convert to UTF-8. */ - int uniLength, /* Length of Unicode string in Tcl_UniChars + size_t uniLength, /* Length of Unicode string in Tcl_UniChars * (must be >= 0). */ Tcl_DString *dsPtr) /* UTF-8 representation of string is appended * to this previously initialized DString. */ @@ -394,7 +394,7 @@ Tcl_UtfToUniChar( Tcl_UniChar * Tcl_UtfToUniCharDString( const char *src, /* UTF-8 string to convert to Unicode. */ - int length, /* Length of UTF-8 string in bytes, or -1 for + size_t length, /* Length of UTF-8 string in bytes, or -1 for * strlen(). */ Tcl_DString *dsPtr) /* Unicode representation of string is * appended to this previously initialized @@ -455,7 +455,7 @@ int Tcl_UtfCharComplete( const char *src, /* String to check if first few bytes contain * a complete UTF-8 character. */ - int length) /* Length of above string in bytes. */ + size_t length) /* Length of above string in bytes. */ { int ch; @@ -481,10 +481,10 @@ Tcl_UtfCharComplete( *--------------------------------------------------------------------------- */ -int +size_t Tcl_NumUtfChars( register const char *src, /* The UTF-8 string to measure. */ - int length) /* The length of the string in bytes, or -1 + size_t length) /* The length of the string in bytes, or (size_t)-1 * for strlen(string). */ { Tcl_UniChar ch; @@ -499,7 +499,7 @@ Tcl_NumUtfChars( */ i = 0; - if (length < 0) { + if (length == (size_t)-1) { while (*src != '\0') { src += TclUtfToUniChar(src, chPtr); i++; @@ -774,7 +774,7 @@ int Tcl_UtfBackslash( const char *src, /* Points to the backslash character of a * backslash sequence. */ - int *readPtr, /* Fill in with number of characters read from + size_t *readPtr, /* Fill in with number of characters read from * src, unless NULL. */ char *dst) /* Filled with the bytes represented by the * backslash sequence. */ @@ -1290,7 +1290,7 @@ int Tcl_UniCharNcasecmp( const Tcl_UniChar *ucs, /* Unicode string to compare to uct. */ const Tcl_UniChar *uct, /* Unicode string ucs is compared to. */ - unsigned long numChars) /* Number of unichars to compare. */ + size_t numChars) /* Number of unichars to compare. */ { for ( ; numChars != 0; numChars--, ucs++, uct++) { if (*ucs != *uct) { @@ -1784,10 +1784,10 @@ Tcl_UniCharCaseMatch( int TclUniCharMatch( const Tcl_UniChar *string, /* Unicode String. */ - int strLen, /* Length of String */ + size_t strLen, /* Length of String */ const Tcl_UniChar *pattern, /* Pattern, which may contain special * characters. */ - int ptnLen, /* Length of Pattern */ + size_t ptnLen, /* Length of Pattern */ int nocase) /* 0 for case sensitive, 1 for insensitive */ { const Tcl_UniChar *stringEnd, *patternEnd; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 13e54ec..1b32473 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -723,7 +723,7 @@ TclFindElement( int TclCopyAndCollapse( - int count, /* Number of byte to copy from src. */ + size_t count, /* Number of byte to copy from src. */ const char *src, /* Copy from here... */ char *dst) /* ... to here. */ { @@ -904,7 +904,7 @@ Tcl_ScanElement( int Tcl_ScanCountedElement( const char *src, /* String to convert to Tcl list element. */ - int length, /* Number of bytes in src, or -1. */ + size_t length, /* Number of bytes in src, or -1. */ int *flagPtr) /* Where to store information to guide * Tcl_ConvertElement. */ { @@ -948,7 +948,7 @@ Tcl_ScanCountedElement( int TclScanElement( const char *src, /* String to convert to Tcl list element. */ - int length, /* Number of bytes in src, or -1. */ + size_t length, /* Number of bytes in src, or (size_t)-1. */ int *flagPtr) /* Where to store information to guide * Tcl_ConvertElement. */ { @@ -969,7 +969,7 @@ TclScanElement( int braceCount = 0; /* Count of all braces '{' '}' seen. */ #endif /* COMPAT */ - if ((p == NULL) || (length == 0) || ((*p == '\0') && (length == -1))) { + if ((p == NULL) || (length == 0) || ((*p == '\0') && (length == (size_t)-1))) { /* * Empty string element must be brace quoted. */ @@ -1072,7 +1072,7 @@ TclScanElement( #endif /* COMPAT */ break; case '\0': /* TYPE_SUBS */ - if (length == -1) { + if (length == (size_t)-1) { goto endOfString; } /* TODO: Panic on improper encoding? */ @@ -1265,7 +1265,7 @@ Tcl_ConvertElement( int Tcl_ConvertCountedElement( register const char *src, /* Source information for list element. */ - int length, /* Number of bytes in src, or -1. */ + size_t length, /* Number of bytes in src, or (size_t)-1. */ char *dst, /* Place to put list-ified element. */ int flags) /* Flags produced by Tcl_ScanElement. */ { @@ -1298,7 +1298,7 @@ Tcl_ConvertCountedElement( int TclConvertElement( register const char *src, /* Source information for list element. */ - int length, /* Number of bytes in src, or -1. */ + size_t length, /* Number of bytes in src, or (size_t)-1. */ char *dst, /* Place to put list-ified element. */ int flags) /* Flags produced by Tcl_ScanElement. */ { @@ -1317,7 +1317,7 @@ TclConvertElement( * No matter what the caller demands, empty string must be braced! */ - if ((src == NULL) || (length == 0) || (*src == '\0' && length == -1)) { + if ((src == NULL) || (length == 0) || (*src == '\0' && length == (size_t)-1)) { src = tclEmptyStringRep; length = 0; conversion = CONVERT_BRACE; @@ -1344,7 +1344,7 @@ TclConvertElement( */ if (conversion == CONVERT_NONE) { - if (length == -1) { + if (length == (size_t)-1) { /* TODO: INT_MAX overflow? */ while (*src) { *p++ = *src++; @@ -1363,7 +1363,7 @@ TclConvertElement( if (conversion == CONVERT_BRACE) { *p = '{'; p++; - if (length == -1) { + if (length == (size_t)-1) { /* TODO: INT_MAX overflow? */ while (*src) { *p++ = *src++; @@ -1436,7 +1436,7 @@ TclConvertElement( p++; continue; case '\0': - if (length == -1) { + if (length == (size_t)-1) { return p - dst; } @@ -1576,7 +1576,7 @@ char Tcl_Backslash( const char *src, /* Points to the backslash character of a * backslash sequence. */ - int *readPtr) /* Fill in with number of characters read from + size_t *readPtr) /* Fill in with number of characters read from * src, unless NULL. */ { char buf[TCL_UTF_MAX]; @@ -1608,9 +1608,9 @@ Tcl_Backslash( int TclTrimRight( const char *bytes, /* String to be trimmed... */ - int numBytes, /* ...and its length in bytes */ + size_t numBytes, /* ...and its length in bytes */ const char *trim, /* String of trim characters... */ - int numTrim) /* ...and its length in bytes */ + size_t numTrim) /* ...and its length in bytes */ { const char *p = bytes + numBytes; int pInc; @@ -1689,9 +1689,9 @@ TclTrimRight( int TclTrimLeft( const char *bytes, /* String to be trimmed... */ - int numBytes, /* ...and its length in bytes */ + size_t numBytes, /* ...and its length in bytes */ const char *trim, /* String of trim characters... */ - int numTrim) /* ...and its length in bytes */ + size_t numTrim) /* ...and its length in bytes */ { const char *p = bytes; @@ -2275,11 +2275,11 @@ Tcl_StringCaseMatch( int TclByteArrayMatch( const unsigned char *string,/* String. */ - int strLen, /* Length of String */ + size_t strLen, /* Length of String */ const unsigned char *pattern, /* Pattern, which may contain special * characters. */ - int ptnLen, /* Length of Pattern */ + size_t ptnLen, /* Length of Pattern */ int flags) { const unsigned char *stringEnd, *patternEnd; @@ -2535,13 +2535,13 @@ Tcl_DStringAppend( Tcl_DString *dsPtr, /* Structure describing dynamic string. */ const char *bytes, /* String to append. If length is -1 then this * must be null-terminated. */ - int length) /* Number of bytes from "bytes" to append. If - * < 0, then append all of bytes, up to null + size_t length) /* Number of bytes from "bytes" to append. If + * (size_t) -1, then append all of bytes, up to null * at end. */ { int newSize; - if (length < 0) { + if (length == (size_t)-1) { length = strlen(bytes); } newSize = length + dsPtr->length; @@ -2701,11 +2701,11 @@ Tcl_DStringAppendElement( void Tcl_DStringSetLength( Tcl_DString *dsPtr, /* Structure describing dynamic string. */ - int length) /* New length for dynamic string. */ + size_t length) /* New length for dynamic string. */ { int newsize; - if (length < 0) { + if (length == (size_t)-1) { length = 0; } if (length >= dsPtr->spaceAvl) { @@ -4177,7 +4177,7 @@ int TclReToGlob( Tcl_Interp *interp, const char *reStr, - int reStrLen, + size_t reStrLen, Tcl_DString *dsPtr, int *exactPtr) { diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 11490f1..90566e1 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -2944,17 +2944,17 @@ ZlibTransformClose( *---------------------------------------------------------------------- */ -static int +static size_t ZlibTransformInput( ClientData instanceData, char *buf, - int toRead, + size_t toRead, int *errorCodePtr) { ZlibChannelData *cd = instanceData; Tcl_DriverInputProc *inProc = Tcl_ChannelInputProc(Tcl_GetChannelType(cd->parent)); - int readBytes, gotBytes, copied; + size_t readBytes, gotBytes, copied; if (cd->mode == TCL_ZLIB_STREAM_DEFLATE) { return inProc(Tcl_GetChannelInstanceData(cd->parent), buf, toRead, @@ -3002,7 +3002,7 @@ ZlibTransformInput( * it is EOF, try flushing the data out of the decompressor. */ - if (readBytes < 0) { + if (readBytes != (size_t)-1) { /* * Report errors to caller. The state of the seek system is * unchanged! @@ -3093,11 +3093,11 @@ ZlibTransformInput( *---------------------------------------------------------------------- */ -static int +static size_t ZlibTransformOutput( ClientData instanceData, const char *buf, - int toWrite, + size_t toWrite, int *errorCodePtr) { ZlibChannelData *cd = instanceData; diff --git a/tests/chanio.test b/tests/chanio.test index 9bb11f7..665df50 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -40,7 +40,7 @@ namespace eval ::tcl::test::io { testConstraint testfevent [llength [info commands testfevent]] testConstraint testchannelevent [llength [info commands testchannelevent]] testConstraint testmainthread [llength [info commands testmainthread]] - testConstraint thread [expr {0 == [catch {package require Thread 2.6}]}] + testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] # You need a *very* special environment to do some tests. In particular, # many file systems do not support large-files... diff --git a/tests/http.test b/tests/http.test index bde5795..9861e0e 100644 --- a/tests/http.test +++ b/tests/http.test @@ -51,7 +51,7 @@ if {![file exists $httpdFile]} { set removeHttpd 1 } -catch {package require Thread 2.6} +catch {package require Thread 2.7-} if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} { set httpthread [thread::create -preserved] thread::send $httpthread [list source $httpdFile] diff --git a/tests/io.test b/tests/io.test index 9621138..0688c14 100644 --- a/tests/io.test +++ b/tests/io.test @@ -41,7 +41,7 @@ testConstraint fcopy [llength [info commands fcopy]] testConstraint testfevent [llength [info commands testfevent]] testConstraint testchannelevent [llength [info commands testchannelevent]] testConstraint testmainthread [llength [info commands testmainthread]] -testConstraint thread [expr {0 == [catch {package require Thread 2.6}]}] +testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] # You need a *very* special environment to do some tests. In # particular, many file systems do not support large-files... diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 5eb0206..03242be 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -24,7 +24,7 @@ catch [list package require -exact Tcltest [info patchlevel]] # Custom constraints used in this file testConstraint fcopy [llength [info commands fcopy]] testConstraint testchannel [llength [info commands testchannel]] -testConstraint thread [expr {0 == [catch {package require Thread 2.6}]}] +testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] #---------------------------------------------------------------------- diff --git a/tests/ioTrans.test b/tests/ioTrans.test index 7027ec1..5a8874c 100644 --- a/tests/ioTrans.test +++ b/tests/ioTrans.test @@ -21,7 +21,7 @@ catch [list package require -exact Tcltest [info patchlevel]] # Custom constraints used in this file testConstraint testchannel [llength [info commands testchannel]] -testConstraint thread [expr {0 == [catch {package require Thread 2.6}]}] +testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] # testchannel cut|splice Both needed to test the reflection in threads. # thread::send diff --git a/tests/socket.test b/tests/socket.test index 9f1cc78..5542c09 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -64,7 +64,7 @@ package require tcltest 2 namespace import -force ::tcltest::* # Some tests require the Thread package or exec command -testConstraint thread [expr {0 == [catch {package require Thread 2.6.6}]}] +testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] testConstraint exec [llength [info commands exec]] # Produce a random port number in the Dynamic/Private range diff --git a/tests/thread.test b/tests/thread.test index 43222ac..d79f693 100644 --- a/tests/thread.test +++ b/tests/thread.test @@ -25,7 +25,7 @@ testConstraint testthread [expr {[info commands testthread] != {}}] # Some tests require the Thread package -testConstraint thread [expr {0 == [catch {package require Thread 2.7}]}] +testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] # Some tests may not work under valgrind diff --git a/tests/unixNotfy.test b/tests/unixNotfy.test index 0646a3d..2f03529 100644 --- a/tests/unixNotfy.test +++ b/tests/unixNotfy.test @@ -17,7 +17,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { # When run in a Tk shell, these tests hang. testConstraint noTk [expr {0 != [catch {package present Tk}]}] -testConstraint thread [expr {0 == [catch {package require Thread 2.6}]}] +testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] # Darwin always uses a threaded notifier testConstraint unthreaded [expr { ![::tcl::pkgconfig get threaded] diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index fdee5db..6ce4243 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -828,7 +828,7 @@ proc genStubs::forAllStubs {name slotProc onAll textVar append text [addPlatformGuard $plat $temp {} true] } ## macosx ## - if {$block(macosx) && !$block(aqua) && !$block(x11)} { + if {($block(unix) || $block(macosx)) && !$block(aqua) && !$block(x11)} { set temp {} set lastNum -1 foreach plat {unix macosx} { @@ -986,7 +986,7 @@ proc genStubs::emitHeader {name} { emitDeclarations $name text if {[info exists hooks($name)]} { - append text "\ntypedef struct ${capName}StubHooks {\n" + append text "\ntypedef struct {\n" foreach hook $hooks($name) { set capHook [string toupper [string index $hook 0]] append capHook [string range $hook 1 end] @@ -1000,7 +1000,11 @@ proc genStubs::emitHeader {name} { append text " int epoch;\n" append text " int revision;\n" } - append text " const struct ${capName}StubHooks *hooks;\n\n" + if {[info exists hooks($name)]} { + append text " const ${capName}StubHooks *hooks;\n\n" + } else { + append text " void *hooks;\n\n" + } emitSlots $name text diff --git a/tools/str2c b/tools/str2c index 971e552..cff7ba2 100644 --- a/tools/str2c +++ b/tools/str2c @@ -36,7 +36,7 @@ static char data\[\]=\"[translate $r]\";" puts "/* * Multi parts read only string generated by str2c */ -static CONST char * CONST data\[\]= {" +static const char * const data\[\]= {" set n 1 for {set i 0} {$i<$lg} {incr i $MAX} { set part [string range $r $i [expr $i+$MAX-1]] @@ -48,7 +48,7 @@ static CONST char * CONST data\[\]= {" } puts "\tNULL\t/* End of data marker */\n};" puts "\n/* use for instance with: - CONST char * CONST *chunk; + const char * const *chunk; for (chunk=data; *chunk; chunk++) { Tcl_AppendResult(interp, *chunk, (char *) NULL); } diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index f07b123..2664f0c 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -458,7 +458,7 @@ TclpInitPlatform(void) void TclpInitLibraryPath( char **valuePtr, - int *lengthPtr, + size_t *lengthPtr, Tcl_Encoding *encodingPtr) { #define LIBRARY_SIZE 32 @@ -983,7 +983,7 @@ int TclpFindVariable( const char *name, /* Name of desired environment variable * (native). */ - int *lengthPtr) /* Used to return length of name (for + size_t *lengthPtr) /* Used to return length of name (for * successful searches) or number of non-NULL * entries in environ (for unsuccessful * searches). */ diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 102c620..b024d2b 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -123,8 +123,8 @@ static int TcpGetHandleProc(ClientData instanceData, static int TcpGetOptionProc(ClientData instanceData, Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); -static int TcpInputProc(ClientData instanceData, char *buf, - int toRead, int *errorCode); +static size_t TcpInputProc(ClientData instanceData, char *buf, + size_t toRead, int *errorCode); static int TcpOutputProc(ClientData instanceData, const char *buf, int toWrite, int *errorCode); static void TcpWatchProc(ClientData instanceData, int mask); @@ -437,11 +437,11 @@ WaitForConnect( */ /* ARGSUSED */ -static int +static size_t TcpInputProc( ClientData instanceData, /* Socket state. */ char *buf, /* Where to store data read. */ - int bufSize, /* How much space is available in the + size_t bufSize, /* How much space is available in the * buffer? */ int *errorCodePtr) /* Where to store error code. */ { diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 789dbb6..14f31e4 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -75,7 +75,7 @@ TclpThreadCreate( Tcl_ThreadId *idPtr, /* Return, the ID of the thread */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread */ ClientData clientData, /* The one argument to Main() */ - int stackSize, /* Size of stack for the new thread */ + size_t stackSize, /* Size of stack for the new thread */ int flags) /* Flags controlling behaviour of the new * thread. */ { @@ -89,7 +89,7 @@ TclpThreadCreate( #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE if (stackSize != TCL_THREAD_STACK_DEFAULT) { - pthread_attr_setstacksize(&attr, (size_t) stackSize); + pthread_attr_setstacksize(&attr, stackSize); #ifdef TCL_THREAD_STACK_MIN } else { /* diff --git a/unix/tclXtNotify.c b/unix/tclXtNotify.c index 50eb4a2..e289e8c 100644 --- a/unix/tclXtNotify.c +++ b/unix/tclXtNotify.c @@ -16,9 +16,6 @@ #include <X11/Intrinsic.h> #include "tclInt.h" -#ifndef CONST86 -# define CONST86 -#endif /* * This structure is used to keep track of the notifier info for a a * registered file. @@ -87,8 +84,8 @@ static void TimerProc(ClientData clientData, XtIntervalId *id); static void CreateFileHandler(int fd, int mask, Tcl_FileProc *proc, ClientData clientData); static void DeleteFileHandler(int fd); -static void SetTimer(CONST86 Tcl_Time * timePtr); -static int WaitForEvent(CONST86 Tcl_Time * timePtr); +static void SetTimer(const Tcl_Time * timePtr); +static int WaitForEvent(const Tcl_Time * timePtr); /* * Functions defined in this file for use by users of the Xt Notifier: @@ -265,7 +262,7 @@ NotifierExitHandler( static void SetTimer( - CONST86 Tcl_Time *timePtr) /* Timeout value, may be NULL. */ + const Tcl_Time *timePtr) /* Timeout value, may be NULL. */ { long timeout; @@ -629,7 +626,7 @@ FileHandlerEventProc( static int WaitForEvent( - CONST86 Tcl_Time *timePtr) /* Maximum block time, or NULL. */ + const Tcl_Time *timePtr) /* Maximum block time, or NULL. */ { int timeout; diff --git a/win/configure b/win/configure index 0258898..ba10113 100755 --- a/win/configure +++ b/win/configure @@ -1308,10 +1308,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh -TCL_VERSION=8.6 -TCL_MAJOR_VERSION=8 -TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL="b3" +TCL_VERSION=9.0 +TCL_MAJOR_VERSION=9 +TCL_MINOR_VERSION=0 +TCL_PATCH_LEVEL="a0" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 299f42b..56f45a0 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -1,4 +1,4 @@ - +/* * tclAppInit.c -- * * Provides a default version of the main program and Tcl_AppInit diff --git a/win/tclWinInit.c b/win/tclWinInit.c index f552e2c..375da27 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -176,7 +176,7 @@ TclpInitPlatform(void) void TclpInitLibraryPath( char **valuePtr, - int *lengthPtr, + size_t *lengthPtr, Tcl_Encoding *encodingPtr) { #define LIBRARY_SIZE 64 @@ -220,7 +220,7 @@ TclpInitLibraryPath( *encodingPtr = NULL; bytes = Tcl_GetStringFromObj(pathPtr, lengthPtr); *valuePtr = ckalloc((*lengthPtr) + 1); - memcpy(*valuePtr, bytes, (size_t)(*lengthPtr)+1); + memcpy(*valuePtr, bytes, (*lengthPtr)+1); Tcl_DecrRefCount(pathPtr); } @@ -650,12 +650,13 @@ int TclpFindVariable( const char *name, /* Name of desired environment variable * (UTF-8). */ - int *lengthPtr) /* Used to return length of name (for + size_t *lengthPtr) /* Used to return length of name (for * successful searches) or number of non-NULL * entries in environ (for unsuccessful * searches). */ { - int i, length, result = -1; + int i, result = -1; + size_t length; register const char *env, *p1, *p2; char *envUpper, *nameUpper; Tcl_DString envString; diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 9e9d1af..458b05b 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -376,7 +376,7 @@ SerialGetMilliseconds(void) { Tcl_Time time; - TclpGetTime(&time); + Tcl_GetTime(&time); return (time.sec * 1000 + time.usec / 1000); } diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 1a74354..d38fe80 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1723,15 +1723,15 @@ TcpAccept( *---------------------------------------------------------------------- */ -static int +static size_t TcpInputProc( ClientData instanceData, /* The socket state. */ char *buf, /* Where to store data. */ - int toRead, /* Maximum number of bytes to read. */ + size_t toRead, /* Maximum number of bytes to read. */ int *errorCodePtr) /* Where to store error codes. */ { SocketInfo *infoPtr = instanceData; - int bytesRead; + size_t bytesRead; DWORD error; ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey); @@ -1745,7 +1745,7 @@ TcpInputProc( if (!SocketsEnabled()) { *errorCodePtr = EFAULT; - return -1; + return (size_t)-1; } /* @@ -1763,7 +1763,7 @@ TcpInputProc( if ((infoPtr->flags & SOCKET_ASYNC_CONNECT) && !WaitForSocketEvent(infoPtr, FD_CONNECT, errorCodePtr)) { - return -1; + return (size_t)-1; } /* @@ -1823,7 +1823,7 @@ TcpInputProc( if ((infoPtr->flags & SOCKET_ASYNC) || (error != WSAEWOULDBLOCK)) { TclWinConvertError(error); *errorCodePtr = Tcl_GetErrno(); - bytesRead = -1; + bytesRead = (size_t)-1; break; } @@ -1833,7 +1833,7 @@ TcpInputProc( */ if (!WaitForSocketEvent(infoPtr, FD_READ|FD_CLOSE, errorCodePtr)) { - bytesRead = -1; + bytesRead = (size_t)-1; break; } } @@ -1860,15 +1860,15 @@ TcpInputProc( *---------------------------------------------------------------------- */ -static int +static size_t TcpOutputProc( ClientData instanceData, /* The socket state. */ const char *buf, /* Where to get data. */ - int toWrite, /* Maximum number of bytes to write. */ + size_t toWrite, /* Maximum number of bytes to write. */ int *errorCodePtr) /* Where to store error codes. */ { SocketInfo *infoPtr = instanceData; - int bytesWritten; + size_t bytesWritten; DWORD error; ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey); @@ -1882,7 +1882,7 @@ TcpOutputProc( if (!SocketsEnabled()) { *errorCodePtr = EFAULT; - return -1; + return (size_t)-1; } /* @@ -1891,7 +1891,7 @@ TcpOutputProc( if ((infoPtr->flags & SOCKET_ASYNC_CONNECT) && !WaitForSocketEvent(infoPtr, FD_CONNECT, errorCodePtr)) { - return -1; + return (size_t)-1; } while (1) { @@ -1926,13 +1926,13 @@ TcpOutputProc( infoPtr->readyEvents &= ~(FD_WRITE); if (infoPtr->flags & SOCKET_ASYNC) { *errorCodePtr = EAGAIN; - bytesWritten = -1; + bytesWritten = (size_t)-1; break; } } else { TclWinConvertError(error); *errorCodePtr = Tcl_GetErrno(); - bytesWritten = -1; + bytesWritten = (size_t)-1; break; } @@ -1942,7 +1942,7 @@ TcpOutputProc( */ if (!WaitForSocketEvent(infoPtr, FD_WRITE|FD_CLOSE, errorCodePtr)) { - bytesWritten = -1; + bytesWritten = (size_t)-1; break; } } diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 7b0f6f8..c856c41 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -214,7 +214,7 @@ TclpThreadCreate( Tcl_ThreadId *idPtr, /* Return, the ID of the thread. */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread. */ ClientData clientData, /* The one argument to Main(). */ - int stackSize, /* Size of stack for the new thread. */ + size_t stackSize, /* Size of stack for the new thread. */ int flags) /* Flags controlling behaviour of the new * thread. */ { @@ -233,7 +233,7 @@ TclpThreadCreate( */ #if defined(_MSC_VER) || defined(__MSVCRT__) || defined(__BORLANDC__) - tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize, + tHandle = (HANDLE) _beginthreadex(NULL, stackSize, (Tcl_ThreadCreateProc*) TclWinThreadStart, winThreadPtr, 0, (unsigned *)idPtr); #else |