mirror of https://github.com/axmolengine/axmol.git
Update libpng to v1.6.38 stable
This commit is contained in:
parent
f8889ba2d6
commit
e375a0fb6b
|
@ -119,7 +119,7 @@ See [windows workflow guide](https://github.com/axmolengine/axmol/issues/564)
|
|||
4. Start Android Studio and Open [Tools][SDKManager], then switch to ```SDK Tools```, check the ```Show Package Details```, choose the following tools and click the button ```Apply``` to install them:
|
||||
* Android SDK Platform 33
|
||||
* Android Gradle Plugin (AGP) 7.2.2
|
||||
* Android SDK Build-Tools 30.0.3 match with AGP
|
||||
* Android SDK Build-Tools 30.0.3 match with AGP, refer to: https://developer.android.com/studio/releases/gradle-plugin
|
||||
* Gradle 7.4.2
|
||||
* NDK r23c+
|
||||
* CMake 3.22.1+
|
||||
|
|
|
@ -170,8 +170,8 @@
|
|||
- License: Apache-2.0
|
||||
|
||||
## png
|
||||
- Upstream: https://github.com/glennrp/libpng
|
||||
- Version: git 1.6.38-a37d483 (4098) with arm64 neon detect fix
|
||||
- [![Upstream](https://img.shields.io/github/v/tag/glennrp/libpng?label=Upstream)](https://github.com/glennrp/libpng)
|
||||
- Version: git 1.6.38 with arm64 neon detect fix
|
||||
- License: PNG Reference Library License version 2
|
||||
|
||||
## poly2tri
|
||||
|
|
|
@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
|||
PNG Reference Library License version 2
|
||||
---------------------------------------
|
||||
|
||||
* Copyright (c) 1995-2020 The PNG Reference Library Authors.
|
||||
* Copyright (c) 2018-2020 Cosmin Truta.
|
||||
* Copyright (c) 1995-2022 The PNG Reference Library Authors.
|
||||
* Copyright (c) 2018-2022 Cosmin Truta.
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||
* Copyright (c) 1996-1997 Andreas Dilger.
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
README for libpng version 1.6.38.git
|
||||
====================================
|
||||
README for libpng version 1.6.38
|
||||
================================
|
||||
|
||||
See the note about version numbers near the top of png.h.
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* arm_init.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
*
|
||||
|
@ -10,9 +10,7 @@
|
|||
* and license in png.h
|
||||
*/
|
||||
|
||||
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
||||
* called.
|
||||
*/
|
||||
/* This module requires POSIX 1003.1 functions. */
|
||||
#define _POSIX_SOURCE 1
|
||||
|
||||
#include "../pngpriv.h"
|
||||
|
@ -32,25 +30,23 @@
|
|||
* are a number of implementations in contrib/arm-neon, but the only one that
|
||||
* has partial support is contrib/arm-neon/linux.c - a generic Linux
|
||||
* implementation which reads /proc/cpufino.
|
||||
* Notes: the png_have_neon implementation at linux.c works on armv7 but doesn't works on arm64
|
||||
*/
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
|
||||
#ifndef PNG_ARM_NEON_FILE
|
||||
# if defined(__ANDROID__)
|
||||
# define PNG_ARM_NEON_FILE "contrib/arm-neon/android-ndk.c"
|
||||
# define PNG_ARM_NEON_FILE "contrib/arm-neon/android-ndk.c"
|
||||
# elif defined(__linux__)
|
||||
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
|
||||
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
|
||||
# else
|
||||
# error "No support for run-time ARM Neon checking; use compile-time options"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_ARM_NEON_FILE
|
||||
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
static int png_have_neon(png_structp png_ptr);
|
||||
#include PNG_ARM_NEON_FILE
|
||||
|
||||
#else /* PNG_ARM_NEON_FILE */
|
||||
# error "PNG_ARM_NEON_FILE undefined: no support for run-time ARM NEON checks"
|
||||
#endif /* PNG_ARM_NEON_FILE */
|
||||
#ifdef PNG_ARM_NEON_FILE
|
||||
# include PNG_ARM_NEON_FILE
|
||||
#endif
|
||||
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
||||
|
||||
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
|
||||
|
|
|
@ -65,11 +65,12 @@ png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
|
|||
png_uint_32 row_width = row_info->width;
|
||||
const png_uint_32 *riffled_palette =
|
||||
(const png_uint_32 *)png_ptr->riffled_palette;
|
||||
const png_int_32 pixels_per_chunk = 4;
|
||||
int i;
|
||||
const png_uint_32 pixels_per_chunk = 4;
|
||||
png_uint_32 i;
|
||||
|
||||
png_debug(1, "in png_do_expand_palette_rgba8_neon");
|
||||
|
||||
PNG_UNUSED(row)
|
||||
if (row_width < pixels_per_chunk)
|
||||
return 0;
|
||||
|
||||
|
@ -109,10 +110,11 @@ png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
|
|||
png_uint_32 row_width = row_info->width;
|
||||
png_const_bytep palette = (png_const_bytep)png_ptr->palette;
|
||||
const png_uint_32 pixels_per_chunk = 8;
|
||||
int i;
|
||||
png_uint_32 i;
|
||||
|
||||
png_debug(1, "in png_do_expand_palette_rgb8_neon");
|
||||
|
||||
PNG_UNUSED(row)
|
||||
if (row_width <= pixels_per_chunk)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Copyright (c) 2018-2020 Cosmin Truta
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
@ -14,7 +14,7 @@
|
|||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_38_git Your_png_h_is_not_version_1_6_38_git;
|
||||
typedef png_libpng_version_1_6_38 Your_png_h_is_not_version_1_6_38;
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* The version tests may need to be added to, but the problem warning has
|
||||
|
@ -720,7 +720,7 @@ png_init_io(png_structrp png_ptr, png_FILE_p fp)
|
|||
*
|
||||
* Where UNSIGNED_MAX is the appropriate maximum unsigned value, so when the
|
||||
* negative integral value is added the result will be an unsigned value
|
||||
* correspnding to the 2's complement representation.
|
||||
* corresponding to the 2's complement representation.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_save_int_32(png_bytep buf, png_int_32 i)
|
||||
|
@ -815,8 +815,8 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||
return PNG_STRING_COPYRIGHT
|
||||
#else
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.38.git" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 2018-2020 Cosmin Truta" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.38" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 2018-2022 Cosmin Truta" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
||||
PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
|
@ -1843,12 +1843,12 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||
# ifdef PNG_WARNINGS_SUPPORTED
|
||||
else
|
||||
{
|
||||
char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114*/
|
||||
char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */
|
||||
|
||||
pos = png_safecat(message, (sizeof message), pos,
|
||||
png_format_number(number, number+(sizeof number),
|
||||
PNG_NUMBER_FORMAT_x, value));
|
||||
pos = png_safecat(message, (sizeof message), pos, "h: "); /*+2 = 116*/
|
||||
pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */
|
||||
}
|
||||
# endif
|
||||
/* The 'reason' is an arbitrary message, allow +79 maximum 195 */
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.38.git
|
||||
* libpng version 1.6.38 - September 14, 2022
|
||||
*
|
||||
* Copyright (c) 2018-2020 Cosmin Truta
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
@ -15,7 +15,7 @@
|
|||
* 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:
|
||||
* Glenn Randers-Pehrson
|
||||
* libpng versions 1.6.36, December 2018, through 1.6.37, April 2019:
|
||||
* libpng versions 1.6.36, December 2018, through 1.6.38, September 2022:
|
||||
* Cosmin Truta
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
|
@ -27,8 +27,8 @@
|
|||
* PNG Reference Library License version 2
|
||||
* ---------------------------------------
|
||||
*
|
||||
* * Copyright (c) 1995-2020 The PNG Reference Library Authors.
|
||||
* * Copyright (c) 2018-2020 Cosmin Truta.
|
||||
* * Copyright (c) 1995-2022 The PNG Reference Library Authors.
|
||||
* * Copyright (c) 2018-2022 Cosmin Truta.
|
||||
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||
* * Copyright (c) 1996-1997 Andreas Dilger.
|
||||
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
@ -239,7 +239,7 @@
|
|||
* ...
|
||||
* 1.5.30 15 10530 15.so.15.30[.0]
|
||||
* ...
|
||||
* 1.6.37 16 10637 16.so.16.37[.0]
|
||||
* 1.6.38 16 10638 16.so.16.38[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major and
|
||||
* minor numbers; the shared-library major version number will be used for
|
||||
|
@ -278,8 +278,8 @@
|
|||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.38.git"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.38.git\n"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.38"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.38 - September 14, 2022\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
|
@ -292,7 +292,7 @@
|
|||
/* This should be zero for a public release, or non-zero for a
|
||||
* development version. [Deprecated]
|
||||
*/
|
||||
#define PNG_LIBPNG_VER_BUILD 1
|
||||
#define PNG_LIBPNG_VER_BUILD 0
|
||||
|
||||
/* Release Status */
|
||||
#define PNG_LIBPNG_BUILD_ALPHA 1
|
||||
|
@ -309,7 +309,7 @@
|
|||
#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
|
||||
PNG_LIBPNG_BUILD_PRIVATE */
|
||||
|
||||
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
|
||||
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
|
||||
|
||||
/* Careful here. At one time, Guy wanted to use 082, but that
|
||||
* would be octal. We must not include leading zeros.
|
||||
|
@ -318,7 +318,7 @@
|
|||
* From version 1.0.1 it is:
|
||||
* XXYYZZ, where XX=major, YY=minor, ZZ=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10638 /* 1.6.38.git */
|
||||
#define PNG_LIBPNG_VER 10638 /* 1.6.38 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
|
@ -428,7 +428,7 @@ extern "C" {
|
|||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_38_git;
|
||||
typedef char* png_libpng_version_1_6_38;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
|
@ -1446,7 +1446,7 @@ PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action,
|
|||
* mainly useful for testing, as the defaults should work with most users.
|
||||
* Those users who are tight on memory or want faster performance at the
|
||||
* expense of compression can modify them. See the compression library
|
||||
* header file (zlib.h) for an explination of the compression functions.
|
||||
* header file (zlib.h) for an explanation of the compression functions.
|
||||
*/
|
||||
|
||||
/* Set the filtering method(s) used by libpng. Currently, the only valid
|
||||
|
@ -1501,7 +1501,7 @@ PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
|
|||
* 0 - 9, corresponding directly to the zlib compression levels 0 - 9
|
||||
* (0 - no compression, 9 - "maximal" compression). Note that tests have
|
||||
* shown that zlib compression levels 3-6 usually perform as well as level 9
|
||||
* for PNG images, and do considerably fewer caclulations. In the future,
|
||||
* for PNG images, and do considerably fewer calculations. In the future,
|
||||
* these values may not correspond directly to the zlib compression levels.
|
||||
*/
|
||||
#ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
/* pngconf.h - machine-configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.38.git
|
||||
* libpng version 1.6.38
|
||||
*
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
@ -180,8 +180,8 @@
|
|||
* compiler-specific macros to the values required to change the calling
|
||||
* conventions of the various functions.
|
||||
*/
|
||||
#if defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
|
||||
defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || \
|
||||
defined(__CYGWIN__)
|
||||
/* Windows system (DOS doesn't support DLLs). Includes builds under Cygwin or
|
||||
* MinGW on any architecture currently supported by Windows. Also includes
|
||||
* Watcom builds but these need special treatment because they are not
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
@ -174,7 +174,7 @@
|
|||
# else /* !defined __ARM_NEON__ */
|
||||
/* The 'intrinsics' code simply won't compile without this -mfpu=neon:
|
||||
*/
|
||||
# if !defined(__aarch64__)
|
||||
# if !defined(__aarch64__) && !defined(_M_ARM64)
|
||||
/* The assembler code currently does not work on ARM64 */
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 2
|
||||
# endif /* __aarch64__ */
|
||||
|
@ -185,6 +185,8 @@
|
|||
/* Use the intrinsics code by default. */
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 1
|
||||
# endif
|
||||
#else /* PNG_ARM_NEON_OPT == 0 */
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 0
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
|
||||
#ifndef PNG_MIPS_MSA_OPT
|
||||
|
@ -263,11 +265,15 @@
|
|||
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
||||
# define PNG_MIPS_MSA_IMPLEMENTATION 1
|
||||
# endif
|
||||
#else
|
||||
# define PNG_MIPS_MSA_IMPLEMENTATION 0
|
||||
#endif /* PNG_MIPS_MSA_OPT > 0 */
|
||||
|
||||
#if PNG_POWERPC_VSX_OPT > 0
|
||||
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
|
||||
# define PNG_POWERPC_VSX_IMPLEMENTATION 1
|
||||
#else
|
||||
# define PNG_POWERPC_VSX_IMPLEMENTATION 0
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -492,16 +498,7 @@
|
|||
static_cast<type>(static_cast<const void*>(value))
|
||||
#else
|
||||
# define png_voidcast(type, value) (value)
|
||||
# ifdef _WIN64
|
||||
# ifdef __GNUC__
|
||||
typedef unsigned long long png_ptruint;
|
||||
# else
|
||||
typedef unsigned __int64 png_ptruint;
|
||||
# endif
|
||||
# else
|
||||
typedef unsigned long png_ptruint;
|
||||
# endif
|
||||
# define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value))
|
||||
# define png_constcast(type, value) ((type)(void*)(const void*)(value))
|
||||
# define png_aligncast(type, value) ((void*)(value))
|
||||
# define png_aligncastconst(type, value) ((const void*)(value))
|
||||
#endif /* __cplusplus */
|
||||
|
@ -543,9 +540,8 @@
|
|||
# include <alloc.h>
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \
|
||||
defined(_WIN32) || defined(__WIN32__)
|
||||
# include <windows.h> /* defines _WINDOWS_ macro */
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#endif /* PNG_VERSION_INFO_ONLY */
|
||||
|
||||
|
@ -554,24 +550,20 @@
|
|||
* functions that are passed far data must be model-independent.
|
||||
*/
|
||||
|
||||
/* Memory model/platform independent fns */
|
||||
/* Platform-independent functions */
|
||||
#ifndef PNG_ABORT
|
||||
# ifdef _WINDOWS_
|
||||
# define PNG_ABORT() ExitProcess(0)
|
||||
# else
|
||||
# define PNG_ABORT() abort()
|
||||
# endif
|
||||
# define PNG_ABORT() abort()
|
||||
#endif
|
||||
|
||||
/* These macros may need to be architecture dependent. */
|
||||
#define PNG_ALIGN_NONE 0 /* do not use data alignment */
|
||||
#define PNG_ALIGN_ALWAYS 1 /* assume unaligned accesses are OK */
|
||||
#define PNG_ALIGN_NONE 0 /* do not use data alignment */
|
||||
#define PNG_ALIGN_ALWAYS 1 /* assume unaligned accesses are OK */
|
||||
#ifdef offsetof
|
||||
# define PNG_ALIGN_OFFSET 2 /* use offsetof to determine alignment */
|
||||
# define PNG_ALIGN_OFFSET 2 /* use offsetof to determine alignment */
|
||||
#else
|
||||
# define PNG_ALIGN_OFFSET -1 /* prevent the use of this */
|
||||
#endif
|
||||
#define PNG_ALIGN_SIZE 3 /* use sizeof to determine alignment */
|
||||
#define PNG_ALIGN_SIZE 3 /* use sizeof to determine alignment */
|
||||
|
||||
#ifndef PNG_ALIGN_TYPE
|
||||
/* Default to using aligned access optimizations and requiring alignment to a
|
||||
|
@ -585,26 +577,25 @@
|
|||
/* This is used because in some compiler implementations non-aligned
|
||||
* structure members are supported, so the offsetof approach below fails.
|
||||
* Set PNG_ALIGN_SIZE=0 for compiler combinations where unaligned access
|
||||
* is good for performance. Do not do this unless you have tested the result
|
||||
* and understand it.
|
||||
* is good for performance. Do not do this unless you have tested the
|
||||
* result and understand it.
|
||||
*/
|
||||
# define png_alignof(type) (sizeof (type))
|
||||
# define png_alignof(type) (sizeof(type))
|
||||
#else
|
||||
# if PNG_ALIGN_TYPE == PNG_ALIGN_OFFSET
|
||||
# define png_alignof(type) offsetof(struct{char c; type t;}, t)
|
||||
# define png_alignof(type) offsetof(struct{char c; type t;}, t)
|
||||
# else
|
||||
# if PNG_ALIGN_TYPE == PNG_ALIGN_ALWAYS
|
||||
# define png_alignof(type) (1)
|
||||
# endif
|
||||
/* Else leave png_alignof undefined to prevent use thereof */
|
||||
# if PNG_ALIGN_TYPE == PNG_ALIGN_ALWAYS
|
||||
# define png_alignof(type) 1
|
||||
# endif
|
||||
/* Else leave png_alignof undefined to prevent use thereof */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* This implicitly assumes alignment is always to a power of 2. */
|
||||
/* This implicitly assumes alignment is always a multiple of 2. */
|
||||
#ifdef png_alignof
|
||||
# define png_isaligned(ptr, type)\
|
||||
(((type)((const char*)ptr-(const char*)0) & \
|
||||
(type)(png_alignof(type)-1)) == 0)
|
||||
# define png_isaligned(ptr, type) \
|
||||
(((type)(size_t)((const void*)(ptr)) & (type)(png_alignof(type)-1)) == 0)
|
||||
#else
|
||||
# define png_isaligned(ptr, type) 0
|
||||
#endif
|
||||
|
|
|
@ -3452,7 +3452,6 @@ png_image_read_background(png_voidp argument)
|
|||
|
||||
for (pass = 0; pass < passes; ++pass)
|
||||
{
|
||||
png_bytep row = png_voidcast(png_bytep, display->first_row);
|
||||
unsigned int startx, stepx, stepy;
|
||||
png_uint_32 y;
|
||||
|
||||
|
@ -3557,8 +3556,6 @@ png_image_read_background(png_voidp argument)
|
|||
|
||||
inrow += 2; /* gray and alpha channel */
|
||||
}
|
||||
|
||||
row += display->row_bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
@ -2075,14 +2075,17 @@ png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
png_byte buf[1];
|
||||
png_crc_read(png_ptr, buf, 1);
|
||||
info_ptr->eXIf_buf[i] = buf[0];
|
||||
if (i == 1 && buf[0] != 'M' && buf[0] != 'I'
|
||||
&& info_ptr->eXIf_buf[0] != buf[0])
|
||||
if (i == 1)
|
||||
{
|
||||
png_crc_finish(png_ptr, length-i-1);
|
||||
png_chunk_benign_error(png_ptr, "incorrect byte-order specifier");
|
||||
png_free(png_ptr, info_ptr->eXIf_buf);
|
||||
info_ptr->eXIf_buf = NULL;
|
||||
return;
|
||||
if ((buf[0] != 'M' && buf[0] != 'I') ||
|
||||
(info_ptr->eXIf_buf[0] != buf[0]))
|
||||
{
|
||||
png_crc_finish(png_ptr, length - 2);
|
||||
png_chunk_benign_error(png_ptr, "incorrect byte-order specifier");
|
||||
png_free(png_ptr, info_ptr->eXIf_buf);
|
||||
info_ptr->eXIf_buf = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2123,8 +2126,9 @@ png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
|
||||
num = length / 2 ;
|
||||
|
||||
if (num != (unsigned int) png_ptr->num_palette ||
|
||||
num > (unsigned int) PNG_MAX_PALETTE_LENGTH)
|
||||
if (length != num * 2 ||
|
||||
num != (unsigned int)png_ptr->num_palette ||
|
||||
num > (unsigned int)PNG_MAX_PALETTE_LENGTH)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "invalid");
|
||||
|
@ -4618,14 +4622,13 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
|||
*/
|
||||
{
|
||||
png_bytep temp = png_ptr->big_row_buf + 32;
|
||||
int extra = (int)((temp - (png_bytep)0) & 0x0f);
|
||||
size_t extra = (size_t)temp & 0x0f;
|
||||
png_ptr->row_buf = temp - extra - 1/*filter byte*/;
|
||||
|
||||
temp = png_ptr->big_prev_row + 32;
|
||||
extra = (int)((temp - (png_bytep)0) & 0x0f);
|
||||
extra = (size_t)temp & 0x0f;
|
||||
png_ptr->prev_row = temp - extra - 1/*filter byte*/;
|
||||
}
|
||||
|
||||
#else
|
||||
/* Use 31 bytes of padding before and 17 bytes after row_buf. */
|
||||
png_ptr->row_buf = png_ptr->big_row_buf + 31;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
@ -1019,6 +1019,9 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
|
|||
info_ptr->trans_alpha = png_voidcast(png_bytep,
|
||||
png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
|
||||
memcpy(info_ptr->trans_alpha, trans_alpha, (size_t)num_trans);
|
||||
|
||||
info_ptr->valid |= PNG_INFO_tRNS;
|
||||
info_ptr->free_me |= PNG_FREE_TRNS;
|
||||
}
|
||||
png_ptr->trans_alpha = info_ptr->trans_alpha;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngstruct.h - header file for PNG reference library
|
||||
*
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
@ -334,18 +334,8 @@ struct png_struct_def
|
|||
size_t current_buffer_size; /* amount of data now in current_buffer */
|
||||
int process_mode; /* what push library is currently doing */
|
||||
int cur_palette; /* current push library palette index */
|
||||
|
||||
#endif /* PROGRESSIVE_READ */
|
||||
|
||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||
/* For the Borland special 64K segment handler */
|
||||
png_bytepp offset_table_ptr;
|
||||
png_bytep offset_table;
|
||||
png_uint_16 offset_table_number;
|
||||
png_uint_16 offset_table_count;
|
||||
png_uint_16 offset_table_count_free;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
png_bytep palette_lookup; /* lookup table for quantizing */
|
||||
png_bytep quantize_index; /* index translation for palette files */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
@ -438,6 +438,11 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||
if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
|
||||
png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT);
|
||||
#endif
|
||||
|
@ -484,6 +489,16 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
|
|||
png_debug(1, "in png_convert_from_time_t");
|
||||
|
||||
tbuf = gmtime(&ttime);
|
||||
if (tbuf == NULL)
|
||||
{
|
||||
/* TODO: add a safe function which takes a png_ptr argument and raises
|
||||
* a png_error if the ttime argument is invalid and the call to gmtime
|
||||
* fails as a consequence.
|
||||
*/
|
||||
memset(ptime, 0, sizeof(*ptime));
|
||||
return;
|
||||
}
|
||||
|
||||
png_convert_from_struct_tm(ptime, tbuf);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue