summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2008-08-13 08:39:05 +0000
committerpixel <pixel>2008-08-13 08:39:05 +0000
commit87bf6e392a949958752741bb571fa7d29705b69f (patch)
treef02b6f8f81bf9c1b1f5d8fb7e4abbef75a64cd68
parentdffe2a032c57d4e00ae82a5c6ac70093566936bf (diff)
Fixing seek.
-rw-r--r--mpq-file.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mpq-file.c b/mpq-file.c
index ad5d51b..3e1622e 100644
--- a/mpq-file.c
+++ b/mpq-file.c
@@ -222,15 +222,15 @@ uint32_t mpqlib_seek(struct mpq_file_t * mpq_f, int32_t offset, enum mpqlib_file
mpq_f->cursor = offset;
break;
case MPQLIB_SEEK_CUR:
- if ((-offset) >= mpq_f->cursor)
+ if ((mpq_f->cursor + offset) < 0)
offset = -mpq_f->cursor;
mpq_f->cursor += offset;
break;
case MPQLIB_SEEK_END:
if (offset > 0)
offset = 0;
- if ((-offset) >= mpq_f->file_size)
- offset = -mpq_f->file_size;
+ if ((mpq_f->cursor + offset) < 0)
+ offset = -mpq_f->cursor;
mpq_f->cursor = mpq_f->file_size + offset;
break;
default: