Commit b8b498f2e27e480407bc1811473c23d68e94367f

suzuki toshiya 2010-10-25T00:35:59

Change the type of FT_MEM_VAL() from FT_ULong to FT_PtrDist. On LLP64 platforms (e.g. Win64), unsigned long (32-bit) cannot cover the memory address (64-bit). FT_MEM_VAL() is used for hashing only and not dereferred, so using signed type FT_PtrDist is safe. * src/base/ftdbgmem.c (FT_MEM_VAL): Change the type of the return value from FT_ULong to FT_PtrDist. (ft_mem_table_resize): The type of hash is changed to FT_PtrDist. (ft_mem_table_get_nodep): Ditto.

diff --git a/ChangeLog b/ChangeLog
index c243a0e..437108d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2010-10-24  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
 
+	Change the type of FT_MEM_VAL() from FT_ULong to FT_PtrDist.
+
+	On LLP64 platforms (e.g. Win64), unsigned long (32-bit)
+	cannot cover the memory address (64-bit).  FT_MEM_VAL() is
+	used for hashing only and not dereferred, so using signed
+	type FT_PtrDist is safe.
+
+	* src/base/ftdbgmem.c (FT_MEM_VAL): Change the type of the
+	return value from FT_ULong to FT_PtrDist.
+	(ft_mem_table_resize): The type of hash is changed to
+	FT_PtrDist.  (ft_mem_table_get_nodep): Ditto.
+
+2010-10-24  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
 	Replace "%lx" for memory address by "%p", LLP64 platforms.
 
 	On LLP64 platforms (e.g. Win64), long (32-bit) cannot cover
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 160269d..12fed04 100644
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -47,7 +47,7 @@
   typedef struct FT_MemTableRec_*   FT_MemTable;
 
 
-#define FT_MEM_VAL( addr )  ((FT_ULong)(FT_Pointer)( addr ))
+#define FT_MEM_VAL( addr )  ((FT_PtrDist)(FT_Pointer)( addr ))
 
   /*
    *  This structure holds statistics for a single allocation/release
@@ -275,7 +275,7 @@
       for ( i = 0; i < table->size; i++ )
       {
         FT_MemNode  node, next, *pnode;
-        FT_ULong    hash;
+        FT_PtrDist  hash;
 
 
         node = table->buckets[i];
@@ -430,7 +430,7 @@
   ft_mem_table_get_nodep( FT_MemTable  table,
                           FT_Byte*     address )
   {
-    FT_ULong     hash;
+    FT_PtrDist   hash;
     FT_MemNode  *pnode, node;