Update libMPQ to latest revision (304)

--HG--
branch : trunk
This commit is contained in:
click
2010-07-14 19:09:39 +02:00
parent d59cc55351
commit 26582fd48b
3 changed files with 7 additions and 5 deletions

View File

@@ -20,7 +20,6 @@
/* generic includes. */
#include <ctype.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>

View File

@@ -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. */

View File

@@ -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;