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/djpeg.c b/djpeg.c
index 80f620f..6de5d2c 100644
--- a/djpeg.c
+++ b/djpeg.c
@@ -88,8 +88,8 @@
*/
-static const char * progname; /* program name for error messages */
-static char * outfilename; /* for -outfile switch */
+static const char *progname; /* program name for error messages */
+static char *outfilename; /* for -outfile switch */
boolean memsrc; /* for -memsrc switch */
boolean strip, skip;
JDIMENSION startY, endY;
@@ -190,7 +190,7 @@
*/
{
int argn;
- char * arg;
+ char *arg;
/* Set up default JPEG parameters. */
requested_fmt = DEFAULT_FMT; /* set default output file format */
@@ -307,7 +307,7 @@
usage();
if (for_real) { /* too expensive to do twice! */
#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */
- FILE * mapfile;
+ FILE *mapfile;
if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) {
fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
@@ -417,7 +417,7 @@
jpeg_getc (j_decompress_ptr cinfo)
/* Read next byte */
{
- struct jpeg_source_mgr * datasrc = cinfo->src;
+ struct jpeg_source_mgr *datasrc = cinfo->src;
if (datasrc->bytes_in_buffer == 0) {
if (! (*datasrc->fill_input_buffer) (cinfo))
@@ -493,8 +493,8 @@
#endif
int file_index;
djpeg_dest_ptr dest_mgr = NULL;
- FILE * input_file;
- FILE * output_file;
+ FILE *input_file;
+ FILE *output_file;
unsigned char *inbuffer = NULL;
unsigned long insize = 0;
JDIMENSION num_scanlines;