summaryrefslogtreecommitdiff
path: root/mpq-bios.c
diff options
context:
space:
mode:
Diffstat (limited to 'mpq-bios.c')
-rw-r--r--mpq-bios.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/mpq-bios.c b/mpq-bios.c
index abac013..4051627 100644
--- a/mpq-bios.c
+++ b/mpq-bios.c
@@ -336,13 +336,13 @@ int mpqlib_find_hash_entry_by_hash(struct mpq_archive_t * mpq_a, uint32_t hA, ui
return -1;
}
-int __mpqlib_seek(struct mpq_archive_t * mpq_a, off_t off) {
+int __mpqlib_seek(struct mpq_archive_t * mpq_a, uint64_t off) {
if (lseek64(mpq_a->fd, off, SEEK_SET) != off)
return 0;
return 1;
}
-int __mpqlib_read(struct mpq_archive_t * mpq_a, void * buffer, size_t size) {
+int __mpqlib_read(struct mpq_archive_t * mpq_a, void * buffer, uint32_t size) {
return read_data(mpq_a, buffer, size);
}
@@ -354,15 +354,18 @@ uint64_t mpqlib_ioctl(struct mpq_archive_t * mpq_a, enum mpqlib_ioctl_t command,
return mpq_a->format_version;
case MPQLIB_IOCTL_GET_SECTOR_SIZE:
return mpq_a->sector_size;
+ case MPQLIB_IOCTL_ENTRY_EXISTS:
case MPQLIB_IOCTL_GET_BLOCK_OFFSET:
case MPQLIB_IOCTL_GET_BLOCK_SIZE:
case MPQLIB_IOCTL_GET_FILE_SIZE:
case MPQLIB_IOCTL_GET_FLAGS:
- if (entry >= mpq_a->block_table_entries) {
+ if ((entry >= mpq_a->block_table_entries) || (entry < 0)) {
__mpqlib_errno = MPQLIB_ERROR_IOCTL_INVALID_ENTRY;
return -1;
}
switch (command) {
+ case MPQLIB_IOCTL_ENTRY_EXISTS:
+ return 0;
case MPQLIB_IOCTL_GET_BLOCK_OFFSET:
return mpq_a->blocks[entry].block_offset;
case MPQLIB_IOCTL_GET_BLOCK_SIZE: