Index: generic/nsf.c =================================================================== diff -u -r4e70d6d46d845f168e6ff18960f8b5a8e3746e6d -r1d1ca561af5942718e613929b36e5d2419e4fe5a --- generic/nsf.c (.../nsf.c) (revision 4e70d6d46d845f168e6ff18960f8b5a8e3746e6d) +++ generic/nsf.c (.../nsf.c) (revision 1d1ca561af5942718e613929b36e5d2419e4fe5a) @@ -168,7 +168,7 @@ #define PARSE_CONTEXT_PREALLOC 20 typedef struct { - int status; + unsigned int status; ClientData *clientData; /* 4 members pointer to the actual parse context data */ Tcl_Obj **objv; Tcl_Obj **full_objv; /* contains method as well */ @@ -337,8 +337,10 @@ nonnull(1) nonnull(2) nonnull(5) nonnull(6) nonnull(8); static int ParameterCheck(Tcl_Interp *interp, Tcl_Obj *paramObjPtr, Tcl_Obj *valueObj, - const char *argNamePrefix, int doCheckArguments, - int isNamed, int doConfigureParameter, + const char *argNamePrefix, + unsigned int doCheckArguments, + int isNamed, + int doConfigureParameter, Nsf_Param **paramPtrPtr) nonnull(1) nonnull(2) nonnull(3); static void ParamDefsRefCountIncr(NsfParamDefs *paramDefs) nonnull(1); @@ -351,7 +353,8 @@ unsigned int processFlags, ParseContext *pc) nonnull(1) nonnull(3) nonnull(5) nonnull(6) nonnull(10); -static int ArgumentCheck(Tcl_Interp *interp, Tcl_Obj *objPtr, struct Nsf_Param const *pPtr, int doCheckArguments, +static int ArgumentCheck(Tcl_Interp *interp, Tcl_Obj *objPtr, struct Nsf_Param const *pPtr, + unsigned int doCheckArguments, unsigned int *flags, ClientData *clientData, Tcl_Obj **outObjPtr) nonnull(1) nonnull(2) nonnull(3) nonnull(5) nonnull(6) nonnull(7); @@ -809,7 +812,7 @@ static void ParseContextRelease(ParseContext *pcPtr) { - int status; + unsigned int status; nonnull_assert(pcPtr != NULL); @@ -2067,7 +2070,7 @@ while (1) { (void)NsfStringIncr(iss); - Tcl_DStringAppend(dsPtr, iss->start, iss->length); + Tcl_DStringAppend(dsPtr, iss->start, (int)iss->length); if (!Tcl_FindCommand(interp, Tcl_DStringValue(dsPtr), NULL, TCL_GLOBAL_ONLY)) { break; } @@ -4131,7 +4134,7 @@ 1 << methodIdx );*/ if (methodObj != NULL) { - unsigned int flag = 1 << methodIdx; + unsigned int flag = 1u << methodIdx; if ((osPtr->overloadedMethods & flag) != 0u) { /* overloaded, we must dispatch */ @@ -6455,8 +6458,8 @@ newCmd = Tcl_CreateObjCommand(interp, Tcl_DStringValue(dsPtr), proc, clientData, dp); - if (flags != 0) { - ((Command *) newCmd)->flags |= flags; + if (flags != 0u) { + ((Command *) newCmd)->flags |= (int)flags; } Tcl_DStringFree(dsPtr); return TCL_OK; @@ -6516,7 +6519,7 @@ newCmd = Tcl_CreateObjCommand(interp, Tcl_DStringValue(dsPtr), proc, clientData, dp); if (flags != 0) { - ((Command *) newCmd)->flags |= flags; + ((Command *) newCmd)->flags |= (int)flags; } Tcl_DStringFree(dsPtr); return TCL_OK; @@ -11148,7 +11151,7 @@ const char *methodString = (methodObj != NULL) ? ObjStr(methodObj) : NULL; if (methodString && *methodString == firstChar && !strcmp(methodName, methodString)) { - flag = 1<nsPtr != NULL) {flags |= TCL_NAMESPACE_ONLY;} Nsf_PushFrameObj(interp, object, framePtr); - result = Tcl_UnsetVar2(interp, name, NULL, flags); + result = Tcl_UnsetVar2(interp, name, NULL, (int)flags); Nsf_PopFrameObj(interp, framePtr); return (withNocomplain != 0) ? TCL_OK : result; @@ -20508,14 +20511,14 @@ */ static int ForwardArg(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *ForwardArgObj, ForwardCmdClientData *tcd, Tcl_Obj **out, - Tcl_Obj **freeList, int *inputArg, int *mapvalue, + Tcl_Obj **freeList, int *inputArg, long *mapvalue, int firstPosArg, int *outputincr) nonnull(1) nonnull(3) nonnull(4) nonnull(5) nonnull(6) nonnull(7) nonnull(8) nonnull(9) nonnull(11); static int ForwardArg(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Tcl_Obj *forwardArgObj, ForwardCmdClientData *tcd, Tcl_Obj **out, - Tcl_Obj **freeList, int *inputArg, int *mapvalue, + Tcl_Obj **freeList, int *inputArg, long *mapvalue, int firstPosArg, int *outputincr) { const char *ForwardArgString, *p; int totalargs; @@ -20791,9 +20794,9 @@ static int CallForwarder(ForwardCmdClientData *tcd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - int result; + int result; NsfObject *object; - CallFrame frame, *framePtr = &frame; + CallFrame frame, *framePtr = &frame; nonnull_assert(tcd != NULL); nonnull_assert(interp != NULL); @@ -20866,7 +20869,7 @@ NsfForwardMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ForwardCmdClientData *tcd = (ForwardCmdClientData *)clientData; - int result, inputArg = 1; + int result, inputArg = 1; nonnull_assert(clientData != NULL); nonnull_assert(interp != NULL); @@ -20904,18 +20907,18 @@ } else { Tcl_Obj **ov, *freeList = NULL; - int j, outputincr, outputArg = 0, firstPosArg=1, - totalargs = objc + tcd->nr_args + 3; + int j, outputincr, outputArg = 0, firstPosArg=1, + totalargs = objc + tcd->nr_args + 3; ALLOC_ON_STACK(Tcl_Obj*, totalargs, OV); - ALLOC_ON_STACK(int, totalargs, objvmap); + ALLOC_ON_STACK(long, totalargs, objvmap); /*fprintf(stderr, "+++ forwardMethod standard case, allocated %d args, tcd->args %s\n", totalargs, ObjStr(tcd->args));*/ ov = &OV[1]; if (tcd->needobjmap != 0) { - memset(objvmap, -1, sizeof(int)*totalargs); + memset(objvmap, -1, sizeof(long) * (size_t)totalargs); } /* @@ -20945,7 +20948,7 @@ if (tcd->args != NULL) { Tcl_Obj **listElements; - int nrElements; + int nrElements; /* * Copy argument list from the definitions. @@ -20968,7 +20971,7 @@ if (objc-inputArg > 0) { /*fprintf(stderr, " copying remaining %d args starting at [%d]\n", objc-inputArg, outputArg);*/ - memcpy(ov+outputArg, objv+inputArg, sizeof(Tcl_Obj *) * ((size_t)objc - inputArg)); + memcpy(ov+outputArg, objv+inputArg, sizeof(Tcl_Obj *) * ((size_t)objc - (size_t)inputArg)); } else { /*fprintf(stderr, " nothing to copy, objc=%d, inputArg=%d\n", objc, inputArg);*/ } @@ -21002,7 +21005,8 @@ for (j = 0; j < totalargs; j++) { Tcl_Obj *tmp; - int pos = objvmap[j], i; + long pos = objvmap[j], i; + if (pos == -1 || pos == j) { continue; } @@ -21036,6 +21040,7 @@ */ if (tcd->prefix && objc > 1) { Tcl_Obj *methodName = Tcl_DuplicateObj(tcd->prefix); + Tcl_AppendObjToObj(methodName, ov[1]); ov[1] = methodName; INCR_REF_COUNT(ov[1]); @@ -21058,7 +21063,7 @@ exitforwardmethod: if (freeList != NULL) {DECR_REF_COUNT2("freeList", freeList);} - FREE_ON_STACK(int, objvmap); + FREE_ON_STACK(long, objvmap); FREE_ON_STACK(Tcl_Obj*, OV); } return result; @@ -21400,8 +21405,12 @@ nonnull(1) nonnull(2) nonnull(3) nonnull(4) nonnull(5) nonnull(6); static int -ArgumentCheckHelper(Tcl_Interp *interp, Tcl_Obj *objPtr, struct Nsf_Param const *pPtr, unsigned int *flags, - ClientData *clientData, Tcl_Obj **outObjPtr) { +ArgumentCheckHelper(Tcl_Interp *interp, + Tcl_Obj *objPtr, + struct Nsf_Param const *pPtr, + unsigned int *flags, + ClientData *clientData, + Tcl_Obj **outObjPtr) { int objc, i, result; Tcl_Obj **ov; @@ -21604,12 +21613,12 @@ *---------------------------------------------------------------------- */ static int ArgumentDefaults(ParseContext *pcPtr, Tcl_Interp *interp, - Nsf_Param const *ifd, int nrParams, int processFlags) + Nsf_Param const *ifd, int nrParams, unsigned int processFlags) nonnull(1) nonnull(2) nonnull(3); static int ArgumentDefaults(ParseContext *pcPtr, Tcl_Interp *interp, - Nsf_Param const *ifd, int nrParams, int processFlags) { + Nsf_Param const *ifd, int nrParams, unsigned int processFlags) { Nsf_Param const *pPtr; int i; @@ -21845,7 +21854,8 @@ NsfObject *object, Tcl_Obj *procNameObj, Nsf_Param const *paramPtr, int nrParams, int serial, unsigned int processFlags, ParseContext *pcPtr) { - int o, dashdash = 0, j, fromArg; + int o, dashdash = 0, fromArg; + long j; Nsf_Param const *currentParamPtr = paramPtr; Nsf_Param const *lastParamPtr = paramPtr + nrParams - 1; @@ -21880,9 +21890,8 @@ for (o = fromArg; o < objc; o++) { Nsf_Param const *pPtr = currentParamPtr; - Tcl_Obj *argumentObj = objv[o]; - Tcl_Obj *valueObj = NULL; - const char *valueInArgument = NULL; + Tcl_Obj *argumentObj = objv[o], *valueObj = NULL; + const char *valueInArgument = NULL; #if defined(PARSE_TRACE_FULL) fprintf(stderr, "arg [%d]: %s (param %ld, last %d)\n", @@ -21983,7 +21992,8 @@ valueInArgument = strchr(argumentString, '='); if (valueInArgument != NULL) { - int found = 0, equalOffset = valueInArgument - argumentString; + int found = 0; + long equalOffset = valueInArgument - argumentString; /* * Handle parameter like -flag=1 @@ -21995,7 +22005,7 @@ } if ((pPtr->flags & NSF_ARG_NOCONFIG) == 0u && ch1 == pPtr->name[1] - && strncmp(argumentString, pPtr->name, equalOffset) == 0 + && strncmp(argumentString, pPtr->name, (size_t)equalOffset) == 0 && *(pPtr->name+equalOffset) == '\0') { valueObj = Tcl_NewStringObj(valueInArgument+1, -1); @@ -24907,7 +24917,7 @@ Tcl_SetBooleanObj(Tcl_GetObjResult(interp), (RUNTIME_STATE(interp)->doCheckResults)); if (valueObj != NULL) { - RUNTIME_STATE(interp)->doCheckResults = boolVal; + RUNTIME_STATE(interp)->doCheckResults = (unsigned int)boolVal; } break; @@ -24965,8 +24975,9 @@ return ObjectDispatch(self, interp, nobjc, nobjv, 0); } else { ParseContext pc; - int withIntrinsic, withLocal, withSystem, flags; - Tcl_Obj *methodObj; + int withIntrinsic, withLocal, withSystem; + Tcl_Obj *methodObj; + unsigned int flags; /* * Parse arguments, use definitions from nsf::my @@ -26009,17 +26020,17 @@ /* * set flag */ - Tcl_Command_flags(cmd) |= flag; + Tcl_Command_flags(cmd) |= (int)flag; if (impliedSetFlag != 0) { - Tcl_Command_flags(cmd) |= impliedSetFlag; + Tcl_Command_flags(cmd) |= (int)impliedSetFlag; } } else { /* * clear flag */ - Tcl_Command_flags(cmd) &= ~flag; + Tcl_Command_flags(cmd) &= (int)~flag; if (impliedClearFlag != 0) { - Tcl_Command_flags(cmd) &= ~impliedClearFlag; + Tcl_Command_flags(cmd) &= (int)~impliedClearFlag; } } if (cl != NULL) { @@ -26448,7 +26459,7 @@ if (arg_oc == 3) { int boolVal = 0; Tcl_GetBooleanFromObj(interp, arg_ov[2], &boolVal); - osPtr->protected[idx] = boolVal; + osPtr->protected[idx] = (char)boolVal; } INCR_REF_COUNT(osPtr->handles[idx]); } @@ -28190,7 +28201,7 @@ static int ParameterCheck(Tcl_Interp *interp, Tcl_Obj *paramObjPtr, Tcl_Obj *valueObj, - const char *argNamePrefix, int doCheckArguments, + const char *argNamePrefix, unsigned int doCheckArguments, int isNamed, int doConfigureParameter, Nsf_Param **paramPtrPtr) { Nsf_Param *paramPtr; @@ -28857,7 +28868,7 @@ * Must be a parameter associated with a variable */ unsigned int flags = (object->nsPtr != NULL) ? (TCL_LEAVE_ERR_MSG|TCL_NAMESPACE_ONLY) : TCL_LEAVE_ERR_MSG; - Tcl_Obj *resultObj = Tcl_ObjGetVar2(interp, paramPtr->nameObj, NULL, flags); + Tcl_Obj *resultObj = Tcl_ObjGetVar2(interp, paramPtr->nameObj, NULL, (int)flags); if (resultObj != NULL) { /* Index: generic/nsfError.c =================================================================== diff -u -r299a221ba9d77636fdd3b6bd41a0927735826136 -r1d1ca561af5942718e613929b36e5d2419e4fe5a --- generic/nsfError.c (.../nsfError.c) (revision 299a221ba9d77636fdd3b6bd41a0927735826136) +++ generic/nsfError.c (.../nsfError.c) (revision 1d1ca561af5942718e613929b36e5d2419e4fe5a) @@ -74,46 +74,54 @@ void NsfDStringVPrintf(Tcl_DString *dsPtr, const char *fmt, va_list vargs) { - int result, failure, offset, avail; + int result, failure, avail, offset; va_list vargsCopy; - /* Calculate the DString's anatomy */ - offset = Tcl_DStringLength(dsPtr); /* current length *without* null - terminating character (NTC) */ + /* + * Tcl_DStringLength returns the current length *without* the terminating + * character (NTC). + */ + offset = Tcl_DStringLength(dsPtr); #if defined(_MSC_VER) - avail = dsPtr->spaceAvl - offset - 1; /* Pre-C99: currently free storage, excluding NTC */ + /* + * Pre-C99: currently free storage, excluding NTC + */ + avail = dsPtr->spaceAvl - offset - 1; #else - avail = dsPtr->spaceAvl - offset; /* C99: currently free storage, including NTC */ + /* + * C99: currently free storage, including NTC + */ + avail = dsPtr->spaceAvl - offset; #endif /* * 1) Copy va_list so that the caller's copy is untouched. * 2) Run vsnprintf() eagerly. */ va_copy(vargsCopy, vargs); - result = vsnprintf(dsPtr->string + offset, avail, fmt, vargsCopy); + result = vsnprintf(dsPtr->string + offset, (size_t)avail, fmt, vargsCopy); va_end(vargsCopy); #if defined(_MSC_VER) /* - vs*printf() in pre-C99 runtimes (MSVC up to VS13, VS15 and newer in - backward-compat mode) return -1 upon overflowing the buffer. - - Note: Tcl via tclInt.h precludes the use of pre-C99 mode even in VS15 and - newer (vsnprintf points to backward-compat, pre-C99 _vsnprintf). + * vs*printf() in pre-C99 runtimes (MSVC up to VS13, VS15 and newer in + * backward-compat mode) return -1 upon overflowing the buffer. + * + * Note: Tcl via tclInt.h precludes the use of pre-C99 mode even in VS15 + * and newer (vsnprintf points to backward-compat, pre-C99 _vsnprintf). */ failure = (result == -1); #else /* - vs*printf() in C99 compliant runtimes (GCC, CLANG, MSVC in VS15 and - newer, MinGW/MinGW-w64 with __USE_MINGW_ANSI_STDIO) returns the number of - chars to be written if the buffer would be sufficiently large (excluding - NTC, the terminating null character). A return value of -1 signals an - encoding error. - */ + * vs*printf() in C99 compliant runtimes (GCC, CLANG, MSVC in VS15 and + * newer, MinGW/MinGW-w64 with __USE_MINGW_ANSI_STDIO) returns the number + * of chars to be written if the buffer would be sufficiently large + * (excluding NTC, the terminating null character). A return value of -1 + * signals an encoding error. + */ assert(result > -1); /* no encoding error */ - failure = (result >= avail); + failure = (result >= (int)avail); #endif if (likely(failure == 0)) { @@ -147,7 +155,7 @@ #endif va_copy(vargsCopy, vargs); - result = vsnprintf(dsPtr->string + offset, avail, fmt, vargsCopy); + result = vsnprintf(dsPtr->string + offset, (size_t)avail, fmt, vargsCopy); va_end(vargsCopy); #if defined(_MSC_VER) Index: generic/nsfInt.h =================================================================== diff -u -r4e70d6d46d845f168e6ff18960f8b5a8e3746e6d -r1d1ca561af5942718e613929b36e5d2419e4fe5a --- generic/nsfInt.h (.../nsfInt.h) (revision 4e70d6d46d845f168e6ff18960f8b5a8e3746e6d) +++ generic/nsfInt.h (.../nsfInt.h) (revision 1d1ca561af5942718e613929b36e5d2419e4fe5a) @@ -431,7 +431,7 @@ char *buffer; char *start; size_t bufSize; - int length; + size_t length; } NsfStringIncrStruct; @@ -505,13 +505,13 @@ #define NSF_DISALLOWED_ARG_VALUECHECK (NSF_ARG_SUBST_DEFAULT|NSF_ARG_METHOD_INVOCATION|NSF_ARG_SWITCH|NSF_ARG_CURRENTLY_UNKNOWN|NSF_ARG_SLOTSET|NSF_ARG_SLOTINITIALIZE) /* flags for ParseContext */ -#define NSF_PC_MUST_DECR 0x0001 -#define NSF_PC_IS_DEFAULT 0x0002 -#define NSF_PC_INVERT_DEFAULT 0x0010 +#define NSF_PC_MUST_DECR 0x0001u +#define NSF_PC_IS_DEFAULT 0x0002u +#define NSF_PC_INVERT_DEFAULT 0x0010u -#define NSF_PC_STATUS_MUST_DECR 0x0001 -#define NSF_PC_STATUS_FREE_OBJV 0x0002 -#define NSF_PC_STATUS_FREE_CD 0x0004 +#define NSF_PC_STATUS_MUST_DECR 0x0001u +#define NSF_PC_STATUS_FREE_OBJV 0x0002u +#define NSF_PC_STATUS_FREE_CD 0x0004u /* method types */ @@ -940,7 +940,7 @@ int logSeverity; int debugCallingDepth; unsigned int doCheckArguments; - int doCheckResults; + unsigned int doCheckResults; int doFilters; int doKeepcmds; int doProfile; @@ -1173,7 +1173,7 @@ EXTERN Tcl_ObjType NsfFlagObjType; EXTERN int NsfFlagObjSet(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *baseParamPtr, int serial, - Nsf_Param CONST *paramPtr, Tcl_Obj *payload, int flags); + Nsf_Param CONST *paramPtr, Tcl_Obj *payload, unsigned int flags); typedef struct { CONST Nsf_Param *signature; int serial; Index: generic/nsfObj.c =================================================================== diff -u -r73a82fc11b54214c6fa9893c8ef5849619eadda1 -r1d1ca561af5942718e613929b36e5d2419e4fe5a --- generic/nsfObj.c (.../nsfObj.c) (revision 73a82fc11b54214c6fa9893c8ef5849619eadda1) +++ generic/nsfObj.c (.../nsfObj.c) (revision 1d1ca561af5942718e613929b36e5d2419e4fe5a) @@ -276,7 +276,7 @@ int serial, /* interface serial */ Nsf_Param const *paramPtr, /* a single parameter */ Tcl_Obj *payload, /* payload */ - int flags /* detail infos */ + unsigned int flags /* detail infos */ ) { NsfFlag *flagPtr; Index: generic/nsfProfile.c =================================================================== diff -u -rdc4e227d31df104be7df072ee78f2779ff387b9e -r1d1ca561af5942718e613929b36e5d2419e4fe5a --- generic/nsfProfile.c (.../nsfProfile.c) (revision dc4e227d31df104be7df072ee78f2779ff387b9e) +++ generic/nsfProfile.c (.../nsfProfile.c) (revision 1d1ca561af5942718e613929b36e5d2419e4fe5a) @@ -291,7 +291,7 @@ } else { value = (NsfProfileData *)Tcl_GetHashValue (hPtr); } - value->microSec += totalMicroSec; + value->microSec += (long)totalMicroSec; value->count ++; } @@ -625,7 +625,7 @@ struct Tcl_Time trt; Tcl_GetTime(&trt); - totalMicroSec = (trt.sec - callTime->sec) * 1000000 + (trt.usec - callTime->usec); + totalMicroSec = (double)((trt.sec - callTime->sec) * 1000000 + (trt.usec - callTime->usec)); Tcl_DStringInit(&ds); NsfProfileObjectLabel(&ds, object); @@ -679,8 +679,8 @@ rst = RUNTIME_STATE(interp); profilePtr = &rst->profile; - totalMicroSec = (trt.sec - cscPtr->startSec) * 1000000 + (trt.usec - cscPtr->startUsec); - profilePtr->overallTime += totalMicroSec; + totalMicroSec = (double)((trt.sec - cscPtr->startSec) * 1000000 + (trt.usec - cscPtr->startUsec)); + profilePtr->overallTime += (long)totalMicroSec; obj = cscPtr->self; if (obj->teardown == 0 || !obj->id) { @@ -766,8 +766,8 @@ Tcl_GetTime(&trt); - totalMicroSec = (trt.sec - startSec) * 1000000 + (trt.usec - startUsec); - profilePtr->overallTime += totalMicroSec; + totalMicroSec = (double)((trt.sec - startSec) * 1000000 + (trt.usec - startUsec)); + profilePtr->overallTime += (long)totalMicroSec; if (rst->doTrace) { NsfProfileTraceExitAppend(interp, methodName, totalMicroSec); @@ -878,8 +878,8 @@ Tcl_Obj *subList = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(interp, subList, Tcl_NewStringObj(key, -1)); - Tcl_ListObjAppendElement(interp, subList, Tcl_NewIntObj(value->microSec)); - Tcl_ListObjAppendElement(interp, subList, Tcl_NewIntObj(value->count)); + Tcl_ListObjAppendElement(interp, subList, Tcl_NewLongObj(value->microSec)); + Tcl_ListObjAppendElement(interp, subList, Tcl_NewLongObj(value->count)); Tcl_ListObjAppendElement(interp, list, subList); } return list; @@ -915,8 +915,8 @@ Tcl_GetTime(&trt); totalMicroSec = (trt.sec - profilePtr->startSec) * 1000000 + (trt.usec - profilePtr->startUSec); - Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj(totalMicroSec)); - Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj(profilePtr->overallTime)); + Tcl_ListObjAppendElement(interp, list, Tcl_NewLongObj((long)totalMicroSec)); + Tcl_ListObjAppendElement(interp, list, Tcl_NewLongObj(profilePtr->overallTime)); Tcl_ListObjAppendElement(interp, list, NsfProfileGetTable(interp, &profilePtr->objectData)); Tcl_ListObjAppendElement(interp, list, NsfProfileGetTable(interp, &profilePtr->methodData)); Tcl_ListObjAppendElement(interp, list, NsfProfileGetTable(interp, &profilePtr->procData)); Index: generic/nsfShadow.c =================================================================== diff -u -r16a02881bff0a0d626d0045dfd96660338d0c314 -r1d1ca561af5942718e613929b36e5d2419e4fe5a --- generic/nsfShadow.c (.../nsfShadow.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) +++ generic/nsfShadow.c (.../nsfShadow.c) (revision 1d1ca561af5942718e613929b36e5d2419e4fe5a) @@ -300,15 +300,18 @@ result = NsfCallCommand(interp, NSF_INFO_FRAME, objc, objv); if (result == TCL_OK && objc == 2) { - int level, topLevel, frameFlags; - CmdFrame *framePtr = Tcl_Interp_cmdFramePtr(interp); - CallFrame *varFramePtr = Tcl_Interp_varFramePtr(interp); - Tcl_Obj *resultObj = Tcl_GetObjResult(interp); + int level, topLevel; + unsigned int frameFlags; + CmdFrame *framePtr = Tcl_Interp_cmdFramePtr(interp); + CallFrame *varFramePtr = Tcl_Interp_varFramePtr(interp); + Tcl_Obj *resultObj = Tcl_GetObjResult(interp); - /* level must be ok, otherwise we would not have a TCL_OK */ + /* + * Level must be ok, otherwise we would not have a TCL_OK. + */ Tcl_GetIntFromObj(interp, objv[1], &level); - /* todo: coroutine level messing is missing */ + /* todo: coroutine level messing is missing. needed? */ topLevel = (framePtr == NULL) ? 0 : framePtr->level; if (level > 0) { @@ -320,7 +323,7 @@ varFramePtr = varFramePtr->callerPtr; } - frameFlags = (varFramePtr != NULL) ? Tcl_CallFrame_isProcCallFrame(varFramePtr) : 0; + frameFlags = (varFramePtr != NULL) ? (unsigned int)Tcl_CallFrame_isProcCallFrame(varFramePtr) : 0u; /*fprintf(stderr, " ... frame %p varFramePtr %p frameFlags %.6x\n", framePtr, varFramePtr, frameFlags); Tcl85showStack(interp);*/ @@ -332,7 +335,10 @@ int oc, i; listObj = Tcl_NewListObj(0, NULL); - /* remove "proc" element from list, if provided */ + + /* + * Remove "proc" element from list, if provided. + */ Tcl_ListObjGetElements(interp, resultObj, &oc, &ov); for (i=0; i 1) { - memcpy(ov+1, objv+1, sizeof(Tcl_Obj *)*(objc-1)); + memcpy(ov+1, objv+1, sizeof(Tcl_Obj *) * ((size_t)objc - 1u)); } result = Tcl_NRCallObjProc(interp, ti->proc, ti->clientData, objc, objv); FREE_ON_STACK(Tcl_Obj *, ov); Index: generic/nsfUtil.c =================================================================== diff -u -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba -r1d1ca561af5942718e613929b36e5d2419e4fe5a --- generic/nsfUtil.c (.../nsfUtil.c) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) +++ generic/nsfUtil.c (.../nsfUtil.c) (revision 1d1ca561af5942718e613929b36e5d2419e4fe5a) @@ -112,7 +112,7 @@ } do { nr_written++; - *pointer++ = i%10 + '0'; + *pointer++ = (char)(i%10 + '0'); i/=10; } while (i); @@ -145,7 +145,7 @@ */ static char *alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -static int blockIncrement = 8; +static size_t blockIncrement = 8u; /* static char *alphabet = "ab"; static int blockIncrement = 2; @@ -175,7 +175,8 @@ iss->length++; if (currentChar == iss->buffer) { size_t newBufSize = iss->bufSize + blockIncrement; - char *newBuffer = ckalloc(newBufSize); + char *newBuffer = ckalloc(newBufSize); + currentChar = newBuffer+blockIncrement; /*memset(newBuffer, 0, blockIncrement);*/ memcpy(currentChar, iss->buffer, iss->bufSize); @@ -217,14 +218,14 @@ void NsfStringIncrInit(NsfStringIncrStruct *iss) { - char *p; - int i = 0; + char *p; + int i = 0; const size_t bufSize = (blockIncrement > 2) ? blockIncrement : 2; nonnull_assert(iss != NULL); for (p=alphabet; *p != '\0'; p++) { - chartable[(int)*p] = ++i; + chartable[(int)*p] = (unsigned char)(++i); } iss->buffer = ckalloc(bufSize);