diff options
Diffstat (limited to 'drivers/png/pngget.c')
-rw-r--r-- | drivers/png/pngget.c | 64 |
1 files changed, 55 insertions, 9 deletions
diff --git a/drivers/png/pngget.c b/drivers/png/pngget.c index 43400cda7e..5b1d757c66 100644 --- a/drivers/png/pngget.c +++ b/drivers/png/pngget.c @@ -1,8 +1,8 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.5.7 [December 15, 2011] - * Copyright (c) 1998-2011 Glenn Randers-Pehrson + * Last changed in libpng 1.5.19 [August 21, 2014] + * Copyright (c) 1998-2002,2004,2006-2014 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.) * @@ -123,6 +123,9 @@ png_get_x_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER) return (info_ptr->x_pixels_per_unit); } +#else + PNG_UNUSED(png_ptr) + PNG_UNUSED(info_ptr) #endif return (0); @@ -140,6 +143,9 @@ png_get_y_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER) return (info_ptr->y_pixels_per_unit); } +#else + PNG_UNUSED(png_ptr) + PNG_UNUSED(info_ptr) #endif return (0); @@ -157,6 +163,9 @@ png_get_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit) return (info_ptr->x_pixels_per_unit); } +#else + PNG_UNUSED(png_ptr) + PNG_UNUSED(info_ptr) #endif return (0); @@ -175,6 +184,9 @@ png_get_pixel_aspect_ratio(png_const_structp png_ptr, png_const_infop info_ptr) 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); @@ -203,6 +215,9 @@ png_get_pixel_aspect_ratio_fixed(png_const_structp 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; @@ -220,6 +235,9 @@ png_get_x_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr) if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER) return (info_ptr->x_offset); } +#else + PNG_UNUSED(png_ptr) + PNG_UNUSED(info_ptr) #endif return (0); @@ -236,6 +254,9 @@ png_get_y_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr) if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER) return (info_ptr->y_offset); } +#else + PNG_UNUSED(png_ptr) + PNG_UNUSED(info_ptr) #endif return (0); @@ -252,6 +273,9 @@ png_get_x_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr) if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL) return (info_ptr->x_offset); } +#else + PNG_UNUSED(png_ptr) + PNG_UNUSED(info_ptr) #endif return (0); @@ -268,6 +292,9 @@ png_get_y_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr) if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL) return (info_ptr->y_offset); } +#else + PNG_UNUSED(png_ptr) + PNG_UNUSED(info_ptr) #endif return (0); @@ -646,7 +673,7 @@ png_get_gAMA(png_const_structp png_ptr, png_const_infop info_ptr, png_fixed_point igamma; png_uint_32 ok = png_get_gAMA_fixed(png_ptr, info_ptr, &igamma); - if (ok) + if (ok != 0) *file_gamma = png_float(png_ptr, igamma, "png_get_gAMA"); return ok; @@ -741,14 +768,20 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr, { png_debug1(1, "in %s retrieval function", "IHDR"); - if (png_ptr == NULL || info_ptr == NULL || width == NULL || - height == NULL || bit_depth == NULL || color_type == NULL) + if (png_ptr == NULL || info_ptr == NULL) return (0); - *width = info_ptr->width; - *height = info_ptr->height; - *bit_depth = info_ptr->bit_depth; - *color_type = info_ptr->color_type; + if (width != NULL) + *width = info_ptr->width; + + if (height != NULL) + *height = info_ptr->height; + + if (bit_depth != NULL) + *bit_depth = info_ptr->bit_depth; + + if (color_type != NULL) + *color_type = info_ptr->color_type; if (compression_type != NULL) *compression_type = info_ptr->compression_type; @@ -1121,4 +1154,17 @@ png_get_io_chunk_name (png_structp png_ptr) } #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_ptr != NULL && info_ptr != NULL) + return png_ptr->num_palette_max; + + return (-1); +} +# endif +#endif + #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ |