[devel] Revised png_get_int_16() to be similar to png_get_int_32().

This commit is contained in:
Glenn Randers-Pehrson 2010-07-31 07:09:58 -05:00
parent 4009a76e97
commit 48dc6ebf5c
9 changed files with 37 additions and 24 deletions

View File

@ -321,6 +321,7 @@ version 1.5.0beta38 [July 31, 2010]
safe but uncast assignments to shorter integers. Also added a zlib
VStudio release library project because the latest zlib Official Windows
build does not include such a thing.
Revised png_get_int_16() to be similar to png_get_int_32().
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit

View File

@ -2803,6 +2803,7 @@ version 1.5.0beta38 [July 31, 2010]
safe but uncast assignments to shorter integers. Also added a zlib
VStudio release library project because the latest zlib Official Windows
build does not include such a thing.
Revised png_get_int_16() to be similar to png_get_int_32().
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

23
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.5.0beta38 - July 30, 2010
* libpng version 1.5.0beta38 - July 31, 2010
* Copyright (c) 1998-2010 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.)
@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.5.0beta38 - July 30, 2010: Glenn
* libpng versions 0.97, January 1998, through 1.5.0beta38 - July 31, 2010: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -172,7 +172,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.5.0beta38, July 30, 2010, are
* libpng versions 1.2.6, August 15, 2004, through 1.5.0beta38, July 31, 2010, are
* Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@ -284,7 +284,7 @@
* Y2K compliance in libpng:
* =========================
*
* July 30, 2010
* July 31, 2010
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
@ -348,7 +348,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.0beta38"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.0beta38 - July 30, 2010\n"
" libpng version 1.5.0beta38 - July 31, 2010\n"
#define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15
@ -1295,11 +1295,9 @@ PNG_EXPORT(void,png_set_filter,(png_structp png_ptr, int method, int filters),,
PNG_FP_EXPORT(void,png_set_filter_heuristics,(png_structp png_ptr,
int heuristic_method, int num_weights, png_doublep filter_weights,
png_doublep filter_costs),,68);
#if 0 /* TO DO */
PNG_FIXED_EXPORT(void,png_set_filter_heuristics_fixed,(png_structp png_ptr,
int heuristic_method, int num_weights, png_fixed_point_p filter_weights,
png_fixed_point_p filter_costs),,209);
#endif
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
/* Heuristic used for row filter selection. These defines should NOT be
@ -1607,10 +1605,8 @@ PNG_EXPORT(png_uint_32,png_get_y_pixels_per_meter,(png_structp png_ptr,
/* Returns pixel aspect ratio, computed from pHYs chunk data. */
PNG_FP_EXPORT(float,png_get_pixel_aspect_ratio,(png_structp png_ptr,
png_infop info_ptr),,125);
#if 0 /* TO DO */
PNG_FIXED_EXPORT(png_fixed_point,png_get_pixel_aspect_ratio_fixed,
(png_structp png_ptr, png_infop info_ptr),,210);
#endif
/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
PNG_EXPORT(png_int_32,png_get_x_offset_pixels,(png_structp png_ptr,
@ -1820,19 +1816,24 @@ PNG_EXPORT(void,png_set_tRNS,(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_sCAL_SUPPORTED
PNG_FP_EXPORT(png_uint_32,png_get_sCAL,(png_structp png_ptr, png_infop info_ptr,
int *unit, double *width, double *height),,168);
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
/* NOTE: this API is currently implemented using floating point arithmetic,
* consequently it can only be used on systems with floating point support.
* In any case the range of values supported by png_fixed_point is small and it
* is highly recommended that png_get_sCAL_s be used instead.
*/
PNG_FIXED_EXPORT(png_uint_32,png_get_sCAL_fixed,(png_structp png_ptr,
png_infop info_ptr, int *unit, png_fixed_point *width,
png_fixed_point *height),,214);
#endif
PNG_EXPORT(png_uint_32,png_get_sCAL_s,(png_structp png_ptr,
png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight),,169);
PNG_FP_EXPORT(void,png_set_sCAL,(png_structp png_ptr, png_infop info_ptr,
int unit, double width, double height),,170);
#if 0 /* TO DO */
PNG_FIXED_EXPORT(void,png_set_sCAL_fixed,(png_structp png_ptr,
png_infop info_ptr, int unit, png_fixed_point width,
png_fixed_point height), ,213);
#endif
PNG_EXPORT(void,png_set_sCAL_s,(png_structp png_ptr, png_infop info_ptr,
int unit, png_charp swidth, png_charp sheight),,171);
#endif /* PNG_sCAL_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.5.0beta38 - July 30, 2010
* libpng version 1.5.0beta38 - July 31, 2010
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -5,7 +5,7 @@
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng version 1.5.0 - July 30, 2010
* Last changed in libpng version 1.5.0 - July 31, 2010
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer

View File

@ -5,7 +5,7 @@
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng version 1.5.0 - July 30, 2010
* Last changed in libpng version 1.5.0 - July 31, 2010
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer

View File

@ -1,7 +1,7 @@
/* pngpriv.h - private declarations for use inside libpng
*
* libpng version 1.5.0beta38 - July 30, 2010
* libpng version 1.5.0beta38 - July 31, 2010
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -87,7 +87,7 @@
#ifndef PNG_ERROR_TEXT_SUPPORTED
# define png_error(s1,s2) png_err(s1)
# define png_chunk_error(s1,s2) png_err(s1)
# define png_fixed_error(s1,s2,s3) png_err(s1)
# define png_fixed_error(s1,s2) png_err(s1)
#endif
#ifndef PNG_EXTERN
@ -392,7 +392,7 @@
*/
#ifdef PNG_FIXED_POINT_MACRO_SUPPORTED
#define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\
((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s, fp),0))
((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0))
#else
PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp,
png_const_charp text));
@ -1029,22 +1029,30 @@ PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr, png_voidp ptr,
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_EXTERN void png_fixed_error PNGARG((png_structp png_ptr,
png_const_charp name, double value));
png_const_charp name)) PNG_NORETURN;
#endif
/* ASCII to FP interfaces, currently only implemented if sCAL
* support is required.
*/
#if defined(PNG_READ_sCAL_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
#if defined(PNG_READ_sCAL_SUPPORTED)
/* MAX_DIGITS is actually the maximum number of characters in an sCAL
* width or height, derived from the precision (number of significant
* digits - a build time settable option) and assumpitions about the
* maximum ridiculous exponent.
*/
#define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/)
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_ascii_from_fp PNGARG((png_structp png_ptr, png_charp ascii,
png_size_t size, double fp, unsigned precision));
#endif /* READ_sCAL && FLOATING_POINT */
#endif /* FLOATING_POINT */
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structp png_ptr,
png_charp ascii, png_size_t size, png_fixed_point fp));
#endif /* FIXED_POINT */
#endif /* READ_sCAL */
#if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
/* An internal API to validate the format of a floating point number.
@ -1119,7 +1127,8 @@ PNG_EXTERN int png_check_fp_number PNGARG((png_charp string, png_size_t size,
PNG_EXTERN int png_check_fp_string PNGARG((png_charp string, png_size_t size));
#endif /* pCAL || sCAL */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
#if defined(PNG_READ_GAMMA_SUPPORTED) ||\
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
/* Added at libpng version 1.5.0 */
/* This is a utility to provide a*times/div (rounded) and indicate
* if there is an overflow. The result is a boolean - false (0)

View File

@ -88,8 +88,9 @@ png_get_int_32)(png_bytep buf)
png_uint_16 (PNGAPI
png_get_uint_16)(png_bytep buf)
{
png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) +
(png_uint_16)(*(buf + 1)));
png_uint_16 i =
((png_uint_32)(*buf) << 8) +
((png_uint_32)(*(buf + 1)));
return (i);
}

View File

@ -5,7 +5,7 @@
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng version 1.5.0 - July 30, 2010
* Last changed in libpng version 1.5.0 - July 31, 2010
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer