From 8522e44467ebcac54201def2c6583639e74e9e24 Mon Sep 17 00:00:00 2001 From: yazoo Date: Tue, 29 Jan 2008 07:43:06 +0000 Subject: Portage win32 --- mpq-bios.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'mpq-bios.c') diff --git a/mpq-bios.c b/mpq-bios.c index 8251b95..35173d6 100644 --- a/mpq-bios.c +++ b/mpq-bios.c @@ -1,5 +1,14 @@ #define _LARGEFILE64_SOURCE + +#ifdef WIN32 +#include +#include +#include +#define lseek64 _lseeki64 +#else #include +#endif + #include #include #include @@ -12,11 +21,13 @@ #include "mpq-misc.h" #include "int-bios.h" #include "errors.h" -#include "inttypes.h" /* * MPQ header. */ +#ifdef WIN32 +#pragma pack(1) +#endif typedef struct { /* basic version of the header. */ @@ -35,7 +46,11 @@ typedef struct { uint64_t extended_block_table_offset; uint16_t hash_table_offset_high; uint16_t block_table_offset_high; -} __attribute__ ((packed)) mpq_header_t; +} +#ifndef WIN32 +__attribute__ ((packed)) +#endif +mpq_header_t; /* * One hash entry. @@ -47,7 +62,11 @@ typedef struct { uint16_t language; uint16_t platform; uint32_t file_block_index; -} __attribute__ ((packed)) mpq_hash_t; +} +#ifndef WIN32 +__attribute__ ((packed)) +#endif +mpq_hash_t; /* * One block entry. @@ -58,7 +77,11 @@ typedef struct { uint32_t block_size; uint32_t file_size; uint32_t flags; -} __attribute__ ((packed)) mpq_block_t; +} +#ifndef WIN32 +__attribute__ ((packed)) +#endif +mpq_block_t; /* @@ -81,7 +104,7 @@ typedef struct { } block_t; struct mpq_archive_t { - int fd; + int fd; int closeit; uint32_t header_size; @@ -108,7 +131,11 @@ struct mpq_archive_t * mpqlib_open_archive(const char * fname) { int fd; struct mpq_archive_t * r; - if ((fd = open(fname, O_RDONLY | O_LARGEFILE | O_BINARY)) == -1) { +#ifdef WIN32 + if ((fd = open(fname, _O_RDONLY | _O_BINARY)) == -1) { +#else + if ((fd = open(fname, O_RDONLY | O_LARGEFILE | O_BINARY)) == -1) { +#endif __mpqlib_errno = MPQLIB_ERROR_OPEN; return NULL; } -- cgit v1.2.3