From 60670274b079f0aa0735bb70fb12c642d1b585ab Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 13 Mar 2019 20:44:29 +0000 Subject: Eliminate many (mostly harmless) MSVC warning messages. Tcl 9 compiles warning-free now on MSVC. --- generic/tclBinary.c | 2 +- generic/tclCompCmds.c | 4 ++-- generic/tclEncoding.c | 2 +- generic/tclEnsemble.c | 2 +- generic/tclIO.c | 18 +++++++++--------- generic/tclIOCmd.c | 2 +- generic/tclIORChan.c | 2 +- generic/tclIOUtil.c | 8 ++++---- generic/tclIndexObj.c | 4 ++-- generic/tclInt.h | 8 ++++---- generic/tclOOBasic.c | 2 +- generic/tclOOCall.c | 2 +- generic/tclOOInfo.c | 4 ++-- generic/tclTestObj.c | 2 +- generic/tclThreadAlloc.c | 2 +- generic/tclUtil.c | 4 ++-- generic/tclZipfs.c | 2 +- win/tclWinFCmd.c | 4 ++-- win/tclWinInit.c | 2 +- win/tclWinSerial.c | 10 +++++----- 20 files changed, 43 insertions(+), 43 deletions(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index cb9cd8e..99827c8 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -640,7 +640,7 @@ DupByteArrayInternalRep( srcArrayPtr = GET_BYTEARRAY(TclFetchIntRep(srcPtr, &tclByteArrayType)); length = srcArrayPtr->used; - copyArrayPtr = ckalloc(BYTEARRAY_SIZE(length)); + copyArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length)); copyArrayPtr->used = length; copyArrayPtr->allocated = length; memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length); diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index dc2470c..6ec0e26 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1566,7 +1566,7 @@ CompileDictEachCmd( } Tcl_DStringFree(&buffer); if (numVars != 2) { - Tcl_Free(argv); + Tcl_Free((void *)argv); return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1574,7 +1574,7 @@ CompileDictEachCmd( keyVarIndex = LocalScalar(argv[0], nameChars, envPtr); nameChars = strlen(argv[1]); valueVarIndex = LocalScalar(argv[1], nameChars, envPtr); - Tcl_Free(argv); + Tcl_Free((void *)argv); if ((keyVarIndex < 0) || (valueVarIndex < 0)) { return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 222f11d..88cf538 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2003,7 +2003,7 @@ LoadEscapeEncoding( Tcl_DStringAppend(&escapeData, (char *) &est, sizeof(est)); } } - Tcl_Free(argv); + Tcl_Free((void *)argv); Tcl_DStringFree(&lineString); } diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 1889475..1741d49 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -1645,7 +1645,7 @@ TclMakeEnsemble( Tcl_DStringFree(&buf); Tcl_DStringFree(&hiddenBuf); if (nameParts != NULL) { - Tcl_Free(nameParts); + Tcl_Free((void *)nameParts); } return ensemble; } diff --git a/generic/tclIO.c b/generic/tclIO.c index 619982a..ab5d20c 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -4408,7 +4408,7 @@ Write( * beginning of the next buffer. */ - saved = -SpaceLeft(bufPtr); + saved = 1 + ~SpaceLeft(bufPtr); memcpy(safe, dst + dstLen, saved); bufPtr->nextAdded = bufPtr->bufLength; } @@ -7672,7 +7672,7 @@ Tcl_BadChannelOption( Tcl_AppendPrintfToObj(errObj, "or -%s", argv[i]); Tcl_SetObjResult(interp, errObj); Tcl_DStringFree(&ds); - Tcl_Free(argv); + Tcl_Free((void *)argv); } Tcl_SetErrno(EINVAL); return TCL_ERROR; @@ -8063,7 +8063,7 @@ Tcl_SetChannelOption( "bad value for -eofchar: must be non-NUL ASCII" " character", -1)); } - Tcl_Free(argv); + Tcl_Free((void *)argv); return TCL_ERROR; } if (GotFlag(statePtr, TCL_READABLE)) { @@ -8078,11 +8078,11 @@ Tcl_SetChannelOption( "bad value for -eofchar: should be a list of zero," " one, or two elements", -1)); } - Tcl_Free(argv); + Tcl_Free((void *)argv); return TCL_ERROR; } if (argv != NULL) { - Tcl_Free(argv); + Tcl_Free((void *)argv); } /* @@ -8116,7 +8116,7 @@ Tcl_SetChannelOption( "bad value for -translation: must be a one or two" " element list", -1)); } - Tcl_Free(argv); + Tcl_Free((void *)argv); return TCL_ERROR; } @@ -8146,7 +8146,7 @@ Tcl_SetChannelOption( "bad value for -translation: must be one of " "auto, binary, cr, lf, crlf, or platform", -1)); } - Tcl_Free(argv); + Tcl_Free((void *)argv); return TCL_ERROR; } @@ -8196,11 +8196,11 @@ Tcl_SetChannelOption( "bad value for -translation: must be one of " "auto, binary, cr, lf, crlf, or platform", -1)); } - Tcl_Free(argv); + Tcl_Free((void *)argv); return TCL_ERROR; } } - Tcl_Free(argv); + Tcl_Free((void *)argv); return TCL_OK; } else if (chanPtr->typePtr->setOptionProc != NULL) { return chanPtr->typePtr->setOptionProc(chanPtr->instanceData, interp, diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index cbfd1da..522ed3d 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1165,7 +1165,7 @@ Tcl_OpenObjCmd( Tcl_SetChannelOption(interp, chan, "-translation", "binary"); } } - Tcl_Free(cmdArgv); + Tcl_Free((void *)cmdArgv); } if (chan == NULL) { return TCL_ERROR; diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 46c69a1..31bc8e0 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -1259,7 +1259,7 @@ ReflectInput( { ReflectedChannel *rcPtr = clientData; Tcl_Obj *toReadObj; - size_t bytec; /* Number of returned bytes */ + size_t bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ Tcl_Obj *resObj; /* Result data for 'read' */ diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 33507ac..f18c20c 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1667,7 +1667,7 @@ TclGetOpenModeEx( "access mode \"%s\" not supported by this system", flag)); } - Tcl_Free(modeArgv); + Tcl_Free((void *)modeArgv); return -1; #endif @@ -1680,7 +1680,7 @@ TclGetOpenModeEx( "access mode \"%s\" not supported by this system", flag)); } - Tcl_Free(modeArgv); + Tcl_Free((void *)modeArgv); return -1; #endif @@ -1696,12 +1696,12 @@ TclGetOpenModeEx( "RDWR, APPEND, BINARY, CREAT, EXCL, NOCTTY, NONBLOCK," " or TRUNC", flag)); } - Tcl_Free(modeArgv); + Tcl_Free((void *)modeArgv); return -1; } } - Tcl_Free(modeArgv); + Tcl_Free((void *)modeArgv); if (!gotRW) { if (interp != NULL) { diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index cc6dd22..e566f57 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -138,7 +138,7 @@ GetIndexFromObjList( * An exact match is always chosen, so we can stop here. */ - Tcl_Free(tablePtr); + Tcl_Free((void *)tablePtr); *indexPtr = t; return TCL_OK; } @@ -150,7 +150,7 @@ GetIndexFromObjList( result = Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, sizeof(char *), msg, flags | INDEX_TEMP_TABLE, indexPtr); - Tcl_Free(tablePtr); + Tcl_Free((void *)tablePtr); return result; } diff --git a/generic/tclInt.h b/generic/tclInt.h index bb20792..0d10b4f 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4409,13 +4409,13 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, ? NULL : Tcl_GetString((objPtr)), \ *(lenPtr) = (objPtr)->length, (objPtr)->bytes)) #define TclGetUnicodeFromObj(objPtr, lenPtr) \ - (Tcl_GetUnicodeFromObj(objPtr, NULL), \ + (Tcl_GetUnicodeFromObj((objPtr), NULL), \ *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1), \ - Tcl_GetUnicodeFromObj(objPtr, NULL)) + Tcl_GetUnicodeFromObj((objPtr), NULL)) #define TclGetByteArrayFromObj(objPtr, lenPtr) \ - (Tcl_GetByteArrayFromObj(objPtr, NULL) ? \ + (Tcl_GetByteArrayFromObj((objPtr), NULL) ? \ (*(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1), \ - (unsigned char *)(((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1) + 2)) : (*(lenPtr) = 0, NULL)) + (unsigned char *)(((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1) + 2)) : NULL) #endif /* diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 72b755b..c1002ce 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -605,7 +605,7 @@ TclOO_Object_Unknown( Tcl_AppendToObj(errorMsg, " or ", -1); } Tcl_AppendToObj(errorMsg, methodNames[i], -1); - Tcl_Free(methodNames); + Tcl_Free((void *)methodNames); Tcl_SetObjResult(interp, errorMsg); Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD", TclGetString(objv[skip]), NULL); diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 596d036..11c6e19 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -635,7 +635,7 @@ SortMethodNames( } *stringsPtr = strings; } else { - Tcl_Free(strings); + Tcl_Free((void *)strings); *stringsPtr = NULL; } return i; diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c index f9767a7..aec764e 100644 --- a/generic/tclOOInfo.c +++ b/generic/tclOOInfo.c @@ -612,7 +612,7 @@ InfoObjectMethodsCmd( Tcl_NewStringObj(names[i], -1)); } if (numNames > 0) { - Tcl_Free(names); + Tcl_Free((void *)names); } } else if (oPtr->methodsPtr) { FOREACH_HASH(namePtr, mPtr, oPtr->methodsPtr) { @@ -1366,7 +1366,7 @@ InfoClassMethodsCmd( Tcl_NewStringObj(names[i], -1)); } if (numNames > 0) { - Tcl_Free(names); + Tcl_Free((void *)names); } } else { FOREACH_HASH_DECLS; diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index c100c03..16e964a 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -625,7 +625,7 @@ TestindexobjCmd( result = Tcl_GetIndexFromObj((setError? interp : NULL), objv[3], argv, "token", INDEX_TEMP_TABLE|(allowAbbrev? 0 : TCL_EXACT), &index); - Tcl_Free(argv); + Tcl_Free((void *)argv); if (result == TCL_OK) { Tcl_SetIntObj(Tcl_GetObjResult(interp), index); } diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index cd57d2e..cf275c8 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -1082,7 +1082,7 @@ TclInitThreadAlloc(void) objLockPtr = TclpNewAllocMutex(); for (i = 0; i < NBUCKETS; ++i) { bucketInfo[i].blockSize = MINALLOC << i; - bucketInfo[i].maxBlocks = 1 << (NBUCKETS - 1 - i); + bucketInfo[i].maxBlocks = ((size_t)1) << (NBUCKETS - 1 - i); bucketInfo[i].numMove = i < NBUCKETS - 1 ? 1 << (NBUCKETS - 2 - i) : 1; bucketInfo[i].lockPtr = TclpNewAllocMutex(); diff --git a/generic/tclUtil.c b/generic/tclUtil.c index d13e3dc..fd742d1 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -881,14 +881,14 @@ Tcl_SplitList( &elSize, &literal); length -= (list - prevList); if (result != TCL_OK) { - Tcl_Free(argv); + Tcl_Free((void *)argv); return result; } if (*element == 0) { break; } if (i >= size) { - Tcl_Free(argv); + Tcl_Free((void *)argv); if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "internal error in Tcl_SplitList", -1)); diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index c831143..2863096 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -1903,7 +1903,7 @@ ZipFSMountBufferObjCmd( { const char *mountPoint; /* Mount point path. */ unsigned char *data; - size_t length; + size_t length = 0; if (objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "?mountpoint? ?data?"); diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index e3aca91..72c833a 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -376,8 +376,8 @@ DoRenameFile( Tcl_SetErrno(EXDEV); } - Tcl_Free(srcArgv); - Tcl_Free(dstArgv); + Tcl_Free((void *)srcArgv); + Tcl_Free((void *)dstArgv); } /* diff --git a/win/tclWinInit.c b/win/tclWinInit.c index b2c8aaa..b5f8eeb 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -317,7 +317,7 @@ AppendEnvironment( objPtr = Tcl_NewStringObj(buf, -1); } Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); - Tcl_Free(pathv); + Tcl_Free((void *)pathv); } } diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index f2169be..92750b8 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -1721,7 +1721,7 @@ SerialSetOptionProc( " two elements with each a single 8-bit character", -1)); Tcl_SetErrorCode(interp, "TCL", "VALUE", "XCHAR", NULL); } - Tcl_Free(argv); + Tcl_Free((void *)argv); return TCL_ERROR; } @@ -1752,7 +1752,7 @@ SerialSetOptionProc( } dcb.XoffChar = (char) character; } - Tcl_Free(argv); + Tcl_Free((void *)argv); if (!SetCommState(infoPtr->handle, &dcb)) { goto setStateFailed; @@ -1777,7 +1777,7 @@ SerialSetOptionProc( "a list of signal,value pairs", value)); Tcl_SetErrorCode(interp, "TCL", "VALUE", "TTYCONTROL", NULL); } - Tcl_Free(argv); + Tcl_Free((void *)argv); return TCL_ERROR; } @@ -1835,7 +1835,7 @@ SerialSetOptionProc( } } - Tcl_Free(argv); + Tcl_Free((void *)argv); return result; } @@ -1861,7 +1861,7 @@ SerialSetOptionProc( inSize = atoi(argv[0]); outSize = atoi(argv[1]); } - Tcl_Free(argv); + Tcl_Free((void *)argv); if ((argc < 1) || (argc > 2) || (inSize <= 0) || (outSize <= 0)) { if (interp != NULL) { -- cgit v0.12