diff --git a/libmpq/explode.h b/libmpq/explode.h index 2724e02..7cd321f 100644 --- a/libmpq/explode.h +++ b/libmpq/explode.h @@ -36,7 +36,14 @@ #define LIBMPQ_PKZIP_CMP_BAD_DATA 3 #define LIBMPQ_PKZIP_CMP_ABORT 4 -#include "pack_begin.h" +#ifdef _MSC_VER +#pragma pack(push,1) +#define PACK_STRUCT +#else +/* we assume GNU here */ +#define PACK_STRUCT __attribute__((packed)) +#endif + /* compression structure. */ typedef struct { uint32_t offs0000; /* 0000 - start. */ @@ -66,7 +73,11 @@ typedef struct { uint8_t clen_bits[0x10]; /* 3104 - number of valid bits for copied block. */ uint16_t len_base[0x10]; /* 3114 - buffer. */ } PACK_STRUCT pkzip_cmp_s; -#include "pack_end.h" + +#ifdef _MSC_VER +#pragma pack(pop) +#endif +#undef PACK_STRUCT /* data structure. */ typedef struct { diff --git a/libmpq/mpq-internal.h b/libmpq/mpq-internal.h index 26d25db..13c6430 100644 --- a/libmpq/mpq-internal.h +++ b/libmpq/mpq-internal.h @@ -64,7 +64,14 @@ #define TRUE 1 #endif -#include "pack_begin.h" +#ifdef _MSC_VER +#pragma pack(push,1) +#define PACK_STRUCT +#else +/* we assume GNU here */ +#define PACK_STRUCT __attribute__((packed)) +#endif + /* mpq archive header. */ typedef struct { uint32_t mpq_magic; /* the 0x1A51504D ('MPQ\x1A') signature. */ @@ -119,7 +126,11 @@ typedef struct { uint32_t block_table_indices; /* real mapping for file number to block entry. */ uint32_t block_table_diff; /* block table difference between valid blocks and invalid blocks before. */ } PACK_STRUCT mpq_map_s; -#include "pack_end.h" + +#ifdef _MSC_VER +#pragma pack(pop) +#endif +#undef PACK_STRUCT /* archive structure used since diablo 1.00 by blizzard. */ struct mpq_archive { diff --git a/libmpq/pack_begin.h b/libmpq/pack_begin.h deleted file mode 100644 index eff141c..0000000 --- a/libmpq/pack_begin.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * pack_begin.h -- header file for struct packing used by libmpq. - * - * Copyright (c) 2010-2011 Georg Lukas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef _PACK_BEGIN -#define _PACK_BEGIN -#else -#error "pack_begin.h may not be included twice!" -#endif - -#ifdef _MSC_VER - #pragma pack(push,1) - #define PACK_STRUCT -#else - /* we assume GNU here */ - #define PACK_STRUCT __attribute__((packed)) -#endif - diff --git a/libmpq/pack_end.h b/libmpq/pack_end.h deleted file mode 100644 index 60b1b1d..0000000 --- a/libmpq/pack_end.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * pack_end.h -- header file for struct packing used by libmpq. - * - * Copyright (c) 2010-2011 Georg Lukas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef _PACK_BEGIN -#undef _PACK_BEGIN -#else -#error "pack_begin.h must be includede before pack_end.h" -#endif - -#ifdef _MSC_VER - #pragma pack(pop) -#endif - -#undef PACK_STRUCT