Compare commits

...
67 changed files with 590 additions and 548 deletions
+25
View File
@@ -313,8 +313,17 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
#if TCL_MAJOR_VERSION < 9
typedef int Tcl_Size;
#define TCL_SIZE_ISNEG(index) ((index) < 0)
#elif !defined(TCL_UNSIGNED_SIZE) && !defined(BUILD_tcl)
typedef ptrdiff_t Tcl_Size;
#define TCL_SIZE_ISNEG(index) (((index) == TCL_INDEX_NONE) \
|| ((sizeof(int) != sizeof(size_t)) && ((ptrdiff_t)(index) < 0) \
&& (Tcl_Panic("Tcl_Size overflow %s:%d", __FILE__, __LINE__), 1)))
#else
typedef size_t Tcl_Size;
#define TCL_SIZE_ISNEG(index) (((index) == TCL_INDEX_NONE) \
|| ((sizeof(int) != sizeof(size_t)) && ((ptrdiff_t)(index) < 0) \
&& (Tcl_Panic("Tcl_Size overflow %s:%d", __FILE__, __LINE__), 1)))
#endif
#ifdef _WIN32
@@ -554,9 +563,15 @@ typedef void (Tcl_CmdTraceProc) (void *clientData, Tcl_Interp *interp,
typedef int (Tcl_CmdObjTraceProc) (void *clientData, Tcl_Interp *interp,
int level, const char *command, Tcl_Command commandInfo, int objc,
struct Tcl_Obj *const *objv);
#if !defined(TCL_UNSIGNED_SIZE) && !defined(BUILD_tcl)
typedef int (Tcl_CmdObjTraceProc2) (void *clientData, Tcl_Interp *interp,
ptrdiff_t level, const char *command, Tcl_Command commandInfo, ptrdiff_t objc,
struct Tcl_Obj *const *objv);
#else
typedef int (Tcl_CmdObjTraceProc2) (void *clientData, Tcl_Interp *interp,
size_t level, const char *command, Tcl_Command commandInfo, size_t objc,
struct Tcl_Obj *const *objv);
#endif
typedef void (Tcl_CmdObjTraceDeleteProc) (void *clientData);
typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
struct Tcl_Obj *dupPtr);
@@ -579,8 +594,13 @@ typedef void (Tcl_InterpDeleteProc) (void *clientData,
typedef void (Tcl_NamespaceDeleteProc) (void *clientData);
typedef int (Tcl_ObjCmdProc) (void *clientData, Tcl_Interp *interp,
int objc, struct Tcl_Obj *const *objv);
#if !defined(TCL_UNSIGNED_SIZE) && !defined(BUILD_tcl)
typedef int (Tcl_ObjCmdProc2) (void *clientData, Tcl_Interp *interp,
ptrdiff_t objc, struct Tcl_Obj *const *objv);
#else
typedef int (Tcl_ObjCmdProc2) (void *clientData, Tcl_Interp *interp,
size_t objc, struct Tcl_Obj *const *objv);
#endif
typedef int (Tcl_LibraryInitProc) (Tcl_Interp *interp);
typedef int (Tcl_LibraryUnloadProc) (Tcl_Interp *interp, int flags);
typedef void (Tcl_PanicProc) (const char *format, ...);
@@ -2320,9 +2340,14 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
# define Tcl_FindExecutable(arg) ((Tcl_FindExecutable)((const char *)(arg)))
#endif
# define Tcl_MainEx Tcl_MainExW
#if !defined(TCL_UNSIGNED_SIZE) && !defined(BUILD_tcl)
EXTERN TCL_NORETURN void Tcl_MainExW(ptrdiff_t argc, wchar_t **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
#else
EXTERN TCL_NORETURN void Tcl_MainExW(size_t argc, wchar_t **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
#endif
#endif
#if defined(USE_TCL_STUBS) && (TCL_MAJOR_VERSION > 8)
#define Tcl_SetPanicProc(panicProc) \
TclInitStubTable(((const char *(*)(Tcl_PanicProc *))TclStubCall((void *)panicProc))(panicProc))
+2 -2
View File
@@ -251,7 +251,7 @@ TclFinalizeAllocSubsystem(void)
void *
TclpAlloc(
size_t numBytes) /* Number of bytes to allocate. */
TCL_HASH_TYPE numBytes) /* Number of bytes to allocate. */
{
union overhead *overPtr;
size_t bucket;
@@ -694,7 +694,7 @@ mstats(
#undef TclpAlloc
void *
TclpAlloc(
size_t numBytes) /* Number of bytes to allocate. */
TCL_HASH_TYPE numBytes) /* Number of bytes to allocate. */
{
return malloc(numBytes);
}
+3 -3
View File
@@ -43,7 +43,7 @@ static void FreeArithSeriesInternalRep (Tcl_Obj *listPtr);
static int SetArithSeriesFromAny (Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfArithSeries (Tcl_Obj *arithSeriesObj);
static Tcl_Obj *ArithSeriesObjStep(Tcl_Obj *arithSeriesPtr);
static Tcl_Size ArithSeriesObjLength(Tcl_Obj *arithSeriesPtr);
static size_t ArithSeriesObjLength(Tcl_Obj *arithSeriesPtr);
/*
* The structure below defines the arithmetic series Tcl object type by
@@ -474,7 +474,7 @@ TclArithSeriesObjIndex(
*
*----------------------------------------------------------------------
*/
Tcl_Size ArithSeriesObjLength(Tcl_Obj *arithSeriesObj)
size_t ArithSeriesObjLength(Tcl_Obj *arithSeriesObj)
{
ArithSeries *arithSeriesRepPtr = (ArithSeries*)
arithSeriesObj->internalRep.twoPtrValue.ptr1;
@@ -730,7 +730,7 @@ TclArithSeriesObjRange(
ArithSeriesGetInternalRep(arithSeriesObj, arithSeriesRepPtr);
if (fromIdx == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(fromIdx)) {
fromIdx = 0;
}
if (fromIdx > toIdx) {
+9 -9
View File
@@ -1367,7 +1367,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInstInt1(assemEnvPtr, tblIdx, opnd, 0);
@@ -1427,7 +1427,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, opnd+1);
@@ -1444,7 +1444,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, opnd);
@@ -1639,7 +1639,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInst1or4(assemEnvPtr, tblIdx, localVar, 0);
@@ -1651,7 +1651,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE || CheckOneByte(interp, localVar)) {
if (TCL_SIZE_ISNEG(localVar) || CheckOneByte(interp, localVar)) {
goto cleanup;
}
BBEmitInstInt1(assemEnvPtr, tblIdx, localVar, 0);
@@ -1663,7 +1663,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE || CheckOneByte(interp, localVar)
if (TCL_SIZE_ISNEG(localVar) || CheckOneByte(interp, localVar)
|| GetIntegerOperand(assemEnvPtr, &tokenPtr, &opnd) != TCL_OK
|| CheckSignedOneByte(interp, opnd)) {
goto cleanup;
@@ -1678,7 +1678,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, localVar, 0);
@@ -1742,7 +1742,7 @@ AssembleOneLine(
goto cleanup;
}
localVar = FindLocalVar(assemEnvPtr, &tokenPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, 0);
@@ -2326,7 +2326,7 @@ FindLocalVar(
}
localVar = TclFindCompiledLocal(varNameStr, varNameLen, 1, envPtr);
Tcl_DecrRefCount(varNameObj);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot use this instruction to create a variable"
+16 -16
View File
@@ -613,7 +613,7 @@ static int
buildInfoObjCmd2(
void *clientData,
Tcl_Interp *interp, /* Current interpreter. */
size_t objc, /* Number of arguments. */
Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
if (objc - 1 > 1) {
@@ -3291,7 +3291,7 @@ static int
invokeObj2Command(
void *clientData, /* Points to command's Command structure. */
Tcl_Interp *interp, /* Current interpreter. */
size_t objc, /* Number of arguments. */
Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int result;
@@ -3311,7 +3311,7 @@ invokeObj2Command(
static int cmdWrapper2Proc(void *clientData,
Tcl_Interp *interp,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[])
{
Command *cmdPtr = (Command *)clientData;
@@ -4370,7 +4370,7 @@ int
Tcl_EvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
size_t objc, /* Number of words in command. */
Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags) /* Collection of OR-ed bits that control the
@@ -4389,7 +4389,7 @@ int
TclNREvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
size_t objc, /* Number of words in command. */
Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags, /* Collection of OR-ed bits that control the
@@ -5089,7 +5089,7 @@ Tcl_EvalTokensStandard(
* errors. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
size_t count) /* Number of tokens to consider at tokenPtr.
Tcl_Size count) /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
{
return TclSubstTokens(interp, tokenPtr, count, /* numLeftPtr */ NULL, 1,
@@ -5122,7 +5122,7 @@ Tcl_EvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
size_t numBytes, /* Number of bytes in script. If -1, the
Tcl_Size numBytes, /* Number of bytes in script. If TCL_INDEX_NONE, the
* script consists of all bytes up to the
* first null character. */
int flags) /* Collection of OR-ed bits that control the
@@ -5137,7 +5137,7 @@ TclEvalEx(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* script. Also used for error reporting. */
const char *script, /* First character of script to evaluate. */
size_t numBytes, /* Number of bytes in script. If -1, the
size_t numBytes, /* Number of bytes in script. If TCL_INDEX_NONE, the
* script consists of all bytes up to the
* first NUL character. */
int flags, /* Collection of OR-ed bits that control the
@@ -5203,7 +5203,7 @@ TclEvalEx(
}
}
if (numBytes == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numBytes)) {
numBytes = strlen(script);
}
Tcl_ResetResult(interp);
@@ -5852,7 +5852,7 @@ TclArgumentBCEnter(
* housekeeping, and can escape now.
*/
if (ePtr->nline != (size_t)objc) {
if (ePtr->nline != (Tcl_Size)objc) {
return;
}
@@ -6911,14 +6911,14 @@ Tcl_VarEval(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_SetRecursionLimit(
Tcl_Interp *interp, /* Interpreter whose nesting limit is to be
* set. */
size_t depth) /* New value for maximimum depth. */
Tcl_Size depth) /* New value for maximimum depth. */
{
Interp *iPtr = (Interp *) interp;
size_t old;
Tcl_Size old;
old = iPtr->maxNestingDepth;
if (depth + 1 > 1) {
@@ -8474,7 +8474,7 @@ Tcl_NRCallObjProc(
Tcl_Interp *interp,
Tcl_ObjCmdProc *objProc,
void *clientData,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[])
{
NRE_callback *rootPtr = TOP_CB(interp);
@@ -8657,7 +8657,7 @@ int
Tcl_NREvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
size_t objc, /* Number of words in command. */
Tcl_Size objc, /* Number of words in command. */
Tcl_Obj *const objv[], /* An array of pointers to objects that are
* the words that make up the command. */
int flags) /* Collection of OR-ed bits that control the
@@ -8672,7 +8672,7 @@ int
Tcl_NRCmdSwap(
Tcl_Interp *interp,
Tcl_Command cmd,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[],
int flags)
{
+8 -8
View File
@@ -222,7 +222,7 @@ Tcl_Obj *
Tcl_NewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
size_t numBytes) /* Number of bytes in the array */
Tcl_Size numBytes) /* Number of bytes in the array */
{
#ifdef TCL_MEM_DEBUG
return Tcl_DbNewByteArrayObj(bytes, numBytes, "unknown", 0);
@@ -265,7 +265,7 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
size_t numBytes, /* Number of bytes in the array */
Tcl_Size numBytes, /* Number of bytes in the array */
const char *file, /* The name of the source file calling this
* procedure; used for debugging. */
int line) /* Line number in the source file; used for
@@ -282,7 +282,7 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
size_t numBytes, /* Number of bytes in the array */
Tcl_Size numBytes, /* Number of bytes in the array */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
@@ -313,7 +313,7 @@ Tcl_SetByteArrayObj(
Tcl_Obj *objPtr, /* Object to initialize as a ByteArray. */
const unsigned char *bytes, /* The array of bytes to use as the new value.
* May be NULL even if numBytes > 0. */
size_t numBytes) /* Number of bytes in the array */
Tcl_Size numBytes) /* Number of bytes in the array */
{
ByteArray *byteArrayPtr;
Tcl_ObjInternalRep ir;
@@ -431,7 +431,7 @@ TclGetBytesFromObj(
unsigned char *
Tcl_SetByteArrayLength(
Tcl_Obj *objPtr, /* The ByteArray object. */
size_t numBytes) /* Number of bytes in resized array */
Tcl_Size numBytes) /* Number of bytes in resized array */
{
ByteArray *byteArrayPtr;
Tcl_ObjInternalRep *irPtr;
@@ -494,7 +494,7 @@ MakeByteArray(
size_t length;
const char *src = Tcl_GetStringFromObj(objPtr, &length);
size_t numBytes
= (limit != TCL_INDEX_NONE && limit < length) ? limit : length;
= (!TCL_SIZE_ISNEG(limit) && limit < length) ? limit : length;
ByteArray *byteArrayPtr = (ByteArray *)Tcl_Alloc(BYTEARRAY_SIZE(numBytes));
unsigned char *dst = byteArrayPtr->bytes;
unsigned char *dstEnd = dst + numBytes;
@@ -730,7 +730,7 @@ TclAppendBytesToByteArray(
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object","TclAppendBytesToByteArray");
}
if (len == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(len)) {
Tcl_Panic("%s must be called with definite number of bytes to append",
"TclAppendBytesToByteArray");
}
@@ -988,7 +988,7 @@ BinaryFormatCmd(
} else if (count > listc) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"number of elements in list does not match count",
-1));
TCL_INDEX_NONE));
return TCL_ERROR;
}
if (TclListObjGetElementsM(interp, objv[arg], &listc,
+16 -16
View File
@@ -382,7 +382,7 @@ Tcl_DumpActiveMemory(
void *
Tcl_DbCkalloc(
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -472,7 +472,7 @@ Tcl_DbCkalloc(
void *
Tcl_AttemptDbCkalloc(
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -657,7 +657,7 @@ Tcl_DbCkfree(
void *
Tcl_DbCkrealloc(
void *ptr,
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -688,7 +688,7 @@ Tcl_DbCkrealloc(
void *
Tcl_AttemptDbCkrealloc(
void *ptr,
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -739,14 +739,14 @@ Tcl_AttemptDbCkrealloc(
void *
Tcl_Alloc(
size_t size)
TCL_HASH_TYPE size)
{
return Tcl_DbCkalloc(size, "unknown", 0);
}
void *
Tcl_AttemptAlloc(
size_t size)
TCL_HASH_TYPE size)
{
return Tcl_AttemptDbCkalloc(size, "unknown", 0);
}
@@ -761,14 +761,14 @@ Tcl_Free(
void *
Tcl_Realloc(
void *ptr,
size_t size)
TCL_HASH_TYPE size)
{
return Tcl_DbCkrealloc(ptr, size, "unknown", 0);
}
void *
Tcl_AttemptRealloc(
void *ptr,
size_t size)
TCL_HASH_TYPE size)
{
return Tcl_AttemptDbCkrealloc(ptr, size, "unknown", 0);
}
@@ -1032,7 +1032,7 @@ Tcl_InitMemory(
void *
Tcl_Alloc(
size_t size)
TCL_HASH_TYPE size)
{
void *result = TclpAlloc(size);
@@ -1054,7 +1054,7 @@ Tcl_Alloc(
void *
Tcl_DbCkalloc(
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -1081,14 +1081,14 @@ Tcl_DbCkalloc(
void *
Tcl_AttemptAlloc(
size_t size)
TCL_HASH_TYPE size)
{
return (char *)TclpAlloc(size);
}
void *
Tcl_AttemptDbCkalloc(
size_t size,
TCL_HASH_TYPE size,
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
@@ -1109,7 +1109,7 @@ Tcl_AttemptDbCkalloc(
void *
Tcl_Realloc(
void *ptr,
size_t size)
TCL_HASH_TYPE size)
{
void *result = TclpRealloc(ptr, size);
@@ -1122,7 +1122,7 @@ Tcl_Realloc(
void *
Tcl_DbCkrealloc(
void *ptr,
size_t size,
TCL_HASH_TYPE size,
const char *file,
int line)
{
@@ -1150,7 +1150,7 @@ Tcl_DbCkrealloc(
void *
Tcl_AttemptRealloc(
void *ptr,
size_t size)
TCL_HASH_TYPE size)
{
return (char *)TclpRealloc(ptr, size);
}
@@ -1158,7 +1158,7 @@ Tcl_AttemptRealloc(
void *
Tcl_AttemptDbCkrealloc(
void *ptr,
size_t size,
TCL_HASH_TYPE size,
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
+3 -5
View File
@@ -2727,7 +2727,7 @@ Tcl_LrangeObjCmd(
/* Argument objects. */
{
int result;
size_t listLen, first, last;
Tcl_Size listLen, first, last;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "list first last");
return TCL_ERROR;
@@ -3912,8 +3912,7 @@ Tcl_LsearchObjCmd(
TclNewIndexObj(itemPtr, i+groupOffset);
for (j=0 ; j<sortInfo.indexc ; j++) {
Tcl_Obj *elObj;
size_t elValue = TclIndexDecode(sortInfo.indexv[j], listc);
TclNewIndexObj(elObj, elValue);
TclNewIndexObj(elObj, TclIndexDecode(sortInfo.indexv[j], listc));
Tcl_ListObjAppendElement(interp, itemPtr, elObj);
}
Tcl_ListObjAppendElement(interp, listPtr, itemPtr);
@@ -3936,8 +3935,7 @@ Tcl_LsearchObjCmd(
TclNewIndexObj(itemPtr, index+groupOffset);
for (j=0 ; j<sortInfo.indexc ; j++) {
Tcl_Obj *elObj;
size_t elValue = TclIndexDecode(sortInfo.indexv[j], listc);
TclNewIndexObj(elObj, elValue);
TclNewIndexObj(elObj, TclIndexDecode(sortInfo.indexv[j], listc));
Tcl_ListObjAppendElement(interp, itemPtr, elObj);
}
Tcl_SetObjResult(interp, itemPtr);
+15 -15
View File
@@ -261,7 +261,7 @@ Tcl_RegexpObjCmd(
if (startIndex) {
TclGetIntForIndexM(interp, startIndex, stringLength, &offset);
Tcl_DecrRefCount(startIndex);
if (offset == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(offset)) {
offset = TCL_INDEX_START;
}
}
@@ -372,7 +372,7 @@ Tcl_RegexpObjCmd(
* area. (Scriptics Bug 4391/SF Bug #219232)
*/
if (i <= (int)info.nsubs && info.matches[i].start != TCL_INDEX_NONE) {
if (i <= (int)info.nsubs && !TCL_SIZE_ISNEG(info.matches[i].start)) {
start = offset + info.matches[i].start;
end = offset + info.matches[i].end;
@@ -585,7 +585,7 @@ Tcl_RegsubObjCmd(
TclGetIntForIndexM(interp, startIndex, stringLength, &offset);
Tcl_DecrRefCount(startIndex);
if (offset == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(offset)) {
offset = TCL_INDEX_START;
}
}
@@ -784,7 +784,7 @@ Tcl_RegsubObjCmd(
for (idx = 0 ; idx <= info.nsubs ; idx++) {
subStart = info.matches[idx].start;
subEnd = info.matches[idx].end;
if ((subStart != TCL_INDEX_NONE) && (subEnd != TCL_INDEX_NONE)) {
if (!TCL_SIZE_ISNEG(subStart) && !TCL_SIZE_ISNEG(subEnd)) {
args[idx + numParts] = Tcl_NewUnicodeObj(
wstring + offset + subStart, subEnd - subStart);
} else {
@@ -888,7 +888,7 @@ Tcl_RegsubObjCmd(
if (idx <= info.nsubs) {
subStart = info.matches[idx].start;
subEnd = info.matches[idx].end;
if ((subStart != TCL_INDEX_NONE) && (subEnd != TCL_INDEX_NONE)) {
if (!TCL_SIZE_ISNEG(subStart) && !TCL_SIZE_ISNEG(subEnd)) {
Tcl_AppendUnicodeToObj(resultPtr,
wstring + offset + subStart, subEnd - subStart);
}
@@ -1411,7 +1411,7 @@ StringIndexCmd(
return TCL_ERROR;
}
if ((index != TCL_INDEX_NONE) && (index + 1 <= end + 1)) {
if (!TCL_SIZE_ISNEG(index) && (index + 1 <= end + 1)) {
int ch = Tcl_GetUniChar(objv[1], index);
if (ch == -1) {
@@ -1481,7 +1481,7 @@ StringInsertCmd(
return TCL_ERROR;
}
if (index == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(index)) {
index = TCL_INDEX_START;
}
if (index > length) {
@@ -2307,7 +2307,7 @@ StringRangeCmd(
return TCL_ERROR;
}
if (last != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(last)) {
Tcl_SetObjResult(interp, Tcl_GetRange(objv[1], first, last));
}
return TCL_OK;
@@ -2414,7 +2414,7 @@ StringRplcCmd(
* result is the original string.
*/
if ((last == TCL_INDEX_NONE) || /* Range ends before start of string */
if (TCL_SIZE_ISNEG(last) || /* Range ends before start of string */
(first + 1 > end + 1) || /* Range begins after end of string */
(last + 1 < first + 1)) { /* Range begins after it starts */
/*
@@ -2427,7 +2427,7 @@ StringRplcCmd(
} else {
Tcl_Obj *resultPtr;
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = TCL_INDEX_START;
}
if (last + 1 > end + 1) {
@@ -2526,7 +2526,7 @@ StringStartCmd(
p = &string[index];
(void)TclUniCharToUCS4(p, &ch);
for (cur = index; cur != TCL_INDEX_NONE; cur--) {
for (cur = index; !TCL_SIZE_ISNEG(cur); cur--) {
int delta = 0;
const Tcl_UniChar *next;
@@ -2588,7 +2588,7 @@ StringEndCmd(
if (TclGetIntForIndexM(interp, objv[2], length-1, &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(index)) {
index = TCL_INDEX_START;
}
if (index + 1 <= length + 1) {
@@ -2906,7 +2906,7 @@ StringLowerCmd(
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
return TCL_ERROR;
}
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = 0;
}
last = first;
@@ -2991,7 +2991,7 @@ StringUpperCmd(
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
return TCL_ERROR;
}
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = TCL_INDEX_START;
}
last = first;
@@ -3076,7 +3076,7 @@ StringTitleCmd(
if (TclGetIntForIndexM(interp,objv[2],length1, &first) != TCL_OK) {
return TCL_ERROR;
}
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = TCL_INDEX_START;
}
last = first;
+22 -22
View File
@@ -287,7 +287,7 @@ TclCompileArraySetCmd(
Tcl_Token *varTokenPtr, *dataTokenPtr;
int isScalar, localIndex, code = TCL_OK;
int isDataLiteral, isDataValid, isDataEven;
size_t len;
Tcl_Size len;
int keyVar, valVar, infoIndex;
int fwd, offsetBack, offsetFwd;
Tcl_Obj *literalObj;
@@ -393,7 +393,7 @@ TclCompileArraySetCmd(
infoPtr = (ForeachInfo *)Tcl_Alloc(offsetof(ForeachInfo, varLists) + sizeof(ForeachVarList *));
infoPtr->numLists = 1;
infoPtr->varLists[0] = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes) + 2 * sizeof(size_t));
infoPtr->varLists[0] = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes) + 2 * sizeof(Tcl_Size));
infoPtr->varLists[0]->numVars = 2;
infoPtr->varLists[0]->varIndexes[0] = keyVar;
infoPtr->varLists[0]->varIndexes[1] = valVar;
@@ -891,7 +891,7 @@ TclCompileConcatCmd(
if (listObj != NULL) {
Tcl_Obj **objs;
const char *bytes;
size_t len, slen;
Tcl_Size len, slen;
TclListObjGetElementsM(NULL, listObj, &len, &objs);
objPtr = Tcl_ConcatObj(len, objs);
@@ -1078,7 +1078,7 @@ TclCompileDictIncrCmd(
if (parsePtr->numWords == 4) {
const char *word;
size_t numBytes;
Tcl_Size numBytes;
int code;
Tcl_Token *incrTokenPtr;
Tcl_Obj *intObj;
@@ -1293,7 +1293,7 @@ TclCompileDictCreateCmd(
Tcl_Obj *keyObj, *valueObj, *dictObj;
const char *bytes;
int i;
size_t len;
Tcl_Size len;
if ((parsePtr->numWords & 1) == 0) {
return TCL_ERROR;
@@ -1528,7 +1528,7 @@ CompileDictEachCmd(
Tcl_Token *varsTokenPtr, *dictTokenPtr, *bodyTokenPtr;
int keyVarIndex, valueVarIndex, nameChars, loopRange, catchRange;
int infoIndex, jumpDisplacement, bodyTargetOffset, emptyTargetOffset;
size_t numVars;
Tcl_Size numVars;
int endTargetOffset;
int collectVar = -1; /* Index of temp var holding the result
* dict. */
@@ -2293,10 +2293,10 @@ PrintDictUpdateInfo(
void *clientData,
Tcl_Obj *appendObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
size_t i;
Tcl_Size i;
for (i=0 ; i<duiPtr->length ; i++) {
if (i) {
@@ -2311,10 +2311,10 @@ DisassembleDictUpdateInfo(
void *clientData,
Tcl_Obj *dictObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
size_t i;
Tcl_Size i;
Tcl_Obj *variables;
TclNewObj(variables);
@@ -2690,7 +2690,7 @@ CompileEachloopCmd(
Tcl_Token *tokenPtr, *bodyTokenPtr;
int jumpBackOffset, infoIndex, range;
int numWords, numLists, i, code = TCL_OK;
size_t j;
Tcl_Size j;
Tcl_Obj *varListObj = NULL;
/*
@@ -2742,7 +2742,7 @@ CompileEachloopCmd(
i < numWords-1;
i++, tokenPtr = TokenAfter(tokenPtr)) {
ForeachVarList *varListPtr;
size_t numVars;
Tcl_Size numVars;
if (i%2 != 1) {
continue;
@@ -2762,7 +2762,7 @@ CompileEachloopCmd(
}
varListPtr = (ForeachVarList *)Tcl_Alloc(offsetof(ForeachVarList, varIndexes)
+ numVars * sizeof(size_t));
+ numVars * sizeof(Tcl_Size));
varListPtr->numVars = numVars;
infoPtr->varLists[i/2] = varListPtr;
infoPtr->numLists++;
@@ -2771,7 +2771,7 @@ CompileEachloopCmd(
Tcl_Obj *varNameObj;
const char *bytes;
int varIndex;
size_t length;
Tcl_Size length;
Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj);
@@ -2976,11 +2976,11 @@ PrintForeachInfo(
void *clientData,
Tcl_Obj *appendObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
size_t i, j;
Tcl_Size i, j;
Tcl_AppendToObj(appendObj, "data=[", TCL_INDEX_NONE);
@@ -3016,11 +3016,11 @@ PrintNewForeachInfo(
void *clientData,
Tcl_Obj *appendObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
size_t i, j;
Tcl_Size i, j;
Tcl_AppendPrintfToObj(appendObj, "jumpOffset=%+" TCL_Z_MODIFIER "d, vars=",
infoPtr->loopCtTemp);
@@ -3046,11 +3046,11 @@ DisassembleForeachInfo(
void *clientData,
Tcl_Obj *dictObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
size_t i, j;
Tcl_Size i, j;
Tcl_Obj *objPtr, *innerPtr;
/*
@@ -3093,11 +3093,11 @@ DisassembleNewForeachInfo(
void *clientData,
Tcl_Obj *dictObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
size_t i, j;
Tcl_Size i, j;
Tcl_Obj *objPtr, *innerPtr;
/*
+1 -1
View File
@@ -2378,7 +2378,7 @@ TclCompileReturnCmd(
ExceptionRange range = envPtr->exceptArrayPtr[index];
if ((range.type == CATCH_EXCEPTION_RANGE)
&& (range.catchOffset == TCL_INDEX_NONE)) {
&& TCL_SIZE_ISNEG(range.catchOffset)) {
enclosingCatch = 1;
break;
}
+20 -20
View File
@@ -921,7 +921,7 @@ TclCompileStringMapCmd(
Tcl_Token *mapTokenPtr, *stringTokenPtr;
Tcl_Obj *mapObj, **objv;
const char *bytes;
size_t len, slen;
Tcl_Size len, slen;
/*
* We only handle the case:
@@ -1524,7 +1524,7 @@ TclSubstCompile(
{
Tcl_Token *endTokenPtr, *tokenPtr;
int breakOffset = 0, count = 0;
size_t bline = line;
Tcl_Size bline = line;
Tcl_Parse parse;
Tcl_InterpState state = NULL;
@@ -1549,7 +1549,7 @@ TclSubstCompile(
for (endTokenPtr = tokenPtr + parse.numTokens;
tokenPtr < endTokenPtr; tokenPtr = TokenAfter(tokenPtr)) {
size_t length;
Tcl_Size length;
int literal, catchRange, breakJump;
char buf[4] = "";
JumpFixup startFixup, okFixup, returnFixup, breakFixup;
@@ -1581,7 +1581,7 @@ TclSubstCompile(
*/
if (tokenPtr->numComponents > 1) {
size_t i;
Tcl_Size i;
int foundCommand = 0;
for (i=2 ; i<=tokenPtr->numComponents ; i++) {
@@ -1945,8 +1945,8 @@ TclCompileSwitchCmd(
if (numWords == 1) {
const char *bytes;
size_t maxLen, numBytes;
size_t bline; /* TIP #280: line of the pattern/action list,
Tcl_Size maxLen, numBytes;
Tcl_Size bline; /* TIP #280: line of the pattern/action list,
* and start of list for when tracking the
* location. This list comes immediately after
* the value we switch on. */
@@ -2590,7 +2590,7 @@ PrintJumptableInfo(
void *clientData,
Tcl_Obj *appendObj,
TCL_UNUSED(ByteCode *),
size_t pcOffset)
TCL_HASH_TYPE pcOffset)
{
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
Tcl_HashEntry *hPtr;
@@ -2619,7 +2619,7 @@ DisassembleJumptableInfo(
void *clientData,
Tcl_Obj *dictObj,
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
TCL_UNUSED(TCL_HASH_TYPE))
{
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
Tcl_Obj *mapping;
@@ -2716,7 +2716,7 @@ TclCompileThrowCmd(
Tcl_Token *codeToken, *msgToken;
Tcl_Obj *objPtr;
int codeKnown, codeIsList, codeIsValid;
size_t len;
Tcl_Size len;
if (numWords != 3) {
return TCL_ERROR;
@@ -2857,7 +2857,7 @@ TclCompileTryCmd(
for (i=0 ; i<numHandlers ; i++) {
Tcl_Obj *tmpObj, **objv;
size_t objc;
Tcl_Size objc;
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
goto failedToCompile;
@@ -2922,7 +2922,7 @@ TclCompileTryCmd(
goto failedToCompile;
}
if (objc > 0) {
size_t len;
Tcl_Size len;
const char *varname = Tcl_GetStringFromObj(objv[0], &len);
resultVarIndices[i] = LocalScalar(varname, len, envPtr);
@@ -2934,7 +2934,7 @@ TclCompileTryCmd(
resultVarIndices[i] = -1;
}
if (objc == 2) {
size_t len;
Tcl_Size len;
const char *varname = Tcl_GetStringFromObj(objv[1], &len);
optionVarIndices[i] = LocalScalar(varname, len, envPtr);
@@ -3056,7 +3056,7 @@ IssueTryClausesInstructions(
DefineLineInformation; /* TIP #280 */
int range, resultVar, optionsVar;
int i, j, forwardsNeedFixing = 0, trapZero = 0, afterBody = 0;
size_t slen, len;
Tcl_Size slen, len;
int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource;
int *noError;
char buf[TCL_INTEGER_SPACE];
@@ -3270,7 +3270,7 @@ IssueTryClausesFinallyInstructions(
int trapZero = 0, afterBody = 0, finalOK, finalError, noFinalError;
int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource;
char buf[TCL_INTEGER_SPACE];
size_t slen, len;
Tcl_Size slen, len;
resultVar = AnonymousLocal(envPtr);
optionsVar = AnonymousLocal(envPtr);
@@ -3680,7 +3680,7 @@ TclCompileUnsetCmd(
}
if (varCount == 0) {
const char *bytes;
size_t len;
Tcl_Size len;
bytes = Tcl_GetStringFromObj(leadingWord, &len);
if (i == 1 && len == 11 && !strncmp("-nocomplain", bytes, 11)) {
@@ -4073,7 +4073,7 @@ CompileAssociativeBinaryOpCmd(
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
size_t words;
Tcl_Size words;
/* TODO: Consider support for compiling expanded args. */
for (words=1 ; words<parsePtr->numWords ; words++) {
@@ -4176,7 +4176,7 @@ CompileComparisonOpCmd(
return TCL_ERROR;
} else {
int tmpIndex = AnonymousLocal(envPtr);
size_t words;
Tcl_Size words;
tokenPtr = TokenAfter(parsePtr->tokenPtr);
CompileWord(envPtr, tokenPtr, interp, 1);
@@ -4312,7 +4312,7 @@ TclCompilePowOpCmd(
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
size_t words;
Tcl_Size words;
/*
* This one has its own implementation because the ** operator is the only
@@ -4513,7 +4513,7 @@ TclCompileMinusOpCmd(
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
size_t words;
Tcl_Size words;
/* TODO: Consider support for compiling expanded args. */
if (parsePtr->numWords == 1) {
@@ -4558,7 +4558,7 @@ TclCompileDivOpCmd(
{
DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
size_t words;
Tcl_Size words;
/* TODO: Consider support for compiling expanded args. */
if (parsePtr->numWords == 1) {
+3 -3
View File
@@ -1860,7 +1860,7 @@ int
Tcl_ParseExpr(
Tcl_Interp *interp, /* Used for error reporting. */
const char *start, /* Start of source string to parse. */
size_t numBytes, /* Number of bytes in string. If -1, the
Tcl_Size numBytes, /* Number of bytes in string. If -1, the
* string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr) /* Structure to fill with information about
@@ -1876,7 +1876,7 @@ Tcl_ParseExpr(
TclNewObj(litList);
TclNewObj(funcList);
if (numBytes == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numBytes)) {
numBytes = (start ? strlen(start) : 0);
}
@@ -2197,7 +2197,7 @@ void
TclCompileExpr(
Tcl_Interp *interp, /* Used for error reporting. */
const char *script, /* The source script to compile. */
size_t numBytes, /* Number of bytes in script. */
Tcl_Size numBytes, /* Number of bytes in script. */
CompileEnv *envPtr, /* Holds resulting instructions. */
int optimize) /* 0 for one-off expressions. */
{
+46 -46
View File
@@ -680,9 +680,9 @@ static void DupByteCodeInternalRep(Tcl_Obj *srcPtr,
static unsigned char * EncodeCmdLocMap(CompileEnv *envPtr,
ByteCode *codePtr, unsigned char *startPtr);
static void EnterCmdExtentData(CompileEnv *envPtr,
size_t cmdNumber, size_t numSrcBytes, size_t numCodeBytes);
Tcl_Size cmdNumber, Tcl_Size numSrcBytes, Tcl_Size numCodeBytes);
static void EnterCmdStartData(CompileEnv *envPtr,
size_t cmdNumber, size_t srcOffset, size_t codeOffset);
Tcl_Size cmdNumber, Tcl_Size srcOffset, Tcl_Size codeOffset);
static void FreeByteCodeInternalRep(Tcl_Obj *objPtr);
static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr);
static int GetCmdLocEncodingSize(CompileEnv *envPtr);
@@ -699,9 +699,9 @@ static void StartExpanding(CompileEnv *envPtr);
* TIP #280: Helper for building the per-word line information of all compiled
* commands.
*/
static void EnterCmdWordData(ExtCmdLoc *eclPtr, size_t srcOffset,
static void EnterCmdWordData(ExtCmdLoc *eclPtr, Tcl_Size srcOffset,
Tcl_Token *tokenPtr, const char *cmd,
size_t numWords, size_t line, int *clNext, int **lines,
Tcl_Size numWords, Tcl_Size line, int *clNext, int **lines,
CompileEnv *envPtr);
static void ReleaseCmdWordData(ExtCmdLoc *eclPtr);
@@ -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;
@@ -1391,7 +1391,7 @@ static void
ReleaseCmdWordData(
ExtCmdLoc *eclPtr)
{
size_t i;
Tcl_Size i;
if (eclPtr->type == TCL_LOCATION_SOURCE) {
Tcl_DecrRefCount(eclPtr->path);
@@ -1553,7 +1553,7 @@ TclInitCompileEnv(
pc = 1;
}
if ((ctxPtr->nline <= (size_t)word) || (ctxPtr->line[word] < 0)) {
if ((ctxPtr->nline <= (Tcl_Size)word) || (ctxPtr->line[word] < 0)) {
/*
* Word is not a literal, relative counting.
*/
@@ -1647,7 +1647,7 @@ TclFreeCompileEnv(
* have transferred to it.
*/
size_t i;
Tcl_Size i;
LiteralEntry *entryPtr = envPtr->literalArrayPtr;
AuxData *auxDataPtr = envPtr->auxDataArrayPtr;
@@ -1748,7 +1748,7 @@ TclWordKnownAtCompileTime(
case TCL_TOKEN_BS:
if (tempPtr != NULL) {
char utfBuf[4] = "";
size_t length = TclParseBackslash(tokenPtr->start,
Tcl_Size length = TclParseBackslash(tokenPtr->start,
tokenPtr->size, NULL, utfBuf);
Tcl_AppendToObj(tempPtr, utfBuf, length);
@@ -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)) {
@@ -2323,8 +2323,8 @@ TclCompileVarSubst(
CompileEnv *envPtr)
{
const char *p, *name = tokenPtr[1].start;
size_t i, nameBytes = tokenPtr[1].size;
size_t localVar;
Tcl_Size i, nameBytes = tokenPtr[1].size;
Tcl_Size localVar;
int localVarName = 1;
/*
@@ -2356,7 +2356,7 @@ TclCompileVarSubst(
if (localVarName != -1) {
localVar = TclFindCompiledLocal(name, nameBytes, localVarName, envPtr);
}
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
PushLiteral(envPtr, name, nameBytes);
}
@@ -2368,7 +2368,7 @@ TclCompileVarSubst(
tokenPtr[1].start + tokenPtr[1].size);
if (tokenPtr->numComponents == 1) {
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
TclEmitOpcode(INST_LOAD_STK, envPtr);
} else if (localVar <= 255) {
TclEmitInstInt1(INST_LOAD_SCALAR1, localVar, envPtr);
@@ -2377,7 +2377,7 @@ TclCompileVarSubst(
}
} else {
TclCompileTokens(interp, tokenPtr+2, tokenPtr->numComponents-1, envPtr);
if (localVar == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(localVar)) {
TclEmitOpcode(INST_LOAD_ARRAY_STK, envPtr);
} else if (localVar <= 255) {
TclEmitInstInt1(INST_LOAD_ARRAY1, localVar, envPtr);
@@ -2400,7 +2400,7 @@ TclCompileTokens(
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
char buffer[4] = "";
int i, numObjsToConcat, adjust;
size_t length;
Tcl_Size length;
unsigned char *entryCodeNext = envPtr->codeNext;
#define NUM_STATIC_POS 20
int isLiteral, maxNumCL, numCL;
@@ -2776,7 +2776,7 @@ PreventCycle(
Tcl_Obj *objPtr,
CompileEnv *envPtr)
{
size_t i;
Tcl_Size i;
for (i = 0; i < envPtr->literalArrayNext; i++) {
if (objPtr == TclFetchLiteral(envPtr, i)) {
@@ -2791,7 +2791,7 @@ PreventCycle(
* can be sure we do not have any lingering cycles hiding in
* the internalrep.
*/
size_t numBytes;
Tcl_Size numBytes;
const char *bytes = Tcl_GetStringFromObj(objPtr, &numBytes);
Tcl_Obj *copyPtr = Tcl_NewStringObj(bytes, numBytes);
@@ -2993,19 +2993,19 @@ TclInitByteCodeObj(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclFindCompiledLocal(
const char *name, /* Points to first character of the name of a
* scalar or array variable. If NULL, a
* temporary var should be created. */
size_t nameBytes, /* Number of bytes in the name. */
Tcl_Size nameBytes, /* Number of bytes in the name. */
int create, /* If 1, allocate a local frame entry for the
* variable if it is new. */
CompileEnv *envPtr) /* Points to the current compile environment*/
{
CompiledLocal *localPtr;
size_t localVar = TCL_INDEX_NONE;
size_t i;
Tcl_Size localVar = TCL_INDEX_NONE;
Tcl_Size i;
Proc *procPtr;
/*
@@ -3024,7 +3024,7 @@ TclFindCompiledLocal(
LocalCache *cachePtr = envPtr->iPtr->varFramePtr->localCachePtr;
const char *localName;
Tcl_Obj **varNamePtr;
size_t len;
Tcl_Size len;
if (!cachePtr || !name) {
return TCL_INDEX_NONE;
@@ -3043,7 +3043,7 @@ TclFindCompiledLocal(
}
if (name != NULL) {
size_t localCt = procPtr->numCompiledLocals;
Tcl_Size localCt = procPtr->numCompiledLocals;
localPtr = procPtr->firstLocalPtr;
for (i = 0; i < localCt; i++) {
@@ -3171,14 +3171,14 @@ EnterCmdStartData(
CompileEnv *envPtr, /* Points to the compilation environment
* structure in which to enter command
* location information. */
size_t cmdIndex, /* Index of the command whose start data is
Tcl_Size cmdIndex, /* Index of the command whose start data is
* being set. */
size_t srcOffset, /* Offset of first char of the command. */
size_t codeOffset) /* Offset of first byte of command code. */
Tcl_Size srcOffset, /* Offset of first char of the command. */
Tcl_Size codeOffset) /* Offset of first byte of command code. */
{
CmdLocation *cmdLocPtr;
if (cmdIndex >= envPtr->numCommands) {
if (TCL_SIZE_ISNEG(cmdIndex) || (cmdIndex >= envPtr->numCommands)) {
Tcl_Panic("EnterCmdStartData: bad command index %" TCL_Z_MODIFIER "u", cmdIndex);
}
@@ -3250,14 +3250,14 @@ EnterCmdExtentData(
CompileEnv *envPtr, /* Points to the compilation environment
* structure in which to enter command
* location information. */
size_t cmdIndex, /* Index of the command whose source and code
Tcl_Size cmdIndex, /* Index of the command whose source and code
* length data is being set. */
size_t numSrcBytes, /* Number of command source chars. */
size_t numCodeBytes) /* Offset of last byte of command code. */
Tcl_Size numSrcBytes, /* Number of command source chars. */
Tcl_Size numCodeBytes) /* Offset of last byte of command code. */
{
CmdLocation *cmdLocPtr;
if (cmdIndex >= envPtr->numCommands) {
if (TCL_SIZE_ISNEG(cmdIndex) || (cmdIndex >= envPtr->numCommands)) {
Tcl_Panic("EnterCmdExtentData: bad command index %" TCL_Z_MODIFIER "u", cmdIndex);
}
@@ -3296,18 +3296,18 @@ EnterCmdWordData(
ExtCmdLoc *eclPtr, /* Points to the map environment structure in
* which to enter command location
* information. */
size_t srcOffset, /* Offset of first char of the command. */
Tcl_Size srcOffset, /* Offset of first char of the command. */
Tcl_Token *tokenPtr,
const char *cmd,
size_t numWords,
size_t line,
Tcl_Size numWords,
Tcl_Size line,
int *clNext,
int **wlines,
CompileEnv *envPtr)
{
ECL *ePtr;
const char *last;
size_t wordIdx, wordLine;
Tcl_Size wordIdx, wordLine;
int *wwlines, *wordNext;
if (eclPtr->nuloc >= eclPtr->nloc) {
@@ -3373,7 +3373,7 @@ EnterCmdWordData(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclCreateExceptRange(
ExceptionRangeType type, /* The kind of ExceptionRange desired. */
CompileEnv *envPtr)/* Points to CompileEnv for which to create a
@@ -3381,7 +3381,7 @@ TclCreateExceptRange(
{
ExceptionRange *rangePtr;
ExceptionAux *auxPtr;
size_t index = envPtr->exceptArrayNext;
Tcl_Size index = envPtr->exceptArrayNext;
if (index >= envPtr->exceptArrayEnd) {
/*
@@ -3512,7 +3512,7 @@ TclAddLoopBreakFixup(
auxPtr->allocBreakTargets *= 2;
auxPtr->allocBreakTargets += 2;
if (auxPtr->breakTargets) {
auxPtr->breakTargets = (size_t *)Tcl_Realloc(auxPtr->breakTargets,
auxPtr->breakTargets = (TCL_HASH_TYPE *)Tcl_Realloc(auxPtr->breakTargets,
sizeof(size_t) * auxPtr->allocBreakTargets);
} else {
auxPtr->breakTargets =
@@ -3734,7 +3734,7 @@ TclFinalizeLoopExceptionRange(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclCreateAuxData(
void *clientData, /* The compilation auxiliary data to store in
* the new aux data record. */
@@ -3743,7 +3743,7 @@ TclCreateAuxData(
CompileEnv *envPtr)/* Points to the CompileEnv for which a new
* aux data structure is to be allocated. */
{
size_t index; /* Index for the new AuxData structure. */
Tcl_Size index; /* Index for the new AuxData structure. */
AuxData *auxDataPtr;
/* Points to the new AuxData structure */
@@ -4416,8 +4416,8 @@ EncodeCmdLocMap(
* is to be stored. */
{
CmdLocation *mapPtr = envPtr->cmdMapPtr;
size_t i, codeDelta, codeLen, srcLen, prevOffset;
size_t numCmds = envPtr->numCommands;
Tcl_Size i, codeDelta, codeLen, srcLen, prevOffset;
Tcl_Size numCmds = envPtr->numCommands;
unsigned char *p = startPtr;
int srcDelta;
@@ -4429,7 +4429,7 @@ EncodeCmdLocMap(
prevOffset = 0;
for (i = 0; i < numCmds; i++) {
codeDelta = mapPtr[i].codeOffset - prevOffset;
if (codeDelta == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(codeDelta)) {
Tcl_Panic("EncodeCmdLocMap: bad code offset");
} else if (codeDelta <= 127) {
TclStoreInt1AtPtr(codeDelta, p);
@@ -4450,7 +4450,7 @@ EncodeCmdLocMap(
codePtr->codeLengthStart = p;
for (i = 0; i < numCmds; i++) {
codeLen = mapPtr[i].numCodeBytes;
if (codeLen == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(codeLen)) {
Tcl_Panic("EncodeCmdLocMap: bad code length");
} else if (codeLen <= 127) {
TclStoreInt1AtPtr(codeLen, p);
@@ -4490,7 +4490,7 @@ EncodeCmdLocMap(
codePtr->srcLengthStart = p;
for (i = 0; i < numCmds; i++) {
srcLen = mapPtr[i].numSrcBytes;
if (srcLen == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(srcLen)) {
Tcl_Panic("EncodeCmdLocMap: bad source length");
} else if (srcLen <= 127) {
TclStoreInt1AtPtr(srcLen, p);
+1 -1
View File
@@ -4233,7 +4233,7 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_GlobalEvalObj(interp, objPtr) \
Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL)
#if defined(TCL_8_COMPAT) && !defined(BUILD_tcl) && TCL_MAJOR_VERSION > 8
#if !defined(TCL_UNSIGNED_SIZE) && !defined(BUILD_tcl) && TCL_MAJOR_VERSION > 8
# ifdef USE_TCL_STUBS
# undef Tcl_Gets
# undef Tcl_GetsObj
+4 -4
View File
@@ -779,12 +779,12 @@ Tcl_Obj *
TclTraceDictPath(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
size_t keyc,
Tcl_Size keyc,
Tcl_Obj *const keyv[],
int flags)
{
Dict *dict, *newDict;
size_t i;
Tcl_Size i;
DictGetInternalRep(dictPtr, dict);
if (dict == NULL) {
@@ -1281,7 +1281,7 @@ int
Tcl_DictObjPutKeyList(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
size_t keyc,
Tcl_Size keyc,
Tcl_Obj *const keyv[],
Tcl_Obj *valuePtr)
{
@@ -1342,7 +1342,7 @@ int
Tcl_DictObjRemoveKeyList(
Tcl_Interp *interp,
Tcl_Obj *dictPtr,
size_t keyc,
Tcl_Size keyc,
Tcl_Obj *const keyv[])
{
Dict *dict;
+5 -5
View File
@@ -498,7 +498,7 @@ FillEncodingFileMap(void)
map = Tcl_NewDictObj();
Tcl_IncrRefCount(map);
for (i = numDirs-1; i != TCL_INDEX_NONE; i--) {
for (i = numDirs-1; !TCL_SIZE_ISNEG(i); i--) {
/*
* Iterate backwards through the search path so as we overwrite
* entries found, we favor files earlier on the search path.
@@ -1248,7 +1248,7 @@ Tcl_ExternalToUtfDStringEx(
if (src == NULL) {
srcLen = 0;
} else if (srcLen == TCL_INDEX_NONE) {
} else if (TCL_SIZE_ISNEG(srcLen)) {
srcLen = encodingPtr->lengthProc(src);
}
@@ -1387,7 +1387,7 @@ Tcl_ExternalToUtf(
if (src == NULL) {
srcLen = 0;
} else if (srcLen == TCL_INDEX_NONE) {
} else if (TCL_SIZE_ISNEG(srcLen)) {
srcLen = encodingPtr->lengthProc(src);
}
if (statePtr == NULL) {
@@ -1576,7 +1576,7 @@ Tcl_UtfToExternalDStringEx(
if (src == NULL) {
srcLen = 0;
} else if (srcLen == TCL_INDEX_NONE) {
} else if (TCL_SIZE_ISNEG(srcLen)) {
srcLen = strlen(src);
}
@@ -1716,7 +1716,7 @@ Tcl_UtfToExternal(
if (src == NULL) {
srcLen = 0;
} else if (srcLen == TCL_INDEX_NONE) {
} else if (TCL_SIZE_ISNEG(srcLen)) {
srcLen = strlen(src);
}
if (statePtr == NULL) {
+34 -34
View File
@@ -106,7 +106,7 @@ static const Tcl_ObjType ensembleCmdType = {
*/
typedef struct {
size_t epoch; /* Used to confirm when the data in this
Tcl_Size epoch; /* Used to confirm when the data in this
* really structure matches up with the
* ensemble. */
Command *token; /* Reference to the command for which this
@@ -189,7 +189,7 @@ TclNamespaceEnsembleCmd(
switch (index) {
case ENS_CREATE: {
const char *name;
size_t len;
Tcl_Size len;
int allocatedMapFlag = 0;
/*
* Defaults
@@ -503,7 +503,7 @@ TclNamespaceEnsembleCmd(
Tcl_SetObjResult(interp, resultObj);
} else {
size_t len;
Tcl_Size len;
int allocatedMapFlag = 0;
Tcl_Obj *subcmdObj = NULL, *mapObj = NULL, *paramObj = NULL,
*unknownObj = NULL; /* Defaults, silence gcc 4 warnings */
@@ -803,7 +803,7 @@ Tcl_SetEnsembleSubcommandList(
return TCL_ERROR;
}
if (subcmdList != NULL) {
size_t length;
Tcl_Size length;
if (TclListObjLengthM(interp, subcmdList, &length) != TCL_OK) {
return TCL_ERROR;
@@ -870,7 +870,7 @@ Tcl_SetEnsembleParameterList(
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldList;
size_t length;
Tcl_Size length;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -955,7 +955,7 @@ Tcl_SetEnsembleMappingDict(
return TCL_ERROR;
}
if (mapDict != NULL) {
size_t size;
Tcl_Size size;
int done;
Tcl_DictSearch search;
Tcl_Obj *valuePtr;
@@ -1055,7 +1055,7 @@ Tcl_SetEnsembleUnknownHandler(
return TCL_ERROR;
}
if (unknownList != NULL) {
size_t length;
Tcl_Size length;
if (TclListObjLengthM(interp, unknownList, &length) != TCL_OK) {
return TCL_ERROR;
@@ -1539,7 +1539,7 @@ TclMakeEnsemble(
Tcl_DString buf, hiddenBuf;
const char **nameParts = NULL;
const char *cmdName = NULL;
size_t i, nameCount = 0;
Tcl_Size i, nameCount = 0;
int ensembleFlags = 0, hiddenLen;
/*
@@ -1718,7 +1718,7 @@ NsEnsembleImplementationCmdNR(
int reparseCount = 0; /* Number of reparses. */
Tcl_Obj *errorObj; /* Used for building error messages. */
Tcl_Obj *subObj;
size_t subIdx;
int subIdx;
/*
* Must recheck objc since numParameters might have changed. See test
@@ -1727,7 +1727,7 @@ NsEnsembleImplementationCmdNR(
restartEnsembleParse:
subIdx = 1 + ensemblePtr->numParameters;
if ((size_t)objc < subIdx + 1) {
if (objc < subIdx + 1) {
/*
* No subcommand argument. Make error message.
*/
@@ -1821,8 +1821,8 @@ NsEnsembleImplementationCmdNR(
* it (a non-unique prefix produces an error).
*/
char *fullName = NULL; /* Full name of the subcommand. */
size_t stringLength, i;
size_t tableLength = ensemblePtr->subcommandTable.numEntries;
Tcl_Size stringLength, i;
Tcl_Size tableLength = ensemblePtr->subcommandTable.numEntries;
Tcl_Obj *fix;
subcmdName = Tcl_GetStringFromObj(subObj, &stringLength);
@@ -1899,7 +1899,7 @@ NsEnsembleImplementationCmdNR(
Tcl_Obj *copyPtr; /* The list of words to dispatch on.
* Will be freed by the dispatch engine. */
Tcl_Obj **copyObjv;
size_t copyObjc, prefixObjc;
Tcl_Size copyObjc, prefixObjc;
TclListObjLengthM(NULL, prefixObj, &prefixObjc);
@@ -1982,7 +1982,7 @@ NsEnsembleImplementationCmdNR(
if (ensemblePtr->subcommandTable.numEntries == 1) {
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[0], TCL_INDEX_NONE);
} else {
size_t i;
Tcl_Size i;
for (i=0 ; i<ensemblePtr->subcommandTable.numEntries-1 ; i++) {
Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[i], TCL_INDEX_NONE);
@@ -2027,8 +2027,8 @@ TclClearRootEnsemble(
int
TclInitRewriteEnsemble(
Tcl_Interp *interp,
size_t numRemoved,
size_t numInserted,
Tcl_Size numRemoved,
Tcl_Size numInserted,
Tcl_Obj *const *objv)
{
Interp *iPtr = (Interp *) interp;
@@ -2040,7 +2040,7 @@ TclInitRewriteEnsemble(
iPtr->ensembleRewrite.numRemovedObjs = numRemoved;
iPtr->ensembleRewrite.numInsertedObjs = numInserted;
} else {
size_t numIns = iPtr->ensembleRewrite.numInsertedObjs;
Tcl_Size numIns = iPtr->ensembleRewrite.numInsertedObjs;
if (numIns < numRemoved) {
iPtr->ensembleRewrite.numRemovedObjs += numRemoved - numIns;
@@ -2127,8 +2127,8 @@ TclSpellFix(
Interp *iPtr = (Interp *) interp;
Tcl_Obj *const *search;
Tcl_Obj **store;
size_t idx;
size_t size;
Tcl_Size idx;
Tcl_Size size;
if (iPtr->ensembleRewrite.sourceObjs == NULL) {
iPtr->ensembleRewrite.sourceObjs = objv;
@@ -2295,9 +2295,9 @@ EnsembleUnknownCallback(
Tcl_Obj *const objv[],
Tcl_Obj **prefixObjPtr)
{
size_t paramc;
Tcl_Size paramc;
int result;
size_t i, prefixObjc;
int i, prefixObjc;
Tcl_Obj **paramv, *unknownCmd, *ensObj;
/*
@@ -2308,7 +2308,7 @@ EnsembleUnknownCallback(
TclNewObj(ensObj);
Tcl_GetCommandFullName(interp, ensemblePtr->token, ensObj);
Tcl_ListObjAppendElement(NULL, unknownCmd, ensObj);
for (i = 1 ; i < (size_t)objc ; i++) {
for (i = 1 ; i < objc ; i++) {
Tcl_ListObjAppendElement(NULL, unknownCmd, objv[i]);
}
TclListObjGetElementsM(NULL, unknownCmd, &paramc, &paramv);
@@ -2585,7 +2585,7 @@ BuildEnsembleConfig(
{
Tcl_HashSearch search; /* Used for scanning the commands in
* the namespace for this ensemble. */
size_t i, j;
Tcl_Size i, j;
int isNew;
Tcl_HashTable *hash = &ensemblePtr->subcommandTable;
Tcl_HashEntry *hPtr;
@@ -2596,7 +2596,7 @@ BuildEnsembleConfig(
Tcl_InitHashTable(hash, TCL_STRING_KEYS);
if (subList) {
size_t subc;
Tcl_Size subc;
Tcl_Obj **subv, *target, *cmdObj, *cmdPrefixObj;
const char *name;
@@ -2928,7 +2928,7 @@ TclCompileEnsemble(
Command *oldCmdPtr = cmdPtr, *newCmdPtr;
int result, flags = 0, depth = 1, invokeAnyway = 0;
int ourResult = TCL_ERROR;
size_t i, len, numBytes;
Tcl_Size i, len, numBytes;
const char *word;
TclNewObj(replaced);
@@ -2998,7 +2998,7 @@ TclCompileEnsemble(
(void) Tcl_GetEnsembleSubcommandList(NULL, ensemble, &listObj);
if (listObj != NULL) {
size_t sclen;
Tcl_Size sclen;
const char *str;
Tcl_Obj *matchObj = NULL;
@@ -3255,20 +3255,20 @@ int
TclAttemptCompileProc(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
size_t depth,
Tcl_Size depth,
Command *cmdPtr,
CompileEnv *envPtr) /* Holds resulting instructions. */
{
DefineLineInformation;
int result;
size_t i;
Tcl_Size i;
Tcl_Token *saveTokenPtr = parsePtr->tokenPtr;
size_t savedStackDepth = envPtr->currStackDepth;
unsigned savedCodeNext = envPtr->codeNext - envPtr->codeStart;
size_t savedAuxDataArrayNext = envPtr->auxDataArrayNext;
size_t savedExceptArrayNext = envPtr->exceptArrayNext;
Tcl_Size savedStackDepth = envPtr->currStackDepth;
TCL_HASH_TYPE savedCodeNext = envPtr->codeNext - envPtr->codeStart;
Tcl_Size savedAuxDataArrayNext = envPtr->auxDataArrayNext;
Tcl_Size savedExceptArrayNext = envPtr->exceptArrayNext;
#ifdef TCL_COMPILE_DEBUG
size_t savedExceptDepth = envPtr->exceptDepth;
Tcl_Size savedExceptDepth = envPtr->exceptDepth;
#endif
if (cmdPtr->compileProc == NULL) {
@@ -3398,7 +3398,7 @@ CompileToInvokedCommand(
Tcl_Obj *objPtr, **words;
const char *bytes;
int cmdLit, extraLiteralFlags = LITERAL_CMD_NAME;
size_t i, numWords, length;
Tcl_Size i, numWords, length;
/*
* Push the words of the command. Take care; the command words may be
+4 -4
View File
@@ -267,7 +267,7 @@ TclSetEnv(
Tcl_MutexLock(&envMutex);
index = TclpFindVariable(name, &length);
if (index == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(index)) {
#ifndef USE_PUTENV
/*
* We need to handle the case where the environment may be changed
@@ -351,7 +351,7 @@ TclSetEnv(
* string in the cache.
*/
if ((index != TCL_INDEX_NONE) && (tenviron[index] == (techar *)p)) {
if (!TCL_SIZE_ISNEG(index) && (tenviron[index] == (techar *)p)) {
ReplaceString(oldValue, p);
#ifdef HAVE_PUTENV_THAT_COPIES
} else {
@@ -469,7 +469,7 @@ TclUnsetEnv(
* needless work and to avoid recursion on the unset.
*/
if (index == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(index)) {
Tcl_MutexUnlock(&envMutex);
return;
}
@@ -574,7 +574,7 @@ TclGetEnv(
Tcl_MutexLock(&envMutex);
index = TclpFindVariable(name, &length);
result = NULL;
if (index != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(index)) {
Tcl_DString envStr;
result = tenviron2utfdstr(tenviron[index], -1, &envStr);
+3 -3
View File
@@ -224,7 +224,7 @@ HandleBgErrors(
Tcl_Preserve(interp);
while (assocPtr->firstBgPtr != NULL) {
int code;
size_t prefixObjc;
Tcl_Size prefixObjc;
Tcl_Obj **prefixObjv, **tempObjv;
/*
@@ -2047,8 +2047,8 @@ int
Tcl_CreateThread(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
void *clientData, /* The one argument to Main() */
size_t stackSize, /* Size of stack for the new thread */
void *clientData, /* The one argument to Main() */
Tcl_Size stackSize, /* Size of stack for the new thread */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
+11 -11
View File
@@ -1224,10 +1224,10 @@ TclStackFree(
void *
TclStackAlloc(
Tcl_Interp *interp,
size_t numBytes)
Tcl_Size numBytes)
{
Interp *iPtr = (Interp *) interp;
size_t numWords;
Tcl_Size numWords;
if (iPtr == NULL || iPtr->execEnvPtr == NULL) {
return (void *) Tcl_Alloc(numBytes);
@@ -4453,7 +4453,7 @@ TEBCresume(
TRACE_APPEND(("ERROR: \"%.30s\" not on reachable chain\n",
O2S(valuePtr)));
for (i = contextPtr->index ; i != TCL_INDEX_NONE ; i--) {
for (i = contextPtr->index ; !TCL_SIZE_ISNEG(i) ; i--) {
miPtr = contextPtr->callPtr->chain + i;
if (miPtr->isFilter
|| miPtr->mPtr->declaringClassPtr != classPtr) {
@@ -5346,7 +5346,7 @@ TEBCresume(
toIdx = TclIndexDecode(toIdx, slength - 1);
fromIdx = TclIndexDecode(fromIdx, slength - 1);
if (toIdx == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(toIdx)) {
TclNewObj(objResultPtr);
} else {
objResultPtr = Tcl_GetRange(valuePtr, fromIdx, toIdx);
@@ -5381,7 +5381,7 @@ TEBCresume(
TclDecrRefCount(OBJ_AT_TOS);
(void) POP_OBJECT();
if ((toIdx == TCL_INDEX_NONE) ||
if (TCL_SIZE_ISNEG(toIdx) ||
(fromIdx + 1 > slength + 1) ||
(toIdx + 1 < fromIdx + 1)) {
TRACE_APPEND(("\"%.30s\"\n", O2S(valuePtr)));
@@ -5389,7 +5389,7 @@ TEBCresume(
NEXT_INST_F(1, 0, 0);
}
if (fromIdx == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(fromIdx)) {
fromIdx = TCL_INDEX_START;
}
@@ -7386,7 +7386,7 @@ TEBCresume(
rangePtr->codeOffset, rangePtr->breakOffset));
NEXT_INST_F(0, 0, 0);
}
if (rangePtr->continueOffset == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(rangePtr->continueOffset)) {
TRACE_APPEND(("%s, loop w/o continue, checking for catch\n",
StringForResultCode(result)));
goto checkForCatch;
@@ -9300,7 +9300,7 @@ GetExceptRangeForPc(
if (searchMode == TCL_BREAK) {
return rangePtr;
}
if (searchMode == TCL_CONTINUE && rangePtr->continueOffset != TCL_INDEX_NONE){
if (searchMode == TCL_CONTINUE && !TCL_SIZE_ISNEG(rangePtr->continueOffset)){
return rangePtr;
}
}
@@ -9734,7 +9734,7 @@ EvalStatsCmd(
break;
}
}
for (i = 31; i != TCL_INDEX_NONE; i--) {
for (i = 31; !TCL_SIZE_ISNEG(i); i--) {
if (statsPtr->srcCount[i] > 0) {
break; /* maxSizeDecade to consume 'i' value
* below... */
@@ -9758,7 +9758,7 @@ EvalStatsCmd(
break;
}
}
for (i = 31; i != TCL_INDEX_NONE; i--) {
for (i = 31; !TCL_SIZE_ISNEG(i); i--) {
if (statsPtr->byteCodeCount[i] > 0) {
break; /* maxSizeDecade to consume 'i' value
* below... */
@@ -9782,7 +9782,7 @@ EvalStatsCmd(
break;
}
}
for (i = 31; i != TCL_INDEX_NONE; i--) {
for (i = 31; !TCL_SIZE_ISNEG(i); i--) {
if (statsPtr->lifetimeCount[i] > 0) {
break; /* maxSizeDecade to consume 'i' value
* below... */
+3 -3
View File
@@ -758,7 +758,7 @@ SplitWinPath(
Tcl_Obj *
Tcl_FSJoinToPath(
Tcl_Obj *pathPtr, /* Valid path or NULL. */
size_t objc, /* Number of array elements to join */
Tcl_Size objc, /* Number of array elements to join */
Tcl_Obj *const objv[]) /* Path elements to join. */
{
if (pathPtr == NULL) {
@@ -927,11 +927,11 @@ TclpNativeJoinPath(
char *
Tcl_JoinPath(
size_t argc,
Tcl_Size argc,
const char *const *argv,
Tcl_DString *resultPtr) /* Pointer to previously initialized DString */
{
size_t i, len;
Tcl_Size i, len;
Tcl_Obj *listObj;
Tcl_Obj *resultObj;
const char *resultStr;
+5 -5
View File
@@ -6235,7 +6235,7 @@ ReadChars(
int savedIEFlags = statePtr->inputEncodingFlags;
int savedFlags = statePtr->flags;
char *dst, *src = RemovePoint(bufPtr);
Tcl_Size numBytes;
TCL_HASH_TYPE numBytes;
int srcLen = BytesLeft(bufPtr);
/*
@@ -6259,7 +6259,7 @@ ReadChars(
(void) Tcl_GetStringFromObj(objPtr, &numBytes);
Tcl_AppendToObj(objPtr, NULL, dstLimit);
if (toRead == srcLen) {
size_t size;
TCL_HASH_TYPE size;
dst = TclGetStringStorage(objPtr, &size) + numBytes;
dstLimit = (size - numBytes) > INT_MAX ? INT_MAX : (size - numBytes);
@@ -9753,7 +9753,7 @@ CopyData(
!GotFlag(inStatePtr, CHANNEL_NONBLOCKING)
,0 /* No append */);
}
underflow = (size >= 0) && ((size_t)size < sizeb); /* Input underflow */
underflow = (size >= 0) && ((Tcl_Size)size < sizeb); /* Input underflow */
}
if (size < 0) {
@@ -9832,7 +9832,7 @@ CopyData(
* unsuitable for updating totals and toRead.
*/
if (sizeb == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(sizeb)) {
writeError:
if (interp) {
TclNewObj(errObj);
@@ -10064,7 +10064,7 @@ DoRead(
while (!bufPtr || /* We got no buffer! OR */
(!IsBufferFull(bufPtr) && /* Our buffer has room AND */
((size_t)BytesLeft(bufPtr) < bytesToRead))) {
((Tcl_Size)BytesLeft(bufPtr) < bytesToRead))) {
/* Not enough bytes in it yet
* to fill the dst */
int code;
+2 -2
View File
@@ -164,12 +164,12 @@ Tcl_PutsObjCmd(
TclChannelPreserve(chan);
result = Tcl_WriteObj(chan, string);
if (result == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(result)) {
goto error;
}
if (newline != 0) {
result = Tcl_WriteChars(chan, "\n", 1);
if (result == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(result)) {
goto error;
}
}
+2 -2
View File
@@ -117,13 +117,13 @@ TclSockGetPort(
int
TclSockMinimumBuffers(
void *sock, /* Socket file descriptor */
size_t size1) /* Minimum buffer size */
Tcl_Size size1) /* Minimum buffer size */
{
int current;
socklen_t len;
int size = size1;
if ((size_t)size != size1) {
if ((Tcl_Size)size != size1) {
return TCL_ERROR;
}
len = sizeof(int);
+12 -2
View File
@@ -187,7 +187,7 @@ Tcl_GetIndexFromObjStruct(
* offset, the third plus the offset again,
* etc. The last entry must be NULL and there
* must not be duplicate entries. */
size_t offset, /* The number of bytes between entries */
Tcl_Size offset, /* The number of bytes between entries */
const char *msg, /* Identifying word to use in error
* messages. */
int flags, /* 0, TCL_EXACT, TCL_NULL_OK or TCL_INDEX_TEMP_TABLE */
@@ -202,7 +202,7 @@ Tcl_GetIndexFromObjStruct(
const Tcl_ObjInternalRep *irPtr;
/* Protect against invalid values, like TCL_INDEX_NONE or 0. */
if (offset+1 <= sizeof(char *)) {
if (offset + 1 <= sizeof(char *)) {
offset = sizeof(char *);
}
/*
@@ -815,6 +815,15 @@ Tcl_WrongNumArgs(
Interp *iPtr = (Interp *)interp;
const char *elementStr;
if (!interp) {
/* We cannot do anything more, just let the caller return TCL_ERROR */
return;
}
if (TCL_SIZE_ISNEG(objc) || (objc < 1)) {
/* Since we don't have objc[0], just print "wrong # args", nothing more */
TclNewStringObj(objPtr, "wrong # args", 12);
goto numargsend;
}
TclNewObj(objPtr);
if (iPtr->flags & INTERP_ALTERNATE_WRONG_ARGS) {
iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS;
@@ -954,6 +963,7 @@ Tcl_WrongNumArgs(
Tcl_AppendStringsToObj(objPtr, message, NULL);
}
Tcl_AppendStringsToObj(objPtr, "\"", NULL);
numargsend:
Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
Tcl_SetObjResult(interp, objPtr);
}
+3 -3
View File
@@ -1197,7 +1197,7 @@ Tcl_CreateAlias(
const char *childCmd, /* Command to install in child. */
Tcl_Interp *targetInterp, /* Interpreter for target command. */
const char *targetCmd, /* Name of target command. */
size_t argc, /* How many additional arguments? */
Tcl_Size argc, /* How many additional arguments? */
const char *const *argv) /* These are the additional args. */
{
Tcl_Obj *childObjPtr, *targetObjPtr;
@@ -1252,7 +1252,7 @@ Tcl_CreateAliasObj(
const char *childCmd, /* Command to install in child. */
Tcl_Interp *targetInterp, /* Interpreter for target command. */
const char *targetCmd, /* Name of target command. */
size_t objc, /* How many additional arguments? */
Tcl_Size objc, /* How many additional arguments? */
Tcl_Obj *const objv[]) /* Argument vector. */
{
Tcl_Obj *childObjPtr, *targetObjPtr;
@@ -3985,7 +3985,7 @@ Tcl_LimitTypeReset(
void
Tcl_LimitSetCommands(
Tcl_Interp *interp,
size_t commandLimit)
Tcl_Size commandLimit)
{
Interp *iPtr = (Interp *) interp;
+2 -2
View File
@@ -246,7 +246,7 @@ Tcl_LinkArray(
* interpreter result. */
int type, /* Type of C variable: TCL_LINK_INT, etc. Also
* may have TCL_LINK_READ_ONLY OR'ed in. */
size_t size) /* Size of C variable array, >1 if array */
Tcl_Size size) /* Size of C variable array, >1 if array */
{
Tcl_Obj *objPtr;
Link *linkPtr;
@@ -254,7 +254,7 @@ Tcl_LinkArray(
const char *name;
int code;
if (size < 1) {
if (TCL_SIZE_ISNEG(size) || size < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"wrong array size given", TCL_INDEX_NONE));
return TCL_ERROR;
+2 -2
View File
@@ -1660,7 +1660,7 @@ Tcl_ListObjGetElements(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
Tcl_Obj *objPtr, /* List object for which an element array is
* to be returned. */
Tcl_Size *objcPtr, /* Where to store the count of objects
size_t *objcPtr, /* Where to store the count of objects
* referenced by objv. */
Tcl_Obj ***objvPtr) /* Where to store the pointer to an array of
* pointers to the list's objects. */
@@ -1993,7 +1993,7 @@ int
Tcl_ListObjLength(
Tcl_Interp *interp, /* Used to report errors if not NULL. */
Tcl_Obj *listObj, /* List object whose #elements to return. */
Tcl_Size *lenPtr) /* The resulting length is stored here. */
size_t *lenPtr) /* The resulting length is stored here. */
{
ListRep listRep;
+12 -12
View File
@@ -179,7 +179,7 @@ TclCreateLiteral(
const char *bytes, /* The start of the string. Note that this is
* not a NUL-terminated string. */
size_t length, /* Number of bytes in the string. */
size_t hash, /* The string's hash. If the value is
TCL_HASH_TYPE hash, /* The string's hash. If the value is
* TCL_INDEX_NONE, it will be computed here. */
int *newPtr,
Namespace *nsPtr,
@@ -229,7 +229,7 @@ TclCreateLiteral(
if (flags & LITERAL_ON_HEAP) {
Tcl_Free((void *)bytes);
}
if (globalPtr->refCount != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(globalPtr->refCount)) {
globalPtr->refCount++;
}
return objPtr;
@@ -351,7 +351,7 @@ Tcl_Obj *
TclFetchLiteral(
CompileEnv *envPtr, /* Points to the CompileEnv from which to
* fetch the registered literal value. */
size_t index) /* Index of the desired literal, as returned
Tcl_Size index) /* Index of the desired literal, as returned
* by prior call to TclRegisterLiteral() */
{
if (index >= envPtr->literalArrayNext) {
@@ -387,16 +387,16 @@ TclFetchLiteral(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclRegisterLiteral(
void *ePtr, /* Points to the CompileEnv in whose object
* array an object is found or created. */
const char *bytes, /* Points to string for which to find or
* create an object in CompileEnv's object
* array. */
size_t length, /* Number of bytes in the string. If -1, the
* string consists of all bytes up to the
* first null character. */
Tcl_Size length, /* Number of bytes in the string. If
* TCL_INDEX_NONE, the string consists of all bytes
* up to the first null character. */
int flags) /* If LITERAL_ON_HEAP then the caller already
* malloc'd bytes and ownership is passed to
* this function. If LITERAL_CMD_NAME then
@@ -412,7 +412,7 @@ TclRegisterLiteral(
int isNew;
Namespace *nsPtr;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = (bytes ? strlen(bytes) : 0);
}
hash = HashString(bytes, length);
@@ -607,7 +607,7 @@ TclHideLiteral(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclAddLiteralObj(
CompileEnv *envPtr,/* Points to CompileEnv in whose literal array
* the object is to be inserted. */
@@ -617,7 +617,7 @@ TclAddLiteralObj(
* NULL. */
{
LiteralEntry *lPtr;
size_t objIndex;
Tcl_Size objIndex;
if (envPtr->literalArrayNext >= envPtr->literalArrayEnd) {
ExpandLocalLiteralArray(envPtr);
@@ -851,7 +851,7 @@ TclReleaseLiteral(
* literal table entry (decrement the ref count of the object).
*/
if ((entryPtr->refCount != TCL_INDEX_NONE) && (entryPtr->refCount-- <= 1)) {
if (!TCL_SIZE_ISNEG((entryPtr->refCount)) && (entryPtr->refCount-- <= 1)) {
if (prevPtr == NULL) {
globalTablePtr->buckets[index] = entryPtr->nextPtr;
} else {
@@ -1175,7 +1175,7 @@ TclVerifyLocalLiteralTable(
for (localPtr=localTablePtr->buckets[i] ; localPtr!=NULL;
localPtr=localPtr->nextPtr) {
count++;
if (localPtr->refCount != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(localPtr->refCount)) {
bytes = Tcl_GetStringFromObj(localPtr->objPtr, &length);
Tcl_Panic("%s: local literal \"%.*s\" had bad refCount %" TCL_Z_MODIFIER "u",
"TclVerifyLocalLiteralTable",
+6 -6
View File
@@ -280,7 +280,7 @@ Tcl_SourceRCFile(
TCL_NORETURN void
Tcl_MainEx(
size_t argc, /* Number of arguments. */
Tcl_Size argc, /* Number of arguments. */
TCHAR **argv, /* Array of argument strings. */
Tcl_AppInitProc *appInitProc,
/* Application-specific initialization
@@ -288,7 +288,7 @@ Tcl_MainEx(
* but before starting to execute commands. */
Tcl_Interp *interp)
{
size_t i=0; /* argv[i] index */
Tcl_Size i=0; /* argv[i] index */
Tcl_Obj *path, *resultPtr, *argvPtr, *appName;
const char *encodingName = NULL;
int code, exitCode = 0;
@@ -454,7 +454,7 @@ Tcl_MainEx(
while ((is.input != NULL) && !Tcl_InterpDeleted(interp)) {
mainLoopProc = TclGetMainLoop();
if (mainLoopProc == NULL) {
size_t length;
Tcl_Size length;
if (is.tty) {
Prompt(interp, &is);
@@ -475,7 +475,7 @@ Tcl_MainEx(
Tcl_IncrRefCount(is.commandPtr);
}
length = Tcl_GetsObj(is.input, is.commandPtr);
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
if (Tcl_InputBlocked(is.input)) {
/*
* This can only happen if stdin has been set to
@@ -740,7 +740,7 @@ StdinProc(
TCL_UNUSED(int) /*mask*/)
{
int code;
size_t length;
Tcl_Size length;
InteractiveState *isPtr = (InteractiveState *)clientData;
Tcl_Channel chan = isPtr->input;
Tcl_Obj *commandPtr = isPtr->commandPtr;
@@ -752,7 +752,7 @@ StdinProc(
Tcl_IncrRefCount(commandPtr);
}
length = Tcl_GetsObj(chan, commandPtr);
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
if (Tcl_InputBlocked(chan)) {
return;
}
+18 -18
View File
@@ -1185,7 +1185,7 @@ TclTeardownNamespace(
Interp *iPtr = (Interp *) nsPtr->interp;
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
size_t i;
Tcl_Size i;
/*
* Start by destroying the namespace's variable table, since variables
@@ -1206,7 +1206,7 @@ TclTeardownNamespace(
*/
while (nsPtr->cmdTable.numEntries > 0) {
size_t length = nsPtr->cmdTable.numEntries;
Tcl_Size length = nsPtr->cmdTable.numEntries;
Command **cmds = (Command **)TclStackAlloc((Tcl_Interp *) iPtr,
sizeof(Command *) * length);
@@ -1396,7 +1396,7 @@ Tcl_Export(
Namespace *currNsPtr = (Namespace *) TclGetCurrentNamespace(interp);
const char *simplePattern;
char *patternCpy;
size_t neededElems, len, i;
Tcl_Size neededElems, len, i;
/*
* If the specified namespace is NULL, use the current namespace.
@@ -1523,7 +1523,7 @@ Tcl_AppendExportList(
* export pattern list is appended. */
{
Namespace *nsPtr;
size_t i;
Tcl_Size i;
int result;
/*
@@ -1726,7 +1726,7 @@ DoImport(
Namespace *importNsPtr,
int allowOverwrite)
{
size_t i = 0, exported = 0;
Tcl_Size i = 0, exported = 0;
Tcl_HashEntry *found;
/*
@@ -2638,7 +2638,7 @@ Tcl_FindCommand(
cmdPtr = NULL;
if (cxtNsPtr->commandPathLength!=0 && strncmp(name, "::", 2)
&& !(flags & TCL_NAMESPACE_ONLY)) {
size_t i;
Tcl_Size i;
Namespace *pathNsPtr, *realNsPtr, *dummyNsPtr;
(void) TclGetNamespaceForQualName(interp, name, cxtNsPtr,
@@ -4039,7 +4039,7 @@ NamespacePathCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
size_t nsObjc, i;
Tcl_Size nsObjc, i;
int result = TCL_ERROR;
Tcl_Obj **nsObjv;
Tcl_Namespace **namespaceList = NULL;
@@ -4123,13 +4123,13 @@ NamespacePathCmd(
void
TclSetNsPath(
Namespace *nsPtr, /* Namespace whose path is to be set. */
size_t pathLength, /* Length of pathAry. */
Tcl_Size pathLength, /* Length of pathAry. */
Tcl_Namespace *pathAry[]) /* Array of namespaces that are the path. */
{
if (pathLength != 0) {
NamespacePathEntry *tmpPathArray =
(NamespacePathEntry *)Tcl_Alloc(sizeof(NamespacePathEntry) * pathLength);
size_t i;
Tcl_Size i;
for (i=0 ; i<pathLength ; i++) {
tmpPathArray[i].nsPtr = (Namespace *) pathAry[i];
@@ -4180,7 +4180,7 @@ static void
UnlinkNsPath(
Namespace *nsPtr)
{
size_t i;
Tcl_Size i;
for (i=0 ; i<nsPtr->commandPathLength ; i++) {
NamespacePathEntry *nsPathPtr = &nsPtr->commandPathArray[i];
@@ -4431,7 +4431,7 @@ Tcl_SetNamespaceUnknownHandler(
Tcl_Namespace *nsPtr, /* Namespace which is being updated. */
Tcl_Obj *handlerPtr) /* The new handler, or NULL to reset. */
{
size_t lstlen = 0;
Tcl_Size lstlen = 0;
Namespace *currNsPtr = (Namespace *) nsPtr;
/*
@@ -4927,7 +4927,7 @@ TclLogCommandInfo(
* command (must be <= command). */
const char *command, /* First character in command that generated
* the error. */
size_t length, /* Number of bytes in command (TCL_INDEX_NONE
Tcl_Size length, /* Number of bytes in command (TCL_INDEX_NONE
* means use all bytes up to first null byte).
*/
const unsigned char *pc, /* Current pc of bytecode execution context */
@@ -4960,10 +4960,10 @@ TclLogCommandInfo(
}
}
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = strlen(command);
}
overflow = (length > (size_t)limit);
overflow = (length > (Tcl_Size)limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n %s\n\"%.*s%s\"", ((iPtr->errorInfo == NULL)
? "while executing" : "invoked from within"),
@@ -5013,7 +5013,7 @@ TclLogCommandInfo(
iPtr->errorStack = newObj;
}
if (iPtr->resetErrorStack) {
size_t len;
Tcl_Size len;
iPtr->resetErrorStack = 0;
TclListObjLengthM(interp, iPtr->errorStack, &len);
@@ -5085,7 +5085,7 @@ void
TclErrorStackResetIf(
Tcl_Interp *interp,
const char *msg,
size_t length)
Tcl_Size length)
{
Interp *iPtr = (Interp *) interp;
@@ -5098,7 +5098,7 @@ TclErrorStackResetIf(
iPtr->errorStack = newObj;
}
if (iPtr->resetErrorStack) {
size_t len;
Tcl_Size len;
iPtr->resetErrorStack = 0;
TclListObjLengthM(interp, iPtr->errorStack, &len);
@@ -5140,7 +5140,7 @@ Tcl_LogCommandInfo(
* command (must be <= command). */
const char *command, /* First character in command that generated
* the error. */
size_t length) /* Number of bytes in command (-1 means use
Tcl_Size length) /* Number of bytes in command (-1 means use
* all bytes up to first null byte). */
{
TclLogCommandInfo(interp, script, command, length, NULL, NULL);
+3 -3
View File
@@ -1687,7 +1687,7 @@ Tcl_NewObjectInstance(
* used for object cloning only.
*/
if (objc != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(objc)) {
CallContext *contextPtr =
TclOOGetCallContext(oPtr, NULL, CONSTRUCTOR, NULL, NULL, NULL);
@@ -1758,7 +1758,7 @@ TclNRNewObjectInstance(
* object cloning only). If there aren't any constructors, we do nothing.
*/
if (objc == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(objc)) {
*objectPtr = (Tcl_Object) oPtr;
return TCL_OK;
}
@@ -2627,7 +2627,7 @@ int
TclOOObjectCmdCore(
Object *oPtr, /* The object being invoked. */
Tcl_Interp *interp, /* The interpreter containing the object. */
size_t objc, /* How many arguments are being passed in. */
Tcl_Size objc, /* How many arguments are being passed in. */
Tcl_Obj *const *objv, /* The array of arguments. */
int flags, /* Whether this is an invocation through the
* public or the private command interface. */
+1 -1
View File
@@ -988,7 +988,7 @@ TclOONextToObjCmd(
methodType = "method";
}
for (i=contextPtr->index ; i != TCL_INDEX_NONE ; i--) {
for (i=contextPtr->index ; !TCL_SIZE_ISNEG(i) ; i--) {
struct MInvoke *miPtr = contextPtr->callPtr->chain + i;
if (!miPtr->isFilter && miPtr->mPtr->declaringClassPtr == classPtr) {
+2 -2
View File
@@ -498,7 +498,7 @@ TclOONewProcMethod(
method = TclOOMakeProcMethod(interp, clsPtr, flags, nameObj, procName,
argsObj, bodyObj, &procMethodType, pmPtr, &pmPtr->procPtr);
if (argsLen == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(argsLen)) {
Tcl_DecrRefCount(argsObj);
}
if (method == NULL) {
@@ -1188,7 +1188,7 @@ static int
ProcedureMethodCompiledVarResolver(
TCL_UNUSED(Tcl_Interp *),
const char *varName,
size_t length,
Tcl_Size length,
TCL_UNUSED(Tcl_Namespace *),
Tcl_ResolvedVarInfo **rPtrPtr)
{
+5 -5
View File
@@ -1512,7 +1512,7 @@ int
TclObjBeingDeleted(
Tcl_Obj *objPtr)
{
return (objPtr->length == TCL_INDEX_NONE);
return (TCL_SIZE_ISNEG(objPtr->length));
}
/*
@@ -1632,7 +1632,7 @@ Tcl_GetString(
objPtr->typePtr->name);
}
objPtr->typePtr->updateStringProc(objPtr);
if (objPtr->bytes == NULL || objPtr->length == TCL_INDEX_NONE
if (objPtr->bytes == NULL || TCL_SIZE_ISNEG(objPtr->length)
|| objPtr->bytes[objPtr->length] != '\0') {
Tcl_Panic("UpdateStringProc for type '%s' "
"failed to create a valid string rep",
@@ -1692,7 +1692,7 @@ TclGetStringFromObj(
objPtr->typePtr->name);
}
objPtr->typePtr->updateStringProc(objPtr);
if (objPtr->bytes == NULL || objPtr->length == TCL_INDEX_NONE
if (objPtr->bytes == NULL || TCL_SIZE_ISNEG(objPtr->length)
|| objPtr->bytes[objPtr->length] != '\0') {
Tcl_Panic("UpdateStringProc for type '%s' "
"failed to create a valid string rep",
@@ -1798,7 +1798,7 @@ char *
Tcl_InitStringRep(
Tcl_Obj *objPtr, /* Object whose string rep is to be set */
const char *bytes,
size_t numBytes)
TCL_HASH_TYPE numBytes)
{
assert(objPtr->bytes == NULL || bytes == NULL);
@@ -4119,7 +4119,7 @@ TclHashObjKey(
void *keyPtr) /* Key from which to compute hash value. */
{
Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
size_t length;
Tcl_Size length;
const char *string = Tcl_GetStringFromObj(objPtr, &length);
TCL_HASH_TYPE result = 0;
+1 -1
View File
@@ -134,7 +134,7 @@ LocateTargetAddresses(
} else {
targetInstPtr = envPtr->codeStart + rangePtr->breakOffset;
DefineTargetAddress(tablePtr, targetInstPtr);
if (rangePtr->continueOffset != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(rangePtr->continueOffset)) {
targetInstPtr = envPtr->codeStart + rangePtr->continueOffset;
DefineTargetAddress(tablePtr, targetInstPtr);
}
+9 -9
View File
@@ -198,7 +198,7 @@ Tcl_ParseCommand(
* NULL, then no error message is provided. */
const char *start, /* First character of string containing one or
* more Tcl commands. */
size_t numBytes, /* Total number of bytes in string. If -1,
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
* the script consists of all bytes up to the
* first null character. */
int nested, /* Non-zero means this is a nested command:
@@ -221,7 +221,7 @@ Tcl_ParseCommand(
* point to char after terminating one. */
size_t scanned;
if (numBytes == TCL_INDEX_NONE && start) {
if (TCL_SIZE_ISNEG(numBytes) && start) {
numBytes = strlen(start);
}
TclParseInit(interp, start, numBytes, parsePtr);
@@ -1335,7 +1335,7 @@ Tcl_ParseVarName(
* NULL, then no error message is provided. */
const char *start, /* Start of variable substitution string.
* First character must be "$". */
size_t numBytes, /* Total number of bytes in string. If -1,
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
* the string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr, /* Structure to fill in with information about
@@ -1350,7 +1350,7 @@ Tcl_ParseVarName(
int varIndex;
unsigned array;
if (numBytes == TCL_INDEX_NONE && start) {
if (TCL_SIZE_ISNEG(numBytes) && start) {
numBytes = strlen(start);
}
if (!append) {
@@ -1633,7 +1633,7 @@ Tcl_ParseBraces(
* NULL, then no error message is provided. */
const char *start, /* Start of string enclosed in braces. The
* first character must be {'. */
size_t numBytes, /* Total number of bytes in string. If -1,
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
* the string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr,
@@ -1651,9 +1651,9 @@ Tcl_ParseBraces(
Tcl_Token *tokenPtr;
const char *src;
int startIndex, level;
size_t length;
Tcl_Size length;
if (numBytes == TCL_INDEX_NONE && start) {
if (TCL_SIZE_ISNEG(numBytes) && start) {
numBytes = strlen(start);
}
if (!append) {
@@ -1835,7 +1835,7 @@ Tcl_ParseQuotedString(
* NULL, then no error message is provided. */
const char *start, /* Start of the quoted string. The first
* character must be '"'. */
size_t numBytes, /* Total number of bytes in string. If -1,
Tcl_Size numBytes, /* Total number of bytes in string. If TCL_INDEX_NONE,
* the string consists of all bytes up to the
* first null character. */
Tcl_Parse *parsePtr,
@@ -1850,7 +1850,7 @@ Tcl_ParseQuotedString(
* the quoted string's terminating close-quote
* if the parse succeeds. */
{
if (numBytes == TCL_INDEX_NONE && start) {
if (TCL_SIZE_ISNEG(numBytes) && start) {
numBytes = strlen(start);
}
if (!append) {
+6 -6
View File
@@ -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);
@@ -795,17 +795,17 @@ Tcl_Obj *
Tcl_FSJoinPath(
Tcl_Obj *listObj, /* Path elements to join, may have a zero
* reference count. */
size_t elements) /* Number of elements to use (-1 = all) */
Tcl_Size elements) /* Number of elements to use (TCL_INDEX_NONE = all) */
{
Tcl_Obj *res;
size_t objc;
Tcl_Size objc;
Tcl_Obj **objv;
if (TclListObjLengthM(NULL, listObj, &objc) != TCL_OK) {
return NULL;
}
elements = ((elements != TCL_INDEX_NONE) && (elements <= objc)) ? elements : objc;
elements = (!TCL_SIZE_ISNEG(elements) && (elements <= objc)) ? elements : objc;
TclListObjGetElementsM(NULL, listObj, &objc, &objv);
res = TclJoinPath(elements, objv, 0);
return res;
@@ -813,13 +813,13 @@ Tcl_FSJoinPath(
Tcl_Obj *
TclJoinPath(
size_t elements, /* Number of elements to use */
Tcl_Size elements, /* Number of elements to use */
Tcl_Obj * const objv[], /* Path elements to join */
int forceRelative) /* If non-zero, assume all more paths are
* relative (e. g. simple normalization) */
{
Tcl_Obj *res = NULL;
size_t i;
Tcl_Size i;
const Tcl_Filesystem *fsPtr = NULL;
if (elements == 0) {
+8 -8
View File
@@ -179,12 +179,12 @@ FileForRedirect(
void
Tcl_DetachPids(
size_t numPids, /* Number of pids to detach: gives size of
Tcl_Size numPids, /* Number of pids to detach: gives size of
* array pointed to by pidPtr. */
Tcl_Pid *pidPtr) /* Array of pids to detach. */
{
Detached *detPtr;
size_t i;
Tcl_Size i;
Tcl_MutexLock(&pipeMutex);
for (i = 0; i < numPids; i++) {
@@ -269,7 +269,7 @@ Tcl_ReapDetachedProcs(void)
int
TclCleanupChildren(
Tcl_Interp *interp, /* Used for error messages. */
size_t numPids, /* Number of entries in pidPtr array. */
Tcl_Size numPids, /* Number of entries in pidPtr array. */
Tcl_Pid *pidPtr, /* Array of process ids of children. */
Tcl_Channel errorChan) /* Channel for file containing stderr output
* from pipeline. NULL means there isn't any
@@ -278,7 +278,7 @@ TclCleanupChildren(
int result = TCL_OK;
int code, abnormalExit, anyErrorInfo;
TclProcessWaitStatus waitStatus;
size_t i;
Tcl_Size i;
Tcl_Obj *msg, *error;
abnormalExit = 0;
@@ -395,10 +395,10 @@ TclCleanupChildren(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclCreatePipeline(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
size_t argc, /* Number of entries in argv. */
Tcl_Size argc, /* Number of entries in argv. */
const char **argv, /* Array of strings describing commands in
* pipeline plus I/O redirection with <, <<,
* >, etc. Argv[argc] must be NULL. */
@@ -1021,7 +1021,7 @@ Tcl_Channel
Tcl_OpenCommandChannel(
Tcl_Interp *interp, /* Interpreter for error reporting. Can NOT be
* NULL. */
size_t argc, /* How many arguments. */
Tcl_Size argc, /* How many arguments. */
const char **argv, /* Array of arguments for command pipe. */
int flags) /* Or'ed combination of TCL_STDIN, TCL_STDOUT,
* TCL_STDERR, and TCL_ENFORCE_MODE. */
@@ -1041,7 +1041,7 @@ Tcl_OpenCommandChannel(
numPids = TclCreatePipeline(interp, argc, argv, &pidPtr, inPipePtr,
outPipePtr, errFilePtr);
if (numPids == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numPids)) {
goto error;
}
+4 -4
View File
@@ -426,7 +426,7 @@ Tcl_PkgRequireProc(
Tcl_Interp *interp, /* Interpreter in which package is now
* available. */
const char *name, /* Name of desired package. */
size_t reqc, /* Requirements constraining the desired
Tcl_Size reqc, /* Requirements constraining the desired
* version. */
Tcl_Obj *const reqv[], /* 0 means to use the latest version
* available. */
@@ -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);
+10 -10
View File
@@ -253,7 +253,7 @@ void
Tcl_RegExpRange(
Tcl_RegExp re, /* Compiled regular expression that has been
* passed to Tcl_RegExpExec. */
size_t index, /* 0 means give the range of the entire match,
Tcl_Size index, /* 0 means give the range of the entire match,
* > 0 means give the range of a matching
* subrange. */
const char **startPtr, /* Store address of first character in
@@ -266,7 +266,7 @@ Tcl_RegExpRange(
if (index > regexpPtr->re.re_nsub) {
*startPtr = *endPtr = NULL;
} else if (regexpPtr->matches[index].rm_so == TCL_INDEX_NONE) {
} else if (TCL_SIZE_ISNEG(regexpPtr->matches[index].rm_so)) {
*startPtr = *endPtr = NULL;
} else {
if (regexpPtr->objPtr) {
@@ -363,18 +363,18 @@ void
TclRegExpRangeUniChar(
Tcl_RegExp re, /* Compiled regular expression that has been
* passed to Tcl_RegExpExec. */
size_t index, /* 0 means give the range of the entire match,
Tcl_Size index, /* 0 means give the range of the entire match,
* > 0 means give the range of a matching
* subrange, TCL_INDEX_NONE means the range of the
* rm_extend field. */
size_t *startPtr, /* Store address of first character in
Tcl_Size *startPtr, /* Store address of first character in
* (sub-)range here. */
size_t *endPtr) /* Store address of character just after last
Tcl_Size *endPtr) /* Store address of character just after last
* in (sub-)range here. */
{
TclRegexp *regexpPtr = (TclRegexp *) re;
if ((regexpPtr->flags&REG_EXPECT) && (index == TCL_INDEX_NONE)) {
if ((regexpPtr->flags&REG_EXPECT) && TCL_SIZE_ISNEG(index)) {
*startPtr = regexpPtr->details.rm_extend.rm_so;
*endPtr = regexpPtr->details.rm_extend.rm_eo;
} else if (index + 1 > regexpPtr->re.re_nsub + 1) {
@@ -443,16 +443,16 @@ Tcl_RegExpExecObj(
* returned by previous call to
* Tcl_GetRegExpFromObj. */
Tcl_Obj *textObj, /* Text against which to match re. */
size_t offset, /* Character index that marks where matching
Tcl_Size offset, /* Character index that marks where matching
* should begin. */
size_t nmatches, /* How many subexpression matches (counting
Tcl_Size nmatches, /* How many subexpression matches (counting
* the whole match as subexpression 0) are of
* interest. -1 means all of them. */
* interest. TCL_INDEX_NONE means all of them. */
int flags) /* Regular expression execution flags. */
{
TclRegexp *regexpPtr = (TclRegexp *) re;
Tcl_UniChar *udata;
size_t length;
Tcl_Size length;
int reflags = regexpPtr->flags;
#define TCL_REG_GLOBOK_FLAGS \
(TCL_REG_ADVANCED | TCL_REG_NOSUB | TCL_REG_NOCASE)
+4 -4
View File
@@ -357,7 +357,7 @@ Tcl_AppendElement(
Tcl_Obj *elementPtr = Tcl_NewStringObj(element, TCL_INDEX_NONE);
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));
@@ -721,7 +721,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) {
@@ -910,7 +910,7 @@ TclMergeReturnOptions(
Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORCODE], &valuePtr);
if (valuePtr != NULL) {
size_t length;
Tcl_Size length;
if (TCL_ERROR == TclListObjLengthM(NULL, valuePtr, &length )) {
/*
@@ -932,7 +932,7 @@ TclMergeReturnOptions(
Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORSTACK], &valuePtr);
if (valuePtr != NULL) {
size_t length;
Tcl_Size length;
if (TCL_ERROR == TclListObjLengthM(NULL, valuePtr, &length)) {
/*
+74 -74
View File
@@ -257,7 +257,7 @@ Tcl_Obj *
Tcl_NewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
size_t length) /* The number of bytes to copy from "bytes"
Tcl_Size length) /* The number of bytes to copy from "bytes"
* when initializing the new object. If
* TCL_INDEX_NONE, use bytes up to the first NUL
* byte. */
@@ -269,13 +269,13 @@ Tcl_Obj *
Tcl_NewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
size_t length) /* The number of bytes to copy from "bytes"
* when initializing the new object. If -1,
Tcl_Size length) /* The number of bytes to copy from "bytes"
* when initializing the new object. If TCL_INDEX_NONE,
* use bytes up to the first NUL byte. */
{
Tcl_Obj *objPtr;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = (bytes? strlen(bytes) : 0);
}
TclNewStringObj(objPtr, bytes, length);
@@ -317,7 +317,7 @@ Tcl_Obj *
Tcl_DbNewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
size_t length, /* The number of bytes to copy from "bytes"
Tcl_Size length, /* The number of bytes to copy from "bytes"
* when initializing the new object. If -1,
* use bytes up to the first NUL byte. */
const char *file, /* The name of the source file calling this
@@ -327,7 +327,7 @@ Tcl_DbNewStringObj(
{
Tcl_Obj *objPtr;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = (bytes? strlen(bytes) : 0);
}
TclDbNewObj(objPtr, file, line);
@@ -339,7 +339,7 @@ Tcl_Obj *
Tcl_DbNewStringObj(
const char *bytes, /* Points to the first of the length bytes
* used to initialize the new object. */
size_t length, /* The number of bytes to copy from "bytes"
Tcl_Size length, /* The number of bytes to copy from "bytes"
* when initializing the new object. If -1,
* use bytes up to the first NUL byte. */
TCL_UNUSED(const char *) /*file*/,
@@ -372,7 +372,7 @@ Tcl_Obj *
Tcl_NewUnicodeObj(
const Tcl_UniChar *unicode, /* The unicode string used to initialize the
* new object. */
size_t numChars) /* Number of characters in the unicode
Tcl_Size numChars) /* Number of characters in the unicode
* string. */
{
Tcl_Obj *objPtr;
@@ -399,13 +399,13 @@ Tcl_NewUnicodeObj(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_GetCharLength(
Tcl_Obj *objPtr) /* The String object to get the num chars
* of. */
{
String *stringPtr;
size_t numChars = 0;
Tcl_Size numChars = 0;
/*
* Quick, no-shimmer return for short string reps.
@@ -444,19 +444,19 @@ Tcl_GetCharLength(
* If numChars is unknown, compute it.
*/
if (numChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numChars)) {
TclNumUtfCharsM(numChars, objPtr->bytes, objPtr->length);
stringPtr->numChars = numChars;
}
return numChars;
}
size_t
Tcl_Size
TclGetCharLength(
Tcl_Obj *objPtr) /* The String object to get the num chars
* of. */
{
size_t numChars = 0;
Tcl_Size numChars = 0;
/*
* Quick, no-shimmer return for short string reps.
@@ -509,7 +509,7 @@ int
TclCheckEmptyString(
Tcl_Obj *objPtr)
{
size_t length = TCL_INDEX_NONE;
Tcl_Size length = TCL_INDEX_NONE;
if (objPtr->bytes == &tclEmptyString) {
return TCL_EMPTYSTRING_YES;
@@ -553,7 +553,7 @@ int
Tcl_GetUniChar(
Tcl_Obj *objPtr, /* The object to get the Unicode charater
* from. */
size_t index) /* Get the index'th Unicode character. */
Tcl_Size index) /* Get the index'th Unicode character. */
{
String *stringPtr;
int ch;
@@ -564,7 +564,7 @@ Tcl_GetUniChar(
*/
if (TclIsPureByteArray(objPtr)) {
size_t length = 0;
Tcl_Size length = 0;
unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &length);
if (index >= length) {
return -1;
@@ -585,7 +585,7 @@ Tcl_GetUniChar(
* If numChars is unknown, compute it.
*/
if (stringPtr->numChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(stringPtr->numChars)) {
TclNumUtfCharsM(stringPtr->numChars, objPtr->bytes, objPtr->length);
}
if (stringPtr->numChars == objPtr->length) {
@@ -622,7 +622,7 @@ int
TclGetUniChar(
Tcl_Obj *objPtr, /* The object to get the Unicode charater
* from. */
size_t index) /* Get the index'th Unicode character. */
Tcl_Size index) /* Get the index'th Unicode character. */
{
int ch = 0;
@@ -632,7 +632,7 @@ TclGetUniChar(
*/
if (TclIsPureByteArray(objPtr)) {
size_t length = 0;
Tcl_Size length = 0;
unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, &length);
if (index >= length) {
return -1;
@@ -641,7 +641,7 @@ TclGetUniChar(
return bytes[index];
}
size_t numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
Tcl_Size numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
if (index >= numChars) {
return -1;
@@ -693,7 +693,7 @@ TclGetUnicodeFromObj(
if (lengthPtr != NULL) {
if (stringPtr->numChars > INT_MAX) {
Tcl_Panic("Tcl_GetUnicodeFromObj with 'int' lengthPtr"
"cannot handle such long strings. Please use 'size_t'");
"cannot handle such long strings. Please use 'Tcl_Size'");
}
*lengthPtr = (int)stringPtr->numChars;
}
@@ -747,14 +747,14 @@ Tcl_GetUnicodeFromObj(
Tcl_Obj *
Tcl_GetRange(
Tcl_Obj *objPtr, /* The Tcl object to find the range of. */
size_t first, /* First index of the range. */
size_t last) /* Last index of the range. */
Tcl_Size first, /* First index of the range. */
Tcl_Size last) /* Last index of the range. */
{
Tcl_Obj *newObjPtr; /* The Tcl object to find the range of. */
String *stringPtr;
size_t length = 0;
Tcl_Size length = 0;
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = TCL_INDEX_START;
}
@@ -788,7 +788,7 @@ Tcl_GetRange(
* If numChars is unknown, compute it.
*/
if (stringPtr->numChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(stringPtr->numChars)) {
TclNumUtfCharsM(stringPtr->numChars, objPtr->bytes, objPtr->length);
}
if (stringPtr->numChars == objPtr->length) {
@@ -838,13 +838,13 @@ Tcl_GetRange(
Tcl_Obj *
TclGetRange(
Tcl_Obj *objPtr, /* The Tcl object to find the range of. */
size_t first, /* First index of the range. */
size_t last) /* Last index of the range. */
Tcl_Size first, /* First index of the range. */
Tcl_Size last) /* Last index of the range. */
{
Tcl_Obj *newObjPtr; /* The Tcl object to find the range of. */
size_t length = 0;
Tcl_Size length = 0;
if (first == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(first)) {
first = TCL_INDEX_START;
}
@@ -866,7 +866,7 @@ TclGetRange(
return Tcl_NewByteArrayObj(bytes + first, last - first + 1);
}
size_t numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
Tcl_Size numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
if (last >= numChars) {
last = numChars - 1;
@@ -906,8 +906,8 @@ 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. */
size_t length) /* The number of bytes to copy from "bytes"
* when initializing the object. If -1,
Tcl_Size length) /* The number of bytes to copy from "bytes"
* when initializing the object. If TCL_INDEX_NONE,
* use bytes up to the first NUL byte.*/
{
if (Tcl_IsShared(objPtr)) {
@@ -926,7 +926,7 @@ Tcl_SetStringObj(
*/
TclInvalidateStringRep(objPtr);
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = (bytes? strlen(bytes) : 0);
}
TclInitStringRep(objPtr, bytes, length);
@@ -959,7 +959,7 @@ void
Tcl_SetObjLength(
Tcl_Obj *objPtr, /* Pointer to object. This object must not
* currently be shared. */
size_t length) /* Number of bytes desired for string
Tcl_Size length) /* Number of bytes desired for string
* representation of object, not including
* terminating null byte. */
{
@@ -1050,7 +1050,7 @@ int
Tcl_AttemptSetObjLength(
Tcl_Obj *objPtr, /* Pointer to object. This object must not
* currently be shared. */
size_t length) /* Number of bytes desired for string
Tcl_Size length) /* Number of bytes desired for string
* representation of object, not including
* terminating null byte. */
{
@@ -1149,7 +1149,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. */
size_t numChars) /* Number of characters in the unicode
Tcl_Size numChars) /* Number of characters in the unicode
* string. */
{
if (Tcl_IsShared(objPtr)) {
@@ -1163,10 +1163,10 @@ static size_t
UnicodeLength(
const Tcl_UniChar *unicode)
{
size_t numChars = 0;
Tcl_Size numChars = 0;
if (unicode) {
while ((numChars != TCL_INDEX_NONE) && (unicode[numChars] != 0)) {
while (!TCL_SIZE_ISNEG(numChars) && (unicode[numChars] != 0)) {
numChars++;
}
}
@@ -1183,8 +1183,8 @@ SetUnicodeObj(
{
String *stringPtr;
if (numChars == TCL_INDEX_NONE) {
numChars = UnicodeLength(unicode);
if (TCL_SIZE_ISNEG(numChars)) {
numChars = UnicodeLength(unicode);
}
/*
@@ -1228,10 +1228,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. */
size_t length, /* The number of bytes available to be
* appended from "bytes". If -1, then
Tcl_Size length, /* The number of bytes available to be
* appended from "bytes". If TCL_INDEX_NONE, then
* all bytes up to a NUL byte are available. */
size_t limit, /* The maximum number of bytes to append to
Tcl_Size 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
@@ -1241,7 +1241,7 @@ Tcl_AppendLimitedToObj(
size_t toCopy = 0;
size_t eLen = 0;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = (bytes ? strlen(bytes) : 0);
}
if (length == 0) {
@@ -1324,7 +1324,7 @@ Tcl_AppendToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const char *bytes, /* Points to the bytes to append to the
* object. */
size_t length) /* The number of bytes to append from "bytes".
Tcl_Size length) /* The number of bytes to append from "bytes".
* If TCL_INDEX_NONE, then append all bytes up to NUL
* byte. */
{
@@ -1353,7 +1353,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. */
size_t length) /* Number of chars in "unicode". */
Tcl_Size length) /* Number of chars in "unicode". */
{
String *stringPtr;
@@ -1407,7 +1407,7 @@ Tcl_AppendObjToObj(
Tcl_Obj *appendObjPtr) /* Object to append. */
{
String *stringPtr;
size_t length = 0, numChars;
Tcl_Size length = 0, numChars;
size_t appendNumChars = TCL_INDEX_NONE;
const char *bytes;
@@ -1448,7 +1448,7 @@ Tcl_AppendObjToObj(
* First, get the lengths.
*/
size_t lengthSrc = 0;
Tcl_Size lengthSrc = 0;
(void) Tcl_GetByteArrayFromObj(objPtr, &length);
(void) Tcl_GetByteArrayFromObj(appendObjPtr, &lengthSrc);
@@ -1520,7 +1520,7 @@ Tcl_AppendObjToObj(
bytes = Tcl_GetStringFromObj(appendObjPtr, &length);
numChars = stringPtr->numChars;
if ((numChars != TCL_INDEX_NONE) && TclHasInternalRep(appendObjPtr, &tclStringType)) {
if (!TCL_SIZE_ISNEG(numChars) && TclHasInternalRep(appendObjPtr, &tclStringType)) {
String *appendStringPtr = GET_STRING(appendObjPtr);
appendNumChars = appendStringPtr->numChars;
@@ -1528,7 +1528,7 @@ Tcl_AppendObjToObj(
AppendUtfToUtfRep(objPtr, bytes, length);
if ((numChars != TCL_INDEX_NONE) && (appendNumChars != TCL_INDEX_NONE)) {
if (!TCL_SIZE_ISNEG(numChars) && !TCL_SIZE_ISNEG(appendNumChars)) {
stringPtr->numChars = numChars + appendNumChars;
}
}
@@ -1559,7 +1559,7 @@ AppendUnicodeToUnicodeRep(
String *stringPtr;
size_t numChars;
if (appendNumChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(appendNumChars)) {
appendNumChars = UnicodeLength(unicode);
}
if (appendNumChars == 0) {
@@ -1600,7 +1600,7 @@ AppendUnicodeToUnicodeRep(
* Relocate unicode if needed; see above.
*/
if (index != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(index)) {
unicode = stringPtr->unicode + index;
}
}
@@ -1648,7 +1648,7 @@ AppendUnicodeToUtfRep(
numChars = ExtendStringRepWithUnicode(objPtr, unicode, numChars);
if (stringPtr->numChars != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(stringPtr->numChars)) {
stringPtr->numChars += numChars;
}
}
@@ -1757,7 +1757,7 @@ AppendUtfToUtfRep(
* Relocate bytes if needed; see above.
*/
if (offset != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(offset)) {
bytes = objPtr->bytes + offset;
}
}
@@ -1842,12 +1842,12 @@ Tcl_AppendFormatToObj(
Tcl_Interp *interp,
Tcl_Obj *appendObj,
const char *format,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[])
{
const char *span = format, *msg, *errCode;
int gotXpg = 0, gotSequential = 0;
size_t objIndex = 0, originalLength, limit, numBytes = 0;
Tcl_Size objIndex = 0, originalLength, limit, numBytes = 0;
Tcl_UniChar ch = 0;
static const char *mixedXPG =
"cannot mix \"%\" and \"%n$\" conversion specifiers";
@@ -2247,7 +2247,7 @@ Tcl_AppendFormatToObj(
switch (ch) {
case 'd': {
size_t length;
Tcl_Size length;
Tcl_Obj *pure;
const char *bytes;
@@ -2320,7 +2320,7 @@ Tcl_AppendFormatToObj(
Tcl_WideUInt bits = 0;
Tcl_WideInt numDigits = 0;
int numBits = 4, base = 16, index = 0, shift = 0;
size_t length;
Tcl_Size length;
Tcl_Obj *pure;
char *bytes;
@@ -2614,7 +2614,7 @@ Tcl_Obj *
Tcl_Format(
Tcl_Interp *interp,
const char *format,
size_t objc,
Tcl_Size objc,
Tcl_Obj *const objv[])
{
int result;
@@ -2895,7 +2895,7 @@ Tcl_ObjPrintf(
char *
TclGetStringStorage(
Tcl_Obj *objPtr,
size_t *sizePtr)
Tcl_Size *sizePtr)
{
String *stringPtr;
@@ -2934,7 +2934,7 @@ TclStringRepeat(
{
Tcl_Obj *objResultPtr;
int inPlace = flags & TCL_STRING_IN_PLACE;
size_t length = 0, unichar = 0, done = 1;
Tcl_Size length = 0, unichar = 0, done = 1;
int binary = TclIsPureByteArray(objPtr);
size_t maxCount;
@@ -3090,7 +3090,7 @@ TclStringCat(
{
Tcl_Obj *objResultPtr, * const *ov;
int oc, binary = 1;
size_t length = 0;
Tcl_Size length = 0;
int allowUniChar = 1, requestUniChar = 0, forceUniChar = 0;
int first = objc - 1; /* Index of first value possibly not empty */
int last = 0; /* Index of last value possibly not empty */
@@ -3474,7 +3474,7 @@ TclStringCmp(
{
const char *s1, *s2;
int empty, match;
size_t length, s1len = 0, s2len = 0;
Tcl_Size length, s1len = 0, s2len = 0;
memCmpFn_t memCmpFn;
if ((reqlength == 0) || (value1Ptr == value2Ptr)) {
@@ -3534,7 +3534,7 @@ TclStringCmp(
memCmpFn = memcmp;
s1len *= sizeof(Tcl_UniChar);
s2len *= sizeof(Tcl_UniChar);
if (reqlength != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(reqlength)) {
reqlength *= sizeof(Tcl_UniChar);
}
} else {
@@ -3578,7 +3578,7 @@ TclStringCmp(
s1 = Tcl_GetStringFromObj(value1Ptr, &s1len);
s2 = Tcl_GetStringFromObj(value2Ptr, &s2len);
}
if (!nocase && checkEq && reqlength == TCL_INDEX_NONE) {
if (!nocase && checkEq && TCL_SIZE_ISNEG(reqlength)) {
/*
* When we have equal-length we can check only for
* (in)equality. We can use memcmp in all (n)eq cases because
@@ -3595,7 +3595,7 @@ TclStringCmp(
* length was requested.
*/
if ((reqlength == TCL_INDEX_NONE) && !nocase) {
if (TCL_SIZE_ISNEG(reqlength) && !nocase) {
memCmpFn = (memCmpFn_t) TclpUtfNcmp2;
} else {
s1len = Tcl_NumUtfChars(s1, s1len);
@@ -3611,7 +3611,7 @@ TclStringCmp(
* comparison function.
*/
length = (s1len < s2len) ? s1len : s2len;
if (reqlength == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(reqlength)) {
/*
* The requested length is negative, so ignore it by setting it
* to length + 1 to correct the match var.
@@ -3622,7 +3622,7 @@ TclStringCmp(
length = reqlength;
}
if (checkEq && reqlength == TCL_INDEX_NONE && (s1len != s2len)) {
if (checkEq && TCL_SIZE_ISNEG(reqlength) && (s1len != s2len)) {
match = 1; /* This will be reversed below. */
} else {
/*
@@ -3670,7 +3670,7 @@ TclStringFirst(
Tcl_UniChar *checkStr, *endStr, *uh, *un;
Tcl_Obj *obj;
if (start == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(start)) {
start = 0;
}
if (ln == 0) {
@@ -3981,7 +3981,7 @@ TclStringReverse(
}
to = objPtr->bytes;
if ((numChars == TCL_INDEX_NONE) || (numChars < numBytes)) {
if (TCL_SIZE_ISNEG(numChars) || (numChars < numBytes)) {
/*
* Either numChars == -1 and we don't know how many chars are
* represented by objPtr->bytes and we need Pass 1 just in case,
@@ -4202,7 +4202,7 @@ ExtendUnicodeRepWithString(
if (stringPtr->hasUnicode) {
numOrigChars = stringPtr->numChars;
}
if (numAppendChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numAppendChars)) {
TclNumUtfCharsM(numAppendChars, bytes, numBytes);
}
needed = numOrigChars + numAppendChars;
@@ -4258,7 +4258,7 @@ DupStringInternalRep(
String *srcStringPtr = GET_STRING(srcPtr);
String *copyStringPtr = NULL;
if (srcStringPtr->numChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(srcStringPtr->numChars)) {
/*
* The String struct in the source value holds zero useful data. Don't
* bother copying it. Don't even bother allocating space in which to
@@ -4408,7 +4408,7 @@ ExtendStringRepWithUnicode(
char *dst;
String *stringPtr = GET_STRING(objPtr);
if (numChars == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(numChars)) {
numChars = UnicodeLength(unicode);
}
+10 -9
View File
@@ -16,6 +16,7 @@
*/
#undef STATIC_BUILD
#undef BUILD_tcl
#ifndef USE_TCL_STUBS
# define USE_TCL_STUBS
#endif
@@ -2234,7 +2235,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[] = {
@@ -4540,7 +4541,7 @@ TestregexpObjCmd(
if (indices) {
Tcl_Obj *objs[2];
if (ii == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(ii)) {
TclRegExpRangeUniChar(regExpr, ii, &start, &end);
} else if (ii > info.nsubs) {
start = TCL_INDEX_NONE;
@@ -4555,12 +4556,12 @@ TestregexpObjCmd(
* instead of the first character after the match.
*/
if (end != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(end)) {
end--;
}
objs[0] = Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(start + 1U)) - 1);
objs[1] = Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(end + 1U)) - 1);
objs[0] = Tcl_NewWideIntObj((Tcl_WideInt)start);
objs[1] = Tcl_NewWideIntObj((Tcl_WideInt)end);
newPtr = Tcl_NewListObj(2, objs);
} else {
@@ -5669,7 +5670,7 @@ TestbytestringObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
size_t n = 0;
Tcl_Size n = 0;
const char *p;
if (objc != 2) {
@@ -7836,9 +7837,9 @@ TestNRELevels(
depth = (refDepth - &depth);
levels[0] = Tcl_NewWideIntObj(depth);
levels[1] = Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(iPtr->numLevels + 1U)) - 1);
levels[2] = Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(iPtr->cmdFramePtr->level + 1U)) - 1);
levels[3] = Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(iPtr->varFramePtr->level + 1U)) - 1);
levels[1] = Tcl_NewWideIntObj((Tcl_WideInt)iPtr->numLevels);
levels[2] = Tcl_NewWideIntObj((Tcl_WideInt)iPtr->cmdFramePtr->level);
levels[3] = Tcl_NewWideIntObj((Tcl_WideInt)iPtr->varFramePtr->level);
levels[4] = Tcl_NewWideIntObj(iPtr->execEnvPtr->execStackPtr->tosPtr
- iPtr->execEnvPtr->execStackPtr->stackWords);
+1 -1
View File
@@ -61,7 +61,7 @@ static void RememberSyncObject(void *objPtr,
void *
Tcl_GetThreadData(
Tcl_ThreadDataKey *keyPtr, /* Identifier for the data chunk */
size_t size) /* Size of storage block */
Tcl_Size size) /* Size of storage block */
{
void *result;
#if TCL_THREADS
+3 -3
View File
@@ -57,7 +57,7 @@ typedef union Block {
unsigned char magic2; /* Second magic number. */
} s;
} u;
size_t reqSize; /* Requested allocation size. */
TCL_HASH_TYPE reqSize; /* Requested allocation size. */
} b;
unsigned char padding[TCL_ALLOCALIGN];
} Block;
@@ -300,7 +300,7 @@ TclFreeAllocCache(
void *
TclpAlloc(
size_t reqSize)
TCL_HASH_TYPE reqSize)
{
Cache *cachePtr;
Block *blockPtr;
@@ -424,7 +424,7 @@ TclpFree(
void *
TclpRealloc(
void *ptr,
size_t reqSize)
TCL_HASH_TYPE reqSize)
{
Cache *cachePtr;
Block *blockPtr;
+1
View File
@@ -16,6 +16,7 @@
#ifndef USE_TCL_STUBS
# define USE_TCL_STUBS
#endif
#undef BUILD_tcl
#include "tclInt.h"
#if TCL_THREADS
+43 -43
View File
@@ -205,7 +205,7 @@ Invalid(
*/
#undef Tcl_UniCharToUtf
size_t
Tcl_Size
Tcl_UniCharToUtf(
int ch, /* The Tcl_UniChar to be stored in the
* buffer. Can be or'ed with flag TCL_COMBINE
@@ -318,7 +318,7 @@ three:
char *
Tcl_UniCharToUtfDString(
const int *uniStr, /* Unicode string to convert to UTF-8. */
size_t uniLength, /* Length of Unicode string. */
Tcl_Size uniLength, /* Length of Unicode string. */
Tcl_DString *dsPtr) /* UTF-8 representation of string is appended
* to this previously initialized DString. */
{
@@ -333,7 +333,7 @@ Tcl_UniCharToUtfDString(
if (uniStr == NULL) {
return NULL;
}
if (uniLength == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(uniLength)) {
uniLength = 0;
w = uniStr;
while (*w != '\0') {
@@ -359,13 +359,13 @@ Tcl_UniCharToUtfDString(
char *
Tcl_Char16ToUtfDString(
const unsigned short *uniStr,/* Utf-16 string to convert to UTF-8. */
size_t uniLength, /* Length of Utf-16 string. */
Tcl_Size uniLength, /* Length of Utf-16 string. */
Tcl_DString *dsPtr) /* UTF-8 representation of string is appended
* to this previously initialized DString. */
{
const unsigned short *w, *wEnd;
char *p, *string;
size_t oldLength;
Tcl_Size oldLength;
int len = 1;
/*
@@ -375,7 +375,7 @@ Tcl_Char16ToUtfDString(
if (uniStr == NULL) {
return NULL;
}
if (uniLength == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(uniLength)) {
uniLength = 0;
w = uniStr;
@@ -453,7 +453,7 @@ static const unsigned short cp1252[32] = {
};
#undef Tcl_UtfToUniChar
size_t
Tcl_Size
Tcl_UtfToUniChar(
const char *src, /* The UTF-8 string. */
int *chPtr)/* Filled with the Unicode character represented by
@@ -536,7 +536,7 @@ Tcl_UtfToUniChar(
return 1;
}
size_t
Tcl_Size
Tcl_UtfToChar16(
const char *src, /* The UTF-8 string. */
unsigned short *chPtr)/* Filled with the Tcl_UniChar represented by
@@ -657,7 +657,7 @@ Tcl_UtfToChar16(
int *
Tcl_UtfToUniCharDString(
const char *src, /* UTF-8 string to convert to Unicode. */
size_t length, /* Length of UTF-8 string in bytes, or -1 for
Tcl_Size 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
@@ -665,7 +665,7 @@ Tcl_UtfToUniCharDString(
{
int ch = 0, *w, *wString;
const char *p;
size_t oldLength;
Tcl_Size oldLength;
/* Pointer to the end of string. Never read endPtr[0] */
const char *endPtr = src + length;
/* Pointer to last byte where optimization still can be used */
@@ -674,7 +674,7 @@ Tcl_UtfToUniCharDString(
if (src == NULL) {
return NULL;
}
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = strlen(src);
}
@@ -714,7 +714,7 @@ Tcl_UtfToUniCharDString(
unsigned short *
Tcl_UtfToChar16DString(
const char *src, /* UTF-8 string to convert to Unicode. */
size_t length, /* Length of UTF-8 string in bytes, or -1 for
Tcl_Size 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
@@ -722,7 +722,7 @@ Tcl_UtfToChar16DString(
{
unsigned short ch = 0, *w, *wString;
const char *p;
size_t oldLength;
Tcl_Size oldLength;
/* Pointer to the end of string. Never read endPtr[0] */
const char *endPtr = src + length;
/* Pointer to last byte where optimization still can be used */
@@ -731,7 +731,7 @@ Tcl_UtfToChar16DString(
if (src == NULL) {
return NULL;
}
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = strlen(src);
}
@@ -792,7 +792,7 @@ int
Tcl_UtfCharComplete(
const char *src, /* String to check if first few bytes contain
* a complete UTF-8 character. */
size_t length) /* Length of above string in bytes. */
Tcl_Size length) /* Length of above string in bytes. */
{
return length >= complete[UCHAR(*src)];
}
@@ -815,16 +815,16 @@ Tcl_UtfCharComplete(
*---------------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_NumUtfChars(
const char *src, /* The UTF-8 string to measure. */
size_t length) /* The length of the string in bytes, or
Tcl_Size length) /* The length of the string in bytes, or
* TCL_INDEX_NONE for strlen(src). */
{
Tcl_UniChar ch = 0;
size_t i = 0;
Tcl_Size i = 0;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
/* string is NUL-terminated, so TclUtfToUniChar calls are safe. */
while (*src != '\0') {
src += TclUtfToUniChar(src, &ch);
@@ -867,16 +867,16 @@ Tcl_NumUtfChars(
return i;
}
size_t
Tcl_Size
TclNumUtfChars(
const char *src, /* The UTF-8 string to measure. */
size_t length) /* The length of the string in bytes, or
Tcl_Size length) /* The length of the string in bytes, or
* TCL_INDEX_NONE for strlen(src). */
{
unsigned short ch = 0;
size_t i = 0;
Tcl_Size i = 0;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
/* string is NUL-terminated, so TclUtfToUniChar calls are safe. */
while (*src != '\0') {
src += Tcl_UtfToChar16(src, &ch);
@@ -1194,12 +1194,12 @@ Tcl_UtfPrev(
int
Tcl_UniCharAtIndex(
const char *src, /* The UTF-8 string to dereference. */
size_t index) /* The position of the desired character. */
Tcl_Size index) /* The position of the desired character. */
{
Tcl_UniChar ch = 0;
int i = 0;
if (index == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(index)) {
return -1;
}
while (index--) {
@@ -1238,11 +1238,11 @@ Tcl_UniCharAtIndex(
const char *
Tcl_UtfAtIndex(
const char *src, /* The UTF-8 string. */
size_t index) /* The position of the desired character. */
Tcl_Size index) /* The position of the desired character. */
{
int ch = 0;
if (index != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(index)) {
while (index--) {
/* Make use of the #undef Tcl_UtfToUniChar above, which already handles UCS4. */
src += Tcl_UtfToUniChar(src, &ch);
@@ -1254,12 +1254,12 @@ Tcl_UtfAtIndex(
const char *
TclUtfAtIndex(
const char *src, /* The UTF-8 string. */
size_t index) /* The position of the desired character. */
Tcl_Size index) /* The position of the desired character. */
{
unsigned short ch = 0;
size_t len = 0;
Tcl_Size len = 0;
if (index != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(index)) {
while (index--) {
src += (len = Tcl_UtfToChar16(src, &ch));
}
@@ -1297,7 +1297,7 @@ TclUtfAtIndex(
*---------------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_UtfBackslash(
const char *src, /* Points to the backslash character of a
* backslash sequence. */
@@ -1341,13 +1341,13 @@ Tcl_UtfBackslash(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_UtfToUpper(
char *str) /* String to convert in place. */
{
int ch, upChar;
char *src, *dst;
size_t len;
Tcl_Size len;
/*
* Iterate over the string until we hit the terminating null.
@@ -1394,13 +1394,13 @@ Tcl_UtfToUpper(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_UtfToLower(
char *str) /* String to convert in place. */
{
int ch, lowChar;
char *src, *dst;
size_t len;
Tcl_Size len;
/*
* Iterate over the string until we hit the terminating null.
@@ -1448,13 +1448,13 @@ Tcl_UtfToLower(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_UtfToTitle(
char *str) /* String to convert in place. */
{
int ch, titleChar, lowChar;
char *src, *dst;
size_t len;
Tcl_Size len;
/*
* Capitalize the first character and then lowercase the rest of the
@@ -1870,11 +1870,11 @@ Tcl_UniCharToTitle(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
Tcl_Char16Len(
const unsigned short *uniStr) /* Unicode string to find length of. */
{
size_t len = 0;
Tcl_Size len = 0;
while (*uniStr != '\0') {
len++;
@@ -1901,11 +1901,11 @@ Tcl_Char16Len(
*/
#undef Tcl_UniCharLen
size_t
Tcl_Size
Tcl_UniCharLen(
const int *uniStr) /* Unicode string to find length of. */
{
size_t len = 0;
Tcl_Size len = 0;
while (*uniStr != '\0') {
len++;
@@ -2563,10 +2563,10 @@ TclUniCharCaseMatch(
int
TclUniCharMatch(
const Tcl_UniChar *string, /* Unicode String. */
size_t strLen, /* Length of String */
Tcl_Size strLen, /* Length of String */
const Tcl_UniChar *pattern, /* Pattern, which may contain special
* characters. */
size_t ptnLen, /* Length of Pattern */
Tcl_Size ptnLen, /* Length of Pattern */
int nocase) /* 0 for case sensitive, 1 for insensitive */
{
const Tcl_UniChar *stringEnd, *patternEnd;
+15 -15
View File
@@ -402,7 +402,7 @@ TclMaxListLength(
{
Tcl_Size count = 0;
if ((numBytes == 0) || ((numBytes == TCL_INDEX_NONE) && (*bytes == '\0'))) {
if ((numBytes == 0) || (TCL_SIZE_ISNEG(numBytes) && (*bytes == '\0'))) {
/* Empty string case - quick exit */
goto done;
}
@@ -418,7 +418,7 @@ TclMaxListLength(
*/
while (numBytes) {
if ((numBytes == TCL_INDEX_NONE) && (*bytes == '\0')) {
if (TCL_SIZE_ISNEG(numBytes) && (*bytes == '\0')) {
break;
}
if (TclIsSpaceProcM(*bytes)) {
@@ -429,9 +429,9 @@ TclMaxListLength(
count++;
do {
bytes++;
numBytes -= (numBytes != TCL_INDEX_NONE);
numBytes -= !TCL_SIZE_ISNEG(numBytes);
} while (numBytes && TclIsSpaceProcM(*bytes));
if ((numBytes == 0) || ((numBytes == TCL_INDEX_NONE) && (*bytes == '\0'))) {
if ((numBytes == 0) || (TCL_SIZE_ISNEG(numBytes) && (*bytes == '\0'))) {
break;
}
@@ -440,7 +440,7 @@ TclMaxListLength(
*/
}
bytes++;
numBytes -= (numBytes != TCL_INDEX_NONE);
numBytes -= !TCL_SIZE_ISNEG(numBytes);
}
/*
@@ -1037,7 +1037,7 @@ TclScanElement(
int extra = 0; /* Count of number of extra bytes needed for
* formatted element, assuming we use escape
* sequences in formatting. */
TCL_HASH_TYPE bytesNeeded; /* Buffer length computed to complete the
Tcl_Size bytesNeeded; /* Buffer length computed to complete the
* element formatting in the selected mode. */
#if COMPAT
int preferEscape = 0; /* Use preferences to track whether to use */
@@ -1045,7 +1045,7 @@ TclScanElement(
int braceCount = 0; /* Count of all braces '{' '}' seen. */
#endif /* COMPAT */
if ((p == NULL) || (length == 0) || ((*p == '\0') && (length == TCL_INDEX_NONE))) {
if ((p == NULL) || (length == 0) || ((*p == '\0') && TCL_SIZE_ISNEG(length))) {
/*
* Empty string element must be brace quoted.
*/
@@ -1127,7 +1127,7 @@ TclScanElement(
break;
case '\\': /* TYPE_SUBS */
extra++; /* Escape '\' => '\\' */
if ((length == 1) || ((length == TCL_INDEX_NONE) && (p[1] == '\0'))) {
if ((length == 1) || (TCL_SIZE_ISNEG(length) && (p[1] == '\0'))) {
/*
* Final backslash. Cannot format with brace quoting.
*/
@@ -1158,7 +1158,7 @@ TclScanElement(
#endif /* COMPAT */
break;
case '\0': /* TYPE_SUBS */
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
goto endOfString;
}
/* TODO: Panic on improper encoding? */
@@ -1407,7 +1407,7 @@ TclConvertElement(
* No matter what the caller demands, empty string must be braced!
*/
if ((src == NULL) || (length == 0) || (*src == '\0' && length == TCL_INDEX_NONE)) {
if ((src == NULL) || (length == 0) || (*src == '\0' && TCL_SIZE_ISNEG(length))) {
p[0] = '{';
p[1] = '}';
return 2;
@@ -1434,7 +1434,7 @@ TclConvertElement(
*/
if (conversion == CONVERT_NONE) {
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
/* TODO: INT_MAX overflow? */
while (*src) {
*p++ = *src++;
@@ -1453,7 +1453,7 @@ TclConvertElement(
if (conversion == CONVERT_BRACE) {
*p = '{';
p++;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
/* TODO: INT_MAX overflow? */
while (*src) {
*p++ = *src++;
@@ -1526,7 +1526,7 @@ TclConvertElement(
p++;
continue;
case '\0':
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
return (Tcl_Size)(p - dst);
}
@@ -2584,7 +2584,7 @@ Tcl_DStringAppend(
{
Tcl_Size newSize;
if (length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(length)) {
length = strlen(bytes);
}
newSize = length + dsPtr->length;
@@ -2613,7 +2613,7 @@ Tcl_DStringAppend(
dsPtr->string = (char *)Tcl_Realloc(dsPtr->string, dsPtr->spaceAvl);
if (index != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(index)) {
bytes = dsPtr->string + index;
}
}
+1 -1
View File
@@ -611,7 +611,7 @@ TclObjLookupVarEx(
restart:
LocalGetInternalRep(part1Ptr, localIndex, namePtr);
if (localIndex != TCL_INDEX_NONE) {
if (!TCL_SIZE_ISNEG(localIndex)) {
if (HasLocalVars(varFramePtr)
&& !(flags & (TCL_GLOBAL_ONLY | TCL_NAMESPACE_ONLY))
&& (localIndex < varFramePtr->numCompiledLocals)) {
+6 -6
View File
@@ -1382,7 +1382,7 @@ ZipFSOpenArchive(
*/
zf->length = Tcl_Seek(zf->chan, 0, SEEK_END);
if (zf->length == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(zf->length)) {
ZIPFS_POSIX_ERROR(interp, "seek error");
goto error;
}
@@ -1481,7 +1481,7 @@ ZipMapArchive(
*/
zf->length = lseek(fd, 0, SEEK_END);
if (zf->length == TCL_INDEX_NONE || zf->length < ZIP_CENTRAL_END_LEN) {
if (TCL_SIZE_ISNEG(zf->length) || zf->length < ZIP_CENTRAL_END_LEN) {
ZIPFS_POSIX_ERROR(interp, "invalid file size");
return TCL_ERROR;
}
@@ -2578,7 +2578,7 @@ ZipAddFile(
nbyte = nbytecompr = 0;
while (1) {
len = Tcl_Read(in, buf, bufsize);
if (len == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(len)) {
Tcl_DStringFree(&zpathDs);
if (nbyte == 0 && errno == EISDIR) {
Tcl_Close(interp, in);
@@ -2708,7 +2708,7 @@ ZipAddFile(
do {
len = Tcl_Read(in, buf, bufsize);
if (len == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(len)) {
deflateEnd(&stream);
goto readErrorWithChannelOpen;
}
@@ -2772,7 +2772,7 @@ ZipAddFile(
nbytecompr = (passwd ? 12 : 0);
while (1) {
len = Tcl_Read(in, buf, bufsize);
if (len == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(len)) {
goto readErrorWithChannelOpen;
} else if (len == 0) {
break;
@@ -3298,7 +3298,7 @@ CopyImageFile(
*/
i = Tcl_Seek(in, 0, SEEK_END);
if (i == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(i)) {
errMsg = "seek error";
goto copyError;
}
+9 -9
View File
@@ -1359,15 +1359,15 @@ int
Tcl_ZlibStreamGet(
Tcl_ZlibStream zshandle, /* As obtained from Tcl_ZlibStreamInit */
Tcl_Obj *data, /* A place to append the data. */
size_t count) /* Number of bytes to grab as a maximum, you
Tcl_Size count) /* Number of bytes to grab as a maximum, you
* may get less! */
{
ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle;
int e;
size_t listLen, i, itemLen = 0, dataPos = 0;
Tcl_Size listLen, i, itemLen = 0, dataPos = 0;
Tcl_Obj *itemObj;
unsigned char *dataPtr, *itemPtr;
size_t existing = 0;
Tcl_Size existing = 0;
/*
* Getting beyond the of stream, just return empty string.
@@ -1382,7 +1382,7 @@ Tcl_ZlibStreamGet(
}
if (zshPtr->mode == TCL_ZLIB_STREAM_INFLATE) {
if (count == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(count)) {
/*
* The only safe thing to do is restict to 65k. We might cause a
* panic for out of memory if we just kept growing the buffer.
@@ -1539,7 +1539,7 @@ Tcl_ZlibStreamGet(
}
} else {
TclListObjLengthM(NULL, zshPtr->outData, &listLen);
if (count == TCL_INDEX_NONE) {
if (TCL_SIZE_ISNEG(count)) {
count = 0;
for (i=0; i<listLen; i++) {
Tcl_ListObjIndex(NULL, zshPtr->outData, i, &itemObj);
@@ -1767,7 +1767,7 @@ Tcl_ZlibInflate(
Tcl_Interp *interp,
int format,
Tcl_Obj *data,
size_t bufferSize,
Tcl_Size bufferSize,
Tcl_Obj *gzipHeaderDictObj)
{
int wbits = 0, e = 0;
@@ -1956,7 +1956,7 @@ unsigned int
Tcl_ZlibCRC32(
unsigned int crc,
const unsigned char *buf,
size_t len)
Tcl_Size len)
{
/* Nothing much to do, just wrap the crc32(). */
return crc32(crc, (Bytef *) buf, len);
@@ -1966,7 +1966,7 @@ unsigned int
Tcl_ZlibAdler32(
unsigned int adler,
const unsigned char *buf,
size_t len)
Tcl_Size len)
{
return adler32(adler, (Bytef *) buf, len);
}
@@ -4081,7 +4081,7 @@ int
Tcl_ZlibStreamGet(
Tcl_ZlibStream zshandle,
Tcl_Obj *data,
size_t count)
Tcl_Size count)
{
return TCL_OK;
}
+4 -3
View File
@@ -24,6 +24,7 @@ testConstraint testobj [llength [info commands testobj]]
testConstraint testbytestring [llength [info commands testbytestring]]
testConstraint testdstring [llength [info commands testdstring]]
testConstraint utf32 [expr {[string length \U010000] == 1}]
testConstraint pointerIs32bit [expr {$tcl_platform(pointerSize) == 4}]
test stringObj-1.1 {string type registration} testobj {
set t [testobj types]
@@ -504,7 +505,7 @@ test stringObj-16.7 {Tcl_GetRange: first = UINT_MAX-1} testobj {
teststringobj set 1 abcde
teststringobj range 1 0xFFFFFFFE 3
} {}
test stringObj-16.8 {Tcl_GetRange: first = SIZE_MAX-1} testobj {
test stringObj-16.8 {Tcl_GetRange: first = -2} {testobj pointerIs32bit} {
teststringobj set 1 abcde
teststringobj range 1 -2 3
} {}
@@ -520,11 +521,11 @@ test stringObj-16.11 {Tcl_GetRange: first = last = UINT_MAX-1} testobj {
teststringobj set 1 abcde
teststringobj range 1 0xFFFFFFFE 0xFFFFFFFE
} {}
test stringObj-16.12 {Tcl_GetRange: first = last = SIZE_MAX-1} testobj {
test stringObj-16.12 {Tcl_GetRange: first = last = SIZE_MAX-1} {testobj pointerIs32bit} {
teststringobj set 1 abcde
teststringobj range 1 -2 -2
} {}
if {[testConstraint testobj]} {
testobj freeallvars
}
+5 -5
View File
@@ -16,10 +16,10 @@
static int TraceProc2 (
void *clientData,
Tcl_Interp *interp,
size_t level,
ptrdiff_t level,
const char *command,
Tcl_Command commandInfo,
size_t objc,
ptrdiff_t objc,
struct Tcl_Obj *const *objv)
{
(void)clientData;
@@ -55,12 +55,12 @@ static int
Pkgt_EqObjCmd2(
void *dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
size_t objc, /* Number of arguments. */
ptrdiff_t objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_WideInt result;
const char *str1, *str2;
size_t len1, len2;
ptrdiff_t len1, len2;
(void)dummy;
if (objc != 3) {
@@ -71,7 +71,7 @@ Pkgt_EqObjCmd2(
str1 = Tcl_GetStringFromObj(objv[1], &len1);
str2 = Tcl_GetStringFromObj(objv[2], &len2);
if (len1 == len2) {
result = (Tcl_UtfNcmp(str1, str2, len1) == 0);
result = (Tcl_UtfNcmp(str1, str2, (size_t)len1) == 0);
} else {
result = 0;
}
+2 -2
View File
@@ -596,7 +596,7 @@ TtySetOptionProc(
TtyState *fsPtr = (TtyState *)instanceData;
size_t len, vlen;
TtyAttrs tty;
size_t argc;
Tcl_Size argc;
const char **argv;
struct termios iostate;
@@ -732,7 +732,7 @@ TtySetOptionProc(
if ((len > 4) && (strncmp(optionName, "-ttycontrol", len) == 0)) {
#if defined(TIOCMGET) && defined(TIOCMSET)
int control, flag;
size_t i;
Tcl_Size i;
if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) {
return TCL_ERROR;
+5 -5
View File
@@ -455,7 +455,7 @@ TclpInitPlatform(void)
void
TclpInitLibraryPath(
char **valuePtr,
size_t *lengthPtr,
Tcl_Size *lengthPtr,
Tcl_Encoding *encodingPtr)
{
#define LIBRARY_SIZE 32
@@ -478,7 +478,7 @@ TclpInitLibraryPath(
if ((str != NULL) && (str[0] != '\0')) {
Tcl_DString ds;
size_t pathc;
Tcl_Size pathc;
const char **pathv;
char installLib[LIBRARY_SIZE];
@@ -1012,16 +1012,16 @@ TclpSetVariables(
*----------------------------------------------------------------------
*/
size_t
Tcl_Size
TclpFindVariable(
const char *name, /* Name of desired environment variable
* (native). */
size_t *lengthPtr) /* Used to return length of name (for
Tcl_Size *lengthPtr) /* Used to return length of name (for
* successful searches) or number of non-NULL
* entries in environ (for unsuccessful
* searches). */
{
size_t i, result = TCL_INDEX_NONE;
Tcl_Size i, result = TCL_INDEX_NONE;
const char *env, *p1, *p2;
Tcl_DString envString;
+1 -1
View File
@@ -216,7 +216,7 @@ printaddrinfo(
static void
InitializeHostName(
char **valuePtr,
size_t *lengthPtr,
TCL_HASH_TYPE *lengthPtr,
Tcl_Encoding *encodingPtr)
{
const char *native = NULL;
+1
View File
@@ -13,6 +13,7 @@
#ifndef USE_TCL_STUBS
# define USE_TCL_STUBS
#endif
#undef BUILD_tcl
#include "tclInt.h"
/*
+1 -1
View File
@@ -214,7 +214,7 @@ TclpThreadCreate(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
void *clientData, /* The one argument to Main() */
size_t stackSize, /* Size of stack for the new thread */
Tcl_Size stackSize, /* Size of stack for the new thread */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
+1
View File
@@ -12,6 +12,7 @@
#ifndef USE_TCL_STUBS
# define USE_TCL_STUBS
#endif
#undef BUILD_tcl
#include <X11/Intrinsic.h>
#include "tcl.h"
+2 -2
View File
@@ -256,7 +256,7 @@ ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@
CC_SWITCHES = -I"${BUILD_DIR}" -I"${GENERIC_DIR_NATIVE}" -I"${TOMMATH_DIR_NATIVE}" \
-I"${ZLIB_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \
${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} -DMP_PREC=4 \
${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} -DMP_PREC=4 -DTCL_UNSIGNED_SIZE \
${AC_FLAGS} ${COMPILE_DEBUG_FLAGS} ${NO_DEPRECATED_FLAGS}
CC_OBJNAME = @CC_OBJNAME@
@@ -264,7 +264,7 @@ CC_EXENAME = @CC_EXENAME@
STUB_CC_SWITCHES = -I"${GENERIC_DIR_NATIVE}" -I"${TOMMATH_DIR_NATIVE}" \
-I"${ZLIB_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \
${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} -DMP_PREC=4 \
${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} -DMP_PREC=4 -DTCL_UNSIGNED_SIZE \
${AC_FLAGS} ${COMPILE_DEBUG_FLAGS}
TCLTEST_OBJS = \
+7 -7
View File
@@ -124,14 +124,14 @@ TclpInitPlatform(void)
void
TclpInitLibraryPath(
char **valuePtr,
size_t *lengthPtr,
TCL_HASH_TYPE *lengthPtr,
Tcl_Encoding *encodingPtr)
{
#define LIBRARY_SIZE 64
Tcl_Obj *pathPtr;
char installLib[LIBRARY_SIZE];
const char *bytes;
size_t length;
TCL_HASH_TYPE length;
TclNewObj(pathPtr);
@@ -284,7 +284,7 @@ AppendEnvironment(
static void
InitializeDefaultLibraryDir(
char **valuePtr,
size_t *lengthPtr,
TCL_HASH_TYPE *lengthPtr,
Tcl_Encoding *encodingPtr)
{
HMODULE hModule = (HMODULE)TclWinGetTclInstance();
@@ -332,7 +332,7 @@ InitializeDefaultLibraryDir(
static void
InitializeSourceLibraryDir(
char **valuePtr,
size_t *lengthPtr,
TCL_HASH_TYPE *lengthPtr,
Tcl_Encoding *encodingPtr)
{
HMODULE hModule = (HMODULE)TclWinGetTclInstance();
@@ -569,16 +569,16 @@ TclpSetVariables(
# define tenviron2utfdstr(string, len, dsPtr) \
(char *)Tcl_Char16ToUtfDString((const unsigned short *)(string), ((((len) + 2) >> 1) - 1), (dsPtr))
size_t
Tcl_Size
TclpFindVariable(
const char *name, /* Name of desired environment variable
* (UTF-8). */
size_t *lengthPtr) /* Used to return length of name (for
Tcl_Size *lengthPtr) /* Used to return length of name (for
* successful searches) or number of non-NULL
* entries in environ (for unsuccessful
* searches). */
{
size_t i, length, result = TCL_INDEX_NONE;
Tcl_Size i, length, result = TCL_INDEX_NONE;
const WCHAR *env;
const char *p1, *p2;
char *envUpper, *nameUpper;
+17 -17
View File
@@ -785,7 +785,7 @@ SerialBlockingWrite(
ResetEvent(osPtr->hEvent);
EnterCriticalSection(&infoPtr->csWrite);
infoPtr->writeQueue -= bufSize;
infoPtr->writeQueue -= (int)bufSize;
/*
* Set Offset to ZERO, otherwise NT4.0 may report an error
@@ -829,7 +829,7 @@ SerialBlockingWrite(
}
EnterCriticalSection(&infoPtr->csWrite);
infoPtr->writeQueue += (*lpWritten - bufSize);
infoPtr->writeQueue += (int)(*lpWritten - bufSize);
LeaveCriticalSection(&infoPtr->csWrite);
return TRUE;
@@ -896,7 +896,7 @@ SerialInputProc(
if (cStat.cbInQue > 0) {
if ((DWORD) bufSize > cStat.cbInQue) {
bufSize = cStat.cbInQue;
bufSize = (int)cStat.cbInQue;
}
} else {
errno = *errorCode = EWOULDBLOCK;
@@ -909,7 +909,7 @@ SerialInputProc(
if (cStat.cbInQue > 0) {
if ((DWORD) bufSize > cStat.cbInQue) {
bufSize = cStat.cbInQue;
bufSize = (int)cStat.cbInQue;
}
} else {
bufSize = 1;
@@ -932,7 +932,7 @@ SerialInputProc(
*errorCode = errno;
return -1;
}
return bytesRead;
return (int)bytesRead;
commError:
infoPtr->lastError = infoPtr->error;
@@ -1038,9 +1038,9 @@ SerialOutputProc(
Tcl_Free(infoPtr->writeBuf);
}
infoPtr->writeBufLen = toWrite;
infoPtr->writeBuf = (char *)Tcl_Alloc(toWrite);
infoPtr->writeBuf = (char *)Tcl_Alloc((unsigned)toWrite);
}
memcpy(infoPtr->writeBuf, buf, toWrite);
memcpy(infoPtr->writeBuf, buf, (unsigned)toWrite);
infoPtr->toWrite = toWrite;
ResetEvent(infoPtr->evWritable);
TclPipeThreadSignal(&infoPtr->writeTI);
@@ -1297,7 +1297,7 @@ SerialWriterThread(
infoPtr = (SerialInfo *) pipeTI->clientData;
buf = infoPtr->writeBuf;
toWrite = infoPtr->toWrite;
toWrite = (DWORD)infoPtr->toWrite;
myWrite.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
@@ -1624,7 +1624,7 @@ SerialSetOptionProc(
size_t len, vlen;
Tcl_DString ds;
const WCHAR *native;
size_t argc;
Tcl_Size argc;
const char **argv;
infoPtr = (SerialInfo *) instanceData;
@@ -1794,7 +1794,7 @@ SerialSetOptionProc(
dcb.XoffChar = argv[1][0];
if (argv[0][0] & 0x80 || argv[1][0] & 0x80) {
Tcl_UniChar character = 0;
int charLen;
Tcl_Size charLen;
charLen = Tcl_UtfToUniChar(argv[0], &character);
if ((character > 0xFF) || argv[0][charLen]) {
@@ -1820,7 +1820,7 @@ SerialSetOptionProc(
*/
if ((len > 4) && (strncmp(optionName, "-ttycontrol", len) == 0)) {
size_t i;
Tcl_Size i;
int res = TCL_OK;
if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) {
@@ -1912,7 +1912,7 @@ SerialSetOptionProc(
}
if (argc == 1) {
inSize = atoi(argv[0]);
outSize = infoPtr->sysBufWrite;
outSize = (int)infoPtr->sysBufWrite;
} else if (argc == 2) {
inSize = atoi(argv[0]);
outSize = atoi(argv[1]);
@@ -1929,7 +1929,7 @@ SerialSetOptionProc(
return TCL_ERROR;
}
if (!SetupComm(infoPtr->handle, inSize, outSize)) {
if (!SetupComm(infoPtr->handle, (DWORD)inSize, (DWORD)outSize)) {
if (interp != NULL) {
Tcl_WinConvertError(GetLastError());
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1938,8 +1938,8 @@ SerialSetOptionProc(
}
return TCL_ERROR;
}
infoPtr->sysBufRead = inSize;
infoPtr->sysBufWrite = outSize;
infoPtr->sysBufRead = (DWORD)inSize;
infoPtr->sysBufWrite = (DWORD)outSize;
/*
* Adjust the handshake limits. Yes, the XonXoff limits seem to
@@ -1979,7 +1979,7 @@ SerialSetOptionProc(
if (Tcl_GetInt(interp, value, &msec) != TCL_OK) {
return TCL_ERROR;
}
tout.ReadTotalTimeoutConstant = msec;
tout.ReadTotalTimeoutConstant = (DWORD)msec;
if (!SetCommTimeouts(infoPtr->handle, &tout)) {
if (interp != NULL) {
Tcl_WinConvertError(GetLastError());
@@ -2220,7 +2220,7 @@ SerialGetOptionProc(
count = (int) cStat.cbOutQue + infoPtr->writeQueue;
LeaveCriticalSection(&infoPtr->csWrite);
snprintf(buf, sizeof(buf), "%ld", inBuffered + cStat.cbInQue);
snprintf(buf, sizeof(buf), "%ld", (DWORD)inBuffered + cStat.cbInQue);
Tcl_DStringAppendElement(dsPtr, buf);
snprintf(buf, sizeof(buf), "%d", outBuffered + count);
Tcl_DStringAppendElement(dsPtr, buf);
+4 -4
View File
@@ -757,7 +757,7 @@ TcpInputProc(
{
TcpState *statePtr = (TcpState *)instanceData;
int bytesRead;
DWORD error;
int error;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
*errorCodePtr = 0;
@@ -1262,7 +1262,7 @@ TcpGetOptionProc(
int optlen;
int ret;
DWORD err;
int err;
/*
* Populate the err variable with a POSIX error
@@ -1606,7 +1606,7 @@ TcpConnect(
Tcl_Interp *interp, /* For error reporting; can be NULL. */
TcpState *statePtr)
{
DWORD error;
int error;
int async_connect = GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT);
/* We are started with async connect and the
* connect notification was not yet
@@ -3033,7 +3033,7 @@ SocketThread(
SetEvent(tsdPtr->readyEvent);
return msg.wParam;
return (DWORD)msg.wParam;
}
+1
View File
@@ -12,6 +12,7 @@
#ifndef USE_TCL_STUBS
# define USE_TCL_STUBS
#endif
#undef BUILD_tcl
#include "tclInt.h"
#ifdef TCL_WITH_EXTERNAL_TOMMATH
# include "tommath.h"
+5 -2
View File
@@ -204,13 +204,16 @@ TclpThreadCreate(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread. */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread. */
void *clientData, /* The one argument to Main(). */
size_t stackSize, /* Size of stack for the new thread. */
Tcl_Size stackSize, /* Size of stack for the new thread. */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
WinThread *winThreadPtr; /* Per-thread startup info */
HANDLE tHandle;
if (stackSize > INT_MAX) {
return TCL_ERROR;
}
winThreadPtr = (WinThread *)Tcl_Alloc(sizeof(WinThread));
winThreadPtr->lpStartAddress = (LPTHREAD_START_ROUTINE) proc;
winThreadPtr->lpParameter = clientData;
@@ -223,7 +226,7 @@ TclpThreadCreate(
*/
#if defined(_MSC_VER) || defined(__MSVCRT__)
tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize,
tHandle = (HANDLE) _beginthreadex(NULL, stackSize,
(Tcl_ThreadCreateProc*) TclWinThreadStart, winThreadPtr,
0, (unsigned *)idPtr);
#else