From aeb420d9f20f0973d428b5de0bd19f83c684bf54 Mon Sep 17 00:00:00 2001 From: pixel Date: Tue, 29 Jan 2008 10:13:13 +0000 Subject: Smoothing up win32 fixes. --- mpq-bios.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'mpq-bios.c') diff --git a/mpq-bios.c b/mpq-bios.c index 35173d6..d2c96f7 100644 --- a/mpq-bios.c +++ b/mpq-bios.c @@ -1,10 +1,13 @@ #define _LARGEFILE64_SOURCE -#ifdef WIN32 #include +#ifdef WIN32 #include #include #define lseek64 _lseeki64 +#define O_RDONLY _O_RDONLY +#define O_BINARY _O_BINARY +#define O_LARGEFILE 0 #else #include #endif @@ -25,10 +28,9 @@ /* * MPQ header. */ -#ifdef WIN32 +#ifdef _MSC_VER #pragma pack(1) #endif - typedef struct { /* basic version of the header. */ char magic[4]; @@ -47,7 +49,7 @@ typedef struct { uint16_t hash_table_offset_high; uint16_t block_table_offset_high; } -#ifndef WIN32 +#ifndef _MSC_VER __attribute__ ((packed)) #endif mpq_header_t; @@ -63,7 +65,7 @@ typedef struct { uint16_t platform; uint32_t file_block_index; } -#ifndef WIN32 +#ifndef _MSC_VER __attribute__ ((packed)) #endif mpq_hash_t; @@ -78,7 +80,7 @@ typedef struct { uint32_t file_size; uint32_t flags; } -#ifndef WIN32 +#ifndef _MSC_VER __attribute__ ((packed)) #endif mpq_block_t; @@ -104,7 +106,7 @@ typedef struct { } block_t; struct mpq_archive_t { - int fd; + int fd; int closeit; uint32_t header_size; @@ -131,11 +133,7 @@ struct mpq_archive_t * mpqlib_open_archive(const char * fname) { int fd; struct mpq_archive_t * r; -#ifdef WIN32 - if ((fd = open(fname, _O_RDONLY | _O_BINARY)) == -1) { -#else - if ((fd = open(fname, O_RDONLY | O_LARGEFILE | O_BINARY)) == -1) { -#endif + if ((fd = open(fname, O_RDONLY | O_LARGEFILE | O_BINARY)) == -1) { __mpqlib_errno = MPQLIB_ERROR_OPEN; return NULL; } -- cgit v1.2.3