[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)
@ -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)
{