23#ifndef MUPDF_FITZ_STREAM_H
24#define MUPDF_FITZ_STREAM_H
407 size_t len = stm->
wp - stm->
rp;
416 c = stm->
next(ctx, stm, max);
421 fz_warn(ctx,
"read error; treating as end of file");
431 return stm->
wp - stm->
rp;
446 if (stm->
rp != stm->
wp)
451 c = stm->
next(ctx, stm, 1);
456 fz_warn(ctx,
"read error; treating as end of file");
476 if (stm->
rp != stm->
wp)
483 c = stm->
next(ctx, stm, 1);
491 fz_warn(ctx,
"read error; treating as end of file");
521 if (stm->
rp == stm->
wp)
525 return fz_peek_byte(ctx, stm) ==
EOF;
548 x = (stm->
bits >> stm->
avail) & ((1 << n) - 1);
558 x = (x << 8) | fz_read_byte(ctx, stm);
564 stm->
bits = fz_read_byte(ctx, stm);
566 x = (x << n) | (stm->
bits >> stm->
avail);
590 x = stm->
bits & ((1 << n) - 1);
596 unsigned int used = 0;
605 x = (fz_read_byte(ctx, stm) << used) | x;
612 stm->
bits = fz_read_byte(ctx, stm);
613 x = ((stm->
bits & ((1 << n) - 1)) << used) | x;
641 return fz_is_eof(ctx, stm) && (stm->
avail == 0 || stm->
bits ==
EOF);
void fz_rethrow_if(fz_context *ctx, int errcode)
#define fz_catch(ctx)
Definition context.h:65
#define fz_try(ctx)
Definition context.h:63
@ FZ_ERROR_TRYLATER
Definition context.h:232
void fz_report_error(fz_context *ctx)
void fz_warn(fz_context *ctx, const char *fmt,...) FZ_PRINTFLIKE(2
fz_stream * fz_open_memory(fz_context *ctx, const unsigned char *data, size_t len)
fz_stream * fz_open_file_autodelete(fz_context *ctx, const char *filename)
fz_buffer * fz_read_file(fz_context *ctx, const char *filename)
const char * fz_stream_filename(fz_context *ctx, fz_stream *stm)
int16_t fz_read_int16(fz_context *ctx, fz_stream *stm)
int64_t fz_tell(fz_context *ctx, fz_stream *stm)
void fz_skip_space(fz_context *ctx, fz_stream *stm)
uint32_t fz_read_uint32_le(fz_context *ctx, fz_stream *stm)
fz_stream * fz_new_stream(fz_context *ctx, void *state, fz_stream_next_fn *next, fz_stream_drop_fn *drop)
int64_t fz_read_int64_le(fz_context *ctx, fz_stream *stm)
fz_stream * fz_open_leecher(fz_context *ctx, fz_stream *chain, fz_buffer *buf)
float fz_read_float(fz_context *ctx, fz_stream *stm)
void fz_stream_seek_fn(fz_context *ctx, fz_stream *stm, int64_t offset, int whence)
Definition stream.h:317
float fz_read_float_le(fz_context *ctx, fz_stream *stm)
int32_t fz_read_int32_le(fz_context *ctx, fz_stream *stm)
int64_t fz_read_int64(fz_context *ctx, fz_stream *stm)
uint32_t fz_read_uint24(fz_context *ctx, fz_stream *stm)
fz_buffer * fz_read_best(fz_context *ctx, fz_stream *stm, size_t initial, int *truncated, size_t worst_case)
uint64_t fz_read_uint64(fz_context *ctx, fz_stream *stm)
int fz_stream_next_fn(fz_context *ctx, fz_stream *stm, size_t max)
Definition stream.h:297
char * fz_read_text_file(fz_context *ctx, const char *filename)
void fz_drop_stream(fz_context *ctx, fz_stream *stm)
int fz_read_rune(fz_context *ctx, fz_stream *in)
fz_stream * fz_keep_stream(fz_context *ctx, fz_stream *stm)
void fz_seek(fz_context *ctx, fz_stream *stm, int64_t offset, int whence)
fz_buffer * fz_try_read_file(fz_context *ctx, const char *filename)
void fz_stream_drop_fn(fz_context *ctx, void *state)
Definition stream.h:307
uint32_t fz_read_uint32(fz_context *ctx, fz_stream *stm)
uint64_t fz_read_uint64_le(fz_context *ctx, fz_stream *stm)
void fz_read_string(fz_context *ctx, fz_stream *stm, char *buffer, int len)
fz_stream * fz_open_buffer(fz_context *ctx, fz_buffer *buf)
int fz_skip_string(fz_context *ctx, fz_stream *stm, const char *str)
fz_stream * fz_open_file_ptr_no_close(fz_context *ctx, FILE *file)
char * fz_read_line(fz_context *ctx, fz_stream *stm, char *buf, size_t max)
int fz_file_exists(fz_context *ctx, const char *path)
fz_stream * fz_try_open_file(fz_context *ctx, const char *name)
int fz_read_utf16_be(fz_context *ctx, fz_stream *stm)
fz_buffer * fz_read_all(fz_context *ctx, fz_stream *stm, size_t initial)
uint16_t fz_read_uint16(fz_context *ctx, fz_stream *stm)
uint32_t fz_read_uint24_le(fz_context *ctx, fz_stream *stm)
int fz_read_utf16_le(fz_context *ctx, fz_stream *stm)
size_t fz_read(fz_context *ctx, fz_stream *stm, unsigned char *data, size_t len)
int16_t fz_read_int16_le(fz_context *ctx, fz_stream *stm)
uint16_t fz_read_uint16_le(fz_context *ctx, fz_stream *stm)
int32_t fz_read_int32(fz_context *ctx, fz_stream *stm)
size_t fz_skip(fz_context *ctx, fz_stream *stm, size_t len)
fz_stream * fz_open_file(fz_context *ctx, const char *filename)
void * state
Definition stream.h:329
unsigned char * rp
Definition stream.h:328
int error
Definition stream.h:322
int refs
Definition stream.h:321
fz_stream_next_fn * next
Definition stream.h:330
fz_stream_seek_fn * seek
Definition stream.h:332
int progressive
Definition stream.h:324
int bits
Definition stream.h:327
unsigned char * wp
Definition stream.h:328
int eof
Definition stream.h:323
int64_t pos
Definition stream.h:325
fz_stream_drop_fn * drop
Definition stream.h:331
int avail
Definition stream.h:326
#define FZ_UNUSED
Definition system.h:278
#define EOF
Definition system.h:165