summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-04-17 14:49:53 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-04-17 14:49:53 (GMT)
commit7ab521d768effeec66e8d06abf0067ce0652a57f (patch)
treed38a0997ec4141e501a5f19512dfe1445d8c4404
parent3943396d1d7a64194d6babf11bbf7db8ab76be16 (diff)
downloadtcl-7ab521d768effeec66e8d06abf0067ce0652a57f.zip
tcl-7ab521d768effeec66e8d06abf0067ce0652a57f.tar.gz
tcl-7ab521d768effeec66e8d06abf0067ce0652a57f.tar.bz2
Eliminate use of (VOID*) casts when calling memset or memcpy.
-rw-r--r--generic/tclAlloc.c4
-rw-r--r--generic/tclCompExpr.c6
-rw-r--r--generic/tclEncoding.c16
-rw-r--r--generic/tclFileName.c4
-rw-r--r--generic/tclHash.c23
-rw-r--r--generic/tclIOGT.c11
-rw-r--r--generic/tclPathObj.c6
-rw-r--r--unix/tclUnixInit.c4
-rw-r--r--unix/tclUnixTest.c6
-rw-r--r--unix/tclUnixTime.c8
-rw-r--r--win/tclWinFile.c6
-rw-r--r--win/tclWinInit.c8
12 files changed, 50 insertions, 52 deletions
diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c
index b51084d..df6db05 100644
--- a/generic/tclAlloc.c
+++ b/generic/tclAlloc.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclAlloc.c,v 1.23 2005/11/01 15:30:52 dkf Exp $
+ * RCS: @(#) $Id: tclAlloc.c,v 1.24 2007/04/17 14:49:53 dkf Exp $
*/
/*
@@ -615,7 +615,7 @@ TclpRealloc(
if (maxSize < numBytes) {
numBytes = maxSize;
}
- memcpy((VOID *) newPtr, (VOID *) oldPtr, (size_t) numBytes);
+ memcpy(newPtr, oldPtr, (size_t) numBytes);
TclpFree(oldPtr);
return newPtr;
}
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 0043b65..e5cddb3 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompExpr.c,v 1.49 2007/04/10 14:47:10 dkf Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.50 2007/04/17 14:49:53 dkf Exp $
*/
#include "tclInt.h"
@@ -1858,7 +1858,7 @@ GenerateTokens(
destPtr->type = TCL_TOKEN_WORD;
destPtr->numComponents = toCopy;
destPtr++;
- memcpy((VOID *) destPtr, (VOID *) sourcePtr,
+ memcpy(destPtr, sourcePtr,
(size_t) (toCopy * sizeof(Tcl_Token)));
parsePtr->numTokens += toCopy + 2;
break;
@@ -1876,7 +1876,7 @@ GenerateTokens(
TclExpandTokenArray(parsePtr);
}
destPtr = parsePtr->tokenPtr + parsePtr->numTokens;
- memcpy((VOID *) destPtr, (VOID *) sourcePtr,
+ memcpy(destPtr, sourcePtr,
(size_t) (toCopy * sizeof(Tcl_Token)));
parsePtr->numTokens += toCopy;
break;
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 120bf59..d0465aa 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEncoding.c,v 1.54 2007/04/10 22:14:30 dkf Exp $
+ * RCS: @(#) $Id: tclEncoding.c,v 1.55 2007/04/17 14:49:53 dkf Exp $
*/
#include "tclInt.h"
@@ -1948,7 +1948,7 @@ LoadEscapeEncoding(
strcpy(dataPtr->final, final);
dataPtr->numSubTables =
Tcl_DStringLength(&escapeData) / sizeof(EscapeSubTable);
- memcpy((VOID *) dataPtr->subTables, (VOID *) Tcl_DStringValue(&escapeData),
+ memcpy(dataPtr->subTables, Tcl_DStringValue(&escapeData),
(size_t) Tcl_DStringLength(&escapeData));
Tcl_DStringFree(&escapeData);
@@ -2986,7 +2986,7 @@ EscapeFromUtfProc(
*dstWrotePtr = 0;
return TCL_CONVERT_NOSPACE;
}
- memcpy((VOID *)dst, (VOID *)dataPtr->init, (size_t)dataPtr->initLen);
+ memcpy(dst, dataPtr->init, (size_t)dataPtr->initLen);
dst += dataPtr->initLen;
} else {
state = PTR2INT(*statePtr);
@@ -3062,7 +3062,7 @@ EscapeFromUtfProc(
result = TCL_CONVERT_NOSPACE;
break;
}
- memcpy((VOID *) dst, (VOID *) subTablePtr->sequence,
+ memcpy(dst, subTablePtr->sequence,
(size_t) subTablePtr->sequenceLen);
dst += subTablePtr->sequenceLen;
}
@@ -3103,12 +3103,10 @@ EscapeFromUtfProc(
result = TCL_CONVERT_NOSPACE;
} else {
if (state) {
- memcpy((VOID *) dst, (VOID *) dataPtr->subTables[0].sequence,
- (size_t) len);
+ memcpy(dst, dataPtr->subTables[0].sequence, (size_t) len);
dst += len;
}
- memcpy((VOID *) dst, (VOID *) dataPtr->final,
- (size_t) dataPtr->finalLen);
+ memcpy(dst, dataPtr->final, (size_t) dataPtr->finalLen);
dst += dataPtr->finalLen;
state &= ~TCL_ENCODING_END;
}
@@ -3297,7 +3295,7 @@ InitializeEncodingSearchPath(
*lengthPtr = numBytes;
*valuePtr = ckalloc((unsigned int) numBytes + 1);
- memcpy((VOID *) *valuePtr, (VOID *) bytes, (size_t) numBytes + 1);
+ memcpy(*valuePtr, bytes, (size_t) numBytes + 1);
Tcl_DecrRefCount(searchPath);
}
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 4de4604..6d574aa 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclFileName.c,v 1.81 2007/04/10 22:01:57 dkf Exp $
+ * RCS: @(#) $Id: tclFileName.c,v 1.82 2007/04/17 14:49:53 dkf Exp $
*/
#include "tclInt.h"
@@ -580,7 +580,7 @@ Tcl_SplitPath(
for (i = 0; i < *argcPtr; i++) {
Tcl_ListObjIndex(NULL, resultPtr, i, &eltPtr);
str = Tcl_GetStringFromObj(eltPtr, &len);
- memcpy((VOID *) p, (VOID *) str, (size_t) len+1);
+ memcpy(p, str, (size_t) len+1);
p += len+1;
}
diff --git a/generic/tclHash.c b/generic/tclHash.c
index 542e89c..8be7d1f 100644
--- a/generic/tclHash.c
+++ b/generic/tclHash.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclHash.c,v 1.28 2007/02/20 23:24:04 nijtmans Exp $
+ * RCS: @(#) $Id: tclHash.c,v 1.29 2007/04/17 14:49:53 dkf Exp $
*/
#include "tclInt.h"
@@ -322,7 +322,7 @@ Tcl_CreateHashEntry(
#endif
if (typePtr->hashKeyProc) {
- hash = typePtr->hashKeyProc (tablePtr, (VOID *) key);
+ hash = typePtr->hashKeyProc(tablePtr, (VOID *) key);
if (typePtr->flags & TCL_HASH_KEY_RANDOMIZE_HASH) {
index = RANDOM_INDEX (tablePtr, hash);
} else {
@@ -346,9 +346,10 @@ Tcl_CreateHashEntry(
continue;
}
#endif
- if (compareKeysProc ((VOID *) key, hPtr)) {
- if (newPtr)
+ if (compareKeysProc((VOID *) key, hPtr)) {
+ if (newPtr) {
*newPtr = 0;
+ }
return hPtr;
}
}
@@ -361,16 +362,17 @@ Tcl_CreateHashEntry(
}
#endif
if (key == hPtr->key.oneWordValue) {
- if (newPtr)
+ if (newPtr) {
*newPtr = 0;
+ }
return hPtr;
}
}
}
- if (!newPtr)
+ if (!newPtr) {
return NULL;
-
+ }
/*
* Entry not found. Add a new one to the bucket.
@@ -378,7 +380,7 @@ Tcl_CreateHashEntry(
*newPtr = 1;
if (typePtr->allocEntryProc) {
- hPtr = typePtr->allocEntryProc (tablePtr, (VOID *) key);
+ hPtr = typePtr->allocEntryProc(tablePtr, (VOID *) key);
} else {
hPtr = (Tcl_HashEntry *) ckalloc((unsigned) sizeof(Tcl_HashEntry));
hPtr->key.oneWordValue = (char *) key;
@@ -1132,11 +1134,12 @@ RebuildTable(
hPtr->nextPtr = tablePtr->buckets[index];
tablePtr->buckets[index] = hPtr;
#else
- VOID *key = (VOID *) Tcl_GetHashKey (tablePtr, hPtr);
+ VOID *key = (VOID *) Tcl_GetHashKey(tablePtr, hPtr);
if (typePtr->hashKeyProc) {
unsigned int hash;
- hash = typePtr->hashKeyProc (tablePtr, (VOID *) key);
+
+ hash = typePtr->hashKeyProc(tablePtr, (VOID *) key);
if (typePtr->flags & TCL_HASH_KEY_RANDOMIZE_HASH) {
index = RANDOM_INDEX (tablePtr, hash);
} else {
diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c
index 901ced5..2460e4a 100644
--- a/generic/tclIOGT.c
+++ b/generic/tclIOGT.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * CVS: $Id: tclIOGT.c,v 1.16 2006/08/30 17:59:03 hobbs Exp $
+ * CVS: $Id: tclIOGT.c,v 1.17 2007/04/17 14:49:53 dkf Exp $
*/
#include "tclInt.h"
@@ -1344,7 +1344,7 @@ ResultCopy(
* We have just enough. Copy everything to the caller.
*/
- memcpy((VOID *) buf, (VOID *) r->buf, (size_t) toRead);
+ memcpy(buf, r->buf, (size_t) toRead);
r->used = 0;
return toRead;
}
@@ -1355,9 +1355,8 @@ ResultCopy(
* requested subset to the caller, and shift the remaining bytes down.
*/
- memcpy((VOID *) buf, (VOID *) r->buf, (size_t) toRead);
- memmove((VOID *) r->buf, (VOID *) (r->buf + toRead),
- (size_t) r->used - toRead);
+ memcpy(buf, r->buf, (size_t) toRead);
+ memmove(r->buf, r->buf + toRead, (size_t) r->used - toRead);
r->used -= toRead;
return toRead;
@@ -1368,7 +1367,7 @@ ResultCopy(
* everything.
*/
- memcpy((VOID *) buf, (VOID *) r->buf, (size_t) r->used);
+ memcpy(buf, r->buf, (size_t) r->used);
toRead = r->used;
r->used = 0;
return toRead;
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index e49141f..35a6e37 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPathObj.c,v 1.59 2007/04/10 14:47:17 dkf Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.60 2007/04/17 14:49:53 dkf Exp $
*/
#include "tclInt.h"
@@ -1651,8 +1651,8 @@ Tcl_FSGetTranslatedStringPath(
const char *result, *orig;
orig = Tcl_GetStringFromObj(transPtr, &len);
- result = (char*) ckalloc((unsigned)(len+1));
- memcpy((VOID*) result, (VOID*) orig, (size_t) (len+1));
+ result = (char *) ckalloc((unsigned)(len+1));
+ memcpy(result, orig, (size_t) (len+1));
TclDecrRefCount(transPtr);
return result;
}
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 3568bd6..854624f 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclUnixInit.c,v 1.68 2007/02/08 23:11:21 hobbs Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.69 2007/04/17 14:49:53 dkf Exp $
*/
#include "tclInt.h"
@@ -560,7 +560,7 @@ TclpInitLibraryPath(
*encodingPtr = Tcl_GetEncoding(NULL, NULL);
str = Tcl_GetStringFromObj(pathPtr, lengthPtr);
*valuePtr = ckalloc((unsigned int) (*lengthPtr)+1);
- memcpy((VOID *) *valuePtr, (VOID *) str, (size_t)(*lengthPtr)+1);
+ memcpy(*valuePtr, str, (size_t)(*lengthPtr)+1);
Tcl_DecrRefCount(pathPtr);
}
diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c
index eb339aa..acfa5fc 100644
--- a/unix/tclUnixTest.c
+++ b/unix/tclUnixTest.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixTest.c,v 1.24 2007/04/16 13:36:36 dkf Exp $
+ * RCS: @(#) $Id: tclUnixTest.c,v 1.25 2007/04/17 14:49:53 dkf Exp $
*/
#include "tclInt.h"
@@ -275,7 +275,7 @@ TestfilehandlerCmd(
return TCL_ERROR;
}
- memset((VOID *) buffer, 'a', 4000);
+ memset(buffer, 'a', 4000);
while (write(GetFd(pipePtr->writeFile), buffer, 4000) > 0) {
/* Empty loop body. */
}
@@ -288,7 +288,7 @@ TestfilehandlerCmd(
return TCL_ERROR;
}
- memset((VOID *) buffer, 'b', 10);
+ memset(buffer, 'b', 10);
TclFormatInt(buf, write(GetFd(pipePtr->writeFile), buffer, 10));
Tcl_SetResult(interp, buf, TCL_VOLATILE);
} else if (strcmp(argv[1], "oneevent") == 0) {
diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c
index 660a831..d4f2067 100644
--- a/unix/tclUnixTime.c
+++ b/unix/tclUnixTime.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixTime.c,v 1.29 2007/04/16 13:36:36 dkf Exp $
+ * RCS: @(#) $Id: tclUnixTime.c,v 1.30 2007/04/17 14:49:53 dkf Exp $
*/
#include "tclInt.h"
@@ -428,8 +428,7 @@ TclpGmtime(
gmtime_r(timePtr, &(tsdPtr->gmtime_buf));
#else
Tcl_MutexLock(&tmMutex);
- memcpy((VOID *) &(tsdPtr->gmtime_buf), (VOID *) gmtime(timePtr),
- sizeof(struct tm));
+ memcpy(&(tsdPtr->gmtime_buf), gmtime(timePtr), sizeof(struct tm));
Tcl_MutexUnlock(&tmMutex);
#endif
@@ -480,8 +479,7 @@ TclpLocaltime(
localtime_r(timePtr, &(tsdPtr->localtime_buf));
#else
Tcl_MutexLock(&tmMutex);
- memcpy((VOID *) &(tsdPtr->localtime_buf), (VOID *) localtime(timePtr),
- sizeof(struct tm));
+ memcpy(&(tsdPtr->localtime_buf), localtime(timePtr), sizeof(struct tm));
Tcl_MutexUnlock(&tmMutex);
#endif
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 4139dac..42e3ff8 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinFile.c,v 1.91 2007/02/20 15:36:47 patthoyts Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.92 2007/04/17 14:49:53 dkf Exp $
*/
/* #define _WIN32_WINNT 0x0500 */
@@ -3292,7 +3292,7 @@ TclNativeCreateNativeRep(
}
Tcl_DecrRefCount(validPathPtr);
nativePathPtr = ckalloc((unsigned) len);
- memcpy((VOID*)nativePathPtr, (VOID*)Tcl_DStringValue(&ds), (size_t) len);
+ memcpy(nativePathPtr, Tcl_DStringValue(&ds), (size_t) len);
Tcl_DStringFree(&ds);
return (ClientData)nativePathPtr;
@@ -3341,7 +3341,7 @@ TclNativeDupInternalRep(
}
copy = (char *) ckalloc(len);
- memcpy((VOID *) copy, (VOID *) clientData, len);
+ memcpy(copy, clientData, len);
return (ClientData) copy;
}
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index 93785b7..7824ebf 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinInit.c,v 1.71 2006/04/05 17:25:27 vincentdarley Exp $
+ * RCS: @(#) $Id: tclWinInit.c,v 1.72 2007/04/17 14:49:54 dkf Exp $
*/
#include "tclWinInt.h"
@@ -211,7 +211,7 @@ TclpInitLibraryPath(
*encodingPtr = NULL;
bytes = Tcl_GetStringFromObj(pathPtr, lengthPtr);
*valuePtr = ckalloc((unsigned int)(*lengthPtr)+1);
- memcpy((VOID *) *valuePtr, (VOID *) bytes, (size_t)(*lengthPtr)+1);
+ memcpy(*valuePtr, bytes, (size_t)(*lengthPtr)+1);
Tcl_DecrRefCount(pathPtr);
}
@@ -359,7 +359,7 @@ InitializeDefaultLibraryDir(
*lengthPtr = strlen(name);
*valuePtr = ckalloc((unsigned int) *lengthPtr + 1);
*encodingPtr = NULL;
- memcpy((VOID *) *valuePtr, (VOID *) name, (size_t) *lengthPtr + 1);
+ memcpy(*valuePtr, name, (size_t) *lengthPtr + 1);
}
/*
@@ -626,7 +626,7 @@ TclpFindVariable(
length = strlen(name);
nameUpper = (char *) ckalloc((unsigned) length+1);
- memcpy((VOID *) nameUpper, (VOID *) name, (size_t) length+1);
+ memcpy(nameUpper, name, (size_t) length+1);
Tcl_UtfToUpper(nameUpper);
Tcl_DStringInit(&envString);