summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-11-21 10:18:50 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-11-21 10:18:50 (GMT)
commitbdfe70e1f89d2635f7185f6892e0354e3daae962 (patch)
tree8388767eb435a513e16d3f3bb3c1648d1aadc198
parentafc237737b8031e888a9338f9040e0f523333db7 (diff)
downloadtcl-bdfe70e1f89d2635f7185f6892e0354e3daae962.zip
tcl-bdfe70e1f89d2635f7185f6892e0354e3daae962.tar.gz
tcl-bdfe70e1f89d2635f7185f6892e0354e3daae962.tar.bz2
more conversion of code, still not running test suite at all
-rw-r--r--generic/tclAlloc.c4
-rw-r--r--generic/tclAssembly.c3
-rw-r--r--generic/tclBasic.c27
-rw-r--r--generic/tclCkalloc.c33
-rw-r--r--generic/tclCmdAH.c6
-rw-r--r--generic/tclCmdMZ.c8
-rw-r--r--generic/tclCompCmds.c2
-rw-r--r--generic/tclCompCmdsSZ.c4
-rw-r--r--generic/tclCompExpr.c11
-rw-r--r--generic/tclCompile.c40
-rw-r--r--generic/tclConfig.c5
-rw-r--r--generic/tclDate.c10
-rw-r--r--generic/tclEnsemble.c17
-rw-r--r--generic/tclEnv.c18
-rw-r--r--generic/tclEvent.c15
-rw-r--r--generic/tclExecute.c2
-rw-r--r--generic/tclFileName.c15
-rw-r--r--generic/tclIO.c63
-rw-r--r--generic/tclIOCmd.c4
-rw-r--r--generic/tclIOUtil.c4
-rw-r--r--generic/tclIndexObj.c4
-rw-r--r--generic/tclLoad.c10
-rw-r--r--generic/tclOO.c12
-rw-r--r--generic/tclObj.c66
-rw-r--r--generic/tclParse.c30
-rw-r--r--generic/tclPathObj.c12
-rw-r--r--generic/tclPipe.c17
-rw-r--r--generic/tclPkg.c24
-rw-r--r--generic/tclRegexp.c2
-rw-r--r--generic/tclResult.c5
-rw-r--r--generic/tclScan.c33
-rwxr-xr-xgeneric/tclStrToD.c13
-rw-r--r--generic/tclStringObj.c7
-rw-r--r--generic/tclTest.c82
-rw-r--r--generic/tclTestObj.c2
-rw-r--r--generic/tclThreadTest.c9
-rw-r--r--generic/tclTimer.c3
-rw-r--r--generic/tclTrace.c2
-rw-r--r--generic/tclUtil.c4
-rw-r--r--generic/tclVar.c80
-rw-r--r--generic/tclZlib.c93
41 files changed, 426 insertions, 375 deletions
diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c
index ae61e85..73c9196 100644
--- a/generic/tclAlloc.c
+++ b/generic/tclAlloc.c
@@ -694,7 +694,7 @@ mstats(
char *
TclpAlloc(
- unsigned int numBytes) /* Number of bytes to allocate. */
+ size_t numBytes) /* Number of bytes to allocate. */
{
return (char *) malloc(numBytes);
}
@@ -742,7 +742,7 @@ TclpFree(
char *
TclpRealloc(
char *oldPtr, /* Pointer to alloced block. */
- unsigned int numBytes) /* New size of memory. */
+ size_t numBytes) /* New size of memory. */
{
return (char *) realloc(oldPtr, numBytes);
}
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 6cb1bb3..779c33c 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -3474,7 +3474,8 @@ StackCheckBasicBlock(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"code pops stack below level of enclosing catch",
TCL_STRLEN));
- Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACKINCATCH", -1);
+ Tcl_SetErrorCode(interp, "TCL", "ASSEM", "BADSTACKINCATCH",
+ NULL);
AddBasicBlockRangeToErrorInfo(assemEnvPtr, blockPtr);
Tcl_SetErrorLine(interp, blockPtr->startLine);
}
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 5ad2d9c..0077ec5 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -2610,11 +2610,11 @@ TclRenameCommand(
*/
Tcl_DStringInit(&newFullName);
- Tcl_DStringAppend(&newFullName, newNsPtr->fullName, -1);
+ Tcl_DStringAppend(&newFullName, newNsPtr->fullName, TCL_STRLEN);
if (newNsPtr != iPtr->globalNsPtr) {
TclDStringAppendLiteral(&newFullName, "::");
}
- Tcl_DStringAppend(&newFullName, newTail, -1);
+ Tcl_DStringAppend(&newFullName, newTail, TCL_STRLEN);
cmdPtr->refCount++;
CallCommandTraces(iPtr, cmdPtr, Tcl_GetString(oldFullName),
Tcl_DStringValue(&newFullName), TCL_TRACE_RENAME);
@@ -2903,14 +2903,14 @@ Tcl_GetCommandFullName(
if (cmdPtr != NULL) {
if (cmdPtr->nsPtr != NULL) {
- Tcl_AppendToObj(objPtr, cmdPtr->nsPtr->fullName, -1);
+ Tcl_AppendToObj(objPtr, cmdPtr->nsPtr->fullName, TCL_STRLEN);
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
Tcl_AppendToObj(objPtr, "::", 2);
}
}
if (cmdPtr->hPtr != NULL) {
name = Tcl_GetHashKey(cmdPtr->hPtr->tablePtr, cmdPtr->hPtr);
- Tcl_AppendToObj(objPtr, name, -1);
+ Tcl_AppendToObj(objPtr, name, TCL_STRLEN);
}
}
}
@@ -3471,7 +3471,7 @@ Tcl_CreateMathFunc(
Tcl_DStringInit(&bigName);
TclDStringAppendLiteral(&bigName, "::tcl::mathfunc::");
- Tcl_DStringAppend(&bigName, name, -1);
+ Tcl_DStringAppend(&bigName, name, TCL_STRLEN);
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&bigName),
OldMathFuncProc, data, OldMathFuncDeleteProc);
@@ -3687,7 +3687,7 @@ Tcl_GetMathFuncInfo(
*/
TclNewLiteralStringObj(cmdNameObj, "tcl::mathfunc::");
- Tcl_AppendToObj(cmdNameObj, name, -1);
+ Tcl_AppendToObj(cmdNameObj, name, TCL_STRLEN);
Tcl_IncrRefCount(cmdNameObj);
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdNameObj);
Tcl_DecrRefCount(cmdNameObj);
@@ -5830,7 +5830,7 @@ Tcl_Eval(
* previous call to Tcl_CreateInterp). */
const char *script) /* Pointer to TCL command to execute. */
{
- int code = Tcl_EvalEx(interp, script, -1, 0);
+ int code = Tcl_EvalEx(interp, script, TCL_STRLEN, 0);
/*
* For backwards compatibility with old C code that predates the object
@@ -6794,7 +6794,7 @@ Tcl_AddErrorInfo(
* pertains. */
const char *message) /* Message to record. */
{
- Tcl_AddObjErrorInfo(interp, message, -1);
+ Tcl_AddObjErrorInfo(interp, message, TCL_STRLEN);
}
/*
@@ -6824,8 +6824,9 @@ Tcl_AddObjErrorInfo(
* pertains. */
const char *message, /* Points to the first byte of an array of
* bytes of the message. */
- size_t length) /* The number of bytes in the message. If < 0,
- * then append all bytes up to a NULL byte. */
+ size_t length) /* The number of bytes in the message. If
+ * TCL_STRLEN, then append all bytes up to a
+ * NULL byte. */
{
register Interp *iPtr = (Interp *) interp;
@@ -6908,7 +6909,7 @@ Tcl_VarEvalVA(
if (string == NULL) {
break;
}
- Tcl_DStringAppend(&buf, string, -1);
+ Tcl_DStringAppend(&buf, string, TCL_STRLEN);
}
result = Tcl_Eval(interp, Tcl_DStringValue(&buf));
@@ -8975,10 +8976,10 @@ TclNRCoroutineObjCmd(
Tcl_DStringInit(&ds);
if (nsPtr != iPtr->globalNsPtr) {
- Tcl_DStringAppend(&ds, nsPtr->fullName, -1);
+ Tcl_DStringAppend(&ds, nsPtr->fullName, TCL_STRLEN);
TclDStringAppendLiteral(&ds, "::");
}
- Tcl_DStringAppend(&ds, procName, -1);
+ Tcl_DStringAppend(&ds, procName, TCL_STRLEN);
cmdPtr = (Command *) Tcl_NRCreateCommand(interp, Tcl_DStringValue(&ds),
/*objProc*/ NULL, TclNRInterpCoroutine, corPtr, DeleteCoroutine);
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c
index a43c344..2c8536f 100644
--- a/generic/tclCkalloc.c
+++ b/generic/tclCkalloc.c
@@ -132,9 +132,9 @@ static int ckallocInit = 0;
*/
static int CheckmemCmd(ClientData clientData, Tcl_Interp *interp,
- int argc, const char *argv[]);
+ size_t argc, const char *argv[]);
static int MemoryCmd(ClientData clientData, Tcl_Interp *interp,
- int argc, const char *argv[]);
+ size_t argc, const char *argv[]);
static void ValidateMemory(struct mem_header *memHeaderP,
const char *file, int line, int nukeGuards);
@@ -196,7 +196,7 @@ TclDumpMemoryInfo(
fprintf((FILE *)clientData, "%s", buf);
} else {
/* Assume objPtr to append to */
- Tcl_AppendToObj((Tcl_Obj *) clientData, buf, -1);
+ Tcl_AppendToObj((Tcl_Obj *) clientData, buf, TCL_STRLEN);
}
return 1;
}
@@ -390,7 +390,7 @@ Tcl_DumpActiveMemory(
char *
Tcl_DbCkalloc(
- unsigned int size,
+ size_t size,
const char *file,
int line)
{
@@ -408,7 +408,7 @@ Tcl_DbCkalloc(
if (result == NULL) {
fflush(stdout);
TclDumpMemoryInfo((ClientData) stderr, 0);
- Tcl_Panic("unable to alloc %u bytes, %s line %d", size, file, line);
+ Tcl_Panic("unable to alloc %lu bytes, %s line %d", size, file, line);
}
/*
@@ -454,7 +454,7 @@ Tcl_DbCkalloc(
}
if (alloc_tracing) {
- fprintf(stderr,"ckalloc %lx %u %s %d\n",
+ fprintf(stderr,"ckalloc %lx %lu %s %d\n",
(long unsigned int) result->body, size, file, line);
}
@@ -480,7 +480,7 @@ Tcl_DbCkalloc(
char *
Tcl_AttemptDbCkalloc(
- unsigned int size,
+ size_t size,
const char *file,
int line)
{
@@ -543,7 +543,7 @@ Tcl_AttemptDbCkalloc(
}
if (alloc_tracing) {
- fprintf(stderr,"ckalloc %lx %u %s %d\n",
+ fprintf(stderr,"ckalloc %lx %lu %s %d\n",
(long unsigned int) result->body, size, file, line);
}
@@ -666,7 +666,7 @@ Tcl_DbCkfree(
char *
Tcl_DbCkrealloc(
char *ptr,
- unsigned int size,
+ size_t size,
const char *file,
int line)
{
@@ -697,7 +697,7 @@ Tcl_DbCkrealloc(
char *
Tcl_AttemptDbCkrealloc(
char *ptr,
- unsigned int size,
+ size_t size,
const char *file,
int line)
{
@@ -748,14 +748,14 @@ Tcl_AttemptDbCkrealloc(
char *
Tcl_Alloc(
- unsigned int size)
+ size_t size)
{
return Tcl_DbCkalloc(size, "unknown", 0);
}
char *
Tcl_AttemptAlloc(
- unsigned int size)
+ size_t size)
{
return Tcl_AttemptDbCkalloc(size, "unknown", 0);
}
@@ -770,14 +770,15 @@ Tcl_Free(
char *
Tcl_Realloc(
char *ptr,
- unsigned int size)
+ size_t size)
{
return Tcl_DbCkrealloc(ptr, size, "unknown", 0);
}
+
char *
Tcl_AttemptRealloc(
char *ptr,
- unsigned int size)
+ size_t size)
{
return Tcl_AttemptDbCkrealloc(ptr, size, "unknown", 0);
}
@@ -809,7 +810,7 @@ static int
MemoryCmd(
ClientData clientData,
Tcl_Interp *interp,
- int argc,
+ size_t argc,
const char *argv[])
{
const char *fileName;
@@ -986,7 +987,7 @@ static int
CheckmemCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Interpreter for evaluation. */
- int argc, /* Number of arguments. */
+ size_t argc, /* Number of arguments. */
const char *argv[]) /* String values of arguments. */
{
if (argc != 2) {
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index bbe7914..879d96e 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -922,9 +922,11 @@ TclMakeFileCommandSafe(
const char *oldName, *newName;
Tcl_DStringSetLength(&oldBuf, 13);
- oldName = Tcl_DStringAppend(&oldBuf, unsafeInfo[i].cmdName, -1);
+ oldName = Tcl_DStringAppend(&oldBuf, unsafeInfo[i].cmdName,
+ TCL_STRLEN);
Tcl_DStringSetLength(&newBuf, 9);
- newName = Tcl_DStringAppend(&newBuf, unsafeInfo[i].cmdName, -1);
+ newName = Tcl_DStringAppend(&newBuf, unsafeInfo[i].cmdName,
+ TCL_STRLEN);
if (TclRenameCommand(interp, oldName, "___tmp") != TCL_OK
|| Tcl_HideCommand(interp, "___tmp", newName) != TCL_OK) {
Tcl_Panic("problem making 'file %s' safe: %s",
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 760b8be..bbe36a4 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -2997,7 +2997,7 @@ StringLowerCmd(
length2 = Tcl_UtfToLower(string2);
Tcl_SetObjLength(resultPtr, length2 + (start - string1));
- Tcl_AppendToObj(resultPtr, end, -1);
+ Tcl_AppendToObj(resultPtr, end, TCL_STRLEN);
Tcl_SetObjResult(interp, resultPtr);
}
@@ -3082,7 +3082,7 @@ StringUpperCmd(
length2 = Tcl_UtfToUpper(string2);
Tcl_SetObjLength(resultPtr, length2 + (start - string1));
- Tcl_AppendToObj(resultPtr, end, -1);
+ Tcl_AppendToObj(resultPtr, end, TCL_STRLEN);
Tcl_SetObjResult(interp, resultPtr);
}
@@ -3167,7 +3167,7 @@ StringTitleCmd(
length2 = Tcl_UtfToTitle(string2);
Tcl_SetObjLength(resultPtr, length2 + (start - string1));
- Tcl_AppendToObj(resultPtr, end, -1);
+ Tcl_AppendToObj(resultPtr, end, TCL_STRLEN);
Tcl_SetObjResult(interp, resultPtr);
}
@@ -3686,7 +3686,7 @@ TclNRSwitchObjCmd(
Tcl_AppendToObj(Tcl_GetObjResult(interp),
", this may be due to a comment incorrectly"
" placed outside of a switch body - see the"
- " \"switch\" documentation", -1);
+ " \"switch\" documentation", TCL_STRLEN);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "SWITCH",
"BADARM", "COMMENT?", NULL);
break;
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 90347b2..dcd22ec 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -2196,7 +2196,7 @@ PrintDictUpdateInfo(
for (i=0 ; i<duiPtr->length ; i++) {
if (i) {
- Tcl_AppendToObj(appendObj, ", ", -1);
+ Tcl_AppendToObj(appendObj, ", ", TCL_STRLEN);
}
Tcl_AppendPrintfToObj(appendObj, "%%v%u", duiPtr->varIndices[i]);
}
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index 3747c0c..1fd5ba8 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -1883,9 +1883,9 @@ PrintJumptableInfo(
offset = PTR2INT(Tcl_GetHashValue(hPtr));
if (i++) {
- Tcl_AppendToObj(appendObj, ", ", -1);
+ Tcl_AppendToObj(appendObj, ", ", TCL_STRLEN);
if (i%4==0) {
- Tcl_AppendToObj(appendObj, "\n\t\t", -1);
+ Tcl_AppendToObj(appendObj, "\n\t\t", TCL_STRLEN);
}
}
Tcl_AppendPrintfToObj(appendObj, "\"%s\"->pc %d",
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 17d7d8b..6e90bb6 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -762,14 +762,16 @@ ParseExpr(
switch (start[1]) {
case 'b':
Tcl_AppendToObj(post,
- " (invalid binary number?)", -1);
+ " (invalid binary number?)",
+ TCL_STRLEN);
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
errCode = "BADNUMBER";
subErrCode = "BINARY";
break;
case 'o':
Tcl_AppendToObj(post,
- " (invalid octal number?)", -1);
+ " (invalid octal number?)",
+ TCL_STRLEN);
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
errCode = "BADNUMBER";
subErrCode = "OCTAL";
@@ -777,7 +779,8 @@ ParseExpr(
default:
if (isdigit(UCHAR(start[1]))) {
Tcl_AppendToObj(post,
- " (invalid octal number?)", -1);
+ " (invalid octal number?)",
+ TCL_STRLEN);
parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
errCode = "BADNUMBER";
subErrCode = "OCTAL";
@@ -1426,7 +1429,7 @@ ParseExpr(
*/
if (post != NULL) {
- Tcl_AppendToObj(msg, ";\n", -1);
+ Tcl_AppendToObj(msg, ";\n", TCL_STRLEN);
Tcl_AppendObjToObj(msg, post);
Tcl_DecrRefCount(post);
}
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index a8304d0..a37883e 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -4084,7 +4084,7 @@ TclDisassembleByteCodeObj(
"ByteCode 0x%s, refCt %u, epoch %u, interp 0x%s (epoch %u)\n",
ptrBuf1, codePtr->refCount, codePtr->compileEpoch, ptrBuf2,
iPtr->compileEpoch);
- Tcl_AppendToObj(bufferObj, " Source ", -1);
+ Tcl_AppendToObj(bufferObj, " Source ", TCL_STRLEN);
PrintSourceToObj(bufferObj, codePtr->source,
TclMin(codePtr->numSrcBytes, 55));
Tcl_AppendPrintfToObj(bufferObj,
@@ -4138,7 +4138,7 @@ TclDisassembleByteCodeObj(
(localPtr->flags & VAR_TEMPORARY) ? ", temp" : "",
(localPtr->flags & VAR_RESOLVED) ? ", resolved" : "");
if (TclIsVarTemporary(localPtr)) {
- Tcl_AppendToObj(bufferObj, "\n", -1);
+ Tcl_AppendToObj(bufferObj, "\n", TCL_STRLEN);
} else {
Tcl_AppendPrintfToObj(bufferObj, ", \"%s\"\n",
localPtr->name);
@@ -4188,7 +4188,7 @@ TclDisassembleByteCodeObj(
if (numCmds == 0) {
pc = codeStart;
while (pc < codeLimit) {
- Tcl_AppendToObj(bufferObj, " ", -1);
+ Tcl_AppendToObj(bufferObj, " ", TCL_STRLEN);
pc += FormatInstruction(codePtr, pc, bufferObj);
}
return bufferObj;
@@ -4250,7 +4250,7 @@ TclDisassembleByteCodeObj(
srcOffset, (srcOffset + srcLen - 1));
}
if (numCmds > 0) {
- Tcl_AppendToObj(bufferObj, "\n", -1);
+ Tcl_AppendToObj(bufferObj, "\n", TCL_STRLEN);
}
/*
@@ -4299,14 +4299,14 @@ TclDisassembleByteCodeObj(
*/
while ((pc-codeStart) < codeOffset) {
- Tcl_AppendToObj(bufferObj, " ", -1);
+ Tcl_AppendToObj(bufferObj, " ", TCL_STRLEN);
pc += FormatInstruction(codePtr, pc, bufferObj);
}
Tcl_AppendPrintfToObj(bufferObj, " Command %d: ", i+1);
PrintSourceToObj(bufferObj, (codePtr->source + srcOffset),
TclMin(srcLen, 55));
- Tcl_AppendToObj(bufferObj, "\n", -1);
+ Tcl_AppendToObj(bufferObj, "\n", TCL_STRLEN);
}
if (pc < codeLimit) {
/*
@@ -4314,7 +4314,7 @@ TclDisassembleByteCodeObj(
*/
while (pc < codeLimit) {
- Tcl_AppendToObj(bufferObj, " ", -1);
+ Tcl_AppendToObj(bufferObj, " ", TCL_STRLEN);
pc += FormatInstruction(codePtr, pc, bufferObj);
}
}
@@ -4438,7 +4438,7 @@ FormatInstruction(
const char *bytes;
size_t length;
- Tcl_AppendToObj(bufferObj, "\t# ", -1);
+ Tcl_AppendToObj(bufferObj, "\t# ", TCL_STRLEN);
bytes = Tcl_GetStringFromObj(codePtr->objArrayPtr[opnd], &length);
PrintSourceToObj(bufferObj, bytes, TclMin(length, 40));
} else if (suffixBuffer[0]) {
@@ -4447,12 +4447,12 @@ FormatInstruction(
PrintSourceToObj(bufferObj, suffixSrc, 40);
}
}
- Tcl_AppendToObj(bufferObj, "\n", -1);
+ Tcl_AppendToObj(bufferObj, "\n", TCL_STRLEN);
if (auxPtr && auxPtr->type->printProc) {
- Tcl_AppendToObj(bufferObj, "\t\t[", -1);
+ Tcl_AppendToObj(bufferObj, "\t\t[", TCL_STRLEN);
auxPtr->type->printProc(auxPtr->clientData, bufferObj, codePtr,
pcOffset);
- Tcl_AppendToObj(bufferObj, "]\n", -1);
+ Tcl_AppendToObj(bufferObj, "]\n", TCL_STRLEN);
}
return numBytes;
}
@@ -4644,38 +4644,38 @@ PrintSourceToObj(
register int i = 0;
if (stringPtr == NULL) {
- Tcl_AppendToObj(appendObj, "\"\"", -1);
+ Tcl_AppendToObj(appendObj, "\"\"", TCL_STRLEN);
return;
}
- Tcl_AppendToObj(appendObj, "\"", -1);
+ Tcl_AppendToObj(appendObj, "\"", TCL_STRLEN);
p = stringPtr;
for (; (*p != '\0') && (i < maxChars); p++, i++) {
switch (*p) {
case '"':
- Tcl_AppendToObj(appendObj, "\\\"", -1);
+ Tcl_AppendToObj(appendObj, "\\\"", TCL_STRLEN);
continue;
case '\f':
- Tcl_AppendToObj(appendObj, "\\f", -1);
+ Tcl_AppendToObj(appendObj, "\\f", TCL_STRLEN);
continue;
case '\n':
- Tcl_AppendToObj(appendObj, "\\n", -1);
+ Tcl_AppendToObj(appendObj, "\\n", TCL_STRLEN);
continue;
case '\r':
- Tcl_AppendToObj(appendObj, "\\r", -1);
+ Tcl_AppendToObj(appendObj, "\\r", TCL_STRLEN);
continue;
case '\t':
- Tcl_AppendToObj(appendObj, "\\t", -1);
+ Tcl_AppendToObj(appendObj, "\\t", TCL_STRLEN);
continue;
case '\v':
- Tcl_AppendToObj(appendObj, "\\v", -1);
+ Tcl_AppendToObj(appendObj, "\\v", TCL_STRLEN);
continue;
default:
Tcl_AppendPrintfToObj(appendObj, "%c", *p);
continue;
}
}
- Tcl_AppendToObj(appendObj, "\"", -1);
+ Tcl_AppendToObj(appendObj, "\"", TCL_STRLEN);
}
#ifdef TCL_COMPILE_STATS
diff --git a/generic/tclConfig.c b/generic/tclConfig.c
index da0601c..670807c 100644
--- a/generic/tclConfig.c
+++ b/generic/tclConfig.c
@@ -122,7 +122,8 @@ Tcl_RegisterConfig(
for (cfg=configuration ; cfg->key!=NULL && cfg->key[0]!='\0' ; cfg++) {
Tcl_DString conv;
const char *convValue =
- Tcl_ExternalToUtfDString(venc, cfg->value, -1, &conv);
+ Tcl_ExternalToUtfDString(venc, cfg->value, TCL_STRLEN,
+ &conv);
/*
* We know that the keys are in ASCII/UTF-8, so for them is no
@@ -155,7 +156,7 @@ Tcl_RegisterConfig(
Tcl_DStringInit(&cmdName);
TclDStringAppendLiteral(&cmdName, "::");
- Tcl_DStringAppend(&cmdName, pkgName, -1);
+ Tcl_DStringAppend(&cmdName, pkgName, TCL_STRLEN);
/*
* The incomplete command name is the name of the namespace to place it
diff --git a/generic/tclDate.c b/generic/tclDate.c
index b3a3e0a..41aa516 100644
--- a/generic/tclDate.c
+++ b/generic/tclDate.c
@@ -2503,19 +2503,19 @@ TclDateerror(
const char *s)
{
Tcl_Obj* t;
- Tcl_AppendToObj(infoPtr->messages, infoPtr->separatrix, -1);
- Tcl_AppendToObj(infoPtr->messages, s, -1);
- Tcl_AppendToObj(infoPtr->messages, " (characters ", -1);
+ Tcl_AppendToObj(infoPtr->messages, infoPtr->separatrix, TCL_STRLEN);
+ Tcl_AppendToObj(infoPtr->messages, s, TCL_STRLEN);
+ Tcl_AppendToObj(infoPtr->messages, " (characters ", TCL_STRLEN);
t = Tcl_NewIntObj(location->first_column);
Tcl_IncrRefCount(t);
Tcl_AppendObjToObj(infoPtr->messages, t);
Tcl_DecrRefCount(t);
- Tcl_AppendToObj(infoPtr->messages, "-", -1);
+ Tcl_AppendToObj(infoPtr->messages, "-", TCL_STRLEN);
t = Tcl_NewIntObj(location->last_column);
Tcl_IncrRefCount(t);
Tcl_AppendObjToObj(infoPtr->messages, t);
Tcl_DecrRefCount(t);
- Tcl_AppendToObj(infoPtr->messages, ")", -1);
+ Tcl_AppendToObj(infoPtr->messages, ")", TCL_STRLEN);
infoPtr->separatrix = "\n";
}
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 775d563..f86083a 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -1469,7 +1469,7 @@ TclMakeEnsemble(
Tcl_DStringInit(&buf);
Tcl_DStringInit(&hiddenBuf);
TclDStringAppendLiteral(&hiddenBuf, "tcl:");
- Tcl_DStringAppend(&hiddenBuf, name, -1);
+ Tcl_DStringAppend(&hiddenBuf, name, TCL_STRLEN);
TclDStringAppendLiteral(&hiddenBuf, ":");
hiddenLen = Tcl_DStringLength(&hiddenBuf);
if (name[0] == ':' && name[1] == ':') {
@@ -1478,7 +1478,7 @@ TclMakeEnsemble(
*/
cmdName = name;
- Tcl_DStringAppend(&buf, name, -1);
+ Tcl_DStringAppend(&buf, name, TCL_STRLEN);
ensembleFlags = TCL_ENSEMBLE_PREFIX;
} else {
/*
@@ -1494,7 +1494,7 @@ TclMakeEnsemble(
for (i = 0; i < nameCount; ++i) {
TclDStringAppendLiteral(&buf, "::");
- Tcl_DStringAppend(&buf, nameParts[i], -1);
+ Tcl_DStringAppend(&buf, nameParts[i], TCL_STRLEN);
}
}
@@ -1534,7 +1534,7 @@ TclMakeEnsemble(
fromObj = Tcl_NewStringObj(map[i].name, TCL_STRLEN);
TclNewStringObj(toObj, Tcl_DStringValue(&buf),
Tcl_DStringLength(&buf));
- Tcl_AppendToObj(toObj, map[i].name, -1);
+ Tcl_AppendToObj(toObj, map[i].name, TCL_STRLEN);
Tcl_DictObjPut(NULL, mapDict, fromObj, toObj);
if (map[i].proc || map[i].nreProc) {
@@ -1552,7 +1552,8 @@ TclMakeEnsemble(
map[i].nreProc, map[i].clientData, NULL);
Tcl_DStringSetLength(&hiddenBuf, hiddenLen);
if (Tcl_HideCommand(interp, "___tmp",
- Tcl_DStringAppend(&hiddenBuf, map[i].name, -1))) {
+ Tcl_DStringAppend(&hiddenBuf, map[i].name,
+ TCL_STRLEN))) {
Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
}
} else {
@@ -1941,12 +1942,14 @@ NsEnsembleImplementationCmdNR(
(ensemblePtr->flags & TCL_ENSEMBLE_PREFIX ? " or ambiguous" : ""),
TclGetString(objv[1+ensemblePtr->numParameters]));
if (ensemblePtr->subcommandTable.numEntries == 1) {
- Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[0], -1);
+ Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[0],
+ TCL_STRLEN);
} else {
size_t i;
for (i=0 ; i<ensemblePtr->subcommandTable.numEntries-1 ; i++) {
- Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[i], -1);
+ Tcl_AppendToObj(errorObj, ensemblePtr->subcommandArrayPtr[i],
+ TCL_STRLEN);
Tcl_AppendToObj(errorObj, ", ", 2);
}
Tcl_AppendPrintfToObj(errorObj, "or %s",
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index fbebf74..ea1a16f 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -106,7 +106,8 @@ TclSetupEnv(
} else {
Tcl_MutexLock(&envMutex);
for (i = 0; environ[i] != NULL; i++) {
- p1 = Tcl_ExternalToUtfDString(NULL, environ[i], -1, &envString);
+ p1 = Tcl_ExternalToUtfDString(NULL, environ[i], TCL_STRLEN,
+ &envString);
p2 = strchr(p1, '=');
if (p2 == NULL) {
/*
@@ -207,7 +208,8 @@ TclSetEnv(
* interpreters.
*/
- env = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envString);
+ env = Tcl_ExternalToUtfDString(NULL, environ[index], TCL_STRLEN,
+ &envString);
if (strcmp(value, env + (length + 1)) == 0) {
Tcl_DStringFree(&envString);
Tcl_MutexUnlock(&envMutex);
@@ -230,7 +232,7 @@ TclSetEnv(
memcpy(p, name, nameLength);
p[nameLength] = '=';
memcpy(p+nameLength+1, value, valueLength+1);
- p2 = Tcl_UtfToExternalDString(NULL, p, -1, &envString);
+ p2 = Tcl_UtfToExternalDString(NULL, p, TCL_STRLEN, &envString);
/*
* Copy the native string to heap memory.
@@ -321,7 +323,8 @@ Tcl_PutEnv(
* name and value parts, and call TclSetEnv to do all of the real work.
*/
- name = Tcl_ExternalToUtfDString(NULL, assignment, -1, &nameString);
+ name = Tcl_ExternalToUtfDString(NULL, assignment, TCL_STRLEN,
+ &nameString);
value = strchr(name, '=');
if ((value != NULL) && (value != name)) {
@@ -407,7 +410,7 @@ TclUnsetEnv(
string[length] = '\0';
#endif /* WIN32 */
- Tcl_UtfToExternalDString(NULL, string, -1, &envString);
+ Tcl_UtfToExternalDString(NULL, string, TCL_STRLEN, &envString);
string = ckrealloc(string, Tcl_DStringLength(&envString) + 1);
memcpy(string, Tcl_DStringValue(&envString),
(unsigned) Tcl_DStringLength(&envString)+1);
@@ -483,12 +486,13 @@ TclGetEnv(
if (index != -1) {
Tcl_DString envStr;
- result = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envStr);
+ result = Tcl_ExternalToUtfDString(NULL, environ[index], TCL_STRLEN,
+ &envStr);
result += length;
if (*result == '=') {
result++;
Tcl_DStringInit(valuePtr);
- Tcl_DStringAppend(valuePtr, result, -1);
+ Tcl_DStringAppend(valuePtr, result, TCL_STRLEN);
result = Tcl_DStringValue(valuePtr);
} else {
result = NULL;
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 7568a33..252c2af 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -464,17 +464,20 @@ TclDefaultBgErrorHandlerObjCmd(
Tcl_RestoreInterpState(interp, saved);
Tcl_WriteObj(errChannel, Tcl_GetVar2Ex(interp,
"errorInfo", NULL, TCL_GLOBAL_ONLY));
- Tcl_WriteChars(errChannel, "\n", -1);
+ Tcl_WriteChars(errChannel, "\n", TCL_STRLEN);
} else {
Tcl_DiscardInterpState(saved);
Tcl_WriteChars(errChannel,
- "bgerror failed to handle background error.\n",-1);
- Tcl_WriteChars(errChannel, " Original error: ", -1);
+ "bgerror failed to handle background error.\n",
+ TCL_STRLEN);
+ Tcl_WriteChars(errChannel, " Original error: ",
+ TCL_STRLEN);
Tcl_WriteObj(errChannel, tempObjv[1]);
- Tcl_WriteChars(errChannel, "\n", -1);
- Tcl_WriteChars(errChannel, " Error in bgerror: ", -1);
+ Tcl_WriteChars(errChannel, "\n", TCL_STRLEN);
+ Tcl_WriteChars(errChannel, " Error in bgerror: ",
+ TCL_STRLEN);
Tcl_WriteObj(errChannel, resultPtr);
- Tcl_WriteChars(errChannel, "\n", -1);
+ Tcl_WriteChars(errChannel, "\n", TCL_STRLEN);
}
Tcl_DecrRefCount(resultPtr);
Tcl_Flush(errChannel);
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 300c97d..917622c 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -2906,7 +2906,7 @@ TEBCresume(
}
TclNewLiteralStringObj(objPtr, "::tcl::mathfunc::");
- Tcl_AppendToObj(objPtr, tclBuiltinFuncTable[opnd].name, -1);
+ Tcl_AppendToObj(objPtr, tclBuiltinFuncTable[opnd].name, TCL_STRLEN);
/*
* Only 0, 1 or 2 args.
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 543c95e..ff04427 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -1394,7 +1394,7 @@ Tcl_GlobObjCmd(
* in TclGlob requires a non-NULL pathOrDir.
*/
- Tcl_DStringAppend(&pref, first, -1);
+ Tcl_DStringAppend(&pref, first, TCL_STRLEN);
globFlags &= ~TCL_GLOBMODE_TAILS;
pathOrDir = NULL;
} else {
@@ -1433,7 +1433,7 @@ Tcl_GlobObjCmd(
}
}
if (*search != '\0') {
- Tcl_DStringAppend(&prefix, search, -1);
+ Tcl_DStringAppend(&prefix, search, TCL_STRLEN);
}
Tcl_DStringFree(&pref);
}
@@ -1588,7 +1588,7 @@ Tcl_GlobObjCmd(
}
for (i = 0; i < objc; i++) {
TclDStringAppendObj(&prefix, objv[i]);
- if (i != objc -1) {
+ if (i != objc-1) {
Tcl_DStringAppend(&prefix, separators, 1);
}
}
@@ -1642,7 +1642,8 @@ Tcl_GlobObjCmd(
(join || (objc == 1)) ? "" : "s");
if (join) {
- Tcl_AppendToObj(errorMsg, Tcl_DStringValue(&prefix), -1);
+ Tcl_AppendToObj(errorMsg, Tcl_DStringValue(&prefix),
+ TCL_STRLEN);
} else {
const char *sep = "";
@@ -1652,7 +1653,7 @@ Tcl_GlobObjCmd(
sep = " ";
}
}
- Tcl_AppendToObj(errorMsg, "\"", -1);
+ Tcl_AppendToObj(errorMsg, "\"", TCL_STRLEN);
Tcl_SetObjResult(interp, errorMsg);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "GLOB", "NOMATCH",
NULL);
@@ -1776,7 +1777,7 @@ TclGlob(
return TCL_ERROR;
}
if (head != Tcl_DStringValue(&buffer)) {
- Tcl_DStringAppend(&buffer, head, -1);
+ Tcl_DStringAppend(&buffer, head, TCL_STRLEN);
}
pathPrefix = TclDStringToObj(&buffer);
Tcl_IncrRefCount(pathPrefix);
@@ -2262,7 +2263,7 @@ DoGlob(
SkipToChar(&p, ',');
Tcl_DStringSetLength(&newName, baseLength);
Tcl_DStringAppend(&newName, element, p-element);
- Tcl_DStringAppend(&newName, closeBrace+1, -1);
+ Tcl_DStringAppend(&newName, closeBrace+1, TCL_STRLEN);
result = DoGlob(interp, matchesObj, separators, pathPtr, flags,
Tcl_DStringValue(&newName), types);
if (result != TCL_OK) {
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 47d7c34..6c3b2e3 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -64,9 +64,10 @@ static int CloseChannelPart(Tcl_Interp *interp, Channel *chanPtr,
int errorCode, int flags);
static int CloseWrite(Tcl_Interp *interp, Channel *chanPtr);
static void CommonGetsCleanup(Channel *chanPtr);
-static int CopyAndTranslateBuffer(ChannelState *statePtr,
- char *result, int space);
-static int CopyBuffer(Channel *chanPtr, char *result, int space);
+static size_t CopyAndTranslateBuffer(ChannelState *statePtr,
+ char *result, size_t space);
+static size_t CopyBuffer(Channel *chanPtr, char *result,
+ size_t space);
static int CopyData(CopyState *csPtr, int mask);
static void CopyEventProc(ClientData clientData, int mask);
static void CreateScriptRecord(Tcl_Interp *interp,
@@ -404,11 +405,11 @@ TclFinalizeIOSubsystem(void)
int active = 1; /* Flag == 1 while there's still work to do */
int doflushnb;
- /* Fetch the pre-TIP#398 compatibility flag */
+ /* Fetch the pre-TIP#398 compatibility flag */
{
const char *s;
Tcl_DString ds;
-
+
s = TclGetEnv("TCL_FLUSH_NONBLOCKING_ON_EXIT", &ds);
doflushnb = ((s != NULL) && strcmp(s, "0"));
if (s != NULL) {
@@ -437,7 +438,7 @@ TclFinalizeIOSubsystem(void)
continue;
}
if (!GotFlag(statePtr, CHANNEL_INCLOSE | CHANNEL_CLOSED )
- || GotFlag(statePtr, BG_FLUSH_SCHEDULED)) {
+ || GotFlag(statePtr, BG_FLUSH_SCHEDULED)) {
ResetFlag(statePtr, BG_FLUSH_SCHEDULED);
active = 1;
break;
@@ -449,20 +450,21 @@ TclFinalizeIOSubsystem(void)
*/
if (active) {
-
/*
- * TIP #398: by default, we no longer set the channel back into
- * blocking mode. To restore the old blocking behavior, the
- * environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT must be set
+ * TIP #398: by default, we no longer set the channel back into
+ * blocking mode. To restore the old blocking behavior, the
+ * environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT must be set
* and not be "0".
*/
+
if (doflushnb) {
- /* Set the channel back into blocking mode to ensure that we wait
- * for all data to flush out.
- */
-
+ /*
+ * Set the channel back into blocking mode to ensure that we
+ * wait for all data to flush out.
+ */
+
(void) Tcl_SetChannelOption(NULL, (Tcl_Channel) chanPtr,
- "-blocking", "on");
+ "-blocking", "on");
}
if ((chanPtr == (Channel *) tsdPtr->stdinChannel) ||
@@ -5749,7 +5751,8 @@ DoReadChars(
ChannelState *statePtr = chanPtr->state;
/* State info for channel */
ChannelBuffer *bufPtr;
- size_t offset, copied, copiedNow, factor;
+ size_t offset, factor;
+ ssize_t copied, copiedNow;
int result;
Tcl_Encoding encoding;
#define UTF_EXPANSION_FACTOR 1024
@@ -9237,7 +9240,7 @@ CopyData(
if (inBinary || sameEncoding) {
size = DoRead(inStatePtr->topChanPtr, csPtr->buffer, sizeb,
- !GotFlag(inStatePtr, CHANNEL_NONBLOCKING));
+ !GotFlag(inStatePtr, CHANNEL_NONBLOCKING));
} else {
size = DoReadChars(inStatePtr->topChanPtr, bufObj, sizeb,
0 /* No append */);
@@ -9274,7 +9277,7 @@ CopyData(
break;
}
if (cmdPtr && (!Tcl_Eof(inChan) || (mask == 0)) &&
- !(mask & TCL_READABLE)) {
+ !(mask & TCL_READABLE)) {
if (mask & TCL_WRITABLE) {
Tcl_DeleteChannelHandler(outChan, CopyEventProc, csPtr);
}
@@ -9555,19 +9558,19 @@ DoRead(
*----------------------------------------------------------------------
*/
-static int
+static size_t
CopyAndTranslateBuffer(
ChannelState *statePtr, /* Channel state from which to read input. */
char *result, /* Where to store the copied input. */
- int space) /* How many bytes are available in result to
+ size_t space) /* How many bytes are available in result to
* store the copied input? */
{
ChannelBuffer *bufPtr; /* The buffer from which to copy bytes. */
- int bytesInBuffer; /* How many bytes are available to be copied
+ size_t bytesInBuffer; /* How many bytes are available to be copied
* in the current input buffer? */
- int copied; /* How many characters were already copied
+ size_t copied; /* How many characters were already copied
* into the destination space? */
- int i; /* Iterates over the copied input looking for
+ size_t i; /* Iterates over the copied input looking for
* the input eofChar. */
/*
@@ -9780,17 +9783,17 @@ CopyAndTranslateBuffer(
*----------------------------------------------------------------------
*/
-static int
+static size_t
CopyBuffer(
Channel *chanPtr, /* Channel from which to read input. */
char *result, /* Where to store the copied input. */
- int space) /* How many bytes are available in result to
+ size_t space) /* How many bytes are available in result to
* store the copied input? */
{
ChannelBuffer *bufPtr; /* The buffer from which to copy bytes. */
- int bytesInBuffer; /* How many bytes are available to be copied
+ size_t bytesInBuffer; /* How many bytes are available to be copied
* in the current input buffer? */
- int copied; /* How many characters were already copied
+ size_t copied; /* How many characters were already copied
* into the destination space? */
/*
@@ -9824,7 +9827,7 @@ CopyBuffer(
space = bytesInBuffer;
}
- memcpy(result, RemovePoint(bufPtr), (size_t) space);
+ memcpy(result, RemovePoint(bufPtr), space);
bufPtr->nextRemoved += space;
copied = space;
@@ -9933,11 +9936,11 @@ DoWrite(
switch (statePtr->outputTranslation) {
case TCL_TRANSLATE_LF:
srcCopied = destCopied;
- memcpy(destPtr, src, (size_t) destCopied);
+ memcpy(destPtr, src, destCopied);
break;
case TCL_TRANSLATE_CR:
srcCopied = destCopied;
- memcpy(destPtr, src, (size_t) destCopied);
+ memcpy(destPtr, src, destCopied);
for (dPtr = destPtr; dPtr < destPtr + destCopied; dPtr++) {
if (*dPtr == '\n') {
*dPtr = '\r';
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 98909c6..a80c777 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -950,7 +950,7 @@ Tcl_ExecObjCmd(
resultPtr = Tcl_NewObj();
if (Tcl_GetChannelHandle(chan, TCL_READABLE, NULL) == TCL_OK) {
- if (Tcl_ReadChars(chan, resultPtr, -1, 0) < 0) {
+ if (Tcl_ReadChars(chan, resultPtr, TCL_STRLEN, 0) < 0) {
/*
* TIP #219.
* Capture error messages put by the driver into the bypass area
@@ -1094,7 +1094,7 @@ Tcl_OpenObjCmd(
Tcl_Obj *permObj;
TclNewLiteralStringObj(permObj, "0o");
- Tcl_AppendToObj(permObj, permString+scanned+1, -1);
+ Tcl_AppendToObj(permObj, permString+scanned+1, TCL_STRLEN);
code = TclGetIntFromObj(NULL, permObj, &prot);
Tcl_DecrRefCount(permObj);
}
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index e56b39e..51f8f7e 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -1790,7 +1790,7 @@ Tcl_FSEvalFileEx(
* otherwise replace them. [Bug 3466099]
*/
- if (Tcl_ReadChars(chan, objPtr, -1,
+ if (Tcl_ReadChars(chan, objPtr, TCL_STRLEN,
memcmp(string, "\xef\xbb\xbf", 3)) < 0) {
Tcl_Close(interp, chan);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1925,7 +1925,7 @@ TclNREvalFile(
* otherwise replace them. [Bug 3466099]
*/
- if (Tcl_ReadChars(chan, objPtr, -1,
+ if (Tcl_ReadChars(chan, objPtr, TCL_STRLEN,
memcmp(string, "\xef\xbb\xbf", 3)) < 0) {
Tcl_Close(interp, chan);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index f5552f0..3265ca3 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -904,9 +904,9 @@ Tcl_WrongNumArgs(
if (iPtr->flags & INTERP_ALTERNATE_WRONG_ARGS) {
iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS;
Tcl_AppendObjToObj(objPtr, Tcl_GetObjResult(interp));
- Tcl_AppendToObj(objPtr, " or \"", -1);
+ Tcl_AppendToObj(objPtr, " or \"", TCL_STRLEN);
} else {
- Tcl_AppendToObj(objPtr, "wrong # args: should be \"", -1);
+ Tcl_AppendToObj(objPtr, "wrong # args: should be \"", TCL_STRLEN);
}
/*
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index f4fd32e..4b9f32c 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -223,9 +223,9 @@ Tcl_LoadObjCmd(
namesMatch = 0;
} else {
TclDStringClear(&pkgName);
- Tcl_DStringAppend(&pkgName, packageName, -1);
+ Tcl_DStringAppend(&pkgName, packageName, TCL_STRLEN);
TclDStringClear(&tmp);
- Tcl_DStringAppend(&tmp, pkgPtr->packageName, -1);
+ Tcl_DStringAppend(&tmp, pkgPtr->packageName, TCL_STRLEN);
Tcl_UtfToLower(Tcl_DStringValue(&pkgName));
Tcl_UtfToLower(Tcl_DStringValue(&tmp));
if (strcmp(Tcl_DStringValue(&tmp),
@@ -300,7 +300,7 @@ Tcl_LoadObjCmd(
*/
if (packageName != NULL) {
- Tcl_DStringAppend(&pkgName, packageName, -1);
+ Tcl_DStringAppend(&pkgName, packageName, TCL_STRLEN);
} else {
int retc;
@@ -647,9 +647,9 @@ Tcl_UnloadObjCmd(
namesMatch = 0;
} else {
TclDStringClear(&pkgName);
- Tcl_DStringAppend(&pkgName, packageName, -1);
+ Tcl_DStringAppend(&pkgName, packageName, TCL_STRLEN);
TclDStringClear(&tmp);
- Tcl_DStringAppend(&tmp, pkgPtr->packageName, -1);
+ Tcl_DStringAppend(&tmp, pkgPtr->packageName, TCL_STRLEN);
Tcl_UtfToLower(Tcl_DStringValue(&pkgName));
Tcl_UtfToLower(Tcl_DStringValue(&tmp));
if (strcmp(Tcl_DStringValue(&tmp),
diff --git a/generic/tclOO.c b/generic/tclOO.c
index d6b8706..2c6146c 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -359,14 +359,14 @@ InitFoundation(
Tcl_DStringInit(&buffer);
for (i=0 ; defineCmds[i].name ; i++) {
TclDStringAppendLiteral(&buffer, "::oo::define::");
- Tcl_DStringAppend(&buffer, defineCmds[i].name, -1);
+ Tcl_DStringAppend(&buffer, defineCmds[i].name, TCL_STRLEN);
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer),
defineCmds[i].objProc, INT2PTR(defineCmds[i].flag), NULL);
Tcl_DStringFree(&buffer);
}
for (i=0 ; objdefCmds[i].name ; i++) {
TclDStringAppendLiteral(&buffer, "::oo::objdefine::");
- Tcl_DStringAppend(&buffer, objdefCmds[i].name, -1);
+ Tcl_DStringAppend(&buffer, objdefCmds[i].name, TCL_STRLEN);
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer),
objdefCmds[i].objProc, INT2PTR(objdefCmds[i].flag), NULL);
Tcl_DStringFree(&buffer);
@@ -659,9 +659,9 @@ AllocObject(
Tcl_DStringInit(&buffer);
Tcl_DStringAppend(&buffer,
- Tcl_GetCurrentNamespace(interp)->fullName, -1);
+ Tcl_GetCurrentNamespace(interp)->fullName, TCL_STRLEN);
TclDStringAppendLiteral(&buffer, "::");
- Tcl_DStringAppend(&buffer, nameStr, -1);
+ Tcl_DStringAppend(&buffer, nameStr, TCL_STRLEN);
oPtr->command = Tcl_CreateObjCommand(interp,
Tcl_DStringValue(&buffer), PublicObjectCmd, oPtr, NULL);
Tcl_DStringFree(&buffer);
@@ -1868,8 +1868,8 @@ Tcl_CopyObjectInstance(
*/
o2Ptr = (Object *) Tcl_NewObjectInstance(interp,
- (Tcl_Class) oPtr->selfCls, targetName, targetNamespaceName, -1,
- NULL, -1);
+ (Tcl_Class) oPtr->selfCls, targetName, targetNamespaceName,
+ TCL_STRLEN, NULL, TCL_STRLEN);
if (o2Ptr == NULL) {
return NULL;
}
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 96e5820..c6ebf50 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -934,8 +934,8 @@ Tcl_AppendAllObjTypes(
Tcl_MutexLock(&tableMutex);
for (hPtr = Tcl_FirstHashEntry(&typeTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj(Tcl_GetHashKey(&typeTable, hPtr), -1));
+ Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj(
+ Tcl_GetHashKey(&typeTable, hPtr), TCL_STRLEN));
}
Tcl_MutexUnlock(&tableMutex);
return TCL_OK;
@@ -1047,7 +1047,7 @@ TclDbDumpActiveObjects(
tablePtr = tsdPtr->objThreadMap;
if (tablePtr != NULL) {
- fprintf(outFile, "total objects: %d\n", tablePtr->numEntries);
+ fprintf(outFile, "total objects: %lu\n", tablePtr->numEntries);
for (hPtr = Tcl_FirstHashEntry(tablePtr, &hSearch); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&hSearch)) {
ObjData *objData = Tcl_GetHashValue(hPtr);
@@ -1341,11 +1341,11 @@ TclFreeObj(
/*
* Invalidate the string rep first so we can use the bytes value for our
* pointer chain, and signal an obj deletion (as opposed to shimmering)
- * with 'length == -1'.
+ * with 'length == TCL_STRLEN'.
*/
TclInvalidateStringRep(objPtr);
- objPtr->length = -1;
+ objPtr->length = TCL_STRLEN;
if (ObjDeletePending(context)) {
PushObjToDelete(context, objPtr);
@@ -1409,11 +1409,11 @@ TclFreeObj(
/*
* Invalidate the string rep first so we can use the bytes value for our
* pointer chain, and signal an obj deletion (as opposed to shimmering)
- * with 'length == -1'.
+ * with 'length == TCL_STRLEN'.
*/
TclInvalidateStringRep(objPtr);
- objPtr->length = -1;
+ objPtr->length = TCL_STRLEN;
if (!objPtr->typePtr || !objPtr->typePtr->freeIntRepProc) {
/*
@@ -1515,7 +1515,7 @@ int
TclObjBeingDeleted(
Tcl_Obj *objPtr)
{
- return (objPtr->length == -1);
+ return (objPtr->length == TCL_STRLEN);
}
/*
@@ -1638,7 +1638,7 @@ Tcl_GetString(
objPtr->typePtr->name);
}
objPtr->typePtr->updateStringProc(objPtr);
- if (objPtr->bytes == NULL || objPtr->length < 0
+ if (objPtr->bytes == NULL || objPtr->length == TCL_STRLEN
|| objPtr->bytes[objPtr->length] != '\0') {
Tcl_Panic("UpdateStringProc for type '%s' "
"failed to create a valid string rep", objPtr->typePtr->name);
@@ -1909,7 +1909,8 @@ Tcl_GetBooleanFromObj(
}
#endif
} while ((ParseBoolean(objPtr) == TCL_OK) || (TCL_OK ==
- TclParseNumber(interp, objPtr, "boolean value", NULL,-1,NULL,0)));
+ TclParseNumber(interp, objPtr, "boolean value", NULL, TCL_STRLEN,
+ NULL, 0)));
return TCL_ERROR;
}
@@ -1980,7 +1981,7 @@ SetBooleanFromAny(
TclNewLiteralStringObj(msg, "expected boolean value but got \"");
Tcl_AppendLimitedToObj(msg, str, length, 50, "");
- Tcl_AppendToObj(msg, "\"", -1);
+ Tcl_AppendToObj(msg, "\"", TCL_STRLEN);
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BOOLEAN", NULL);
}
@@ -2270,7 +2271,8 @@ Tcl_GetDoubleFromObj(
if (TclIsNaN(objPtr->internalRep.doubleValue)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "floating point value is Not a Number", -1));
+ "floating point value is Not a Number",
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "DOUBLE", "NAN",
NULL);
}
@@ -2325,8 +2327,8 @@ SetDoubleFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr) /* The object to convert. */
{
- return TclParseNumber(interp, objPtr, "floating-point number", NULL, -1,
- NULL, 0);
+ return TclParseNumber(interp, objPtr, "floating-point number", NULL,
+ TCL_STRLEN, NULL, 0);
}
/*
@@ -2355,7 +2357,7 @@ UpdateStringOfDouble(
register Tcl_Obj *objPtr) /* Double obj with string rep to update. */
{
char buffer[TCL_DOUBLE_SPACE];
- register int len;
+ register size_t len;
Tcl_PrintDouble(NULL, objPtr->internalRep.doubleValue, buffer);
len = strlen(buffer);
@@ -2490,9 +2492,9 @@ Tcl_GetIntFromObj(
}
if ((ULONG_MAX > UINT_MAX) && ((l > UINT_MAX) || (l < -(long)UINT_MAX))) {
if (interp != NULL) {
- const char *s =
+ static const char *s =
"integer value too large to represent as non-long integer";
- Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_STRLEN));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
}
return TCL_ERROR;
@@ -2552,7 +2554,7 @@ UpdateStringOfInt(
register Tcl_Obj *objPtr) /* Int object whose string rep to update. */
{
char buffer[TCL_INTEGER_SPACE];
- register int len;
+ register size_t len;
len = TclFormatInt(buffer, objPtr->internalRep.longValue);
@@ -2809,15 +2811,15 @@ Tcl_GetLongFromObj(
tooLarge:
#endif
if (interp != NULL) {
- const char *s = "integer value too large to represent";
- Tcl_Obj *msg = Tcl_NewStringObj(s, -1);
+ static const char *s = "integer value too large to represent";
+ Tcl_Obj *msg = Tcl_NewStringObj(s, TCL_STRLEN);
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
}
return TCL_ERROR;
}
- } while (TclParseNumber(interp, objPtr, "integer", NULL, -1, NULL,
+ } while (TclParseNumber(interp, objPtr, "integer", NULL, TCL_STRLEN, NULL,
TCL_PARSE_INTEGER_ONLY)==TCL_OK);
return TCL_ERROR;
}
@@ -2847,7 +2849,7 @@ UpdateStringOfWideInt(
register Tcl_Obj *objPtr) /* Int object whose string rep to update. */
{
char buffer[TCL_INTEGER_SPACE+2];
- register unsigned len;
+ register size_t len;
register Tcl_WideInt wideVal = objPtr->internalRep.wideValue;
/*
@@ -3106,15 +3108,15 @@ Tcl_GetWideIntFromObj(
}
}
if (interp != NULL) {
- const char *s = "integer value too large to represent";
- Tcl_Obj *msg = Tcl_NewStringObj(s, -1);
+ static const char *s = "integer value too large to represent";
+ Tcl_Obj *msg = Tcl_NewStringObj(s, TCL_STRLEN);
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
}
return TCL_ERROR;
}
- } while (TclParseNumber(interp, objPtr, "integer", NULL, -1, NULL,
+ } while (TclParseNumber(interp, objPtr, "integer", NULL, TCL_STRLEN, NULL,
TCL_PARSE_INTEGER_ONLY)==TCL_OK);
return TCL_ERROR;
}
@@ -3408,7 +3410,7 @@ GetBignumFromObj(
}
return TCL_ERROR;
}
- } while (TclParseNumber(interp, objPtr, "integer", NULL, -1, NULL,
+ } while (TclParseNumber(interp, objPtr, "integer", NULL, TCL_STRLEN, NULL,
TCL_PARSE_INTEGER_ONLY)==TCL_OK);
return TCL_ERROR;
}
@@ -3660,8 +3662,8 @@ TclGetNumberFromObj(
*clientDataPtr = bigPtr;
return TCL_OK;
}
- } while (TCL_OK ==
- TclParseNumber(interp, objPtr, "number", NULL, -1, NULL, 0));
+ } while (TCL_OK == TclParseNumber(interp, objPtr, "number", NULL,
+ TCL_STRLEN, NULL, 0));
return TCL_ERROR;
}
@@ -3967,7 +3969,7 @@ TclCompareObjKeys(
Tcl_Obj *objPtr1 = keyPtr;
Tcl_Obj *objPtr2 = (Tcl_Obj *) hPtr->key.oneWordValue;
register const char *p1, *p2;
- register int l1, l2;
+ register size_t l1, l2;
/*
* If the object pointers are the same then they match.
@@ -4497,12 +4499,12 @@ Tcl_RepresentationCmd(
}
if (objv[1]->bytes) {
- Tcl_AppendToObj(descObj, ", string representation \"", -1);
+ Tcl_AppendToObj(descObj, ", string representation \"", TCL_STRLEN);
Tcl_AppendLimitedToObj(descObj, objv[1]->bytes, objv[1]->length,
16, "...");
- Tcl_AppendToObj(descObj, "\"", -1);
+ Tcl_AppendToObj(descObj, "\"", TCL_STRLEN);
} else {
- Tcl_AppendToObj(descObj, ", no string representation", -1);
+ Tcl_AppendToObj(descObj, ", no string representation", TCL_STRLEN);
}
Tcl_SetObjResult(interp, descObj);
diff --git a/generic/tclParse.c b/generic/tclParse.c
index c505130..a06bec5 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -187,11 +187,14 @@ void
TclParseInit(
Tcl_Interp *interp, /* Interpreter to use for error reporting */
const char *start, /* Start of string to be parsed. */
- size_t numBytes, /* Total number of bytes in string. If (size_t)-1,
- * the script consists of all bytes up to the
- * first null character. */
+ size_t numBytes, /* Total number of bytes in string. If
+ * TCL_STRLEN, the script consists of all
+ * bytes up to the first null character. */
Tcl_Parse *parsePtr) /* Points to struct to initialize */
{
+ if (numBytes == TCL_STRLEN) {
+ numBytes = strlen(start);
+ }
parsePtr->numWords = 0;
parsePtr->tokenPtr = parsePtr->staticTokens;
parsePtr->numTokens = 0;
@@ -259,7 +262,7 @@ Tcl_ParseCommand(
if ((start == NULL) && (numBytes != 0)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't parse a NULL pointer", -1));
+ "can't parse a NULL pointer", TCL_STRLEN));
}
return TCL_ERROR;
}
@@ -570,13 +573,13 @@ Tcl_ParseCommand(
if (src[-1] == '"') {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "extra characters after close-quote", -1));
+ "extra characters after close-quote", TCL_STRLEN));
}
parsePtr->errorType = TCL_PARSE_QUOTE_EXTRA;
} else {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "extra characters after close-brace", -1));
+ "extra characters after close-brace", TCL_STRLEN));
}
parsePtr->errorType = TCL_PARSE_BRACE_EXTRA;
}
@@ -1177,7 +1180,7 @@ ParseTokens(
if (numBytes == 0) {
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
- "missing close-bracket", -1));
+ "missing close-bracket", TCL_STRLEN));
}
parsePtr->errorType = TCL_PARSE_MISSING_BRACKET;
parsePtr->term = tokenPtr->start;
@@ -1413,7 +1416,7 @@ Tcl_ParseVarName(
if (numBytes == 0) {
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
- "missing close-brace for variable name", -1));
+ "missing close-brace for variable name", TCL_STRLEN));
}
parsePtr->errorType = TCL_PARSE_MISSING_VAR_BRACE;
parsePtr->term = tokenPtr->start-1;
@@ -1481,7 +1484,7 @@ Tcl_ParseVarName(
if ((parsePtr->term == src+numBytes) || (*parsePtr->term != ')')){
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
- "missing )", -1));
+ "missing )", TCL_STRLEN));
}
parsePtr->errorType = TCL_PARSE_MISSING_PAREN;
parsePtr->term = src;
@@ -1548,7 +1551,7 @@ Tcl_ParseVar(
int code;
Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse));
- if (Tcl_ParseVarName(interp, start, -1, parsePtr, 0) != TCL_OK) {
+ if (Tcl_ParseVarName(interp, start, TCL_STRLEN, parsePtr, 0) != TCL_OK) {
TclStackFree(interp, parsePtr);
return NULL;
}
@@ -1758,7 +1761,7 @@ Tcl_ParseBraces(
}
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
- "missing close-brace", -1));
+ "missing close-brace", TCL_STRLEN));
/*
* Guess if the problem is due to comments by searching the source string
@@ -1781,7 +1784,8 @@ Tcl_ParseBraces(
case '#' :
if (openBrace && TclIsSpaceProc(src[-1])) {
Tcl_AppendToObj(Tcl_GetObjResult(parsePtr->interp),
- ": possible unbalanced brace in comment", -1);
+ ": possible unbalanced brace in comment",
+ TCL_STRLEN);
goto error;
}
break;
@@ -1861,7 +1865,7 @@ Tcl_ParseQuotedString(
if (*parsePtr->term != '"') {
if (parsePtr->interp != NULL) {
Tcl_SetObjResult(parsePtr->interp, Tcl_NewStringObj(
- "missing \"", -1));
+ "missing \"", TCL_STRLEN));
}
parsePtr->errorType = TCL_PARSE_MISSING_QUOTE;
parsePtr->term = start;
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 7b6a972..0935615 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -228,6 +228,7 @@ TclFSNormalizeAbsolutePath(
if (retVal == NULL) {
const char *path = TclGetString(pathPtr);
+
retVal = Tcl_NewStringObj(path, dirSep - path);
Tcl_IncrRefCount(retVal);
}
@@ -705,7 +706,7 @@ TclPathPart(
return pathPtr;
} else {
Tcl_Obj *root = Tcl_NewStringObj(fileName,
- (int) (length - strlen(extension)));
+ length - strlen(extension));
Tcl_IncrRefCount(root);
return root;
@@ -782,7 +783,7 @@ GetExtension(
if (extension == NULL) {
ret = Tcl_NewObj();
} else {
- ret = Tcl_NewStringObj(extension, -1);
+ ret = Tcl_NewStringObj(extension, TCL_STRLEN);
}
Tcl_IncrRefCount(ret);
return ret;
@@ -1493,7 +1494,8 @@ MakePathFromNormalized(
if (pathPtr->typePtr->updateStringProc == NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't find object string representation", -1));
+ "can't find object string representation",
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "PATH", "WTF",
NULL);
}
@@ -2376,7 +2378,7 @@ SetFsPathFromAny(
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't find HOME environment variable to"
- " expand path", -1));
+ " expand path", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "PATH",
"HOMELESS", NULL);
}
@@ -2446,7 +2448,7 @@ SetFsPathFromAny(
*/
Tcl_Obj *joined;
- Tcl_Obj *rest = Tcl_NewStringObj(name+split+1, -1);
+ Tcl_Obj *rest = Tcl_NewStringObj(name+split+1, TCL_STRLEN);
Tcl_IncrRefCount(transPtr);
joined = Tcl_FSJoinToPath(transPtr, 1, &rest);
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index 7220569..b635a61 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -347,7 +347,8 @@ TclCleanupChildren(
"child suspended: %s\n", p));
} else {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "child wait status didn't make sense\n", -1));
+ "child wait status didn't make sense\n",
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
"ODDWAITRESULT", msg1, NULL);
}
@@ -372,7 +373,7 @@ TclCleanupChildren(
Tcl_Seek(errorChan, (Tcl_WideInt)0, SEEK_SET);
objPtr = Tcl_NewObj();
- count = Tcl_ReadChars(errorChan, objPtr, -1, 0);
+ count = Tcl_ReadChars(errorChan, objPtr, TCL_STRLEN, 0);
if (count < 0) {
result = TCL_ERROR;
Tcl_DecrRefCount(objPtr);
@@ -398,7 +399,7 @@ TclCleanupChildren(
if ((abnormalExit != 0) && (anyErrorInfo == 0) && (interp != NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "child process exited abnormally", -1));
+ "child process exited abnormally", TCL_STRLEN));
}
return result;
}
@@ -549,7 +550,7 @@ TclCreatePipeline(
if (*p == '\0') {
if ((i == (lastBar + 1)) || (i == (argc - 1))) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "illegal use of | or |& in command", -1));
+ "illegal use of | or |& in command", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
"PIPESYNTAX", NULL);
goto error;
@@ -731,7 +732,7 @@ TclCreatePipeline(
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "illegal use of | or |& in command", -1));
+ "illegal use of | or |& in command", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", "PIPESYNTAX",
NULL);
goto error;
@@ -1084,7 +1085,7 @@ Tcl_OpenCommandChannel(
if ((flags & TCL_STDOUT) && (outPipe == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't read output from command:"
- " standard output was redirected", -1));
+ " standard output was redirected", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
"BADREDIRECT", NULL);
goto error;
@@ -1092,7 +1093,7 @@ Tcl_OpenCommandChannel(
if ((flags & TCL_STDIN) && (inPipe == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't write input to command:"
- " standard input was redirected", -1));
+ " standard input was redirected", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
"BADREDIRECT", NULL);
goto error;
@@ -1104,7 +1105,7 @@ Tcl_OpenCommandChannel(
if (channel == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "pipe for command could not be created", -1));
+ "pipe for command could not be created", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", "NOPIPE", NULL);
goto error;
}
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index baa1d5d..b7d12b6 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -303,7 +303,7 @@ Tcl_PkgRequireEx(
!= CheckVersionAndConvert(interp, version, NULL, NULL)) {
return NULL;
}
- ov = Tcl_NewStringObj(version, -1);
+ ov = Tcl_NewStringObj(version, TCL_STRLEN);
if (exact) {
Tcl_AppendStringsToObj(ov, "-", version, NULL);
}
@@ -332,7 +332,7 @@ Tcl_PkgRequireProc(
if (result == NULL) {
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(result, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(result, TCL_STRLEN));
return TCL_OK;
}
@@ -488,7 +488,7 @@ PkgRequireCore(
pkgPtr->clientData = versionToProvide;
Tcl_Preserve(script);
Tcl_Preserve(versionToProvide);
- code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL);
+ code = Tcl_EvalEx(interp, script, TCL_STRLEN, TCL_EVAL_GLOBAL);
Tcl_Release(script);
pkgPtr = FindPackage(interp, name);
@@ -584,7 +584,7 @@ PkgRequireCore(
script = ((Interp *) interp)->packageUnknown;
if (script != NULL) {
Tcl_DStringInit(&command);
- Tcl_DStringAppend(&command, script, -1);
+ Tcl_DStringAppend(&command, script, TCL_STRLEN);
Tcl_DStringAppendElement(&command, name);
AddRequirementsToDString(&command, reqc, reqv);
@@ -856,7 +856,7 @@ Tcl_PackageObjCmd(
if (objc == 4) {
ckfree(argv3i);
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(availPtr->script, -1));
+ Tcl_NewStringObj(availPtr->script, TCL_STRLEN));
return TCL_OK;
}
Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC);
@@ -898,7 +898,7 @@ Tcl_PackageObjCmd(
pkgPtr = Tcl_GetHashValue(hPtr);
if ((pkgPtr->version != NULL) || (pkgPtr->availPtr != NULL)) {
Tcl_ListObjAppendElement(NULL,resultObj, Tcl_NewStringObj(
- Tcl_GetHashKey(tablePtr, hPtr), -1));
+ Tcl_GetHashKey(tablePtr, hPtr), TCL_STRLEN));
}
}
Tcl_SetObjResult(interp, resultObj);
@@ -962,7 +962,7 @@ Tcl_PackageObjCmd(
pkgPtr = Tcl_GetHashValue(hPtr);
if (pkgPtr->version != NULL) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(pkgPtr->version, -1));
+ Tcl_NewStringObj(pkgPtr->version, TCL_STRLEN));
}
}
return TCL_OK;
@@ -1002,7 +1002,7 @@ Tcl_PackageObjCmd(
* Create a new-style requirement for the exact version.
*/
- ov = Tcl_NewStringObj(version, -1);
+ ov = Tcl_NewStringObj(version, TCL_STRLEN);
Tcl_AppendStringsToObj(ov, "-", version, NULL);
version = NULL;
argv3 = TclGetString(objv[3]);
@@ -1025,7 +1025,7 @@ Tcl_PackageObjCmd(
if (objc == 2) {
if (iPtr->packageUnknown != NULL) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(iPtr->packageUnknown, -1));
+ Tcl_NewStringObj(iPtr->packageUnknown, TCL_STRLEN));
}
} else if (objc == 3) {
if (iPtr->packageUnknown != NULL) {
@@ -1076,8 +1076,8 @@ Tcl_PackageObjCmd(
* Always return current value.
*/
- Tcl_SetObjResult(interp,
- Tcl_NewStringObj(pkgPreferOptions[iPtr->packagePrefer], -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ pkgPreferOptions[iPtr->packagePrefer], TCL_STRLEN));
break;
}
case PKG_VCOMPARE:
@@ -1123,7 +1123,7 @@ Tcl_PackageObjCmd(
for (availPtr = pkgPtr->availPtr; availPtr != NULL;
availPtr = availPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, resultObj,
- Tcl_NewStringObj(availPtr->version, -1));
+ Tcl_NewStringObj(availPtr->version, TCL_STRLEN));
}
}
Tcl_SetObjResult(interp, resultObj);
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c
index 266fd82..1a2edc4 100644
--- a/generic/tclRegexp.c
+++ b/generic/tclRegexp.c
@@ -682,7 +682,7 @@ TclRegAbout(
for (inf=infonames ; inf->bit != 0 ; inf++) {
if (regexpPtr->re.re_info & inf->bit) {
Tcl_ListObjAppendElement(NULL, infoObj,
- Tcl_NewStringObj(inf->text, -1));
+ Tcl_NewStringObj(inf->text, TCL_STRLEN));
}
}
Tcl_ListObjAppendElement(NULL, resultObj, infoObj);
diff --git a/generic/tclResult.c b/generic/tclResult.c
index d05dc6f..5aa6785 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -1027,7 +1027,8 @@ Tcl_SetErrorCodeVA(
if (elem == NULL) {
break;
}
- Tcl_ListObjAppendElement(NULL, errorObj, Tcl_NewStringObj(elem, -1));
+ Tcl_ListObjAppendElement(NULL, errorObj,
+ Tcl_NewStringObj(elem, TCL_STRLEN));
}
Tcl_SetObjErrorCode(interp, errorObj);
}
@@ -1586,7 +1587,7 @@ Tcl_GetReturnOptions(
}
if (result == TCL_ERROR) {
- Tcl_AddObjErrorInfo(interp, "", -1);
+ Tcl_AddObjErrorInfo(interp, "", TCL_STRLEN);
Tcl_DictObjPut(NULL, options, keys[KEY_ERRORSTACK], iPtr->errorStack);
}
if (iPtr->errorCode) {
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 59725b3..723c6b8 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -334,7 +334,7 @@ ValidateFormat(
mixedXPG:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot mix \"%\" and \"%n$\" conversion specifiers",
- -1));
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "MIXEDSPECTYPES", NULL);
goto error;
}
@@ -381,7 +381,7 @@ ValidateFormat(
if (flags & SCAN_WIDTH) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"field width may not be specified in %c conversion",
- -1));
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADWIDTH", NULL);
goto error;
}
@@ -394,9 +394,10 @@ ValidateFormat(
invalidFieldSize:
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
errorMsg = Tcl_NewStringObj(
- "field size modifier may not be specified in %", -1);
- Tcl_AppendToObj(errorMsg, buf, -1);
- Tcl_AppendToObj(errorMsg, " conversion", -1);
+ "field size modifier may not be specified in %",
+ TCL_STRLEN);
+ Tcl_AppendToObj(errorMsg, buf, TCL_STRLEN);
+ Tcl_AppendToObj(errorMsg, " conversion", TCL_STRLEN);
Tcl_SetObjResult(interp, errorMsg);
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADSIZE", NULL);
goto error;
@@ -416,7 +417,7 @@ ValidateFormat(
case 'u':
if (flags & SCAN_BIG) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "unsigned bignum scans are invalid", -1));
+ "unsigned bignum scans are invalid", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADUNSIGNED",NULL);
goto error;
}
@@ -453,15 +454,15 @@ ValidateFormat(
break;
badSet:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "unmatched [ in format string", -1));
+ "unmatched [ in format string", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BRACKET", NULL);
goto error;
default:
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
errorMsg = Tcl_NewStringObj(
- "bad scan conversion character \"", -1);
- Tcl_AppendToObj(errorMsg, buf, -1);
- Tcl_AppendToObj(errorMsg, "\"", -1);
+ "bad scan conversion character \"", TCL_STRLEN);
+ Tcl_AppendToObj(errorMsg, buf, TCL_STRLEN);
+ Tcl_AppendToObj(errorMsg, "\"", TCL_STRLEN);
Tcl_SetObjResult(interp, errorMsg);
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADTYPE", NULL);
goto error;
@@ -509,7 +510,7 @@ ValidateFormat(
if (nassign[i] > 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"variable is assigned by multiple \"%n$\" conversion specifiers",
- -1));
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "POLYASSIGNED", NULL);
goto error;
} else if (!xpgSize && (nassign[i] == 0)) {
@@ -520,7 +521,7 @@ ValidateFormat(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"variable is not assigned by any conversion specifiers",
- -1));
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "UNASSIGNED", NULL);
goto error;
}
@@ -532,12 +533,12 @@ ValidateFormat(
badIndex:
if (gotXpg) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "\"%n$\" argument index out of range", -1));
+ "\"%n$\" argument index out of range", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "INDEXRANGE", NULL);
} else {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"different numbers of variable names and field specifiers",
- -1));
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "FORMAT", "FIELDVARMISMATCH", NULL);
}
@@ -926,7 +927,7 @@ Tcl_ScanObjCmd(
if ((flags & SCAN_UNSIGNED) && (wideValue < 0)) {
sprintf(buf, "%" TCL_LL_MODIFIER "u",
(Tcl_WideUInt)wideValue);
- Tcl_SetStringObj(objPtr, buf, -1);
+ Tcl_SetStringObj(objPtr, buf, TCL_STRLEN);
} else {
Tcl_SetWideIntObj(objPtr, wideValue);
}
@@ -940,7 +941,7 @@ Tcl_ScanObjCmd(
}
if ((flags & SCAN_UNSIGNED) && (value < 0)) {
sprintf(buf, "%lu", value); /* INTL: ISO digit */
- Tcl_SetStringObj(objPtr, buf, -1);
+ Tcl_SetStringObj(objPtr, buf, TCL_STRLEN);
} else {
Tcl_SetLongObj(objPtr, value);
}
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 270012b..0cfccd2 100755
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -383,9 +383,9 @@ static Tcl_WideUInt Nokia770Twiddle(Tcl_WideUInt w);
* the first byte to be scanned. If bytes is NULL, then objPtr must be
* non-NULL, and the string representation of objPtr will be scanned
* (generated first, if necessary). The numBytes argument determines the
- * number of bytes to be scanned. If numBytes is negative, the first NUL
- * byte encountered will terminate the scan. If numBytes is non-negative,
- * then no more than numBytes bytes will be scanned.
+ * number of bytes to be scanned. If numBytes is TCL_STRLEN, the first
+ * NUL byte encountered will terminate the scan. If numBytes is
+ * non-negative, then no more than numBytes bytes will be scanned.
*
* The argument flags is an input that controls the numeric formats
* recognized by the parser. The flag bits are:
@@ -1382,7 +1382,8 @@ TclParseNumber(
Tcl_AppendLimitedToObj(msg, bytes, numBytes, 50, "");
Tcl_AppendToObj(msg, "\"", TCL_STRLEN);
if (state == BAD_OCTAL) {
- Tcl_AppendToObj(msg, " (looks like invalid octal number)", -1);
+ Tcl_AppendToObj(msg, " (looks like invalid octal number)",
+ TCL_STRLEN);
}
Tcl_SetObjResult(interp, msg);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL);
@@ -4508,9 +4509,9 @@ Tcl_InitBignumFromDouble(
if (TclIsInfinite(d)) {
if (interp != NULL) {
- const char *s = "integer value too large to represent";
+ static const char *s = "integer value too large to represent";
- Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(s, TCL_STRLEN));
Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL);
}
return TCL_ERROR;
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 23f1052..b54dc35 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -753,8 +753,9 @@ Tcl_SetStringObj(
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 negative,
- * use bytes up to the first NUL byte.*/
+ * when initializing the object. If
+ * TCL_STRLEN, use bytes up to the first NUL
+ * byte.*/
{
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_SetStringObj");
@@ -2529,7 +2530,7 @@ AppendPrintfToObjVA(
}
Tcl_ListObjAppendElement(NULL, list,
- Tcl_NewStringObj(bytes , (int)(end - bytes)));
+ Tcl_NewStringObj(bytes, (size_t)(end - bytes)));
break;
}
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 780d720..a59a652 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -913,7 +913,7 @@ TestasyncCmd(
break;
}
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(argv[3], -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(argv[3], TCL_STRLEN));
Tcl_MutexUnlock(&asyncTestMutex);
return code;
#ifdef TCL_THREADS
@@ -1155,8 +1155,8 @@ CmdDelProc1(
ClientData clientData) /* String to save. */
{
Tcl_DStringInit(&delString);
- Tcl_DStringAppend(&delString, "CmdDelProc1 ", -1);
- Tcl_DStringAppend(&delString, (char *) clientData, -1);
+ Tcl_DStringAppend(&delString, "CmdDelProc1 ", TCL_STRLEN);
+ Tcl_DStringAppend(&delString, (char *) clientData, TCL_STRLEN);
}
static void
@@ -1164,8 +1164,8 @@ CmdDelProc2(
ClientData clientData) /* String to save. */
{
Tcl_DStringInit(&delString);
- Tcl_DStringAppend(&delString, "CmdDelProc2 ", -1);
- Tcl_DStringAppend(&delString, (char *) clientData, -1);
+ Tcl_DStringAppend(&delString, "CmdDelProc2 ", TCL_STRLEN);
+ Tcl_DStringAppend(&delString, (char *) clientData, TCL_STRLEN);
}
/*
@@ -1401,7 +1401,7 @@ ObjTraceProc(
const char *word = Tcl_GetString(objv[0]);
if (!strcmp(word, "Error")) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(command, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(command, TCL_STRLEN));
return TCL_ERROR;
} else if (!strcmp(word, "Break")) {
return TCL_BREAK;
@@ -1761,14 +1761,15 @@ TestdoubledigitsObjCmd(
if (status != TCL_OK
|| Tcl_GetIntFromObj(interp, objv[2], &ndigits) != TCL_OK
|| Tcl_GetIndexFromObj(interp, objv[3], options, "conversion type",
- TCL_EXACT, &type) != TCL_OK) {
+ TCL_EXACT, &type) != TCL_OK) {
fprintf(stderr, "bad value? %g\n", d);
return TCL_ERROR;
}
type = types[type];
if (objc > 4) {
if (strcmp(Tcl_GetString(objv[4]), "shorten")) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("bad flag", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("bad flag",
+ TCL_STRLEN));
return TCL_ERROR;
}
type |= TCL_DD_SHORTEN_FLAG;
@@ -3086,7 +3087,7 @@ TestlinkCmd(
}
}
if (argv[6][0] != 0) {
- tmp = Tcl_NewStringObj(argv[6], -1);
+ tmp = Tcl_NewStringObj(argv[6], TCL_STRLEN);
if (Tcl_GetWideIntFromObj(interp, tmp, &wideVar) != TCL_OK) {
Tcl_DecrRefCount(tmp);
return TCL_ERROR;
@@ -3144,7 +3145,7 @@ TestlinkCmd(
}
if (argv[15][0]) {
Tcl_WideInt w;
- tmp = Tcl_NewStringObj(argv[15], -1);
+ tmp = Tcl_NewStringObj(argv[15], TCL_STRLEN);
if (Tcl_GetWideIntFromObj(interp, tmp, &w) != TCL_OK) {
Tcl_DecrRefCount(tmp);
return TCL_ERROR;
@@ -3194,7 +3195,7 @@ TestlinkCmd(
Tcl_UpdateLinkedVar(interp, "string");
}
if (argv[6][0] != 0) {
- tmp = Tcl_NewStringObj(argv[6], -1);
+ tmp = Tcl_NewStringObj(argv[6], TCL_STRLEN);
if (Tcl_GetWideIntFromObj(interp, tmp, &wideVar) != TCL_OK) {
Tcl_DecrRefCount(tmp);
return TCL_ERROR;
@@ -3261,7 +3262,7 @@ TestlinkCmd(
}
if (argv[15][0]) {
Tcl_WideInt w;
- tmp = Tcl_NewStringObj(argv[15], -1);
+ tmp = Tcl_NewStringObj(argv[15], TCL_STRLEN);
if (Tcl_GetWideIntFromObj(interp, tmp, &w) != TCL_OK) {
Tcl_DecrRefCount(tmp);
return TCL_ERROR;
@@ -3335,7 +3336,7 @@ TestlocaleCmd(
}
locale = setlocale(lcTypes[index], locale);
if (locale) {
- Tcl_SetStringObj(Tcl_GetObjResult(interp), locale, -1);
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), locale, TCL_STRLEN);
}
return TCL_OK;
}
@@ -3697,15 +3698,14 @@ PrintParse(
break;
}
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj(typeString, -1));
+ Tcl_NewStringObj(typeString, TCL_STRLEN));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewStringObj(tokenPtr->start, tokenPtr->size));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewIntObj(tokenPtr->numComponents));
}
- Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj(parsePtr->commandStart + parsePtr->commandSize,
- -1));
+ Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj(
+ parsePtr->commandStart + parsePtr->commandSize, TCL_STRLEN));
}
/*
@@ -4820,7 +4820,7 @@ GetTimesCmd(
/* TclGetString 100000 times */
fprintf(stderr, "TclGetStringFromObj of \"12345\" 100000 times\n");
- objPtr = Tcl_NewStringObj("12345", -1);
+ objPtr = Tcl_NewStringObj("12345", TCL_STRLEN);
Tcl_GetTime(&start);
for (i = 0; i < 100000; i++) {
(void) TclGetString(objPtr);
@@ -5119,7 +5119,7 @@ TestsaveresultCmd(
Tcl_SetResult(interp, (char *)"dynamic result", TestsaveresultFree);
break;
case RESULT_OBJECT:
- objPtr = Tcl_NewStringObj("object result", -1);
+ objPtr = Tcl_NewStringObj("object result", TCL_STRLEN);
Tcl_SetObjResult(interp, objPtr);
break;
}
@@ -5386,7 +5386,7 @@ TestChannelCmd(
if ((cmdName[0] == 's') && (strncmp(cmdName, "setchannelerror", len) == 0)) {
- Tcl_Obj *msg = Tcl_NewStringObj(argv[3],-1);
+ Tcl_Obj *msg = Tcl_NewStringObj(argv[3], TCL_STRLEN);
Tcl_IncrRefCount(msg);
Tcl_SetChannelError(chan, msg);
@@ -5399,7 +5399,7 @@ TestChannelCmd(
}
if ((cmdName[0] == 's') && (strncmp(cmdName, "setchannelerrorinterp", len) == 0)) {
- Tcl_Obj *msg = Tcl_NewStringObj(argv[3],-1);
+ Tcl_Obj *msg = Tcl_NewStringObj(argv[3], TCL_STRLEN);
Tcl_IncrRefCount(msg);
Tcl_SetChannelErrorInterp(interp, msg);
@@ -5747,7 +5747,7 @@ TestChannelCmd(
}
return TclChannelTransform(interp, chan,
- Tcl_NewStringObj(argv[4], -1));
+ Tcl_NewStringObj(argv[4], TCL_STRLEN));
}
if ((cmdName[0] == 'u') && (strncmp(cmdName, "unstack", len) == 0)) {
@@ -5839,7 +5839,7 @@ TestChannelEventCmd(
esPtr->chanPtr = chanPtr;
esPtr->interp = interp;
esPtr->mask = mask;
- esPtr->scriptPtr = Tcl_NewStringObj(argv[4], -1);
+ esPtr->scriptPtr = Tcl_NewStringObj(argv[4], TCL_STRLEN);
Tcl_IncrRefCount(esPtr->scriptPtr);
Tcl_CreateChannelHandler((Tcl_Channel) chanPtr, mask,
@@ -5906,10 +5906,11 @@ TestChannelEventCmd(
esPtr = esPtr->nextPtr) {
if (esPtr->mask) {
Tcl_ListObjAppendElement(interp, resultListPtr, Tcl_NewStringObj(
- (esPtr->mask == TCL_READABLE) ? "readable" : "writable", -1));
+ (esPtr->mask == TCL_READABLE) ? "readable" : "writable",
+ TCL_STRLEN));
} else {
Tcl_ListObjAppendElement(interp, resultListPtr,
- Tcl_NewStringObj("none", -1));
+ Tcl_NewStringObj("none", TCL_STRLEN));
}
Tcl_ListObjAppendElement(interp, resultListPtr, esPtr->scriptPtr);
}
@@ -6133,7 +6134,7 @@ TestFilesystemObjCmd(
res = Tcl_FSUnregister(&testReportingFilesystem);
msg = (res == TCL_OK) ? "unregistered" : "failed";
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(msg , -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(msg , TCL_STRLEN));
return res;
}
@@ -6220,7 +6221,7 @@ TestReport(
Tcl_DString ds;
Tcl_DStringInit(&ds);
- Tcl_DStringAppend(&ds, "lappend filesystemReport ", -1);
+ Tcl_DStringAppend(&ds, "lappend filesystemReport ", TCL_STRLEN);
Tcl_DStringStartSublist(&ds);
Tcl_DStringAppendElement(&ds, cmd);
if (path != NULL) {
@@ -6505,7 +6506,7 @@ TestSimpleFilesystemObjCmd(
res = Tcl_FSUnregister(&simpleFilesystem);
msg = (res == TCL_OK) ? "unregistered" : "failed";
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(msg , -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(msg , TCL_STRLEN));
return res;
}
@@ -6532,7 +6533,7 @@ SimpleRedirect(
Tcl_IncrRefCount(pathPtr);
return pathPtr;
}
- origPtr = Tcl_NewStringObj(str+10,-1);
+ origPtr = Tcl_NewStringObj(str+10, TCL_STRLEN);
Tcl_IncrRefCount(origPtr);
return origPtr;
}
@@ -6571,7 +6572,7 @@ SimpleMatchInDirectory(
Tcl_Obj *gElt, *nElt;
Tcl_ListObjIndex(NULL, resPtr, j, &gElt);
- nElt = Tcl_NewStringObj("simplefs:/",10);
+ nElt = Tcl_NewStringObj("simplefs:/", 10);
Tcl_AppendObjToObj(nElt, gElt);
Tcl_ListObjAppendElement(NULL, resultPtr, nElt);
}
@@ -6634,7 +6635,7 @@ SimpleListVolumes(void)
/* Add one new volume */
Tcl_Obj *retVal;
- retVal = Tcl_NewStringObj("simplefs:/", -1);
+ retVal = Tcl_NewStringObj("simplefs:/", TCL_STRLEN);
Tcl_IncrRefCount(retVal);
return retVal;
}
@@ -6707,7 +6708,7 @@ TestcpuidCmd(
status = TclWinCPUID((unsigned) index, regs);
if (status != TCL_OK) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj("operation not available", -1));
+ Tcl_NewStringObj("operation not available", TCL_STRLEN));
return status;
}
for (i=0 ; i<4 ; ++i) {
@@ -6753,7 +6754,8 @@ TestHashSystemHashCmd(
hPtr = Tcl_CreateHashEntry(&hash, INT2PTR(i), &isNew);
if (!isNew) {
Tcl_SetObjResult(interp, Tcl_NewIntObj(i));
- Tcl_AppendToObj(Tcl_GetObjResult(interp)," creation problem",-1);
+ Tcl_AppendToObj(Tcl_GetObjResult(interp), " creation problem",
+ TCL_STRLEN);
Tcl_DeleteHashTable(&hash);
return TCL_ERROR;
}
@@ -6770,13 +6772,15 @@ TestHashSystemHashCmd(
hPtr = Tcl_FindHashEntry(&hash, (char *) INT2PTR(i));
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewIntObj(i));
- Tcl_AppendToObj(Tcl_GetObjResult(interp)," lookup problem",-1);
+ Tcl_AppendToObj(Tcl_GetObjResult(interp), " lookup problem",
+ TCL_STRLEN);
Tcl_DeleteHashTable(&hash);
return TCL_ERROR;
}
if (PTR2INT(Tcl_GetHashValue(hPtr)) != i+42) {
Tcl_SetObjResult(interp, Tcl_NewIntObj(i));
- Tcl_AppendToObj(Tcl_GetObjResult(interp)," value problem",-1);
+ Tcl_AppendToObj(Tcl_GetObjResult(interp), " value problem",
+ TCL_STRLEN);
Tcl_DeleteHashTable(&hash);
return TCL_ERROR;
}
@@ -6896,18 +6900,18 @@ TestconcatobjCmd(
*/
Tcl_SetObjResult(interp,
- Tcl_NewStringObj("Tcl_ConcatObj is unsafe:", -1));
+ Tcl_NewStringObj("Tcl_ConcatObj is unsafe:", TCL_STRLEN));
emptyPtr = Tcl_NewObj();
- list1Ptr = Tcl_NewStringObj("foo bar sum", -1);
+ list1Ptr = Tcl_NewStringObj("foo bar sum", TCL_STRLEN);
Tcl_ListObjLength(NULL, list1Ptr, &len);
if (list1Ptr->bytes != NULL) {
ckfree(list1Ptr->bytes);
list1Ptr->bytes = NULL;
}
- list2Ptr = Tcl_NewStringObj("eeny meeny", -1);
+ list2Ptr = Tcl_NewStringObj("eeny meeny", TCL_STRLEN);
Tcl_ListObjLength(NULL, list2Ptr, &len);
if (list2Ptr->bytes != NULL) {
ckfree(list2Ptr->bytes);
@@ -7354,7 +7358,7 @@ InterpCompiledVarResolver(
resVarInfo->vInfo.fetchProc = MyCompiledVarFetch;
resVarInfo->vInfo.deleteProc = MyCompiledVarFree;
resVarInfo->var = NULL;
- resVarInfo->nameObj = Tcl_NewStringObj(name, -1);
+ resVarInfo->nameObj = Tcl_NewStringObj(name, TCL_STRLEN);
Tcl_IncrRefCount(resVarInfo->nameObj);
*rPtr = &resVarInfo->vInfo;
return TCL_OK;
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index 2a69903..754a8bf 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -1176,7 +1176,7 @@ TeststringobjCmd(
SetVarToObj(varPtr, varIndex, Tcl_DuplicateObj(varPtr[varIndex]));
}
string = Tcl_GetString(objv[3]);
- Tcl_AppendToObj(varPtr[varIndex], string, length);
+ Tcl_AppendToObj(varPtr[varIndex], string, (size_t) length);
Tcl_SetObjResult(interp, varPtr[varIndex]);
break;
case 1: /* appendstrings */
diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c
index 9a17f30..ccd9649 100644
--- a/generic/tclThreadTest.c
+++ b/generic/tclThreadTest.c
@@ -663,10 +663,10 @@ ThreadErrorProc(
errorInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
if (errorProcString == NULL) {
errChannel = Tcl_GetStdChannel(TCL_STDERR);
- Tcl_WriteChars(errChannel, "Error from thread ", -1);
- Tcl_WriteChars(errChannel, buf, -1);
+ Tcl_WriteChars(errChannel, "Error from thread ", TCL_STRLEN);
+ Tcl_WriteChars(errChannel, buf, TCL_STRLEN);
Tcl_WriteChars(errChannel, "\n", 1);
- Tcl_WriteChars(errChannel, errorInfo, -1);
+ Tcl_WriteChars(errChannel, errorInfo, TCL_STRLEN);
Tcl_WriteChars(errChannel, "\n", 1);
} else {
argv[0] = errorProcString;
@@ -991,7 +991,8 @@ ThreadCancel(
Tcl_MutexUnlock(&threadMutex);
Tcl_ResetResult(interp);
return Tcl_CancelEval(tsdPtr->interp,
- (result != NULL) ? Tcl_NewStringObj(result, -1) : NULL, 0, flags);
+ (result != NULL) ? Tcl_NewStringObj(result, TCL_STRLEN) : NULL,
+ 0, flags);
}
/*
diff --git a/generic/tclTimer.c b/generic/tclTimer.c
index e772005..94eb2d0 100644
--- a/generic/tclTimer.c
+++ b/generic/tclTimer.c
@@ -980,7 +980,8 @@ Tcl_AfterObjCmd(
Tcl_ListObjAppendElement(interp, resultListPtr,
afterPtr->commandPtr);
Tcl_ListObjAppendElement(interp, resultListPtr, Tcl_NewStringObj(
- (afterPtr->token == NULL) ? "idle" : "timer", -1));
+ (afterPtr->token == NULL) ? "idle" : "timer",
+ TCL_STRLEN));
Tcl_SetObjResult(interp, resultListPtr);
}
break;
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index e64b5b5..92b1faf 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -1993,7 +1993,7 @@ TraceVarProc(
*/
Tcl_DStringInit(&cmd);
- Tcl_DStringAppend(&cmd, tvarPtr->command, (int) tvarPtr->length);
+ Tcl_DStringAppend(&cmd, tvarPtr->command, tvarPtr->length);
Tcl_DStringAppendElement(&cmd, name1);
Tcl_DStringAppendElement(&cmd, (name2 ? name2 : ""));
#ifndef TCL_REMOVE_OBSOLETE_TRACES
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 3d839bc..5b792d9 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3964,12 +3964,12 @@ TclGetProcessGlobalValue(
Tcl_UtfToExternalDString(pgvPtr->encoding, pgvPtr->value,
pgvPtr->numBytes, &native);
Tcl_ExternalToUtfDString(current, Tcl_DStringValue(&native),
- Tcl_DStringLength(&native), &newValue);
+ Tcl_DStringLength(&native), &newValue);
Tcl_DStringFree(&native);
ckfree(pgvPtr->value);
pgvPtr->value = ckalloc(Tcl_DStringLength(&newValue) + 1);
memcpy(pgvPtr->value, Tcl_DStringValue(&newValue),
- (size_t) Tcl_DStringLength(&newValue) + 1);
+ Tcl_DStringLength(&newValue) + 1);
Tcl_DStringFree(&newValue);
Tcl_FreeEncoding(pgvPtr->encoding);
pgvPtr->encoding = current;
diff --git a/generic/tclVar.c b/generic/tclVar.c
index b5137a3..40ada3f 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -254,7 +254,7 @@ TclVarHashCreateVar(
Tcl_Obj *keyPtr;
Var *varPtr;
- keyPtr = Tcl_NewStringObj(key, -1);
+ keyPtr = Tcl_NewStringObj(key, TCL_STRLEN);
Tcl_IncrRefCount(keyPtr);
varPtr = VarHashCreateVar(tablePtr, keyPtr, newPtr);
Tcl_DecrRefCount(keyPtr);
@@ -386,7 +386,7 @@ TclLookupVar(
Tcl_Obj *part1Ptr;
Var *varPtr;
- part1Ptr = Tcl_NewStringObj(part1, -1);
+ part1Ptr = Tcl_NewStringObj(part1, TCL_STRLEN);
Tcl_IncrRefCount(part1Ptr);
varPtr = TclObjLookupVar(interp, part1Ptr, part2, flags, msg,
@@ -464,7 +464,7 @@ TclObjLookupVar(
Var *resPtr;
if (part2) {
- part2Ptr = Tcl_NewStringObj(part2, -1);
+ part2Ptr = Tcl_NewStringObj(part2, TCL_STRLEN);
Tcl_IncrRefCount(part2Ptr);
} else {
part2Ptr = NULL;
@@ -619,7 +619,7 @@ TclObjLookupVarEx(
}
part2 = newPart2 = part1Ptr->internalRep.twoPtrValue.ptr2;
if (newPart2) {
- part2Ptr = Tcl_NewStringObj(newPart2, -1);
+ part2Ptr = Tcl_NewStringObj(newPart2, TCL_STRLEN);
Tcl_IncrRefCount(part2Ptr);
}
part1Ptr = part1Ptr->internalRep.twoPtrValue.ptr1;
@@ -662,10 +662,10 @@ TclObjLookupVarEx(
len1 = i;
newPart2 = ckalloc(len2 + 1);
- memcpy(newPart2, part2, (unsigned) len2);
+ memcpy(newPart2, part2, len2);
*(newPart2+len2) = '\0';
part2 = newPart2;
- part2Ptr = Tcl_NewStringObj(newPart2, -1);
+ part2Ptr = Tcl_NewStringObj(newPart2, TCL_STRLEN);
Tcl_IncrRefCount(part2Ptr);
/*
@@ -982,7 +982,7 @@ TclLookupSimpleVar(
return NULL;
}
if (tail != varName) {
- tailPtr = Tcl_NewStringObj(tail, -1);
+ tailPtr = Tcl_NewStringObj(tail, TCL_STRLEN);
} else {
tailPtr = varNamePtr;
}
@@ -1213,7 +1213,7 @@ Tcl_GetVar(
{
Tcl_Obj *varNamePtr, *resultPtr;
- varNamePtr = Tcl_NewStringObj(varName, -1);
+ varNamePtr = Tcl_NewStringObj(varName, TCL_STRLEN);
Tcl_IncrRefCount(varNamePtr);
resultPtr = Tcl_ObjGetVar2(interp, varNamePtr, NULL, flags);
TclDecrRefCount(varNamePtr);
@@ -1261,10 +1261,10 @@ Tcl_GetVar2(
{
Tcl_Obj *resultPtr, *part1Ptr, *part2Ptr;
- part1Ptr = Tcl_NewStringObj(part1, -1);
+ part1Ptr = Tcl_NewStringObj(part1, TCL_STRLEN);
Tcl_IncrRefCount(part1Ptr);
if (part2) {
- part2Ptr = Tcl_NewStringObj(part2, -1);
+ part2Ptr = Tcl_NewStringObj(part2, TCL_STRLEN);
Tcl_IncrRefCount(part2Ptr);
} else {
part2Ptr = NULL;
@@ -1318,10 +1318,10 @@ Tcl_GetVar2Ex(
{
Tcl_Obj *part1Ptr, *part2Ptr, *resPtr;
- part1Ptr = Tcl_NewStringObj(part1, -1);
+ part1Ptr = Tcl_NewStringObj(part1, TCL_STRLEN);
Tcl_IncrRefCount(part1Ptr);
if (part2) {
- part2Ptr = Tcl_NewStringObj(part2, -1);
+ part2Ptr = Tcl_NewStringObj(part2, TCL_STRLEN);
Tcl_IncrRefCount(part2Ptr);
} else {
part2Ptr = NULL;
@@ -1564,9 +1564,9 @@ Tcl_SetVar(
{
Tcl_Obj *valuePtr, *varNamePtr, *varValuePtr;
- varNamePtr = Tcl_NewStringObj(varName, -1);
+ varNamePtr = Tcl_NewStringObj(varName, TCL_STRLEN);
Tcl_IncrRefCount(varNamePtr);
- valuePtr = Tcl_NewStringObj(newValue, -1);
+ valuePtr = Tcl_NewStringObj(newValue, TCL_STRLEN);
Tcl_IncrRefCount(valuePtr);
varValuePtr = Tcl_ObjSetVar2(interp, varNamePtr, NULL, valuePtr, flags);
@@ -1623,15 +1623,15 @@ Tcl_SetVar2(
Tcl_Obj *valuePtr, *part1Ptr, *part2Ptr;
Tcl_Obj *varValuePtr;
- part1Ptr = Tcl_NewStringObj(part1, -1);
+ part1Ptr = Tcl_NewStringObj(part1, TCL_STRLEN);
Tcl_IncrRefCount(part1Ptr);
if (part2 != NULL) {
- part2Ptr = Tcl_NewStringObj(part2, -1);
+ part2Ptr = Tcl_NewStringObj(part2, TCL_STRLEN);
Tcl_IncrRefCount(part2Ptr);
} else {
part2Ptr = NULL;
}
- valuePtr = Tcl_NewStringObj(newValue, -1);
+ valuePtr = Tcl_NewStringObj(newValue, TCL_STRLEN);
Tcl_IncrRefCount(valuePtr);
varValuePtr = Tcl_ObjSetVar2(interp, part1Ptr, part2Ptr, valuePtr, flags);
@@ -1701,10 +1701,10 @@ Tcl_SetVar2Ex(
{
Tcl_Obj *part1Ptr, *part2Ptr, *resPtr;
- part1Ptr = Tcl_NewStringObj(part1, -1);
+ part1Ptr = Tcl_NewStringObj(part1, TCL_STRLEN);
Tcl_IncrRefCount(part1Ptr);
if (part2) {
- part2Ptr = Tcl_NewStringObj(part2, -1);
+ part2Ptr = Tcl_NewStringObj(part2, TCL_STRLEN);
Tcl_IncrRefCount(part2Ptr);
} else {
part2Ptr = NULL;
@@ -2175,7 +2175,7 @@ Tcl_UnsetVar(
int result;
Tcl_Obj *varNamePtr;
- varNamePtr = Tcl_NewStringObj(varName, -1);
+ varNamePtr = Tcl_NewStringObj(varName, TCL_STRLEN);
Tcl_IncrRefCount(varNamePtr);
/*
@@ -2223,10 +2223,10 @@ Tcl_UnsetVar2(
int result;
Tcl_Obj *part1Ptr, *part2Ptr = NULL;
- part1Ptr = Tcl_NewStringObj(part1, -1);
+ part1Ptr = Tcl_NewStringObj(part1, TCL_STRLEN);
Tcl_IncrRefCount(part1Ptr);
if (part2) {
- part2Ptr = Tcl_NewStringObj(part2, -1);
+ part2Ptr = Tcl_NewStringObj(part2, TCL_STRLEN);
Tcl_IncrRefCount(part2Ptr);
}
@@ -2938,7 +2938,7 @@ TclArraySet(
}
if (elemLen & 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "list must have an even number of elements", -1));
+ "list must have an even number of elements", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "FORMAT", NULL);
return TCL_ERROR;
}
@@ -4035,10 +4035,10 @@ ArrayStatsCmd(
stats = Tcl_HashStats((Tcl_HashTable *) varPtr->value.tablePtr);
if (stats == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "error reading array statistics", -1));
+ "error reading array statistics", TCL_STRLEN));
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(stats, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(stats, TCL_STRLEN));
ckfree(stats);
return TCL_OK;
}
@@ -4372,7 +4372,7 @@ TclPtrMakeUpvar(
int result;
if (myName) {
- myNamePtr = Tcl_NewStringObj(myName, -1);
+ myNamePtr = Tcl_NewStringObj(myName, TCL_STRLEN);
Tcl_IncrRefCount(myNamePtr);
} else {
myNamePtr = NULL;
@@ -4456,7 +4456,7 @@ TclPtrObjMakeUpvar(
if (varPtr == otherPtr) {
Tcl_SetObjResult((Tcl_Interp *) iPtr, Tcl_NewStringObj(
- "can't upvar from variable to itself", -1));
+ "can't upvar from variable to itself", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "UPVAR", "SELF", NULL);
return TCL_ERROR;
}
@@ -4544,9 +4544,9 @@ Tcl_UpVar(
return TCL_ERROR;
}
- varNamePtr = Tcl_NewStringObj(varName, -1);
+ varNamePtr = Tcl_NewStringObj(varName, TCL_STRLEN);
Tcl_IncrRefCount(varNamePtr);
- localNamePtr = Tcl_NewStringObj(localNameStr, -1);
+ localNamePtr = Tcl_NewStringObj(localNameStr, TCL_STRLEN);
Tcl_IncrRefCount(localNamePtr);
result = ObjMakeUpvar(interp, framePtr, varNamePtr, NULL, 0,
@@ -4598,9 +4598,9 @@ Tcl_UpVar2(
return TCL_ERROR;
}
- part1Ptr = Tcl_NewStringObj(part1, -1);
+ part1Ptr = Tcl_NewStringObj(part1, TCL_STRLEN);
Tcl_IncrRefCount(part1Ptr);
- localNamePtr = Tcl_NewStringObj(localNameStr, -1);
+ localNamePtr = Tcl_NewStringObj(localNameStr, TCL_STRLEN);
Tcl_IncrRefCount(localNamePtr);
result = ObjMakeUpvar(interp, framePtr, part1Ptr, part2, 0,
@@ -4653,7 +4653,7 @@ Tcl_GetVariableFullName(
nsPtr = TclGetVarNsPtr(varPtr);
if (nsPtr) {
- Tcl_AppendToObj(objPtr, nsPtr->fullName, -1);
+ Tcl_AppendToObj(objPtr, nsPtr->fullName, TCL_STRLEN);
if (nsPtr != iPtr->globalNsPtr) {
Tcl_AppendToObj(objPtr, "::", 2);
}
@@ -4738,7 +4738,7 @@ Tcl_GlobalObjCmd(
if (tail == varName) {
tailPtr = objPtr;
} else {
- tailPtr = Tcl_NewStringObj(tail, -1);
+ tailPtr = Tcl_NewStringObj(tail, TCL_STRLEN);
Tcl_IncrRefCount(tailPtr);
}
@@ -4889,7 +4889,7 @@ Tcl_VariableObjCmd(
if (tail == varName) {
tailPtr = varNamePtr;
} else {
- tailPtr = Tcl_NewStringObj(tail, -1);
+ tailPtr = Tcl_NewStringObj(tail, TCL_STRLEN);
Tcl_IncrRefCount(tailPtr);
}
@@ -5514,10 +5514,10 @@ TclVarErrMsg(
{
Tcl_Obj *part1Ptr = NULL, *part2Ptr = NULL;
- part1Ptr = Tcl_NewStringObj(part1, -1);
+ part1Ptr = Tcl_NewStringObj(part1, TCL_STRLEN);
Tcl_IncrRefCount(part1Ptr);
if (part2) {
- part2Ptr = Tcl_NewStringObj(part2, -1);
+ part2Ptr = Tcl_NewStringObj(part2, TCL_STRLEN);
Tcl_IncrRefCount(part2Ptr);
} else {
part2 = NULL;
@@ -5790,7 +5790,7 @@ Tcl_FindNamespaceVar(
* and TCL_NAMESPACE_ONLY are given,
* TCL_GLOBAL_ONLY is ignored. */
{
- Tcl_Obj *namePtr = Tcl_NewStringObj(name, -1);
+ Tcl_Obj *namePtr = Tcl_NewStringObj(name, TCL_STRLEN);
Tcl_Var var;
Tcl_IncrRefCount(namePtr);
@@ -5887,7 +5887,7 @@ ObjFindNamespaceVar(
varPtr = NULL;
if (simpleName != name) {
- simpleNamePtr = Tcl_NewStringObj(simpleName, -1);
+ simpleNamePtr = Tcl_NewStringObj(simpleName, TCL_STRLEN);
Tcl_IncrRefCount(simpleNamePtr);
} else {
simpleNamePtr = namePtr;
@@ -5981,7 +5981,7 @@ TclInfoVarsCmd(
if (simplePattern == pattern) {
simplePatternPtr = objv[1];
} else {
- simplePatternPtr = Tcl_NewStringObj(simplePattern, -1);
+ simplePatternPtr = Tcl_NewStringObj(simplePattern,TCL_STRLEN);
}
Tcl_IncrRefCount(simplePatternPtr);
}
@@ -6166,7 +6166,7 @@ TclInfoGlobalsCmd(
if (pattern == TclGetString(objv[1])) {
patternPtr = objv[1];
} else {
- patternPtr = Tcl_NewStringObj(pattern, -1);
+ patternPtr = Tcl_NewStringObj(pattern, TCL_STRLEN);
}
Tcl_IncrRefCount(patternPtr);
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index e2a9610..698262d 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -184,8 +184,8 @@ static int ZlibPushSubcmd(Tcl_Interp *interp, size_t objc,
Tcl_Obj *const objv[]);
static inline size_t ResultCopy(ZlibChannelData *cd, char *buf,
size_t toRead);
-static int ResultGenerate(ZlibChannelData *cd, int n, int flush,
- int *errorCodePtr);
+static int ResultGenerate(ZlibChannelData *cd, size_t n,
+ int flush, int *errorCodePtr);
static Tcl_Channel ZlibStackChannelTransform(Tcl_Interp *interp,
int mode, int format, int level, int limit,
Tcl_Channel channel, Tcl_Obj *gzipHeaderDictPtr,
@@ -259,7 +259,8 @@ ConvertError(
*/
case Z_ERRNO:
- Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_PosixError(interp),-1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_PosixError(interp),
+ TCL_STRLEN));
return;
/*
@@ -310,7 +311,7 @@ ConvertError(
sprintf(codeStrBuf, "%d", code);
break;
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(zError(code), -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(zError(code), TCL_STRLEN));
/*
* Tricky point! We might pass NULL twice here (and will when the error
@@ -347,7 +348,7 @@ ConvertErrorToList(
return Tcl_NewListObj(3, objv);
case Z_ERRNO:
TclNewLiteralStringObj(objv[2], "POSIX");
- objv[3] = Tcl_NewStringObj(Tcl_ErrnoId(), -1);
+ objv[3] = Tcl_NewStringObj(Tcl_ErrnoId(), TCL_STRLEN);
return Tcl_NewListObj(4, objv);
case Z_NEED_DICT:
TclNewLiteralStringObj(objv[2], "NEED_DICT");
@@ -402,7 +403,7 @@ GetValue(
const char *nameStr,
Tcl_Obj **valuePtrPtr)
{
- Tcl_Obj *name = Tcl_NewStringObj(nameStr, -1);
+ Tcl_Obj *name = Tcl_NewStringObj(nameStr, TCL_STRLEN);
int result = Tcl_DictObjGet(interp, dictObj, name, valuePtrPtr);
TclDecrRefCount(name);
@@ -525,7 +526,7 @@ SetValue(
const char *key,
Tcl_Obj *value)
{
- Tcl_Obj *keyObj = Tcl_NewStringObj(key, -1);
+ Tcl_Obj *keyObj = Tcl_NewStringObj(key, TCL_STRLEN);
Tcl_IncrRefCount(keyObj);
Tcl_DictObjPut(NULL, dictObj, keyObj, value);
@@ -552,8 +553,8 @@ ExtractHeader(
}
}
- Tcl_ExternalToUtfDString(latin1enc, (char *) headerPtr->comment, -1,
- &tmp);
+ Tcl_ExternalToUtfDString(latin1enc, (char *) headerPtr->comment,
+ TCL_STRLEN, &tmp);
SetValue(dictObj, "comment", TclDStringToObj(&tmp));
}
SetValue(dictObj, "crc", Tcl_NewBooleanObj(headerPtr->hcrc));
@@ -569,8 +570,8 @@ ExtractHeader(
}
}
- Tcl_ExternalToUtfDString(latin1enc, (char *) headerPtr->name, -1,
- &tmp);
+ Tcl_ExternalToUtfDString(latin1enc, (char *) headerPtr->name,
+ TCL_STRLEN, &tmp);
SetValue(dictObj, "filename", TclDStringToObj(&tmp));
}
if (headerPtr->os != 255) {
@@ -580,8 +581,8 @@ ExtractHeader(
SetValue(dictObj, "time", Tcl_NewLongObj((long) headerPtr->time));
}
if (headerPtr->text != Z_UNKNOWN) {
- SetValue(dictObj, "type",
- Tcl_NewStringObj(headerPtr->text ? "text" : "binary", -1));
+ SetValue(dictObj, "type", Tcl_NewStringObj(
+ headerPtr->text ? "text" : "binary", TCL_STRLEN));
}
if (latin1enc != NULL) {
@@ -783,7 +784,7 @@ Tcl_ZlibStreamInit(
if (Tcl_GetCommandInfo(interp, Tcl_DStringValue(&cmdname),
&cmdinfo) == 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "BUG: Stream command name already exists", -1));
+ "BUG: Stream command name already exists", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "BUG", "EXISTING_CMD", NULL);
Tcl_DStringFree(&cmdname);
goto error;
@@ -1167,7 +1168,7 @@ Tcl_ZlibStreamPut(
if (zshPtr->streamEnd) {
if (zshPtr->interp) {
Tcl_SetObjResult(zshPtr->interp, Tcl_NewStringObj(
- "already past compressed stream end", -1));
+ "already past compressed stream end", TCL_STRLEN));
Tcl_SetErrorCode(zshPtr->interp, "TCL", "ZIP", "CLOSED", NULL);
}
return TCL_ERROR;
@@ -1393,7 +1394,7 @@ Tcl_ZlibStreamGet(
if (zshPtr->interp) {
Tcl_SetObjResult(zshPtr->interp, Tcl_NewStringObj(
"unexpected zlib internal state during"
- " decompression", -1));
+ " decompression", TCL_STRLEN));
Tcl_SetErrorCode(zshPtr->interp, "TCL", "ZIP", "STATE",
NULL);
}
@@ -2145,7 +2146,8 @@ ZlibCmd(
return TCL_ERROR;
badLevel:
- Tcl_SetObjResult(interp, Tcl_NewStringObj("level must be 0 to 9", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("level must be 0 to 9",
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMPRESSIONLEVEL", NULL);
if (extraInfoStr) {
Tcl_AddErrorInfo(interp, extraInfoStr);
@@ -2288,7 +2290,8 @@ ZlibStreamSubcmd(
} else if (Tcl_GetIntFromObj(interp, levelObj, &level) != TCL_OK) {
return TCL_ERROR;
} else if (level < 0 || level > 9) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("level must be 0 to 9",-1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("level must be 0 to 9",
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMPRESSIONLEVEL", NULL);
Tcl_AddErrorInfo(interp, "\n (in -level option)");
return TCL_ERROR;
@@ -2398,13 +2401,15 @@ ZlibPushSubcmd(
if (mode == TCL_ZLIB_STREAM_DEFLATE && !(chanMode & TCL_WRITABLE)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "compression may only be applied to writable channels", -1));
+ "compression may only be applied to writable channels",
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "UNWRITABLE", NULL);
return TCL_ERROR;
}
if (mode == TCL_ZLIB_STREAM_INFLATE && !(chanMode & TCL_READABLE)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "decompression may only be applied to readable channels",-1));
+ "decompression may only be applied to readable channels",
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "UNREADABLE", NULL);
return TCL_ERROR;
}
@@ -2438,7 +2443,7 @@ ZlibPushSubcmd(
}
if (level < 0 || level > 9) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "level must be 0 to 9", -1));
+ "level must be 0 to 9", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMPRESSIONLEVEL",
NULL);
goto genericOptionError;
@@ -2460,7 +2465,7 @@ ZlibPushSubcmd(
if (format == TCL_ZLIB_FORMAT_GZIP) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"a compression dictionary may not be set in the "
- "gzip format", -1));
+ "gzip format", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "BADOPT", NULL);
goto genericOptionError;
}
@@ -2668,7 +2673,7 @@ ZlibStreamAddCmd(
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-buffer\" option must be followed by integer "
- "decompression buffersize", -1));
+ "decompression buffersize", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "NOVAL", NULL);
return TCL_ERROR;
}
@@ -2687,7 +2692,7 @@ ZlibStreamAddCmd(
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-dictionary\" option must be followed by"
- " compression dictionary bytes", -1));
+ " compression dictionary bytes", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "NOVAL", NULL);
return TCL_ERROR;
}
@@ -2698,7 +2703,7 @@ ZlibStreamAddCmd(
if (flush == -2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-flush\", \"-fullflush\" and \"-finalize\" options"
- " are mutually exclusive", -1));
+ " are mutually exclusive", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "EXCLUSIVE", NULL);
return TCL_ERROR;
}
@@ -2792,7 +2797,7 @@ ZlibStreamPutCmd(
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-dictionary\" option must be followed by"
- " compression dictionary bytes", -1));
+ " compression dictionary bytes", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "NOVAL", NULL);
return TCL_ERROR;
}
@@ -2802,7 +2807,7 @@ ZlibStreamPutCmd(
if (flush == -2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"\"-flush\", \"-fullflush\" and \"-finalize\" options"
- " are mutually exclusive", -1));
+ " are mutually exclusive", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "EXCLUSIVE", NULL);
return TCL_ERROR;
}
@@ -2848,7 +2853,8 @@ ZlibStreamHeaderCmd(
} else if (zshPtr->mode != TCL_ZLIB_STREAM_INFLATE
|| zshPtr->format != TCL_ZLIB_FORMAT_GZIP) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "only gunzip streams can produce header information", -1));
+ "only gunzip streams can produce header information",
+ TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "BADOP", NULL);
return TCL_ERROR;
}
@@ -2962,8 +2968,8 @@ ZlibTransformInput(
ZlibChannelData *cd = instanceData;
Tcl_DriverInputProc *inProc =
Tcl_ChannelInputProc(Tcl_GetChannelType(cd->parent));
- size_t readBytes, copied;
- ssize_t gotBytes;
+ size_t copied;
+ ssize_t readBytes, gotBytes;
if (cd->mode == TCL_ZLIB_STREAM_DEFLATE) {
return inProc(Tcl_GetChannelInstanceData(cd->parent), buf, toRead,
@@ -3011,7 +3017,7 @@ ZlibTransformInput(
* it is EOF, try flushing the data out of the decompressor.
*/
- if (readBytes != (size_t)-1) {
+ if (readBytes < 0) {
/*
* Report errors to caller. The state of the seek system is
* unchanged!
@@ -3143,11 +3149,12 @@ ZlibTransformOutput(
}
errObj = Tcl_NewListObj(0, NULL);
- Tcl_ListObjAppendElement(NULL, errObj, Tcl_NewStringObj("-errorcode",-1));
+ Tcl_ListObjAppendElement(NULL, errObj,
+ Tcl_NewStringObj("-errorcode", TCL_STRLEN));
Tcl_ListObjAppendElement(NULL, errObj,
ConvertErrorToList(e, cd->outStream.adler));
Tcl_ListObjAppendElement(NULL, errObj,
- Tcl_NewStringObj(cd->outStream.msg, -1));
+ Tcl_NewStringObj(cd->outStream.msg, TCL_STRLEN));
Tcl_SetChannelError(cd->parent, errObj);
*errorCodePtr = EINVAL;
return -1;
@@ -3263,7 +3270,7 @@ ZlibTransformSetOption( /* not used */
return TCL_ERROR;
} else if (newLimit < 1 || newLimit > MAX_BUFFER_SIZE) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "-limit must be between 1 and 65536", -1));
+ "-limit must be between 1 and 65536", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "READLIMIT", NULL);
return TCL_ERROR;
}
@@ -3337,7 +3344,7 @@ ZlibTransformGetOption(
Tcl_DStringAppendElement(dsPtr, "-checksum");
Tcl_DStringAppendElement(dsPtr, buf);
} else {
- Tcl_DStringAppend(dsPtr, buf, -1);
+ Tcl_DStringAppend(dsPtr, buf, TCL_STRLEN);
return TCL_OK;
}
}
@@ -3667,7 +3674,8 @@ ZlibStackChannelTransform(
}
cd->chan = chan;
cd->parent = Tcl_GetStackedChannel(chan);
- Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetChannelName(chan), -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ Tcl_GetChannelName(chan), TCL_STRLEN));
return chan;
error:
@@ -3764,7 +3772,7 @@ ResultCopy(
static int
ResultGenerate(
ZlibChannelData *cd,
- int n,
+ size_t n,
int flush,
int *errorCodePtr)
{
@@ -3838,11 +3846,12 @@ ResultGenerate(
handleError:
errObj = Tcl_NewListObj(0, NULL);
- Tcl_ListObjAppendElement(NULL, errObj, Tcl_NewStringObj("-errorcode",-1));
+ Tcl_ListObjAppendElement(NULL, errObj,
+ Tcl_NewStringObj("-errorcode", TCL_STRLEN));
Tcl_ListObjAppendElement(NULL, errObj,
ConvertErrorToList(e, cd->inStream.adler));
Tcl_ListObjAppendElement(NULL, errObj,
- Tcl_NewStringObj(cd->inStream.msg, -1));
+ Tcl_NewStringObj(cd->inStream.msg, TCL_STRLEN));
Tcl_SetChannelError(cd->parent, errObj);
*errorCodePtr = EINVAL;
return TCL_ERROR;
@@ -3910,7 +3919,7 @@ Tcl_ZlibStreamInit(
Tcl_Obj *dictObj,
Tcl_ZlibStream *zshandle)
{
- Tcl_SetObjResult(interp, Tcl_NewStringObj("unimplemented", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("unimplemented", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "UNIMPLEMENTED", NULL);
return TCL_ERROR;
}
@@ -3976,7 +3985,7 @@ Tcl_ZlibDeflate(
int level,
Tcl_Obj *gzipHeaderDictObj)
{
- Tcl_SetObjResult(interp, Tcl_NewStringObj("unimplemented", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("unimplemented", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "UNIMPLEMENTED", NULL);
return TCL_ERROR;
}
@@ -3989,7 +3998,7 @@ Tcl_ZlibInflate(
int bufferSize,
Tcl_Obj *gzipHeaderDictObj)
{
- Tcl_SetObjResult(interp, Tcl_NewStringObj("unimplemented", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("unimplemented", TCL_STRLEN));
Tcl_SetErrorCode(interp, "TCL", "UNIMPLEMENTED", NULL);
return TCL_ERROR;
}