diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 4deda5e7a..012774741 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,9 @@ 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 FString::Format() so that I can fix all the problem printf strings that a 64-bit GCC compile finds. diff --git a/src/farchive.cpp b/src/farchive.cpp index 629f703fa..cbf2cd358 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -1459,12 +1459,12 @@ DWORD FArchive::HashObject (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) { index = m_ObjectMap[index].hashNext; } - return (DWORD)index; + return index; } void FArchive::UserWriteClass (const PClass *type) diff --git a/src/farchive.h b/src/farchive.h index 6d751d9e8..fdb60d41b 100644 --- a/src/farchive.h +++ b/src/farchive.h @@ -237,9 +237,9 @@ protected: struct ObjectMap { const DObject *object; - size_t hashNext; + DWORD hashNext; } *m_ObjectMap; - size_t m_ObjectHash[EObjectHashSize]; + DWORD m_ObjectHash[EObjectHashSize]; struct NameMap {