diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-01-24 20:04:03 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-01-31 11:56:59 +0100 |
commit | 5d1e60c1337bf5b93044957089ab03a3f3eaf334 (patch) | |
tree | 4fcf49546331272d87efde2cac81d8d47d7b9d37 /source/fitz | |
parent | b4a4aaed7833e2def0c8bb3681523d7aabe365f9 (diff) | |
download | mupdf-5d1e60c1337bf5b93044957089ab03a3f3eaf334.tar.xz |
Rename confusing fz_stream close callback to drop.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/stream-open.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/fitz/stream-open.c b/source/fitz/stream-open.c index 1a99ad52..62e410a4 100644 --- a/source/fitz/stream-open.c +++ b/source/fitz/stream-open.c @@ -25,7 +25,7 @@ fz_file_exists(fz_context *ctx, const char *path) } fz_stream * -fz_new_stream(fz_context *ctx, void *state, fz_stream_next_fn *next, fz_stream_close_fn *close) +fz_new_stream(fz_context *ctx, void *state, fz_stream_next_fn *next, fz_stream_drop_fn *drop) { fz_stream *stm = NULL; @@ -35,7 +35,7 @@ fz_new_stream(fz_context *ctx, void *state, fz_stream_next_fn *next, fz_stream_c } fz_catch(ctx) { - close(ctx, state); + drop(ctx, state); fz_rethrow(ctx); } @@ -52,7 +52,7 @@ fz_new_stream(fz_context *ctx, void *state, fz_stream_next_fn *next, fz_stream_c stm->state = state; stm->next = next; - stm->close = close; + stm->drop = drop; stm->seek = NULL; return stm; @@ -69,8 +69,8 @@ fz_drop_stream(fz_context *ctx, fz_stream *stm) { if (fz_drop_imp(ctx, stm, &stm->refs)) { - if (stm->close) - stm->close(ctx, stm->state); + if (stm->drop) + stm->drop(ctx, stm->state); fz_free(ctx, stm); } } @@ -122,7 +122,7 @@ static void seek_file(fz_context *ctx, fz_stream *stm, int64_t offset, int whenc stm->wp = state->buffer; } -static void close_file(fz_context *ctx, void *state_) +static void drop_file(fz_context *ctx, void *state_) { fz_file_stream *state = state_; int n = fclose(state->file); @@ -138,7 +138,7 @@ fz_open_file_ptr(fz_context *ctx, FILE *file) fz_file_stream *state = fz_malloc_struct(ctx, fz_file_stream); state->file = file; - stm = fz_new_stream(ctx, state, next_file, close_file); + stm = fz_new_stream(ctx, state, next_file, drop_file); stm->seek = seek_file; return stm; @@ -148,7 +148,7 @@ fz_stream *fz_open_file_ptr_no_close(fz_context *ctx, FILE *file) { fz_stream *stm = fz_open_file_ptr(ctx, file); /* We don't own the file ptr. Ensure we don't close it */ - stm->close = NULL; + stm->drop = NULL; return stm; } @@ -204,7 +204,7 @@ static void seek_buffer(fz_context *ctx, fz_stream *stm, int64_t offset, int whe stm->rp += (int)(offset - pos); } -static void close_buffer(fz_context *ctx, void *state_) +static void drop_buffer(fz_context *ctx, void *state_) { fz_buffer *state = (fz_buffer *)state_; fz_drop_buffer(ctx, state); @@ -216,7 +216,7 @@ fz_open_buffer(fz_context *ctx, fz_buffer *buf) fz_stream *stm; fz_keep_buffer(ctx, buf); - stm = fz_new_stream(ctx, buf, next_buffer, close_buffer); + stm = fz_new_stream(ctx, buf, next_buffer, drop_buffer); stm->seek = seek_buffer; stm->rp = buf->data; @@ -232,7 +232,7 @@ fz_open_memory(fz_context *ctx, const unsigned char *data, size_t len) { fz_stream *stm; - stm = fz_new_stream(ctx, NULL, next_buffer, close_buffer); + stm = fz_new_stream(ctx, NULL, next_buffer, drop_buffer); stm->seek = seek_buffer; stm->rp = (unsigned char *)data; |