From d119ce6f9a354d705396f06f86d00532836f3883 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 10 Oct 2007 18:07:51 -0700 Subject: [PATCH] saa_fread/fwrite: when seeking, must set [rw]ptr as well [rw]ptr represent the global position and need to be kept in sync with [rw]pos:[rw]blk at all times. Failed to do that while seeking, with obviously bad results. --- nasmlib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nasmlib.c b/nasmlib.c index aca2af42..7e7441b4 100644 --- a/nasmlib.c +++ b/nasmlib.c @@ -692,6 +692,7 @@ void saa_fread(struct SAA *s, size_t posn, void *data, size_t len) } ix = posn / s->blk_len; + s->rptr = posn; s->rpos = posn % s->blk_len; s->rblk = &s->blk_ptrs[ix]; @@ -710,6 +711,7 @@ void saa_fwrite(struct SAA *s, size_t posn, const void *data, size_t len) } ix = posn / s->blk_len; + s->wptr = posn; s->wpos = posn % s->blk_len; s->wblk = &s->blk_ptrs[ix]; -- 2.11.4.GIT