summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-03-29 13:17:10 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-03-29 13:17:10 (GMT)
commitb0b75a50838fb17c643dad2d633c7240d207db96 (patch)
treeab995338e4b7059fabdc9b295e5948e263bd0651
parent432fbdc37562b215a1955ebc8c5af4aadd24315a (diff)
downloadtcl-b0b75a50838fb17c643dad2d633c7240d207db96.zip
tcl-b0b75a50838fb17c643dad2d633c7240d207db96.tar.gz
tcl-b0b75a50838fb17c643dad2d633c7240d207db96.tar.bz2
More progress
-rw-r--r--generic/regexec.c12
-rw-r--r--generic/tclBinary.c36
-rw-r--r--generic/tclCmdIL.c4
-rw-r--r--generic/tclCompile.c48
-rw-r--r--generic/tclCompile.h14
-rw-r--r--generic/tclDisassemble.c4
-rw-r--r--generic/tclEnsemble.c8
-rw-r--r--generic/tclExecute.c12
-rw-r--r--generic/tclInt.h13
-rw-r--r--generic/tclPathObj.c2
-rw-r--r--generic/tclRegexp.c4
-rw-r--r--generic/tclThreadTest.c10
-rw-r--r--generic/tclVar.c12
13 files changed, 90 insertions, 89 deletions
diff --git a/generic/regexec.c b/generic/regexec.c
index fdbdef0..b9091ab 100644
--- a/generic/regexec.c
+++ b/generic/regexec.c
@@ -545,8 +545,8 @@ zapallsubs(
size_t i;
for (i = n-1; i > 0; i--) {
- p[i].rm_so = -1;
- p[i].rm_eo = -1;
+ p[i].rm_so = TCL_INDEX_NONE;
+ p[i].rm_eo = TCL_INDEX_NONE;
}
}
@@ -560,11 +560,11 @@ zaptreesubs(
struct subre *const t)
{
if (t->op == '(') {
- int n = t->subno;
+ size_t n = t->subno;
assert(n > 0);
- if ((size_t) n < v->nmatch) {
- v->pmatch[n].rm_so = -1;
- v->pmatch[n].rm_eo = -1;
+ if (n < v->nmatch) {
+ v->pmatch[n].rm_so = TCL_INDEX_NONE;
+ v->pmatch[n].rm_eo = TCL_INDEX_NONE;
}
}
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 65e9f6c..ebc0ffb 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -909,7 +909,7 @@ BinaryFormatCmd(
* cursor has visited.*/
const char *errorString;
const char *errorValue, *str;
- int offset, size;
+ size_t offset, size;
size_t length;
if (objc < 2) {
@@ -1047,16 +1047,16 @@ BinaryFormatCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
- if ((count > (size_t)offset) || (count == BINARY_ALL)) {
+ if ((count > offset) || (count == BINARY_ALL)) {
count = offset;
}
- if (offset > (int)length) {
+ if (offset > length) {
length = offset;
}
offset -= count;
break;
case '@':
- if (offset > (int)length) {
+ if (offset > length) {
length = offset;
}
if (count == BINARY_ALL) {
@@ -1072,7 +1072,7 @@ BinaryFormatCmd(
goto badField;
}
}
- if (offset > (int)length) {
+ if (offset > length) {
length = offset;
}
if (length == 0) {
@@ -1151,7 +1151,7 @@ BinaryFormatCmd(
value = 0;
errorString = "binary";
if (cmd == 'B') {
- for (offset = 0; (size_t)offset < count; offset++) {
+ for (offset = 0; offset < count; offset++) {
value <<= 1;
if (str[offset] == '1') {
value |= 1;
@@ -1166,7 +1166,7 @@ BinaryFormatCmd(
}
}
} else {
- for (offset = 0; (size_t)offset < count; offset++) {
+ for (offset = 0; offset < count; offset++) {
value >>= 1;
if (str[offset] == '1') {
value |= 128;
@@ -1213,7 +1213,7 @@ BinaryFormatCmd(
value = 0;
errorString = "hexadecimal";
if (cmd == 'H') {
- for (offset = 0; (size_t)offset < count; offset++) {
+ for (offset = 0; offset < count; offset++) {
value <<= 4;
if (!isxdigit(UCHAR(str[offset]))) { /* INTL: digit */
errorValue = str;
@@ -1234,7 +1234,7 @@ BinaryFormatCmd(
}
}
} else {
- for (offset = 0; (size_t)offset < count; offset++) {
+ for (offset = 0; offset < count; offset++) {
value >>= 4;
if (!isxdigit(UCHAR(str[offset]))) { /* INTL: digit */
@@ -1305,7 +1305,7 @@ BinaryFormatCmd(
}
}
arg++;
- for (i = 0; (size_t)i < count; i++) {
+ for (i = 0; i < count; i++) {
if (FormatNumber(interp, cmd, listv[i], &cursor) != TCL_OK) {
Tcl_DecrRefCount(resultPtr);
return TCL_ERROR;
@@ -1416,7 +1416,7 @@ BinaryScanCmd(
unsigned char *buffer; /* Start of result buffer. */
const char *errorString;
const char *str;
- int offset, size, i;
+ size_t offset, size, i;
size_t length = 0;
Tcl_Obj *valuePtr, *elementPtr;
@@ -1536,7 +1536,7 @@ BinaryScanCmd(
dest = TclGetString(valuePtr);
if (cmd == 'b') {
- for (i = 0; (size_t)i < count; i++) {
+ for (i = 0; i < count; i++) {
if (i % 8) {
value >>= 1;
} else {
@@ -1545,7 +1545,7 @@ BinaryScanCmd(
*dest++ = (char) ((value & 1) ? '1' : '0');
}
} else {
- for (i = 0; (size_t)i < count; i++) {
+ for (i = 0; i < count; i++) {
if (i % 8) {
value <<= 1;
} else {
@@ -1591,7 +1591,7 @@ BinaryScanCmd(
dest = TclGetString(valuePtr);
if (cmd == 'h') {
- for (i = 0; (size_t)i < count; i++) {
+ for (i = 0; i < count; i++) {
if (i % 2) {
value >>= 4;
} else {
@@ -1600,7 +1600,7 @@ BinaryScanCmd(
*dest++ = hexdigit[value & 0xF];
}
} else {
- for (i = 0; (size_t)i < count; i++) {
+ for (i = 0; i < count; i++) {
if (i % 2) {
value <<= 4;
} else {
@@ -1657,7 +1657,7 @@ BinaryScanCmd(
goto badIndex;
}
if (count == BINARY_NOCOUNT) {
- if ((length - offset) < (size_t)size) {
+ if (length < (size_t)size + offset) {
goto done;
}
valuePtr = ScanNumber(buffer+offset, cmd, flags,
@@ -1672,7 +1672,7 @@ BinaryScanCmd(
}
TclNewObj(valuePtr);
src = buffer + offset;
- for (i = 0; (size_t)i < count; i++) {
+ for (i = 0; i < count; i++) {
elementPtr = ScanNumber(src, cmd, flags, &numberCachePtr);
src += size;
Tcl_ListObjAppendElement(NULL, valuePtr, elementPtr);
@@ -1703,7 +1703,7 @@ BinaryScanCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
- if ((count == BINARY_ALL) || (count > (size_t)offset)) {
+ if ((count == BINARY_ALL) || (count > offset)) {
offset = 0;
} else {
offset -= count;
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 004cdb2..e73bce4 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -3694,7 +3694,7 @@ Tcl_LsearchObjCmd(
if (allMatches) {
listPtr = Tcl_NewListObj(0, NULL);
}
- for (i = start; i < (size_t)listc; i += groupSize) {
+ for (i = start; i < listc; i += groupSize) {
match = 0;
if (sortInfo.indexc != 0) {
itemPtr = SelectObjFromSublist(listv[i+groupOffset], &sortInfo);
@@ -4188,7 +4188,7 @@ Tcl_LsortObjCmd(
allocatedIndexVector = 1; /* Cannot use indexc field, as it
* might be decreased by 1 later. */
}
- for (j=0 ; j<(size_t)sortInfo.indexc ; j++) {
+ for (j=0 ; j<sortInfo.indexc ; j++) {
/* Prescreened values, no errors or out of range possible */
TclIndexEncode(NULL, indexv[j], TCL_INDEX_NONE,
TCL_INDEX_NONE, &sortInfo.indexv[j]);
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 5045aab..ce7c824 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -673,9 +673,9 @@ static void DupByteCodeInternalRep(Tcl_Obj *srcPtr,
static unsigned char * EncodeCmdLocMap(CompileEnv *envPtr,
ByteCode *codePtr, unsigned char *startPtr);
static void EnterCmdExtentData(CompileEnv *envPtr,
- int cmdNumber, int numSrcBytes, int numCodeBytes);
+ size_t cmdNumber, size_t numSrcBytes, size_t numCodeBytes);
static void EnterCmdStartData(CompileEnv *envPtr,
- int cmdNumber, int srcOffset, int codeOffset);
+ size_t cmdNumber, size_t srcOffset, size_t codeOffset);
static void FreeByteCodeInternalRep(Tcl_Obj *objPtr);
static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr);
static int GetCmdLocEncodingSize(CompileEnv *envPtr);
@@ -3158,15 +3158,15 @@ EnterCmdStartData(
CompileEnv *envPtr, /* Points to the compilation environment
* structure in which to enter command
* location information. */
- int cmdIndex, /* Index of the command whose start data is
+ size_t cmdIndex, /* Index of the command whose start data is
* being set. */
- int srcOffset, /* Offset of first char of the command. */
- int codeOffset) /* Offset of first byte of command code. */
+ size_t srcOffset, /* Offset of first char of the command. */
+ size_t codeOffset) /* Offset of first byte of command code. */
{
CmdLocation *cmdLocPtr;
- if ((size_t)cmdIndex >= envPtr->numCommands) {
- Tcl_Panic("EnterCmdStartData: bad command index %d", cmdIndex);
+ if (cmdIndex >= envPtr->numCommands) {
+ Tcl_Panic("EnterCmdStartData: bad command index %" TCL_Z_MODIFIER "u", cmdIndex);
}
if (cmdIndex >= envPtr->cmdMapEnd) {
@@ -3207,8 +3207,8 @@ EnterCmdStartData(
cmdLocPtr = &envPtr->cmdMapPtr[cmdIndex];
cmdLocPtr->codeOffset = codeOffset;
cmdLocPtr->srcOffset = srcOffset;
- cmdLocPtr->numSrcBytes = -1;
- cmdLocPtr->numCodeBytes = -1;
+ cmdLocPtr->numSrcBytes = TCL_INDEX_NONE;
+ cmdLocPtr->numCodeBytes = TCL_INDEX_NONE;
}
/*
@@ -3237,19 +3237,19 @@ EnterCmdExtentData(
CompileEnv *envPtr, /* Points to the compilation environment
* structure in which to enter command
* location information. */
- int cmdIndex, /* Index of the command whose source and code
+ size_t cmdIndex, /* Index of the command whose source and code
* length data is being set. */
- int numSrcBytes, /* Number of command source chars. */
- int numCodeBytes) /* Offset of last byte of command code. */
+ size_t numSrcBytes, /* Number of command source chars. */
+ size_t numCodeBytes) /* Offset of last byte of command code. */
{
CmdLocation *cmdLocPtr;
- if ((size_t)cmdIndex >= envPtr->numCommands) {
- Tcl_Panic("EnterCmdExtentData: bad command index %d", cmdIndex);
+ if (cmdIndex >= envPtr->numCommands) {
+ Tcl_Panic("EnterCmdExtentData: bad command index %" TCL_Z_MODIFIER "u", cmdIndex);
}
if (cmdIndex > envPtr->cmdMapEnd) {
- Tcl_Panic("EnterCmdExtentData: missing start data for command %d",
+ Tcl_Panic("EnterCmdExtentData: missing start data for command %" TCL_Z_MODIFIER "u",
cmdIndex);
}
@@ -3720,7 +3720,7 @@ TclFinalizeLoopExceptionRange(
*----------------------------------------------------------------------
*/
-int
+size_t
TclCreateAuxData(
ClientData clientData, /* The compilation auxiliary data to store in
* the new aux data record. */
@@ -3729,7 +3729,7 @@ TclCreateAuxData(
CompileEnv *envPtr)/* Points to the CompileEnv for which a new
* aux data structure is to be allocated. */
{
- int index; /* Index for the new AuxData structure. */
+ size_t index; /* Index for the new AuxData structure. */
AuxData *auxDataPtr;
/* Points to the new AuxData structure */
@@ -3742,7 +3742,7 @@ TclCreateAuxData(
*/
size_t currBytes = envPtr->auxDataArrayNext * sizeof(AuxData);
- int newElems = 2*envPtr->auxDataArrayEnd;
+ size_t newElems = 2*envPtr->auxDataArrayEnd;
size_t newBytes = newElems * sizeof(AuxData);
if (envPtr->mallocedAuxDataArray) {
@@ -4402,10 +4402,10 @@ EncodeCmdLocMap(
* is to be stored. */
{
CmdLocation *mapPtr = envPtr->cmdMapPtr;
- int numCmds = envPtr->numCommands;
+ size_t i, codeDelta, codeLen, srcLen, prevOffset;
+ size_t numCmds = envPtr->numCommands;
unsigned char *p = startPtr;
- int codeDelta, codeLen, srcDelta, srcLen, prevOffset;
- int i;
+ int srcDelta;
/*
* Encode the code offset for each command as a sequence of deltas.
@@ -4415,7 +4415,7 @@ EncodeCmdLocMap(
prevOffset = 0;
for (i = 0; i < numCmds; i++) {
codeDelta = mapPtr[i].codeOffset - prevOffset;
- if (codeDelta < 0) {
+ if (codeDelta == TCL_INDEX_NONE) {
Tcl_Panic("EncodeCmdLocMap: bad code offset");
} else if (codeDelta <= 127) {
TclStoreInt1AtPtr(codeDelta, p);
@@ -4436,7 +4436,7 @@ EncodeCmdLocMap(
codePtr->codeLengthStart = p;
for (i = 0; i < numCmds; i++) {
codeLen = mapPtr[i].numCodeBytes;
- if (codeLen < 0) {
+ if (codeLen == TCL_INDEX_NONE) {
Tcl_Panic("EncodeCmdLocMap: bad code length");
} else if (codeLen <= 127) {
TclStoreInt1AtPtr(codeLen, p);
@@ -4476,7 +4476,7 @@ EncodeCmdLocMap(
codePtr->srcLengthStart = p;
for (i = 0; i < numCmds; i++) {
srcLen = mapPtr[i].numSrcBytes;
- if (srcLen < 0) {
+ if (srcLen == TCL_INDEX_NONE) {
Tcl_Panic("EncodeCmdLocMap: bad source length");
} else if (srcLen <= 127) {
TclStoreInt1AtPtr(srcLen, p);
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index 62b6416..6a719ea 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -163,10 +163,10 @@ typedef struct ExceptionAux {
*/
typedef struct {
- int codeOffset; /* Offset of first byte of command code. */
- int numCodeBytes; /* Number of bytes for command's code. */
- int srcOffset; /* Offset of first char of the command. */
- int numSrcBytes; /* Number of command source chars. */
+ size_t codeOffset; /* Offset of first byte of command code. */
+ size_t numCodeBytes; /* Number of bytes for command's code. */
+ size_t srcOffset; /* Offset of first char of the command. */
+ size_t numSrcBytes; /* Number of command source chars. */
} CmdLocation;
/*
@@ -347,7 +347,7 @@ typedef struct CompileEnv {
* numCommands is the index of the next entry
* to use; (numCommands-1) is the entry index
* for the last command. */
- int cmdMapEnd; /* Index after last CmdLocation entry. */
+ size_t cmdMapEnd; /* Index after last CmdLocation entry. */
int mallocedCmdMap; /* 1 if command map array was expanded and
* cmdMapPtr points in the heap, else 0. */
#if TCL_MAJOR_VERSION > 8
@@ -359,7 +359,7 @@ typedef struct CompileEnv {
* auxDataArrayNext is the number of aux data
* items and (auxDataArrayNext-1) is index of
* current aux data array entry. */
- int auxDataArrayEnd; /* Index after last aux data array entry. */
+ size_t auxDataArrayEnd; /* Index after last aux data array entry. */
#if TCL_MAJOR_VERSION < 9
int mallocedAuxDataArray;
#endif
@@ -1106,7 +1106,7 @@ MODULE_SCOPE void TclCompileTokens(Tcl_Interp *interp,
CompileEnv *envPtr);
MODULE_SCOPE void TclCompileVarSubst(Tcl_Interp *interp,
Tcl_Token *tokenPtr, CompileEnv *envPtr);
-MODULE_SCOPE int TclCreateAuxData(void *clientData,
+MODULE_SCOPE size_t TclCreateAuxData(void *clientData,
const AuxDataType *typePtr, CompileEnv *envPtr);
MODULE_SCOPE int TclCreateExceptRange(ExceptionRangeType type,
CompileEnv *envPtr);
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c
index 469089a..ec0836a 100644
--- a/generic/tclDisassemble.c
+++ b/generic/tclDisassemble.c
@@ -56,7 +56,7 @@ static const Tcl_ObjType instNameType = {
const Tcl_ObjInternalRep *irPtr; \
irPtr = TclFetchInternalRep((objPtr), &instNameType); \
assert(irPtr != NULL); \
- (inst) = (size_t)irPtr->wideValue; \
+ (inst) = irPtr->wideValue; \
} while (0)
@@ -833,7 +833,7 @@ UpdateStringOfInstName(
if (inst > LAST_INST_OPCODE) {
dst = Tcl_InitStringRep(objPtr, NULL, TCL_INTEGER_SPACE + 5);
- TclOOM(dst, (size_t)TCL_INTEGER_SPACE + 5);
+ TclOOM(dst, TCL_INTEGER_SPACE + 5);
sprintf(dst, "inst_%" TCL_Z_MODIFIER "u", inst);
(void) Tcl_InitStringRep(objPtr, NULL, strlen(dst));
} else {
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index f3d15f3..5fdf7f4 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -3384,8 +3384,8 @@ CompileToInvokedCommand(
Tcl_Token *tokPtr;
Tcl_Obj *objPtr, **words;
const char *bytes;
- int i, cmdLit, extraLiteralFlags = LITERAL_CMD_NAME;
- size_t numWords, length;
+ int cmdLit, extraLiteralFlags = LITERAL_CMD_NAME;
+ size_t i, numWords, length;
/*
* Push the words of the command. Take care; the command words may be
@@ -3394,9 +3394,9 @@ CompileToInvokedCommand(
*/
TclListObjGetElements(NULL, replacements, &numWords, &words);
- for (i = 0, tokPtr = parsePtr->tokenPtr; i < (int)parsePtr->numWords;
+ for (i = 0, tokPtr = parsePtr->tokenPtr; i < parsePtr->numWords;
i++, tokPtr = TokenAfter(tokPtr)) {
- if (i > 0 && (size_t)i <= numWords) {
+ if (i > 0 && i <= numWords) {
bytes = Tcl_GetStringFromObj(words[i-1], &length);
PushLiteral(envPtr, bytes, length);
continue;
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index dc02cff..19cf65f 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -6245,7 +6245,7 @@ TEBCresume(
numVars = varListPtr->numVars;
listPtr = OBJ_AT_DEPTH(listTmpDepth);
if (TclListObjLength(interp, listPtr, &listLen) != TCL_OK) {
- TRACE_APPEND(("ERROR converting list %ld, \"%s\": %s",
+ TRACE_APPEND(("ERROR converting list %" TCL_Z_MODIFIER "d, \"%s\": %s",
i, O2S(listPtr), O2S(Tcl_GetObjResult(interp))));
goto gotError;
}
@@ -8686,8 +8686,8 @@ PrintByteCodeInfo(
codePtr->numCodeBytes, codePtr->numLitObjects,
codePtr->numAuxDataItems, codePtr->maxStackDepth,
#ifdef TCL_COMPILE_STATS
- (int)codePtr->numSrcBytes?
- ((float)codePtr->structureSize)/(int)codePtr->numSrcBytes :
+ codePtr->numSrcBytes?
+ ((float)codePtr->structureSize)/codePtr->numSrcBytes :
#endif
0.0);
@@ -9580,7 +9580,7 @@ EvalStatsCmd(
break;
}
}
- for (i = 31; i != (size_t)-1; i--) {
+ for (i = 31; i != TCL_INDEX_NONE; i--) {
if (statsPtr->srcCount[i] > 0) {
break; /* maxSizeDecade to consume 'i' value
* below... */
@@ -9604,7 +9604,7 @@ EvalStatsCmd(
break;
}
}
- for (i = 31; i != (size_t)-1; i--) {
+ for (i = 31; i != TCL_INDEX_NONE; i--) {
if (statsPtr->byteCodeCount[i] > 0) {
break; /* maxSizeDecade to consume 'i' value
* below... */
@@ -9628,7 +9628,7 @@ EvalStatsCmd(
break;
}
}
- for (i = 31; i != (size_t)-1; i--) {
+ for (i = 31; i != TCL_INDEX_NONE; i--) {
if (statsPtr->lifetimeCount[i] > 0) {
break; /* maxSizeDecade to consume 'i' value
* below... */
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 10d5913..2550493 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -115,21 +115,24 @@ typedef int ptrdiff_t;
* to/from pointer from/to integer of different size".
*/
-#if !defined(INT2PTR) && !defined(PTR2INT)
+#if !defined(INT2PTR)
# if defined(HAVE_INTPTR_T) || defined(intptr_t)
# define INT2PTR(p) ((void *)(intptr_t)(p))
-# define PTR2INT(p) ((intptr_t)(p))
# else
# define INT2PTR(p) ((void *)(p))
+# endif
+#endif
+#if !defined(PTR2INT)
+# if defined(HAVE_INTPTR_T) || defined(intptr_t)
+# define PTR2INT(p) ((intptr_t)(p))
+# else
# define PTR2INT(p) ((long)(p))
# endif
#endif
-#if !defined(UINT2PTR) && !defined(PTR2UINT)
+#if !defined(PTR2UINT)
# if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
-# define UINT2PTR(p) ((void *)(uintptr_t)(p))
# define PTR2UINT(p) ((uintptr_t)(p))
# else
-# define UINT2PTR(p) ((void *)(p))
# define PTR2UINT(p) ((unsigned long)(p))
# endif
#endif
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 8c81568..a698d6f 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -831,8 +831,6 @@ TclJoinPath(
size_t i;
const Tcl_Filesystem *fsPtr = NULL;
- assert ( elements >= 0 );
-
if (elements == 0) {
TclNewObj(res);
return res;
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c
index 5b13dd9..aac47bb 100644
--- a/generic/tclRegexp.c
+++ b/generic/tclRegexp.c
@@ -918,8 +918,8 @@ CompileRegexp(
regexpPtr = (TclRegexp*)Tcl_Alloc(sizeof(TclRegexp));
regexpPtr->objPtr = NULL;
regexpPtr->string = NULL;
- regexpPtr->details.rm_extend.rm_so = -1;
- regexpPtr->details.rm_extend.rm_eo = -1;
+ regexpPtr->details.rm_extend.rm_so = TCL_INDEX_NONE;
+ regexpPtr->details.rm_extend.rm_eo = TCL_INDEX_NONE;
/*
* Get the up-to-date string representation and map to unicode.
diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c
index f440ec0..cfc7ceb 100644
--- a/generic/tclThreadTest.c
+++ b/generic/tclThreadTest.c
@@ -271,7 +271,7 @@ ThreadObjCmd(
} else {
result = NULL;
}
- return ThreadCancel(interp, (Tcl_ThreadId) (size_t) id, result, flags);
+ return ThreadCancel(interp, (Tcl_ThreadId) INT2PTR(id), result, flags);
}
case THREAD_CREATE: {
const char *script;
@@ -335,11 +335,11 @@ ThreadObjCmd(
*/
if (objc == 2) {
- idObj = Tcl_NewWideIntObj((Tcl_WideInt)(size_t)Tcl_GetCurrentThread());
+ idObj = Tcl_NewWideIntObj((Tcl_WideInt)INT2PTR(Tcl_GetCurrentThread()));
} else if (objc == 3
&& strcmp("-main", Tcl_GetString(objv[2])) == 0) {
Tcl_MutexLock(&threadMutex);
- idObj = Tcl_NewWideIntObj((Tcl_WideInt)(size_t)mainThreadId);
+ idObj = Tcl_NewWideIntObj((Tcl_WideInt)INT2PTR(mainThreadId));
Tcl_MutexUnlock(&threadMutex);
} else {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
@@ -364,7 +364,7 @@ ThreadObjCmd(
return TCL_ERROR;
}
- result = Tcl_JoinThread((Tcl_ThreadId)(size_t)id, &status);
+ result = Tcl_JoinThread((Tcl_ThreadId)INT2PTR(id), &status);
if (result == TCL_OK) {
Tcl_SetIntObj(Tcl_GetObjResult(interp), status);
} else {
@@ -406,7 +406,7 @@ ThreadObjCmd(
}
arg++;
script = Tcl_GetString(objv[arg]);
- return ThreadSend(interp, (Tcl_ThreadId)(size_t)id, script, wait);
+ return ThreadSend(interp, (Tcl_ThreadId)INT2PTR(id), script, wait);
}
case THREAD_EVENT: {
if (objc > 2) {
diff --git a/generic/tclVar.c b/generic/tclVar.c
index e403148..2c53bcd 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -268,7 +268,7 @@ static const Tcl_ObjType localVarNameType = {
const Tcl_ObjInternalRep *irPtr; \
irPtr = TclFetchInternalRep((objPtr), &localVarNameType); \
(name) = irPtr ? (Tcl_Obj *)irPtr->twoPtrValue.ptr1 : NULL; \
- (index) = irPtr ? PTR2INT(irPtr->twoPtrValue.ptr2) : -1; \
+ (index) = irPtr ? PTR2UINT(irPtr->twoPtrValue.ptr2) : TCL_INDEX_NONE; \
} while (0)
static const Tcl_ObjType parsedVarNameType = {
@@ -609,17 +609,17 @@ TclObjLookupVarEx(
const char *errMsg = NULL;
int index, parsed = 0;
- int localIndex;
+ size_t localIndex;
Tcl_Obj *namePtr, *arrayPtr, *elem;
*arrayPtrPtr = NULL;
restart:
LocalGetInternalRep(part1Ptr, localIndex, namePtr);
- if (localIndex >= 0) {
+ if (localIndex != TCL_INDEX_NONE) {
if (HasLocalVars(varFramePtr)
&& !(flags & (TCL_GLOBAL_ONLY | TCL_NAMESPACE_ONLY))
- && (localIndex < (int)varFramePtr->numCompiledLocals)) {
+ && (localIndex < varFramePtr->numCompiledLocals)) {
/*
* Use the cached index if the names coincide.
*/
@@ -5587,7 +5587,7 @@ static void
FreeLocalVarName(
Tcl_Obj *objPtr)
{
- int index;
+ size_t index;
Tcl_Obj *namePtr;
LocalGetInternalRep(objPtr, index, namePtr);
@@ -5603,7 +5603,7 @@ DupLocalVarName(
Tcl_Obj *srcPtr,
Tcl_Obj *dupPtr)
{
- int index;
+ size_t index;
Tcl_Obj *namePtr;
LocalGetInternalRep(srcPtr, index, namePtr);