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/jcdctmgr.c b/jcdctmgr.c
index abbbe2a..f3919b9 100644
--- a/jcdctmgr.c
+++ b/jcdctmgr.c
@@ -25,21 +25,21 @@
/* Private subobject for this module */
-typedef void (*forward_DCT_method_ptr) (DCTELEM * data);
-typedef void (*float_DCT_method_ptr) (FAST_FLOAT * data);
+typedef void (*forward_DCT_method_ptr) (DCTELEM *data);
+typedef void (*float_DCT_method_ptr) (FAST_FLOAT *data);
typedef void (*convsamp_method_ptr) (JSAMPARRAY sample_data,
JDIMENSION start_col,
- DCTELEM * workspace);
+ DCTELEM *workspace);
typedef void (*float_convsamp_method_ptr) (JSAMPARRAY sample_data,
JDIMENSION start_col,
FAST_FLOAT *workspace);
-typedef void (*quantize_method_ptr) (JCOEFPTR coef_block, DCTELEM * divisors,
- DCTELEM * workspace);
+typedef void (*quantize_method_ptr) (JCOEFPTR coef_block, DCTELEM *divisors,
+ DCTELEM *workspace);
typedef void (*float_quantize_method_ptr) (JCOEFPTR coef_block,
- FAST_FLOAT * divisors,
- FAST_FLOAT * workspace);
+ FAST_FLOAT *divisors,
+ FAST_FLOAT *workspace);
METHODDEF(void) quantize (JCOEFPTR, DCTELEM *, DCTELEM *);
@@ -55,22 +55,22 @@
* entries, because of scaling (especially for an unnormalized DCT).
* Each table is given in normal array order.
*/
- DCTELEM * divisors[NUM_QUANT_TBLS];
+ DCTELEM *divisors[NUM_QUANT_TBLS];
/* work area for FDCT subroutine */
- DCTELEM * workspace;
+ DCTELEM *workspace;
#ifdef DCT_FLOAT_SUPPORTED
/* Same as above for the floating-point case. */
float_DCT_method_ptr float_dct;
float_convsamp_method_ptr float_convsamp;
float_quantize_method_ptr float_quantize;
- FAST_FLOAT * float_divisors[NUM_QUANT_TBLS];
- FAST_FLOAT * float_workspace;
+ FAST_FLOAT *float_divisors[NUM_QUANT_TBLS];
+ FAST_FLOAT *float_workspace;
#endif
} my_fdct_controller;
-typedef my_fdct_controller * my_fdct_ptr;
+typedef my_fdct_controller *my_fdct_ptr;
#if BITS_IN_JSAMPLE == 8
@@ -170,7 +170,7 @@
*/
LOCAL(int)
-compute_reciprocal (UINT16 divisor, DCTELEM * dtbl)
+compute_reciprocal (UINT16 divisor, DCTELEM *dtbl)
{
UDCTELEM2 fq, fr;
UDCTELEM c;
@@ -238,8 +238,8 @@
my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
int ci, qtblno, i;
jpeg_component_info *compptr;
- JQUANT_TBL * qtbl;
- DCTELEM * dtbl;
+ JQUANT_TBL *qtbl;
+ DCTELEM *dtbl;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
@@ -332,7 +332,7 @@
* What's actually stored is 1/divisor so that the inner loop can
* use a multiplication rather than a division.
*/
- FAST_FLOAT * fdtbl;
+ FAST_FLOAT *fdtbl;
int row, col;
static const double aanscalefactor[DCTSIZE] = {
1.0, 1.387039845, 1.306562965, 1.175875602,
@@ -370,7 +370,7 @@
*/
METHODDEF(void)
-convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace)
+convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace)
{
register DCTELEM *workspaceptr;
register JSAMPROW elemptr;
@@ -405,7 +405,7 @@
*/
METHODDEF(void)
-quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace)
+quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
{
int i;
DCTELEM temp;
@@ -487,7 +487,7 @@
*/
METHODDEF(void)
-forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
+forward_DCT (j_compress_ptr cinfo, jpeg_component_info *compptr,
JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
JDIMENSION start_row, JDIMENSION start_col,
JDIMENSION num_blocks)
@@ -495,8 +495,8 @@
{
/* This routine is heavily used, so it's worth coding it tightly. */
my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
- DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no];
- DCTELEM * workspace;
+ DCTELEM *divisors = fdct->divisors[compptr->quant_tbl_no];
+ DCTELEM *workspace;
JDIMENSION bi;
/* Make sure the compiler doesn't look up these every pass */
@@ -524,7 +524,7 @@
METHODDEF(void)
-convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace)
+convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace)
{
register FAST_FLOAT *workspaceptr;
register JSAMPROW elemptr;
@@ -555,7 +555,7 @@
METHODDEF(void)
-quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace)
+quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace)
{
register FAST_FLOAT temp;
register int i;
@@ -577,7 +577,7 @@
METHODDEF(void)
-forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,
+forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info *compptr,
JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
JDIMENSION start_row, JDIMENSION start_col,
JDIMENSION num_blocks)
@@ -585,8 +585,8 @@
{
/* This routine is heavily used, so it's worth coding it tightly. */
my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
- FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no];
- FAST_FLOAT * workspace;
+ FAST_FLOAT *divisors = fdct->float_divisors[compptr->quant_tbl_no];
+ FAST_FLOAT *workspace;
JDIMENSION bi;