diff options
author | yazoo <yazoo> | 2008-01-29 07:43:06 +0000 |
---|---|---|
committer | yazoo <yazoo> | 2008-01-29 07:43:06 +0000 |
commit | 8522e44467ebcac54201def2c6583639e74e9e24 (patch) | |
tree | 9d475da6b178bf96359f06d39773441b76b8d567 /mpq-bios.c | |
parent | 7ecf94d4b339bc2197f449f0f1538f2915313087 (diff) |
Portage win32
Diffstat (limited to 'mpq-bios.c')
-rw-r--r-- | mpq-bios.c | 39 |
1 files changed, 33 insertions, 6 deletions
@@ -1,5 +1,14 @@ #define _LARGEFILE64_SOURCE + +#ifdef WIN32 +#include <stdio.h> +#include <io.h> +#include <sys/types.h> +#define lseek64 _lseeki64 +#else #include <unistd.h> +#endif + #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -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; } |