summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: