diff options
| -rw-r--r-- | generic/tclInt.decls | 8 | ||||
| -rw-r--r-- | generic/tclIntDecls.h | 20 | ||||
| -rw-r--r-- | generic/tclLiteral.c | 59 | ||||
| -rw-r--r-- | generic/tclStubInit.c | 6 | ||||
| -rw-r--r-- | generic/tclTest.c | 125 | ||||
| -rw-r--r-- | generic/tclUtf.c | 4 | ||||
| -rw-r--r-- | generic/tclUtil.c | 7 | ||||
| -rw-r--r-- | generic/tclZlib.c | 2 | ||||
| -rw-r--r-- | unix/tclUnixSock.c | 2 |
9 files changed, 137 insertions, 96 deletions
diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 96fa01c..46adc69 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -1037,7 +1037,13 @@ declare 256 { int TclPtrUnsetVar(Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags) } -declare 259 { + +declare 257 { + void TclStaticPackage(Tcl_Interp *interp, const char *pkgName, + Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc) +} + +declare 260 { void TclUnusedStubEntry(void) } diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 437bb52..7560d11 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -638,9 +638,14 @@ EXTERN int TclPtrObjMakeUpvar(Tcl_Interp *interp, EXTERN int TclPtrUnsetVar(Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags); -/* Slot 257 is reserved */ +/* 257 */ +EXTERN void TclStaticPackage(Tcl_Interp *interp, + const char *pkgName, + Tcl_PackageInitProc *initProc, + Tcl_PackageInitProc *safeInitProc); /* Slot 258 is reserved */ -/* 259 */ +/* Slot 259 is reserved */ +/* 260 */ EXTERN void TclUnusedStubEntry(void); typedef struct TclIntStubs { @@ -904,9 +909,10 @@ typedef struct TclIntStubs { Tcl_Obj * (*tclPtrIncrObjVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, const int flags); /* 254 */ int (*tclPtrObjMakeUpvar) (Tcl_Interp *interp, Tcl_Var otherPtr, Tcl_Obj *myNamePtr, int myFlags); /* 255 */ int (*tclPtrUnsetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags); /* 256 */ - void (*reserved257)(void); + void (*tclStaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 257 */ void (*reserved258)(void); - void (*tclUnusedStubEntry) (void); /* 259 */ + void (*reserved259)(void); + void (*tclUnusedStubEntry) (void); /* 260 */ } TclIntStubs; extern const TclIntStubs *tclIntStubsPtr; @@ -1348,10 +1354,12 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclPtrObjMakeUpvar) /* 255 */ #define TclPtrUnsetVar \ (tclIntStubsPtr->tclPtrUnsetVar) /* 256 */ -/* Slot 257 is reserved */ +#define TclStaticPackage \ + (tclIntStubsPtr->tclStaticPackage) /* 257 */ /* Slot 258 is reserved */ +/* Slot 259 is reserved */ #define TclUnusedStubEntry \ - (tclIntStubsPtr->tclUnusedStubEntry) /* 259 */ + (tclIntStubsPtr->tclUnusedStubEntry) /* 260 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index 16185e6..55473c1 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -58,7 +58,7 @@ static void RebuildLiteralTable(LiteralTable *tablePtr); void TclInitLiteralTable( - register LiteralTable *tablePtr) + LiteralTable *tablePtr) /* Pointer to table structure, which is * supplied by the caller. */ { @@ -269,7 +269,7 @@ TclCreateLiteral( } #endif - globalPtr = ckalloc(sizeof(LiteralEntry)); + globalPtr = (LiteralEntry *)ckalloc(sizeof(LiteralEntry)); globalPtr->objPtr = objPtr; Tcl_IncrRefCount(objPtr); globalPtr->refCount = 1; @@ -381,7 +381,7 @@ int TclRegisterLiteral( void *ePtr, /* Points to the CompileEnv in whose object * array an object is found or created. */ - register char *bytes, /* Points to string for which to find or + char *bytes, /* Points to string for which to find or * create an object in CompileEnv's object * array. */ int length, /* Number of bytes in the string. If < 0, the @@ -490,13 +490,13 @@ static LiteralEntry * LookupLiteralEntry( Tcl_Interp *interp, /* Interpreter for which objPtr was created to * hold a literal. */ - register Tcl_Obj *objPtr) /* Points to a Tcl object holding a literal + Tcl_Obj *objPtr) /* Points to a Tcl object holding a literal * that was previously created by a call to * TclRegisterLiteral. */ { Interp *iPtr = (Interp *) interp; LiteralTable *globalTablePtr = &iPtr->literalTable; - register LiteralEntry *entryPtr; + LiteralEntry *entryPtr; const char *bytes; int length, globalHash; @@ -536,7 +536,7 @@ void TclHideLiteral( Tcl_Interp *interp, /* Interpreter for which objPtr was created to * hold a literal. */ - register CompileEnv *envPtr,/* Points to CompileEnv whose literal array + CompileEnv *envPtr,/* Points to CompileEnv whose literal array * contains the entry being hidden. */ int index) /* The index of the entry in the literal * array. */ @@ -599,14 +599,14 @@ TclHideLiteral( int TclAddLiteralObj( - register CompileEnv *envPtr,/* Points to CompileEnv in whose literal array + CompileEnv *envPtr,/* Points to CompileEnv in whose literal array * the object is to be inserted. */ Tcl_Obj *objPtr, /* The object to insert into the array. */ LiteralEntry **litPtrPtr) /* The location where the pointer to the new * literal entry should be stored. May be * NULL. */ { - register LiteralEntry *lPtr; + LiteralEntry *lPtr; int objIndex; if (envPtr->literalArrayNext >= envPtr->literalArrayEnd) { @@ -648,12 +648,12 @@ TclAddLiteralObj( static int AddLocalLiteralEntry( - register CompileEnv *envPtr,/* Points to CompileEnv in whose literal array + CompileEnv *envPtr,/* Points to CompileEnv in whose literal array * the object is to be inserted. */ Tcl_Obj *objPtr, /* The literal to add to the CompileEnv. */ int localHash) /* Hash value for the literal's string. */ { - register LiteralTable *localTablePtr = &envPtr->localLitTable; + LiteralTable *localTablePtr = &envPtr->localLitTable; LiteralEntry *localPtr; int objIndex; @@ -725,7 +725,7 @@ AddLocalLiteralEntry( static void ExpandLocalLiteralArray( - register CompileEnv *envPtr)/* Points to the CompileEnv whose object array + CompileEnv *envPtr)/* Points to the CompileEnv whose object array * must be enlarged. */ { /* @@ -747,14 +747,14 @@ ExpandLocalLiteralArray( } if (envPtr->mallocedLiteralArray) { - newArrayPtr = ckrealloc(currArrayPtr, newSize); + newArrayPtr = (LiteralEntry *)ckrealloc(currArrayPtr, newSize); } else { /* * envPtr->literalArrayPtr isn't a ckalloc'd pointer, so we must * code a ckrealloc equivalent for ourselves. */ - newArrayPtr = ckalloc(newSize); + newArrayPtr = (LiteralEntry *)ckalloc(newSize); memcpy(newArrayPtr, currArrayPtr, currBytes); envPtr->mallocedLiteralArray = 1; } @@ -807,13 +807,13 @@ void TclReleaseLiteral( Tcl_Interp *interp, /* Interpreter for which objPtr was created to * hold a literal. */ - register Tcl_Obj *objPtr) /* Points to a literal object that was + Tcl_Obj *objPtr) /* Points to a literal object that was * previously created by a call to * TclRegisterLiteral. */ { Interp *iPtr = (Interp *) interp; LiteralTable *globalTablePtr; - register LiteralEntry *entryPtr, *prevPtr; + LiteralEntry *entryPtr, *prevPtr; const char *bytes; int length, index; @@ -888,10 +888,10 @@ TclReleaseLiteral( static unsigned HashString( - register const char *string, /* String for which to compute hash value. */ + const char *string, /* String for which to compute hash value. */ int length) /* Number of bytes in the string. */ { - register unsigned int result = 0; + unsigned int result = 0; /* * I tried a zillion different hash functions and asked many other people @@ -952,12 +952,12 @@ HashString( static void RebuildLiteralTable( - register LiteralTable *tablePtr) + LiteralTable *tablePtr) /* Local or global table to enlarge. */ { LiteralEntry **oldBuckets; - register LiteralEntry **oldChainPtr, **newChainPtr; - register LiteralEntry *entryPtr; + LiteralEntry **oldChainPtr, **newChainPtr; + LiteralEntry *entryPtr; LiteralEntry **bucketPtr; const char *bytes; unsigned int oldSize; @@ -982,7 +982,8 @@ RebuildLiteralTable( } tablePtr->numBuckets *= 4; - tablePtr->buckets = ckalloc(tablePtr->numBuckets * sizeof(LiteralEntry*)); + tablePtr->buckets = (LiteralEntry **)ckalloc( + tablePtr->numBuckets * sizeof(LiteralEntry *)); for (count=tablePtr->numBuckets, newChainPtr=tablePtr->buckets; count>0 ; count--, newChainPtr++) { *newChainPtr = NULL; @@ -1086,7 +1087,7 @@ TclLiteralStats( #define NUM_COUNTERS 10 int count[NUM_COUNTERS], overflow, i, j; double average, tmp; - register LiteralEntry *entryPtr; + LiteralEntry *entryPtr; char *result, *p; /* @@ -1118,7 +1119,7 @@ TclLiteralStats( * Print out the histogram and a few other pieces of information. */ - result = ckalloc(NUM_COUNTERS*60 + 300); + result = (char *)ckalloc(NUM_COUNTERS*60 + 300); sprintf(result, "%d entries in table, %d buckets\n", tablePtr->numEntries, tablePtr->numBuckets); p = result + strlen(result); @@ -1157,10 +1158,10 @@ TclVerifyLocalLiteralTable( CompileEnv *envPtr) /* Points to CompileEnv whose literal table is * to be validated. */ { - register LiteralTable *localTablePtr = &envPtr->localLitTable; - register LiteralEntry *localPtr; + LiteralTable *localTablePtr = &envPtr->localLitTable; + LiteralEntry *localPtr; char *bytes; - register int i; + int i; int length, count; count = 0; @@ -1208,10 +1209,10 @@ TclVerifyGlobalLiteralTable( Interp *iPtr) /* Points to interpreter whose global literal * table is to be validated. */ { - register LiteralTable *globalTablePtr = &iPtr->literalTable; - register LiteralEntry *globalPtr; + LiteralTable *globalTablePtr = &iPtr->literalTable; + LiteralEntry *globalPtr; char *bytes; - register int i; + int i; int length, count; count = 0; diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 5c901e7..7807083 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -57,6 +57,7 @@ #define TclBN_mp_tc_and TclBN_mp_and #define TclBN_mp_tc_or TclBN_mp_or #define TclBN_mp_tc_xor TclBN_mp_xor +#define TclStaticPackage Tcl_StaticPackage #define TclUnusedStubEntry NULL /* See bug 510001: TclSockMinimumBuffers needs plat imp */ @@ -745,9 +746,10 @@ static const TclIntStubs tclIntStubs = { TclPtrIncrObjVar, /* 254 */ TclPtrObjMakeUpvar, /* 255 */ TclPtrUnsetVar, /* 256 */ - 0, /* 257 */ + TclStaticPackage, /* 257 */ 0, /* 258 */ - TclUnusedStubEntry, /* 259 */ + 0, /* 259 */ + TclUnusedStubEntry, /* 260 */ }; static const TclIntPlatStubs tclIntPlatStubs = { diff --git a/generic/tclTest.c b/generic/tclTest.c index 2a43d91..592998b 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -315,6 +315,7 @@ static Tcl_FSListVolumesProc SimpleListVolumes; static Tcl_FSPathInFilesystemProc SimplePathInFilesystem; static Tcl_Obj * SimpleRedirect(Tcl_Obj *pathPtr); static Tcl_FSMatchInDirectoryProc SimpleMatchInDirectory; +static Tcl_ObjCmdProc TestUtfNextCmd; static Tcl_ObjCmdProc TestUtfPrevCmd; static Tcl_ObjCmdProc TestNumUtfCharsCmd; static Tcl_ObjCmdProc TestFindFirstCmd; @@ -572,8 +573,10 @@ Tcltest_Init( NULL, NULL); Tcl_CreateObjCommand(interp, "testsetobjerrorcode", TestsetobjerrorcodeCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testutfnext", + TestUtfNextCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testutfprev", - TestUtfPrevCmd, (ClientData) 0, NULL); + TestUtfPrevCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testnumutfchars", TestNumUtfCharsCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testfindfirst", @@ -709,7 +712,6 @@ Tcltest_SafeInit( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestasyncCmd( ClientData dummy, /* Not used. */ @@ -956,7 +958,6 @@ TestbumpinterpepochObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestcmdinfoCmd( ClientData dummy, /* Not used. */ @@ -1028,7 +1029,6 @@ TestcmdinfoCmd( return TCL_OK; } - /*ARGSUSED*/ static int CmdProc1( ClientData clientData, /* String to return. */ @@ -1040,7 +1040,6 @@ CmdProc1( return TCL_OK; } - /*ARGSUSED*/ static int CmdProc2( ClientData clientData, /* String to return. */ @@ -1087,7 +1086,6 @@ CmdDelProc2( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestcmdtokenCmd( ClientData dummy, /* Not used. */ @@ -1151,7 +1149,6 @@ TestcmdtokenCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestcmdtraceCmd( ClientData dummy, /* Not used. */ @@ -1437,7 +1434,6 @@ CreatedCommandProc2( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestdcallCmd( ClientData dummy, /* Not used. */ @@ -1502,7 +1498,6 @@ DelCallbackProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestdelCmd( ClientData dummy, /* Not used. */ @@ -1523,9 +1518,9 @@ TestdelCmd( return TCL_ERROR; } - dPtr = ckalloc(sizeof(DelCmd)); + dPtr = (DelCmd *)ckalloc(sizeof(DelCmd)); dPtr->interp = interp; - dPtr->deleteCmd = ckalloc(strlen(argv[3]) + 1); + dPtr->deleteCmd = (char *)ckalloc(strlen(argv[3]) + 1); strcpy(dPtr->deleteCmd, argv[3]); Tcl_CreateCommand(slave, argv[2], DelCmdProc, (ClientData) dPtr, @@ -1552,7 +1547,7 @@ static void DelDeleteProc( ClientData clientData) /* String command to evaluate. */ { - DelCmd *dPtr = clientData; + DelCmd *dPtr = (DelCmd *)clientData; Tcl_Eval(dPtr->interp, dPtr->deleteCmd); Tcl_ResetResult(dPtr->interp); @@ -1707,7 +1702,6 @@ TestdoubledigitsObjCmd(ClientData unused, *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestdstringCmd( ClientData dummy, /* Not used. */ @@ -1834,7 +1828,6 @@ static void SpecialFree(blockPtr) *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestencodingObjCmd( ClientData dummy, /* Not used. */ @@ -1865,15 +1858,15 @@ TestencodingObjCmd( if (objc != 5) { return TCL_ERROR; } - encodingPtr = ckalloc(sizeof(TclEncoding)); + encodingPtr = (TclEncoding *)ckalloc(sizeof(TclEncoding)); encodingPtr->interp = interp; string = Tcl_GetStringFromObj(objv[3], &length); - encodingPtr->toUtfCmd = ckalloc(length + 1); + encodingPtr->toUtfCmd = (char *)ckalloc(length + 1); memcpy(encodingPtr->toUtfCmd, string, (unsigned) length + 1); string = Tcl_GetStringFromObj(objv[4], &length); - encodingPtr->fromUtfCmd = ckalloc(length + 1); + encodingPtr->fromUtfCmd = (char *)ckalloc(length + 1); memcpy(encodingPtr->fromUtfCmd, string, (unsigned) (length + 1)); string = Tcl_GetStringFromObj(objv[2], &length); @@ -1968,7 +1961,7 @@ static void EncodingFreeProc( ClientData clientData) /* ClientData associated with type. */ { - TclEncoding *encodingPtr = clientData; + TclEncoding *encodingPtr = (TclEncoding *)clientData; ckfree(encodingPtr->toUtfCmd); ckfree(encodingPtr->fromUtfCmd); @@ -2127,7 +2120,7 @@ TesteventObjCmd( "position specifier", TCL_EXACT, &posIndex) != TCL_OK) { return TCL_ERROR; } - ev = ckalloc(sizeof(TestEvent)); + ev = (TestEvent *)ckalloc(sizeof(TestEvent)); ev->header.proc = TesteventProc; ev->header.nextPtr = NULL; ev->interp = interp; @@ -2689,7 +2682,6 @@ TestgetplatformCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestinterpdeleteCmd( ClientData dummy, /* Not used. */ @@ -2730,7 +2722,6 @@ TestinterpdeleteCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestlinkCmd( ClientData dummy, /* Not used. */ @@ -2985,7 +2976,7 @@ TestlinkCmd( if (strcmp(argv[5], "-") == 0) { stringVar = NULL; } else { - stringVar = ckalloc(strlen(argv[5]) + 1); + stringVar = (char *)ckalloc(strlen(argv[5]) + 1); strcpy(stringVar, argv[5]); } } @@ -3092,7 +3083,7 @@ TestlinkCmd( if (strcmp(argv[5], "-") == 0) { stringVar = NULL; } else { - stringVar = ckalloc(strlen(argv[5]) + 1); + stringVar = (char *)ckalloc(strlen(argv[5]) + 1); strcpy(stringVar, argv[5]); } Tcl_UpdateLinkedVar(interp, "string"); @@ -3261,7 +3252,6 @@ TestlocaleCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestMathFunc( ClientData clientData, /* Integer value to return. */ @@ -3291,7 +3281,6 @@ TestMathFunc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestMathFunc2( ClientData clientData, /* Integer value to return. */ @@ -3398,7 +3387,6 @@ TestMathFunc2( * *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void CleanupTestSetassocdataTests( ClientData clientData, /* Data to be released. */ @@ -3732,7 +3720,6 @@ TestparsevarnameObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestregexpObjCmd( ClientData dummy, /* Not used. */ @@ -4056,7 +4043,6 @@ TestregexpXflags( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestreturnObjCmd( ClientData dummy, /* Not used. */ @@ -4278,7 +4264,6 @@ TesttranslatefilenameCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestupvarCmd( ClientData dummy, /* Not used. */ @@ -4331,7 +4316,6 @@ TestupvarCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestseterrorcodeCmd( ClientData dummy, /* Not used. */ @@ -4384,7 +4368,6 @@ TestseterrorcodeCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestsetobjerrorcodeCmd( ClientData dummy, /* Not used. */ @@ -4413,7 +4396,6 @@ TestsetobjerrorcodeCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestfeventCmd( ClientData clientData, /* Not used. */ @@ -4667,8 +4649,8 @@ static int GetTimesObjCmd( ClientData unused, /* Unused. */ Tcl_Interp *interp, /* The current interpreter. */ - int notused1, /* Number of arguments. */ - Tcl_Obj *const notused2[]) /* The argument objects. */ + int objc, /* Number of arguments. (not used)*/ + Tcl_Obj *const dummy[]) /* The argument objects (not used). */ { Interp *iPtr = (Interp *) interp; int i, n; @@ -4677,12 +4659,14 @@ GetTimesObjCmd( Tcl_Obj *objPtr, **objv; const char *s; char newString[TCL_INTEGER_SPACE]; + (void)objc; + (void)dummy; /* alloc & free 100000 times */ fprintf(stderr, "alloc & free 100000 6 word items\n"); Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { - objPtr = ckalloc(sizeof(Tcl_Obj)); + objPtr = (Tcl_Obj *)ckalloc(sizeof(Tcl_Obj)); ckfree(objPtr); } Tcl_GetTime(&stop); @@ -4691,10 +4675,10 @@ GetTimesObjCmd( /* alloc 5000 times */ fprintf(stderr, "alloc 5000 6 word items\n"); - objv = ckalloc(5000 * sizeof(Tcl_Obj *)); + objv = (Tcl_Obj **) ckalloc(5000 * sizeof(Tcl_Obj *)); Tcl_GetTime(&start); for (i = 0; i < 5000; i++) { - objv[i] = ckalloc(sizeof(Tcl_Obj)); + objv[i] = (Tcl_Obj *) ckalloc(sizeof(Tcl_Obj)); } Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); @@ -5148,7 +5132,6 @@ Testset2Cmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestsaveresultCmd( ClientData dummy, /* Not used. */ @@ -5400,7 +5383,6 @@ TestexitmainloopCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestChannelCmd( ClientData clientData, /* Not used. */ @@ -5517,7 +5499,7 @@ TestChannelCmd( /* Remember the channel in the pool of detached channels */ - det = ckalloc(sizeof(TestChannel)); + det = (TestChannel *) ckalloc(sizeof(TestChannel)); det->chan = chan; det->nextPtr = firstDetached; firstDetached = det; @@ -5869,7 +5851,6 @@ TestChannelCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestChannelEventCmd( ClientData dummy, /* Not used. */ @@ -5915,7 +5896,8 @@ TestChannelEventCmd( return TCL_ERROR; } - esPtr = ckalloc(sizeof(EventScriptRecord)); + esPtr = (EventScriptRecord *) ckalloc((unsigned) + sizeof(EventScriptRecord)); esPtr->nextPtr = statePtr->scriptRecordPtr; statePtr->scriptRecordPtr = esPtr; @@ -6293,11 +6275,6 @@ TestReport( if (interp == NULL) { /* This is bad, but not much we can do about it */ } else { - /* - * No idea why I decided to program this up using the old string-based - * API, but there you go. We should convert it to objects. - */ - Tcl_Obj *savedResult; Tcl_DString ds; @@ -6724,6 +6701,52 @@ SimpleListVolumes(void) } /* + * Used to check operations of Tcl_UtfNext. + * + * Usage: testutfnext $bytes $offset + */ + +static int +TestUtfNextCmd( + ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *const objv[]) +{ + int numBytes, offset = 0; + char *bytes; + const char *result; + Tcl_Obj *copy; + + if (objc < 2 || objc > 3) { + Tcl_WrongNumArgs(interp, 1, objv, "bytes ?offset?"); + return TCL_ERROR; + } + + bytes = (char *) Tcl_GetByteArrayFromObj(objv[1], &numBytes); + + if (objc == 3) { + if (TCL_OK != TclGetIntForIndex(interp, objv[2], numBytes, &offset)) { + return TCL_ERROR; + } + if (offset < 0) { + offset = 0; + } + if (offset > numBytes) { + offset = numBytes; + } + } + copy = Tcl_DuplicateObj(objv[1]); + bytes = (char *) Tcl_SetByteArrayLength(copy, numBytes+1); + bytes[numBytes] = '\0'; + + result = Tcl_UtfNext(bytes + offset); + Tcl_SetObjResult(interp, Tcl_NewIntObj(result - bytes)); + + Tcl_DecrRefCount(copy); + return TCL_OK; +} +/* * Used to check operations of Tcl_UtfPrev. * * Usage: testutfprev $bytes $offset @@ -6740,16 +6763,16 @@ TestUtfPrevCmd( char *bytes; const char *result; Tcl_Obj *copy; - + if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "bytes ?offset?"); return TCL_ERROR; } bytes = (char *) Tcl_GetByteArrayFromObj(objv[1], &numBytes); - + if (objc == 3) { - if (TCL_OK != Tcl_GetIntFromObj(interp, objv[2], &offset)) { + if (TCL_OK != TclGetIntForIndex(interp, objv[2], numBytes, &offset)) { return TCL_ERROR; } if (offset < 0) { @@ -6766,9 +6789,9 @@ TestUtfPrevCmd( bytes[numBytes] = '\0'; result = Tcl_UtfPrev(bytes + offset, bytes); + Tcl_SetObjResult(interp, Tcl_NewIntObj(result - bytes)); Tcl_DecrRefCount(copy); - Tcl_SetObjResult(interp, Tcl_NewIntObj(result - bytes)); return TCL_OK; } diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 3377b70..ec9bffd 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -698,7 +698,7 @@ Tcl_UtfNext( * starts a character when characters are read starting at start and * that character might include the byte src[-1]. The routine will * examine only those bytes in the range that might be returned. - * It will not examine the byte *src, and because of that cannot + * It will not examine the byte *src, and because of that cannot * determine for certain in all circumstances whether the character * that begins with the returned pointer will or will not include * the byte src[-1]. In the scenario, where src points to the end of @@ -713,7 +713,7 @@ Tcl_UtfNext( * prevented from running past the beginning of the string. * * In a string where all characters are complete and properly formed, - * and the value of src points to the first byte of a character, + * and the value of src points to the first byte of a character, * repeated Tcl_UtfPrev calls will step to the starting bytes of * characters, one character at a time. Within those limitations, * Tcl_UtfPrev and Tcl_UtfNext are inverses. If either condition cannot diff --git a/generic/tclUtil.c b/generic/tclUtil.c index d7d6134..2c20831 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1686,12 +1686,12 @@ TclTrimRight( * rely on (trim[numTrim] == '\0'). */ { const char *pp, *p = bytes + numBytes; + Tcl_UniChar ch1 = 0; /* Empty strings -> nothing to do */ if ((numBytes == 0) || (numTrim == 0)) { return 0; } - Tcl_UniChar ch1 = 0, ch2 = 0; /* * Outer loop: iterate over string to be trimmed. @@ -1700,6 +1700,7 @@ TclTrimRight( do { const char *q = trim; int pInc = 0, bytesLeft = numTrim; + Tcl_UniChar ch2 = 0; pp = Tcl_UtfPrev(p, bytes); do { @@ -1765,6 +1766,7 @@ TclTrimLeft( * rely on (trim[numTrim] == '\0'). */ { const char *p = bytes; + Tcl_UniChar ch1 = 0; /* Empty strings -> nothing to do */ if ((numBytes == 0) || (numTrim == 0)) { @@ -1776,7 +1778,7 @@ TclTrimLeft( */ do { - Tcl_UniChar ch1 = 0; + Tcl_UniChar ch2 = 0; int pInc = TclUtfToUniChar(p, &ch1); const char *q = trim; int bytesLeft = numTrim; @@ -1786,7 +1788,6 @@ TclTrimLeft( */ do { - Tcl_UniChar ch2 = 0; int qInc = TclUtfToUniChar(q, &ch2); if (ch1 == ch2) { diff --git a/generic/tclZlib.c b/generic/tclZlib.c index aed38c3..002c6ae 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -3832,7 +3832,7 @@ ResultGenerate( if (((flush == Z_SYNC_FLUSH) && (e == Z_BUF_ERROR)) || (e == Z_STREAM_END) - || (e == Z_OK && cd->inStream.avail_out == 0)) { + || (e == Z_OK && written == 0)) { return TCL_OK; } diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 4d7a8fb..8537207 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -984,7 +984,7 @@ TcpThreadActionProc( if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { /* * Async-connecting socket must get reassigned handler if it have been - * transferred to another thread. Remove the handler if the socket is + * transferred to another thread. Remove the handler if the socket is * not managed by this thread anymore and create new handler (TSD related) * so the callback will run in the correct thread, bug [f583715154]. */ |
