diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-02-02 23:11:45 -0600 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2013-03-01 21:38:03 -0600 |
commit | f3af706c2a489333f816843bc986a6bafe47719b (patch) | |
tree | 8fa3603462427abc8d9b3b349df899621975b72c /pngget.c | |
parent | 96cf4bde0e3c65012ba71c9b8dc930138a27ca96 (diff) | |
download | libpng-f3af706c2a489333f816843bc986a6bafe47719b.tar.gz |
[libpng16] Imported from libpng-1.6.0beta05.tarv1.6.1beta05
Diffstat (limited to 'pngget.c')
-rw-r--r-- | pngget.c | 303 |
1 files changed, 128 insertions, 175 deletions
@@ -1,8 +1,8 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.6.1 [(PENDING RELEASE)] - * Copyright (c) 1998-2013 Glenn Randers-Pehrson + * Last changed in libpng 1.6.0 [(PENDING RELEASE)] + * Copyright (c) 1998-2012 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -112,8 +112,7 @@ png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr) } png_uint_32 PNGAPI -png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp - info_ptr) +png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) @@ -130,8 +129,7 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp } png_uint_32 PNGAPI -png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp - info_ptr) +png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) @@ -166,8 +164,7 @@ png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr) #ifdef PNG_FLOATING_POINT_SUPPORTED float PNGAPI -png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp - info_ptr) +png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_READ_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) @@ -178,9 +175,6 @@ png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp return ((float)((float)info_ptr->y_pixels_per_unit /(float)info_ptr->x_pixels_per_unit)); } -#else - PNG_UNUSED(png_ptr) - PNG_UNUSED(info_ptr) #endif return ((float)0.0); @@ -209,9 +203,6 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr, (png_int_32)info_ptr->x_pixels_per_unit)) return res; } -#else - PNG_UNUSED(png_ptr) - PNG_UNUSED(info_ptr) #endif return 0; @@ -431,7 +422,6 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr, #endif /* PNG_EASY_ACCESS_SUPPORTED */ - png_byte PNGAPI png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr) { @@ -441,7 +431,6 @@ png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr) return (0); } -#ifdef PNG_READ_SUPPORTED png_const_bytep PNGAPI png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr) { @@ -450,7 +439,6 @@ png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr) return (NULL); } -#endif #ifdef PNG_bKGD_SUPPORTED png_uint_32 PNGAPI @@ -475,47 +463,87 @@ png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr, * same time to correct the rgb grayscale coefficient defaults obtained from the * cHRM chunk in 1.5.4 */ +png_uint_32 PNGFAPI +png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, + png_fixed_point *int_red_X, png_fixed_point *int_red_Y, + png_fixed_point *int_red_Z, png_fixed_point *int_green_X, + png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, + png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, + png_fixed_point *int_blue_Z) +{ + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) + { + png_xy xy; + png_XYZ XYZ; + + png_debug1(1, "in %s retrieval function", "cHRM_XYZ"); + + xy.whitex = info_ptr->x_white; + xy.whitey = info_ptr->y_white; + xy.redx = info_ptr->x_red; + xy.redy = info_ptr->y_red; + xy.greenx = info_ptr->x_green; + xy.greeny = info_ptr->y_green; + xy.bluex = info_ptr->x_blue; + xy.bluey = info_ptr->y_blue; + + /* The *_checked function handles error reporting, so just return 0 if + * there is a failure here. + */ + if (png_XYZ_from_xy_checked(png_ptr, &XYZ, xy)) + { + if (int_red_X != NULL) + *int_red_X = XYZ.redX; + if (int_red_Y != NULL) + *int_red_Y = XYZ.redY; + if (int_red_Z != NULL) + *int_red_Z = XYZ.redZ; + if (int_green_X != NULL) + *int_green_X = XYZ.greenX; + if (int_green_Y != NULL) + *int_green_Y = XYZ.greenY; + if (int_green_Z != NULL) + *int_green_Z = XYZ.greenZ; + if (int_blue_X != NULL) + *int_blue_X = XYZ.blueX; + if (int_blue_Y != NULL) + *int_blue_Y = XYZ.blueY; + if (int_blue_Z != NULL) + *int_blue_Z = XYZ.blueZ; + + return (PNG_INFO_cHRM); + } + } + + return (0); +} + # ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, double *blue_y) { - /* Quiet API change: this code used to only return the end points if a cHRM - * chunk was present, but the end points can also come from iCCP or sRGB - * chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and - * the png_set_ APIs merely check that set end points are mutually - * consistent. - */ - if (png_ptr != NULL && info_ptr != NULL && - (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS)) + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) { png_debug1(1, "in %s retrieval function", "cHRM"); if (white_x != NULL) - *white_x = png_float(png_ptr, - info_ptr->colorspace.end_points_xy.whitex, "cHRM white X"); + *white_x = png_float(png_ptr, info_ptr->x_white, "cHRM white X"); if (white_y != NULL) - *white_y = png_float(png_ptr, - info_ptr->colorspace.end_points_xy.whitey, "cHRM white Y"); + *white_y = png_float(png_ptr, info_ptr->y_white, "cHRM white Y"); if (red_x != NULL) - *red_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redx, - "cHRM red X"); + *red_x = png_float(png_ptr, info_ptr->x_red, "cHRM red X"); if (red_y != NULL) - *red_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redy, - "cHRM red Y"); + *red_y = png_float(png_ptr, info_ptr->y_red, "cHRM red Y"); if (green_x != NULL) - *green_x = png_float(png_ptr, - info_ptr->colorspace.end_points_xy.greenx, "cHRM green X"); + *green_x = png_float(png_ptr, info_ptr->x_green, "cHRM green X"); if (green_y != NULL) - *green_y = png_float(png_ptr, - info_ptr->colorspace.end_points_xy.greeny, "cHRM green Y"); + *green_y = png_float(png_ptr, info_ptr->y_green, "cHRM green Y"); if (blue_x != NULL) - *blue_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluex, - "cHRM blue X"); + *blue_x = png_float(png_ptr, info_ptr->x_blue, "cHRM blue X"); if (blue_y != NULL) - *blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey, - "cHRM blue Y"); + *blue_y = png_float(png_ptr, info_ptr->y_blue, "cHRM blue Y"); return (PNG_INFO_cHRM); } @@ -528,38 +556,30 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr, double *green_Y, double *green_Z, double *blue_X, double *blue_Y, double *blue_Z) { - if (png_ptr != NULL && info_ptr != NULL && - (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS)) - { - png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)"); + png_XYZ XYZ; + if (png_get_cHRM_XYZ_fixed(png_ptr, info_ptr, + &XYZ.redX, &XYZ.redY, &XYZ.redZ, &XYZ.greenX, &XYZ.greenY, &XYZ.greenZ, + &XYZ.blueX, &XYZ.blueY, &XYZ.blueZ) & PNG_INFO_cHRM) + { if (red_X != NULL) - *red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X, - "cHRM red X"); + *red_X = png_float(png_ptr, XYZ.redX, "cHRM red X"); if (red_Y != NULL) - *red_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Y, - "cHRM red Y"); + *red_Y = png_float(png_ptr, XYZ.redY, "cHRM red Y"); if (red_Z != NULL) - *red_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Z, - "cHRM red Z"); + *red_Z = png_float(png_ptr, XYZ.redZ, "cHRM red Z"); if (green_X != NULL) - *green_X = png_float(png_ptr, - info_ptr->colorspace.end_points_XYZ.green_X, "cHRM green X"); + *green_X = png_float(png_ptr, XYZ.greenX, "cHRM green X"); if (green_Y != NULL) - *green_Y = png_float(png_ptr, - info_ptr->colorspace.end_points_XYZ.green_Y, "cHRM green Y"); + *green_Y = png_float(png_ptr, XYZ.greenY, "cHRM green Y"); if (green_Z != NULL) - *green_Z = png_float(png_ptr, - info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z"); + *green_Z = png_float(png_ptr, XYZ.greenZ, "cHRM green Z"); if (blue_X != NULL) - *blue_X = png_float(png_ptr, - info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X"); + *blue_X = png_float(png_ptr, XYZ.blueX, "cHRM blue X"); if (blue_Y != NULL) - *blue_Y = png_float(png_ptr, - info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y"); + *blue_Y = png_float(png_ptr, XYZ.blueY, "cHRM blue Y"); if (blue_Z != NULL) - *blue_Z = png_float(png_ptr, - info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z"); + *blue_Z = png_float(png_ptr, XYZ.blueZ, "cHRM blue Z"); return (PNG_INFO_cHRM); } @@ -569,43 +589,6 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr, # ifdef PNG_FIXED_POINT_SUPPORTED png_uint_32 PNGAPI -png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, - png_fixed_point *int_red_X, png_fixed_point *int_red_Y, - png_fixed_point *int_red_Z, png_fixed_point *int_green_X, - png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, - png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, - png_fixed_point *int_blue_Z) -{ - if (png_ptr != NULL && info_ptr != NULL && - (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS)) - { - png_debug1(1, "in %s retrieval function", "cHRM_XYZ"); - - if (int_red_X != NULL) - *int_red_X = info_ptr->colorspace.end_points_XYZ.red_X; - if (int_red_Y != NULL) - *int_red_Y = info_ptr->colorspace.end_points_XYZ.red_Y; - if (int_red_Z != NULL) - *int_red_Z = info_ptr->colorspace.end_points_XYZ.red_Z; - if (int_green_X != NULL) - *int_green_X = info_ptr->colorspace.end_points_XYZ.green_X; - if (int_green_Y != NULL) - *int_green_Y = info_ptr->colorspace.end_points_XYZ.green_Y; - if (int_green_Z != NULL) - *int_green_Z = info_ptr->colorspace.end_points_XYZ.green_Z; - if (int_blue_X != NULL) - *int_blue_X = info_ptr->colorspace.end_points_XYZ.blue_X; - if (int_blue_Y != NULL) - *int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y; - if (int_blue_Z != NULL) - *int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z; - return (PNG_INFO_cHRM); - } - - return (0); -} - -png_uint_32 PNGAPI png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x, png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, @@ -613,25 +596,24 @@ png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, { png_debug1(1, "in %s retrieval function", "cHRM"); - if (png_ptr != NULL && info_ptr != NULL && - (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS)) + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) { if (white_x != NULL) - *white_x = info_ptr->colorspace.end_points_xy.whitex; + *white_x = info_ptr->x_white; if (white_y != NULL) - *white_y = info_ptr->colorspace.end_points_xy.whitey; + *white_y = info_ptr->y_white; if (red_x != NULL) - *red_x = info_ptr->colorspace.end_points_xy.redx; + *red_x = info_ptr->x_red; if (red_y != NULL) - *red_y = info_ptr->colorspace.end_points_xy.redy; + *red_y = info_ptr->y_red; if (green_x != NULL) - *green_x = info_ptr->colorspace.end_points_xy.greenx; + *green_x = info_ptr->x_green; if (green_y != NULL) - *green_y = info_ptr->colorspace.end_points_xy.greeny; + *green_y = info_ptr->y_green; if (blue_x != NULL) - *blue_x = info_ptr->colorspace.end_points_xy.bluex; + *blue_x = info_ptr->x_blue; if (blue_y != NULL) - *blue_y = info_ptr->colorspace.end_points_xy.bluey; + *blue_y = info_ptr->y_blue; return (PNG_INFO_cHRM); } @@ -641,43 +623,35 @@ png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, #endif #ifdef PNG_gAMA_SUPPORTED -# ifdef PNG_FIXED_POINT_SUPPORTED -png_uint_32 PNGAPI +png_uint_32 PNGFAPI png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *file_gamma) { png_debug1(1, "in %s retrieval function", "gAMA"); - if (png_ptr != NULL && info_ptr != NULL && - (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) && - file_gamma != NULL) + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) + && file_gamma != NULL) { - *file_gamma = info_ptr->colorspace.gamma; + *file_gamma = info_ptr->gamma; return (PNG_INFO_gAMA); } return (0); } -# endif - # ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr, double *file_gamma) { - png_debug1(1, "in %s retrieval function", "gAMA(float)"); + png_fixed_point igamma; + png_uint_32 ok = png_get_gAMA_fixed(png_ptr, info_ptr, &igamma); - if (png_ptr != NULL && info_ptr != NULL && - (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) && - file_gamma != NULL) - { - *file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma, - "png_get_gAMA"); - return (PNG_INFO_gAMA); - } + if (ok) + *file_gamma = png_float(png_ptr, igamma, "png_get_gAMA"); - return (0); + return ok; } + # endif #endif @@ -691,7 +665,7 @@ png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr, if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB) && file_srgb_intent != NULL) { - *file_srgb_intent = info_ptr->colorspace.rendering_intent; + *file_srgb_intent = (int)info_ptr->srgb_intent; return (PNG_INFO_sRGB); } @@ -701,7 +675,7 @@ png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr, #ifdef PNG_iCCP_SUPPORTED png_uint_32 PNGAPI -png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr, +png_get_iCCP(png_const_structrp png_ptr, png_const_inforp info_ptr, png_charpp name, int *compression_type, png_bytepp profile, png_uint_32 *proflen) { @@ -713,11 +687,11 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr, { *name = info_ptr->iccp_name; *profile = info_ptr->iccp_profile; - *proflen = png_get_uint_32(info_ptr->iccp_profile); - /* This is somewhat irrelevant since the profile data returned has - * actually been uncompressed. + /* Compression_type is a dummy so the API won't have to change + * if we introduce multiple compression types later. */ - *compression_type = PNG_COMPRESSION_TYPE_BASE; + *proflen = info_ptr->iccp_proflen; + *compression_type = info_ptr->iccp_compression; return (PNG_INFO_iCCP); } @@ -726,14 +700,14 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr, #endif #ifdef PNG_sPLT_SUPPORTED -int PNGAPI -png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr, +png_uint_32 PNGAPI +png_get_sPLT(png_const_structrp png_ptr, png_const_inforp info_ptr, png_sPLT_tpp spalettes) { if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) { *spalettes = info_ptr->splt_palettes; - return info_ptr->splt_palettes_num; + return ((png_uint_32)info_ptr->splt_palettes_num); } return (0); @@ -742,7 +716,7 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr, #ifdef PNG_hIST_SUPPORTED png_uint_32 PNGAPI -png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr, +png_get_hIST(png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_16p *hist) { png_debug1(1, "in %s retrieval function", "hIST"); @@ -818,7 +792,7 @@ png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr, #ifdef PNG_pCAL_SUPPORTED png_uint_32 PNGAPI -png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, +png_get_pCAL(png_const_structrp png_ptr, png_const_inforp info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *units, png_charpp *params) { @@ -844,8 +818,8 @@ png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, #ifdef PNG_sCAL_SUPPORTED # ifdef PNG_FIXED_POINT_SUPPORTED -# if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \ - defined(PNG_FLOATING_POINT_SUPPORTED) +# if (defined PNG_FLOATING_ARITHMETIC_SUPPORTED) || \ + (defined PNG_FLOATING_POINT_SUPPORTED) png_uint_32 PNGAPI png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, png_fixed_point *width, png_fixed_point *height) @@ -938,7 +912,7 @@ png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr, #endif /* pHYs */ png_uint_32 PNGAPI -png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr, +png_get_PLTE(png_const_structrp png_ptr, png_const_inforp info_ptr, png_colorp *palette, int *num_palette) { png_debug1(1, "in %s retrieval function", "PLTE"); @@ -974,8 +948,8 @@ png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr, #endif #ifdef PNG_TEXT_SUPPORTED -int PNGAPI -png_get_text(png_const_structrp png_ptr, png_inforp info_ptr, +png_uint_32 PNGAPI +png_get_text(png_const_structrp png_ptr, png_const_inforp info_ptr, png_textp *text_ptr, int *num_text) { if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0) @@ -989,7 +963,7 @@ png_get_text(png_const_structrp png_ptr, png_inforp info_ptr, if (num_text != NULL) *num_text = info_ptr->num_text; - return info_ptr->num_text; + return ((png_uint_32)info_ptr->num_text); } if (num_text != NULL) @@ -1062,9 +1036,9 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr, } #endif -#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED int PNGAPI -png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr, +png_get_unknown_chunks(png_const_structrp png_ptr, png_const_inforp info_ptr, png_unknown_chunkpp unknowns) { if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL) @@ -1096,24 +1070,7 @@ png_get_user_chunk_ptr(png_const_structrp png_ptr) png_size_t PNGAPI png_get_compression_buffer_size(png_const_structrp png_ptr) { - if (png_ptr == NULL) - return 0; - -# ifdef PNG_WRITE_SUPPORTED - if (png_ptr->mode & PNG_IS_READ_STRUCT) -# endif - { -# ifdef PNG_SEQUENTIAL_READ_SUPPORTED - return png_ptr->IDAT_read_size; -# else - return PNG_IDAT_READ_SIZE; -# endif - } - -# ifdef PNG_WRITE_SUPPORTED - else - return png_ptr->zbuffer_size; -# endif + return (png_ptr ? png_ptr->zbuf_size : 0); } #ifdef PNG_SET_USER_LIMITS_SUPPORTED @@ -1159,19 +1116,15 @@ png_get_io_chunk_type (png_const_structrp png_ptr) { return png_ptr->chunk_name; } -#endif /* ?PNG_IO_STATE_SUPPORTED */ -#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED -# ifdef PNG_GET_PALETTE_MAX_SUPPORTED -int PNGAPI -png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr) +#if PNG_LIBPNG_VER < 10600 +png_const_bytep PNGAPI +png_get_io_chunk_name (png_structrp png_ptr) { - if (png_ptr != NULL && info_ptr != NULL) - return png_ptr->num_palette_max; - - return (-1); + PNG_CSTRING_FROM_CHUNK(png_ptr->io_chunk_string, png_ptr->chunk_name); + return png_ptr->io_chunk_string; } -# endif #endif +#endif /* ?PNG_IO_STATE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ |