From a94e86a03d3059b2bd7f48b9bbc436253bd2d94e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 11 Oct 2017 14:03:39 +0200 Subject: Make fz_open_memory take a const buffer. --- include/mupdf/fitz/stream.h | 2 +- source/fitz/stream-open.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/mupdf/fitz/stream.h b/include/mupdf/fitz/stream.h index f9cf755c..be59a7a0 100644 --- a/include/mupdf/fitz/stream.h +++ b/include/mupdf/fitz/stream.h @@ -68,7 +68,7 @@ fz_stream *fz_open_file_ptr(fz_context *ctx, FILE *file); Returns pointer to newly created stream. May throw exceptions on failure to allocate. */ -fz_stream *fz_open_memory(fz_context *ctx, unsigned char *data, size_t len); +fz_stream *fz_open_memory(fz_context *ctx, const unsigned char *data, size_t len); /* fz_open_buffer: Open a buffer as a stream. diff --git a/source/fitz/stream-open.c b/source/fitz/stream-open.c index 83990d52..d7cff535 100644 --- a/source/fitz/stream-open.c +++ b/source/fitz/stream-open.c @@ -208,15 +208,15 @@ fz_open_buffer(fz_context *ctx, fz_buffer *buf) } fz_stream * -fz_open_memory(fz_context *ctx, unsigned char *data, size_t len) +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->seek = seek_buffer; - stm->rp = data; - stm->wp = data + len; + stm->rp = (unsigned char *)data; + stm->wp = (unsigned char *)data + len; stm->pos = (fz_off_t)len; -- cgit v1.2.3