aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTartalo <none@none>2010-06-09 15:14:20 +0200
committerTartalo <none@none>2010-06-09 15:14:20 +0200
commit062d2835dd7cbbd6264bf4182ea2663c370e02fe (patch)
tree0e5ba7351441c25cabcdcdafa6448540bd826b9a
parent078a73692a88e6b87e2b930a47237da3631a0f51 (diff)
parentc644d2f4c22d287d39c1acdf365b7d7d19c04e4c (diff)
Branch merge
--HG-- branch : trunk
-rw-r--r--externals/libmpq/bindings/d/mpq.d2
-rw-r--r--externals/libmpq/libmpq/common.c4
-rw-r--r--externals/libmpq/libmpq/explode.h13
-rw-r--r--externals/libmpq/libmpq/mpq-internal.h14
-rw-r--r--externals/libmpq/libmpq/mpq.c8
-rw-r--r--externals/libmpq/libmpq/pack_begin.h34
-rw-r--r--externals/libmpq/libmpq/pack_end.h31
-rw-r--r--externals/libmpq/libmpq/platform.h28
8 files changed, 102 insertions, 32 deletions
diff --git a/externals/libmpq/bindings/d/mpq.d b/externals/libmpq/bindings/d/mpq.d
index aa35d136990..d72c2d2a986 100644
--- a/externals/libmpq/bindings/d/mpq.d
+++ b/externals/libmpq/bindings/d/mpq.d
@@ -48,7 +48,7 @@ const LIBMPQ_ERROR_DECRYPT = -11; /* we don't know the decryption seed. */
const LIBMPQ_ERROR_UNPACK = -12; /* error on unpacking file. */
/** libmpq internal meta-data for an archive */
-struct mpq_archive_s;
+extern struct mpq_archive_s;
extern(C) {
diff --git a/externals/libmpq/libmpq/common.c b/externals/libmpq/libmpq/common.c
index 91b259f5515..346afe0181c 100644
--- a/externals/libmpq/libmpq/common.c
+++ b/externals/libmpq/libmpq/common.c
@@ -20,12 +20,10 @@
/* generic includes. */
#include <ctype.h>
+#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
-#if HAVE_UNISTD_H
- #include <unistd.h>
-#endif
/* libmpq main includes. */
#include "mpq.h"
diff --git a/externals/libmpq/libmpq/explode.h b/externals/libmpq/libmpq/explode.h
index 84bbde77bee..1d14dfc0e0a 100644
--- a/externals/libmpq/libmpq/explode.h
+++ b/externals/libmpq/libmpq/explode.h
@@ -36,10 +36,7 @@
#define LIBMPQ_PKZIP_CMP_BAD_DATA 3
#define LIBMPQ_PKZIP_CMP_ABORT 4
-#ifdef _MSC_VER
-#pragma pack(push,1)
-#endif
-
+#include "pack_begin.h"
/* compression structure. */
typedef struct {
uint32_t offs0000; /* 0000 - start. */
@@ -68,12 +65,8 @@ typedef struct {
uint8_t slen_bits[0x10]; /* 30F4 - numbers of bits for skip copied block length. */
uint8_t clen_bits[0x10]; /* 3104 - number of valid bits for copied block. */
uint16_t len_base[0x10]; /* 3114 - buffer. */
-#ifdef _MSC_VER
-} pkzip_cmp_s;
-#pragma pack(pop)
-#else
-} __attribute__ ((packed)) pkzip_cmp_s;
-#endif
+} PACK_STRUCT pkzip_cmp_s;
+#include "pack_end.h"
/* data structure. */
typedef struct {
diff --git a/externals/libmpq/libmpq/mpq-internal.h b/externals/libmpq/libmpq/mpq-internal.h
index eddcb7e89ae..bfa9d25c945 100644
--- a/externals/libmpq/libmpq/mpq-internal.h
+++ b/externals/libmpq/libmpq/mpq-internal.h
@@ -62,13 +62,7 @@
#define TRUE 1
#endif
-#ifdef _MSC_VER
- #pragma pack(push,1)
- #define PACK_STRUCT
-#else
- #define PACK_STRUCT __attribute__((packed))
-#endif
-
+#include "pack_begin.h"
/* mpq archive header. */
typedef struct {
uint32_t mpq_magic; /* the 0x1A51504D ('MPQ\x1A') signature. */
@@ -123,11 +117,7 @@ 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;
-
-#ifdef _MSC_VER
- #pragma pack(pop)
-#endif
-#undef PACK_STRUCT
+#include "pack_end.h"
/* archive structure used since diablo 1.00 by blizzard. */
struct mpq_archive {
diff --git a/externals/libmpq/libmpq/mpq.c b/externals/libmpq/libmpq/mpq.c
index 4e3d7db0b4d..606346b7bf6 100644
--- a/externals/libmpq/libmpq/mpq.c
+++ b/externals/libmpq/libmpq/mpq.c
@@ -33,13 +33,9 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
-#if HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-#ifdef _MSC_VER
- #define fseeko _fseeki64
-#endif
+/* support for platform specific things */
+#include "platform.h"
/* this function returns the library version information. */
const char *libmpq__version(void) {
diff --git a/externals/libmpq/libmpq/pack_begin.h b/externals/libmpq/libmpq/pack_begin.h
new file mode 100644
index 00000000000..eb4a6ddebbb
--- /dev/null
+++ b/externals/libmpq/libmpq/pack_begin.h
@@ -0,0 +1,34 @@
+/*
+ * pack_begin.h -- header file for struct packing used by libmpq.
+ *
+ * Copyright (c) 2010 Georg Lukas <georg@op-co.de>
+ *
+ * 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/externals/libmpq/libmpq/pack_end.h b/externals/libmpq/libmpq/pack_end.h
new file mode 100644
index 00000000000..a8a35113bfb
--- /dev/null
+++ b/externals/libmpq/libmpq/pack_end.h
@@ -0,0 +1,31 @@
+/*
+ * pack_end.h -- header file for struct packing used by libmpq.
+ *
+ * Copyright (c) 2010 Georg Lukas <georg@op-co.de>
+ *
+ * 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
diff --git a/externals/libmpq/libmpq/platform.h b/externals/libmpq/libmpq/platform.h
new file mode 100644
index 00000000000..68fdfdc5ded
--- /dev/null
+++ b/externals/libmpq/libmpq/platform.h
@@ -0,0 +1,28 @@
+/*
+ * platform.h -- header file for platform specific parts.
+ *
+ * Copyright (c) 2010 Georg Lukas <georg@op-co.de>
+ *
+ * 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 _PLATFORM_H
+#define _PLATFORM_H
+
+#ifdef _MSC_VER
+ #define fseeko _fseeki64
+#endif
+
+#endif /* _PLATFORM_H */