rsys

Basic data structures and low-level features
git clone git://git.meso-star.fr/rsys.git
Log | Files | Refs | README | LICENSE

commit 0ec8214b119be0afa53150de65e8e1dbdcf8a76f
parent 8fcaf9187ea756e2430bb6350a886ab1637dd09f
Author: vaplv <vaplv@free.fr>
Date:   Thu, 25 May 2017 15:49:54 +0200

Implement the big_buffer_set function

Diffstat:
Msrc/big_buffer.h | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/big_buffer.h b/src/big_buffer.h @@ -106,13 +106,9 @@ BIGBUF_FUNC__(flush__)(struct BIGBUF__* bigbuf) buf_size = bigbuf->buf.size; buf_data = bigbuf->buf.data; - if(bigbuf->buf_index + buf_size == bigbuf->size) { - err = fseek(bigbuf->file, bigbuf->end, SEEK_SET); - } else { - cur = ftell(bigbuf->file); - offset = (long)(sizeof(BIGBUF_DATA)*bigbuf->buf_index) - cur + bigbuf->head; - err = fseek(bigbuf->file, offset, SEEK_CUR); - } + cur = ftell(bigbuf->file); + offset = (long)(sizeof(BIGBUF_DATA)*bigbuf->buf_index) - cur + bigbuf->head; + err = fseek(bigbuf->file, offset, SEEK_CUR); if(err < 0) { res = RES_IO_ERR; goto error; @@ -399,6 +395,7 @@ BIGBUF_FUNC__(set) ASSERT(at >= bigbuf->buf_index); bigbuf->buf.data[at - bigbuf->buf_index] = *data; + bigbuf->mode = BIGBUF_WRITE__; exit: return res;