diff options
author | pixel <pixel> | 2008-01-29 10:13:13 +0000 |
---|---|---|
committer | pixel <pixel> | 2008-01-29 10:13:13 +0000 |
commit | aeb420d9f20f0973d428b5de0bd19f83c684bf54 (patch) | |
tree | bf9119050b3510bb12fc77fcfc5ed59ab6ab900b /mpq-bios.c | |
parent | 6d8020e380791e063a70b3802fed2b72de7dcdec (diff) |
Smoothing up win32 fixes.
Diffstat (limited to 'mpq-bios.c')
-rw-r--r-- | mpq-bios.c | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -1,10 +1,13 @@ #define _LARGEFILE64_SOURCE -#ifdef WIN32 #include <stdio.h> +#ifdef WIN32 #include <io.h> #include <sys/types.h> #define lseek64 _lseeki64 +#define O_RDONLY _O_RDONLY +#define O_BINARY _O_BINARY +#define O_LARGEFILE 0 #else #include <unistd.h> #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; } |