[libpng17] Fixed some indentation to comply with our coding style (synced

with libpng-1.6.24beta05).
This commit is contained in:
Glenn Randers-Pehrson 2016-07-13 15:27:04 -05:00
parent 83ca33b017
commit f1fb09c406
9 changed files with 137 additions and 136 deletions

View File

@ -1391,6 +1391,7 @@ Version 1.7.0beta82 [July 4, 2016]
Fixed two Coverity issues in pngcp.c.
Version 1.7.0beta83 [July 4, 2016]
Fixed some indentation to comply with our coding style.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -5691,6 +5691,7 @@ Version 1.7.0beta82 [July 4, 2016]
Fixed two Coverity issues in pngcp.c.
Version 1.7.0beta83 [July 4, 2016]
Fixed some indentation to comply with our coding style.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -375,7 +375,7 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
* low byte.
*/
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
png_set_scale_16(png_ptr);
png_set_scale_16(png_ptr);
#else
png_set_strip_16(png_ptr);
#endif
@ -383,12 +383,12 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
/* Strip alpha bytes from the input data without combining with the
* background (not recommended).
*/
png_set_strip_alpha(png_ptr);
png_set_strip_alpha(png_ptr);
/* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
* byte into separate bytes (useful for paletted and grayscale images).
*/
png_set_packing(png_ptr);
png_set_packing(png_ptr);
/* Change the order of packed pixels to least significant bit first
* (not useful if you are using png_set_packing). */
@ -988,11 +988,11 @@ void write_png(char *file_name /* , ... other image information ... */)
png_bytep row_pointers[height];
if (height > PNG_UINT_32_MAX/(sizeof (png_bytep)))
png_error (png_ptr, "Image is too tall to process in memory");
png_error (png_ptr, "Image is too tall to process in memory");
/* Set up pointers into your "image" byte array */
for (k = 0; k < height; k++)
row_pointers[k] = image + k*width*bytes_per_pixel;
row_pointers[k] = image + k*width*bytes_per_pixel;
/* One of the following output methods is REQUIRED */

17
png.h
View File

@ -286,8 +286,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.7.0beta83"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.7.0beta83 - July 4, 2016\n"
#define PNG_HEADER_VERSION_STRING " libpng version 1.7.0beta83 - July 4, 2016\n"
#define PNG_LIBPNG_VER_SONUM 17
#define PNG_LIBPNG_VER_DLLNUM 17
@ -332,14 +331,14 @@
* the library has been built.
*/
#ifndef PNGLCONF_H
/* If pnglibconf.h is missing, you can
* copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
*/
/* If pnglibconf.h is missing, you can
* copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
*/
# include "pnglibconf.h"
#endif
#ifndef PNG_VERSION_INFO_ONLY
/* Machine specific configuration. */
/* Machine specific configuration. */
# include "pngconf.h"
#endif
@ -3872,9 +3871,9 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\
((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\
(((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\
12U+3U*(image).colormap_entries/*PLTE data*/+\
(((image).format&PNG_FORMAT_FLAG_ALPHA)?\
12U/*tRNS*/+(image).colormap_entries:0U):0U)+\
12U+3U*(image).colormap_entries/*PLTE data*/+\
(((image).format&PNG_FORMAT_FLAG_ALPHA)?\
12U/*tRNS*/+(image).colormap_entries:0U):0U)+\
12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size))
/* A helper for the following macro; if your compiler cannot handle the
* following macro use this one with the result of

View File

@ -188,27 +188,27 @@
* compatible with GCC or Visual C because of different calling conventions.
*/
# if PNG_API_RULE == 2
/* If this line results in an error, either because __watcall is not
* understood or because of a redefine just below you cannot use *this*
* build of the library with the compiler you are using. *This* build was
* build using Watcom and applications must also be built using Watcom!
*/
/* If this line results in an error, either because __watcall is not
* understood or because of a redefine just below you cannot use *this*
* build of the library with the compiler you are using. *This* build was
* build using Watcom and applications must also be built using Watcom!
*/
# define PNGCAPI __watcall
# endif
# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
# define PNGCAPI __cdecl
# if PNG_API_RULE == 1
/* If this line results in an error __stdcall is not understood and
* PNG_API_RULE should not have been set to '1'.
*/
/* If this line results in an error __stdcall is not understood and
* PNG_API_RULE should not have been set to '1'.
*/
# define PNGAPI __stdcall
# endif
# else
/* An older compiler, or one not detected (erroneously) above,
* if necessary override on the command line to get the correct
* variants for the compiler.
*/
/* An older compiler, or one not detected (erroneously) above,
* if necessary override on the command line to get the correct
* variants for the compiler.
*/
# ifndef PNGCAPI
# define PNGCAPI _cdecl
# endif
@ -225,10 +225,10 @@
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
(defined(__BORLANDC__) && __BORLANDC__ < 0x500)
/* older Borland and MSC
* compilers used '__export' and required this to be after
* the type.
*/
/* older Borland and MSC
* compilers used '__export' and required this to be after
* the type.
*/
# ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
# endif
@ -244,9 +244,9 @@
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
# define PNGAPI _System
# else /* !Windows/x86 && !OS/2 */
/* Use the defaults, or define PNG*API on the command line (but
* this will have to be done for every compile!)
*/
/* Use the defaults, or define PNG*API on the command line (but
* this will have to be done for every compile!)
*/
# endif /* other system, !OS/2 */
#endif /* !Windows/x86 */
@ -267,7 +267,7 @@
*/
#ifndef PNG_IMPEXP
# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
/* This forces use of a DLL, disallowing static linking */
/* This forces use of a DLL, disallowing static linking */
# define PNG_IMPEXP PNG_DLL_IMPORT
# endif
@ -340,7 +340,7 @@
* less efficient code.
*/
# if defined(__clang__) && defined(__has_attribute)
/* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
/* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
# endif

View File

@ -1083,7 +1083,7 @@ PNG_INTERNAL_FUNCTION(void,png_write_sBIT,(png_structrp png_ptr,
#ifdef PNG_WRITE_cHRM_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_cHRM_fixed,(png_structrp png_ptr,
const png_xy *xy), PNG_EMPTY);
/* The xy value must have been previously validated */
/* The xy value must have been previously validated */
#endif
#ifdef PNG_WRITE_sRGB_SUPPORTED
@ -1769,13 +1769,13 @@ PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr,
PNG_INTERNAL_FUNCTION(void,png_colorspace_sync_info,(png_const_structrp png_ptr,
png_inforp info_ptr), PNG_EMPTY);
/* Synchronize the info 'valid' flags with the colorspace */
/* Synchronize the info 'valid' flags with the colorspace */
PNG_INTERNAL_FUNCTION(void,png_colorspace_sync,(png_const_structrp png_ptr,
png_inforp info_ptr), PNG_EMPTY);
/* Copy the png_struct colorspace to the info_struct and call the above to
* synchronize the flags. Checks for NULL info_ptr and does nothing.
*/
/* Copy the png_struct colorspace to the info_struct and call the above to
* synchronize the flags. Checks for NULL info_ptr and does nothing.
*/
#endif
/* Added at libpng version 1.4.0 */

View File

@ -1412,7 +1412,7 @@ png_image_skip_unused_chunks(png_structrp png_ptr)
/* But do not ignore image data handling chunks */
png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_AS_DEFAULT,
chunks_to_process, (int)/*SAFE*/(sizeof chunks_to_process)/5);
}
}
}
# define PNG_SKIP_CHUNKS(p) png_image_skip_unused_chunks(p)

View File

@ -304,10 +304,10 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
length = strlen(units) + 1;
png_debug1(3, "allocating units for info (%lu bytes)",
(unsigned long)length);
(unsigned long)length);
info_ptr->pcal_units = png_voidcast(png_charp,
png_malloc_warn(png_ptr, length));
png_malloc_warn(png_ptr, length));
if (info_ptr->pcal_units == NULL)
{
@ -1624,7 +1624,7 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_alloc_size_t size)
png_error(png_ptr, "invalid compression buffer size");
# if (defined PNG_SEQUENTIAL_READ_SUPPORTED) || defined PNG_WRITE_SUPPORTED
png_ptr->IDAT_size = (png_uint_32)/*SAFE*/size;
png_ptr->IDAT_size = (png_uint_32)/*SAFE*/size;
# endif /* SEQUENTIAL_READ || WRITE */
}

184
pngtest.c
View File

@ -130,13 +130,13 @@ static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present";
static int
tIME_to_str(png_structp png_ptr, png_charp ts, png_const_timep t)
{
png_const_charp str = png_convert_to_rfc1123(png_ptr, t);
png_const_charp str = png_convert_to_rfc1123(png_ptr, t);
if (str == NULL)
return 0;
if (str == NULL)
return 0;
strcpy(ts, str);
return 1;
strcpy(ts, str);
return 1;
}
#endif /* older libpng */
#endif
@ -240,95 +240,95 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
* png_byte pixel_depth bits per pixel (depth*channels)
*/
/* Counts the number of zero samples (or zero pixels if color_type is 3 */
/* Counts the number of zero samples (or zero pixels if color_type is 3 */
if (row_info->color_type == 0 || row_info->color_type == 3)
{
int pos = 0;
png_uint_32 n, nstop;
if (row_info->color_type == 0 || row_info->color_type == 3)
{
int pos = 0;
png_uint_32 n, nstop;
for (n = 0, nstop=row_info->width; n<nstop; n++)
{
if (row_info->bit_depth == 1)
{
if (((*dp << pos++ ) & 0x80) == 0)
zero_samples++;
for (n = 0, nstop=row_info->width; n<nstop; n++)
{
if (row_info->bit_depth == 1)
{
if (((*dp << pos++ ) & 0x80) == 0)
zero_samples++;
if (pos == 8)
{
pos = 0;
dp++;
}
}
if (pos == 8)
{
pos = 0;
dp++;
}
}
if (row_info->bit_depth == 2)
{
if (((*dp << (pos+=2)) & 0xc0) == 0)
zero_samples++;
if (row_info->bit_depth == 2)
{
if (((*dp << (pos+=2)) & 0xc0) == 0)
zero_samples++;
if (pos == 8)
{
pos = 0;
dp++;
}
}
if (pos == 8)
{
pos = 0;
dp++;
}
}
if (row_info->bit_depth == 4)
{
if (((*dp << (pos+=4)) & 0xf0) == 0)
zero_samples++;
if (row_info->bit_depth == 4)
{
if (((*dp << (pos+=4)) & 0xf0) == 0)
zero_samples++;
if (pos == 8)
{
pos = 0;
dp++;
}
}
if (pos == 8)
{
pos = 0;
dp++;
}
}
if (row_info->bit_depth == 8)
if (*dp++ == 0)
zero_samples++;
if (row_info->bit_depth == 8)
if (*dp++ == 0)
zero_samples++;
if (row_info->bit_depth == 16)
{
if ((*dp | *(dp+1)) == 0)
zero_samples++;
dp+=2;
}
}
}
else /* Other color types */
{
png_uint_32 n, nstop;
int channel;
int color_channels = row_info->channels;
if (row_info->color_type > 3)
color_channels--;
if (row_info->bit_depth == 16)
{
if ((*dp | *(dp+1)) == 0)
zero_samples++;
dp+=2;
}
}
}
else /* Other color types */
{
png_uint_32 n, nstop;
int channel;
int color_channels = row_info->channels;
if (row_info->color_type > 3)
color_channels--;
for (n = 0, nstop=row_info->width; n<nstop; n++)
{
for (channel = 0; channel < color_channels; channel++)
{
if (row_info->bit_depth == 8)
if (*dp++ == 0)
zero_samples++;
for (n = 0, nstop=row_info->width; n<nstop; n++)
{
for (channel = 0; channel < color_channels; channel++)
{
if (row_info->bit_depth == 8)
if (*dp++ == 0)
zero_samples++;
if (row_info->bit_depth == 16)
{
if ((*dp | *(dp+1)) == 0)
zero_samples++;
if (row_info->bit_depth == 16)
{
if ((*dp | *(dp+1)) == 0)
zero_samples++;
dp+=2;
}
}
if (row_info->color_type > 3)
{
dp++;
if (row_info->bit_depth == 16)
dp++;
}
}
}
dp+=2;
}
}
if (row_info->color_type > 3)
{
dp++;
if (row_info->bit_depth == 16)
dp++;
}
}
}
}
#endif /* WRITE_USER_TRANSFORM */
@ -926,7 +926,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
init_callback_info(read_info_ptr);
png_set_read_user_chunk_fn(read_ptr, &user_chunk_data,
read_user_chunk_callback);
read_user_chunk_callback);
#endif
#ifdef PNG_SETJMP_SUPPORTED
@ -1851,19 +1851,19 @@ main(int argc, char *argv[])
}
if (multiple == 0 && argc == 3 + verbose)
outname = argv[2 + verbose];
outname = argv[2 + verbose];
if ((multiple == 0 && argc > 3 + verbose) ||
(multiple != 0 && argc < 2))
{
fprintf(STDERR,
"usage: %s [infile.png] [outfile.png]\n\t%s -m {infile.png}\n",
argv[0], argv[0]);
fprintf(STDERR,
" reads/writes one PNG file (without -m) or multiple files (-m)\n");
fprintf(STDERR,
" with -m %s is used as a temporary file\n", outname);
exit(1);
fprintf(STDERR,
"usage: %s [infile.png] [outfile.png]\n\t%s -m {infile.png}\n",
argv[0], argv[0]);
fprintf(STDERR,
" reads/writes one PNG file (without -m) or multiple files (-m)\n");
fprintf(STDERR,
" with -m %s is used as a temporary file\n", outname);
exit(1);
}
if (multiple != 0)