updated libpng to 1.4.4

avoids warnings for gcc2 (deprecated attribute)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39523 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2010-11-19 20:20:05 +00:00
parent 00e694dce3
commit d8c9110cb6
11 changed files with 366 additions and 351 deletions
+214 -216
View File
File diff suppressed because it is too large Load Diff
+66 -51
View File
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.4.3 - June 26, 2010 * libpng version 1.4.4 - September 23, 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)
@@ -44,14 +44,14 @@
* includes the resource compiler for Windows DLL configurations. * includes the resource compiler for Windows DLL configurations.
*/ */
#ifdef PNG_USER_CONFIG #ifdef PNG_USER_CONFIG
# include "pngusr.h"
# ifndef PNG_USER_PRIVATEBUILD # ifndef PNG_USER_PRIVATEBUILD
# define PNG_USER_PRIVATEBUILD # define PNG_USER_PRIVATEBUILD
# endif # endif
# include "pngusr.h"
#endif #endif
/* /*
* If you create a private DLL you need to define in "pngusr.h" the followings: * If you create a private DLL you should define in "pngusr.h" the following:
* #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
* the DLL was built> * the DLL was built>
* e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons." * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
@@ -59,7 +59,7 @@
* distinguish your DLL from those of the official release. These * distinguish your DLL from those of the official release. These
* correspond to the trailing letters that come after the version * correspond to the trailing letters that come after the version
* number and must match your private DLL name> * number and must match your private DLL name>
* e.g. // private DLL "libpng13gx.dll" * e.g. // private DLL "libpng14gx.dll"
* #define PNG_USER_DLLFNAME_POSTFIX "gx" * #define PNG_USER_DLLFNAME_POSTFIX "gx"
* *
* The following macros are also at your disposal if you want to complete the * The following macros are also at your disposal if you want to complete the
@@ -269,11 +269,19 @@
* #define PNG_NO_STDIO * #define PNG_NO_STDIO
*/ */
#ifdef _WIN32_WCE
# define PNG_NO_CONSOLE_IO
# define PNG_NO_STDIO
# define PNG_NO_TIME_RFC1123
# ifdef PNG_DEBUG
# undef PNG_DEBUG
# endif
#endif
#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED) #if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)
# define PNG_STDIO_SUPPORTED # define PNG_STDIO_SUPPORTED
#endif #endif
#ifdef PNG_BUILD_DLL #ifdef PNG_BUILD_DLL
# if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO) # if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO)
# define PNG_NO_CONSOLE_IO # define PNG_NO_CONSOLE_IO
@@ -439,7 +447,7 @@
/* The following uses const char * instead of char * for error /* The following uses const char * instead of char * for error
* and warning message functions, so some compilers won't complain. * and warning message functions, so some compilers won't complain.
* If you do not want to use const, define PNG_NO_CONST here. * If you do not want to use const, define PNG_NO_CONST.
*/ */
#ifndef PNG_CONST #ifndef PNG_CONST
@@ -454,8 +462,10 @@
* library that you will not be using. I wish I could figure out how to * library that you will not be using. I wish I could figure out how to
* automate this, but I can't do that without making it seriously hard * automate this, but I can't do that without making it seriously hard
* on the users. So if you are not using an ability, change the #define * on the users. So if you are not using an ability, change the #define
* to and #undef, and that part of the library will not be compiled. If * to an #undef, or pass in PNG_NO_feature and that part of the library
* your linker can't find a function, you may want to make sure the * will not be compiled.
* If your linker can't find a function, you may want to make sure the
* ability is defined here. Some of these depend upon some others being * ability is defined here. Some of these depend upon some others being
* defined. I haven't figured out all the interactions here, so you may * defined. I haven't figured out all the interactions here, so you may
* have to experiment awhile to get everything to compile. If you are * have to experiment awhile to get everything to compile. If you are
@@ -1114,7 +1124,7 @@ typedef unsigned char png_byte;
#else #else
typedef size_t png_size_t; typedef size_t png_size_t;
#endif #endif
#define png_sizeof(x) sizeof(x) #define png_sizeof(x) (sizeof (x))
/* The following is needed for medium model support. It cannot be in the /* The following is needed for medium model support. It cannot be in the
* pngpriv.h header. Needs modification for other compilers besides * pngpriv.h header. Needs modification for other compilers besides
@@ -1236,6 +1246,13 @@ typedef char FAR * FAR * FAR * png_charppp;
# define PNG_DLL # define PNG_DLL
#endif #endif
/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
* you may get warnings regarding the linkage of png_zalloc and png_zfree.
* Don't ignore those warnings; you must also reset the default calling
* convention in your compiler to match your PNGAPI, and you must build
* zlib and your applications the same way you build libpng.
*/
#ifdef __CYGWIN__ #ifdef __CYGWIN__
# undef PNGAPI # undef PNGAPI
# define PNGAPI __cdecl # define PNGAPI __cdecl
@@ -1243,14 +1260,11 @@ typedef char FAR * FAR * FAR * png_charppp;
# define PNG_IMPEXP # define PNG_IMPEXP
#endif #endif
#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */ #ifdef __WATCOMC__
# ifndef PNGAPI
/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", # define PNGAPI
* you may get warnings regarding the linkage of png_zalloc and png_zfree. # endif
* Don't ignore those warnings; you must also reset the default calling #endif
* convention in your compiler to match your PNGAPI, and you must build
* zlib and your applications the same way you build libpng.
*/
#if defined(__MINGW32__) && !defined(PNG_MODULEDEF) #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
# ifndef PNG_NO_MODULEDEF # ifndef PNG_NO_MODULEDEF
@@ -1335,6 +1349,8 @@ typedef char FAR * FAR * FAR * png_charppp;
# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol # define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
#endif #endif
#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */
/* Support for compiler specific function attributes. These are used /* Support for compiler specific function attributes. These are used
* so that where compiler support is available incorrect use of API * so that where compiler support is available incorrect use of API
* functions in png.h will generate compiler warnings. * functions in png.h will generate compiler warnings.
@@ -1412,7 +1428,7 @@ typedef char FAR * FAR * FAR * png_charppp;
/* memory model/platform independent fns */ /* memory model/platform independent fns */
#ifndef PNG_ABORT #ifndef PNG_ABORT
# ifdef _WINDOWS_ # if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_))
# define PNG_ABORT() ExitProcess(0) # define PNG_ABORT() ExitProcess(0)
# else # else
# define PNG_ABORT() abort() # define PNG_ABORT() abort()
@@ -1433,7 +1449,8 @@ typedef char FAR * FAR * FAR * png_charppp;
# define png_memset _fmemset # define png_memset _fmemset
# define png_sprintf sprintf # define png_sprintf sprintf
#else #else
# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */ # if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_))
# /* Favor Windows over C runtime fns */
# define CVT_PTR(ptr) (ptr) # define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strcpy lstrcpyA # define png_strcpy lstrcpyA
@@ -1453,31 +1470,32 @@ typedef char FAR * FAR * FAR * png_charppp;
# define png_memcpy memcpy # define png_memcpy memcpy
# define png_memset memset # define png_memset memset
# define png_sprintf sprintf # define png_sprintf sprintf
# ifndef PNG_NO_SNPRINTF
# ifdef _MSC_VER
# define png_snprintf _snprintf /* Added to v 1.2.19 */
# define png_snprintf2 _snprintf
# define png_snprintf6 _snprintf
# else
# define png_snprintf snprintf /* Added to v 1.2.19 */
# define png_snprintf2 snprintf
# define png_snprintf6 snprintf
# endif
# else
/* You don't have or don't want to use snprintf(). Caution: Using
* sprintf instead of snprintf exposes your application to accidental
* or malevolent buffer overflows. If you don't have snprintf()
* as a general rule you should provide one (you can get one from
* Portable OpenSSH).
*/
# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
# endif
# endif # endif
#endif #endif
#ifndef PNG_NO_SNPRINTF
# ifdef _MSC_VER
# define png_snprintf _snprintf /* Added to v 1.2.19 */
# define png_snprintf2 _snprintf
# define png_snprintf6 _snprintf
# else
# define png_snprintf snprintf /* Added to v 1.2.19 */
# define png_snprintf2 snprintf
# define png_snprintf6 snprintf
# endif
#else
/* You don't have or don't want to use snprintf(). Caution: Using
* sprintf instead of snprintf exposes your application to accidental
* or malevolent buffer overflows. If you don't have snprintf()
* as a general rule you should provide one (you can get one from
* Portable OpenSSH).
*/
# define png_snprintf(s1,n,fmt,x1) png_sprintf(s1,fmt,x1)
# define png_snprintf2(s1,n,fmt,x1,x2) png_sprintf(s1,fmt,x1,x2)
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
png_sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
#endif
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, /* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
* and no smaller than png_uint_32. Casts from png_size_t or png_uint_32 * and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
* to png_alloc_size_t are not necessary; in fact, it is recommended * to png_alloc_size_t are not necessary; in fact, it is recommended
@@ -1488,22 +1506,19 @@ typedef char FAR * FAR * FAR * png_charppp;
* to encounter practical situations that require such conversions. * to encounter practical situations that require such conversions.
*/ */
#if defined(__TURBOC__) && !defined(__FLAT__) #if defined(__TURBOC__) && !defined(__FLAT__)
# define png_mem_alloc farmalloc
# define png_mem_free farfree
typedef unsigned long png_alloc_size_t; typedef unsigned long png_alloc_size_t;
#else #else
# if defined(_MSC_VER) && defined(MAXSEG_64K) # if defined(_MSC_VER) && defined(MAXSEG_64K)
# define png_mem_alloc(s) halloc(s, 1)
# define png_mem_free hfree
typedef unsigned long png_alloc_size_t; typedef unsigned long png_alloc_size_t;
# else # else
# if defined(_WINDOWS_) && (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL) /* This is an attempt to detect an old Windows system where (int) is
# define png_mem_alloc(s) HeapAlloc(GetProcessHeap(), 0, s) * actually 16 bits, in that case png_malloc must have an argument with a
# define png_mem_free(p) HeapFree(GetProcessHeap(), 0, p) * bigger size to accomodate the requirements of the library.
typedef DWORD png_alloc_size_t; */
# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \
(!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
typedef DWORD png_alloc_size_t;
# else # else
# define png_mem_alloc malloc
# define png_mem_free free
typedef png_size_t png_alloc_size_t; typedef png_size_t png_alloc_size_t;
# endif # endif
# endif # endif
+4
View File
@@ -5,6 +5,10 @@ SetSubDirSupportedPlatformsBeOSCompatible ;
UseLibraryHeaders png zlib ; UseLibraryHeaders png zlib ;
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) shared ] ; SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) shared ] ;
if $(HAIKU_GCC_VERSION[1]) = 2 {
SubDirCcFlags -DPNG_NO_PEDANTIC_WARNINGS ;
}
Translator PNGTranslator : Translator PNGTranslator :
PNGMain.cpp PNGMain.cpp
PNGTranslator.cpp PNGTranslator.cpp
@@ -33,6 +33,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <OS.h> #include <OS.h>
#define PNG_NO_PEDANTIC_WARNINGS
#include <png.h> #include <png.h>
#include "PNGTranslator.h" #include "PNGTranslator.h"
#include "PNGView.h" #include "PNGView.h"
+1
View File
@@ -19,6 +19,7 @@
#include <TextView.h> #include <TextView.h>
#include <stdio.h> #include <stdio.h>
#define PNG_NO_PEDANTIC_WARNINGS
#include <png.h> #include <png.h>
+3 -3
View File
@@ -10,8 +10,8 @@ this sentence.
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.4.3, June 26, 2010, are libpng versions 1.2.6, August 15, 2004, through 1.4.4, September 23, 2010, are
Copyright (c) 2004, 2006-2007 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
@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
June 26, 2010 September 23, 2010
+3 -3
View File
@@ -17,7 +17,7 @@
#include "pngpriv.h" #include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_4_3 Your_png_h_is_not_version_1_4_3; typedef version_1_4_4 Your_png_h_is_not_version_1_4_4;
/* Version information for C files. This had better match the version /* Version information for C files. This had better match the version
* string defined in png.h. * string defined in png.h.
@@ -551,13 +551,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.4.3 - June 26, 2010" PNG_STRING_NEWLINE \ "libpng version 1.4.4 - September 23, 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.4.3 - June 26, 2010\ return ((png_charp) "libpng version 1.4.4 - September 23, 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.");
+31 -31
View File
@@ -843,7 +843,7 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
* or the stream marked as finished. * or the stream marked as finished.
*/ */
while (png_ptr->zstream.avail_in > 0 && while (png_ptr->zstream.avail_in > 0 &&
!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) !(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
{ {
int ret; int ret;
@@ -872,49 +872,49 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
/* Check for any failure before proceeding. */ /* Check for any failure before proceeding. */
if (ret != Z_OK && ret != Z_STREAM_END) if (ret != Z_OK && ret != Z_STREAM_END)
{ {
/* Terminate the decompression. */ /* Terminate the decompression. */
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
/* This may be a truncated stream (missing or /* This may be a truncated stream (missing or
* damaged end code). Treat that as a warning. * damaged end code). Treat that as a warning.
*/ */
if (png_ptr->row_number >= png_ptr->num_rows || if (png_ptr->row_number >= png_ptr->num_rows ||
png_ptr->pass > 6) png_ptr->pass > 6)
png_warning(png_ptr, "Truncated compressed data in IDAT"); png_warning(png_ptr, "Truncated compressed data in IDAT");
else else
png_error(png_ptr, "Decompression error in IDAT"); png_error(png_ptr, "Decompression error in IDAT");
/* Skip the check on unprocessed input */ /* Skip the check on unprocessed input */
return; return;
} }
/* Did inflate output any data? */ /* Did inflate output any data? */
if (png_ptr->zstream.next_out != png_ptr->row_buf) if (png_ptr->zstream.next_out != png_ptr->row_buf)
{ {
/* Is this unexpected data after the last row? /* Is this unexpected data after the last row?
* If it is, artificially terminate the LZ output * If it is, artificially terminate the LZ output
* here. * here.
*/ */
if (png_ptr->row_number >= png_ptr->num_rows || if (png_ptr->row_number >= png_ptr->num_rows ||
png_ptr->pass > 6) png_ptr->pass > 6)
{ {
/* Extra data. */ /* Extra data. */
png_warning(png_ptr, "Extra compressed data in IDAT"); png_warning(png_ptr, "Extra compressed data in IDAT");
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
/* Do no more processing; skip the unprocessed /* Do no more processing; skip the unprocessed
* input check below. * input check below.
*/ */
return; return;
} }
/* Do we have a complete row? */ /* Do we have a complete row? */
if (png_ptr->zstream.avail_out == 0) if (png_ptr->zstream.avail_out == 0)
png_push_process_row(png_ptr); png_push_process_row(png_ptr);
} }
/* And check for the end of the stream. */ /* And check for the end of the stream. */
if (ret == Z_STREAM_END) if (ret == Z_STREAM_END)
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
} }
/* All the data should have been processed, if anything /* All the data should have been processed, if anything
@@ -988,7 +988,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->pass == 6 && png_ptr->height <= 4) if (png_ptr->pass == 6 && png_ptr->height <= 4)
{ {
png_push_have_row(png_ptr, NULL); png_push_have_row(png_ptr, NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
@@ -1028,7 +1028,7 @@ png_push_process_row(png_structp png_ptr)
for (i = 0; i < 4 && png_ptr->pass == 2; i++) for (i = 0; i < 4 && png_ptr->pass == 2; i++)
{ {
png_push_have_row(png_ptr, NULL); png_push_have_row(png_ptr, NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
@@ -1078,13 +1078,13 @@ png_push_process_row(png_structp png_ptr)
for (i = 0; i < 2 && png_ptr->pass == 4; i++) for (i = 0; i < 2 && png_ptr->pass == 4; i++)
{ {
png_push_have_row(png_ptr, NULL); png_push_have_row(png_ptr, NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
if (png_ptr->pass == 6) /* Pass 5 might be empty */ if (png_ptr->pass == 6) /* Pass 5 might be empty */
{ {
png_push_have_row(png_ptr, NULL); png_push_have_row(png_ptr, NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
@@ -1103,7 +1103,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->pass == 6) /* Skip top generated row */ if (png_ptr->pass == 6) /* Skip top generated row */
{ {
png_push_have_row(png_ptr, NULL); png_push_have_row(png_ptr, NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
@@ -1117,7 +1117,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->pass != 6) if (png_ptr->pass != 6)
break; break;
png_push_have_row(png_ptr, NULL); png_push_have_row(png_ptr, NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
} }
+10 -12
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.4.3 - June 26, 2010 * libpng version 1.4.4 - September 23, 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)
@@ -28,14 +28,16 @@
#include <stdlib.h> #include <stdlib.h>
#ifndef PNG_EXTERN
/* The functions exported by PNG_EXTERN are internal functions, which /* The functions exported by PNG_EXTERN are internal functions, which
* aren't usually used outside the library (as far as I know), so it is * aren't usually used outside the library (as far as I know), so it is
* debatable if they should be exported at all. In the future, when it * debatable if they should be exported at all. In the future, when it
* is possible to have run-time registry of chunk-handling functions, * is possible to have run-time registry of chunk-handling functions,
* some of these will be made available again. * some of these will be made available again.
#define PNG_EXTERN extern # define PNG_EXTERN extern
*/ */
#define PNG_EXTERN # define PNG_EXTERN
#endif
/* Other defines specific to compilers can go here. Try to keep /* Other defines specific to compilers can go here. Try to keep
* them inside an appropriate ifdef/endif pair for portability. * them inside an appropriate ifdef/endif pair for portability.
@@ -75,10 +77,6 @@
#if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \
defined(_WIN32) || defined(__WIN32__) defined(_WIN32) || defined(__WIN32__)
# include <windows.h> /* defines _WINDOWS_ macro */ # include <windows.h> /* defines _WINDOWS_ macro */
/* I have no idea why is this necessary... */
# ifdef _MSC_VER
# include <malloc.h>
# endif
#endif #endif
/* Various modes of operation. Note that after an init, mode is set to /* Various modes of operation. Note that after an init, mode is set to
@@ -672,7 +670,7 @@ PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
#endif #endif
#ifdef PNG_READ_iCCP_SUPPORTED #ifdef PNG_READ_iCCP_SUPPORTED
extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif /* PNG_READ_iCCP_SUPPORTED */ #endif /* PNG_READ_iCCP_SUPPORTED */
@@ -707,7 +705,7 @@ PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
#endif #endif
#ifdef PNG_READ_sPLT_SUPPORTED #ifdef PNG_READ_sPLT_SUPPORTED
extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif /* PNG_READ_sPLT_SUPPORTED */ #endif /* PNG_READ_sPLT_SUPPORTED */
@@ -828,14 +826,14 @@ PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
int filter_type)); int filter_type));
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */ /* Free all memory used by the read (old method - NOT DLL EXPORTED) */
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
png_infop end_info_ptr)); png_infop end_info_ptr));
/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ /* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
extern void png_write_destroy PNGARG((png_structp png_ptr)); PNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr));
#ifdef USE_FAR_KEYWORD /* memory model conversion function */ #ifdef USE_FAR_KEYWORD /* memory model conversion function */
extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr, PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
int check)); int check));
#endif /* USE_FAR_KEYWORD */ #endif /* USE_FAR_KEYWORD */
+32 -34
View File
@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* Last changed in libpng 1.4.3 [June 26, 2010] * Last changed in libpng 1.4.4 [August 26, 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.)
@@ -30,38 +30,41 @@ png_get_uint_31(png_structp png_ptr, png_bytep buf)
} }
#ifndef PNG_USE_READ_MACROS #ifndef PNG_USE_READ_MACROS
/* Grab an unsigned 32-bit integer from a buffer in big-endian format. */ /* Grab an unsigned 32-bit integer from a buffer in big-endian format. */
png_uint_32 PNGAPI png_uint_32 (PNGAPI
png_get_uint_32(png_bytep buf) png_get_uint_32)(png_bytep buf)
{ {
png_uint_32 i = ((png_uint_32)(*buf) << 24) + png_uint_32 i =
((png_uint_32)(*(buf + 1)) << 16) + ((png_uint_32)(*(buf )) << 24) +
((png_uint_32)(*(buf + 2)) << 8) + ((png_uint_32)(*(buf + 1)) << 16) +
(png_uint_32)(*(buf + 3)); ((png_uint_32)(*(buf + 2)) << 8) +
((png_uint_32)(*(buf + 3)) ) ;
return (i); return (i);
} }
/* Grab a signed 32-bit integer from a buffer in big-endian format. The /* Grab a signed 32-bit integer from a buffer in big-endian format. The
* data is stored in the PNG file in two's complement format, and it is * data is stored in the PNG file in two's complement format and there
* assumed that the machine format for signed integers is the same. * is no guarantee that a 'png_int_32' is exactly 32 bits, therefore
* the following code does a two's complement to native conversion.
*/ */
png_int_32 PNGAPI png_int_32 (PNGAPI
png_get_int_32(png_bytep buf) png_get_int_32)(png_bytep buf)
{ {
png_int_32 i = ((png_int_32)(*buf) << 24) + png_uint_32 u = png_get_uint_32(buf);
((png_int_32)(*(buf + 1)) << 16) + if ((u & 0x80000000) == 0) /* non-negative */
((png_int_32)(*(buf + 2)) << 8) + return u;
(png_int_32)(*(buf + 3));
return (i); u = (u ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
return -(png_int_32)u;
} }
/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */ /* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
png_uint_16 PNGAPI png_uint_16 (PNGAPI
png_get_uint_16(png_bytep buf) png_get_uint_16)(png_bytep buf)
{ {
png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) + png_uint_16 i =
(png_uint_16)(*(buf + 1))); ((png_uint_32)(*buf) << 8) +
((png_uint_32)(*(buf + 1)));
return (i); return (i);
} }
@@ -1128,20 +1131,20 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (profile_size > profile_length) if (profile_size > profile_length)
{ {
#ifdef PNG_STDIO_SUPPORTED
char umsg[50];
#endif
png_free(png_ptr, png_ptr->chunkdata); png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL; png_ptr->chunkdata = NULL;
png_warning(png_ptr, "Ignoring truncated iCCP profile"); png_warning(png_ptr, "Ignoring truncated iCCP profile");
#ifdef PNG_STDIO_SUPPORTED #ifdef PNG_STDIO_SUPPORTED
{
char umsg[50];
png_snprintf(umsg, 50, "declared profile size = %lu", png_snprintf(umsg, 50, "declared profile size = %lu",
(unsigned long)profile_size); (unsigned long)profile_size);
png_warning(png_ptr, umsg); png_warning(png_ptr, umsg);
png_snprintf(umsg, 50, "actual profile length = %lu", png_snprintf(umsg, 50, "actual profile length = %lu",
(unsigned long)profile_length); (unsigned long)profile_length);
png_warning(png_ptr, umsg); png_warning(png_ptr, umsg);
}
#endif #endif
return; return;
} }
@@ -1875,9 +1878,6 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_warning(png_ptr, "malformed height string in sCAL chunk"); png_warning(png_ptr, "malformed height string in sCAL chunk");
png_free(png_ptr, png_ptr->chunkdata); png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL; png_ptr->chunkdata = NULL;
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, swidth);
#endif
return; return;
} }
#else #else
@@ -1888,9 +1888,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_warning(png_ptr, "Out of memory while processing sCAL chunk height"); png_warning(png_ptr, "Out of memory while processing sCAL chunk height");
png_free(png_ptr, png_ptr->chunkdata); png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL; png_ptr->chunkdata = NULL;
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, swidth); png_free(png_ptr, swidth);
#endif
return; return;
} }
png_memcpy(sheight, ep, png_strlen(ep)); png_memcpy(sheight, ep, png_strlen(ep));
+1 -1
View File
@@ -673,5 +673,5 @@ png_get_user_transform_ptr(png_structp png_ptr)
#endif #endif
} }
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED || #endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
PNG_WRITE_USER_TRANSFORM_SUPPORTED */ PNG_WRITE_USER_TRANSFORM_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */