Index: generic/nsf.c =================================================================== diff -u -N -re8d2c805806a4395457eb4b79fc986fd008ba9a7 -rbdfa0fc0d417405db109b2099da713dc4a0daa6f --- generic/nsf.c (.../nsf.c) (revision e8d2c805806a4395457eb4b79fc986fd008ba9a7) +++ generic/nsf.c (.../nsf.c) (revision bdfa0fc0d417405db109b2099da713dc4a0daa6f) @@ -721,10 +721,10 @@ pcPtr->clientData = &pcPtr->clientData_static[0]; pcPtr->flags = &pcPtr->flags_static[0]; } else { - pcPtr->full_objv = (Tcl_Obj **)ckalloc((int)sizeof(Tcl_Obj *) * (objc+1)); - pcPtr->flags = (unsigned int *)ckalloc((int)sizeof(int) * (objc+1)); + pcPtr->full_objv = (Tcl_Obj **)ckalloc((int)sizeof(Tcl_Obj *) * ((unsigned)objc+1u)); + pcPtr->flags = (unsigned *)ckalloc((unsigned)sizeof(int) * ((unsigned)objc+1u)); MEM_COUNT_ALLOC("pcPtr.objv", pcPtr->full_objv); - pcPtr->clientData = (ClientData *)ckalloc((int)sizeof(ClientData) * objc); + pcPtr->clientData = (ClientData *)ckalloc((unsigned)sizeof(ClientData) * (unsigned)objc); MEM_COUNT_ALLOC("pcPtr.clientData", pcPtr->clientData); /*fprintf(stderr, "ParseContextMalloc %d objc, %p %p\n", objc, pcPtr->full_objv, pcPtr->clientData);*/ memset(pcPtr->full_objv, 0, sizeof(Tcl_Obj *) * (size_t)(objc+1)); @@ -756,12 +756,12 @@ * *---------------------------------------------------------------------- */ -static void ParseContextExtendObjv(ParseContext *pcPtr, int from, int elts, Tcl_Obj *CONST source[]) +static void ParseContextExtendObjv(ParseContext *pcPtr, unsigned from, unsigned elts, Tcl_Obj *CONST source[]) nonnull(1) nonnull(4); static void -ParseContextExtendObjv(ParseContext *pcPtr, int from, int elts, Tcl_Obj *CONST source[]) { - int requiredSize = from + elts + 1; +ParseContextExtendObjv(ParseContext *pcPtr, unsigned from, unsigned elts, Tcl_Obj *CONST source[]) { + unsigned requiredSize = from + elts + 1; nonnull_assert(pcPtr != NULL); nonnull_assert(source != NULL); @@ -773,8 +773,8 @@ /* * Realloc from preallocated memory */ - pcPtr->full_objv = (Tcl_Obj **) ckalloc((int)sizeof(Tcl_Obj *) * requiredSize); - pcPtr->flags = (unsigned int *)ckalloc((int)sizeof(int) * requiredSize); + pcPtr->full_objv = (Tcl_Obj **)ckalloc((int)sizeof(Tcl_Obj *) * requiredSize); + pcPtr->flags = (unsigned *)ckalloc((int)sizeof(int) * requiredSize); MEM_COUNT_ALLOC("pcPtr.objv", pcPtr->full_objv); memcpy(pcPtr->full_objv, &pcPtr->objv_static[0], sizeof(Tcl_Obj *) * PARSE_CONTEXT_PREALLOC); memcpy(pcPtr->flags, &pcPtr->flags_static[0], sizeof(int) * PARSE_CONTEXT_PREALLOC); @@ -786,8 +786,8 @@ /* * Realloc from mallocated memory */ - pcPtr->full_objv = (Tcl_Obj **) ckrealloc((char *)pcPtr->full_objv, (int)sizeof(Tcl_Obj *) * requiredSize); - pcPtr->flags = (unsigned int *)ckrealloc((char *)pcPtr->flags, (int)sizeof(int) * requiredSize); + pcPtr->full_objv = (Tcl_Obj **)ckrealloc((char *)pcPtr->full_objv, (unsigned)sizeof(Tcl_Obj *) * requiredSize); + pcPtr->flags = (unsigned *)ckrealloc((char *)pcPtr->flags, (unsigned)sizeof(int) * requiredSize); /*fprintf(stderr, "ParseContextExtendObjv: extend %p realloc %d new objv=%p pcPtr %p\n", pcPtr, requiredSize, pcPtr->full_objv, pcPtr);*/ } @@ -17196,7 +17196,7 @@ */ /*NsfPrintObjv("actual: ", objc, objv);*/ - ParseContextExtendObjv(pcPtr, paramDefs->nrParams, elts-1, objv + 1 + pcPtr->lastObjc); + ParseContextExtendObjv(pcPtr, (unsigned)paramDefs->nrParams, (unsigned)elts-1u, objv + 1u + pcPtr->lastObjc); } else { /* * A single argument was passed to "args". There is no need to @@ -17992,7 +17992,7 @@ if (inEnsemble != 0) { methodNameLength = 1 + cscPtr->objc - oc; nobjc = objc + methodNameLength; - nobjv = (Tcl_Obj **)ckalloc((int)sizeof(Tcl_Obj *) * nobjc); + nobjv = (Tcl_Obj **)ckalloc((unsigned)sizeof(Tcl_Obj *) * (unsigned)nobjc); MEM_COUNT_ALLOC("nextArgumentVector", nobjv); /* * Copy the ensemble path name @@ -18002,7 +18002,7 @@ } else { methodNameLength = 1; nobjc = objc + methodNameLength; - nobjv = (Tcl_Obj **)ckalloc((int)sizeof(Tcl_Obj *) * nobjc); + nobjv = (Tcl_Obj **)ckalloc((unsigned)sizeof(Tcl_Obj *) * (unsigned)nobjc); MEM_COUNT_ALLOC("nextArgumentVector", nobjv); /* * Copy the method name Index: generic/nsfInt.h =================================================================== diff -u -N -r295ac11031c89a0e649ea8b0ba3da8b6aa1ce953 -rbdfa0fc0d417405db109b2099da713dc4a0daa6f --- generic/nsfInt.h (.../nsfInt.h) (revision 295ac11031c89a0e649ea8b0ba3da8b6aa1ce953) +++ generic/nsfInt.h (.../nsfInt.h) (revision bdfa0fc0d417405db109b2099da713dc4a0daa6f) @@ -179,7 +179,7 @@ # define MEM_COUNT_RELEASE() #endif -# define STRING_NEW(target, p, l) (target) = ckalloc((l)+1); strncpy((target), (p), (l)); *((target)+(l)) = '\0'; \ +# define STRING_NEW(target, p, l) (target) = ckalloc((unsigned)(l)+1u); strncpy((target), (p), (l)); *((target)+(l)) = '\0'; \ MEM_COUNT_ALLOC(#target, (target)) # define STRING_FREE(key, p) MEM_COUNT_FREE((key), (p)); ckfree((p)) @@ -195,10 +195,13 @@ #define nr_elements(arr) ((int) (sizeof(arr) / sizeof((arr)[0]))) +/* + * Tcl 8.6 uses (unsigned) per default + */ # define NEW(type) \ - (type *)ckalloc(sizeof(type)); MEM_COUNT_ALLOC(#type, NULL) + (type *)ckalloc((unsigned)sizeof(type)); MEM_COUNT_ALLOC(#type, NULL) # define NEW_ARRAY(type,n) \ - (type *)ckalloc(sizeof(type)*(size_t)(n)); MEM_COUNT_ALLOC(#type "*", NULL) + (type *)ckalloc((unsigned)sizeof(type)*(unsigned)(n)); MEM_COUNT_ALLOC(#type "*", NULL) # define FREE(type, var) \ ckfree((char*) (var)); MEM_COUNT_FREE(#type,(var)) @@ -274,7 +277,7 @@ # define ISOBJ_(o) ((o) != (void*)0xdeadbeaf && ((o)->typePtr ? ((o)->typePtr->name != NULL) : ((o)->bytes != NULL)) && (o)->length >= -1 && (o)->refCount >= 0) # else # define ISOBJ(o) ((o) != NULL && ISOBJ_(o)) -# define ISOBJ_(o) ((o) != (void*)0xdeadbeaf && ((o)->typePtr ? (o)->typePtr->name != NULL : ((o)->bytes != NULL)) && ((o)->bytes != NULL ? (o)->length >= 0 : 1) && (o)->refCount >= 0) +# define ISOBJ_(o) ((o) != (void*)0xdeadbeaf && ((o)->typePtr ? ((o)->typePtr->name != NULL) : ((o)->bytes != NULL)) && (o)->length >= -1 && (o)->refCount >= 0) # endif #else # define ISOBJ(o) ((o) != NULL && ISOBJ_(o)) Index: generic/nsfUtil.c =================================================================== diff -u -N -r9238ec9d4886db0f3c2c903cb19042aaca35b31f -rbdfa0fc0d417405db109b2099da713dc4a0daa6f --- generic/nsfUtil.c (.../nsfUtil.c) (revision 9238ec9d4886db0f3c2c903cb19042aaca35b31f) +++ generic/nsfUtil.c (.../nsfUtil.c) (revision bdfa0fc0d417405db109b2099da713dc4a0daa6f) @@ -179,7 +179,7 @@ iss->length++; if (currentChar == iss->buffer) { size_t newBufSize = iss->bufSize + blockIncrement; - char *newBuffer = ckalloc(newBufSize); + char *newBuffer = ckalloc((unsigned)newBufSize); currentChar = newBuffer+blockIncrement; /*memset(newBuffer, 0, blockIncrement);*/ @@ -232,7 +232,7 @@ chartable[(int)*p] = (unsigned char)(++i); } - iss->buffer = ckalloc(bufSize); + iss->buffer = ckalloc((unsigned)bufSize); memset(iss->buffer, 0, bufSize); iss->start = iss->buffer + bufSize-2; iss->bufSize = bufSize;