Use consistent/modern code formatting for pointers
The convention used by libjpeg:
type * variable;
is not very common anymore, because it looks too much like
multiplication. Some (particularly C++ programmers) prefer to tuck the
pointer symbol against the type:
type* variable;
to emphasize that a pointer to a type is effectively a new type.
However, this can also be confusing, since defining multiple variables
on the same line would not work properly:
type* variable1, variable2; /* Only variable1 is actually a
pointer. */
This commit reformats the entirety of the libjpeg-turbo code base so
that it uses the same code formatting convention for pointers that the
TurboJPEG API code uses:
type *variable1, *variable2;
This seems to be the most common convention among C programmers, and
it is the convention used by other codec libraries, such as libpng and
libtiff.
diff --git a/jdatasrc.c b/jdatasrc.c
index 1f46a96..acbeb8a 100644
--- a/jdatasrc.c
+++ b/jdatasrc.c
@@ -29,12 +29,12 @@
typedef struct {
struct jpeg_source_mgr pub; /* public fields */
- FILE * infile; /* source stream */
- JOCTET * buffer; /* start of buffer */
+ 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 */
@@ -162,7 +162,7 @@
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
@@ -214,7 +214,7 @@
*/
GLOBAL(void)
-jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
+jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile)
{
my_src_ptr src;
@@ -255,9 +255,9 @@
GLOBAL(void)
jpeg_mem_src (j_decompress_ptr cinfo,
- const 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 */
ERREXIT(cinfo, JERR_INPUT_EMPTY);