From 9f044c17fa2d571d70b2675d6e332f3bb062a8df Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Tue, 7 Dec 2010 14:59:43 -0600 Subject: [PATCH] [devel] Added some whitespace in png.h and pngpriv.h, revised a comment in pngvalid.c --- png.h | 63 ++++++++++++++++++++++++++++-------------------------- pngpriv.h | 13 ++++++----- pngvalid.c | 2 +- 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/png.h b/png.h index 1a1d866e8..9f9c8bc68 100644 --- a/png.h +++ b/png.h @@ -767,11 +767,11 @@ typedef png_info FAR * FAR * png_infopp; */ typedef struct png_row_info_struct { - png_uint_32 width; /* width of row */ - png_size_t rowbytes; /* number of bytes in row */ - png_byte color_type; /* color type of row */ - png_byte bit_depth; /* bit depth of row */ - png_byte channels; /* number of channels (1, 2, 3, or 4) */ + png_uint_32 width; /* width of row */ + png_size_t rowbytes; /* number of bytes in row */ + png_byte color_type; /* color type of row */ + png_byte bit_depth; /* bit depth of row */ + png_byte channels; /* number of channels (1, 2, 3, or 4) */ png_byte pixel_depth; /* bits per pixel (depth * channels) */ } png_row_info; @@ -800,15 +800,16 @@ typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32, #ifdef PNG_PROGRESSIVE_READ_SUPPORTED typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop), ); -typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop), ); -typedef PNG_CALLBACK(void, *png_progressive_row_ptr, (png_structp, png_bytep, - png_uint_32, int), ); +typedef PNG_CALLBACK(void, *png_progressive_end_ptr, + (png_structp, png_infop), ); +typedef PNG_CALLBACK(void, *png_progressive_row_ptr, + (png_structp, png_bytep, png_uint_32, int), ); #endif #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) -typedef PNG_CALLBACK(void, *png_user_transform_ptr, (png_structp, png_row_infop, - png_bytep), ); +typedef PNG_CALLBACK(void, *png_user_transform_ptr, + (png_structp, png_row_infop, png_bytep), ); #endif #ifdef PNG_USER_CHUNKS_SUPPORTED @@ -818,6 +819,7 @@ typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp, #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp), ); #endif + #ifdef PNG_SETJMP_SUPPORTED /* This must match the function definition in , and the * application must include this before png.h to obtain the definition @@ -1125,21 +1127,22 @@ PNG_EXPORT(44, void, png_set_shift, (png_structp png_ptr, png_const_color_8p #if defined(PNG_READ_INTERLACING_SUPPORTED) || \ defined(PNG_WRITE_INTERLACING_SUPPORTED) /* Have the code handle the interlacing. Returns the number of passes. - * MUST be called before png_read_update_info or png_start_read_image, otherwise - * it will not have the desired effect. Note that it is still necessary to call - * png_read_row or png_read_rows png_get_image_height times for each pass. - */ + * MUST be called before png_read_update_info or png_start_read_image, + * otherwise it will not have the desired effect. Note that it is still + * necessary to call png_read_row or png_read_rows png_get_image_height + * times for each pass. +*/ PNG_EXPORT(45, int, png_set_interlace_handling, (png_structp png_ptr)); #endif #ifdef PNG_SEQUENTIAL_READ_SUPPORTED -/* Alternatively call this to get the number of rows in the current pass. Call - * this after png_read_update_info or png_start_read_image; if you call it - * before it will just return the image height (which is also what it returns - * for a non-interlaced image!). +/* Alternatively call this to get the number of rows in the current pass. + * Call this after png_read_update_info or png_start_read_image; if you + * call it before it will just return the image height (which is also what + * it returns for a non-interlaced image!). * - * NOTE: you need to call these to find out how many times to call png_read_row - * if you handle your own de-interlacing. + * NOTE: you need to call these to find out how many times to call + * png_read_row if you handle your own de-interlacing. */ PNG_EXPORT(215, int, png_get_num_passes, (png_structp png_ptr)); PNG_EXPORT(216, png_uint_32, png_get_num_rows, (png_structp png_ptr)); @@ -1196,7 +1199,6 @@ PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structp png_ptr, png_fixed_point screen_gamma, png_fixed_point default_file_gamma)); #endif - #ifdef PNG_WRITE_FLUSH_SUPPORTED /* Set how many lines between output flushes - 0 for no flushing */ PNG_EXPORT(51, void, png_set_flush, (png_structp png_ptr, int nrows)); @@ -1232,9 +1234,9 @@ PNG_EXPORT(57, void, png_read_image, (png_structp png_ptr, png_bytepp image)); PNG_EXPORT(58, void, png_write_row, (png_structp png_ptr, png_const_bytep row)); -/* Write a few rows of image data: (*row) is not written; however, the type is - * declared as writeable to maintain compatibility with previous versions of - * libpng and to allow the 'display_row' array from read_rows to be passed +/* Write a few rows of image data: (*row) is not written; however, the type + * is declared as writeable to maintain compatibility with previous versions + * of libpng and to allow the 'display_row' array from read_rows to be passed * unchanged to write_rows. */ PNG_EXPORT(59, void, png_write_rows, (png_structp png_ptr, png_bytepp row, @@ -1269,7 +1271,7 @@ PNG_EXPORT(65, void, png_destroy_write_struct, (png_structpp png_ptr_ptr, PNG_EXPORT(66, void, png_set_crc_action, (png_structp png_ptr, int crit_action, int ancil_action)); -/* Values for png_set_crc_action() to say how to handle CRC errors in +/* Values for png_set_crc_action() say how to handle CRC errors in * ancillary and critical chunks, and whether to use the data contained * therein. Note that it is impossible to "discard" data in a critical * chunk. For versions prior to 0.90, the action was always error/quit, @@ -1495,9 +1497,10 @@ PNG_EXPORT(92, void, png_process_data, (png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); -/* Function that combines rows. 'new_row' is a flag that should come from the - * callback and be non-NULL if anything needs to be done; the library stores its - * own version of the new data internally and ignores the passed in value. +/* Function that combines rows. 'new_row' is a flag that should come from + * the callback and be non-NULL if anything needs to be done; the library + * stores its own version of the new data internally and ignores the passed + * in value. */ PNG_EXPORT(93, void, png_progressive_combine_row, (png_structp png_ptr, png_bytep old_row, png_const_bytep new_row)); @@ -2167,8 +2170,8 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); * defs */ -/* The last ordinal number (this is the *last* one; the next one to - * use is one more than this.) +/* The last ordinal number (this is the *last* one already used; the next + * one to use is one more than this.) */ #ifdef PNG_EXPORT_LAST_ORDINAL PNG_EXPORT_LAST_ORDINAL(218); diff --git a/pngpriv.h b/pngpriv.h index 1054af942..a64764cab 100644 --- a/pngpriv.h +++ b/pngpriv.h @@ -63,9 +63,10 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; #endif /* Moved to pngpriv.h at libpng-1.5.0 */ -/* NOTE: some of these may be used in external applications as these definitions - * were exposed in pngconf.h prior to 1.5. +/* NOTE: some of these may have been used in external applications as + * these definitions were exposed in pngconf.h prior to 1.5. */ + /* If you are running on a machine where you cannot allocate more * than 64K of memory at once, uncomment this. While libpng will not * normally need that much memory in a chunk (unless you load up a very @@ -116,7 +117,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; * aren't usually used outside the library (as far as I know), so it is * debatable if they should be exported at all. In the future, when it * is possible to have run-time registry of chunk-handling functions, - * some of these will be made available again. + * some of these might be made available again. # define PNG_EXTERN extern */ # define PNG_EXTERN @@ -256,6 +257,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; /* CONSTANTS and UTILITY MACROS * These are used internally by libpng and not exposed in the API */ + /* Various modes of operation. Note that after an init, mode is set to * zero automatically when the structure is created. */ @@ -408,8 +410,9 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; * its argument multiple times, so must be used with care. The * range checking uses the PNG specification values for a signed * 32 bit fixed point value except that the values are deliberately - * rounded-to-zero to an integral value - 21474. 's' is a string - * that describes the value being converted. + * rounded-to-zero to an integral value - 21474 (21474.83 is roughly + * (2^31-1) * 100000). 's' is a string that describes the value being + * converted. * * NOTE: this macro will raise a png_error if the range check fails, * therefore it is normally only appropriate to use this on values diff --git a/pngvalid.c b/pngvalid.c index a545594f9..440f8d809 100644 --- a/pngvalid.c +++ b/pngvalid.c @@ -3573,7 +3573,7 @@ int main(int argc, PNG_CONST char **argv) * transformations. The practial limits for human perception are described * below (the setting for maxpc16), however for 8 bit encodings it isn't * possible to meet the accepted capabilities of human vision - i.e. 8 bit - * images can never be good enough (regardless of encoding.) + * images can never be good enough, regardless of encoding. */ pm.maxout8 = .1; /* Arithmetic error in *encoded* value */ pm.maxabs8 = .00005; /* 1/20000 */