More cosmetic reformatting

Broke several remaining "if () statement;" and "else statement;" into
two lines.
This commit is contained in:
Glenn Randers-Pehrson 2009-05-30 20:19:20 -05:00
parent 45ae51743b
commit d8eb62ff15
7 changed files with 48 additions and 35 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.4.0beta62 - May 29, 2009 Libpng 1.4.0beta62 - May 31, 2009
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@ -466,9 +466,10 @@ version 1.4.0beta61 [May 20, 2009]
accordingly. accordingly.
More reformatting of comments, mostly to capitalize sentences. More reformatting of comments, mostly to capitalize sentences.
version 1.4.0beta62 [May 29, 2009] version 1.4.0beta62 [May 31, 2009]
Added "#define PNG_NO_WRITE_SWAP" to contrib/pngminim/encoder/pngusr.h Added "#define PNG_NO_WRITE_SWAP" to contrib/pngminim/encoder/pngusr.h
and "define PNG_NO_READ_SWAP" to decoder/pngusr.h and preader/pngusr.h and "define PNG_NO_READ_SWAP" to decoder/pngusr.h and preader/pngusr.h
Reformatted several remaining "else statement" into two lines.
version 1.4.0betaN [future] version 1.4.0betaN [future]
Build shared libraries with -lz and sometimes -lm. Build shared libraries with -lz and sometimes -lm.

View File

@ -2143,9 +2143,10 @@ version 1.4.0beta61 [May 20, 2009]
accordingly. accordingly.
More reformatting of comments, mostly to capitalize sentences. More reformatting of comments, mostly to capitalize sentences.
version 1.4.0beta62 [May 29, 2009] version 1.4.0beta62 [May 31, 2009]
Added "#define PNG_NO_WRITE_SWAP" to contrib/pngminim/encoder/pngusr.h Added "#define PNG_NO_WRITE_SWAP" to contrib/pngminim/encoder/pngusr.h
and "define PNG_NO_READ_SWAP" to decoder/pngusr.h and preader/pngusr.h and "define PNG_NO_READ_SWAP" to decoder/pngusr.h and preader/pngusr.h
Reformatted several remaining "else statement" into two lines.
version 1.4.0betaN [future] version 1.4.0betaN [future]
Build shared libraries with -lz and sometimes -lm. Build shared libraries with -lz and sometimes -lm.

View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.4.0 [May 20, 2009] * Last changed in libpng 1.4.0 [May 31, 2009]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -121,7 +121,8 @@ png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER) if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0); return (0);
else return (info_ptr->x_pixels_per_unit); else
return (info_ptr->x_pixels_per_unit);
} }
#else #else
return (0); return (0);
@ -141,7 +142,8 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER) if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0); return (0);
else return (info_ptr->y_pixels_per_unit); else
return (info_ptr->y_pixels_per_unit);
} }
#else #else
return (0); return (0);
@ -162,7 +164,8 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit) info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
return (0); return (0);
else return (info_ptr->x_pixels_per_unit); else
return (info_ptr->x_pixels_per_unit);
} }
#else #else
return (0); return (0);
@ -206,7 +209,8 @@ png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0); return (0);
else return (info_ptr->x_offset); else
return (info_ptr->x_offset);
} }
#else #else
return (0); return (0);
@ -227,7 +231,8 @@ png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0); return (0);
else return (info_ptr->y_offset); else
return (info_ptr->y_offset);
} }
#else #else
return (0); return (0);
@ -248,7 +253,8 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0); return (0);
else return (info_ptr->x_offset); else
return (info_ptr->x_offset);
} }
#else #else
return (0); return (0);
@ -269,7 +275,8 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0); return (0);
else return (info_ptr->y_offset); else
return (info_ptr->y_offset);
} }
#else #else
return (0); return (0);

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.4.0 [May 20, 2009] * Last changed in libpng 1.4.0 [May 31, 2009]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -59,7 +59,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return (NULL);
/* added at libpng-1.2.6 */ /* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED #ifdef PNG_SET_USER_LIMITS_SUPPORTED
png_ptr->user_width_max=PNG_USER_WIDTH_MAX; png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
@ -133,7 +133,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
if (!png_cleanup_needed) if (!png_cleanup_needed)
{ {
/* initialize zbuf - compression buffer */ /* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE; png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr, png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr,
png_ptr->zbuf_size); png_ptr->zbuf_size);
@ -403,7 +403,7 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
} }
#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ #endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
/* optional call to update the users info_ptr structure */ /* Optional call to update the users info_ptr structure */
void PNGAPI void PNGAPI
png_read_update_info(png_structp png_ptr, png_infop info_ptr) png_read_update_info(png_structp png_ptr, png_infop info_ptr)
{ {
@ -454,7 +454,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
png_read_start_row(png_ptr); png_read_start_row(png_ptr);
if (png_ptr->row_number == 0 && png_ptr->pass == 0) if (png_ptr->row_number == 0 && png_ptr->pass == 0)
{ {
/* check for transforms that have been set but were defined out */ /* Check for transforms that have been set but were defined out */
#if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED) #if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED)
if (png_ptr->transformations & PNG_INVERT_MONO) if (png_ptr->transformations & PNG_INVERT_MONO)
png_warning(png_ptr, "PNG_READ_INVERT_SUPPORTED is not defined"); png_warning(png_ptr, "PNG_READ_INVERT_SUPPORTED is not defined");
@ -486,7 +486,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
} }
#if defined(PNG_READ_INTERLACING_SUPPORTED) #if defined(PNG_READ_INTERLACING_SUPPORTED)
/* if interlaced and we do not need a new row, combine row and return */ /* If interlaced and we do not need a new row, combine row and return */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{ {
switch (png_ptr->pass) switch (png_ptr->pass)
@ -632,12 +632,12 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
png_do_read_transformations(png_ptr); png_do_read_transformations(png_ptr);
#if defined(PNG_READ_INTERLACING_SUPPORTED) #if defined(PNG_READ_INTERLACING_SUPPORTED)
/* blow up interlaced rows to full size */ /* Blow up interlaced rows to full size */
if (png_ptr->interlaced && if (png_ptr->interlaced &&
(png_ptr->transformations & PNG_INTERLACE)) (png_ptr->transformations & PNG_INTERLACE))
{ {
if (png_ptr->pass < 6) if (png_ptr->pass < 6)
/* old interface (pre-1.0.9): /* Old interface (pre-1.0.9):
* png_do_read_interlace(&(png_ptr->row_info), * png_do_read_interlace(&(png_ptr->row_info),
* png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); * png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
*/ */
@ -954,7 +954,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
} }
#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ #endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
/* free all memory used by the read */ /* Free all memory used by the read */
void PNGAPI void PNGAPI
png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
png_infopp end_info_ptr_ptr) png_infopp end_info_ptr_ptr)
@ -1026,7 +1026,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
} }
} }
/* free all memory used by the read (old method) */ /* Free all memory used by the read (old method) */
void /* PRIVATE */ void /* PRIVATE */
png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr) png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr)
{ {
@ -1193,7 +1193,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
/* invert the alpha channel from opacity to transparency /* Invert the alpha channel from opacity to transparency
*/ */
if (transforms & PNG_TRANSFORM_INVERT_ALPHA) if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
png_set_invert_alpha(png_ptr); png_set_invert_alpha(png_ptr);
@ -1256,7 +1256,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
*/ */
#if defined(PNG_READ_INVERT_SUPPORTED) #if defined(PNG_READ_INVERT_SUPPORTED)
/* invert monochrome files to have 0 as white and 1 as black /* Invert monochrome files to have 0 as white and 1 as black
*/ */
if (transforms & PNG_TRANSFORM_INVERT_MONO) if (transforms & PNG_TRANSFORM_INVERT_MONO)
png_set_invert_mono(png_ptr); png_set_invert_mono(png_ptr);
@ -1278,21 +1278,21 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_READ_BGR_SUPPORTED) #if defined(PNG_READ_BGR_SUPPORTED)
/* flip the RGB pixels to BGR (or RGBA to BGRA) /* Flip the RGB pixels to BGR (or RGBA to BGRA)
*/ */
if (transforms & PNG_TRANSFORM_BGR) if (transforms & PNG_TRANSFORM_BGR)
png_set_bgr(png_ptr); png_set_bgr(png_ptr);
#endif #endif
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR)
*/ */
if (transforms & PNG_TRANSFORM_SWAP_ALPHA) if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
png_set_swap_alpha(png_ptr); png_set_swap_alpha(png_ptr);
#endif #endif
#if defined(PNG_READ_SWAP_SUPPORTED) #if defined(PNG_READ_SWAP_SUPPORTED)
/* swap bytes of 16 bit files to least significant byte first /* Swap bytes of 16 bit files to least significant byte first
*/ */
if (transforms & PNG_TRANSFORM_SWAP_ENDIAN) if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
png_set_swap(png_ptr); png_set_swap(png_ptr);
@ -1336,7 +1336,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr); png_read_end(png_ptr, info_ptr);
transforms = transforms; /* quiet compiler warnings */ transforms = transforms; /* Quiet compiler warnings */
params = params; params = params;
} }

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* Last changed in libpng 1.4.0 [May 20, 2009] * Last changed in libpng 1.4.0 [May 31, 2009]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng /* pngtest.c - a simple test program to test libpng
* *
* Last changed in libpng 1.4.0 [May 20, 2009] * Last changed in libpng 1.4.0 [May 31, 2009]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -210,7 +210,8 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
zero_samples++; zero_samples++;
if (row_info->bit_depth == 16) if (row_info->bit_depth == 16)
{ {
if ((*dp | *(dp+1)) == 0) zero_samples++; if ((*dp | *(dp+1)) == 0)
zero_samples++;
dp+=2; dp+=2;
} }
} }
@ -231,7 +232,8 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
zero_samples++; zero_samples++;
if (row_info->bit_depth == 16) if (row_info->bit_depth == 16)
{ {
if ((*dp | *(dp+1)) == 0) zero_samples++; if ((*dp | *(dp+1)) == 0)
zero_samples++;
dp+=2; dp+=2;
} }
} }
@ -1614,4 +1616,4 @@ main(int argc, char *argv[])
} }
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_4_0beta61 your_png_h_is_not_version_1_4_0beta61; typedef version_1_4_0beta62 your_png_h_is_not_version_1_4_0beta62;

View File

@ -1,7 +1,7 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* Last changed in libpng 1.4.0 [May 20, 2009] * Last changed in libpng 1.4.0 [May 31, 2009]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -47,7 +47,8 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_uint_32 check; png_uint_32 check;
if (png_ptr == NULL) return; if (png_ptr == NULL)
return;
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr)); check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
if (check != length) if (check != length)
png_error(png_ptr, "Write Error"); png_error(png_ptr, "Write Error");
@ -68,7 +69,8 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */ png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
png_FILE_p io_ptr; png_FILE_p io_ptr;
if (png_ptr == NULL) return; if (png_ptr == NULL)
return;
/* Check if data really is near. If so, use usual code. */ /* Check if data really is near. If so, use usual code. */
near_data = (png_byte *)CVT_PTR_NOCHECK(data); near_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);