summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2007-07-09 19:10:35 +0000
committerpixel <pixel>2007-07-09 19:10:35 +0000
commitd71a0bb87551712359702851576b3b01132622f6 (patch)
tree856825a6cd8fd684ee9ddb73241c2eb72fd6e25d
parent6e2814c248483e3474a7f60266f4170f03d89653 (diff)
Adding two versions of find_hash_entry
-rw-r--r--mpq-bios.c9
-rw-r--r--mpq-bios.h3
2 files changed, 9 insertions, 3 deletions
diff --git a/mpq-bios.c b/mpq-bios.c
index d8be0bd..bcea83d 100644
--- a/mpq-bios.c
+++ b/mpq-bios.c
@@ -316,13 +316,18 @@ void mpqlib_printtables(struct mpq_archive_t * mpq_a) {
}
}
-int mpqlib_find_hash_entry(struct mpq_archive_t * mpq_a, const char * name, uint32_t language, uint32_t platform) {
- int i;
+int mpqlib_find_hash_entry_by_name(struct mpq_archive_t * mpq_a, const char * name, uint32_t language, uint32_t platform) {
uint32_t hA, hB;
hA = mpqlib_hashA_filename(name);
hB = mpqlib_hashB_filename(name);
+ return mpqlib_find_hash_entry_by_hash(mpq_a, hA, hB, language, platform);
+}
+
+int mpqlib_find_hash_entry_by_hash(struct mpq_archive_t * mpq_a, uint32_t hA, uint32_t hB, uint32_t language, uint32_t platform) {
+ int i;
+
for (i = 0; i < mpq_a->hash_table_entries; i++) {
if ((mpq_a->hashs[i].file_path_hasha == hA) &&
(mpq_a->hashs[i].file_path_hashb == hB) &&
diff --git a/mpq-bios.h b/mpq-bios.h
index a30ef16..433f197 100644
--- a/mpq-bios.h
+++ b/mpq-bios.h
@@ -32,7 +32,8 @@ struct mpq_archive_t * mpqlib_open_archive(const char * fname);
struct mpq_archive_t * mpqlib_reopen_archive(int fd);
void mpqlib_printtables(struct mpq_archive_t *);
void mpqlib_close_archive(struct mpq_archive_t *);
-int mpqlib_find_hash_entry(struct mpq_archive_t *, const char * name, uint32_t language, uint32_t platform);
+int mpqlib_find_hash_entry_by_name(struct mpq_archive_t *, const char * name, uint32_t language, uint32_t platform);
+int mpqlib_find_hash_entry_by_hash(struct mpq_archive_t *, uint32_t hA, uint32_t hB, uint32_t language, uint32_t platform);
uint64_t mpqlib_ioctl(struct mpq_archive_t *, enum mpqlib_ioctl_t command, int entry);
#ifdef __cplusplus