[devel] Expand tabs and use consistent whitespace in pngrutil.c

This commit is contained in:
Glenn Randers-Pehrson 2010-03-06 08:18:03 -06:00
parent 16908a1d78
commit 72cda2db72

View File

@ -232,7 +232,8 @@ png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
if (output != 0 && output_size > count)
{
int copy = output_size - count;
if (avail < copy) copy = avail;
if (avail < copy)
copy = avail;
png_memcpy(output + count, png_ptr->zbuf, copy);
}
count += avail;
@ -284,7 +285,7 @@ png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
png_warning(png_ptr, msg);
}
/* 0 means an error - notice that this code simple ignores
/* 0 means an error - notice that this code simply ignores
* zero length compressed chunks as a result.
*/
return 0;
@ -316,7 +317,8 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
png_size_t expanded_size = png_inflate(png_ptr,
(png_bytep)(png_ptr->chunkdata + prefix_size),
chunklength - prefix_size,
0/*output*/, 0/*output size*/);
0, /*output*/
0); /*output size*/
/* Now check the limits on this chunk - if the limit fails the
* compressed data will be removed, the prefix will remain.
@ -372,7 +374,8 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
char umsg[50];
#ifdef PNG_STDIO_SUPPORTED
png_snprintf(umsg, sizeof umsg, "Unknown zTXt compression type %d", comp_type);
png_snprintf(umsg, sizeof umsg,
"Unknown zTXt compression type %d", comp_type);
png_warning(png_ptr, umsg);
#else
png_warning(png_ptr, "Unknown zTXt compression type");
@ -560,7 +563,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
/* If we actually NEED the PLTE chunk (ie for a paletted image), we do
/* If we actually need the PLTE chunk (ie for a paletted image), we do
* whatever the normal CRC configuration tells us. However, if we
* have an RGB image, the PLTE can be considered ancillary, so
* we will act as though it is.
@ -575,9 +578,10 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */
{
/* If we don't want to use the data from an ancillary chunk,
we have two options: an error abort, or a warning and we
ignore the data in this chunk (which should be OK, since
it's considered ancillary for a RGB or RGBA image). */
* we have two options: an error abort, or a warning and we
* ignore the data in this chunk (which should be OK, since
* it's considered ancillary for a RGB or RGBA image).
*/
if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE))
{
if (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)
@ -1108,9 +1112,9 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Check the profile_size recorded in the first 32 bits of the ICC profile */
pC = (png_bytep)(png_ptr->chunkdata + prefix_length);
profile_size = ((*(pC ))<<24) |
((*(pC + 1))<<16) |
((*(pC + 2))<< 8) |
profile_size = ((*(pC )) << 24) |
((*(pC + 1)) << 16) |
((*(pC + 2)) << 8) |
((*(pC + 3)) );
if (profile_size < profile_length)
@ -1224,7 +1228,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
new_palette.depth = *entry_start++;
entry_size = (new_palette.depth == 8 ? 6 : 10);
entry_size = (new_palette.depth == 8? 6 : 10);
data_length = (slength - (entry_start - (png_bytep)png_ptr->chunkdata));
/* Integrity-check the data length */
@ -1453,7 +1457,8 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* We convert the index value into RGB components so that we can allow
* arbitrary RGB values for background when we have transparency, and
* so it is easy to determine the RGB values of the background color
* from the info_ptr struct. */
* from the info_ptr struct.
*/
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
png_ptr->background.index = buf[0];
@ -1687,7 +1692,8 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
endptr = png_ptr->chunkdata + slength;
/* We need to have at least 12 bytes after the purpose string
in order to get the parameter information. */
* in order to get the parameter information.
*/
if (endptr <= buf + 12)
{
png_warning(png_ptr, "Invalid pCAL data");
@ -1705,7 +1711,8 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(3, "Checking pCAL equation type and number of parameters");
/* Check that we have the right number of parameters for known
equation types. */
* equation types.
*/
if ((type == PNG_EQUATION_LINEAR && nparams != 2) ||
(type == PNG_EQUATION_BASE_E && nparams != 3) ||
(type == PNG_EQUATION_ARBITRARY && nparams != 3) ||
@ -2091,7 +2098,8 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_MAX_MALLOC_64K
/* We will no doubt have problems with chunks even half this size, but
there is no hard and fast rule to tell us where to stop. */
* there is no hard and fast rule to tell us where to stop.
*/
if (length > (png_uint_32)65535L)
{
png_warning(png_ptr, "zTXt chunk too large to fit in memory");
@ -2212,7 +2220,8 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_MAX_MALLOC_64K
/* We will no doubt have problems with chunks even half this size, but
there is no hard and fast rule to tell us where to stop. */
* there is no hard and fast rule to tell us where to stop.
*/
if (length > (png_uint_32)65535L)
{
png_warning(png_ptr, "iTXt chunk too large to fit in memory");
@ -2320,10 +2329,11 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
/* This function is called when we haven't found a handler for a
chunk. If there isn't a problem with the chunk itself (ie bad
chunk name, CRC, or a critical chunk), the chunk is silently ignored
-- unless the PNG_FLAG_UNKNOWN_CHUNKS_SUPPORTED flag is on in which
case it will be saved away to be written out later. */
* chunk. If there isn't a problem with the chunk itself (ie bad
* chunk name, CRC, or a critical chunk), the chunk is silently ignored
* -- unless the PNG_FLAG_UNKNOWN_CHUNKS_SUPPORTED flag is on in which
* case it will be saved away to be written out later.
*/
void /* PRIVATE */
png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -2435,10 +2445,11 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
/* This function is called to verify that a chunk name is valid.
This function can't have the "critical chunk check" incorporated
into it, since in the future we will need to be able to call user
functions to handle unknown critical chunks after we check that
the chunk name itself is valid. */
* This function can't have the "critical chunk check" incorporated
* into it, since in the future we will need to be able to call user
* functions to handle unknown critical chunks after we check that
* the chunk name itself is valid.
*/
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
@ -2454,15 +2465,16 @@ png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
}
/* Combines the row recently read in with the existing pixels in the
row. This routine takes care of alpha and transparency if requested.
This routine also handles the two methods of progressive display
of interlaced images, depending on the mask value.
The mask value describes which pixels are to be combined with
the row. The pattern always repeats every 8 pixels, so just 8
bits are needed. A one indicates the pixel is to be combined,
a zero indicates the pixel is to be skipped. This is in addition
to any alpha or transparency value associated with the pixel. If
you want all pixels to be combined, pass 0xff (255) in mask. */
* row. This routine takes care of alpha and transparency if requested.
* This routine also handles the two methods of progressive display
* of interlaced images, depending on the mask value.
* The mask value describes which pixels are to be combined with
* the row. The pattern always repeats every 8 pixels, so just 8
* bits are needed. A one indicates the pixel is to be combined,
* a zero indicates the pixel is to be skipped. This is in addition
* to any alpha or transparency value associated with the pixel. If
* you want all pixels to be combined, pass 0xff (255) in mask.
*/
void /* PRIVATE */
png_combine_row(png_structp png_ptr, png_bytep row, int mask)
@ -2666,10 +2678,6 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
}
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* OLD pre-1.0.9 interface:
void png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
png_uint_32 transformations)
*/
void /* PRIVATE */
png_do_read_interlace(png_structp png_ptr)
{
@ -2986,9 +2994,9 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
pb = abs(pc);
pc = abs(p + pc);
#else
pa = p < 0 ? -p : p;
pb = pc < 0 ? -pc : pc;
pc = (p + pc) < 0 ? -(p + pc) : p + pc;
pa = p < 0? -p : p;
pb = pc < 0? -pc : pc;
pc = (p + pc) < 0? -(p + pc) : p + pc;
#endif
/*
@ -3000,7 +3008,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
p = c;
*/
p = (pa <= pb && pa <= pc) ? a : (pb <= pc) ? b : c;
p = (pa <= pb && pa <= pc)? a : (pb <= pc) ? b : c;
*rp = (png_byte)(((int)(*rp) + p) & 0xff);
rp++;
@ -3117,7 +3125,7 @@ png_read_finish_row(png_structp png_ptr)
break;
}
if (ret != Z_OK)
png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg :
png_error(png_ptr, png_ptr->zstream.msg? png_ptr->zstream.msg :
"Decompression Error");
if (!(png_ptr->zstream.avail_out))