aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclick <none@none>2010-07-14 19:09:39 +0200
committerclick <none@none>2010-07-14 19:09:39 +0200
commit26582fd48b480b1ddc0b86f9647df13879e1b116 (patch)
tree57922852540e344cf59db6b3dec0b16dd34ad183
parentd59cc55351d0b3f94ae6d71a7d16685a157cb321 (diff)
Update libMPQ to latest revision (304)
--HG-- branch : trunk
-rw-r--r--externals/libmpq/libmpq/common.c1
-rw-r--r--externals/libmpq/libmpq/mpq-internal.h2
-rw-r--r--externals/libmpq/libmpq/mpq.c9
3 files changed, 7 insertions, 5 deletions
diff --git a/externals/libmpq/libmpq/common.c b/externals/libmpq/libmpq/common.c
index 346afe0181c..c17e4035dcc 100644
--- a/externals/libmpq/libmpq/common.c
+++ b/externals/libmpq/libmpq/common.c
@@ -20,7 +20,6 @@
/* generic includes. */
#include <ctype.h>
-#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
diff --git a/externals/libmpq/libmpq/mpq-internal.h b/externals/libmpq/libmpq/mpq-internal.h
index bfa9d25c945..76eabe4190a 100644
--- a/externals/libmpq/libmpq/mpq-internal.h
+++ b/externals/libmpq/libmpq/mpq-internal.h
@@ -44,7 +44,7 @@
#define LIBMPQ_FLAG_COMPRESS_MULTI 0x00000200 /* multiple compressions. */
#define LIBMPQ_FLAG_COMPRESS_NONE 0x00000300 /* no compression (no blizzard flag used by myself). */
#define LIBMPQ_FLAG_SINGLE 0x01000000 /* file is stored in one single sector, first seen in world of warcraft. */
-#define LIBMPQ_FLAG_EXTRA 0x04000000 /* compressed block offset table has one extra entry. */
+#define LIBMPQ_FLAG_CRC 0x04000000 /* compressed block offset table has CRC checksum. */
/* define generic hash values. */
#define LIBMPQ_HASH_FREE 0xFFFFFFFF /* hash table entry is empty and has always been empty. */
diff --git a/externals/libmpq/libmpq/mpq.c b/externals/libmpq/libmpq/mpq.c
index 1b654444d61..83d5533109f 100644
--- a/externals/libmpq/libmpq/mpq.c
+++ b/externals/libmpq/libmpq/mpq.c
@@ -609,7 +609,7 @@ int32_t libmpq__block_open_offset(mpq_archive_s *mpq_archive, uint32_t file_numb
}
/* check if data has one extra entry. */
- if ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_EXTRA) != 0) {
+ if ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_CRC) != 0) {
/* add one uint32_t. */
packed_size += sizeof(uint32_t);
@@ -654,8 +654,11 @@ int32_t libmpq__block_open_offset(mpq_archive_s *mpq_archive, uint32_t file_numb
goto error;
}
- /* check if the archive is protected some way, sometimes the file appears not to be encrypted, but it is. */
- if (mpq_archive->mpq_file[file_number]->packed_offset[0] != rb) {
+ /* check if the archive is protected some way, sometimes the file appears not to be encrypted, but it is.
+ * a special case are files with an additional sector but LIBMPQ_FLAG_CRC not set. we don't want to handle
+ * them as encrypted. */
+ if (mpq_archive->mpq_file[file_number]->packed_offset[0] != rb &&
+ mpq_archive->mpq_file[file_number]->packed_offset[0] != rb + 4) {
/* file is encrypted. */
mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags |= LIBMPQ_FLAG_ENCRYPTED;