mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-18 16:25:05 +08:00
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.
This commit is contained in:
parent
6867acc18e
commit
d119ce6f9a
@ -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];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user