summaryrefslogtreecommitdiff
path: root/nasmlib.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-10 18:07:51 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-10 18:07:51 -0700
commitd119ce6f9a354d705396f06f86d00532836f3883 (patch)
tree1a4ba20a0348ba8dfe369653c33d00f78cd62d6b /nasmlib.c
parent6867acc18ee541e361a5fa1e5a1bac3a478a3856 (diff)
downloadnasm-d119ce6f9a354d705396f06f86d00532836f3883.tar.gz
nasm-d119ce6f9a354d705396f06f86d00532836f3883.tar.bz2
nasm-d119ce6f9a354d705396f06f86d00532836f3883.zip
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.
Diffstat (limited to 'nasmlib.c')
-rw-r--r--nasmlib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/nasmlib.c b/nasmlib.c
index aca2af4..7e7441b 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];