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.
This commit is contained in:
22
jcphuff.c
22
jcphuff.c
@@ -33,7 +33,7 @@ typedef struct {
|
||||
/* Bit-level coding status.
|
||||
* next_output_byte/free_in_buffer are local copies of cinfo->dest fields.
|
||||
*/
|
||||
JOCTET * next_output_byte; /* => next byte to write in buffer */
|
||||
JOCTET *next_output_byte; /* => next byte to write in buffer */
|
||||
size_t free_in_buffer; /* # of byte spaces remaining in buffer */
|
||||
size_t put_buffer; /* current bit-accumulation buffer */
|
||||
int put_bits; /* # of bits now in it */
|
||||
@@ -46,7 +46,7 @@ typedef struct {
|
||||
int ac_tbl_no; /* the table number of the single component */
|
||||
unsigned int EOBRUN; /* run length of EOBs */
|
||||
unsigned int BE; /* # of buffered correction bits before MCU */
|
||||
char * bit_buffer; /* buffer for correction bits (1 per char) */
|
||||
char *bit_buffer; /* buffer for correction bits (1 per char) */
|
||||
/* packing correction bits tightly would save some space but cost time... */
|
||||
|
||||
unsigned int restarts_to_go; /* MCUs left in this restart interval */
|
||||
@@ -56,13 +56,13 @@ typedef struct {
|
||||
* Since any one scan codes only DC or only AC, we only need one set
|
||||
* of tables, not one for DC and one for AC.
|
||||
*/
|
||||
c_derived_tbl * derived_tbls[NUM_HUFF_TBLS];
|
||||
c_derived_tbl *derived_tbls[NUM_HUFF_TBLS];
|
||||
|
||||
/* Statistics tables for optimization; again, one set is enough */
|
||||
long * count_ptrs[NUM_HUFF_TBLS];
|
||||
long *count_ptrs[NUM_HUFF_TBLS];
|
||||
} phuff_entropy_encoder;
|
||||
|
||||
typedef phuff_entropy_encoder * phuff_entropy_ptr;
|
||||
typedef phuff_entropy_encoder *phuff_entropy_ptr;
|
||||
|
||||
/* MAX_CORR_BITS is the number of bits the AC refinement correction-bit
|
||||
* buffer can hold. Larger sizes may slightly improve compression, but
|
||||
@@ -111,7 +111,7 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
|
||||
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
|
||||
boolean is_DC_band;
|
||||
int ci, tbl;
|
||||
jpeg_component_info * compptr;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
entropy->cinfo = cinfo;
|
||||
entropy->gather_statistics = gather_statistics;
|
||||
@@ -208,7 +208,7 @@ LOCAL(void)
|
||||
dump_buffer (phuff_entropy_ptr entropy)
|
||||
/* Empty the output buffer; we do not support suspension in this module. */
|
||||
{
|
||||
struct jpeg_destination_mgr * dest = entropy->cinfo->dest;
|
||||
struct jpeg_destination_mgr *dest = entropy->cinfo->dest;
|
||||
|
||||
if (! (*dest->empty_output_buffer) (entropy->cinfo))
|
||||
ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND);
|
||||
@@ -284,7 +284,7 @@ emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol)
|
||||
if (entropy->gather_statistics)
|
||||
entropy->count_ptrs[tbl_no][symbol]++;
|
||||
else {
|
||||
c_derived_tbl * tbl = entropy->derived_tbls[tbl_no];
|
||||
c_derived_tbl *tbl = entropy->derived_tbls[tbl_no];
|
||||
emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]);
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol)
|
||||
*/
|
||||
|
||||
LOCAL(void)
|
||||
emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart,
|
||||
emit_buffered_bits (phuff_entropy_ptr entropy, char *bufstart,
|
||||
unsigned int nbits)
|
||||
{
|
||||
if (entropy->gather_statistics)
|
||||
@@ -383,7 +383,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
int blkn, ci;
|
||||
int Al = cinfo->Al;
|
||||
JBLOCKROW block;
|
||||
jpeg_component_info * compptr;
|
||||
jpeg_component_info *compptr;
|
||||
ISHIFT_TEMPS
|
||||
|
||||
entropy->next_output_byte = cinfo->dest->next_output_byte;
|
||||
@@ -770,7 +770,7 @@ finish_pass_gather_phuff (j_compress_ptr cinfo)
|
||||
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
|
||||
boolean is_DC_band;
|
||||
int ci, tbl;
|
||||
jpeg_component_info * compptr;
|
||||
jpeg_component_info *compptr;
|
||||
JHUFF_TBL **htblptr;
|
||||
boolean did[NUM_HUFF_TBLS];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user