From a6def883e44695f8682edc208ebf1e97fb7c2370 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Sun, 9 Aug 2009 21:11:15 +0200 Subject: Fixing code for dummy MSVC C89 compiler. --- mpq-bios.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mpq-bios.c b/mpq-bios.c index eeba42a..07518c0 100644 --- a/mpq-bios.c +++ b/mpq-bios.c @@ -476,13 +476,13 @@ int mpqlib_add_hash_entry_by_hash(struct mpq_archive_t * mpq_a, uint32_t h, uint } int mpqlib_add_hash_entry_by_name(struct mpq_archive_t * mpq_a, const char * name, uint16_t language, uint16_t platform, int entry) { + uint32_t h, hA, hB; + if (!mpq_a->for_write) { __mpqlib_errno = MPQLIB_ERROR_READONLY; return -1; } - uint32_t h, hA, hB; - h = mpqlib_hash_filename(name); hA = mpqlib_hashA_filename(name); hB = mpqlib_hashB_filename(name); @@ -491,13 +491,13 @@ int mpqlib_add_hash_entry_by_name(struct mpq_archive_t * mpq_a, const char * nam } int mpqlib_update_hash_entry_by_hash(struct mpq_archive_t * mpq_a, uint32_t h, uint32_t hA, uint32_t hB, uint16_t language, uint16_t platform, int entry) { + hash_t * hash = mpqlib_locate_hash_entry(mpq_a, h, hA, hB, language, platform); + if (!mpq_a->for_write) { __mpqlib_errno = MPQLIB_ERROR_READONLY; return -1; } - hash_t * hash = mpqlib_locate_hash_entry(mpq_a, h, hA, hB, language, platform); - if (hash) { hash->file_block_index = entry; return 0; -- cgit v1.2.3