From 235dfb18cd272ab592838389574d4d7f14b5d6eb Mon Sep 17 00:00:00 2001 From: leitner Date: Sun, 1 Nov 2020 15:16:16 +0000 Subject: [PATCH] add bs_seterrorstate --- buffer/bs_seterrorstate.c | 6 ++++++ parse.h | 3 +++ 2 files changed, 9 insertions(+) create mode 100644 buffer/bs_seterrorstate.c diff --git a/buffer/bs_seterrorstate.c b/buffer/bs_seterrorstate.c new file mode 100644 index 0000000..ec32b2c --- /dev/null +++ b/buffer/bs_seterrorstate.c @@ -0,0 +1,6 @@ +#include "parse.h" + +void bs_seterrorstate(struct bytestream* b) { + b->cur = 1; + b->max = 0; +} diff --git a/parse.h b/parse.h index 9dbd32d..b82a44a 100644 --- a/parse.h +++ b/parse.h @@ -83,6 +83,9 @@ unsigned char bs_peek(struct bytestream* bs); /* was there a read error or did we attempt to read more than maxlen bytes? */ int bs_err(struct bytestream* bs); +/* mark bytestream as erroneous */ +void bs_seterrorstate(struct bytestream* b); + /* Can we read this much more bytes from the bytestream? */ /* returns 1 for yes, 0 for no */ int bs_capacitycheck(struct bytestream* bs,size_t capacity);