diff options
author | pixel <pixel> | 2007-07-09 20:26:02 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-07-09 20:26:02 +0000 |
commit | e3be7db2c856dc67286a5c873f65af1f40126f46 (patch) | |
tree | fbd889e3edcbdf061ea5b292401cd2e9a9d63e42 /mpq-bios.c | |
parent | a47cbe621febe11586f22c28a4507d74930d1737 (diff) |
mpq-file almost done.
Diffstat (limited to 'mpq-bios.c')
-rw-r--r-- | mpq-bios.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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: |