From d8eb62ff15ef12558de1ca64481a5962baa66bfc Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 30 May 2009 20:19:20 -0500 Subject: [PATCH] More cosmetic reformatting Broke several remaining "if () statement;" and "else statement;" into two lines. --- ANNOUNCE | 5 +++-- CHANGES | 3 ++- pngget.c | 23 +++++++++++++++-------- pngread.c | 32 ++++++++++++++++---------------- pngset.c | 2 +- pngtest.c | 10 ++++++---- pngwio.c | 8 +++++--- 7 files changed, 48 insertions(+), 35 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 244b7bf1c..5679476ea 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -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 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. 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 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] Build shared libraries with -lz and sometimes -lm. diff --git a/CHANGES b/CHANGES index 929eda0aa..0a0ac505c 100644 --- a/CHANGES +++ b/CHANGES @@ -2143,9 +2143,10 @@ version 1.4.0beta61 [May 20, 2009] accordingly. 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 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] Build shared libraries with -lz and sometimes -lm. diff --git a/pngget.c b/pngget.c index 8a7d0ef00..3032d1db2 100644 --- a/pngget.c +++ b/pngget.c @@ -1,7 +1,7 @@ /* 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 * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (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) return (0); - else return (info_ptr->x_pixels_per_unit); + else + return (info_ptr->x_pixels_per_unit); } #else 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) return (0); - else return (info_ptr->y_pixels_per_unit); + else + return (info_ptr->y_pixels_per_unit); } #else 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) return (0); - else return (info_ptr->x_pixels_per_unit); + else + return (info_ptr->x_pixels_per_unit); } #else 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) return (0); - else return (info_ptr->x_offset); + else + return (info_ptr->x_offset); } #else 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) return (0); - else return (info_ptr->y_offset); + else + return (info_ptr->y_offset); } #else 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) return (0); - else return (info_ptr->x_offset); + else + return (info_ptr->x_offset); } #else 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) return (0); - else return (info_ptr->y_offset); + else + return (info_ptr->y_offset); } #else return (0); diff --git a/pngread.c b/pngread.c index d5d0067e7..081daa9a6 100644 --- a/pngread.c +++ b/pngread.c @@ -1,7 +1,7 @@ /* 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 * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (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) return (NULL); - /* added at libpng-1.2.6 */ + /* Added at libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED png_ptr->user_width_max=PNG_USER_WIDTH_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) { - /* initialize zbuf - compression buffer */ + /* Initialize zbuf - compression buffer */ png_ptr->zbuf_size = PNG_ZBUF_SIZE; png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr, 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 */ -/* optional call to update the users info_ptr structure */ +/* Optional call to update the users info_ptr structure */ void PNGAPI 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); 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 (png_ptr->transformations & PNG_INVERT_MONO) 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 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)) { 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); #if defined(PNG_READ_INTERLACING_SUPPORTED) - /* blow up interlaced rows to full size */ + /* Blow up interlaced rows to full size */ if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) { 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_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 */ -/* free all memory used by the read */ +/* Free all memory used by the read */ void PNGAPI png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp 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 */ 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) return; #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) 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) - /* 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) png_set_invert_mono(png_ptr); @@ -1278,21 +1278,21 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, #endif #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) png_set_bgr(png_ptr); #endif #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) png_set_swap_alpha(png_ptr); #endif #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) 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 */ png_read_end(png_ptr, info_ptr); - transforms = transforms; /* quiet compiler warnings */ + transforms = transforms; /* Quiet compiler warnings */ params = params; } diff --git a/pngset.c b/pngset.c index 686f6ca54..49fc7759f 100644 --- a/pngset.c +++ b/pngset.c @@ -1,7 +1,7 @@ /* 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 * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngtest.c b/pngtest.c index 0dc8f40e8..e9261235a 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,7 +1,7 @@ /* 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 * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (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++; if (row_info->bit_depth == 16) { - if ((*dp | *(dp+1)) == 0) zero_samples++; + if ((*dp | *(dp+1)) == 0) + zero_samples++; dp+=2; } } @@ -231,7 +232,8 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) zero_samples++; if (row_info->bit_depth == 16) { - if ((*dp | *(dp+1)) == 0) zero_samples++; + if ((*dp | *(dp+1)) == 0) + zero_samples++; 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. */ -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; diff --git a/pngwio.c b/pngwio.c index 57a9719b8..59a2841f9 100644 --- a/pngwio.c +++ b/pngwio.c @@ -1,7 +1,7 @@ /* 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 * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (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; - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr)); if (check != length) 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_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. */ near_data = (png_byte *)CVT_PTR_NOCHECK(data); io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);