diff --git a/ANNOUNCE b/ANNOUNCE index 87853866..f82cb503 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -43,6 +43,7 @@ Other information: Changes since the last public release (1.2.39): version 1.2.40beta01 [August 13, 2009] + Removed an extra png_debug() recently added to png_write_find_filter(). Send comments/corrections/commendations to png-mng-implement at lists.sf.net diff --git a/CHANGES b/CHANGES index 98fd8b4b..594828d0 100644 --- a/CHANGES +++ b/CHANGES @@ -2460,6 +2460,7 @@ version 1.2.39 and 1.0.48 [August 13, 2009] No changes. version 1.2.40beta01 [August 13, 2009] + Removed an extra png_debug() recently added to png_write_find_filter(). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngwutil.c b/pngwutil.c index aed280e3..25df2e2d 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -398,6 +398,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, png_byte buf[13]; /* Buffer to store the IHDR info */ png_debug(1, "in png_write_IHDR"); + /* Check that we have valid input data from the application info */ switch (color_type) { @@ -575,6 +576,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) png_byte buf[3]; png_debug(1, "in png_write_PLTE"); + if (( #if defined(PNG_MNG_FEATURES_SUPPORTED) !(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) && @@ -634,6 +636,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) #ifdef PNG_USE_LOCAL_ARRAYS PNG_IDAT; #endif + png_debug(1, "in png_write_IDAT"); /* Optimize the CMF field in the zlib stream. */ @@ -688,7 +691,9 @@ png_write_IEND(png_structp png_ptr) #ifdef PNG_USE_LOCAL_ARRAYS PNG_IEND; #endif + png_debug(1, "in png_write_IEND"); + png_write_chunk(png_ptr, (png_bytep)png_IEND, png_bytep_NULL, (png_size_t)0); png_ptr->mode |= PNG_HAVE_IEND; @@ -707,6 +712,7 @@ png_write_gAMA(png_structp png_ptr, double file_gamma) png_byte buf[4]; png_debug(1, "in png_write_gAMA"); + /* file_gamma is saved in 1/100,000ths */ igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5); png_save_uint_32(buf, igamma); @@ -723,6 +729,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma) png_byte buf[4]; png_debug(1, "in png_write_gAMA"); + /* file_gamma is saved in 1/100,000ths */ png_save_uint_32(buf, (png_uint_32)file_gamma); png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); @@ -741,6 +748,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent) png_byte buf[1]; png_debug(1, "in png_write_sRGB"); + if (srgb_intent >= PNG_sRGB_INTENT_LAST) png_warning(png_ptr, "Invalid sRGB rendering intent specified"); @@ -849,6 +857,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette) #endif png_debug(1, "in png_write_sPLT"); + if ((name_len = png_check_keyword(png_ptr,spalette->name, &new_name))==0) return; @@ -922,6 +931,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type) png_size_t size; png_debug(1, "in png_write_sBIT"); + /* Make sure we don't depend upon the order of PNG_COLOR_8 */ if (color_type & PNG_COLOR_MASK_COLOR) { @@ -1029,6 +1039,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x, png_byte buf[32]; png_debug(1, "in png_write_cHRM"); + /* Each value is saved in 1/100,000ths */ #if !defined(PNG_NO_CHECK_cHRM) if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y, @@ -1065,6 +1076,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, png_byte buf[6]; png_debug(1, "in png_write_tRNS"); + if (color_type == PNG_COLOR_TYPE_PALETTE) { if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette) @@ -1120,6 +1132,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) png_byte buf[6]; png_debug(1, "in png_write_bKGD"); + if (color_type == PNG_COLOR_TYPE_PALETTE) { if ( @@ -1174,6 +1187,7 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) png_byte buf[3]; png_debug(1, "in png_write_hIST"); + if (num_hist > (int)png_ptr->num_palette) { png_debug2(3, "num_hist = %d, num_palette = %d", num_hist, @@ -1214,6 +1228,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) int kwarn=0; png_debug(1, "in png_check_keyword"); + *new_key = NULL; if (key == NULL || (key_len = png_strlen(key)) == 0) @@ -1337,6 +1352,7 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text, png_charp new_key; png_debug(1, "in png_write_tEXt"); + if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0) return; @@ -1525,6 +1541,7 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset, png_byte buf[9]; png_debug(1, "in png_write_oFFs"); + if (unit_type >= PNG_OFFSET_LAST) png_warning(png_ptr, "Unrecognized unit type for oFFs chunk"); @@ -1551,6 +1568,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, int i; png_debug1(1, "in png_write_pCAL (%d parameters)", nparams); + if (type >= PNG_EQUATION_LAST) png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); @@ -1684,6 +1702,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, png_byte buf[9]; png_debug(1, "in png_write_pHYs"); + if (unit_type >= PNG_RESOLUTION_LAST) png_warning(png_ptr, "Unrecognized unit type for pHYs chunk"); @@ -1708,6 +1727,7 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time) png_byte buf[7]; png_debug(1, "in png_write_tIME"); + if (mod_time->month > 12 || mod_time->month < 1 || mod_time->day > 31 || mod_time->day < 1 || mod_time->hour > 23 || mod_time->second > 60) @@ -1752,6 +1772,7 @@ png_write_start_row(png_structp png_ptr) png_size_t buf_size; png_debug(1, "in png_write_start_row"); + buf_size = (png_size_t)(PNG_ROWBYTES( png_ptr->usr_channels*png_ptr->usr_bit_depth, png_ptr->width) + 1); @@ -1852,6 +1873,7 @@ png_write_finish_row(png_structp png_ptr) int ret; png_debug(1, "in png_write_finish_row"); + /* Next row */ png_ptr->row_number++; @@ -1961,6 +1983,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) #endif png_debug(1, "in png_do_write_interlace"); + /* We don't have to do anything on the last pass (6) */ #if defined(PNG_USELESS_TESTS_SUPPORTED) if (row != NULL && row_info != NULL && pass < 6) @@ -2133,8 +2156,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info) png_debug(1, "in png_write_find_filter"); - - png_debug(1, "in png_write_find_filter"); /* Find out how many bytes offset each pixel is */ bpp = (row_info->pixel_depth + 7) >> 3; @@ -2744,6 +2765,7 @@ void /* PRIVATE */ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) { png_debug(1, "in png_write_filtered_row"); + png_debug1(2, "filter = %d", filtered_row[0]); /* Set up the zlib input buffer */