From b5d086ac02c3a8d4de583a10c034340c98626ce1 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sat, 9 Apr 2011 22:54:45 +0400 Subject: [PATCH] Fix memory access on 32-bit linux. The reason for random read failures is that these defines are only effective if they are placed before any system headers, especially sys/types.h; in the old version they didn't work, and pread was expecting a signed 32-bit offset. --- library/private/Internal.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/library/private/Internal.h b/library/private/Internal.h index 59e4792b9..a58e9fd71 100644 --- a/library/private/Internal.h +++ b/library/private/Internal.h @@ -34,6 +34,11 @@ distribution. #define _QUOTEME(x) #x #define QUOT(x) _QUOTEME(x) +#ifdef LINUX_BUILD + #define __USE_FILE_OFFSET64 + #define _FILE_OFFSET_BITS 64 +#endif + // one file for globals #include "dfhack/DFGlobal.h" @@ -60,8 +65,6 @@ using namespace std; #include #include #include - #define __USE_FILE_OFFSET64 - #define _FILE_OFFSET_BITS 64 #include #include #include