summaryrefslogtreecommitdiff
path: root/fitz/filt_basic.c
diff options
context:
space:
mode:
Diffstat (limited to 'fitz/filt_basic.c')
-rw-r--r--fitz/filt_basic.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fitz/filt_basic.c b/fitz/filt_basic.c
index 09d63402..ac6a5903 100644
--- a/fitz/filt_basic.c
+++ b/fitz/filt_basic.c
@@ -14,6 +14,7 @@ struct null_filter
{
fz_stream *chain;
int remain;
+ int pos;
};
static int
@@ -21,8 +22,12 @@ read_null(fz_stream *stm, unsigned char *buf, int len)
{
struct null_filter *state = stm->state;
int amount = MIN(len, state->remain);
- int n = fz_read(state->chain, buf, amount);
+ int n;
+
+ fz_seek(state->chain, state->pos, 0);
+ n = fz_read(state->chain, buf, amount);
state->remain -= n;
+ state->pos += n;
return n;
}
@@ -36,7 +41,7 @@ close_null(fz_context *ctx, void *state_)
}
fz_stream *
-fz_open_null(fz_stream *chain, int len)
+fz_open_null(fz_stream *chain, int len, int offset)
{
struct null_filter *state;
fz_context *ctx = chain->ctx;
@@ -46,6 +51,7 @@ fz_open_null(fz_stream *chain, int len)
state = fz_malloc_struct(ctx, struct null_filter);
state->chain = chain;
state->remain = len;
+ state->pos = offset;
}
fz_catch(ctx)
{