diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-07-11 16:52:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-07-11 18:07:59 +0300 |
commit | 2410797ab15d08e5138b8cf10d8f8246513935af (patch) | |
tree | 7b256ebb075babe33fc307c8b536c48b24bbd4ee /source/blender/imbuf/intern/jp2.c | |
parent | 03d8907ca7564c88c9f5357be93a74adbc638665 (diff) |
ImBuf: cleanup, use const for memory passed in
Diffstat (limited to 'source/blender/imbuf/intern/jp2.c')
-rw-r--r-- | source/blender/imbuf/intern/jp2.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 8750b825fb6..82b015b92c8 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -58,17 +58,17 @@ typedef struct img_folder { float *rates; } img_fol_t; -static int check_jp2(unsigned char *mem) /* J2K_CFMT */ +static int check_jp2(const unsigned char *mem) /* J2K_CFMT */ { return memcmp(JP2_HEAD, mem, sizeof(JP2_HEAD)) ? 0 : 1; } -static int check_j2k(unsigned char *mem) /* J2K_CFMT */ +static int check_j2k(const unsigned char *mem) /* J2K_CFMT */ { return memcmp(J2K_HEAD, mem, sizeof(J2K_HEAD)) ? 0 : 1; } -int imb_is_a_jp2(unsigned char *buf) +int imb_is_a_jp2(const unsigned char *buf) { return check_jp2(buf); } @@ -116,7 +116,7 @@ static void info_callback(const char *msg, void *client_data) } \ } (void)0 \ -struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) +struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) { struct ImBuf *ibuf = NULL; bool use_float = false; /* for precision higher then 8 use float */ @@ -170,7 +170,8 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags, char co opj_setup_decoder(dinfo, ¶meters); /* open a byte stream */ - cio = opj_cio_open((opj_common_ptr)dinfo, mem, size); + /* note, we can't avoid removing 'const' cast here */ + cio = opj_cio_open((opj_common_ptr)dinfo, (unsigned char *)mem, size); /* decode the stream and fill the image structure */ image = opj_decode(dinfo, cio); |