Index: jdatasrc.c |
diff --git a/jdatasrc.c b/jdatasrc.c |
index 1e9c8ad2b486d7036b8819175f8f1420f63ae461..acbeb8a7166711b7e5f75e83de7cea93d3b39722 100644 |
--- a/jdatasrc.c |
+++ b/jdatasrc.c |
@@ -6,7 +6,8 @@ |
* Modified 2009-2011 by Guido Vollbeding. |
* libjpeg-turbo Modifications: |
* Copyright (C) 2013, D. R. Commander. |
- * For conditions of distribution and use, see the accompanying README file. |
+ * For conditions of distribution and use, see the accompanying README.ijg |
+ * file. |
* |
* This file contains decompression data source routines for the case of |
* reading JPEG data from memory or from a file (or any stdio stream). |
@@ -26,16 +27,16 @@ |
/* Expanded data source object for stdio input */ |
typedef struct { |
- struct jpeg_source_mgr pub; /* public fields */ |
+ struct jpeg_source_mgr pub; /* public fields */ |
- FILE * infile; /* source stream */ |
- JOCTET * buffer; /* start of buffer */ |
- boolean start_of_file; /* have we gotten any data yet? */ |
+ FILE *infile; /* source stream */ |
+ JOCTET *buffer; /* start of buffer */ |
+ boolean start_of_file; /* have we gotten any data yet? */ |
} my_source_mgr; |
-typedef my_source_mgr * my_src_ptr; |
+typedef my_source_mgr *my_src_ptr; |
-#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ |
+#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ |
/* |
@@ -106,7 +107,7 @@ fill_input_buffer (j_decompress_ptr cinfo) |
nbytes = JFREAD(src->infile, src->buffer, INPUT_BUF_SIZE); |
if (nbytes <= 0) { |
- if (src->start_of_file) /* Treat empty input file as fatal error */ |
+ if (src->start_of_file) /* Treat empty input file as fatal error */ |
ERREXIT(cinfo, JERR_INPUT_EMPTY); |
WARNMS(cinfo, JWRN_JPEG_EOF); |
/* Insert a fake EOI marker */ |
@@ -161,7 +162,7 @@ fill_mem_input_buffer (j_decompress_ptr cinfo) |
METHODDEF(void) |
skip_input_data (j_decompress_ptr cinfo, long num_bytes) |
{ |
- struct jpeg_source_mgr * src = cinfo->src; |
+ struct jpeg_source_mgr *src = cinfo->src; |
/* Just a dumb implementation for now. Could use fseek() except |
* it doesn't work on pipes. Not clear that being smart is worth |
@@ -213,7 +214,7 @@ term_source (j_decompress_ptr cinfo) |
*/ |
GLOBAL(void) |
-jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) |
+jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile) |
{ |
my_src_ptr src; |
@@ -224,14 +225,14 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) |
* This makes it unsafe to use this manager and a different source |
* manager serially with the same JPEG object. Caveat programmer. |
*/ |
- if (cinfo->src == NULL) { /* first time for this JPEG object? */ |
+ if (cinfo->src == NULL) { /* first time for this JPEG object? */ |
cinfo->src = (struct jpeg_source_mgr *) |
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, |
- SIZEOF(my_source_mgr)); |
+ sizeof(my_source_mgr)); |
src = (my_src_ptr) cinfo->src; |
src->buffer = (JOCTET *) |
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, |
- INPUT_BUF_SIZE * SIZEOF(JOCTET)); |
+ INPUT_BUF_SIZE * sizeof(JOCTET)); |
} |
src = (my_src_ptr) cinfo->src; |
@@ -254,21 +255,21 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) |
GLOBAL(void) |
jpeg_mem_src (j_decompress_ptr cinfo, |
- unsigned char * inbuffer, unsigned long insize) |
+ const unsigned char *inbuffer, unsigned long insize) |
{ |
- struct jpeg_source_mgr * src; |
+ struct jpeg_source_mgr *src; |
- if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */ |
+ if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */ |
ERREXIT(cinfo, JERR_INPUT_EMPTY); |
/* The source object is made permanent so that a series of JPEG images |
* can be read from the same buffer by calling jpeg_mem_src only before |
* the first one. |
*/ |
- if (cinfo->src == NULL) { /* first time for this JPEG object? */ |
+ if (cinfo->src == NULL) { /* first time for this JPEG object? */ |
cinfo->src = (struct jpeg_source_mgr *) |
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, |
- SIZEOF(struct jpeg_source_mgr)); |
+ sizeof(struct jpeg_source_mgr)); |
} |
src = cinfo->src; |
@@ -278,6 +279,6 @@ jpeg_mem_src (j_decompress_ptr cinfo, |
src->resync_to_restart = jpeg_resync_to_restart; /* use default method */ |
src->term_source = term_source; |
src->bytes_in_buffer = (size_t) insize; |
- src->next_input_byte = (JOCTET *) inbuffer; |
+ src->next_input_byte = (const JOCTET *) inbuffer; |
} |
#endif |