Skip to content

Commit b2db23c

Browse files
committed
Merge pull request flutter#10 from pornel/const
Declare inbuffer arg in jpeg_mem_src() to be const This reassures the caller that the buffer will not be modified and also allows read-only buffers to be passed to the function.
2 parents 8fb37b8 + 7222ec2 commit b2db23c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

jdatasrc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
254254

255255
GLOBAL(void)
256256
jpeg_mem_src (j_decompress_ptr cinfo,
257-
unsigned char * inbuffer, unsigned long insize)
257+
const unsigned char * inbuffer, unsigned long insize)
258258
{
259259
struct jpeg_source_mgr * src;
260260

@@ -278,6 +278,6 @@ jpeg_mem_src (j_decompress_ptr cinfo,
278278
src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
279279
src->term_source = term_source;
280280
src->bytes_in_buffer = (size_t) insize;
281-
src->next_input_byte = (JOCTET *) inbuffer;
281+
src->next_input_byte = (const JOCTET *) inbuffer;
282282
}
283283
#endif

jpeglib.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,8 @@ EXTERN(void) jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile);
919919
/* Data source and destination managers: memory buffers. */
920920
EXTERN(void) jpeg_mem_dest (j_compress_ptr cinfo, unsigned char ** outbuffer,
921921
unsigned long * outsize);
922-
EXTERN(void) jpeg_mem_src (j_decompress_ptr cinfo, unsigned char * inbuffer,
922+
EXTERN(void) jpeg_mem_src (j_decompress_ptr cinfo,
923+
const unsigned char * inbuffer,
923924
unsigned long insize);
924925
#endif
925926

0 commit comments

Comments
 (0)