summaryrefslogtreecommitdiff
path: root/fitz/fitz.h
diff options
context:
space:
mode:
Diffstat (limited to 'fitz/fitz.h')
-rw-r--r--fitz/fitz.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/fitz/fitz.h b/fitz/fitz.h
index bea851fa..13e285e6 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -497,7 +497,8 @@ typedef struct fz_stream_s fz_stream;
struct fz_stream_s
{
int refs;
- int dead;
+ int error;
+ int eof;
int pos;
int avail;
int bits;
@@ -550,6 +551,17 @@ static inline void fz_unreadbyte(fz_stream *stm)
stm->rp--;
}
+static inline int fz_iseof(fz_stream *stm)
+{
+ if (stm->rp == stm->wp)
+ {
+ if (stm->eof)
+ return 1;
+ return fz_peekbyte(stm) == EOF;
+ }
+ return 0;
+}
+
static inline unsigned int fz_readbits(fz_stream *stm, int n)
{
unsigned int x;
@@ -582,6 +594,16 @@ static inline unsigned int fz_readbits(fz_stream *stm, int n)
return x;
}
+static inline void fz_syncbits(fz_stream *stm)
+{
+ stm->avail = 0;
+}
+
+static inline int fz_iseofbits(fz_stream *stm)
+{
+ return fz_iseof(stm) && (stm->avail == 0 || stm->bits == EOF);
+}
+
/*
* Data filters.
*/