- Changed the types of object hash indices in FArchive from size_t to DWORD.

This seems to fix crashes on GCC 64-bit builds when saving games. Not sure
  if it was a GCC bug or my bug, since it worked fine with VC++, but since the
  code that calculates the index only returns a DWORD, storing it as a size_t
  was rather pointless.



SVN r969 (trunk)
This commit is contained in:
Randy Heit 2008-05-14 03:54:04 +00:00
parent a0d5463b49
commit c4cbef9e58
3 changed files with 9 additions and 4 deletions

View file

@ -1,4 +1,9 @@
May 13, 2008 May 13, 2008
- Changed the types of object hash indices in FArchive from size_t to DWORD.
This seems to fix crashes on GCC 64-bit builds when saving games. Not sure
if it was a GCC bug or my bug, since it worked fine with VC++, but since the
code that calculates the index only returns a DWORD, storing it as a size_t
was rather pointless.
- Added the C99 printf size specifiers 't' (ptrdiff_t) and 'z' (size_t) to - Added the C99 printf size specifiers 't' (ptrdiff_t) and 'z' (size_t) to
FString::Format() so that I can fix all the problem printf strings that a FString::Format() so that I can fix all the problem printf strings that a
64-bit GCC compile finds. 64-bit GCC compile finds.

View file

@ -1459,12 +1459,12 @@ DWORD FArchive::HashObject (const DObject *obj) const
DWORD FArchive::FindObjectIndex (const DObject *obj) const DWORD FArchive::FindObjectIndex (const DObject *obj) const
{ {
size_t index = m_ObjectHash[HashObject (obj)]; DWORD index = m_ObjectHash[HashObject (obj)];
while (index != TypeMap::NO_INDEX && m_ObjectMap[index].object != obj) while (index != TypeMap::NO_INDEX && m_ObjectMap[index].object != obj)
{ {
index = m_ObjectMap[index].hashNext; index = m_ObjectMap[index].hashNext;
} }
return (DWORD)index; return index;
} }
void FArchive::UserWriteClass (const PClass *type) void FArchive::UserWriteClass (const PClass *type)

View file

@ -237,9 +237,9 @@ protected:
struct ObjectMap struct ObjectMap
{ {
const DObject *object; const DObject *object;
size_t hashNext; DWORD hashNext;
} *m_ObjectMap; } *m_ObjectMap;
size_t m_ObjectHash[EObjectHashSize]; DWORD m_ObjectHash[EObjectHashSize];
struct NameMap struct NameMap
{ {