1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

libpng: Update to 1.6.48

This commit is contained in:
Rémi Verschelde
2025-06-05 17:13:04 +02:00
parent 10c07157a1
commit 79000c725b
24 changed files with 114 additions and 141 deletions

View File

@@ -561,7 +561,7 @@ Files extracted from upstream source:
## libpng ## libpng
- Upstream: http://libpng.org/pub/png/libpng.html - Upstream: http://libpng.org/pub/png/libpng.html
- Version: 1.6.47 (872555f4ba910252783af1507f9e7fe1653be252, 2025) - Version: 1.6.48 (ea127968204cc5d10f3fc9250c306b9e8cbd9b80, 2025)
- License: libpng/zlib - License: libpng/zlib
Files extracted from upstream source: Files extracted from upstream source:

View File

@@ -35,14 +35,14 @@
#ifndef PNG_ARM_NEON_FILE #ifndef PNG_ARM_NEON_FILE
# if defined(__aarch64__) || defined(_M_ARM64) # if defined(__aarch64__) || defined(_M_ARM64)
/* ARM Neon is expected to be unconditionally available on ARM64. */ /* ARM Neon is expected to be unconditionally available on ARM64. */
# error "PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on ARM64" # error PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on ARM64
# elif defined(__ARM_NEON__) || defined(__ARM_NEON) # elif defined(__ARM_NEON__) || defined(__ARM_NEON)
/* ARM Neon is expected to be available on the target CPU architecture. */ /* ARM Neon is expected to be available on the target CPU architecture. */
# error "PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on this CPU arch" # error PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on this CPU arch
# elif defined(__linux__) # elif defined(__linux__)
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c" # define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
# else # else
# error "No support for run-time ARM Neon checking; use compile-time options" # error No support for run-time ARM Neon checking; use compile-time options
# endif # endif
#endif #endif
@@ -53,7 +53,7 @@ static int png_have_neon(png_structp png_ptr);
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */ #endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED #ifndef PNG_ALIGNED_MEMORY_SUPPORTED
# error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED" # error ALIGNED_MEMORY is required; please define PNG_ALIGNED_MEMORY_SUPPORTED
#endif #endif
void void

View File

@@ -13,7 +13,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 png_libpng_version_1_6_47 Your_png_h_is_not_version_1_6_47; typedef png_libpng_version_1_6_48 Your_png_h_is_not_version_1_6_48;
/* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the /* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the
* corresponding macro definitions. This causes a compile time failure if * corresponding macro definitions. This causes a compile time failure if
@@ -700,7 +700,7 @@ png_get_io_ptr(png_const_structrp png_ptr)
* function of your own because "FILE *" isn't necessarily available. * function of your own because "FILE *" isn't necessarily available.
*/ */
void PNGAPI void PNGAPI
png_init_io(png_structrp png_ptr, png_FILE_p fp) png_init_io(png_structrp png_ptr, FILE *fp)
{ {
png_debug(1, "in png_init_io"); png_debug(1, "in png_init_io");
@@ -815,7 +815,7 @@ png_get_copyright(png_const_structrp png_ptr)
return PNG_STRING_COPYRIGHT return PNG_STRING_COPYRIGHT
#else #else
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.47" PNG_STRING_NEWLINE \ "libpng version 1.6.48" PNG_STRING_NEWLINE \
"Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \ "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \ PNG_STRING_NEWLINE \
@@ -1491,7 +1491,7 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
} }
#endif /* COLORSPACE */ #endif /* COLORSPACE */
#ifdef PNG_iCCP_SUPPORTED #ifdef PNG_READ_iCCP_SUPPORTED
/* Error message generation */ /* Error message generation */
static char static char
png_icc_tag_char(png_uint_32 byte) png_icc_tag_char(png_uint_32 byte)
@@ -1567,9 +1567,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_const_charp name,
return 0; return 0;
} }
#endif /* iCCP */
#ifdef PNG_READ_iCCP_SUPPORTED
/* Encoded value of D50 as an ICC XYZNumber. From the ICC 2010 spec the value /* Encoded value of D50 as an ICC XYZNumber. From the ICC 2010 spec the value
* is XYZ(0.9642,1.0,0.8249), which scales to: * is XYZ(0.9642,1.0,0.8249), which scales to:
* *
@@ -3969,7 +3967,7 @@ png_image_free_function(png_voidp argument)
# ifdef PNG_STDIO_SUPPORTED # ifdef PNG_STDIO_SUPPORTED
if (cp->owned_file != 0) if (cp->owned_file != 0)
{ {
FILE *fp = png_voidcast(FILE*, cp->png_ptr->io_ptr); FILE *fp = png_voidcast(FILE *, cp->png_ptr->io_ptr);
cp->owned_file = 0; cp->owned_file = 0;
/* Ignore errors here. */ /* Ignore errors here. */

View File

@@ -1,6 +1,6 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.6.47 * libpng version 1.6.48
* *
* Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
@@ -14,7 +14,7 @@
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.35, July 2018: * libpng versions 0.97, January 1998, through 1.6.35, July 2018:
* Glenn Randers-Pehrson * Glenn Randers-Pehrson
* libpng versions 1.6.36, December 2018, through 1.6.47, February 2025: * libpng versions 1.6.36, December 2018, through 1.6.48, April 2025:
* Cosmin Truta * Cosmin Truta
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
*/ */
@@ -238,7 +238,7 @@
* ... * ...
* 1.5.30 15 10530 15.so.15.30[.0] * 1.5.30 15 10530 15.so.15.30[.0]
* ... * ...
* 1.6.47 16 10647 16.so.16.47[.0] * 1.6.48 16 10648 16.so.16.48[.0]
* *
* Henceforth the source version will match the shared-library major and * Henceforth the source version will match the shared-library major and
* minor numbers; the shared-library major version number will be used for * minor numbers; the shared-library major version number will be used for
@@ -274,7 +274,7 @@
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.47" #define PNG_LIBPNG_VER_STRING "1.6.48"
#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n" #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
/* The versions of shared library builds should stay in sync, going forward */ /* The versions of shared library builds should stay in sync, going forward */
@@ -285,7 +285,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6 #define PNG_LIBPNG_VER_MINOR 6
#define PNG_LIBPNG_VER_RELEASE 47 #define PNG_LIBPNG_VER_RELEASE 48
/* This should be zero for a public release, or non-zero for a /* This should be zero for a public release, or non-zero for a
* development version. * development version.
@@ -316,7 +316,7 @@
* From version 1.0.1 it is: * From version 1.0.1 it is:
* XXYYZZ, where XX=major, YY=minor, ZZ=release * XXYYZZ, where XX=major, YY=minor, ZZ=release
*/ */
#define PNG_LIBPNG_VER 10647 /* 1.6.47 */ #define PNG_LIBPNG_VER 10648 /* 1.6.48 */
/* Library configuration: these options cannot be changed after /* Library configuration: these options cannot be changed after
* the library has been built. * the library has been built.
@@ -426,7 +426,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h /* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number. * do not agree upon the version number.
*/ */
typedef char* png_libpng_version_1_6_47; typedef char* png_libpng_version_1_6_48;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
* *
@@ -1570,7 +1570,7 @@ PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
#ifdef PNG_STDIO_SUPPORTED #ifdef PNG_STDIO_SUPPORTED
/* Initialize the input/output for the PNG file to the default functions. */ /* Initialize the input/output for the PNG file to the default functions. */
PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, png_FILE_p fp)); PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, FILE *fp));
#endif #endif
/* Replace the (error and abort), and warning functions with user /* Replace the (error and abort), and warning functions with user
@@ -3088,7 +3088,7 @@ PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image,
*/ */
PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image, PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
FILE* file)); FILE *file));
/* The PNG header is read from the stdio FILE object. */ /* The PNG header is read from the stdio FILE object. */
#endif /* STDIO */ #endif /* STDIO */
@@ -3163,7 +3163,7 @@ PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image,
PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file, PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
int convert_to_8_bit, const void *buffer, png_int_32 row_stride, int convert_to_8_bit, const void *buffer, png_int_32 row_stride,
const void *colormap)); const void *colormap));
/* Write the image to the given (FILE*). */ /* Write the image to the given FILE object. */
#endif /* SIMPLIFIED_WRITE_STDIO */ #endif /* SIMPLIFIED_WRITE_STDIO */
/* With all write APIs if image is in one of the linear formats with 16-bit /* With all write APIs if image is in one of the linear formats with 16-bit

View File

@@ -1,6 +1,6 @@
/* pngconf.h - machine-configurable file for libpng /* pngconf.h - machine-configurable file for libpng
* *
* libpng version 1.6.47 * libpng version 1.6.48
* *
* Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
@@ -219,25 +219,13 @@
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */ /* NOTE: PNGCBAPI always defaults to PNGCAPI. */
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD) # if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
# error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed" # error PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed
# endif # endif
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\ # define PNG_DLL_EXPORT __declspec(dllexport)
(defined(__BORLANDC__) && __BORLANDC__ < 0x500) # ifndef PNG_DLL_IMPORT
/* older Borland and MSC # define PNG_DLL_IMPORT __declspec(dllimport)
* compilers used '__export' and required this to be after # endif
* the type.
*/
# ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
# endif
# define PNG_DLL_EXPORT __export
# else /* newer compiler */
# define PNG_DLL_EXPORT __declspec(dllexport)
# ifndef PNG_DLL_IMPORT
# define PNG_DLL_IMPORT __declspec(dllimport)
# endif
# endif /* compiler */
#else /* !Windows */ #else /* !Windows */
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
@@ -479,7 +467,7 @@
#if CHAR_BIT == 8 && UCHAR_MAX == 255 #if CHAR_BIT == 8 && UCHAR_MAX == 255
typedef unsigned char png_byte; typedef unsigned char png_byte;
#else #else
# error "libpng requires 8-bit bytes" # error libpng requires 8-bit bytes
#endif #endif
#if INT_MIN == -32768 && INT_MAX == 32767 #if INT_MIN == -32768 && INT_MAX == 32767
@@ -487,7 +475,7 @@
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767 #elif SHRT_MIN == -32768 && SHRT_MAX == 32767
typedef short png_int_16; typedef short png_int_16;
#else #else
# error "libpng requires a signed 16-bit type" # error libpng requires a signed 16-bit integer type
#endif #endif
#if UINT_MAX == 65535 #if UINT_MAX == 65535
@@ -495,7 +483,7 @@
#elif USHRT_MAX == 65535 #elif USHRT_MAX == 65535
typedef unsigned short png_uint_16; typedef unsigned short png_uint_16;
#else #else
# error "libpng requires an unsigned 16-bit type" # error libpng requires an unsigned 16-bit integer type
#endif #endif
#if INT_MIN < -2147483646 && INT_MAX > 2147483646 #if INT_MIN < -2147483646 && INT_MAX > 2147483646
@@ -503,7 +491,7 @@
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646 #elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
typedef long int png_int_32; typedef long int png_int_32;
#else #else
# error "libpng requires a signed 32-bit (or more) type" # error libpng requires a signed 32-bit (or longer) integer type
#endif #endif
#if UINT_MAX > 4294967294U #if UINT_MAX > 4294967294U
@@ -511,7 +499,7 @@
#elif ULONG_MAX > 4294967294U #elif ULONG_MAX > 4294967294U
typedef unsigned long int png_uint_32; typedef unsigned long int png_uint_32;
#else #else
# error "libpng requires an unsigned 32-bit (or more) type" # error libpng requires an unsigned 32-bit (or longer) integer type
#endif #endif
/* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t. /* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t.
@@ -592,10 +580,6 @@ typedef const png_fixed_point * png_const_fixed_point_p;
typedef size_t * png_size_tp; typedef size_t * png_size_tp;
typedef const size_t * png_const_size_tp; typedef const size_t * png_const_size_tp;
#ifdef PNG_STDIO_SUPPORTED
typedef FILE * png_FILE_p;
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double * png_doublep; typedef double * png_doublep;
typedef const double * png_const_doublep; typedef const double * png_const_doublep;
@@ -617,6 +601,15 @@ typedef double * * png_doublepp;
/* Pointers to pointers to pointers; i.e., pointer to array */ /* Pointers to pointers to pointers; i.e., pointer to array */
typedef char * * * png_charppp; typedef char * * * png_charppp;
#ifdef PNG_STDIO_SUPPORTED
/* With PNG_STDIO_SUPPORTED it was possible to use I/O streams that were
* not necessarily stdio FILE streams, to allow building Windows applications
* before Win32 and Windows CE applications before WinCE 3.0, but that kind
* of support has long been discontinued.
*/
typedef FILE * png_FILE_p; /* [Deprecated] */
#endif
#endif /* PNG_BUILDING_SYMBOL_TABLE */ #endif /* PNG_BUILDING_SYMBOL_TABLE */
#endif /* PNGCONF_H */ #endif /* PNGCONF_H */

View File

@@ -1,6 +1,6 @@
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c /* pngdebug.h - internal debugging macros for libpng
* *
* Copyright (c) 2018 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2013 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.
@@ -10,6 +10,10 @@
* and license in png.h * and license in png.h
*/ */
#ifndef PNGPRIV_H
# error This file must not be included by applications; please include <png.h>
#endif
/* Define PNG_DEBUG at compile time for debugging information. Higher /* Define PNG_DEBUG at compile time for debugging information. Higher
* numbers for PNG_DEBUG mean more debugging information. This has * numbers for PNG_DEBUG mean more debugging information. This has
* only been added since version 0.95 so it is not implemented throughout * only been added since version 0.95 so it is not implemented throughout

View File

@@ -1,6 +1,6 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 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.

View File

@@ -1,6 +1,6 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 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.

View File

@@ -1,6 +1,6 @@
/* pnginfo.h - header file for PNG reference library /* pnginfo.h - internal structures for libpng
* *
* Copyright (c) 2018 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2013,2018 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.
@@ -10,43 +10,20 @@
* and license in png.h * and license in png.h
*/ */
/* png_info is a structure that holds the information in a PNG file so #ifndef PNGPRIV_H
* that the application can find out the characteristics of the image. # error This file must not be included by applications; please include <png.h>
* If you are reading the file, this structure will tell you what is #endif
* in the PNG file. If you are writing the file, fill in the information
* you want to put into the PNG file, using png_set_*() functions, then /* INTERNAL, PRIVATE definition of a PNG.
* call png_write_info().
* *
* The names chosen should be very close to the PNG specification, so * png_info is a modifiable description of a PNG datastream. The fields inside
* consult that document for information about the meaning of each field. * this structure are accessed through png_get_<CHUNK>() functions and modified
* using png_set_<CHUNK>() functions.
* *
* With libpng < 0.95, it was only possible to directly set and read the * Some functions in libpng do directly access members of png_info. However,
* the values in the png_info_struct, which meant that the contents and * this should be avoided. png_struct objects contain members which hold
* order of the values had to remain fixed. With libpng 0.95 and later, * caches, sometimes optimised, of the values from png_info objects, and
* however, there are now functions that abstract the contents of * png_info is not passed to the functions which read and write image data.
* png_info_struct from the application, so this makes it easier to use
* libpng with dynamic libraries, and even makes it possible to use
* libraries that don't have all of the libpng ancillary chunk-handing
* functionality. In libpng-1.5.0 this was moved into a separate private
* file that is not visible to applications.
*
* The following members may have allocated storage attached that should be
* cleaned up before the structure is discarded: palette, trans, text,
* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
* are automatically freed when the info structure is deallocated, if they were
* allocated internally by libpng. This behavior can be changed by means
* of the png_data_freer() function.
*
* More allocation details: all the chunk-reading functions that
* change these members go through the corresponding png_set_*
* functions. A function to clear these members is available: see
* png_free_data(). The png_set_* functions do not depend on being
* able to point info structure members to any of the storage they are
* passed (they make their own copies), EXCEPT that the png_set_text
* functions use the same storage passed to them in the text_ptr or
* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
* functions do not make their own copies.
*/ */
#ifndef PNGINFO_H #ifndef PNGINFO_H
#define PNGINFO_H #define PNGINFO_H

View File

@@ -1,6 +1,6 @@
/* pnglibconf.h - library build configuration */ /* pnglibconf.h - library build configuration */
/* libpng version 1.6.47 */ /* libpng version 1.6.48 */
/* Copyright (c) 2018-2025 Cosmin Truta */ /* Copyright (c) 2018-2025 Cosmin Truta */
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */

View File

@@ -1,6 +1,6 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* Copyright (c) 2018 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2014,2016 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.

View File

@@ -1,6 +1,6 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 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.

View File

@@ -1,6 +1,6 @@
/* pngpriv.h - private declarations for use inside libpng /* pngpriv.h - private declarations for use inside libpng
* *
* Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 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.
@@ -19,8 +19,20 @@
* they should be well aware of the issues that may arise from doing so. * they should be well aware of the issues that may arise from doing so.
*/ */
/* pngpriv.h must be included first in each translation unit inside libpng.
* On the other hand, it must not be included at all, directly or indirectly,
* by any application code that uses the libpng API.
*/
#ifndef PNGPRIV_H #ifndef PNGPRIV_H
#define PNGPRIV_H # define PNGPRIV_H
#else
# error Duplicate inclusion of pngpriv.h; please check the libpng source files
#endif
#if defined(PNG_H) || defined(PNGCONF_H) || defined(PNGLCONF_H)
# error This file must not be included by applications; please include <png.h>
#endif
/* Feature Test Macros. The following are defined here to ensure that correctly /* Feature Test Macros. The following are defined here to ensure that correctly
* implemented libraries reveal the APIs libpng needs to build and hide those * implemented libraries reveal the APIs libpng needs to build and hide those
@@ -57,7 +69,6 @@
*/ */
#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H) #if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
# include <config.h> # include <config.h>
/* Pick up the definition of 'restrict' from config.h if it was read: */ /* Pick up the definition of 'restrict' from config.h if it was read: */
# define PNG_RESTRICT restrict # define PNG_RESTRICT restrict
#endif #endif
@@ -67,9 +78,7 @@
* are not internal definitions may be required. This is handled below just * are not internal definitions may be required. This is handled below just
* before png.h is included, but load the configuration now if it is available. * before png.h is included, but load the configuration now if it is available.
*/ */
#ifndef PNGLCONF_H #include "pnglibconf.h"
# include "pnglibconf.h"
#endif
/* Local renames may change non-exported API functions from png.h */ /* Local renames may change non-exported API functions from png.h */
#if defined(PNG_PREFIX) && !defined(PNGPREFIX_H) #if defined(PNG_PREFIX) && !defined(PNGPREFIX_H)
@@ -991,17 +1000,15 @@
* must match that used in the build, or we must be using pnglibconf.h.prebuilt: * must match that used in the build, or we must be using pnglibconf.h.prebuilt:
*/ */
#if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM #if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM
# error ZLIB_VERNUM != PNG_ZLIB_VERNUM \ # error The include path of <zlib.h> is incorrect
"-I (include path) error: see the notes in pngpriv.h" /* When pnglibconf.h was built, the copy of zlib.h that it used was not the
/* This means that when pnglibconf.h was built the copy of zlib.h that it * same as the one being used here. Considering how libpng makes decisions
* used is not the same as the one being used here. Because the build of * to use the zlib API based on the zlib version number, the -I options must
* libpng makes decisions to use inflateInit2 and inflateReset2 based on the * match.
* zlib version number and because this affects handling of certain broken
* PNG files the -I directives must match.
* *
* The most likely explanation is that you passed a -I in CFLAGS. This will * A possible cause of this mismatch is that you passed an -I option in
* not work; all the preprocessor directives and in particular all the -I * CFLAGS, which is unlikely to work. All the preprocessor options, and all
* directives must be in CPPFLAGS. * the -I options in particular, should be in CPPFLAGS.
*/ */
#endif #endif
@@ -2162,4 +2169,3 @@ PNG_INTERNAL_FUNCTION(int,
#endif #endif
#endif /* PNG_VERSION_INFO_ONLY */ #endif /* PNG_VERSION_INFO_ONLY */
#endif /* PNGPRIV_H */

View File

@@ -1328,7 +1328,7 @@ png_image_read_header(png_voidp argument)
#ifdef PNG_STDIO_SUPPORTED #ifdef PNG_STDIO_SUPPORTED
int PNGAPI int PNGAPI
png_image_begin_read_from_stdio(png_imagep image, FILE* file) png_image_begin_read_from_stdio(png_imagep image, FILE *file)
{ {
if (image != NULL && image->version == PNG_IMAGE_VERSION) if (image != NULL && image->version == PNG_IMAGE_VERSION)
{ {

View File

@@ -1,6 +1,6 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* Copyright (c) 2018 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2016,2018 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.
@@ -56,7 +56,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, size_t length)
/* fread() returns 0 on error, so it is OK to store this in a size_t /* fread() returns 0 on error, so it is OK to store this in a size_t
* instead of an int, which is what fread() actually returns. * instead of an int, which is what fread() actually returns.
*/ */
check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr)); check = fread(data, 1, length, png_voidcast(FILE *, png_ptr->io_ptr));
if (check != length) if (check != length)
png_error(png_ptr, "Read Error"); png_error(png_ptr, "Read Error");

View File

@@ -1,6 +1,6 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 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.

View File

@@ -1,6 +1,6 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 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.

View File

@@ -300,17 +300,14 @@ png_set_mDCV(png_const_structrp png_ptr, png_inforp info_ptr,
double maxDL, double minDL) double maxDL, double minDL)
{ {
png_set_mDCV_fixed(png_ptr, info_ptr, png_set_mDCV_fixed(png_ptr, info_ptr,
/* The ITU approach is to scale by 50,000, not 100,000 so just divide png_fixed(png_ptr, white_x, "png_set_mDCV(white(x))"),
* the input values by 2 and use png_fixed: png_fixed(png_ptr, white_y, "png_set_mDCV(white(y))"),
*/ png_fixed(png_ptr, red_x, "png_set_mDCV(red(x))"),
png_fixed(png_ptr, white_x / 2, "png_set_mDCV(white(x))"), png_fixed(png_ptr, red_y, "png_set_mDCV(red(y))"),
png_fixed(png_ptr, white_y / 2, "png_set_mDCV(white(y))"), png_fixed(png_ptr, green_x, "png_set_mDCV(green(x))"),
png_fixed(png_ptr, red_x / 2, "png_set_mDCV(red(x))"), png_fixed(png_ptr, green_y, "png_set_mDCV(green(y))"),
png_fixed(png_ptr, red_y / 2, "png_set_mDCV(red(y))"), png_fixed(png_ptr, blue_x, "png_set_mDCV(blue(x))"),
png_fixed(png_ptr, green_x / 2, "png_set_mDCV(green(x))"), png_fixed(png_ptr, blue_y, "png_set_mDCV(blue(y))"),
png_fixed(png_ptr, green_y / 2, "png_set_mDCV(green(y))"),
png_fixed(png_ptr, blue_x / 2, "png_set_mDCV(blue(x))"),
png_fixed(png_ptr, blue_y / 2, "png_set_mDCV(blue(y))"),
png_fixed_ITU(png_ptr, maxDL, "png_set_mDCV(maxDL)"), png_fixed_ITU(png_ptr, maxDL, "png_set_mDCV(maxDL)"),
png_fixed_ITU(png_ptr, minDL, "png_set_mDCV(minDL)")); png_fixed_ITU(png_ptr, minDL, "png_set_mDCV(minDL)"));
} }

View File

@@ -1,6 +1,6 @@
/* pngstruct.h - header file for PNG reference library /* pngstruct.h - internal structures for libpng
* *
* Copyright (c) 2018-2022 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 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.
@@ -10,11 +10,9 @@
* and license in png.h * and license in png.h
*/ */
/* The structure that holds the information to read and write PNG files. #ifndef PNGPRIV_H
* The only people who need to care about what is inside of this are the # error This file must not be included by applications; please include <png.h>
* people who will be modifying the library for their own special needs. #endif
* It should NOT be accessed directly by an application.
*/
#ifndef PNGSTRUCT_H #ifndef PNGSTRUCT_H
#define PNGSTRUCT_H #define PNGSTRUCT_H

View File

@@ -1,6 +1,6 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* Copyright (c) 2018 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2014,2016,2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2014,2016,2018 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.
@@ -54,7 +54,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, size_t length)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr)); check = fwrite(data, 1, length, (FILE *)png_ptr->io_ptr);
if (check != length) if (check != length)
png_error(png_ptr, "Write Error"); png_error(png_ptr, "Write Error");
@@ -77,12 +77,12 @@ png_flush(png_structrp png_ptr)
void PNGCBAPI void PNGCBAPI
png_default_flush(png_structp png_ptr) png_default_flush(png_structp png_ptr)
{ {
png_FILE_p io_ptr; FILE *io_ptr;
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
io_ptr = png_voidcast(png_FILE_p, (png_ptr->io_ptr)); io_ptr = png_voidcast(FILE *, png_ptr->io_ptr);
fflush(io_ptr); fflush(io_ptr);
} }
# endif # endif

View File

@@ -2333,7 +2333,7 @@ int PNGAPI
png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit, png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
const void *buffer, png_int_32 row_stride, const void *colormap) const void *buffer, png_int_32 row_stride, const void *colormap)
{ {
/* Write the image to the given (FILE*). */ /* Write the image to the given FILE object. */
if (image != NULL && image->version == PNG_IMAGE_VERSION) if (image != NULL && image->version == PNG_IMAGE_VERSION)
{ {
if (file != NULL && buffer != NULL) if (file != NULL && buffer != NULL)

View File

@@ -1,6 +1,6 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 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.

View File

@@ -23,7 +23,7 @@
#if PNG_POWERPC_VSX_OPT > 0 #if PNG_POWERPC_VSX_OPT > 0
#ifndef __VSX__ #ifndef __VSX__
# error "This code requires VSX support (POWER7 and later). Please provide -mvsx compiler flag." # error This code requires VSX support (POWER7 and later); please compile with -mvsx
#endif #endif
#define vec_ld_unaligned(vec,data) vec = vec_vsx_ld(0,data) #define vec_ld_unaligned(vec,data) vec = vec_vsx_ld(0,data)

View File

@@ -46,7 +46,7 @@ static int png_have_vsx(png_structp png_ptr);
#include PNG_POWERPC_VSX_FILE #include PNG_POWERPC_VSX_FILE
#else /* PNG_POWERPC_VSX_FILE */ #else /* PNG_POWERPC_VSX_FILE */
# error "PNG_POWERPC_VSX_FILE undefined: no support for run-time POWERPC VSX checks" # error PNG_POWERPC_VSX_FILE undefined: no support for run-time POWERPC VSX checks
#endif /* PNG_POWERPC_VSX_FILE */ #endif /* PNG_POWERPC_VSX_FILE */
#endif /* PNG_POWERPC_VSX_CHECK_SUPPORTED */ #endif /* PNG_POWERPC_VSX_CHECK_SUPPORTED */