summaryrefslogtreecommitdiff
path: root/fitz/stm_read.c
diff options
context:
space:
mode:
Diffstat (limited to 'fitz/stm_read.c')
-rw-r--r--fitz/stm_read.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fitz/stm_read.c b/fitz/stm_read.c
index 58379887..5622a24f 100644
--- a/fitz/stm_read.c
+++ b/fitz/stm_read.c
@@ -175,10 +175,10 @@ fz_seek(fz_stream *stm, int offset, int whence)
}
if (whence == 0)
{
- unsigned char *p = stm->wp - (stm->pos - offset);
- if (p >= stm->bp && p <= stm->wp)
+ int dist = stm->pos - offset;
+ if (dist >= 0 && dist <= stm->wp - stm->bp)
{
- stm->rp = p;
+ stm->rp = stm->wp - dist;
stm->eof = 0;
return;
}