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.
This commit is contained in:
suzuki toshiya 2010-10-25 00:35:59 +09:00
parent 46c371c2c7
commit b8b498f2e2
2 changed files with 17 additions and 3 deletions

View File

@ -1,3 +1,17 @@
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.

View File

@ -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;