From d73c6dbd81c0537e3d6df60dc145af1b6539d6d2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 11 Aug 2020 05:39:08 +0000 Subject: Eliminate many unnecessary type-casts, mostly (size_t) when value is already size_t or int --- generic/tclAlloc.c | 2 +- generic/tclBasic.c | 2 +- generic/tclBinary.c | 16 ++++++++-------- generic/tclCkalloc.c | 6 +++--- generic/tclCmdMZ.c | 4 ++-- generic/tclCompCmdsSZ.c | 2 +- generic/tclCompExpr.c | 2 +- generic/tclCompile.c | 8 ++++---- generic/tclExecute.c | 4 ++-- generic/tclFileName.c | 2 +- generic/tclIO.c | 6 +++--- generic/tclIOUtil.c | 2 +- generic/tclInterp.c | 8 ++++---- generic/tclListObj.c | 6 +++--- generic/tclObj.c | 12 ++++++------ generic/tclPathObj.c | 2 +- generic/tclStubInit.c | 2 +- generic/tclThread.c | 4 ++-- generic/tclThreadTest.c | 4 ++-- generic/tclTrace.c | 4 ++-- macosx/tclMacOSXFCmd.c | 2 +- unix/tclUnixFile.c | 2 +- unix/tclUnixInit.c | 4 ++-- unix/tclUnixSock.c | 2 +- win/tclWinConsole.c | 6 +++--- win/tclWinFCmd.c | 2 +- win/tclWinInit.c | 4 ++-- win/tclWinPipe.c | 2 +- win/tclWinSerial.c | 2 +- win/tclWinSock.c | 2 +- 30 files changed, 63 insertions(+), 63 deletions(-) diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index 6187ce2..39b9395 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -604,7 +604,7 @@ TclpRealloc( if (maxSize < numBytes) { numBytes = maxSize; } - memcpy(newPtr, oldPtr, (size_t) numBytes); + memcpy(newPtr, oldPtr, numBytes); TclpFree(oldPtr); return newPtr; } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 50bc84e..2ac6fef 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4139,7 +4139,7 @@ Tcl_CancelEval( if (resultObjPtr != NULL) { result = Tcl_GetStringFromObj(resultObjPtr, &cancelInfo->length); cancelInfo->result = ckrealloc(cancelInfo->result,cancelInfo->length); - memcpy(cancelInfo->result, result, (size_t) cancelInfo->length); + memcpy(cancelInfo->result, result, cancelInfo->length); TclDecrRefCount(resultObjPtr); /* Discard their result object. */ } else { cancelInfo->result = NULL; diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 8f4f6ab..f66aff7 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -339,7 +339,7 @@ Tcl_SetByteArrayObj( byteArrayPtr->allocated = length; if ((bytes != NULL) && (length > 0)) { - memcpy(byteArrayPtr->bytes, bytes, (size_t) length); + memcpy(byteArrayPtr->bytes, bytes, length); } objPtr->typePtr = &tclByteArrayType; SET_BYTEARRAY(objPtr, byteArrayPtr); @@ -532,7 +532,7 @@ DupByteArrayInternalRep( copyArrayPtr = ckalloc(BYTEARRAY_SIZE(length)); copyArrayPtr->used = length; copyArrayPtr->allocated = length; - memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, (size_t) length); + memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length); SET_BYTEARRAY(copyPtr, copyArrayPtr); copyPtr->typePtr = &tclByteArrayType; @@ -593,7 +593,7 @@ UpdateStringOfByteArray( objPtr->length = size; if (size == length) { - memcpy(dst, src, (size_t) size); + memcpy(dst, src, size); dst[size] = '\0'; } else { for (i = 0; i < length; i++) { @@ -945,7 +945,7 @@ BinaryFormatCmd( resultPtr = Tcl_NewObj(); buffer = Tcl_SetByteArrayLength(resultPtr, length); - memset(buffer, 0, (size_t) length); + memset(buffer, 0, length); /* * Pack the data into the result object. Note that we can skip the error @@ -982,10 +982,10 @@ BinaryFormatCmd( count = 1; } if (length >= count) { - memcpy(cursor, bytes, (size_t) count); + memcpy(cursor, bytes, count); } else { - memcpy(cursor, bytes, (size_t) length); - memset(cursor + length, pad, (size_t) (count - length)); + memcpy(cursor, bytes, length); + memset(cursor + length, pad, count - length); } cursor += count; break; @@ -1174,7 +1174,7 @@ BinaryFormatCmd( if (count == BINARY_NOCOUNT) { count = 1; } - memset(cursor, 0, (size_t) count); + memset(cursor, 0, count); cursor += count; break; case 'X': diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 9c3cbff..2730443 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -623,7 +623,7 @@ Tcl_DbCkfree( Tcl_MutexLock(ckallocMutexPtr); ValidateMemory(memp, file, line, TRUE); if (init_malloced_bodies) { - memset(ptr, GUARD_VALUE, (size_t) memp->length); + memset(ptr, GUARD_VALUE, memp->length); } total_frees++; @@ -693,7 +693,7 @@ Tcl_DbCkrealloc( copySize = memp->length; } newPtr = Tcl_DbCkalloc(size, file, line); - memcpy(newPtr, ptr, (size_t) copySize); + memcpy(newPtr, ptr, copySize); Tcl_DbCkfree(ptr, file, line); return newPtr; } @@ -727,7 +727,7 @@ Tcl_AttemptDbCkrealloc( if (newPtr == NULL) { return NULL; } - memcpy(newPtr, ptr, (size_t) copySize); + memcpy(newPtr, ptr, copySize); Tcl_DbCkfree(ptr, file, line); return newPtr; } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 298b3b7..b9b6b6c 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2288,7 +2288,7 @@ StringReptCmd( return TCL_ERROR; } for (index = 0; index < count; index++) { - memcpy(string2 + (length1 * index), string1, (size_t) length1); + memcpy(string2 + (length1 * index), string1, length1); } string2[length2] = '\0'; @@ -2850,7 +2850,7 @@ TclStringCmp( * The comparison function should compare up to the minimum byte * length only. */ - match = memCmpFn(s1, s2, (size_t) length); + match = memCmpFn(s1, s2, length); } if ((match == 0) && (reqlength > length)) { match = s1len - s2len; diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 31e2c88..ddfe0dc 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -756,7 +756,7 @@ TclCompileStringMatchCmd( } str = tokenPtr[1].start; length = tokenPtr[1].size; - if ((length <= 1) || strncmp(str, "-nocase", (size_t) length)) { + if ((length <= 1) || strncmp(str, "-nocase", length)) { /* * Fail at run time, not in compilation. */ diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 9c7ab8d..0d33821 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -2068,7 +2068,7 @@ ParseLexeme( } else { char utfBytes[TCL_UTF_MAX]; - memcpy(utfBytes, start, (size_t) numBytes); + memcpy(utfBytes, start, numBytes); utfBytes[numBytes] = '\0'; scanned = TclUtfToUniChar(utfBytes, &ch); } diff --git a/generic/tclCompile.c b/generic/tclCompile.c index ece0cae..1cc655e 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2820,7 +2820,7 @@ TclInitByteCodeObj( p += sizeof(ByteCode); codePtr->codeStart = p; - memcpy(p, envPtr->codeStart, (size_t) codeBytes); + memcpy(p, envPtr->codeStart, codeBytes); p += TCL_ALIGN(codeBytes); /* align object array */ codePtr->objArrayPtr = (Tcl_Obj **) p; @@ -2853,7 +2853,7 @@ TclInitByteCodeObj( p += TCL_ALIGN(objArrayBytes); /* align exception range array */ if (exceptArrayBytes > 0) { codePtr->exceptArrayPtr = (ExceptionRange *) p; - memcpy(p, envPtr->exceptArrayPtr, (size_t) exceptArrayBytes); + memcpy(p, envPtr->exceptArrayPtr, exceptArrayBytes); } else { codePtr->exceptArrayPtr = NULL; } @@ -2861,7 +2861,7 @@ TclInitByteCodeObj( p += TCL_ALIGN(exceptArrayBytes); /* align AuxData array */ if (auxDataArrayBytes > 0) { codePtr->auxDataArrayPtr = (AuxData *) p; - memcpy(p, envPtr->auxDataArrayPtr, (size_t) auxDataArrayBytes); + memcpy(p, envPtr->auxDataArrayPtr, auxDataArrayBytes); } else { codePtr->auxDataArrayPtr = NULL; } @@ -3028,7 +3028,7 @@ TclFindCompiledLocal( localPtr->resolveInfo = NULL; if (name != NULL) { - memcpy(localPtr->name, name, (size_t) nameBytes); + memcpy(localPtr->name, name, nameBytes); } localPtr->name[nameBytes] = '\0'; procPtr->numCompiledLocals++; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index dd82f95..aacf565 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2838,7 +2838,7 @@ TEBCresume( for (; currPtr <= &OBJ_AT_TOS; currPtr++) { bytes = TclGetStringFromObj(*currPtr, &length); if (bytes != NULL) { - memcpy(p, bytes, (size_t) length); + memcpy(p, bytes, length); p += length; } } @@ -2873,7 +2873,7 @@ TEBCresume( for (; currPtr <= &OBJ_AT_TOS; currPtr++) { if ((*currPtr)->bytes != tclEmptyStringRep) { bytes = (char *) Tcl_GetByteArrayFromObj(*currPtr,&length); - memcpy(p, bytes, (size_t) length); + memcpy(p, bytes, length); p += length; } } diff --git a/generic/tclFileName.c b/generic/tclFileName.c index f7de10c..6cdfa7e 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -598,7 +598,7 @@ Tcl_SplitPath( for (i = 0; i < *argcPtr; i++) { Tcl_ListObjIndex(NULL, resultPtr, i, &eltPtr); str = Tcl_GetStringFromObj(eltPtr, &len); - memcpy(p, str, (size_t) len+1); + memcpy(p, str, len+1); p += len+1; } diff --git a/generic/tclIO.c b/generic/tclIO.c index ab8d8ac..7abeb68 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -4314,7 +4314,7 @@ Write( * that we need to stick at the beginning of this buffer. */ - memcpy(InsertPoint(bufPtr), safe, (size_t) saved); + memcpy(InsertPoint(bufPtr), safe, saved); bufPtr->nextAdded += saved; saved = 0; } @@ -4711,7 +4711,7 @@ Tcl_GetsObj( gs.rawRead -= rawRead; gs.bytesWrote--; gs.charsWrote--; - memmove(dst, dst + 1, (size_t) (dstEnd - dst)); + memmove(dst, dst + 1, dstEnd - dst); dstEnd--; } } @@ -10475,7 +10475,7 @@ Tcl_IsChannelExisting( } if ((*chanName == *name) && - (memcmp(name, chanName, (size_t) chanNameLen + 1) == 0)) { + (memcmp(name, chanName, chanNameLen + 1) == 0)) { return 1; } } diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 7c2c478..e67da14 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -4209,7 +4209,7 @@ TclFSNonnativePathType( if (pathLen < len) { continue; } - if (strncmp(strVol, path, (size_t) len) == 0) { + if (strncmp(strVol, path, len) == 0) { type = TCL_PATH_ABSOLUTE; if (filesystemPtrPtr != NULL) { *filesystemPtrPtr = fsRecPtr->fsPtr; diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 95c68ee..d4cf1a1 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -1813,8 +1813,8 @@ AliasNRCmd( cmdv = &listRep->elements; prefv = &aliasPtr->objPtr; - memcpy(cmdv, prefv, (size_t) (prefc * sizeof(Tcl_Obj *))); - memcpy(cmdv+prefc, objv+1, (size_t) ((objc-1) * sizeof(Tcl_Obj *))); + memcpy(cmdv, prefv, prefc * sizeof(Tcl_Obj *)); + memcpy(cmdv+prefc, objv+1, (objc-1) * sizeof(Tcl_Obj *)); for (i=0; i 0) && (shift != 0)) { Tcl_Obj **src = elemPtrs + start; - memmove(src+shift, src, (size_t) numAfterLast * sizeof(Tcl_Obj*)); + memmove(src+shift, src, numAfterLast * sizeof(Tcl_Obj*)); } } else { /* @@ -1024,7 +1024,7 @@ Tcl_ListObjReplace( */ if (first > 0) { - memcpy(elemPtrs, oldPtrs, (size_t) first * sizeof(Tcl_Obj *)); + memcpy(elemPtrs, oldPtrs, first * sizeof(Tcl_Obj *)); } /* diff --git a/generic/tclObj.c b/generic/tclObj.c index a4df3e7..28fb3da 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -2059,25 +2059,25 @@ ParseBoolean( /* * Checking the 'y' is redundant, but makes the code clearer. */ - if (strncmp(lowerCase, "yes", (size_t) length) == 0) { + if (strncmp(lowerCase, "yes", length) == 0) { newBool = 1; goto goodBoolean; } return TCL_ERROR; case 'n': - if (strncmp(lowerCase, "no", (size_t) length) == 0) { + if (strncmp(lowerCase, "no", length) == 0) { newBool = 0; goto goodBoolean; } return TCL_ERROR; case 't': - if (strncmp(lowerCase, "true", (size_t) length) == 0) { + if (strncmp(lowerCase, "true", length) == 0) { newBool = 1; goto goodBoolean; } return TCL_ERROR; case 'f': - if (strncmp(lowerCase, "false", (size_t) length) == 0) { + if (strncmp(lowerCase, "false", length) == 0) { newBool = 0; goto goodBoolean; } @@ -2086,10 +2086,10 @@ ParseBoolean( if (length < 2) { return TCL_ERROR; } - if (strncmp(lowerCase, "on", (size_t) length) == 0) { + if (strncmp(lowerCase, "on", length) == 0) { newBool = 1; goto goodBoolean; - } else if (strncmp(lowerCase, "off", (size_t) length) == 0) { + } else if (strncmp(lowerCase, "off", length) == 0) { newBool = 0; goto goodBoolean; } diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index c5b1ef6..0f98881 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1745,7 +1745,7 @@ Tcl_FSGetTranslatedStringPath( const char *orig = Tcl_GetStringFromObj(transPtr, &len); char *result = ckalloc(len+1); - memcpy(result, orig, (size_t) len+1); + memcpy(result, orig, len+1); TclDecrRefCount(transPtr); return result; } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 7807083..bab9d5e 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -465,7 +465,7 @@ mp_err mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen) if (maxlen < 0) { return MP_VAL; } - return mp_to_radix(a, str, (size_t)maxlen, NULL, radix); + return mp_to_radix(a, str, maxlen, NULL, radix); } void bn_reverse(unsigned char *s, int len) diff --git a/generic/tclThread.c b/generic/tclThread.c index 8915792..03937de 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -88,13 +88,13 @@ Tcl_GetThreadData( if (result == NULL) { result = ckalloc(size); - memset(result, 0, (size_t) size); + memset(result, 0, size); TclThreadStorageKeySet(keyPtr, result); } #else /* TCL_THREADS */ if (*keyPtr == NULL) { result = ckalloc(size); - memset(result, 0, (size_t)size); + memset(result, 0, size); *keyPtr = result; RememberSyncObject(keyPtr, &keyRecord); } else { diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 35b3fc3..ff18077 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -294,7 +294,7 @@ ThreadObjCmd( script = Tcl_GetStringFromObj(objv[2], &len); if ((len > 1) && (script[0] == '-') && (script[1] == 'j') && - (0 == strncmp(script, "-joinable", (size_t) len))) { + (0 == strncmp(script, "-joinable", len))) { joinable = 1; script = "testthread wait"; /* Just enter event loop */ } else { @@ -311,7 +311,7 @@ ThreadObjCmd( script = Tcl_GetStringFromObj(objv[2], &len); joinable = ((len > 1) && (script[0] == '-') && (script[1] == 'j') - && (0 == strncmp(script, "-joinable", (size_t) len))); + && (0 == strncmp(script, "-joinable", len))); script = Tcl_GetString(objv[3]); } else { Tcl_WrongNumArgs(interp, 2, objv, "?-joinable? ?script?"); diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 882dc39..3178441 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -1689,8 +1689,8 @@ CallTraceFunction( * Copy the command characters into a new string. */ - commandCopy = TclStackAlloc(interp, (unsigned) numChars + 1); - memcpy(commandCopy, command, (size_t) numChars); + commandCopy = TclStackAlloc(interp, numChars + 1); + memcpy(commandCopy, command, numChars); commandCopy[numChars] = '\0'; /* diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c index e462e5e..53b01e0 100644 --- a/macosx/tclMacOSXFCmd.c +++ b/macosx/tclMacOSXFCmd.c @@ -654,7 +654,7 @@ SetOSTypeFromAny( OSType osType; char bytes[4] = {'\0','\0','\0','\0'}; - memcpy(bytes, Tcl_DStringValue(&ds), (size_t)Tcl_DStringLength(&ds)); + memcpy(bytes, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); osType = (OSType) bytes[0] << 24 | (OSType) bytes[1] << 16 | (OSType) bytes[2] << 8 | diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index f70ce6a..35046a5 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -1116,7 +1116,7 @@ TclNativeCreateNativeRep( } Tcl_DecrRefCount(validPathPtr); nativePathPtr = ckalloc(len); - memcpy(nativePathPtr, Tcl_DStringValue(&ds), (size_t) len); + memcpy(nativePathPtr, Tcl_DStringValue(&ds), len); Tcl_DStringFree(&ds); return nativePathPtr; diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index b189fee..0ae0fa7 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -546,8 +546,8 @@ TclpInitLibraryPath( *encodingPtr = Tcl_GetEncoding(NULL, NULL); str = Tcl_GetStringFromObj(pathPtr, lengthPtr); - *valuePtr = (char *)ckalloc((*lengthPtr) + 1); - memcpy(*valuePtr, str, (size_t)(*lengthPtr)+1); + *valuePtr = (char *)ckalloc(*lengthPtr + 1); + memcpy(*valuePtr, str, *lengthPtr + 1); Tcl_DecrRefCount(pathPtr); } diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index ddba078..1a54914 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -277,7 +277,7 @@ InitializeHostName( *encodingPtr = Tcl_GetEncoding(NULL, NULL); *lengthPtr = strlen(native); *valuePtr = ckalloc(*lengthPtr + 1); - memcpy(*valuePtr, native, (size_t)(*lengthPtr) + 1); + memcpy(*valuePtr, native, *lengthPtr + 1); } /* diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 1293ebe..a223a1f 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -672,11 +672,11 @@ ConsoleInputProc( */ if (bufSize < (infoPtr->bytesRead - infoPtr->offset)) { - memcpy(buf, &infoPtr->buffer[infoPtr->offset], (size_t) bufSize); + memcpy(buf, &infoPtr->buffer[infoPtr->offset], bufSize); bytesRead = bufSize; infoPtr->offset += bufSize; } else { - memcpy(buf, &infoPtr->buffer[infoPtr->offset], (size_t) bufSize); + memcpy(buf, &infoPtr->buffer[infoPtr->offset], bufSize); bytesRead = infoPtr->bytesRead - infoPtr->offset; /* @@ -783,7 +783,7 @@ ConsoleOutputProc( infoPtr->writeBufLen = toWrite; infoPtr->writeBuf = ckalloc(toWrite); } - memcpy(infoPtr->writeBuf, buf, (size_t) toWrite); + memcpy(infoPtr->writeBuf, buf, toWrite); infoPtr->toWrite = toWrite; ResetEvent(threadInfo->readyEvent); TclPipeThreadSignal(&threadInfo->TI); diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 357f0a1..a7a98a4 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -337,7 +337,7 @@ DoRenameFile( * character is either end-of-string or a directory separator */ - if ((strncmp(src, dst, (size_t) Tcl_DStringLength(&srcString))==0) + if ((strncmp(src, dst, Tcl_DStringLength(&srcString))==0) && (dst[Tcl_DStringLength(&srcString)] == '\\' || dst[Tcl_DStringLength(&srcString)] == '/' || dst[Tcl_DStringLength(&srcString)] == '\0')) { diff --git a/win/tclWinInit.c b/win/tclWinInit.c index b1dd0f3..b0e08d0 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -229,8 +229,8 @@ TclpInitLibraryPath( *encodingPtr = NULL; bytes = Tcl_GetStringFromObj(pathPtr, lengthPtr); - *valuePtr = (char *)ckalloc((*lengthPtr) + 1); - memcpy(*valuePtr, bytes, (size_t)(*lengthPtr)+1); + *valuePtr = (char *)ckalloc(*lengthPtr + 1); + memcpy(*valuePtr, bytes, *lengthPtr + 1); Tcl_DecrRefCount(pathPtr); } diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 04c371e..098ead4 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -2317,7 +2317,7 @@ PipeOutputProc( infoPtr->writeBufLen = toWrite; infoPtr->writeBuf = ckalloc(toWrite); } - memcpy(infoPtr->writeBuf, buf, (size_t) toWrite); + memcpy(infoPtr->writeBuf, buf, toWrite); infoPtr->toWrite = toWrite; ResetEvent(infoPtr->writable); TclPipeThreadSignal(&infoPtr->writeTI); diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index aeebb56..9023928 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -1038,7 +1038,7 @@ SerialOutputProc( infoPtr->writeBufLen = toWrite; infoPtr->writeBuf = ckalloc(toWrite); } - memcpy(infoPtr->writeBuf, buf, (size_t) toWrite); + memcpy(infoPtr->writeBuf, buf, toWrite); infoPtr->toWrite = toWrite; ResetEvent(infoPtr->evWritable); TclPipeThreadSignal(&infoPtr->writeTI); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index fdb7e12..a05b8f6 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -378,7 +378,7 @@ InitializeHostName( *encodingPtr = Tcl_GetEncoding(NULL, "utf-8"); *lengthPtr = Tcl_DStringLength(&ds); *valuePtr = ckalloc((*lengthPtr) + 1); - memcpy(*valuePtr, Tcl_DStringValue(&ds), (size_t)(*lengthPtr)+1); + memcpy(*valuePtr, Tcl_DStringValue(&ds), *lengthPtr + 1); Tcl_DStringFree(&ds); } -- cgit v0.12