diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-12-13 16:29:18 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-01-02 20:04:42 +0000 |
commit | 651f13408c67a8392ad93adda079c096d8a6118c (patch) | |
tree | 4f6b68c2d53cdc75d1625649103cc29aedc9e2f7 /include | |
parent | 0dde9978288535003ad9341613b9e4803339500d (diff) | |
download | mupdf-651f13408c67a8392ad93adda079c096d8a6118c.tar.xz |
Add rebinding for fz_streams.
Diffstat (limited to 'include')
-rw-r--r-- | include/mupdf/fitz/stream.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/include/mupdf/fitz/stream.h b/include/mupdf/fitz/stream.h index 1f616eef..206ba5be 100644 --- a/include/mupdf/fitz/stream.h +++ b/include/mupdf/fitz/stream.h @@ -136,6 +136,14 @@ enum int fz_stream_meta(fz_stream *stm, int key, int size, void *ptr); +void fz_rebind_stream(fz_stream *stm, fz_context *ctx); + +typedef int (fz_stream_read_fn)(fz_stream *stm, unsigned char *buf, int len); +typedef void (fz_stream_close_fn)(fz_context *ctx, void *state); +typedef void (fz_stream_seek_fn)(fz_stream *stm, int offset, int whence); +typedef int (fz_stream_meta_fn)(fz_stream *stm, int key, int size, void *ptr); +typedef fz_stream *(fz_stream_rebind_fn)(fz_stream *stm); + struct fz_stream_s { fz_context *ctx; @@ -147,14 +155,19 @@ struct fz_stream_s int bits; unsigned char *bp, *rp, *wp, *ep; void *state; - int (*read)(fz_stream *stm, unsigned char *buf, int len); - void (*close)(fz_context *ctx, void *state); - void (*seek)(fz_stream *stm, int offset, int whence); - int (*meta)(fz_stream *stm, int key, int size, void *ptr); + fz_stream_read_fn *read; + fz_stream_close_fn *close; + fz_stream_seek_fn *seek; + fz_stream_meta_fn *meta; + fz_stream_rebind_fn *rebind; unsigned char buf[4096]; }; -fz_stream *fz_new_stream(fz_context *ctx, void*, int(*)(fz_stream*, unsigned char*, int), void(*)(fz_context *, void *)); +fz_stream *fz_new_stream(fz_context *ctx, + void *state, + fz_stream_read_fn *read, + fz_stream_close_fn *close, + fz_stream_rebind_fn *rebind); fz_stream *fz_keep_stream(fz_stream *stm); void fz_fill_buffer(fz_stream *stm); |