summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-23 09:21:34 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-23 09:21:34 (GMT)
commit13e1b59af5ddbcf793d09fff1ff42abc88acba51 (patch)
treea1283548bf9622f48870276e3d6cb249d4cb4bcc
parentc32b5a727445c796b53e7b3e84b14774de2baa78 (diff)
parentf87dbfe42e4103369dd3f77e045ce29843ae2c80 (diff)
downloadtcl-13e1b59af5ddbcf793d09fff1ff42abc88acba51.zip
tcl-13e1b59af5ddbcf793d09fff1ff42abc88acba51.tar.gz
tcl-13e1b59af5ddbcf793d09fff1ff42abc88acba51.tar.bz2
Merge 9.0
-rwxr-xr-xgeneric/tclArithSeries.c2
-rw-r--r--generic/tclAssembly.c2
-rw-r--r--generic/tclCmdIL.c17
-rw-r--r--generic/tclCompCmds.c2
-rw-r--r--generic/tclCompCmdsGR.c4
-rw-r--r--generic/tclCompCmdsSZ.c4
-rw-r--r--generic/tclCompile.c6
-rw-r--r--generic/tclDecls.h6
-rw-r--r--generic/tclEncoding.c4
-rw-r--r--generic/tclExecute.c12
-rw-r--r--generic/tclFCmd.c2
-rw-r--r--generic/tclFileName.c12
-rw-r--r--generic/tclIORTrans.c4
-rw-r--r--generic/tclIOUtil.c12
-rw-r--r--generic/tclInt.h4
-rw-r--r--generic/tclLink.c4
-rw-r--r--generic/tclListObj.c3
-rw-r--r--generic/tclLiteral.c9
-rw-r--r--generic/tclNamesp.c2
-rw-r--r--generic/tclOOBasic.c4
-rw-r--r--generic/tclOODefineCmds.c14
-rw-r--r--generic/tclObj.c2
-rw-r--r--generic/tclOptimize.c4
-rw-r--r--generic/tclPathObj.c40
-rw-r--r--generic/tclPkg.c6
-rw-r--r--generic/tclRegexp.c2
-rw-r--r--generic/tclResult.c4
-rw-r--r--generic/tclTest.c24
-rw-r--r--generic/tclTestObj.c6
-rw-r--r--generic/tclTimer.c4
-rw-r--r--generic/tclTomMath.h8
-rw-r--r--generic/tclVar.c4
-rw-r--r--generic/tclZipfs.c68
-rw-r--r--generic/tclZlib.c33
-rw-r--r--tests/bigdata.test8
-rw-r--r--tests/cmdIL.test3
-rw-r--r--tests/lsearch.test3
-rw-r--r--unix/tclUnixFCmd.c8
-rw-r--r--unix/tclUnixFile.c4
-rw-r--r--unix/tclUnixInit.c14
-rw-r--r--win/Makefile.in20
41 files changed, 212 insertions, 182 deletions
diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c
index 2efae10..9d87f1a 100755
--- a/generic/tclArithSeries.c
+++ b/generic/tclArithSeries.c
@@ -592,7 +592,7 @@ UpdateStringOfArithSeries(Tcl_Obj *arithSeriesObj)
Tcl_Obj *elemObj;
Tcl_Size i;
Tcl_WideInt length = 0;
- size_t slen;
+ Tcl_Size slen;
/*
* Pass 1: estimate space.
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index f372113..ef25e74 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -857,7 +857,7 @@ CompileAssembleObj(
* names in the bytecode resolve */
int status; /* Status return from Tcl_AssembleCode */
const char* source; /* String representation of the source code */
- size_t sourceLen; /* Length of the source code in bytes */
+ Tcl_Size sourceLen; /* Length of the source code in bytes */
/*
* Get the expression ByteCode from the object. If it exists, make sure it
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 1d8139a..567de38 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -2326,6 +2326,7 @@ Tcl_LassignObjCmd(
Tcl_Obj *listCopyPtr;
Tcl_Obj **listObjv; /* The contents of the list. */
Tcl_Size listObjc; /* The length of the list. */
+ Tcl_Size origListObjc; /* Original length */
int code = TCL_OK;
if (objc < 2) {
@@ -2337,8 +2338,10 @@ Tcl_LassignObjCmd(
if (listCopyPtr == NULL) {
return TCL_ERROR;
}
+ Tcl_IncrRefCount(listCopyPtr); /* Important! fs */
TclListObjGetElementsM(NULL, listCopyPtr, &listObjc, &listObjv);
+ origListObjc = listObjc;
objc -= 2;
objv += 2;
@@ -2366,7 +2369,13 @@ Tcl_LassignObjCmd(
}
if (code == TCL_OK && listObjc > 0) {
- Tcl_SetObjResult(interp, Tcl_NewListObj(listObjc, listObjv));
+ Tcl_Obj *resultObjPtr = TclListObjRange(
+ interp, listCopyPtr, origListObjc - listObjc, origListObjc - 1);
+ if (resultObjPtr == NULL) {
+ code = TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, resultObjPtr);
+ }
}
Tcl_DecrRefCount(listCopyPtr);
@@ -2759,7 +2768,11 @@ Tcl_LrangeObjCmd(
return TCL_ERROR;
}
} else {
- Tcl_SetObjResult(interp, TclListObjRange(objv[1], first, last));
+ Tcl_Obj *resultObj = TclListObjRange(interp, objv[1], first, last);
+ if (resultObj == NULL) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, resultObj);
}
return TCL_OK;
}
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 6a1c653..bc56ee9 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -3156,7 +3156,7 @@ TclCompileFormatCmd(
Tcl_Obj **objv, *formatObj, *tmpObj;
const char *bytes, *start;
int i, j;
- size_t len;
+ Tcl_Size len;
/*
* Don't handle any guaranteed-error cases.
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index 5b79187..f35cd50 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -2113,7 +2113,7 @@ TclCompileRegsubCmd(
Tcl_DString pattern;
const char *bytes;
int exact, quantified, result = TCL_ERROR;
- size_t len;
+ Tcl_Size len;
if ((int)parsePtr->numWords < 5 || (int)parsePtr->numWords > 6) {
return TCL_ERROR;
@@ -2705,7 +2705,7 @@ IndexTailVarIfKnown(
Tcl_Obj *tailPtr;
const char *tailName, *p;
int n = varTokenPtr->numComponents;
- size_t len;
+ Tcl_Size len;
Tcl_Token *lastTokenPtr;
int full, localIndex;
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index a819c97..531fbf0 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -252,7 +252,7 @@ TclCompileStringCatCmd(
} else {
Tcl_DecrRefCount(obj);
if (folded) {
- size_t len;
+ Tcl_Size len;
const char *bytes = Tcl_GetStringFromObj(folded, &len);
PushLiteral(envPtr, bytes, len);
@@ -270,7 +270,7 @@ TclCompileStringCatCmd(
wordTokenPtr = TokenAfter(wordTokenPtr);
}
if (folded) {
- size_t len;
+ Tcl_Size len;
const char *bytes = Tcl_GetStringFromObj(folded, &len);
PushLiteral(envPtr, bytes, len);
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 6940448..5da5cf1 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -776,7 +776,7 @@ TclSetByteCodeFromAny(
Interp *iPtr = (Interp *) interp;
CompileEnv compEnv; /* Compilation environment structure allocated
* in frame. */
- size_t length;
+ Tcl_Size length;
int result = TCL_OK;
const char *stringPtr;
Proc *procPtr = iPtr->compiledProcPtr;
@@ -1328,7 +1328,7 @@ CompileSubstObj(
}
if (codePtr == NULL) {
CompileEnv compEnv;
- size_t numBytes;
+ Tcl_Size numBytes;
const char *bytes = Tcl_GetStringFromObj(objPtr, &numBytes);
/* TODO: Check for more TIP 280 */
@@ -1812,7 +1812,7 @@ CompileCmdLiteral(
const char *bytes;
Command *cmdPtr;
int cmdLitIdx, extraLiteralFlags = LITERAL_CMD_NAME;
- size_t length;
+ Tcl_Size length;
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj);
if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 54b3a4a..988b563 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -4307,4 +4307,10 @@ extern const TclStubs *tclStubsPtr;
# define Tcl_GetMaster Tcl_GetParent
#endif
+/* TIP #660 for 8.7 */
+#if TCL_MAJOR_VERSION < 9
+# undef Tcl_GetSizeIntFromObj
+# define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj
+#endif
+
#endif /* _TCLDECLS */
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index fca4ea5..2b8e8c0 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2786,9 +2786,9 @@ Utf32ToUtfProc(
int prev = ch;
#endif
if (flags & TCL_ENCODING_LE) {
- ch = (src[3] & 0xFF) << 24 | (src[2] & 0xFF) << 16 | (src[1] & 0xFF) << 8 | (src[0] & 0xFF);
+ ch = (unsigned int)(src[3] & 0xFF) << 24 | (src[2] & 0xFF) << 16 | (src[1] & 0xFF) << 8 | (src[0] & 0xFF);
} else {
- ch = (src[0] & 0xFF) << 24 | (src[1] & 0xFF) << 16 | (src[2] & 0xFF) << 8 | (src[3] & 0xFF);
+ ch = (unsigned int)(src[0] & 0xFF) << 24 | (src[1] & 0xFF) << 16 | (src[2] & 0xFF) << 8 | (src[3] & 0xFF);
}
#if TCL_UTF_MAX < 4
if (HIGH_SURROGATE(prev) && !LOW_SURROGATE(ch)) {
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 897dd63..712d1ff 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -1437,7 +1437,7 @@ CompileExprObj(
* TIP #280: No invoker (yet) - Expression compilation.
*/
- size_t length;
+ Tcl_Size length;
const char *string = Tcl_GetStringFromObj(objPtr, &length);
TclInitCompileEnv(interp, &compEnv, string, length, NULL, 0);
@@ -4951,12 +4951,12 @@ TEBCresume(
if (TclHasInternalRep(valuePtr,&tclArithSeriesType.objType)) {
objResultPtr = TclArithSeriesObjRange(interp, valuePtr, fromIdx, toIdx);
- if (objResultPtr == NULL) {
- TRACE_ERROR(interp);
- goto gotError;
- }
} else {
- objResultPtr = TclListObjRange(valuePtr, fromIdx, toIdx);
+ objResultPtr = TclListObjRange(interp, valuePtr, fromIdx, toIdx);
+ }
+ if (objResultPtr == NULL) {
+ TRACE_ERROR(interp);
+ goto gotError;
}
TRACE_APPEND(("\"%.30s\"", O2S(objResultPtr)));
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c
index 0504db0..7c8fa2b 100644
--- a/generic/tclFCmd.c
+++ b/generic/tclFCmd.c
@@ -1385,7 +1385,7 @@ TclFileTemporaryCmd(
TclNewObj(nameObj);
}
if (objc > 2) {
- size_t length;
+ Tcl_Size length;
Tcl_Obj *templateObj = objv[2];
const char *string = Tcl_GetStringFromObj(templateObj, &length);
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 7c6fd08..77a0d8d 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -807,7 +807,7 @@ TclpNativeJoinPath(
const char *joining)
{
int needsSep;
- size_t length;
+ Tcl_Size length;
char *dest;
const char *p;
const char *start;
@@ -848,7 +848,7 @@ TclpNativeJoinPath(
* Append the element, eliminating duplicate and trailing slashes.
*/
- Tcl_SetObjLength(prefix, length + (int) strlen(p));
+ Tcl_SetObjLength(prefix, length + strlen(p));
dest = TclGetString(prefix) + length;
for (; *p != '\0'; p++) {
@@ -1358,7 +1358,7 @@ Tcl_GlobObjCmd(
globTypes->macCreator = NULL;
while (length-- > 0) {
- size_t len;
+ Tcl_Size len;
const char *str;
Tcl_ListObjIndex(interp, typePtr, length, &look);
@@ -2188,7 +2188,7 @@ DoGlob(
*/
if (*p == '\0') {
- size_t length;
+ Tcl_Size length;
Tcl_DString append;
/*
@@ -2252,7 +2252,7 @@ DoGlob(
* The current prefix must end in a separator.
*/
- size_t len;
+ Tcl_Size len;
const char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) {
@@ -2289,7 +2289,7 @@ DoGlob(
* This behaviour is not currently tested for in the test suite.
*/
- size_t len;
+ Tcl_Size len;
const char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) {
diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c
index d90517a..8e72e9e 100644
--- a/generic/tclIORTrans.c
+++ b/generic/tclIORTrans.c
@@ -2004,7 +2004,7 @@ InvokeTclMethod(
*/
if (result != TCL_ERROR) {
Tcl_Obj *cmd = Tcl_NewListObj(cmdc, rtPtr->argv);
- size_t cmdLen;
+ Tcl_Size cmdLen;
const char *cmdString = Tcl_GetStringFromObj(cmd, &cmdLen);
Tcl_IncrRefCount(cmd);
@@ -2770,7 +2770,7 @@ ForwardSetObjError(
ForwardParam *paramPtr,
Tcl_Obj *obj)
{
- size_t len;
+ Tcl_Size len;
const char *msgStr = Tcl_GetStringFromObj(obj, &len);
len++;
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index f2f91a7..cec6ad3 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -521,7 +521,7 @@ TclFSCwdPointerEquals(
if (tsdPtr->cwdPathPtr == *pathPtrPtr) {
return 1;
} else {
- size_t len1, len2;
+ Tcl_Size len1, len2;
const char *str1, *str2;
str1 = Tcl_GetStringFromObj(tsdPtr->cwdPathPtr, &len1);
@@ -663,7 +663,7 @@ FsUpdateCwd(
Tcl_Obj *cwdObj,
void *clientData)
{
- size_t len = 0;
+ Tcl_Size len = 0;
const char *str = NULL;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey);
@@ -1324,7 +1324,7 @@ TclFSNormalizeToUniquePath(
{
FilesystemRecord *fsRecPtr, *firstFsRecPtr;
- size_t i;
+ Tcl_Size i;
int isVfsPath = 0;
const char *path;
@@ -1686,7 +1686,7 @@ Tcl_FSEvalFileEx(
const char *encodingName) /* Either the name of an encoding or NULL to
use the utf-8 encoding. */
{
- size_t length;
+ Tcl_Size length;
int result = TCL_ERROR;
Tcl_StatBuf statBuf;
Tcl_Obj *oldScriptFile;
@@ -1952,7 +1952,7 @@ EvalFileCallback(
* Record information about where the error occurred.
*/
- size_t length;
+ Tcl_Size length;
const char *pathString = Tcl_GetStringFromObj(pathPtr, &length);
const unsigned int limit = 150;
int overflow = (length > limit);
@@ -2794,7 +2794,7 @@ Tcl_FSGetCwd(
* infinite loop bug when trying to normalize tsdPtr->cwdPathPtr.
*/
- size_t len1, len2;
+ Tcl_Size len1, len2;
const char *str1, *str2;
str1 = Tcl_GetStringFromObj(tsdPtr->cwdPathPtr, &len1);
diff --git a/generic/tclInt.h b/generic/tclInt.h
index cb660c9..0be8530 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3248,8 +3248,8 @@ MODULE_SCOPE Tcl_Obj * TclListObjCopy(Tcl_Interp *interp, Tcl_Obj *listPtr);
MODULE_SCOPE int TclListObjAppendElements(Tcl_Interp *interp,
Tcl_Obj *toObj, Tcl_Size elemCount,
Tcl_Obj *const elemObjv[]);
-MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Obj *listPtr, Tcl_Size fromIdx,
- Tcl_Size toIdx);
+MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Interp *interp, Tcl_Obj *listPtr,
+ Tcl_Size fromIdx, Tcl_Size toIdx);
MODULE_SCOPE Tcl_Obj * TclLsetList(Tcl_Interp *interp, Tcl_Obj *listPtr,
Tcl_Obj *indexPtr, Tcl_Obj *valuePtr);
MODULE_SCOPE Tcl_Obj * TclLsetFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
diff --git a/generic/tclLink.c b/generic/tclLink.c
index 1cd5f15..7474769 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -592,7 +592,7 @@ SetInvalidRealFromAny(
{
const char *str;
const char *endPtr;
- size_t length;
+ Tcl_Size length;
str = Tcl_GetStringFromObj(objPtr, &length);
if ((length == 1) && (str[0] == '.')) {
@@ -638,7 +638,7 @@ GetInvalidIntFromObj(
Tcl_Obj *objPtr,
int *intPtr)
{
- size_t length;
+ Tcl_Size length;
const char *str = Tcl_GetStringFromObj(objPtr, &length);
if ((length == 0) || ((length == 2) && (str[0] == '0')
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 747eea0..39d2c11 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -1601,6 +1601,7 @@ ListRepRange(
Tcl_Obj *
TclListObjRange(
+ Tcl_Interp *interp, /* May be NULL. Used for error messages */
Tcl_Obj *listObj, /* List object to take a range from. */
Tcl_Size rangeStart, /* Index of first element to include. */
Tcl_Size rangeEnd) /* Index of last element to include. */
@@ -1609,7 +1610,7 @@ TclListObjRange(
ListRep resultRep;
int isShared;
- if (TclListObjGetRep(NULL, listObj, &listRep) != TCL_OK)
+ if (TclListObjGetRep(interp, listObj, &listRep) != TCL_OK)
return NULL;
isShared = Tcl_IsShared(listObj);
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index d04776a..7ddb88a 100644
--- a/generic/tclLiteral.c
+++ b/generic/tclLiteral.c
@@ -560,7 +560,8 @@ TclHideLiteral(
{
LiteralEntry **nextPtrPtr, *entryPtr, *lPtr;
LiteralTable *localTablePtr = &envPtr->localLitTable;
- size_t localHash, length;
+ size_t localHash;
+ Tcl_Size length;
const char *bytes;
Tcl_Obj *newObjPtr;
@@ -837,7 +838,8 @@ TclReleaseLiteral(
LiteralTable *globalTablePtr;
LiteralEntry *entryPtr, *prevPtr;
const char *bytes;
- size_t length, index;
+ size_t index;
+ Tcl_Size length;
if (iPtr == NULL) {
goto done;
@@ -980,7 +982,8 @@ RebuildLiteralTable(
LiteralEntry *entryPtr;
LiteralEntry **bucketPtr;
const char *bytes;
- size_t oldSize, count, index, length;
+ size_t oldSize, count, index;
+ Tcl_Size length;
oldSize = tablePtr->numBuckets;
oldBuckets = tablePtr->buckets;
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index fd4961a..d7858da 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -3145,7 +3145,7 @@ NamespaceCodeCmd(
Namespace *currNsPtr;
Tcl_Obj *listPtr, *objPtr;
const char *arg;
- size_t length;
+ Tcl_Size length;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "arg");
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 4ae1480a..31c2471 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -185,7 +185,7 @@ TclOO_Class_Create(
{
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
const char *objName;
- size_t len;
+ Tcl_Size len;
/*
* Sanity check; should not be possible to invoke this method on a
@@ -250,7 +250,7 @@ TclOO_Class_CreateNs(
{
Object *oPtr = (Object *) Tcl_ObjectContextObject(context);
const char *objName, *nsName;
- size_t len;
+ Tcl_Size len;
/*
* Sanity check; should not be possible to invoke this method on a
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c
index 571c532..c46764b 100644
--- a/generic/tclOODefineCmds.c
+++ b/generic/tclOODefineCmds.c
@@ -704,7 +704,7 @@ TclOOUnknownDefinition(
Namespace *nsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
- size_t soughtLen;
+ Tcl_Size soughtLen;
const char *soughtStr, *matchedStr = NULL;
if (objc < 2) {
@@ -778,7 +778,7 @@ FindCommand(
Tcl_Obj *stringObj,
Tcl_Namespace *const namespacePtr)
{
- size_t length;
+ Tcl_Size length;
const char *nameStr, *string = Tcl_GetStringFromObj(stringObj, &length);
Namespace *const nsPtr = (Namespace *) namespacePtr;
FOREACH_HASH_DECLS;
@@ -997,16 +997,16 @@ GenerateErrorInfo(
* an object, class or class-as-object that
* was being configured. */
{
- size_t length;
+ Tcl_Size length;
Tcl_Obj *realNameObj = Tcl_ObjectDeleted((Tcl_Object) oPtr)
? savedNameObj : TclOOObjectName(interp, oPtr);
const char *objName = Tcl_GetStringFromObj(realNameObj, &length);
- unsigned limit = OBJNAME_LENGTH_IN_ERRORINFO_LIMIT;
+ int limit = OBJNAME_LENGTH_IN_ERRORINFO_LIMIT;
int overflow = (length > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (in definition script for %s \"%.*s%s\" line %d)",
- typeOfSubject, (overflow ? limit : (unsigned)length), objName,
+ typeOfSubject, (overflow ? limit : (int)length), objName,
(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
}
@@ -1534,7 +1534,7 @@ TclOODefineConstructorObjCmd(
Object *oPtr;
Class *clsPtr;
Tcl_Method method;
- size_t bodyLength;
+ Tcl_Size bodyLength;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "arguments body");
@@ -1745,7 +1745,7 @@ TclOODefineDestructorObjCmd(
Object *oPtr;
Class *clsPtr;
Tcl_Method method;
- size_t bodyLength;
+ Tcl_Size bodyLength;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "body");
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 5401608..5348289 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -617,7 +617,7 @@ TclContinuationsEnterDerived(
int start,
int *clNext)
{
- size_t length;
+ Tcl_Size length;
int end, num;
int *wordCLLast = clNext;
diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c
index e0a77aa..7a4a962 100644
--- a/generic/tclOptimize.c
+++ b/generic/tclOptimize.c
@@ -232,7 +232,7 @@ ConvertZeroEffectToNOP(
&& TclGetUInt1AtPtr(currentInstPtr + size + 1) == 2) {
Tcl_Obj *litPtr = TclFetchLiteral(envPtr,
TclGetUInt1AtPtr(currentInstPtr + 1));
- size_t numBytes;
+ Tcl_Size numBytes;
(void) Tcl_GetStringFromObj(litPtr, &numBytes);
if (numBytes == 0) {
@@ -247,7 +247,7 @@ ConvertZeroEffectToNOP(
&& TclGetUInt1AtPtr(currentInstPtr + size + 1) == 2) {
Tcl_Obj *litPtr = TclFetchLiteral(envPtr,
TclGetUInt4AtPtr(currentInstPtr + 1));
- size_t numBytes;
+ Tcl_Size numBytes;
(void) Tcl_GetStringFromObj(litPtr, &numBytes);
if (numBytes == 0) {
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index a59256f..abf9d6b 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -25,7 +25,7 @@ static void DupFsPathInternalRep(Tcl_Obj *srcPtr,
static void FreeFsPathInternalRep(Tcl_Obj *pathPtr);
static void UpdateStringOfFsPath(Tcl_Obj *pathPtr);
static int SetFsPathFromAny(Tcl_Interp *interp, Tcl_Obj *pathPtr);
-static size_t FindSplitPos(const char *path, int separator);
+static Tcl_Size FindSplitPos(const char *path, int separator);
static int IsSeparatorOrNull(int ch);
static Tcl_Obj * GetExtension(Tcl_Obj *pathPtr);
static int MakePathFromNormalized(Tcl_Interp *interp,
@@ -206,7 +206,7 @@ TclFSNormalizeAbsolutePath(
/*
* Need to skip '.' in the path.
*/
- size_t curLen;
+ Tcl_Size curLen;
if (retVal == NULL) {
const char *path = TclGetString(pathPtr);
@@ -226,7 +226,7 @@ TclFSNormalizeAbsolutePath(
}
if (dirSep[2] == '.' && IsSeparatorOrNull(dirSep[3])) {
Tcl_Obj *linkObj;
- size_t curLen;
+ Tcl_Size curLen;
char *linkStr;
/*
@@ -305,7 +305,7 @@ TclFSNormalizeAbsolutePath(
*/
if (tclPlatform == TCL_PLATFORM_WINDOWS) {
- size_t i;
+ Tcl_Size i;
for (i = 0; i < curLen; i++) {
if (linkStr[i] == '\\') {
@@ -385,7 +385,7 @@ TclFSNormalizeAbsolutePath(
*/
if (tclPlatform == TCL_PLATFORM_WINDOWS) {
- size_t len;
+ Tcl_Size len;
const char *path = Tcl_GetStringFromObj(retVal, &len);
if (len == 2 && path[0] != 0 && path[1] == ':') {
@@ -559,7 +559,7 @@ TclPathPart(
* the standardPath code.
*/
- size_t numBytes;
+ Tcl_Size numBytes;
const char *rest = Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &numBytes);
if (strchr(rest, '/') != NULL) {
@@ -596,7 +596,7 @@ TclPathPart(
* we don't, and instead just use the standardPath code.
*/
- size_t numBytes;
+ Tcl_Size numBytes;
const char *rest = Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &numBytes);
if (strchr(rest, '/') != NULL) {
@@ -624,7 +624,7 @@ TclPathPart(
return GetExtension(fsPathPtr->normPathPtr);
case TCL_PATH_ROOT: {
const char *fileName, *extension;
- size_t length;
+ Tcl_Size length;
fileName = Tcl_GetStringFromObj(fsPathPtr->normPathPtr,
&length);
@@ -675,7 +675,7 @@ TclPathPart(
if (portion == TCL_PATH_EXTENSION) {
return GetExtension(pathPtr);
} else if (portion == TCL_PATH_ROOT) {
- size_t length;
+ Tcl_Size length;
const char *fileName, *extension;
fileName = Tcl_GetStringFromObj(pathPtr, &length);
@@ -1166,7 +1166,7 @@ IsSeparatorOrNull(
* of the end of the string.
*/
-static size_t
+static Tcl_Size
FindSplitPos(
const char *path,
int separator)
@@ -1364,7 +1364,7 @@ TclFSMakePathRelative(
Tcl_Obj *pathPtr, /* The path we have. */
Tcl_Obj *cwdPtr) /* Make it relative to this. */
{
- size_t cwdLen, len;
+ Tcl_Size cwdLen, len;
const char *tempStr;
Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(pathPtr, &fsPathType);
@@ -1632,7 +1632,7 @@ Tcl_FSGetTranslatedStringPath(
Tcl_Obj *transPtr = Tcl_FSGetTranslatedPath(interp, pathPtr);
if (transPtr != NULL) {
- size_t len;
+ Tcl_Size len;
const char *orig = Tcl_GetStringFromObj(transPtr, &len);
char *result = (char *)Tcl_Alloc(len+1);
@@ -1682,7 +1682,7 @@ Tcl_FSGetNormalizedPath(
*/
Tcl_Obj *dir, *copy;
- size_t tailLen, cwdLen;
+ Tcl_Size tailLen, cwdLen;
int pathType;
pathType = Tcl_FSGetPathType(fsPathPtr->cwdPtr);
@@ -1784,7 +1784,7 @@ Tcl_FSGetNormalizedPath(
}
fsPathPtr = PATHOBJ(pathPtr);
} else if (fsPathPtr->normPathPtr == NULL) {
- size_t cwdLen;
+ Tcl_Size cwdLen;
Tcl_Obj *copy;
copy = AppendPath(fsPathPtr->cwdPtr, pathPtr);
@@ -2117,7 +2117,7 @@ Tcl_FSEqualPaths(
Tcl_Obj *secondPtr)
{
const char *firstStr, *secondStr;
- size_t firstLen, secondLen;
+ Tcl_Size firstLen, secondLen;
int tempErrno;
if (firstPtr == secondPtr) {
@@ -2174,7 +2174,7 @@ SetFsPathFromAny(
TCL_UNUSED(Tcl_Interp *), /* Used for error reporting if not NULL. */
Tcl_Obj *pathPtr) /* The object to convert. */
{
- size_t len;
+ Tcl_Size len;
FsPath *fsPathPtr;
Tcl_Obj *transPtr;
@@ -2326,7 +2326,7 @@ UpdateStringOfFsPath(
Tcl_Obj *pathPtr) /* path obj with string rep to update. */
{
FsPath *fsPathPtr = PATHOBJ(pathPtr);
- size_t cwdLen;
+ Tcl_Size cwdLen;
Tcl_Obj *copy;
if (PATHFLAGS(pathPtr) == 0 || fsPathPtr->cwdPtr == NULL) {
@@ -2398,7 +2398,7 @@ TclNativePathInFilesystem(
* situation.
*/
- size_t len;
+ Tcl_Size len;
(void) Tcl_GetStringFromObj(pathPtr, &len);
if (len == 0) {
@@ -2544,8 +2544,8 @@ TclResolveTildePath(
Tcl_Obj *pathObj)
{
const char *path;
- size_t len;
- size_t split;
+ Tcl_Size len;
+ Tcl_Size split;
Tcl_DString resolvedPath;
path = Tcl_GetStringFromObj(pathObj, &len);
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index 48ec6cd..bbc9d2c 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -1160,7 +1160,7 @@ TclNRPackageObjCmd(
break;
}
case PKG_IFNEEDED: {
- size_t length;
+ Tcl_Size length;
int res;
char *argv3i, *avi;
@@ -1399,7 +1399,7 @@ TclNRPackageObjCmd(
}
break;
case PKG_UNKNOWN: {
- size_t length;
+ Tcl_Size length;
if (objc == 2) {
if (iPtr->packageUnknown != NULL) {
@@ -2072,7 +2072,7 @@ AddRequirementsToResult(
{
Tcl_Obj *result = Tcl_GetObjResult(interp);
int i;
- size_t length;
+ Tcl_Size length;
for (i = 0; i < reqc; i++) {
const char *v = Tcl_GetStringFromObj(reqv[i], &length);
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c
index 1e6a2a9..dfdf12d 100644
--- a/generic/tclRegexp.c
+++ b/generic/tclRegexp.c
@@ -595,7 +595,7 @@ Tcl_GetRegExpFromObj(
* expression. */
int flags) /* Regular expression compilation flags. */
{
- size_t length;
+ Tcl_Size length;
TclRegexp *regexpPtr;
const char *pattern;
diff --git a/generic/tclResult.c b/generic/tclResult.c
index b6ece1b..ed0f106 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -354,7 +354,7 @@ Tcl_AppendElement(
Tcl_Obj *elementPtr = Tcl_NewStringObj(element, -1);
Tcl_Obj *listPtr = Tcl_NewListObj(1, &elementPtr);
const char *bytes;
- size_t length;
+ Tcl_Size length;
if (Tcl_IsShared(iPtr->objResultPtr)) {
Tcl_SetObjResult(interp, Tcl_DuplicateObj(iPtr->objResultPtr));
@@ -718,7 +718,7 @@ TclProcessReturn(
Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORINFO],
&valuePtr);
if (valuePtr != NULL) {
- size_t length;
+ Tcl_Size length;
(void) Tcl_GetStringFromObj(valuePtr, &length);
if (length) {
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 95a1525..9d1d132 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -92,7 +92,7 @@ typedef struct TestAsyncHandler {
# define Tcl_CreateObjTrace2 Tcl_CreateObjTrace
# define TclSizeT int
#else
-# define TclSizeT size_t
+# define TclSizeT ptrdiff_t
#endif
/*
@@ -345,7 +345,7 @@ static Tcl_ObjCmdProc2 TestFindFirstCmd;
static Tcl_ObjCmdProc2 TestFindLastCmd;
static Tcl_ObjCmdProc2 TestHashSystemHashCmd;
static Tcl_ObjCmdProc2 TestGetIntForIndexCmd;
-static Tcl_ObjCmdProc TestLutilCmd;
+static Tcl_ObjCmdProc2 TestLutilCmd;
static Tcl_NRPostProc NREUnwind_callback;
static Tcl_ObjCmdProc2 TestNREUnwind;
@@ -733,7 +733,7 @@ Tcltest_Init(
NULL, NULL);
Tcl_CreateObjCommand2(interp, "testapplylambda", TestApplyLambdaObjCmd,
NULL, NULL);
- Tcl_CreateObjCommand(interp, "testlutil", TestLutilCmd,
+ Tcl_CreateObjCommand2(interp, "testlutil", TestLutilCmd,
NULL, NULL);
if (TclObjTest_Init(interp) != TCL_OK) {
@@ -2253,7 +2253,7 @@ TestencodingObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Encoding encoding;
- size_t length;
+ Tcl_Size length;
const char *string;
TclEncoding *encodingPtr;
static const char *const optionStrings[] = {
@@ -4143,7 +4143,7 @@ PrintParse(
Tcl_Obj *objPtr;
const char *typeString;
Tcl_Token *tokenPtr;
- size_t i;
+ Tcl_Size i;
objPtr = Tcl_GetObjResult(interp);
if (parsePtr->commentSize + 1 > 1) {
@@ -4157,7 +4157,7 @@ PrintParse(
Tcl_NewStringObj(parsePtr->commandStart, parsePtr->commandSize));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewWideIntObj(parsePtr->numWords));
- for (i = 0; i < (size_t)parsePtr->numTokens; i++) {
+ for (i = 0; i < parsePtr->numTokens; i++) {
tokenPtr = &parsePtr->tokenPtr[i];
switch (tokenPtr->type) {
case TCL_TOKEN_EXPAND_WORD:
@@ -7342,7 +7342,7 @@ SimpleMatchInDirectory(
origPtr = SimpleRedirect(dirPtr);
res = Tcl_FSMatchInDirectory(interp, resPtr, origPtr, pattern, types);
if (res == TCL_OK) {
- size_t gLength, j;
+ Tcl_Size gLength, j;
Tcl_ListObjLength(NULL, resPtr, &gLength);
for (j = 0; j < gLength; j++) {
Tcl_Obj *gElt, *nElt;
@@ -7428,7 +7428,7 @@ TestUtfNextCmd(
TclSizeT objc,
Tcl_Obj *const objv[])
{
- size_t numBytes;
+ Tcl_Size numBytes;
char *bytes;
const char *result, *first;
char buffer[32];
@@ -7441,7 +7441,7 @@ TestUtfNextCmd(
}
bytes = Tcl_GetStringFromObj(objv[1], &numBytes);
- if (numBytes + 4U > sizeof(buffer)) {
+ if (numBytes + 4 > (Tcl_Size) sizeof(buffer)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"testutfnext\" can only handle %" TCL_Z_MODIFIER "u bytes",
sizeof(buffer) - 4));
@@ -7907,7 +7907,7 @@ TestconcatobjCmd(
{
Tcl_Obj *list1Ptr, *list2Ptr, *emptyPtr, *concatPtr, *tmpPtr;
int result = TCL_OK;
- size_t len;
+ Tcl_Size len;
Tcl_Obj *objv[3];
/*
@@ -8264,7 +8264,7 @@ TestparseargsCmd(
Tcl_Obj *const objv[]) /* Arguments. */
{
static int foo = 0;
- size_t count = objc;
+ Tcl_Size count = objc;
Tcl_Obj **remObjv, *result[3];
Tcl_ArgvInfo argTable[] = {
{TCL_ARGV_CONSTANT, "-bool", INT2PTR(1), &foo, "booltest", NULL},
@@ -8639,7 +8639,7 @@ static int
TestLutilCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ TclSizeT objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Arguments. */
{
Tcl_Size nL1, nL2;
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index 679a0b6..5edbd7c 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -43,7 +43,7 @@ static Tcl_ObjCmdProc2 TestintobjCmd;
static Tcl_ObjCmdProc2 TestlistobjCmd;
static Tcl_ObjCmdProc2 TestobjCmd;
static Tcl_ObjCmdProc2 TeststringobjCmd;
-static Tcl_ObjCmdProc TestbigdataCmd;
+static Tcl_ObjCmdProc2 TestbigdataCmd;
#define VARPTR_KEY "TCLOBJTEST_VARPTR"
#define NUMBER_OF_OBJECT_VARS 20
@@ -119,7 +119,7 @@ TclObjTest_Init(
Tcl_CreateObjCommand2(interp, "testobj", TestobjCmd, NULL, NULL);
Tcl_CreateObjCommand2(interp, "teststringobj", TeststringobjCmd,
NULL, NULL);
- Tcl_CreateObjCommand(interp, "testbigdata", TestbigdataCmd,
+ Tcl_CreateObjCommand2(interp, "testbigdata", TestbigdataCmd,
NULL, NULL);
return TCL_OK;
}
@@ -1548,7 +1548,7 @@ static int
TestbigdataCmd (
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *const subcmds[] = {
diff --git a/generic/tclTimer.c b/generic/tclTimer.c
index 0e9257b..f0bc5fa 100644
--- a/generic/tclTimer.c
+++ b/generic/tclTimer.c
@@ -787,7 +787,7 @@ Tcl_AfterObjCmd(
Tcl_Time wakeup;
AfterInfo *afterPtr;
AfterAssocData *assocPtr;
- size_t length;
+ Tcl_Size length;
int index = -1;
static const char *const afterSubCmds[] = {
"cancel", "idle", "info", NULL
@@ -882,7 +882,7 @@ Tcl_AfterObjCmd(
case AFTER_CANCEL: {
Tcl_Obj *commandPtr;
const char *command, *tempCommand;
- size_t tempLength;
+ Tcl_Size tempLength;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "id|command");
diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h
index 40a4e9d..26db082 100644
--- a/generic/tclTomMath.h
+++ b/generic/tclTomMath.h
@@ -24,6 +24,14 @@
# define MP_VAL -3 /* invalid input */
# define MP_ITER -4 /* maximum iterations reached */
# define MP_BUF -5 /* buffer overflow, supplied buffer too small */
+ typedef int mp_order;
+# define MP_LSB_FIRST -1
+# define MP_MSB_FIRST 1
+ typedef int mp_endian;
+# define MP_LITTLE_ENDIAN -1
+# define MP_NATIVE_ENDIAN 0
+# define MP_BIG_ENDIAN 1
+# define MP_DEPRECATED_PRAGMA(s) /* nothing */
# define MP_WUR /* nothing */
# define mp_iszero(a) ((a)->used == 0)
# define mp_isneg(a) ((a)->sign != 0)
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 60bf4c8..202e81b 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -842,7 +842,7 @@ TclLookupSimpleVar(
Namespace *varNsPtr, *cxtNsPtr, *dummy1Ptr, *dummy2Ptr;
ResolverScheme *resPtr;
int isNew, i, result;
- size_t varLen;
+ Tcl_Size varLen;
const char *varName = Tcl_GetStringFromObj(varNamePtr, &varLen);
varPtr = NULL;
@@ -972,7 +972,7 @@ TclLookupSimpleVar(
if (localCt > 0) {
Tcl_Obj **objPtrPtr = &varFramePtr->localCachePtr->varName0;
const char *localNameStr;
- size_t localLen;
+ Tcl_Size localLen;
for (i=0 ; i<localCt ; i++, objPtrPtr++) {
Tcl_Obj *objPtr = *objPtrPtr;
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 35f1f60..c9bf0eb 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -2280,7 +2280,7 @@ ZipFSMountBufferObjCmd(
{
const char *mountPoint; /* Mount point path. */
unsigned char *data;
- size_t length;
+ Tcl_Size length;
if (objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "?mountpoint? ?data?");
@@ -2391,7 +2391,7 @@ ZipFSMkKeyObjCmd(
Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- size_t len, i = 0;
+ Tcl_Size len, i = 0;
const char *pw;
Tcl_Obj *passObj;
unsigned char *passBuf;
@@ -2409,7 +2409,7 @@ ZipFSMkKeyObjCmd(
}
passObj = Tcl_NewByteArrayObj(NULL, 264);
- passBuf = Tcl_GetByteArrayFromObj(passObj, (size_t *)NULL);
+ passBuf = Tcl_GetByteArrayFromObj(passObj, (Tcl_Size *)NULL);
while (len > 0) {
int ch = pw[len - 1];
@@ -2516,7 +2516,8 @@ ZipAddFile(
* UTF-8). */
const char *zpathTcl; /* Filename in Tcl's internal encoding. */
int crc, flush, zpathlen;
- size_t nbyte, nbytecompr, len, olen, align = 0;
+ size_t nbyte, nbytecompr;
+ Tcl_Size len, olen, align = 0;
long long headerStartOffset, dataStartOffset, dataEndOffset;
int mtime = 0, isNew, compMeth;
unsigned long keys[3], keys0[3];
@@ -2540,7 +2541,7 @@ ZipAddFile(
* crazy enough to embed NULs in filenames, they deserve what they get!
*/
- zpathExt = Tcl_UtfToExternalDString(ZipFS.utf8, zpathTcl, TCL_INDEX_NONE, &zpathDs);
+ zpathExt = Tcl_UtfToExternalDString(ZipFS.utf8, zpathTcl, -1, &zpathDs);
zpathlen = strlen(zpathExt);
if (zpathlen + ZIP_CENTRAL_HEADER_LEN > bufsize) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -2578,7 +2579,7 @@ ZipAddFile(
nbyte = nbytecompr = 0;
while (1) {
len = Tcl_Read(in, buf, bufsize);
- if (len == (size_t) TCL_INDEX_NONE) {
+ if (len < 0) {
Tcl_DStringFree(&zpathDs);
if (nbyte == 0 && errno == EISDIR) {
Tcl_Close(interp, in);
@@ -2619,7 +2620,7 @@ ZipAddFile(
memset(buf, '\0', ZIP_LOCAL_HEADER_LEN);
memcpy(buf + ZIP_LOCAL_HEADER_LEN, zpathExt, zpathlen);
len = zpathlen + ZIP_LOCAL_HEADER_LEN;
- if ((size_t) Tcl_Write(out, buf, len) != len) {
+ if (Tcl_Write(out, buf, len) != len) {
writeErrorWithChannelOpen:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write error on \"%s\": %s",
@@ -2643,7 +2644,7 @@ ZipAddFile(
ZipWriteShort(astart, aend, abuf, 0xffff);
ZipWriteShort(astart, aend, abuf + 2, align - 4);
ZipWriteInt(astart, aend, abuf + 4, 0x03020100);
- if ((size_t) Tcl_Write(out, (const char *) abuf, align) != align) {
+ if (Tcl_Write(out, (const char *) abuf, align) != align) {
goto writeErrorWithChannelOpen;
}
}
@@ -2708,7 +2709,7 @@ ZipAddFile(
do {
len = Tcl_Read(in, buf, bufsize);
- if (len == (size_t) TCL_INDEX_NONE) {
+ if (len < 0) {
deflateEnd(&stream);
goto readErrorWithChannelOpen;
}
@@ -2719,7 +2720,7 @@ ZipAddFile(
stream.avail_out = sizeof(obuf);
stream.next_out = (unsigned char *) obuf;
len = deflate(&stream, flush);
- if (len == (size_t) Z_STREAM_ERROR) {
+ if (len == Z_STREAM_ERROR) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"deflate error on \"%s\"", TclGetString(pathObj)));
ZIPFS_ERROR_CODE(interp, "DEFLATE");
@@ -2730,14 +2731,14 @@ ZipAddFile(
}
olen = sizeof(obuf) - stream.avail_out;
if (passwd) {
- size_t i;
+ Tcl_Size i;
int tmp;
for (i = 0; i < olen; i++) {
obuf[i] = (char) zencode(keys, crc32tab, obuf[i], tmp);
}
}
- if (olen && ((size_t) Tcl_Write(out, obuf, olen) != olen)) {
+ if (olen && (Tcl_Write(out, obuf, olen) != olen)) {
deflateEnd(&stream);
goto writeErrorWithChannelOpen;
}
@@ -2772,20 +2773,20 @@ ZipAddFile(
nbytecompr = (passwd ? 12 : 0);
while (1) {
len = Tcl_Read(in, buf, bufsize);
- if (len == (size_t) TCL_INDEX_NONE) {
+ if (len < 0) {
goto readErrorWithChannelOpen;
} else if (len == 0) {
break;
}
if (passwd) {
- size_t i;
+ Tcl_Size i;
int tmp;
for (i = 0; i < len; i++) {
buf[i] = (char) zencode(keys0, crc32tab, buf[i], tmp);
}
}
- if ((size_t) Tcl_Write(out, buf, len) != len) {
+ if (Tcl_Write(out, buf, len) != len) {
goto writeErrorWithChannelOpen;
}
nbytecompr += len;
@@ -2918,11 +2919,11 @@ ComputeNameInArchive(
* archive */
const char *strip, /* A prefix to strip; may be NULL if no
* stripping need be done. */
- size_t slen) /* The length of the prefix; must be 0 if no
+ Tcl_Size slen) /* The length of the prefix; must be 0 if no
* stripping need be done. */
{
const char *name;
- size_t len;
+ Tcl_Size len;
if (directNameObj) {
name = TclGetString(directNameObj);
@@ -2991,7 +2992,7 @@ ZipFSMkZipOrImg(
{
Tcl_Channel out;
int count, ret = TCL_ERROR;
- size_t pwlen = 0, slen = 0, len, i = 0;
+ Tcl_Size pwlen = 0, slen = 0, len, i = 0;
Tcl_Size lobjc;
long long directoryStartOffset;
/* The overall file offset of the start of the
@@ -3178,7 +3179,7 @@ ZipFSMkZipOrImg(
strip = NULL;
}
}
- for (i = 0; i < (size_t) lobjc; i += (mappingList ? 2 : 1)) {
+ for (i = 0; i < lobjc; i += (mappingList ? 2 : 1)) {
Tcl_Obj *pathObj = lobjv[i];
const char *name = ComputeNameInArchive(pathObj,
(mappingList ? lobjv[i + 1] : NULL), strip, slen);
@@ -3198,7 +3199,7 @@ ZipFSMkZipOrImg(
directoryStartOffset = Tcl_Tell(out);
count = 0;
- for (i = 0; i < (size_t) lobjc; i += (mappingList ? 2 : 1)) {
+ for (i = 0; i < lobjc; i += (mappingList ? 2 : 1)) {
const char *name = ComputeNameInArchive(lobjv[i],
(mappingList ? lobjv[i + 1] : NULL), strip, slen);
Tcl_DString ds;
@@ -3215,7 +3216,7 @@ ZipFSMkZipOrImg(
z, len);
if ((Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN)
!= ZIP_CENTRAL_HEADER_LEN)
- || ((size_t) Tcl_Write(out, name, len) != len)) {
+ || (Tcl_Write(out, name, len) != len)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write error: %s", Tcl_PosixError(interp)));
Tcl_DStringFree(&ds);
@@ -3282,8 +3283,8 @@ CopyImageFile(
Tcl_Channel out) /* Where to copy to; already open for writing
* binary data. */
{
- size_t i, k;
- int m, n;
+ Tcl_WideInt i, k;
+ Tcl_Size m, n;
Tcl_Channel in;
char buf[4096];
const char *errMsg;
@@ -3299,7 +3300,7 @@ CopyImageFile(
*/
i = Tcl_Seek(in, 0, SEEK_END);
- if (i == (size_t) TCL_INDEX_NONE) {
+ if (i == -1) {
errMsg = "seek error";
goto copyError;
}
@@ -3312,8 +3313,8 @@ CopyImageFile(
for (k = 0; k < i; k += m) {
m = i - k;
- if (m > (int) sizeof(buf)) {
- m = (int) sizeof(buf);
+ if (m > (Tcl_Size) sizeof(buf)) {
+ m = sizeof(buf);
}
n = Tcl_Read(in, buf, m);
if (n == -1) {
@@ -5002,8 +5003,8 @@ ZipFSMatchInDirectoryProc(
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
Tcl_Obj *normPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
- int scnt, l, dirOnly = -1, strip = 0, mounts = 0;
- size_t prefixLen, len;
+ int scnt, l, dirOnly = -1, mounts = 0;
+ Tcl_Size prefixLen, len, strip = 0;
char *pat, *prefix, *path;
Tcl_DString dsPref, *prefixBuf = NULL;
@@ -5139,7 +5140,8 @@ ZipFSMatchMountPoints(
{
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
- size_t l, normLength;
+ size_t l;
+ Tcl_Size normLength;
const char *path = Tcl_GetStringFromObj(normPathPtr, &normLength);
size_t len = normLength;
@@ -5221,7 +5223,7 @@ ZipFSPathInFilesystemProc(
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
int ret = -1;
- size_t len;
+ Tcl_Size len;
char *path;
pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
@@ -5248,9 +5250,9 @@ ZipFSPathInFilesystemProc(
ZipEntry *z;
for (z = zf->topEnts; z != NULL; z = z->tnext) {
- size_t lenz = strlen(z->name);
+ Tcl_Size lenz = strlen(z->name);
- if (((size_t) len >= lenz) &&
+ if ((len >= lenz) &&
(strncmp(path, z->name, lenz) == 0)) {
ret = TCL_OK;
goto endloop;
@@ -5368,7 +5370,7 @@ ZipFSFileAttrsGetProc(
Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef)
{
- size_t len;
+ Tcl_Size len;
int ret = TCL_OK;
char *path;
ZipEntry *z;
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 3c34d44..6476edc 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -423,7 +423,7 @@ GenerateHeader(
{
Tcl_Obj *value;
int len, result = TCL_ERROR;
- size_t length;
+ Tcl_Size length;
Tcl_WideInt wideValue = 0;
const char *valueStr;
Tcl_Encoding latin1enc;
@@ -624,7 +624,7 @@ SetInflateDictionary(
Tcl_Obj *compDictObj)
{
if (compDictObj != NULL) {
- size_t length = 0;
+ Tcl_Size length = 0;
unsigned char *bytes = Tcl_GetByteArrayFromObj(compDictObj, &length);
if (bytes == NULL) {
@@ -641,7 +641,7 @@ SetDeflateDictionary(
Tcl_Obj *compDictObj)
{
if (compDictObj != NULL) {
- size_t length = 0;
+ Tcl_Size length = 0;
unsigned char *bytes = Tcl_GetByteArrayFromObj(compDictObj, &length);
if (bytes == NULL) {
@@ -1191,7 +1191,7 @@ Tcl_ZlibStreamSetCompressionDictionary(
ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle;
if (compressionDictionaryObj && (NULL == Tcl_GetByteArrayFromObj(
- compressionDictionaryObj, (size_t *)NULL))) {
+ compressionDictionaryObj, (Tcl_Size *)NULL))) {
/* Missing or invalid compression dictionary */
compressionDictionaryObj = NULL;
}
@@ -1234,7 +1234,8 @@ Tcl_ZlibStreamPut(
ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle;
char *dataTmp = NULL;
int e;
- size_t size = 0, outSize, toStore;
+ Tcl_Size size = 0;
+ size_t outSize, toStore;
unsigned char *bytes;
if (zshPtr->streamEnd) {
@@ -1616,7 +1617,7 @@ Tcl_ZlibDeflate(
Tcl_Obj *gzipHeaderDictObj)
{
int wbits = 0, e = 0, extraSize = 0;
- size_t inLen = 0;
+ Tcl_Size inLen = 0;
Byte *inData = NULL;
z_stream stream;
GzipHeader header;
@@ -1989,8 +1990,8 @@ ZlibCmd(
Tcl_Obj *const objv[])
{
int option, level = -1;
- Tcl_Size i, dlen = 0, start, buffersize = 0;
- Tcl_WideInt wideLen;
+ Tcl_Size i, dlen = 0, buffersize = 0;
+ Tcl_WideInt wideLen, start;
Byte *data;
Tcl_Obj *headerDictObj;
const char *extraInfoStr = NULL;
@@ -2024,8 +2025,8 @@ ZlibCmd(
if (data == NULL) {
return TCL_ERROR;
}
- if (objc>3 && Tcl_GetIntFromObj(interp, objv[3],
- (int *) &start) != TCL_OK) {
+ if (objc>3 && Tcl_GetWideIntFromObj(interp, objv[3],
+ &start) != TCL_OK) {
return TCL_ERROR;
}
if (objc < 4) {
@@ -2388,7 +2389,7 @@ ZlibStreamSubcmd(
}
if (compDictObj) {
- if (NULL == Tcl_GetBytesFromObj(interp, compDictObj, (size_t *)NULL)) {
+ if (NULL == Tcl_GetBytesFromObj(interp, compDictObj, (Tcl_Size *)NULL)) {
return TCL_ERROR;
}
}
@@ -2571,7 +2572,7 @@ ZlibPushSubcmd(
}
}
- if (compDictObj && (NULL == Tcl_GetBytesFromObj(interp, compDictObj, (size_t *)NULL))) {
+ if (compDictObj && (NULL == Tcl_GetBytesFromObj(interp, compDictObj, (Tcl_Size *)NULL))) {
return TCL_ERROR;
}
@@ -2819,7 +2820,7 @@ ZlibStreamAddCmd(
*/
if (compDictObj != NULL) {
- size_t len = 0;
+ Tcl_Size len = 0;
if (NULL == Tcl_GetBytesFromObj(interp, compDictObj, &len)) {
return TCL_ERROR;
@@ -2927,7 +2928,7 @@ ZlibStreamPutCmd(
*/
if (compDictObj != NULL) {
- size_t len = 0;
+ Tcl_Size len = 0;
if (NULL == Tcl_GetBytesFromObj(interp, compDictObj, &len)) {
return TCL_ERROR;
@@ -3370,7 +3371,7 @@ ZlibTransformSetOption( /* not used */
TclNewStringObj(compDictObj, value, strlen(value));
Tcl_IncrRefCount(compDictObj);
- if (NULL == Tcl_GetBytesFromObj(interp, compDictObj, (size_t *)NULL)) {
+ if (NULL == Tcl_GetBytesFromObj(interp, compDictObj, (Tcl_Size *)NULL)) {
Tcl_DecrRefCount(compDictObj);
return TCL_ERROR;
}
@@ -3520,7 +3521,7 @@ ZlibTransformGetOption(
}
} else {
if (cd->compDictObj) {
- size_t length;
+ Tcl_Size length;
const char *str = Tcl_GetStringFromObj(cd->compDictObj, &length);
Tcl_DStringAppend(dsPtr, str, length);
diff --git a/tests/bigdata.test b/tests/bigdata.test
index ced2510..c580fbd 100644
--- a/tests/bigdata.test
+++ b/tests/bigdata.test
@@ -752,17 +752,17 @@ bigtest lappend-bigdata-1 "lappend" {4294967300 4294967300 {1 2 3 4 5 a b c d}}
#
# lassign
-bigtestRO lassign-bigdata-1 "lassign" {0 1 2 3 4 5 6 7 8 9 1} -body {
+bigtestRO lassign-bigdata-1 "lassign" {0 1 2 3 4 5 6 7 8 {9 0 1 2 3 4 5 6 7 8} {6 7 8 9 0 1 2 3 4 5}} -body {
# Unset explicitly before setting to save memory as bigtestRO runs the
# script below twice.
unset -nocomplain l2
- set l2 [lassign $l a b c d e f g h i j]
- list $a $b $c $d $e $f $g $h $i $j [testlutil equal $l2 [bigList 0x100000000]]
+ set l2 [lassign $l a b c d e f g h i]
+ list $a $b $c $d $e $f $g $h $i [lrange $l2 0 9] [lrange $l2 end-9 end]
} -setup {
set l [bigList 0x10000000a]
} -cleanup {
bigClean
-} -constraints bug-d90fee06d0
+}
#
# ledit
diff --git a/tests/cmdIL.test b/tests/cmdIL.test
index 5a68925..b24b10c 100644
--- a/tests/cmdIL.test
+++ b/tests/cmdIL.test
@@ -168,6 +168,9 @@ test cmdIL-1.41 {lsort -stride and -index} -body {
test cmdIL-1.42 {lsort -stride and-index} -body {
lsort -stride 2 -index -1-1 {a 2 b 1}
} -returnCodes error -result {index "-1-1" out of range}
+test cmdIL-1.43 {lsort -stride errors} -returnCodes error -body {
+ lsort -stride 4294967296 bar
+} -result {list size must be a multiple of the stride length}
# Can't think of any good tests for the MergeSort and MergeLists procedures,
# except a bunch of random lists to sort.
diff --git a/tests/lsearch.test b/tests/lsearch.test
index 7c1402d..b8a8aa7 100644
--- a/tests/lsearch.test
+++ b/tests/lsearch.test
@@ -688,6 +688,9 @@ test lsearch-28.8 {lsearch -sorted with -stride} -body {
test lsearch-28.9 {lsearch -sorted with -stride} -body {
lsearch -sorted -stride 2 -index 1 -subindices -inline {3 5 8 7 2 9} 9
} -result 9
+test lsearch-28.10 {lsearch -sorted with -stride} -body {
+ lsearch -sorted -stride 4294967296 -index 1 -subindices -inline {3 5 8 7 2 9} 9
+} -returnCodes 1 -result {list size must be a multiple of the stride length}
# cleanup
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index 8109202..b260cf4 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -1504,7 +1504,7 @@ SetGroupAttribute(
Tcl_DString ds;
struct group *groupPtr = NULL;
const char *string;
- size_t length;
+ Tcl_Size length;
string = Tcl_GetStringFromObj(attributePtr, &length);
@@ -1571,7 +1571,7 @@ SetOwnerAttribute(
Tcl_DString ds;
struct passwd *pwPtr = NULL;
const char *string;
- size_t length;
+ Tcl_Size length;
string = Tcl_GetStringFromObj(attributePtr, &length);
@@ -1947,7 +1947,7 @@ TclpObjNormalizePath(
{
const char *currentPathEndPosition;
char cur;
- size_t pathLen;
+ Tcl_Size pathLen;
const char *path = Tcl_GetStringFromObj(pathPtr, &pathLen);
Tcl_DString ds;
const char *nativePath;
@@ -2171,7 +2171,7 @@ TclUnixOpenTemporaryFile(
Tcl_DString templ, tmp;
const char *string;
int fd;
- size_t length;
+ Tcl_Size length;
/*
* We should also check against making more then TMP_MAX of these.
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 50ee64d..41985ab 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -946,7 +946,7 @@ TclpObjLink(
if (linkAction & TCL_CREATE_SYMBOLIC_LINK) {
Tcl_DString ds;
Tcl_Obj *transPtr;
- size_t length;
+ Tcl_Size length;
/*
* Now we don't want to link to the absolute, normalized path.
@@ -1087,7 +1087,7 @@ TclNativeCreateNativeRep(
const char *str;
Tcl_DString ds;
Tcl_Obj *validPathPtr;
- size_t len;
+ Tcl_Size len;
if (TclFSCwdIsNative()) {
/*
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 9d1c192..1aecbd8 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -544,9 +544,17 @@ TclpInitLibraryPath(
Tcl_DStringFree(&buffer);
*encodingPtr = Tcl_GetEncoding(NULL, NULL);
- str = Tcl_GetStringFromObj(pathPtr, lengthPtr);
- *valuePtr = (char *)Tcl_Alloc(*lengthPtr + 1);
- memcpy(*valuePtr, str, *lengthPtr + 1);
+
+ /*
+ * Note lengthPtr is (TCL_HASH_TYPE *) which is unsigned so cannot
+ * pass directly to Tcl_GetStringFromObj.
+ * TODO - why is the type TCL_HASH_TYPE anyways?
+ */
+ Tcl_Size length;
+ str = Tcl_GetStringFromObj(pathPtr, &length);
+ *lengthPtr = length;
+ *valuePtr = (char *)Tcl_Alloc(length + 1);
+ memcpy(*valuePtr, str, length + 1);
Tcl_DecrRefCount(pathPtr);
}
diff --git a/win/Makefile.in b/win/Makefile.in
index 1c74b4f..98fb7ce 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -150,10 +150,8 @@ TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
TCL_DLL_FILE = @TCL_DLL_FILE@
TCL_LIB_FILE = @TCL_LIB_FILE@
DDE_DLL_FILE = tcl9dde$(DDEVER)${DLLSUFFIX}
-DDE_DLL_FILE8 = tcldde$(DDEVER)${DLLSUFFIX}
DDE_LIB_FILE = @LIBPREFIX@tcldde$(DDEVER)${DLLSUFFIX}${LIBSUFFIX}
REG_DLL_FILE = tcl9registry$(REGVER)${DLLSUFFIX}
-REG_DLL_FILE8 = tclregistry$(REGVER)${DLLSUFFIX}
REG_LIB_FILE = @LIBPREFIX@tclregistry$(REGVER)${DLLSUFFIX}${LIBSUFFIX}
TEST_DLL_FILE = tcltest$(VER)${DLLSUFFIX}
TEST_EXE_FILE = tcltest${EXESUFFIX}
@@ -519,7 +517,7 @@ tcltest: binaries $(TEST_EXE_FILE) $(TEST_DLL_FILE) $(CAT32) tcltest.cmd
binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ winextensions ${TCL_ZIP_FILE} $(TCLSH)
-winextensions: ${DDE_DLL_FILE} ${REG_DLL_FILE} ${DDE_DLL_FILE8} ${REG_DLL_FILE8}
+winextensions: ${DDE_DLL_FILE} ${REG_DLL_FILE}
libraries:
@@ -593,14 +591,6 @@ ${REG_DLL_FILE}: ${TCL_STUB_LIB_FILE} ${REG_OBJS}
@MAKE_DLL@ ${REG_OBJS} $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS)
$(COPY) tclsh.exe.manifest ${REG_DLL_FILE}.manifest
-${DDE_DLL_FILE8}: ${TCL_STUB_LIB_FILE} tcl8WinDde.$(OBJEXT)
- @MAKE_DLL@ tcl8WinDde.$(OBJEXT) $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS)
- $(COPY) tclsh.exe.manifest ${DDE_DLL_FILE8}.manifest
-
-${REG_DLL_FILE8}: ${TCL_STUB_LIB_FILE} tcl8WinReg.$(OBJEXT)
- @MAKE_DLL@ -DTCL_MAJOR_VERSION=8 tcl8WinReg.$(OBJEXT) $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS)
- $(COPY) tclsh.exe.manifest ${REG_DLL_FILE8}.manifest
-
${TEST_DLL_FILE}: ${TCL_STUB_LIB_FILE} ${TCLTEST_OBJS}
@$(RM) ${TEST_DLL_FILE} ${TEST_LIB_FILE}
@MAKE_DLL@ ${TCLTEST_OBJS} $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS)
@@ -860,10 +850,6 @@ install-binaries: binaries
$(COPY) $(ROOT_DIR)/library/dde/pkgIndex.tcl \
"$(LIB_INSTALL_DIR)/dde${DDEDOTVER}"; \
fi
- @if [ -f $(DDE_DLL_FILE8) ]; then \
- echo Installing $(DDE_DLL_FILE8); \
- $(COPY) $(DDE_DLL_FILE8) "$(LIB_INSTALL_DIR)/dde${DDEDOTVER}"; \
- fi
@if [ -f $(DDE_LIB_FILE) ]; then \
echo Installing $(DDE_LIB_FILE); \
$(COPY) $(DDE_LIB_FILE) "$(LIB_INSTALL_DIR)/dde${DDEDOTVER}"; \
@@ -874,10 +860,6 @@ install-binaries: binaries
$(COPY) $(ROOT_DIR)/library/registry/pkgIndex.tcl \
"$(LIB_INSTALL_DIR)/registry${REGDOTVER}"; \
fi
- @if [ -f $(REG_DLL_FILE8) ]; then \
- echo Installing $(REG_DLL_FILE8); \
- $(COPY) $(REG_DLL_FILE8) "$(LIB_INSTALL_DIR)/registry${REGDOTVER}"; \
- fi
@if [ -f $(REG_LIB_FILE) ]; then \
echo Installing $(REG_LIB_FILE); \
$(COPY) $(REG_LIB_FILE) "$(LIB_INSTALL_DIR)/registry${REGDOTVER}"; \