summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2011-03-16 15:51:23 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2011-03-16 15:51:23 (GMT)
commitdee2f1612dea8ead0ec7def7896d5721d6681035 (patch)
tree119dfe299caa274250c7187e003326188cc5fe75
parent27d8d9d7d60c59f0ce188d11be7e0bd5c741f8f5 (diff)
downloadtcl-dee2f1612dea8ead0ec7def7896d5721d6681035.zip
tcl-dee2f1612dea8ead0ec7def7896d5721d6681035.tar.gz
tcl-dee2f1612dea8ead0ec7def7896d5721d6681035.tar.bz2
[Bug #3197864] pointer truncation on Win64 TCL_MEM_DEBUG builds
-rw-r--r--ChangeLog2
-rw-r--r--generic/tclCkalloc.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index f2859bc..c6554dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
Add /usr/lib64 to set of auto-search dirs. [Bug 1230554]
(SC_PATH_X): Correct syntax error when xincludes not found.
Backported from Tcl 8.5
+ * generic/tclCkalloc.c: [Bug #3197864] pointer truncation on Win64
+ TCL_MEM_DEBUG builds
2010-03-11 Jan Nijtmans <nijtmans@users.sf.net>
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c
index 07fdf4c..e81eaea 100644
--- a/generic/tclCkalloc.c
+++ b/generic/tclCkalloc.c
@@ -82,7 +82,7 @@ static struct mem_header *allocHead = NULL; /* List of allocated structures */
*/
#define BODY_OFFSET \
- ((unsigned long) (&((struct mem_header *) 0)->body))
+ ((size_t) (&((struct mem_header *) 0)->body))
static int total_mallocs = 0;
static int total_frees = 0;
@@ -577,7 +577,7 @@ Tcl_DbCkfree(ptr, file, line)
* even though BODY_OFFSET is in words on these machines).
*/
- memp = (struct mem_header *) (((unsigned long) ptr) - BODY_OFFSET);
+ memp = (struct mem_header *) (((size_t) ptr) - BODY_OFFSET);
if (alloc_tracing) {
fprintf(stderr, "ckfree %lx %ld %s %d\n",
@@ -652,7 +652,7 @@ Tcl_DbCkrealloc(ptr, size, file, line)
* line.
*/
- memp = (struct mem_header *) (((unsigned long) ptr) - BODY_OFFSET);
+ memp = (struct mem_header *) (((size_t) ptr) - BODY_OFFSET);
copySize = size;
if (copySize > (unsigned int) memp->length) {
@@ -684,7 +684,7 @@ Tcl_AttemptDbCkrealloc(ptr, size, file, line)
* line.
*/
- memp = (struct mem_header *) (((unsigned long) ptr) - BODY_OFFSET);
+ memp = (struct mem_header *) (((size_t) ptr) - BODY_OFFSET);
copySize = size;
if (copySize > (unsigned int) memp->length) {