[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.
diff --git a/ANNOUNCE b/ANNOUNCE
index 419d8b4..6ef35af 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -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
within a few weeks by a public version or by another test version.
@@ -226,7 +226,7 @@
offset of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
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
Removed the now-redundant check for out-of-bounds new_row from example.c
@@ -324,7 +324,16 @@
Revised png_get_int_16() to be similar to png_get_int_32().
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:
(subscription required; visit
diff --git a/CHANGES b/CHANGES
index f71aeb8..acc253f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2806,7 +2806,19 @@
Revised png_get_int_16() to be similar to png_get_int_32().
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
(subscription required; visit
diff --git a/png.c b/png.c
index 948bd46..5469f3d 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -73,8 +73,8 @@
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Function to allocate memory for zlib and clear it to 0. */
-voidpf /* PRIVATE */
-png_zalloc(voidpf png_ptr, uInt items, uInt size)
+PNG_FUNCTION(voidpf /* PRIVATE */,
+png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
{
png_voidp ptr;
png_structp p=(png_structp)png_ptr;
@@ -147,8 +147,8 @@
* 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.
*/
-png_infop PNGAPI
-png_create_info_struct(png_structp png_ptr)
+PNG_FUNCTION(png_infop,PNGAPI
+png_create_info_struct,(png_structp png_ptr),PNG_ALLOCATED)
{
png_infop info_ptr;
@@ -560,13 +560,13 @@
#else
# ifdef __STDC__
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) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE);
# 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) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
@@ -1430,9 +1430,9 @@
{
unsigned i;
*ascii++ = 46; /* decimal point */
- /* ndigits may be <5 for small numbers, output leading zeros then
- * ndigits digits to first:
- */
+ /* ndigits may be <5 for small numbers, output leading zeros
+ * then ndigits digits to first:
+ */
i = 5;
while (ndigits < i) *ascii++ = 48, --i;
while (ndigits >= first) *ascii++ = digits[--ndigits];
@@ -1454,7 +1454,7 @@
# endif /* FIXED_POINT */
#endif /* READ_SCAL */
-#if defined(PNG_FLOATING_POINT_SUPPORTED) &&\
+#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
!defined(PNG_FIXED_POINT_MACRO_SUPPORTED)
png_fixed_point
png_fixed(png_structp png_ptr, double fp, png_const_charp text)
@@ -1465,11 +1465,11 @@
return (png_fixed_point)r;
png_fixed_error(png_ptr, text);
- return 0; /*NOT REACHED*/
+ /*NOT REACHED*/
}
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED) ||\
+#if defined(PNG_READ_GAMMA_SUPPORTED) || \
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG__READ_pHYs_SUPPORTED)
/* muldiv functions */
/* This API takes signed arguments and rounds the result to the nearest
diff --git a/png.h b/png.h
index 107075f..8605907 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.5.0beta39 - July 31, 2010: Glenn
+ * libpng versions 0.97, January 1998, through 1.5.0beta39 - August 2, 2010: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -172,7 +172,7 @@
*
* This code is released under the libpng license.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.5.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
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@@ -284,7 +284,7 @@
* Y2K compliance in libpng:
* =========================
*
- * July 31, 2010
+ * August 2, 2010
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
@@ -348,7 +348,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.0beta39"
#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_DLLNUM 15
@@ -801,7 +801,9 @@
#ifdef PNG_SETJMP_SUPPORTED
/* This must match the function definition in <setjmp.h>, and the
* 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
* then your compiler has 'longjmp' that does not match the requirements of the
@@ -814,7 +816,8 @@
* your compiler. This may be very difficult - try using a different compiler
* 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
/* Transform masks for the high-level interface */
@@ -1833,7 +1836,7 @@
int unit, double width, double height),,170);
PNG_FIXED_EXPORT(void,png_set_sCAL_fixed,(png_structp png_ptr,
png_infop info_ptr, int unit, png_fixed_point width,
- png_fixed_point height), ,213);
+ png_fixed_point height),,213);
PNG_EXPORT(void,png_set_sCAL_s,(png_structp png_ptr, png_infop info_ptr,
int unit, png_charp swidth, png_charp sheight),,171);
#endif /* PNG_sCAL_SUPPORTED */
diff --git a/pngconf.h b/pngconf.h
index 68414e9..080bb34 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -281,12 +281,36 @@
# 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
# define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
#endif
+
#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)\
- extern PNG_EXPORT_TYPE(type) (PNGAPI name) PNGARG(args) attributes
+ extern PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args),\
+ attributes)
#endif
/* Use PNG_REMOVED to comment out a removed interface. */
@@ -325,6 +349,9 @@
# ifndef PNG_NORETURN
# define PNG_NORETURN __attribute__((__noreturn__))
# endif
+# ifndef PNG_PTR_NORETURN
+# define PNG_PTR_NORETURN __attribute__((__noreturn__))
+# endif
# ifndef PNG_ALLOCATED
# define PNG_ALLOCATED __attribute__((__malloc__))
# endif
@@ -351,6 +378,36 @@
# endif /* PNG_PRIVATE */
# endif /* PNGLIB_BUILD */
# 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 */
#ifndef PNG_DEPRECATED
diff --git a/pngerror.c b/pngerror.c
index 7b40d48..70c7be6 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (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)
-static void /* PRIVATE */
-png_default_error PNGARG((png_structp png_ptr,
- png_const_charp error_message)) PNG_NORETURN;
+static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr,
+ png_const_charp error_message)),PNG_NORETURN);
+
#ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr,
- png_const_charp warning_message));
+ png_const_charp warning_message));
#endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called whenever there is a fatal error. This function
@@ -35,8 +35,8 @@
* to replace the error function at run-time.
*/
#ifdef PNG_ERROR_TEXT_SUPPORTED
-void PNGAPI
-png_error(png_structp png_ptr, png_const_charp error_message)
+PNG_FUNCTION(void,PNGAPI
+png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
{
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
char msg[16];
@@ -86,8 +86,8 @@
png_default_error(png_ptr, error_message);
}
#else
-void PNGAPI
-png_err(png_structp png_ptr)
+PNG_FUNCTION(void,PNGAPI
+png_err,(png_structp png_ptr),PNG_NORETURN)
{
if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_ptr, '\0');
@@ -192,8 +192,9 @@
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
-void PNGAPI
-png_chunk_error(png_structp png_ptr, png_const_charp error_message)
+PNG_FUNCTION(void,PNGAPI
+png_chunk_error,(png_structp png_ptr, png_const_charp error_message),
+ PNG_NORETURN)
{
char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL)
@@ -239,8 +240,8 @@
#ifdef PNG_ERROR_TEXT_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
-void
-png_fixed_error(png_structp png_ptr, png_const_charp name)
+PNG_FUNCTION(void,
+png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN)
{
# define fixed_message "fixed point overflow in "
# define fixed_message_ln ((sizeof fixed_message)-1)
@@ -280,8 +281,9 @@
* function is used by default, or if the program supplies NULL for the
* error function pointer in png_set_error_fn().
*/
-static void /* PRIVATE */
-png_default_error(png_structp png_ptr, png_const_charp error_message)
+static PNG_FUNCTION(void /* PRIVATE */,
+png_default_error,(png_structp png_ptr, png_const_charp error_message),
+ PNG_NORETURN)
{
#ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
@@ -319,14 +321,14 @@
fprintf(stderr, PNG_STRING_NEWLINE);
}
#endif
- png_longjmp(png_ptr, 1);
#ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */
#endif
+ png_longjmp(png_ptr, 1);
}
-void PNGAPI
-png_longjmp(png_structp png_ptr, int val)
+PNG_FUNCTION(void,PNGAPI
+png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
{
#ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn)
diff --git a/pngmem.c b/pngmem.c
index e50ab9f..0194530 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (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
by a single call to calloc() if this is thought to improve performance. */
-png_voidp /* PRIVATE */
-png_create_struct(int type)
+PNG_FUNCTION(png_voidp /* PRIVATE */,
+png_create_struct,(int type),PNG_ALLOCATED)
{
# ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, NULL, NULL));
}
/* Alternate version of png_create_struct, for use with user-defined malloc. */
-png_voidp /* PRIVATE */
-png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
+PNG_FUNCTION(png_voidp /* PRIVATE */,
+png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
+ PNG_ALLOCATED)
{
# endif /* PNG_USER_MEM_SUPPORTED */
png_size_t size;
@@ -119,8 +120,8 @@
* result, we would be truncating potentially larger memory requests
* (which should cause a fatal error) and introducing major problems.
*/
-png_voidp PNGAPI
-png_calloc(png_structp png_ptr, png_alloc_size_t size)
+PNG_FUNCTION(png_voidp,PNGAPI
+png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
@@ -132,8 +133,8 @@
return (ret);
}
-png_voidp PNGAPI
-png_malloc(png_structp png_ptr, png_alloc_size_t size)
+PNG_FUNCTION(png_voidp,PNGAPI
+png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
@@ -153,8 +154,8 @@
return (ret);
}
-png_voidp PNGAPI
-png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
+PNG_FUNCTION(png_voidp,PNGAPI
+png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
# endif /* PNG_USER_MEM_SUPPORTED */
@@ -364,8 +365,8 @@
/* 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
to improve performance noticably. */
-png_voidp /* PRIVATE */
-png_create_struct(int type)
+PNG_FUNCTION(png_voidp /* PRIVATE */,
+png_create_struct,(int type),PNG_ALLOCATED)
{
# ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, NULL, NULL));
@@ -374,8 +375,9 @@
/* 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
to improve performance noticably. */
-png_voidp /* PRIVATE */
-png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
+PNG_FUNCTION(png_voidp /* PRIVATE */,
+png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
+ PNG_ALLOCATED)
{
# endif /* PNG_USER_MEM_SUPPORTED */
png_size_t size;
@@ -470,8 +472,8 @@
* have the ability to do that.
*/
-png_voidp PNGAPI
-png_calloc(png_structp png_ptr, png_alloc_size_t size)
+PNG_FUNCTION(png_voidp,PNGAPI
+png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
@@ -483,8 +485,8 @@
return (ret);
}
-png_voidp PNGAPI
-png_malloc(png_structp png_ptr, png_alloc_size_t size)
+PNG_FUNCTION(png_voidp,PNGAPI
+png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
@@ -504,8 +506,8 @@
return (ret);
}
-png_voidp PNGAPI
-png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
+PNG_FUNCTION(png_voidp,PNGAPI
+png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
# endif /* PNG_USER_MEM_SUPPORTED */
@@ -579,6 +581,7 @@
else
png_free_default(png_ptr, ptr);
}
+
void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr)
{
@@ -600,7 +603,6 @@
# endif
# endif
}
-
#endif /* Not Borland DOS special memory handler */
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
@@ -608,8 +610,8 @@
* instead of issuing a png_error, if it fails to allocate the requested
* memory.
*/
-png_voidp PNGAPI
-png_malloc_warn(png_structp png_ptr, png_alloc_size_t size)
+PNG_FUNCTION(png_voidp,PNGAPI
+png_malloc_warn,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ptr;
png_uint_32 save_flags;
diff --git a/pngpriv.h b/pngpriv.h
index e268c96..e50faf8 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -1,7 +1,7 @@
/* 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
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -439,13 +439,15 @@
*/
/* 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 */
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
- malloc_fn, png_voidp mem_ptr));
+PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct_2,
+ 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_free_ptr free_fn, png_voidp mem_ptr));
@@ -454,7 +456,8 @@
png_infop info_ptr));
/* 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. */
PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
@@ -1028,8 +1031,8 @@
#endif /* USE_FAR_KEYWORD */
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
-PNG_EXTERN void png_fixed_error PNGARG((png_structp png_ptr,
- png_const_charp name)) PNG_NORETURN;
+PNG_EXTERN PNG_FUNCTION(void, png_fixed_error, (png_structp png_ptr,
+ png_const_charp name),PNG_NORETURN);
#endif
/* ASCII to FP interfaces, currently only implemented if sCAL
diff --git a/pngread.c b/pngread.c
index a542457..8095b81 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -19,9 +19,9 @@
#ifdef PNG_READ_SUPPORTED
/* Create a PNG structure for reading, and allocate any memory needed. */
-png_structp PNGAPI
-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_FUNCTION(png_structp,PNGAPI
+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_ALLOCATED)
{
#ifdef PNG_USER_MEM_SUPPORTED
@@ -32,10 +32,10 @@
/* Alternate create PNG structure for reading, and allocate any memory
* needed.
*/
-png_structp PNGAPI
-png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
+PNG_FUNCTION(png_structp,PNGAPI
+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_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 */
diff --git a/pngvalid.c b/pngvalid.c
index 1eaefb7..bddb500 100644
--- a/pngvalid.c
+++ b/pngvalid.c
@@ -26,8 +26,16 @@
#include <setjmp.h> /* For jmp_buf, setjmp, longjmp */
#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 ******************************/
-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++;
if (pos >= bufsize) pos = bufsize-1;
@@ -50,16 +58,16 @@
return safecat(buffer, bufsize, pos, number);
}
-static const char invalid[] = "invalid";
-static const char sep[] = ": ";
+static PNG_CONST char invalid[] = "invalid";
+static PNG_CONST char sep[] = ": ";
/* 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
};
-static const char *colour_types[8] =
+static PNG_CONST char *colour_types[8] =
{
"greyscale", invalid, "truecolour", "indexed-colour",
"greyscale with alpha", invalid, "truecolour with alpha", invalid
@@ -110,7 +118,7 @@
return 0;
}
-static inline unsigned
+static unsigned
sample(png_byte *row, png_byte colour_type, png_byte bit_depth, png_uint_32 x,
unsigned sample)
{
@@ -235,6 +243,8 @@
ps->writepos = 0;
}
+/* Currently unused: */
+#if 0
static void
store_freefile(png_store_file *pf)
{
@@ -245,6 +255,7 @@
pf->datacount = 0;
free(pf);
}
+#endif
/* 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.
@@ -269,7 +280,7 @@
/* Generate an error message (in the given buffer) */
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;
png_store *ps = png_get_error_ptr(pp);
@@ -365,6 +376,7 @@
static void
store_flush(png_structp pp)
{
+ pp = pp;
/*DOES NOTHING*/
}
@@ -444,7 +456,8 @@
* returned libpng structures as destroyed by store_write_reset above.
*/
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)
return NULL;
@@ -510,7 +523,7 @@
*/
static png_structp
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);
@@ -568,7 +581,7 @@
unsigned ngammas;
/* 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
* below.
@@ -590,10 +603,10 @@
/* Flags: */
/* When to use the use_input_precision option: */
- int use_input_precision :1;
- int use_input_precision_sbit :1;
- int use_input_precision_16to8 :1;
- int log :1; /* Log max error */
+ unsigned use_input_precision :1;
+ unsigned use_input_precision_sbit :1;
+ unsigned use_input_precision_16to8 :1;
+ unsigned log :1; /* Log max error */
/* 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!
@@ -633,7 +646,7 @@
static int fail(png_modifier *pm)
{
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
@@ -643,7 +656,7 @@
store_init(&pm->this);
pm->modifications = NULL;
pm->state = modifier_start;
- pm->sbitlow = 1;
+ pm->sbitlow = 1U;
pm->maxout8 = pm->maxpc8 = pm->maxabs8 = 0;
pm->maxout16 = pm->maxpc16 = pm->maxabs16 = 0;
pm->error_gray_2 = pm->error_gray_4 = pm->error_gray_8 = 0;
@@ -846,7 +859,7 @@
while (mod != NULL)
{
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)
{
/* Regardless of what the modify function does do not run this
@@ -946,15 +959,15 @@
/* Set up a modifier. */
static png_structp
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)
{
- png_set_read_fn(pp, pm, modifier_read);
+ png_set_read_fn(ppSafe, pm, modifier_read);
pm->state = modifier_start;
pm->bit_depth = 0;
@@ -969,11 +982,11 @@
else
{
store_read_reset(&pm->this);
- pp = NULL;
+ ppSafe = NULL;
}
}
- return pp;
+ return ppSafe;
}
/***************************** STANDARD PNG FILES *****************************/
@@ -986,11 +999,11 @@
* 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 COL_FROM_ID(id) ((id)& 0x7)
-#define DEPTH_FROM_ID(id) (((id) >> 3) & 0x1f)
+#define COL_FROM_ID(id) ((id)& 0x7U)
+#define DEPTH_FROM_ID(id) (((id) >> 3) & 0x1fU)
-#define STD_WIDTH 128
-#define STD_ROWMAX (STD_WIDTH*8)
+#define STD_WIDTH 128U
+#define STD_ROWMAX (STD_WIDTH*8U)
static unsigned
bit_size(png_structp pp, png_byte colour_type, png_byte bit_depth)
@@ -1012,11 +1025,10 @@
return (STD_WIDTH * bit_size(pp, colour_type, bit_depth)) / 8;
}
-static png_uint_32
-standard_width(png_structp pp, png_byte colour_type, png_byte bit_depth)
-{
- return STD_WIDTH;
-}
+/* standard_wdith(pp, colour_type, bit_depth) current returns the same number
+ * every time, so just use a macro:
+ */
+#define standard_width(pp, colour_type, bit_depth) STD_WIDTH
static png_uint_32
standard_height(png_structp pp, png_byte colour_type, png_byte bit_depth)
@@ -1026,6 +1038,7 @@
case 1:
case 2:
case 4:
+ default:
return 1; /* Total of 128 pixels */
case 8:
return 2; /* Total of 256 pixels/bytes */
@@ -1134,11 +1147,14 @@
}
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)
{
- png_byte bit_depth = 1U << bdlo;
+ png_byte bit_depth;
png_uint_32 h, y;
png_structp pp;
png_infop pi;
@@ -1164,6 +1180,7 @@
continue;
}
+ bit_depth = 1U << bdlo;
h = standard_height(pp, colour_type, bit_depth),
png_set_IHDR(pp, pi, standard_width(pp, colour_type, bit_depth), h,
bit_depth, colour_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
@@ -1171,9 +1188,11 @@
if (colour_type == 3) /* palette */
{
- int i;
+ unsigned i = 0;
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);
}
@@ -1212,8 +1231,11 @@
/* Tests - individual test cases */
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)
{
png_byte bit_depth = 1U << bdlo;
@@ -1327,12 +1349,6 @@
/********************************* GAMMA TESTS ********************************/
/* Gamma test images. */
-static void
-make_gamma_images(png_store *ps)
-{
- /* Do nothing - the standard greyscale images are used. */
-}
-
typedef struct gamma_modification
{
png_modification this;
@@ -1343,6 +1359,8 @@
static int
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. */
png_save_uint_32(pm->buffer, 4);
png_save_uint_32(pm->buffer+4, CHUNK_gAMA);
@@ -1357,7 +1375,7 @@
me->this.chunk = CHUNK_gAMA;
me->this.modify_fn = gamma_modify;
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;
pm->modifications = &me->this;
}
@@ -1372,6 +1390,8 @@
static int
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 */
png_save_uint_32(pm->buffer, 1);
png_save_uint_32(pm->buffer+4, CHUNK_sRGB);
@@ -1459,10 +1479,11 @@
* maxpc: maximum percentage error (as a percentage)
*/
static void
-gamma_test(png_modifier *pm, const png_byte colour_type,
- const png_byte bit_depth, const double file_gamma, const double screen_gamma,
- const png_byte sbit, const int threshold_test, const char *name,
- const int speed, const int use_input_precision, const int strip16)
+gamma_test(png_modifier *pm, PNG_CONST png_byte colour_type,
+ PNG_CONST png_byte bit_depth, PNG_CONST double file_gamma,
+ PNG_CONST double screen_gamma, PNG_CONST png_byte sbit,
+ 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_infop pi;
@@ -1513,15 +1534,15 @@
png_read_update_info(pp, pi);
{
- const png_byte out_ct = png_get_color_type(pp, pi);
- const png_byte out_bd = png_get_bit_depth(pp, pi);
- const unsigned outmax = (1U<<out_bd)-1;
- const png_uint_32 w = png_get_image_width(pp, pi);
- const png_uint_32 h = png_get_image_height(pp, pi);
- const size_t cb = png_get_rowbytes(pp, pi); /* For the memcmp below. */
- const double maxabs = abserr(pm, out_bd);
- const double maxout = outerr(pm, out_bd);
- const double maxpc = pcerr(pm, out_bd);
+ PNG_CONST png_byte out_ct = png_get_color_type(pp, pi);
+ PNG_CONST png_byte out_bd = png_get_bit_depth(pp, pi);
+ PNG_CONST unsigned outmax = (1U<<out_bd)-1;
+ PNG_CONST png_uint_32 w = png_get_image_width(pp, pi);
+ PNG_CONST png_uint_32 h = png_get_image_height(pp, pi);
+ PNG_CONST size_t cb = png_get_rowbytes(pp, pi); /* For memcmp below. */
+ PNG_CONST double maxabs = abserr(pm, out_bd);
+ PNG_CONST double maxout = outerr(pm, out_bd);
+ PNG_CONST double maxpc = pcerr(pm, out_bd);
png_uint_32 y;
/* There are three sources of error, firstly the quantization in the file
@@ -1560,11 +1581,11 @@
* basic tests below do not do this, however if 'use_input_precision' is
* 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)
|| bit_depth != out_bd;
- const int samples_per_pixel = (out_ct & 2) ? 3 : 1;
- const double gamma = 1/(file_gamma*screen_gamma); /* Overall correction */
+ PNG_CONST unsigned samples_per_pixel = (out_ct & 2U) ? 3U : 1U;
+ PNG_CONST double gamma = 1/(file_gamma*screen_gamma); /* Overall */
for (y=0; y<h; ++y) /* just one pass - no interlacing */
{
@@ -1578,9 +1599,9 @@
if (processing) for (x=0; x<w; ++x) for (s=0; s<samples_per_pixel; ++s)
{
/* Input sample values: */
- const unsigned id = sample(std, colour_type, bit_depth, x, s);
- const unsigned od = sample(display, out_ct, out_bd, x, s);
- const unsigned isbit = id >> (bit_depth-sbit);
+ PNG_CONST unsigned id = sample(std, colour_type, bit_depth, x, s);
+ PNG_CONST unsigned od = sample(display, out_ct, out_bd, x, s);
+ PNG_CONST unsigned isbit = id >> (bit_depth-sbit);
double i, sample, encoded_sample, output, encoded_error, error;
double es_lo, es_hi;
@@ -1788,10 +1809,11 @@
}
}
-static void gamma_transform_test(png_modifier *pm, const png_byte colour_type,
- const png_byte bit_depth, const double file_gamma, const double screen_gamma,
- const png_byte sbit, const int speed, const int use_input_precision,
- const int strip16)
+static void gamma_transform_test(png_modifier *pm,
+ PNG_CONST png_byte colour_type, PNG_CONST png_byte bit_depth,
+ PNG_CONST double file_gamma, PNG_CONST double screen_gamma,
+ PNG_CONST png_byte sbit, PNG_CONST int speed,
+ PNG_CONST int use_input_precision, PNG_CONST int strip16)
{
size_t pos = 0;
char name[64];
@@ -1823,7 +1845,7 @@
*/
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)
{
@@ -1844,7 +1866,7 @@
*/
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)
if (i != j)
{
@@ -1880,7 +1902,7 @@
* 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.
*/
- int i, j;
+ unsigned i, 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)
{
@@ -1929,14 +1951,14 @@
if (summary)
{
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(" 4 bit gray: %.5f\n", pm->error_gray_4);
printf(" 8 bit gray: %.5f\n", pm->error_gray_8);
}
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(" 16 bit color: %.5f\n", pm->error_color_16);
}
@@ -1954,10 +1976,11 @@
}
/* 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 speed = 0; /* Speed test only (for gamma stuff) */
+ int summary = 1; /* Print the error sumamry at the end */
+ 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
* every one of these mentioned somewhere.)
@@ -1974,9 +1997,9 @@
/* Store the test gammas */
pm.gammas = gammas;
- pm.ngammas = 3; /* for speed */
- pm.sbitlow = 8; /* because libpng doesn't do sbit below 8! */
- pm.use_input_precision_16to8 = 1; /* Because of the way libpng does it */
+ pm.ngammas = 3U; /* for speed */
+ pm.sbitlow = 8U; /* because libpng doesn't do sbit below 8! */
+ pm.use_input_precision_16to8 = 1U; /* Because of the way libpng does it */
/* Some default values (set the behavior for 'make check' here) */
pm.maxout8 = .1; /* Arithmetic error in *encoded* value */
@@ -2006,11 +2029,13 @@
pm.ngammas = (sizeof gammas)/(sizeof gammas[0]);
else if (strcmp(*argv, "-w") == 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]);
- else if (argc >= 1 && strcmp(*argv, "-sbitlow") == 0)
- --argc, pm.sbitlow = atol(*++argv);
- else if (argc >= 1 && strncmp(*argv, "-max", 4) == 0)
+ else if (argc >= 1 && strcmp(*argv, "--sbitlow") == 0)
+ --argc, pm.sbitlow = (png_byte)atoi(*++argv);
+ else if (argc >= 1 && strcmp(*argv, "--touch") == 0)
+ --argc, touch = *++argv;
+ else if (argc >= 1 && strncmp(*argv, "--max", 4) == 0)
{
--argc;
if (strcmp(4+*argv, "abs8") == 0)
@@ -2039,7 +2064,6 @@
/* Make useful base images */
make_standard_images(&pm.this);
- make_gamma_images(&pm.this);
/* Perform the standard and gamma tests. */
if (!speed)
@@ -2052,15 +2076,16 @@
#else
"fixed",
#endif
- (pm.this.nerrors || pm.this.treat_warnings_as_errors &&
- pm.this.nwarnings) ? "(errors)" : (pm.this.nwarnings ?
+ (pm.this.nerrors || (pm.this.treat_warnings_as_errors &&
+ pm.this.nwarnings)) ? "(errors)" : (pm.this.nwarnings ?
"(warnings)" : "(no errors or warnings)")
);
/* Error exit if there are any errors, and maybe if there are any
* 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)
fprintf(stderr, "pngvalid: %s\n", pm.this.error);
@@ -2069,6 +2094,24 @@
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;
}
diff --git a/pngwrite.c b/pngwrite.c
index 0f1cd46..87f39c1 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -437,9 +437,9 @@
#endif
/* Initialize png_ptr structure, and allocate any memory needed */
-png_structp PNGAPI
-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_FUNCTION(png_structp,PNGAPI
+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_ALLOCATED)
{
#ifdef PNG_USER_MEM_SUPPORTED
return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
@@ -449,10 +449,10 @@
/* Alternate initialize png_ptr structure, and allocate any memory needed */
static void png_reset_filter_heuristics(png_structp png_ptr); /* forward decl */
-png_structp PNGAPI
-png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
+PNG_FUNCTION(png_structp,PNGAPI
+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_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 */
volatile int png_cleanup_needed = 0;
diff --git a/projects/vstudio/libpng/libpng.vcxproj b/projects/vstudio/libpng/libpng.vcxproj
index 619fd88..a25bad0 100644
--- a/projects/vstudio/libpng/libpng.vcxproj
+++ b/projects/vstudio/libpng/libpng.vcxproj
@@ -88,7 +88,6 @@
<MinimalRebuild>false</MinimalRebuild>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -106,8 +105,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>zlib.lib;msvcrtd.lib;kernel32.lib</AdditionalDependencies>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <AdditionalDependencies>zlib.lib</AdditionalDependencies>
<Version>15</Version>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
@@ -120,7 +118,6 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -133,6 +130,7 @@
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -144,7 +142,6 @@
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -156,7 +153,7 @@
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
- <AdditionalIncludeDirectories>$(ZLib1Dir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<Optimization>Full</Optimization>
</ClCompile>
@@ -165,10 +162,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>zdll.lib;msvcrt.lib;kernel32.lib</AdditionalDependencies>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <AdditionalDependencies>zlib.lib</AdditionalDependencies>
<Version>15</Version>
- <AdditionalLibraryDirectories>$(ZLib1Dir)</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
@@ -188,9 +184,10 @@
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
- <AdditionalIncludeDirectories>$(ZLib1Dir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<Optimization>Full</Optimization>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -198,6 +195,9 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
+ <Lib>
+ <LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
+ </Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\png.c">
diff --git a/projects/vstudio/pngtest/pngtest.vcxproj b/projects/vstudio/pngtest/pngtest.vcxproj
index d73d514..a03dca5 100644
--- a/projects/vstudio/pngtest/pngtest.vcxproj
+++ b/projects/vstudio/pngtest/pngtest.vcxproj
@@ -81,7 +81,6 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
@@ -91,12 +90,12 @@
<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;msvcrtd.lib;kernel32.lib</AdditionalDependencies>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <AdditionalDependencies>libpng15.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
@@ -124,12 +123,12 @@
<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;msvcrtd.lib;kernel32.lib</AdditionalDependencies>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
@@ -145,25 +144,26 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(ZLib1Dir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <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;msvcrt.lib;kernel32.lib</AdditionalDependencies>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <AdditionalDependencies>libpng15.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
@@ -183,22 +183,24 @@
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(ZLib1Dir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <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;msvcrt.lib;kernel32.lib</AdditionalDependencies>
- <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
- <AdditionalLibraryDirectories>$(OutDir);$(ZLib1Dir)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Message>Executing PNG test program</Message>
diff --git a/projects/vstudio/pngvalid/pngvalid.vcxproj b/projects/vstudio/pngvalid/pngvalid.vcxproj
new file mode 100644
index 0000000..f647857
--- /dev/null
+++ b/projects/vstudio/pngvalid/pngvalid.vcxproj
@@ -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>
diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt
index da0606b..d97ae26 100644
--- a/projects/vstudio/readme.txt
+++ b/projects/vstudio/readme.txt
@@ -1,7 +1,7 @@
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
@@ -15,21 +15,11 @@
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
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,
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'
configurations.
@@ -40,6 +30,25 @@
optimization may make it difficult to debug. Simply rebuild with a lower
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
=================
You have enough information to build a working application.
@@ -51,37 +60,5 @@
far more effective to debug on the release builds, there is no point building
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
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.
diff --git a/projects/vstudio/vstudio.sln b/projects/vstudio/vstudio.sln
index b288ab6..abf59de 100644
--- a/projects/vstudio/vstudio.sln
+++ b/projects/vstudio/vstudio.sln
@@ -1,17 +1,23 @@
-
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}"
ProjectSection(ProjectDependencies) = postProject
- {E5A897B8-320E-6490-784B-11B374DD242A} = {E5A897B8-320E-6490-784B-11B374DD242A}
+ {64CE4900-97EA-2DD5-4226-F2E36FFF2867} = {64CE4900-97EA-2DD5-4226-F2E36FFF2867}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pngtest", "pngtest\pngtest.vcxproj", "{228BA965-50D5-42B2-8BCF-AFCC227E3C1D}"
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
-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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -37,12 +43,22 @@
{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.Build.0 = Release|Win32
- {E5A897B8-320E-6490-784B-11B374DD242A}.Debug Library|Win32.ActiveCfg = Debug Library|Win32
- {E5A897B8-320E-6490-784B-11B374DD242A}.Debug Library|Win32.Build.0 = Debug Library|Win32
- {E5A897B8-320E-6490-784B-11B374DD242A}.Debug|Win32.ActiveCfg = Debug|Win32
- {E5A897B8-320E-6490-784B-11B374DD242A}.Debug|Win32.Build.0 = Debug|Win32
- {E5A897B8-320E-6490-784B-11B374DD242A}.Release Library|Win32.ActiveCfg = Debug|Win32
- {E5A897B8-320E-6490-784B-11B374DD242A}.Release|Win32.ActiveCfg = Debug|Win32
+ {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Debug Library|Win32.ActiveCfg = Debug Library|Win32
+ {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Debug Library|Win32.Build.0 = Debug Library|Win32
+ {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Debug|Win32.ActiveCfg = Debug|Win32
+ {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Debug|Win32.Build.0 = Debug|Win32
+ {64CE4900-97EA-2DD5-4226-F2E36FFF2867}.Release Library|Win32.ActiveCfg = Release Library|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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props
index e36f2fc..0df5ddc 100644
--- a/projects/vstudio/zlib.props
+++ b/projects/vstudio/zlib.props
@@ -1,8 +1,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
*
@@ -11,32 +11,19 @@
* and license in png.h
* You must edit this file to record the location of the zlib
- * official and debug builds unless they are in the default
- * directories:
-
- * official: zlib1
- * debug: zlib debug
+ * source code.
-->
-<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">
- <!-- Place the name of the directory containing the official
- build of zlib and the corresponding header files in this
- property. The directory is expected to contain at least:
-
- zdll.lib # The DLL import library
- zlib.lib # The static library
- zlib.h # The header 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.
+ <!-- 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.
+ If you use a relative directory name (as below) then it must be
+ relative to the project directories; these are one level deepers than
+ the directories containing this file.
-->
<ZLibSrcDir>..\..\..\..\zlib-1.2.4</ZLibSrcDir>
</PropertyGroup>
diff --git a/projects/vstudio/zlib/zlib.vcxproj b/projects/vstudio/zlib/zlib.vcxproj
index 76b7447..c16fd82 100644
--- a/projects/vstudio/zlib/zlib.vcxproj
+++ b/projects/vstudio/zlib/zlib.vcxproj
@@ -13,6 +13,10 @@
<Configuration>Release Library</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(ZLibSrcDir)\adler32.c" />
@@ -32,65 +36,55 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.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">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<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>
<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 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">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</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'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>WIN32;ZLIB_DLL;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <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>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -106,15 +100,12 @@
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <Optimization>Full</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <BufferSecurityCheck>false</BufferSecurityCheck>
+ <Optimization>Disabled</Optimization>
<BrowseInformation>true</BrowseInformation>
</ClCompile>
<Link>
@@ -123,10 +114,52 @@
<SubSystem>Windows</SubSystem>
</Link>
</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'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DEBUGZLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>