[devel] VisualC/GCC warning fixes, VisualC build fixes

The changes include support for function attributes in VC in addition to
    those already present in GCC - necessary because without these some
    warnings are unavoidable.  Fixes include signed/unsigned fixes in
    pngvalid and checks with gcc -Wall -Wextra -Wunused.
  VC requires function attributes on function definitions as well as
    declarations, PNG_FUNCTION has been added to enable this and the
    relevant function definitions changed.
This commit is contained in:
Glenn Randers-Pehrson 2010-08-02 08:00:10 -05:00
parent 21c1f06ef9
commit 77396b63f9
18 changed files with 678 additions and 313 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.0beta39 - July 31, 2010 Libpng 1.5.0beta39 - August 2, 2010
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@ -226,7 +226,7 @@ version 1.5.0beta24 [May 7, 2010]
offset of the png_ptr->rowbuf pointer into png_ptr->big_row_buf. offset of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
Added more blank lines for readability. Added more blank lines for readability.
version 1.5.0beta25 [July 31, 2010] version 1.5.0beta25 [August 2, 2010]
In pngpread.c: png_push_have_row() add check for new_row > height In pngpread.c: png_push_have_row() add check for new_row > height
Removed the now-redundant check for out-of-bounds new_row from example.c Removed the now-redundant check for out-of-bounds new_row from example.c
@ -324,7 +324,16 @@ version 1.5.0beta38 [July 31, 2010]
Revised png_get_int_16() to be similar to png_get_int_32(). Revised png_get_int_16() to be similar to png_get_int_32().
Restored projects/visualc71. Restored projects/visualc71.
version 1.5.0beta39 [July 31, 2010] version 1.5.0beta39 [August 2, 2010]
VisualC/GCC warning fixes, VisualC build fixes
The changes include support for function attributes in VC in addition to
those already present in GCC - necessary because without these some
warnings are unavoidable. Fixes include signed/unsigned fixes in
pngvalid and checks with gcc -Wall -Wextra -Wunused.
VC requires function attributes on function definitions as well as
declarations, PNG_FUNCTION has been added to enable this and the
relevant function definitions changed.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

14
CHANGES
View File

@ -2806,7 +2806,19 @@ version 1.5.0beta38 [July 31, 2010]
Revised png_get_int_16() to be similar to png_get_int_32(). Revised png_get_int_16() to be similar to png_get_int_32().
Restored projects/visualc71. Restored projects/visualc71.
version 1.5.0beta39 [July 31, 2010] version 1.5.0beta39 [August 2, 2010]
VisualC/GCC warning fixes, VisualC build fixes
The changes include support for function attributes in VC in addition to
those already present in GCC - necessary because without these some
warnings are unavoidable. Fixes include signed/unsigned fixes in
pngvalid and checks with gcc -Wall -Wextra -Wunused.
VC requires function attributes on function definitions as well as
declarations, PNG_FUNCTION has been added to enable this and the
relevant function definitions changed.
projects/vstudio now builds and runs all tests (pngvalid added),
however the DLL builds are probably not useful as there seems to be no
way to avoid dependency on the VC runtime in the DLL case.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

26
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* Last changed in libpng 1.5.0 [July 31, 2010] * Last changed in libpng 1.5.0 [August 2, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -73,8 +73,8 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Function to allocate memory for zlib and clear it to 0. */ /* Function to allocate memory for zlib and clear it to 0. */
voidpf /* PRIVATE */ PNG_FUNCTION(voidpf /* PRIVATE */,
png_zalloc(voidpf png_ptr, uInt items, uInt size) png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
{ {
png_voidp ptr; png_voidp ptr;
png_structp p=(png_structp)png_ptr; png_structp p=(png_structp)png_ptr;
@ -147,8 +147,8 @@ png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
* and png_info_init() so that applications that want to use a shared * and png_info_init() so that applications that want to use a shared
* libpng don't have to be recompiled if png_info changes size. * libpng don't have to be recompiled if png_info changes size.
*/ */
png_infop PNGAPI PNG_FUNCTION(png_infop,PNGAPI
png_create_info_struct(png_structp png_ptr) png_create_info_struct,(png_structp png_ptr),PNG_ALLOCATED)
{ {
png_infop info_ptr; png_infop info_ptr;
@ -560,13 +560,13 @@ png_get_copyright(png_structp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \ return ((png_charp) PNG_STRING_NEWLINE \
"libpng version 1.5.0beta39 - July 31, 2010" PNG_STRING_NEWLINE \ "libpng version 1.5.0beta39 - August 2, 2010" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE); PNG_STRING_NEWLINE);
# else # else
return ((png_charp) "libpng version 1.5.0beta39 - July 31, 2010\ return ((png_charp) "libpng version 1.5.0beta39 - August 2, 2010\
Copyright (c) 1998-2010 Glenn Randers-Pehrson\ Copyright (c) 1998-2010 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."); Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
@ -1430,9 +1430,9 @@ png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size,
{ {
unsigned i; unsigned i;
*ascii++ = 46; /* decimal point */ *ascii++ = 46; /* decimal point */
/* ndigits may be <5 for small numbers, output leading zeros then /* ndigits may be <5 for small numbers, output leading zeros
* ndigits digits to first: * then ndigits digits to first:
*/ */
i = 5; i = 5;
while (ndigits < i) *ascii++ = 48, --i; while (ndigits < i) *ascii++ = 48, --i;
while (ndigits >= first) *ascii++ = digits[--ndigits]; while (ndigits >= first) *ascii++ = digits[--ndigits];
@ -1454,7 +1454,7 @@ png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size,
# endif /* FIXED_POINT */ # endif /* FIXED_POINT */
#endif /* READ_SCAL */ #endif /* READ_SCAL */
#if defined(PNG_FLOATING_POINT_SUPPORTED) &&\ #if defined(PNG_FLOATING_POINT_SUPPORTED) && \
!defined(PNG_FIXED_POINT_MACRO_SUPPORTED) !defined(PNG_FIXED_POINT_MACRO_SUPPORTED)
png_fixed_point png_fixed_point
png_fixed(png_structp png_ptr, double fp, png_const_charp text) png_fixed(png_structp png_ptr, double fp, png_const_charp text)
@ -1465,11 +1465,11 @@ png_fixed(png_structp png_ptr, double fp, png_const_charp text)
return (png_fixed_point)r; return (png_fixed_point)r;
png_fixed_error(png_ptr, text); png_fixed_error(png_ptr, text);
return 0; /*NOT REACHED*/ /*NOT REACHED*/
} }
#endif #endif
#if defined(PNG_READ_GAMMA_SUPPORTED) ||\ #if defined(PNG_READ_GAMMA_SUPPORTED) || \
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG__READ_pHYs_SUPPORTED) defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG__READ_pHYs_SUPPORTED)
/* muldiv functions */ /* muldiv functions */
/* This API takes signed arguments and rounds the result to the nearest /* This API takes signed arguments and rounds the result to the nearest

19
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.5.0beta39 - July 31, 2010 * libpng version 1.5.0beta39 - August 2, 2010
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -11,7 +11,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * 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.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.5.0beta39 - July 31, 2010: Glenn * libpng versions 0.97, January 1998, through 1.5.0beta39 - August 2, 2010: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -172,7 +172,7 @@
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* *
* libpng versions 1.2.6, August 15, 2004, through 1.5.0beta39, July 31, 2010, are * libpng versions 1.2.6, August 15, 2004, through 1.5.0beta39, August 2, 2010, are
* Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are * Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
@ -284,7 +284,7 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* July 31, 2010 * August 2, 2010
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
@ -348,7 +348,7 @@
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.0beta39" #define PNG_LIBPNG_VER_STRING "1.5.0beta39"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.0beta39 - July 31, 2010\n" " libpng version 1.5.0beta39 - August 2, 2010\n"
#define PNG_LIBPNG_VER_SONUM 15 #define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15 #define PNG_LIBPNG_VER_DLLNUM 15
@ -801,7 +801,9 @@ typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp),);
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
/* This must match the function definition in <setjmp.h>, and the /* This must match the function definition in <setjmp.h>, and the
* application must include this before png.h to obtain the definition * application must include this before png.h to obtain the definition
* of jmp_buf. The function is required to be PNG_NORETURN. * of jmp_buf. The function is required to be PNG_NORETURN. (Note that
* PNG_PTR_NORETURN is used here because current versions of the Microsoft
* C compiler do not support the PNG_NORETURN attribute on a pointer.)
* *
* If you get a type warning from the compiler when linking against this line * If you get a type warning from the compiler when linking against this line
* then your compiler has 'longjmp' that does not match the requirements of the * then your compiler has 'longjmp' that does not match the requirements of the
@ -814,7 +816,8 @@ typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp),);
* your compiler. This may be very difficult - try using a different compiler * your compiler. This may be very difficult - try using a different compiler
* to build the library! * to build the library!
*/ */
typedef void (PNGCAPI *png_longjmp_ptr) PNGARG((jmp_buf, int)) PNG_NORETURN; typedef PNG_FUNCTION(void,(PNGCAPI *png_longjmp_ptr),PNGARG((jmp_buf, int)),
PNG_PTR_NORETURN);
#endif #endif
/* Transform masks for the high-level interface */ /* Transform masks for the high-level interface */
@ -1833,7 +1836,7 @@ PNG_FP_EXPORT(void,png_set_sCAL,(png_structp png_ptr, png_infop info_ptr,
int unit, double width, double height),,170); int unit, double width, double height),,170);
PNG_FIXED_EXPORT(void,png_set_sCAL_fixed,(png_structp png_ptr, PNG_FIXED_EXPORT(void,png_set_sCAL_fixed,(png_structp png_ptr,
png_infop info_ptr, int unit, png_fixed_point width, png_infop info_ptr, int unit, png_fixed_point width,
png_fixed_point height), ,213); png_fixed_point height),,213);
PNG_EXPORT(void,png_set_sCAL_s,(png_structp png_ptr, png_infop info_ptr, PNG_EXPORT(void,png_set_sCAL_s,(png_structp png_ptr, png_infop info_ptr,
int unit, png_charp swidth, png_charp sheight),,171); int unit, png_charp swidth, png_charp sheight),,171);
#endif /* PNG_sCAL_SUPPORTED */ #endif /* PNG_sCAL_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.5.0beta39 - July 31, 2010 * libpng version 1.5.0beta39 - August 2, 2010
* *
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -281,12 +281,36 @@
# endif # endif
#endif #endif
/* THe following complexity is concerned with getting the 'attributes' of the
* declared function in the correct place. This potentially requires a separate
* PNG_EXPORT function for every compiler.
*/
#ifndef PNG_FUNCTION
# ifdef __GNUC__
# define PNG_FUNCTION(type, name, args, attributes)\
attributes type name args
# else /* !GNUC */
# ifdef _MSC_VER
# define PNG_FUNCTION(type, name, args, attributes)\
attributes type name args
# else /* !MSC */
# define PNG_FUNCTION(type, name, args, attributes)\
type name args
# endif
# endif
#endif
#ifndef PNG_EXPORT_TYPE #ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) PNG_IMPEXP type # define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
#endif #endif
#ifndef PNG_EXPORT #ifndef PNG_EXPORT
/* The ordinal value is only relevant when preprocessing png.h for symbol
* table entries.
*/
# define PNG_EXPORT(type, name, args, attributes, ordinal)\ # define PNG_EXPORT(type, name, args, attributes, ordinal)\
extern PNG_EXPORT_TYPE(type) (PNGAPI name) PNGARG(args) attributes extern PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args),\
attributes)
#endif #endif
/* Use PNG_REMOVED to comment out a removed interface. */ /* Use PNG_REMOVED to comment out a removed interface. */
@ -325,6 +349,9 @@
# ifndef PNG_NORETURN # ifndef PNG_NORETURN
# define PNG_NORETURN __attribute__((__noreturn__)) # define PNG_NORETURN __attribute__((__noreturn__))
# endif # endif
# ifndef PNG_PTR_NORETURN
# define PNG_PTR_NORETURN __attribute__((__noreturn__))
# endif
# ifndef PNG_ALLOCATED # ifndef PNG_ALLOCATED
# define PNG_ALLOCATED __attribute__((__malloc__)) # define PNG_ALLOCATED __attribute__((__malloc__))
# endif # endif
@ -351,6 +378,36 @@
# endif /* PNG_PRIVATE */ # endif /* PNG_PRIVATE */
# endif /* PNGLIB_BUILD */ # endif /* PNGLIB_BUILD */
# endif /* __GNUC__ */ # endif /* __GNUC__ */
# ifdef _MSC_VER /* may need to check value */
# ifndef PNG_USE_RESULT
# define PNG_USE_RESULT /*not supported*/
# endif
# ifndef PNG_NORETURN
# define PNG_NORETURN __declspec(noreturn)
# endif
# ifndef PNG_PTR_NORETURN
# define PNG_PTR_NORETURN /*not supported*/
# endif
# ifndef PNG_ALLOCATED
# define PNG_ALLOCATED __declspec(restrict)
# endif
/* This specifically protects structure members that should only be
* accessed from within the library, therefore should be empty during
* a library build.
*/
# ifndef PNGLIB_BUILD
# ifndef PNG_DEPRECATED
# define PNG_DEPRECATED __declspec(deprecated)
# endif
# ifndef PNG_DEPSTRUCT
# define PNG_DEPSTRUCT __declspec(deprecated)
# endif
# ifndef PNG_PRIVATE
# define PNG_PRIVATE __declspec(deprecated)
# endif /* PNG_PRIVATE */
# endif /* PNGLIB_BUILD */
# endif /* __GNUC__ */
#endif /* PNG_PEDANTIC_WARNINGS */ #endif /* PNG_PEDANTIC_WARNINGS */
#ifndef PNG_DEPRECATED #ifndef PNG_DEPRECATED

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Last changed in libpng 1.5.0 [July 31, 2010] * Last changed in libpng 1.5.0 [August 2, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -20,13 +20,13 @@
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
static void /* PRIVATE */ static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr,
png_default_error PNGARG((png_structp png_ptr, png_const_charp error_message)),PNG_NORETURN);
png_const_charp error_message)) PNG_NORETURN;
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr, png_default_warning PNGARG((png_structp png_ptr,
png_const_charp warning_message)); png_const_charp warning_message));
#endif /* PNG_WARNINGS_SUPPORTED */ #endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called whenever there is a fatal error. This function /* This function is called whenever there is a fatal error. This function
@ -35,8 +35,8 @@ png_default_warning PNGARG((png_structp png_ptr,
* to replace the error function at run-time. * to replace the error function at run-time.
*/ */
#ifdef PNG_ERROR_TEXT_SUPPORTED #ifdef PNG_ERROR_TEXT_SUPPORTED
void PNGAPI PNG_FUNCTION(void,PNGAPI
png_error(png_structp png_ptr, png_const_charp error_message) png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
{ {
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
char msg[16]; char msg[16];
@ -86,8 +86,8 @@ png_error(png_structp png_ptr, png_const_charp error_message)
png_default_error(png_ptr, error_message); png_default_error(png_ptr, error_message);
} }
#else #else
void PNGAPI PNG_FUNCTION(void,PNGAPI
png_err(png_structp png_ptr) png_err,(png_structp png_ptr),PNG_NORETURN)
{ {
if (png_ptr != NULL && png_ptr->error_fn != NULL) if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_ptr, '\0'); (*(png_ptr->error_fn))(png_ptr, '\0');
@ -192,8 +192,9 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */ #endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED) #if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
void PNGAPI PNG_FUNCTION(void,PNGAPI
png_chunk_error(png_structp png_ptr, png_const_charp error_message) png_chunk_error,(png_structp png_ptr, png_const_charp error_message),
PNG_NORETURN)
{ {
char msg[18+PNG_MAX_ERROR_TEXT]; char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL) if (png_ptr == NULL)
@ -239,8 +240,8 @@ png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
#ifdef PNG_ERROR_TEXT_SUPPORTED #ifdef PNG_ERROR_TEXT_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
void PNG_FUNCTION(void,
png_fixed_error(png_structp png_ptr, png_const_charp name) png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN)
{ {
# define fixed_message "fixed point overflow in " # define fixed_message "fixed point overflow in "
# define fixed_message_ln ((sizeof fixed_message)-1) # define fixed_message_ln ((sizeof fixed_message)-1)
@ -280,8 +281,9 @@ png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
* function is used by default, or if the program supplies NULL for the * function is used by default, or if the program supplies NULL for the
* error function pointer in png_set_error_fn(). * error function pointer in png_set_error_fn().
*/ */
static void /* PRIVATE */ static PNG_FUNCTION(void /* PRIVATE */,
png_default_error(png_structp png_ptr, png_const_charp error_message) png_default_error,(png_structp png_ptr, png_const_charp error_message),
PNG_NORETURN)
{ {
#ifdef PNG_CONSOLE_IO_SUPPORTED #ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
@ -319,14 +321,14 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
fprintf(stderr, PNG_STRING_NEWLINE); fprintf(stderr, PNG_STRING_NEWLINE);
} }
#endif #endif
png_longjmp(png_ptr, 1);
#ifndef PNG_CONSOLE_IO_SUPPORTED #ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */ error_message = error_message; /* Make compiler happy */
#endif #endif
png_longjmp(png_ptr, 1);
} }
void PNGAPI PNG_FUNCTION(void,PNGAPI
png_longjmp(png_structp png_ptr, int val) png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
{ {
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn) if (png_ptr && png_ptr->longjmp_fn)

View File

@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* Last changed in libpng 1.5.0 [July 31, 2010] * Last changed in libpng 1.5.0 [August 2, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -27,16 +27,17 @@
/* Allocate memory for a png_struct. The malloc and memset can be replaced /* Allocate memory for a png_struct. The malloc and memset can be replaced
by a single call to calloc() if this is thought to improve performance. */ by a single call to calloc() if this is thought to improve performance. */
png_voidp /* PRIVATE */ PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct(int type) png_create_struct,(int type),PNG_ALLOCATED)
{ {
# ifdef PNG_USER_MEM_SUPPORTED # ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, NULL, NULL)); return (png_create_struct_2(type, NULL, NULL));
} }
/* Alternate version of png_create_struct, for use with user-defined malloc. */ /* Alternate version of png_create_struct, for use with user-defined malloc. */
png_voidp /* PRIVATE */ PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
PNG_ALLOCATED)
{ {
# endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
png_size_t size; png_size_t size;
@ -119,8 +120,8 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* result, we would be truncating potentially larger memory requests * result, we would be truncating potentially larger memory requests
* (which should cause a fatal error) and introducing major problems. * (which should cause a fatal error) and introducing major problems.
*/ */
png_voidp PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_calloc(png_structp png_ptr, png_alloc_size_t size) png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
@ -132,8 +133,8 @@ png_calloc(png_structp png_ptr, png_alloc_size_t size)
return (ret); return (ret);
} }
png_voidp PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc(png_structp png_ptr, png_alloc_size_t size) png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
@ -153,8 +154,8 @@ png_malloc(png_structp png_ptr, png_alloc_size_t size)
return (ret); return (ret);
} }
png_voidp PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_default(png_structp png_ptr, png_alloc_size_t size) png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
# endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
@ -364,8 +365,8 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
/* Allocate memory for a png_struct or a png_info. The malloc and /* Allocate memory for a png_struct or a png_info. The malloc and
memset can be replaced by a single call to calloc() if this is thought memset can be replaced by a single call to calloc() if this is thought
to improve performance noticably. */ to improve performance noticably. */
png_voidp /* PRIVATE */ PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct(int type) png_create_struct,(int type),PNG_ALLOCATED)
{ {
# ifdef PNG_USER_MEM_SUPPORTED # ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, NULL, NULL)); return (png_create_struct_2(type, NULL, NULL));
@ -374,8 +375,9 @@ png_create_struct(int type)
/* Allocate memory for a png_struct or a png_info. The malloc and /* Allocate memory for a png_struct or a png_info. The malloc and
memset can be replaced by a single call to calloc() if this is thought memset can be replaced by a single call to calloc() if this is thought
to improve performance noticably. */ to improve performance noticably. */
png_voidp /* PRIVATE */ PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
PNG_ALLOCATED)
{ {
# endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
png_size_t size; png_size_t size;
@ -470,8 +472,8 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* have the ability to do that. * have the ability to do that.
*/ */
png_voidp PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_calloc(png_structp png_ptr, png_alloc_size_t size) png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
@ -483,8 +485,8 @@ png_calloc(png_structp png_ptr, png_alloc_size_t size)
return (ret); return (ret);
} }
png_voidp PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc(png_structp png_ptr, png_alloc_size_t size) png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
@ -504,8 +506,8 @@ png_malloc(png_structp png_ptr, png_alloc_size_t size)
return (ret); return (ret);
} }
png_voidp PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_default(png_structp png_ptr, png_alloc_size_t size) png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
# endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
@ -579,6 +581,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
else else
png_free_default(png_ptr, ptr); png_free_default(png_ptr, ptr);
} }
void PNGAPI void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr) png_free_default(png_structp png_ptr, png_voidp ptr)
{ {
@ -600,7 +603,6 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
# endif # endif
# endif # endif
} }
#endif /* Not Borland DOS special memory handler */ #endif /* Not Borland DOS special memory handler */
/* This function was added at libpng version 1.2.3. The png_malloc_warn() /* This function was added at libpng version 1.2.3. The png_malloc_warn()
@ -608,8 +610,8 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
* instead of issuing a png_error, if it fails to allocate the requested * instead of issuing a png_error, if it fails to allocate the requested
* memory. * memory.
*/ */
png_voidp PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_warn(png_structp png_ptr, png_alloc_size_t size) png_malloc_warn,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ptr; png_voidp ptr;
png_uint_32 save_flags; png_uint_32 save_flags;

View File

@ -1,7 +1,7 @@
/* pngpriv.h - private declarations for use inside libpng /* pngpriv.h - private declarations for use inside libpng
* *
* libpng version 1.5.0beta39 - July 31, 2010 * libpng version 1.5.0beta39 - August 2, 2010
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -439,13 +439,15 @@ extern "C" {
*/ */
/* Allocate memory for an internal libpng struct */ /* Allocate memory for an internal libpng struct */
PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct,PNGARG((int type)),
PNG_ALLOCATED);
/* Free memory from internal libpng struct */ /* Free memory from internal libpng struct */
PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct_2,
malloc_fn, png_voidp mem_ptr)); PNGARG((int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)),
PNG_ALLOCATED);
PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
png_free_ptr free_fn, png_voidp mem_ptr)); png_free_ptr free_fn, png_voidp mem_ptr));
@ -454,7 +456,8 @@ PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
png_infop info_ptr)); png_infop info_ptr));
/* Function to allocate memory for zlib. PNGAPI is disallowed. */ /* Function to allocate memory for zlib. PNGAPI is disallowed. */
PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); PNG_EXTERN PNG_FUNCTION(voidpf,png_zalloc,PNGARG((voidpf png_ptr, uInt items,
uInt size)),PNG_ALLOCATED);
/* Function to free memory for zlib. PNGAPI is disallowed. */ /* Function to free memory for zlib. PNGAPI is disallowed. */
PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
@ -1028,8 +1031,8 @@ PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr, png_voidp ptr,
#endif /* USE_FAR_KEYWORD */ #endif /* USE_FAR_KEYWORD */
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED) #if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_EXTERN void png_fixed_error PNGARG((png_structp png_ptr, PNG_EXTERN PNG_FUNCTION(void, png_fixed_error, (png_structp png_ptr,
png_const_charp name)) PNG_NORETURN; png_const_charp name),PNG_NORETURN);
#endif #endif
/* ASCII to FP interfaces, currently only implemented if sCAL /* ASCII to FP interfaces, currently only implemented if sCAL

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.5.0 [July 31, 2010] * Last changed in libpng 1.5.0 [August 2, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -19,9 +19,9 @@
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED
/* Create a PNG structure for reading, and allocate any memory needed. */ /* Create a PNG structure for reading, and allocate any memory needed. */
png_structp PNGAPI PNG_FUNCTION(png_structp,PNGAPI
png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr, png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn) png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
@ -32,10 +32,10 @@ png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
/* Alternate create PNG structure for reading, and allocate any memory /* Alternate create PNG structure for reading, and allocate any memory
* needed. * needed.
*/ */
png_structp PNGAPI PNG_FUNCTION(png_structp,PNGAPI
png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn) png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */

View File

@ -26,8 +26,16 @@
#include <setjmp.h> /* For jmp_buf, setjmp, longjmp */ #include <setjmp.h> /* For jmp_buf, setjmp, longjmp */
#include <math.h> /* For floor */ #include <math.h> /* For floor */
/* Unused formal parameter errors are removed using the following macro which is
* expected to have no bad effects on performance.
*/
#ifndef UNUSED
#define UNUSED(param) param = param;
#endif
/******************************* ERROR UTILITIES ******************************/ /******************************* ERROR UTILITIES ******************************/
static size_t safecat(char *buffer, size_t bufsize, size_t pos, const char *cat) static size_t safecat(char *buffer, size_t bufsize, size_t pos,
PNG_CONST char *cat)
{ {
while (pos < bufsize && cat != NULL && *cat != 0) buffer[pos++] = *cat++; while (pos < bufsize && cat != NULL && *cat != 0) buffer[pos++] = *cat++;
if (pos >= bufsize) pos = bufsize-1; if (pos >= bufsize) pos = bufsize-1;
@ -50,16 +58,16 @@ static size_t safecatd(char *buffer, size_t bufsize, size_t pos, double d,
return safecat(buffer, bufsize, pos, number); return safecat(buffer, bufsize, pos, number);
} }
static const char invalid[] = "invalid"; static PNG_CONST char invalid[] = "invalid";
static const char sep[] = ": "; static PNG_CONST char sep[] = ": ";
/* NOTE: this is indexed by ln2(bit_depth)! */ /* NOTE: this is indexed by ln2(bit_depth)! */
static const char *bit_depths[8] = static PNG_CONST char *bit_depths[8] =
{ {
"1", "2", "4", "8", "16", invalid, invalid, invalid "1", "2", "4", "8", "16", invalid, invalid, invalid
}; };
static const char *colour_types[8] = static PNG_CONST char *colour_types[8] =
{ {
"greyscale", invalid, "truecolour", "indexed-colour", "greyscale", invalid, "truecolour", "indexed-colour",
"greyscale with alpha", invalid, "truecolour with alpha", invalid "greyscale with alpha", invalid, "truecolour with alpha", invalid
@ -110,7 +118,7 @@ next_format(png_bytep colour_type, png_bytep bit_depth)
return 0; return 0;
} }
static inline unsigned static unsigned
sample(png_byte *row, png_byte colour_type, png_byte bit_depth, png_uint_32 x, sample(png_byte *row, png_byte colour_type, png_byte bit_depth, png_uint_32 x,
unsigned sample) unsigned sample)
{ {
@ -235,6 +243,8 @@ store_storenew(png_store *ps)
ps->writepos = 0; ps->writepos = 0;
} }
/* Currently unused: */
#if 0
static void static void
store_freefile(png_store_file *pf) store_freefile(png_store_file *pf)
{ {
@ -245,6 +255,7 @@ store_freefile(png_store_file *pf)
pf->datacount = 0; pf->datacount = 0;
free(pf); free(pf);
} }
#endif
/* Main interface to file storeage, after writing a new PNG file (see the API /* Main interface to file storeage, after writing a new PNG file (see the API
* below) call store_storefile to store the result with the given name and id. * below) call store_storefile to store the result with the given name and id.
@ -269,7 +280,7 @@ store_storefile(png_store *ps, png_uint_32 id)
/* Generate an error message (in the given buffer) */ /* Generate an error message (in the given buffer) */
static size_t static size_t
store_message(png_structp pp, char *buffer, size_t bufsize, const char *msg) store_message(png_structp pp, char *buffer, size_t bufsize, PNG_CONST char *msg)
{ {
size_t pos = 0; size_t pos = 0;
png_store *ps = png_get_error_ptr(pp); png_store *ps = png_get_error_ptr(pp);
@ -365,6 +376,7 @@ store_write(png_structp pp, png_bytep pb, png_size_t st)
static void static void
store_flush(png_structp pp) store_flush(png_structp pp)
{ {
pp = pp;
/*DOES NOTHING*/ /*DOES NOTHING*/
} }
@ -444,7 +456,8 @@ store_write_reset(png_store *ps)
* returned libpng structures as destroyed by store_write_reset above. * returned libpng structures as destroyed by store_write_reset above.
*/ */
static png_structp static png_structp
set_store_for_write(png_store *ps, png_infopp ppi, const char name[64]) set_store_for_write(png_store *ps, png_infopp ppi,
PNG_CONST char * volatile name)
{ {
if (setjmp(ps->jmpbuf) != 0) if (setjmp(ps->jmpbuf) != 0)
return NULL; return NULL;
@ -510,7 +523,7 @@ store_read_set(png_store *ps, png_uint_32 id)
*/ */
static png_structp static png_structp
set_store_for_read(png_store *ps, png_infopp ppi, png_uint_32 id, set_store_for_read(png_store *ps, png_infopp ppi, png_uint_32 id,
const char *name) PNG_CONST char *name)
{ {
safecat(ps->test, sizeof ps->test, 0, name); safecat(ps->test, sizeof ps->test, 0, name);
@ -568,7 +581,7 @@ typedef struct png_modifier
unsigned ngammas; unsigned ngammas;
/* Lowest sbit to test (libpng fails for sbit < 8) */ /* Lowest sbit to test (libpng fails for sbit < 8) */
unsigned sbitlow; png_byte sbitlow;
/* Error control - these are the limits on errors accepted by the gamma tests /* Error control - these are the limits on errors accepted by the gamma tests
* below. * below.
@ -590,10 +603,10 @@ typedef struct png_modifier
/* Flags: */ /* Flags: */
/* When to use the use_input_precision option: */ /* When to use the use_input_precision option: */
int use_input_precision :1; unsigned use_input_precision :1;
int use_input_precision_sbit :1; unsigned use_input_precision_sbit :1;
int use_input_precision_16to8 :1; unsigned use_input_precision_16to8 :1;
int log :1; /* Log max error */ unsigned log :1; /* Log max error */
/* Buffer information, the buffer size limits the size of the chunks that can /* Buffer information, the buffer size limits the size of the chunks that can
* be modified - they must fit (including header and CRC) into the buffer! * be modified - they must fit (including header and CRC) into the buffer!
@ -633,7 +646,7 @@ static double outerr(png_modifier *pm, png_byte bit_depth)
static int fail(png_modifier *pm) static int fail(png_modifier *pm)
{ {
return !pm->log && !pm->this.verbose && (pm->this.nerrors > 0 || return !pm->log && !pm->this.verbose && (pm->this.nerrors > 0 ||
pm->this.treat_warnings_as_errors && pm->this.nwarnings > 0); (pm->this.treat_warnings_as_errors && pm->this.nwarnings > 0));
} }
static void static void
@ -643,7 +656,7 @@ modifier_init(png_modifier *pm)
store_init(&pm->this); store_init(&pm->this);
pm->modifications = NULL; pm->modifications = NULL;
pm->state = modifier_start; pm->state = modifier_start;
pm->sbitlow = 1; pm->sbitlow = 1U;
pm->maxout8 = pm->maxpc8 = pm->maxabs8 = 0; pm->maxout8 = pm->maxpc8 = pm->maxabs8 = 0;
pm->maxout16 = pm->maxpc16 = pm->maxabs16 = 0; pm->maxout16 = pm->maxpc16 = pm->maxabs16 = 0;
pm->error_gray_2 = pm->error_gray_4 = pm->error_gray_8 = 0; pm->error_gray_2 = pm->error_gray_4 = pm->error_gray_8 = 0;
@ -846,7 +859,7 @@ modifier_read(png_structp pp, png_bytep pb, png_size_t st)
while (mod != NULL) while (mod != NULL)
{ {
if ((mod->add == chunk || if ((mod->add == chunk ||
mod->add == CHUNK_PLTE && chunk == CHUNK_IDAT) && (mod->add == CHUNK_PLTE && chunk == CHUNK_IDAT)) &&
mod->modify_fn != NULL && !mod->modified && !mod->added) mod->modify_fn != NULL && !mod->modified && !mod->added)
{ {
/* Regardless of what the modify function does do not run this /* Regardless of what the modify function does do not run this
@ -946,15 +959,15 @@ modifier_read(png_structp pp, png_bytep pb, png_size_t st)
/* Set up a modifier. */ /* Set up a modifier. */
static png_structp static png_structp
set_modifier_for_read(png_modifier *pm, png_infopp ppi, png_uint_32 id, set_modifier_for_read(png_modifier *pm, png_infopp ppi, png_uint_32 id,
const char *name) PNG_CONST char *name)
{ {
png_structp pp = set_store_for_read(&pm->this, ppi, id, name); volatile png_structp ppSafe = set_store_for_read(&pm->this, ppi, id, name);
if (pp != NULL) if (ppSafe != NULL)
{ {
if (setjmp(pm->this.jmpbuf) == 0) if (setjmp(pm->this.jmpbuf) == 0)
{ {
png_set_read_fn(pp, pm, modifier_read); png_set_read_fn(ppSafe, pm, modifier_read);
pm->state = modifier_start; pm->state = modifier_start;
pm->bit_depth = 0; pm->bit_depth = 0;
@ -969,11 +982,11 @@ set_modifier_for_read(png_modifier *pm, png_infopp ppi, png_uint_32 id,
else else
{ {
store_read_reset(&pm->this); store_read_reset(&pm->this);
pp = NULL; ppSafe = NULL;
} }
} }
return pp; return ppSafe;
} }
/***************************** STANDARD PNG FILES *****************************/ /***************************** STANDARD PNG FILES *****************************/
@ -986,11 +999,11 @@ set_modifier_for_read(png_modifier *pm, png_infopp ppi, png_uint_32 id,
* and with an ID derived from the colour type and bit depth as follows: * and with an ID derived from the colour type and bit depth as follows:
*/ */
#define FILEID(col, depth) ((png_uint_32)((col) + ((depth)<<3))) #define FILEID(col, depth) ((png_uint_32)((col) + ((depth)<<3)))
#define COL_FROM_ID(id) ((id)& 0x7) #define COL_FROM_ID(id) ((id)& 0x7U)
#define DEPTH_FROM_ID(id) (((id) >> 3) & 0x1f) #define DEPTH_FROM_ID(id) (((id) >> 3) & 0x1fU)
#define STD_WIDTH 128 #define STD_WIDTH 128U
#define STD_ROWMAX (STD_WIDTH*8) #define STD_ROWMAX (STD_WIDTH*8U)
static unsigned static unsigned
bit_size(png_structp pp, png_byte colour_type, png_byte bit_depth) bit_size(png_structp pp, png_byte colour_type, png_byte bit_depth)
@ -1012,11 +1025,10 @@ standard_rowsize(png_structp pp, png_byte colour_type, png_byte bit_depth)
return (STD_WIDTH * bit_size(pp, colour_type, bit_depth)) / 8; return (STD_WIDTH * bit_size(pp, colour_type, bit_depth)) / 8;
} }
static png_uint_32 /* standard_wdith(pp, colour_type, bit_depth) current returns the same number
standard_width(png_structp pp, png_byte colour_type, png_byte bit_depth) * every time, so just use a macro:
{ */
return STD_WIDTH; #define standard_width(pp, colour_type, bit_depth) STD_WIDTH
}
static png_uint_32 static png_uint_32
standard_height(png_structp pp, png_byte colour_type, png_byte bit_depth) standard_height(png_structp pp, png_byte colour_type, png_byte bit_depth)
@ -1026,6 +1038,7 @@ standard_height(png_structp pp, png_byte colour_type, png_byte bit_depth)
case 1: case 1:
case 2: case 2:
case 4: case 4:
default:
return 1; /* Total of 128 pixels */ return 1; /* Total of 128 pixels */
case 8: case 8:
return 2; /* Total of 256 pixels/bytes */ return 2; /* Total of 256 pixels/bytes */
@ -1134,11 +1147,14 @@ standard_row(png_structp pp, png_byte buffer[STD_ROWMAX], png_byte colour_type,
} }
static void static void
make_standard(png_store* ps, png_byte colour_type, int bdlo, int bdhi) make_standard(png_store* PNG_CONST ps, png_byte PNG_CONST colour_type,
int PNG_CONST bdloIn, int PNG_CONST bdhi)
{ {
volatile int bdlo = bdloIn;
for (; bdlo <= bdhi; ++bdlo) for (; bdlo <= bdhi; ++bdlo)
{ {
png_byte bit_depth = 1U << bdlo; png_byte bit_depth;
png_uint_32 h, y; png_uint_32 h, y;
png_structp pp; png_structp pp;
png_infop pi; png_infop pi;
@ -1164,6 +1180,7 @@ make_standard(png_store* ps, png_byte colour_type, int bdlo, int bdhi)
continue; continue;
} }
bit_depth = 1U << bdlo;
h = standard_height(pp, colour_type, bit_depth), h = standard_height(pp, colour_type, bit_depth),
png_set_IHDR(pp, pi, standard_width(pp, colour_type, bit_depth), h, png_set_IHDR(pp, pi, standard_width(pp, colour_type, bit_depth), h,
bit_depth, colour_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, bit_depth, colour_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
@ -1171,9 +1188,11 @@ make_standard(png_store* ps, png_byte colour_type, int bdlo, int bdhi)
if (colour_type == 3) /* palette */ if (colour_type == 3) /* palette */
{ {
int i; unsigned i = 0;
png_color pal[256]; png_color pal[256];
for (i=0; i<256; ++i) pal[i].red = pal[i].green = pal[i].blue = i; do
pal[i].red = pal[i].green = pal[i].blue = (png_byte)i;
while(++i < 256U);
png_set_PLTE(pp, pi, pal, 256); png_set_PLTE(pp, pi, pal, 256);
} }
@ -1212,8 +1231,11 @@ make_standard_images(png_store *ps)
/* Tests - individual test cases */ /* Tests - individual test cases */
static void static void
test_standard(png_store* ps, png_byte colour_type, int bdlo, int bdhi) test_standard(png_store* PNG_CONST ps, png_byte PNG_CONST colour_type,
int PNG_CONST bdloIn, int PNG_CONST bdhi)
{ {
volatile int bdlo = bdloIn;
for (; bdlo <= bdhi; ++bdlo) for (; bdlo <= bdhi; ++bdlo)
{ {
png_byte bit_depth = 1U << bdlo; png_byte bit_depth = 1U << bdlo;
@ -1327,12 +1349,6 @@ perform_standard_test(png_modifier *pm)
/********************************* GAMMA TESTS ********************************/ /********************************* GAMMA TESTS ********************************/
/* Gamma test images. */ /* Gamma test images. */
static void
make_gamma_images(png_store *ps)
{
/* Do nothing - the standard greyscale images are used. */
}
typedef struct gamma_modification typedef struct gamma_modification
{ {
png_modification this; png_modification this;
@ -1343,6 +1359,8 @@ gamma_modification;
static int static int
gamma_modify(png_structp pp, png_modifier *pm, png_modification *me, int add) gamma_modify(png_structp pp, png_modifier *pm, png_modification *me, int add)
{ {
UNUSED(pp);
UNUSED(add);
/* This simply dumps the given gamma value into the buffer. */ /* This simply dumps the given gamma value into the buffer. */
png_save_uint_32(pm->buffer, 4); png_save_uint_32(pm->buffer, 4);
png_save_uint_32(pm->buffer+4, CHUNK_gAMA); png_save_uint_32(pm->buffer+4, CHUNK_gAMA);
@ -1357,7 +1375,7 @@ gamma_modification_init(gamma_modification *me, png_modifier *pm, double gamma)
me->this.chunk = CHUNK_gAMA; me->this.chunk = CHUNK_gAMA;
me->this.modify_fn = gamma_modify; me->this.modify_fn = gamma_modify;
me->this.add = CHUNK_PLTE; me->this.add = CHUNK_PLTE;
me->gamma = floor(gamma * 100000 + .5); me->gamma = (png_fixed_point)floor(gamma * 100000 + .5);
me->this.next = pm->modifications; me->this.next = pm->modifications;
pm->modifications = &me->this; pm->modifications = &me->this;
} }
@ -1372,6 +1390,8 @@ srgb_modification;
static int static int
srgb_modify(png_structp pp, png_modifier *pm, png_modification *me, int add) srgb_modify(png_structp pp, png_modifier *pm, png_modification *me, int add)
{ {
UNUSED(pp);
UNUSED(add);
/* As above, ignore add and just make a new chunk */ /* As above, ignore add and just make a new chunk */
png_save_uint_32(pm->buffer, 1); png_save_uint_32(pm->buffer, 1);
png_save_uint_32(pm->buffer+4, CHUNK_sRGB); png_save_uint_32(pm->buffer+4, CHUNK_sRGB);
@ -1459,10 +1479,11 @@ sbit_modification_init(sbit_modification *me, png_modifier *pm, png_byte sbit)
* maxpc: maximum percentage error (as a percentage) * maxpc: maximum percentage error (as a percentage)
*/ */
static void static void
gamma_test(png_modifier *pm, const png_byte colour_type, gamma_test(png_modifier *pm, PNG_CONST png_byte colour_type,
const png_byte bit_depth, const double file_gamma, const double screen_gamma, PNG_CONST png_byte bit_depth, PNG_CONST double file_gamma,
const png_byte sbit, const int threshold_test, const char *name, PNG_CONST double screen_gamma, PNG_CONST png_byte sbit,
const int speed, const int use_input_precision, const int strip16) PNG_CONST int threshold_test, PNG_CONST char *name, PNG_CONST int speed,
PNG_CONST int use_input_precision, PNG_CONST int strip16)
{ {
png_structp pp; png_structp pp;
png_infop pi; png_infop pi;
@ -1513,15 +1534,15 @@ gamma_test(png_modifier *pm, const png_byte colour_type,
png_read_update_info(pp, pi); png_read_update_info(pp, pi);
{ {
const png_byte out_ct = png_get_color_type(pp, pi); PNG_CONST png_byte out_ct = png_get_color_type(pp, pi);
const png_byte out_bd = png_get_bit_depth(pp, pi); PNG_CONST png_byte out_bd = png_get_bit_depth(pp, pi);
const unsigned outmax = (1U<<out_bd)-1; PNG_CONST unsigned outmax = (1U<<out_bd)-1;
const png_uint_32 w = png_get_image_width(pp, pi); PNG_CONST png_uint_32 w = png_get_image_width(pp, pi);
const png_uint_32 h = png_get_image_height(pp, pi); PNG_CONST png_uint_32 h = png_get_image_height(pp, pi);
const size_t cb = png_get_rowbytes(pp, pi); /* For the memcmp below. */ PNG_CONST size_t cb = png_get_rowbytes(pp, pi); /* For memcmp below. */
const double maxabs = abserr(pm, out_bd); PNG_CONST double maxabs = abserr(pm, out_bd);
const double maxout = outerr(pm, out_bd); PNG_CONST double maxout = outerr(pm, out_bd);
const double maxpc = pcerr(pm, out_bd); PNG_CONST double maxpc = pcerr(pm, out_bd);
png_uint_32 y; png_uint_32 y;
/* There are three sources of error, firstly the quantization in the file /* There are three sources of error, firstly the quantization in the file
@ -1560,11 +1581,11 @@ gamma_test(png_modifier *pm, const png_byte colour_type,
* basic tests below do not do this, however if 'use_input_precision' is * basic tests below do not do this, however if 'use_input_precision' is
* set a subsequent test is performed below. * set a subsequent test is performed below.
*/ */
const int processing = (fabs(screen_gamma*file_gamma-1) >= PNG_CONST int processing = (fabs(screen_gamma*file_gamma-1) >=
PNG_GAMMA_THRESHOLD && !threshold_test && !speed && colour_type != 3) PNG_GAMMA_THRESHOLD && !threshold_test && !speed && colour_type != 3)
|| bit_depth != out_bd; || bit_depth != out_bd;
const int samples_per_pixel = (out_ct & 2) ? 3 : 1; PNG_CONST unsigned samples_per_pixel = (out_ct & 2U) ? 3U : 1U;
const double gamma = 1/(file_gamma*screen_gamma); /* Overall correction */ PNG_CONST double gamma = 1/(file_gamma*screen_gamma); /* Overall */
for (y=0; y<h; ++y) /* just one pass - no interlacing */ for (y=0; y<h; ++y) /* just one pass - no interlacing */
{ {
@ -1578,9 +1599,9 @@ gamma_test(png_modifier *pm, const png_byte colour_type,
if (processing) for (x=0; x<w; ++x) for (s=0; s<samples_per_pixel; ++s) if (processing) for (x=0; x<w; ++x) for (s=0; s<samples_per_pixel; ++s)
{ {
/* Input sample values: */ /* Input sample values: */
const unsigned id = sample(std, colour_type, bit_depth, x, s); PNG_CONST unsigned id = sample(std, colour_type, bit_depth, x, s);
const unsigned od = sample(display, out_ct, out_bd, x, s); PNG_CONST unsigned od = sample(display, out_ct, out_bd, x, s);
const unsigned isbit = id >> (bit_depth-sbit); PNG_CONST unsigned isbit = id >> (bit_depth-sbit);
double i, sample, encoded_sample, output, encoded_error, error; double i, sample, encoded_sample, output, encoded_error, error;
double es_lo, es_hi; double es_lo, es_hi;
@ -1788,10 +1809,11 @@ perform_gamma_threshold_tests(png_modifier *pm)
} }
} }
static void gamma_transform_test(png_modifier *pm, const png_byte colour_type, static void gamma_transform_test(png_modifier *pm,
const png_byte bit_depth, const double file_gamma, const double screen_gamma, PNG_CONST png_byte colour_type, PNG_CONST png_byte bit_depth,
const png_byte sbit, const int speed, const int use_input_precision, PNG_CONST double file_gamma, PNG_CONST double screen_gamma,
const int strip16) PNG_CONST png_byte sbit, PNG_CONST int speed,
PNG_CONST int use_input_precision, PNG_CONST int strip16)
{ {
size_t pos = 0; size_t pos = 0;
char name[64]; char name[64];
@ -1823,7 +1845,7 @@ static void perform_gamma_transform_tests(png_modifier *pm, int speed)
*/ */
while (next_format(&colour_type, &bit_depth)) if (colour_type != 3) while (next_format(&colour_type, &bit_depth)) if (colour_type != 3)
{ {
int i, j; unsigned i, j;
for (i=0; i<pm->ngammas; ++i) for (j=0; j<pm->ngammas; ++j) if (i != j) for (i=0; i<pm->ngammas; ++i) for (j=0; j<pm->ngammas; ++j) if (i != j)
{ {
@ -1844,7 +1866,7 @@ static void perform_gamma_sbit_tests(png_modifier *pm, int speed)
*/ */
for (sbit=pm->sbitlow; sbit<16; ++sbit) for (sbit=pm->sbitlow; sbit<16; ++sbit)
{ {
int i, j; unsigned i, j;
for (i=0; i<pm->ngammas; ++i) for (j=0; j<pm->ngammas; ++j) for (i=0; i<pm->ngammas; ++i) for (j=0; j<pm->ngammas; ++j)
if (i != j) if (i != j)
{ {
@ -1880,7 +1902,7 @@ static void perform_gamma_strip16_tests(png_modifier *pm, int speed)
* proceed *without* gamma correction, and the tests above will fail (but not * proceed *without* gamma correction, and the tests above will fail (but not
* by much) - this could be fixed, it only appears with the -g option. * by much) - this could be fixed, it only appears with the -g option.
*/ */
int i, j; unsigned i, j;
for (i=0; i<pm->ngammas; ++i) for (j=0; j<pm->ngammas; ++j) for (i=0; i<pm->ngammas; ++i) for (j=0; j<pm->ngammas; ++j)
if (i != j && fabs(pm->gammas[j]/pm->gammas[i]-1) >= PNG_GAMMA_THRESHOLD) if (i != j && fabs(pm->gammas[j]/pm->gammas[i]-1) >= PNG_GAMMA_THRESHOLD)
{ {
@ -1929,14 +1951,14 @@ perform_gamma_test(png_modifier *pm, int speed, int summary)
if (summary) if (summary)
{ {
printf("Gamma correction with sBIT:\n"); printf("Gamma correction with sBIT:\n");
if (pm->sbitlow < 8) if (pm->sbitlow < 8U)
{ {
printf(" 2 bit gray: %.5f\n", pm->error_gray_2); printf(" 2 bit gray: %.5f\n", pm->error_gray_2);
printf(" 4 bit gray: %.5f\n", pm->error_gray_4); printf(" 4 bit gray: %.5f\n", pm->error_gray_4);
printf(" 8 bit gray: %.5f\n", pm->error_gray_8); printf(" 8 bit gray: %.5f\n", pm->error_gray_8);
} }
printf(" 16 bit gray: %.5f\n", pm->error_gray_16); printf(" 16 bit gray: %.5f\n", pm->error_gray_16);
if (pm->sbitlow < 8) if (pm->sbitlow < 8U)
printf(" 8 bit color: %.5f\n", pm->error_color_8); printf(" 8 bit color: %.5f\n", pm->error_color_8);
printf(" 16 bit color: %.5f\n", pm->error_color_16); printf(" 16 bit color: %.5f\n", pm->error_color_16);
} }
@ -1954,10 +1976,11 @@ perform_gamma_test(png_modifier *pm, int speed, int summary)
} }
/* main program */ /* main program */
int main(int argc, const char **argv) int main(int argc, PNG_CONST char **argv)
{ {
int summary = 1; /* Print the error sumamry at the end */ int summary = 1; /* Print the error sumamry at the end */
int speed = 0; /* Speed test only (for gamma stuff) */ int speed = 0; /* Speed test only (for gamma stuff) */
PNG_CONST char *touch = NULL; /* Create the given output file on success. */
/* This is an array of standard gamma values (believe it or not I've seen /* This is an array of standard gamma values (believe it or not I've seen
* every one of these mentioned somewhere.) * every one of these mentioned somewhere.)
@ -1974,9 +1997,9 @@ int main(int argc, const char **argv)
/* Store the test gammas */ /* Store the test gammas */
pm.gammas = gammas; pm.gammas = gammas;
pm.ngammas = 3; /* for speed */ pm.ngammas = 3U; /* for speed */
pm.sbitlow = 8; /* because libpng doesn't do sbit below 8! */ pm.sbitlow = 8U; /* because libpng doesn't do sbit below 8! */
pm.use_input_precision_16to8 = 1; /* Because of the way libpng does it */ pm.use_input_precision_16to8 = 1U; /* Because of the way libpng does it */
/* Some default values (set the behavior for 'make check' here) */ /* Some default values (set the behavior for 'make check' here) */
pm.maxout8 = .1; /* Arithmetic error in *encoded* value */ pm.maxout8 = .1; /* Arithmetic error in *encoded* value */
@ -2006,11 +2029,13 @@ int main(int argc, const char **argv)
pm.ngammas = (sizeof gammas)/(sizeof gammas[0]); pm.ngammas = (sizeof gammas)/(sizeof gammas[0]);
else if (strcmp(*argv, "-w") == 0) else if (strcmp(*argv, "-w") == 0)
pm.this.treat_warnings_as_errors = 0; pm.this.treat_warnings_as_errors = 0;
else if (strcmp(*argv, "-speed") == 0) else if (strcmp(*argv, "--speed") == 0)
speed = 1, pm.ngammas = (sizeof gammas)/(sizeof gammas[0]); speed = 1, pm.ngammas = (sizeof gammas)/(sizeof gammas[0]);
else if (argc >= 1 && strcmp(*argv, "-sbitlow") == 0) else if (argc >= 1 && strcmp(*argv, "--sbitlow") == 0)
--argc, pm.sbitlow = atol(*++argv); --argc, pm.sbitlow = (png_byte)atoi(*++argv);
else if (argc >= 1 && strncmp(*argv, "-max", 4) == 0) else if (argc >= 1 && strcmp(*argv, "--touch") == 0)
--argc, touch = *++argv;
else if (argc >= 1 && strncmp(*argv, "--max", 4) == 0)
{ {
--argc; --argc;
if (strcmp(4+*argv, "abs8") == 0) if (strcmp(4+*argv, "abs8") == 0)
@ -2039,7 +2064,6 @@ int main(int argc, const char **argv)
/* Make useful base images */ /* Make useful base images */
make_standard_images(&pm.this); make_standard_images(&pm.this);
make_gamma_images(&pm.this);
/* Perform the standard and gamma tests. */ /* Perform the standard and gamma tests. */
if (!speed) if (!speed)
@ -2052,15 +2076,16 @@ int main(int argc, const char **argv)
#else #else
"fixed", "fixed",
#endif #endif
(pm.this.nerrors || pm.this.treat_warnings_as_errors && (pm.this.nerrors || (pm.this.treat_warnings_as_errors &&
pm.this.nwarnings) ? "(errors)" : (pm.this.nwarnings ? pm.this.nwarnings)) ? "(errors)" : (pm.this.nwarnings ?
"(warnings)" : "(no errors or warnings)") "(warnings)" : "(no errors or warnings)")
); );
/* Error exit if there are any errors, and maybe if there are any /* Error exit if there are any errors, and maybe if there are any
* warnings. * warnings.
*/ */
if (pm.this.nerrors || pm.this.treat_warnings_as_errors && pm.this.nwarnings) if (pm.this.nerrors || (pm.this.treat_warnings_as_errors &&
pm.this.nwarnings))
{ {
if (!pm.this.verbose) if (!pm.this.verbose)
fprintf(stderr, "pngvalid: %s\n", pm.this.error); fprintf(stderr, "pngvalid: %s\n", pm.this.error);
@ -2069,6 +2094,24 @@ int main(int argc, const char **argv)
exit(1); exit(1);
} }
/* Success case. */
if (touch != NULL)
{
FILE *fsuccess = fopen(touch, "wt");
if (fsuccess != NULL)
{
int error = 0;
fprintf(fsuccess, "PNG validation succeeded\n");
fflush(fsuccess);
error = ferror(fsuccess);
if (fclose(fsuccess) || error)
{
fprintf(stderr, "%s: write failed\n", touch);
exit(1);
}
}
}
return 0; return 0;
} }

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* Last changed in libpng 1.5.0 [July 31, 2010] * Last changed in libpng 1.5.0 [August 2, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -437,9 +437,9 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
#endif #endif
/* Initialize png_ptr structure, and allocate any memory needed */ /* Initialize png_ptr structure, and allocate any memory needed */
png_structp PNGAPI PNG_FUNCTION(png_structp,PNGAPI
png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr, png_create_write_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn) png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn, return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
@ -449,10 +449,10 @@ png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr,
/* Alternate initialize png_ptr structure, and allocate any memory needed */ /* Alternate initialize png_ptr structure, and allocate any memory needed */
static void png_reset_filter_heuristics(png_structp png_ptr); /* forward decl */ static void png_reset_filter_heuristics(png_structp png_ptr); /* forward decl */
png_structp PNGAPI PNG_FUNCTION(png_structp,PNGAPI
png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn) png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
volatile int png_cleanup_needed = 0; volatile int png_cleanup_needed = 0;

View File

@ -88,7 +88,6 @@
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
@ -106,8 +105,7 @@
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>zlib.lib;msvcrtd.lib;kernel32.lib</AdditionalDependencies> <AdditionalDependencies>zlib.lib</AdditionalDependencies>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<Version>15</Version> <Version>15</Version>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
@ -120,7 +118,6 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
@ -133,6 +130,7 @@
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings> <DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -144,7 +142,6 @@
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -156,7 +153,7 @@
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings> <DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ZLib1Dir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
</ClCompile> </ClCompile>
@ -165,10 +162,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>zdll.lib;msvcrt.lib;kernel32.lib</AdditionalDependencies> <AdditionalDependencies>zlib.lib</AdditionalDependencies>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<Version>15</Version> <Version>15</Version>
<AdditionalLibraryDirectories>$(ZLib1Dir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
@ -188,9 +184,10 @@
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings> <DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ZLib1Dir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -198,6 +195,9 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
</Link> </Link>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\..\png.c"> <ClCompile Include="..\..\..\png.c">

View File

@ -81,7 +81,6 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
@ -91,12 +90,12 @@
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<FunctionLevelLinking>false</FunctionLevelLinking> <FunctionLevelLinking>false</FunctionLevelLinking>
<BrowseInformation>true</BrowseInformation> <BrowseInformation>true</BrowseInformation>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib;msvcrtd.lib;kernel32.lib</AdditionalDependencies> <AdditionalDependencies>libpng15.lib</AdditionalDependencies>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
@ -124,12 +123,12 @@
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<FunctionLevelLinking>false</FunctionLevelLinking> <FunctionLevelLinking>false</FunctionLevelLinking>
<BrowseInformation>true</BrowseInformation> <BrowseInformation>true</BrowseInformation>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib;msvcrtd.lib;kernel32.lib</AdditionalDependencies> <AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
@ -145,25 +144,26 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking> <FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLib1Dir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged> <CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<BrowseInformation>true</BrowseInformation> <BrowseInformation>true</BrowseInformation>
<WholeProgramOptimization>true</WholeProgramOptimization>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;msvcrt.lib;kernel32.lib</AdditionalDependencies> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> <AdditionalDependencies>libpng15.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
@ -183,22 +183,24 @@
<FunctionLevelLinking>false</FunctionLevelLinking> <FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLib1Dir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings> <DisableSpecificWarnings>4996</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged> <CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError> <TreatWarningAsError>true</TreatWarningAsError>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<BrowseInformation>true</BrowseInformation> <BrowseInformation>true</BrowseInformation>
<WholeProgramOptimization>true</WholeProgramOptimization>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib;msvcrt.lib;kernel32.lib</AdditionalDependencies> <AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<AdditionalLibraryDirectories>$(OutDir);$(ZLib1Dir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
<Message>Executing PNG test program</Message> <Message>Executing PNG test program</Message>

View File

@ -0,0 +1,219 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug Library|Win32">
<Configuration>Debug Library</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Library|Win32">
<Configuration>Release Library</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>pngvalid</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(SolutionDir)\zlib.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<MinimalRebuild>false</MinimalRebuild>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<IntrinsicFunctions>true</IntrinsicFunctions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>false</FunctionLevelLinking>
<BrowseInformation>true</BrowseInformation>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Message>Executing PNG validation program</Message>
<Command>"$(OutDir)pngvalid.exe" --touch "$(IntDir)pngvalid.out"</Command>
<Outputs>$(IntDir)pngvalid.out</Outputs>
<Inputs>$(OutDir)pngvalid.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<MinimalRebuild>false</MinimalRebuild>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<IntrinsicFunctions>true</IntrinsicFunctions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>false</FunctionLevelLinking>
<BrowseInformation>true</BrowseInformation>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Message>Executing PNG validation program</Message>
<Command>"$(OutDir)pngvalid.exe" --touch "$(IntDir)pngvalid.out"</Command>
<Outputs>$(IntDir)pngvalid.out</Outputs>
<Inputs>$(OutDir)pngvalid.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<BrowseInformation>true</BrowseInformation>
<WholeProgramOptimization>true</WholeProgramOptimization>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<CustomBuildStep>
<Message>Executing PNG validation program</Message>
<Command>"$(OutDir)pngvalid.exe" --touch "$(IntDir)pngvalid.out"</Command>
<Outputs>$(IntDir)pngvalid.out</Outputs>
<Inputs>$(OutDir)pngvalid.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<BrowseInformation>true</BrowseInformation>
<WholeProgramOptimization>true</WholeProgramOptimization>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<CustomBuildStep>
<Message>Executing PNG validation program</Message>
<Command>$(OutDir)pngvalid.exe ..\..\..\pngvalid.png $(IntDir)pngout.png</Command>
<Command>"$(OutDir)pngvalid.exe" --touch "$(IntDir)pngvalid.out"</Command>
<Outputs>$(IntDir)pngvalid.out</Outputs>
<Inputs>$(OutDir)pngvalid.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\pngvalid.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,7 +1,7 @@
VisualStudio instructions VisualStudio instructions
libpng version 1.5.0beta39 - July 31, 2010 libpng version 1.5.0beta39 - August 2, 2010
Copyright (c) 1998-2010 Glenn Randers-Pehrson Copyright (c) 1998-2010 Glenn Randers-Pehrson
@ -15,21 +15,11 @@ You should be familiar with VisualStudio before using this directory.
Initial preparations Initial preparations
==================== ====================
You should install the 'official' build of zlib on your system - follow the
instructions provided on http://www.zlib.net. When a new release is being
made of zlib the instructions disappear for a while until the new official
build is available. You will have to wait.
You must enter some information in zlib.props before attempting to build You must enter some information in zlib.props before attempting to build
with this 'solution'. Please read and edit zlib.props first. You will with this 'solution'. Please read and edit zlib.props first. You will
probably not be familiar with the contents of zlib.props - do not worry, probably not be familiar with the contents of zlib.props - do not worry,
it is mostly harmless. it is mostly harmless.
Make sure that your official build layout matches the requirements listed
in zlib.props. Prior to zlib-1.2.4 the official build (1.2.3) placed
include and library files in different directories - if you find this
has happened just put them all in the same directory.
This is all you need to do to build the 'release' and 'release library' This is all you need to do to build the 'release' and 'release library'
configurations. configurations.
@ -40,6 +30,25 @@ information is produced (in the .pdb), but if you encounter a problem the
optimization may make it difficult to debug. Simply rebuild with a lower optimization may make it difficult to debug. Simply rebuild with a lower
optimization level (e.g. /Od.) optimization level (e.g. /Od.)
Linking your application
========================
Normally you should link against the 'release' configuration. This builds a
DLL for libpng 1.5 with the default runtime options used by Visual Studio
2010. In particular the runtime library is the "MultiThreaded DLL" version.
If you use Visual Studio defaults to build your application you will have no
problems.
If you don't use the Visual Studio defaults your application must still be built
with the default runtime option (/MD). If, for some reason, it is not then your
application will crash inside libpng15.dll as soon as libpng tries to read
from a file handle you pass in.
If you do not want to use the DLL, for example for a very small application,
the 'release library' configuration may be more appropriate. This is built
with a non-standard runtime library - the "MultiThreaded" version. When you
build your application it must be compiled with this option (/MT), otherwise
it will not build (if you are lucky) or crash (if you are not.)
Stop reading here Stop reading here
================= =================
You have enough information to build a working application. You have enough information to build a working application.
@ -51,37 +60,5 @@ do not need these unless your own solution itself uses debug builds (it is
far more effective to debug on the release builds, there is no point building far more effective to debug on the release builds, there is no point building
a special debug build.) a special debug build.)
If, despite the previous paragraph, you still feel you need a debug build you
will have to download the zlib source as well (http://www.zlib.net) and include
the directory where you unpack it in zlib.props. This solution will then be
able to build a minimal zlib sufficient for libpng. This build is only
suitable for making a debug libpng.
The debug build of libpng is minimally supported. Support for debug builds of The debug build of libpng is minimally supported. Support for debug builds of
zlib is also minimal. You really don't want to do this. zlib is also minimal. You really don't want to do this.
This solution only supports the Multi-Threaded DLL C Runtime
============================================================
If you examine the solution you will find that it very deliberately lists
exactly which MicroSoft DLLs it is linking against. It explicitly links
against msvcrt.lib. The debug version links against msvcrtd.lib (this is
why it is a debug version - it's nothing to do with having any special
debug support, it doesn't).
These versions of the MicroSoft C runtime correspond to the compiler flags
/MD (release) and /MDd (debug) - the "Multi-Threaded DLL" implementation of the
C runtime library.
If you need to change this then you will have to make sure that both the
compiler flags and the ".lib" in the linker dependences match up. Fortunately
neither zlib nor libpng require libraries other than a C runtime and
kernel32.
You cannot pass (FILE*) objects from a different runtime (including msvcrtd
to msvcrt) to libpng. If you do then your program will crash within libpng
when it first makes a file read or write call.
It is likely if you have read this far that you have found you can't avoid
having multiple C runtimes in your program. This is OK, it does work, but
you will have to implement the libpng file read/write callbacks rather than
using the internal libpng default. This is easy.

View File

@ -1,17 +1,23 @@
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010 # Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "libpng\libpng.vcxproj", "{D6973076-9317-4EF2-A0B8-B7A18AC0713E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "libpng\libpng.vcxproj", "{D6973076-9317-4EF2-A0B8-B7A18AC0713E}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{E5A897B8-320E-6490-784B-11B374DD242A} = {E5A897B8-320E-6490-784B-11B374DD242A} {64CE4900-97EA-2DD5-4226-F2E36FFF2867} = {64CE4900-97EA-2DD5-4226-F2E36FFF2867}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pngtest", "pngtest\pngtest.vcxproj", "{228BA965-50D5-42B2-8BCF-AFCC227E3C1D}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pngtest", "pngtest\pngtest.vcxproj", "{228BA965-50D5-42B2-8BCF-AFCC227E3C1D}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{64CE4900-97EA-2DD5-4226-F2E36FFF2867} = {64CE4900-97EA-2DD5-4226-F2E36FFF2867}
{D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {D6973076-9317-4EF2-A0B8-B7A18AC0713E} {D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {D6973076-9317-4EF2-A0B8-B7A18AC0713E}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib\zlib.vcxproj", "{E5A897B8-320E-6490-784B-11B374DD242A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib\zlib.vcxproj", "{64CE4900-97EA-2DD5-4226-F2E36FFF2867}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pngvalid", "pngvalid\pngvalid.vcxproj", "{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}"
ProjectSection(ProjectDependencies) = postProject
{64CE4900-97EA-2DD5-4226-F2E36FFF2867} = {64CE4900-97EA-2DD5-4226-F2E36FFF2867}
{D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {D6973076-9317-4EF2-A0B8-B7A18AC0713E}
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -37,12 +43,22 @@ Global
{228BA965-50D5-42B2-8BCF-AFCC227E3C1D}.Release Library|Win32.Build.0 = Release Library|Win32 {228BA965-50D5-42B2-8BCF-AFCC227E3C1D}.Release Library|Win32.Build.0 = Release Library|Win32
{228BA965-50D5-42B2-8BCF-AFCC227E3C1D}.Release|Win32.ActiveCfg = Release|Win32 {228BA965-50D5-42B2-8BCF-AFCC227E3C1D}.Release|Win32.ActiveCfg = Release|Win32
{228BA965-50D5-42B2-8BCF-AFCC227E3C1D}.Release|Win32.Build.0 = Release|Win32 {228BA965-50D5-42B2-8BCF-AFCC227E3C1D}.Release|Win32.Build.0 = Release|Win32
{E5A897B8-320E-6490-784B-11B374DD242A}.Debug Library|Win32.ActiveCfg = Debug Library|Win32 {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Debug Library|Win32.ActiveCfg = Debug Library|Win32
{E5A897B8-320E-6490-784B-11B374DD242A}.Debug Library|Win32.Build.0 = Debug Library|Win32 {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Debug Library|Win32.Build.0 = Debug Library|Win32
{E5A897B8-320E-6490-784B-11B374DD242A}.Debug|Win32.ActiveCfg = Debug|Win32 {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Debug|Win32.ActiveCfg = Debug|Win32
{E5A897B8-320E-6490-784B-11B374DD242A}.Debug|Win32.Build.0 = Debug|Win32 {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Debug|Win32.Build.0 = Debug|Win32
{E5A897B8-320E-6490-784B-11B374DD242A}.Release Library|Win32.ActiveCfg = Debug|Win32 {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Release Library|Win32.ActiveCfg = Release Library|Win32
{E5A897B8-320E-6490-784B-11B374DD242A}.Release|Win32.ActiveCfg = Debug|Win32 {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Release Library|Win32.Build.0 = Release Library|Win32
{64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Release|Win32.ActiveCfg = Release|Win32
{64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Release|Win32.Build.0 = Release|Win32
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Debug Library|Win32.ActiveCfg = Debug Library|Win32
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Debug Library|Win32.Build.0 = Debug Library|Win32
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Debug|Win32.ActiveCfg = Debug|Win32
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Debug|Win32.Build.0 = Debug|Win32
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Release Library|Win32.ActiveCfg = Release Library|Win32
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Release Library|Win32.Build.0 = Release Library|Win32
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Release|Win32.ActiveCfg = Release|Win32
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
* zlib.props - location of zlib source and build * zlib.props - location of zlib source
* *
* libpng version 1.5.0beta39 - July 31, 2010 * libpng version 1.5.0beta39 - August 2, 2010
* *
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* *
@ -11,32 +11,19 @@
* and license in png.h * and license in png.h
* You must edit this file to record the location of the zlib * You must edit this file to record the location of the zlib
* official and debug builds unless they are in the default * source code.
* directories:
* official: zlib1
* debug: zlib debug
--> -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<!-- Place the name of the directory containing the official <!-- Place the name of the directory containing the source of zlib used for
build of zlib and the corresponding header files in this debugging in this property.
property. The directory is expected to contain at least: The directory need only contain the '.c' and '.h' files from the
source.
zdll.lib # The DLL import library If you use a relative directory name (as below) then it must be
zlib.lib # The static library relative to the project directories; these are one level deepers than
zlib.h # The header file the directories containing this file.
zconf.h # Another header file included by zlib.h
-->
<ZLib1Dir>..\..\..\..\zlib124-dll\zlib-1.2.4</ZLib1Dir>
<!-- Place the name of the directory containing the source of
zlib used for debugging in this property.
The directory need only contain the '.c' and '.h' files
from the source. For your own sanity make sure that the
'.h' files in the source match those from the 'official'
build above.
--> -->
<ZLibSrcDir>..\..\..\..\zlib-1.2.4</ZLibSrcDir> <ZLibSrcDir>..\..\..\..\zlib-1.2.4</ZLibSrcDir>
</PropertyGroup> </PropertyGroup>

View File

@ -13,6 +13,10 @@
<Configuration>Release Library</Configuration> <Configuration>Release Library</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="$(ZLibSrcDir)\adler32.c" /> <ClCompile Include="$(ZLibSrcDir)\adler32.c" />
@ -32,65 +36,55 @@
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(SolutionDir)\zlib.props" /> <Import Project="$(SolutionDir)\zlib.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <LinkIncremental>true</LinkIncremental>
<PreprocessorDefinitions>WIN32;ZLIB_DLL;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> </PropertyGroup>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<BrowseInformation>true</BrowseInformation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<Version>1</Version>
<AdditionalDependencies>msvcrtd.lib;kernel32.lib</AdditionalDependencies>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<ClCompile> <ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -106,15 +100,12 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>TurnOffAllWarnings</WarningLevel> <WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization> <Optimization>Disabled</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<BufferSecurityCheck>false</BufferSecurityCheck>
<BrowseInformation>true</BrowseInformation> <BrowseInformation>true</BrowseInformation>
</ClCompile> </ClCompile>
<Link> <Link>
@ -123,10 +114,52 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<BufferSecurityCheck>false</BufferSecurityCheck>
<BrowseInformation>true</BrowseInformation>
<FunctionLevelLinking>true</FunctionLevelLinking>
<TreatWarningAsError>true</TreatWarningAsError>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<BufferSecurityCheck>false</BufferSecurityCheck>
<BrowseInformation>true</BrowseInformation>
<FunctionLevelLinking>true</FunctionLevelLinking>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DEBUGZLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DEBUGZLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile> </ClCompile>