From 26582fd48b480b1ddc0b86f9647df13879e1b116 Mon Sep 17 00:00:00 2001 From: click Date: Wed, 14 Jul 2010 19:09:39 +0200 Subject: [PATCH] Update libMPQ to latest revision (304) --HG-- branch : trunk --- externals/libmpq/libmpq/common.c | 1 - externals/libmpq/libmpq/mpq-internal.h | 2 +- externals/libmpq/libmpq/mpq.c | 9 ++++++--- 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 -#include #include #include #include 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;