summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
Diffstat (limited to 'fitz')
-rw-r--r--fitz/filt_basic.c10
-rw-r--r--fitz/fitz-internal.h2
2 files changed, 9 insertions, 3 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)
{
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h
index 1e54c900..197d0279 100644
--- a/fitz/fitz-internal.h
+++ b/fitz/fitz-internal.h
@@ -520,7 +520,7 @@ static inline int fz_is_eof_bits(fz_stream *stm)
*/
fz_stream *fz_open_copy(fz_stream *chain);
-fz_stream *fz_open_null(fz_stream *chain, int len);
+fz_stream *fz_open_null(fz_stream *chain, int len, int offset);
fz_stream *fz_open_arc4(fz_stream *chain, unsigned char *key, unsigned keylen);
fz_stream *fz_open_aesd(fz_stream *chain, unsigned char *key, unsigned keylen);
fz_stream *fz_open_a85d(fz_stream *chain);