Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1e5cc509
Commit
1e5cc509
authored
Feb 17, 2024
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
png: Import upstream release 1.6.42.
parent
3881edf6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
245 additions
and
177 deletions
+245
-177
AUTHORS
libs/png/AUTHORS
+19
-11
LICENSE
libs/png/LICENSE
+2
-2
png.c
libs/png/png.c
+14
-59
png.h
libs/png/png.h
+27
-23
pngconf.h
libs/png/pngconf.h
+2
-2
pngerror.c
libs/png/pngerror.c
+14
-20
pngget.c
libs/png/pngget.c
+0
-0
pnglibconf.h
libs/png/pnglibconf.h
+8
-3
pngpriv.h
libs/png/pngpriv.h
+98
-20
pngread.c
libs/png/pngread.c
+5
-3
pngrtran.c
libs/png/pngrtran.c
+3
-3
pngrutil.c
libs/png/pngrutil.c
+9
-10
pngset.c
libs/png/pngset.c
+16
-6
pngtrans.c
libs/png/pngtrans.c
+9
-5
pngwrite.c
libs/png/pngwrite.c
+14
-5
pngwutil.c
libs/png/pngwutil.c
+5
-5
No files found.
libs/png/AUTHORS
View file @
1e5cc509
...
...
@@ -4,6 +4,7 @@ PNG REFERENCE LIBRARY AUTHORS
This is the list of PNG Reference Library ("libpng") Contributing
Authors, for copyright and licensing purposes.
* Adam Richter
* Andreas Dilger
* Cosmin Truta
* Dave Martindale
...
...
@@ -33,20 +34,27 @@ Authors, for copyright and licensing purposes.
* Vadim Barkov
* Willem van Schaik
* Zhijie Liang
* Apple Inc.
- Zixu Wang (王子旭)
* Arm Holdings
- Richard Townsend
- Richard Townsend
* Google Inc.
- Dan Field
- Leon Scroggins III
- Matt Sarett
- Mike Klein
- Sami Boukortt
- Wan-Teh Chang
- Dan Field
- Leon Scroggins III
- Matt Sarett
- Mike Klein
- Sami Boukortt
- Wan-Teh Chang
* Loongson Technology Corporation Ltd.
- GuXiWei (顾希伟)
- JinBo (金波)
- ZhangLixia (张利霞)
The build projects, the build scripts, the test scripts, and other
files in the "
ci", "
projects", "scripts" and "tests" directories, have
files in the "projects", "scripts" and "tests" directories, have
other copyright owners, but are released under the libpng license.
Some files in the "contrib" directory, and some tools-generated files
that are distributed with libpng, have other copyright owners, and are
released under other open source licenses.
Some files in the "ci" and "contrib" directories, as well as some
of the tools-generated files that are distributed with libpng, have
other copyright owners, and are released under other open source
licenses.
libs/png/LICENSE
View file @
1e5cc509
...
...
@@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
PNG Reference Library License version 2
---------------------------------------
* Copyright (c) 1995-202
3
The PNG Reference Library Authors.
* Copyright (c) 2018-202
3
Cosmin Truta.
* Copyright (c) 1995-202
4
The PNG Reference Library Authors.
* Copyright (c) 2018-202
4
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.
...
...
libs/png/png.c
View file @
1e5cc509
/* png.c - location for general purpose libpng functions
*
* Copyright (c) 2018-202
3
Cosmin Truta
* Copyright (c) 2018-202
4
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,27 +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_40
Your_png_h_is_not_version_1_6_40
;
#ifdef __GNUC__
/* The version tests may need to be added to, but the problem warning has
* consistently been fixed in GCC versions which obtain wide-spread release.
* The problem is that many versions of GCC rearrange comparison expressions in
* the optimizer in such a way that the results of the comparison will change
* if signed integer overflow occurs. Such comparisons are not permitted in
* ANSI C90, however GCC isn't clever enough to work out that that do not occur
* below in png_ascii_from_fp and png_muldiv, so it produces a warning with
* -Wextra. Unfortunately this is highly dependent on the optimizer and the
* machine architecture so the warning comes and goes unpredictably and is
* impossible to "fix", even were that a good idea.
*/
#if __GNUC__ == 7 && __GNUC_MINOR__ == 1
#define GCC_STRICT_OVERFLOW 1
#endif
/* GNU 7.1.x */
#endif
/* GNU */
#ifndef GCC_STRICT_OVERFLOW
#define GCC_STRICT_OVERFLOW 0
#endif
typedef
png_libpng_version_1_6_42
Your_png_h_is_not_version_1_6_42
;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
...
...
@@ -73,21 +53,21 @@ png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
int
PNGAPI
png_sig_cmp
(
png_const_bytep
sig
,
size_t
start
,
size_t
num_to_check
)
{
png_byte
png_signature
[
8
]
=
{
137
,
80
,
78
,
71
,
13
,
10
,
26
,
10
};
static
const
png_byte
png_signature
[
8
]
=
{
137
,
80
,
78
,
71
,
13
,
10
,
26
,
10
};
if
(
num_to_check
>
8
)
num_to_check
=
8
;
else
if
(
num_to_check
<
1
)
return
(
-
1
)
;
return
-
1
;
if
(
start
>
7
)
return
(
-
1
)
;
return
-
1
;
if
(
start
+
num_to_check
>
8
)
num_to_check
=
8
-
start
;
return
((
int
)(
memcmp
(
&
sig
[
start
],
&
png_signature
[
start
],
num_to_check
))
);
return
memcmp
(
&
sig
[
start
],
&
png_signature
[
start
],
num_to_check
);
}
#endif
/* READ */
...
...
@@ -447,7 +427,6 @@ png_info_init_3,(png_infopp ptr_ptr, size_t png_info_struct_size),
memset
(
info_ptr
,
0
,
(
sizeof
*
info_ptr
));
}
/* The following API is not called internally */
void
PNGAPI
png_data_freer
(
png_const_structrp
png_ptr
,
png_inforp
info_ptr
,
int
freer
,
png_uint_32
mask
)
...
...
@@ -686,9 +665,9 @@ png_voidp PNGAPI
png_get_io_ptr
(
png_const_structrp
png_ptr
)
{
if
(
png_ptr
==
NULL
)
return
(
NULL
)
;
return
NULL
;
return
(
png_ptr
->
io_ptr
)
;
return
png_ptr
->
io_ptr
;
}
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
...
...
@@ -752,7 +731,7 @@ png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
{
size_t
pos
=
0
;
char
number_buf
[
5
];
/* enough for a four-digit year */
char
number_buf
[
5
]
=
{
0
,
0
,
0
,
0
,
0
}
;
/* enough for a four-digit year */
# define APPEND_STRING(string) pos = png_safecat(out, 29, pos, (string))
# define APPEND_NUMBER(format, value)\
...
...
@@ -815,8 +794,8 @@ png_get_copyright(png_const_structrp png_ptr)
return
PNG_STRING_COPYRIGHT
#else
return
PNG_STRING_NEWLINE
\
"libpng version 1.6.4
0
"
PNG_STRING_NEWLINE
\
"Copyright (c) 2018-202
3
Cosmin Truta"
PNG_STRING_NEWLINE
\
"libpng version 1.6.4
2
"
PNG_STRING_NEWLINE
\
"Copyright (c) 2018-202
4
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
\
...
...
@@ -977,7 +956,7 @@ png_reset_zstream(png_structrp png_ptr)
return
Z_STREAM_ERROR
;
/* WARNING: this resets the window bits to the maximum! */
return
(
inflateReset
(
&
png_ptr
->
zstream
)
);
return
inflateReset
(
&
png_ptr
->
zstream
);
}
#endif
/* READ */
...
...
@@ -986,7 +965,7 @@ png_uint_32 PNGAPI
png_access_version_number
(
void
)
{
/* Version of *.c files used when building libpng */
return
((
png_uint_32
)
PNG_LIBPNG_VER
)
;
return
(
png_uint_32
)
PNG_LIBPNG_VER
;
}
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
...
...
@@ -2891,14 +2870,6 @@ png_pow10(int power)
/* Function to format a floating point value in ASCII with a given
* precision.
*/
#if GCC_STRICT_OVERFLOW
#pragma GCC diagnostic push
/* The problem arises below with exp_b10, which can never overflow because it
* comes, originally, from frexp and is therefore limited to a range which is
* typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)).
*/
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
#endif
/* GCC_STRICT_OVERFLOW */
void
/* PRIVATE */
png_ascii_from_fp
(
png_const_structrp
png_ptr
,
png_charp
ascii
,
size_t
size
,
double
fp
,
unsigned
int
precision
)
...
...
@@ -3220,10 +3191,6 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
/* Here on buffer too small. */
png_error
(
png_ptr
,
"ASCII conversion buffer too small"
);
}
#if GCC_STRICT_OVERFLOW
#pragma GCC diagnostic pop
#endif
/* GCC_STRICT_OVERFLOW */
# endif
/* FLOATING_POINT */
# ifdef PNG_FIXED_POINT_SUPPORTED
...
...
@@ -3251,7 +3218,7 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
if
(
num
<=
0x80000000
)
/* else overflowed */
{
unsigned
int
ndigits
=
0
,
first
=
16
/* flag value */
;
char
digits
[
10
];
char
digits
[
10
]
=
{
0
}
;
while
(
num
)
{
...
...
@@ -3336,15 +3303,6 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
* the nearest .00001). Overflow and divide by zero are signalled in
* the result, a boolean - true on success, false on overflow.
*/
#if GCC_STRICT_OVERFLOW
/* from above */
/* It is not obvious which comparison below gets optimized in such a way that
* signed overflow would change the result; looking through the code does not
* reveal any tests which have the form GCC complains about, so presumably the
* optimizer is moving an add or subtract into the 'if' somewhere.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
#endif
/* GCC_STRICT_OVERFLOW */
int
png_muldiv
(
png_fixed_point_p
res
,
png_fixed_point
a
,
png_int_32
times
,
png_int_32
divisor
)
...
...
@@ -3459,9 +3417,6 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
return
0
;
}
#if GCC_STRICT_OVERFLOW
#pragma GCC diagnostic pop
#endif
/* GCC_STRICT_OVERFLOW */
#endif
/* READ_GAMMA || INCH_CONVERSIONS */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
...
...
libs/png/png.h
View file @
1e5cc509
/* png.h - header file for PNG reference library
*
* libpng version 1.6.4
0
* libpng version 1.6.4
2
*
* Copyright (c) 2018-202
3
Cosmin Truta
* Copyright (c) 2018-202
4
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.4
0, June 2023
:
* libpng versions 1.6.36, December 2018, through 1.6.4
2, January 2024
:
* Cosmin Truta
* See also "Contributing Authors", below.
*/
...
...
@@ -27,8 +27,8 @@
* PNG Reference Library License version 2
* ---------------------------------------
*
* * Copyright (c) 1995-202
3
The PNG Reference Library Authors.
* * Copyright (c) 2018-202
3
Cosmin Truta.
* * Copyright (c) 1995-202
4
The PNG Reference Library Authors.
* * Copyright (c) 2018-202
4
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.4
0 16 10640 16.so.16.40
[.0]
* 1.6.4
2 16 10641 16.so.16.41
[.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.4
0
"
#define PNG_HEADER_VERSION_STRING " libpng version
1.6.40 - June 21, 2023
\n"
#define PNG_LIBPNG_VER_STRING "1.6.4
2
"
#define PNG_HEADER_VERSION_STRING " libpng version
" PNG_LIBPNG_VER_STRING "
\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
...
...
@@ -287,7 +287,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6
#define PNG_LIBPNG_VER_RELEASE 4
0
#define PNG_LIBPNG_VER_RELEASE 4
1
/* This should be zero for a public release, or non-zero for a
* development version. [Deprecated]
...
...
@@ -318,7 +318,7 @@
* From version 1.0.1 it is:
* XXYYZZ, where XX=major, YY=minor, ZZ=release
*/
#define PNG_LIBPNG_VER 1064
0
/* 1.6.40
*/
#define PNG_LIBPNG_VER 1064
1
/* 1.6.42
*/
/* 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_4
0
;
typedef
char
*
png_libpng_version_1_6_4
2
;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
...
...
@@ -849,7 +849,7 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000
/* read only */
/* Added to libpng-1.5.4 */
#define PNG_TRANSFORM_EXPAND_16 0x4000
/* read only */
#if
INT_MAX >= 0x8000
/* else this might break
*/
#if
~0U > 0xffffU
/* or else this might break on a 16-bit machine
*/
#define PNG_TRANSFORM_SCALE_16 0x8000
/* read only */
#endif
...
...
@@ -908,15 +908,15 @@ PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes));
/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
* PNG file. Returns zero if the supplied bytes match the 8-byte PNG
* signature, and non-zero otherwise. Having num_to_check == 0 or
* start > 7 will always fail (i
e
return non-zero).
* start > 7 will always fail (i
.e.
return non-zero).
*/
PNG_EXPORT
(
3
,
int
,
png_sig_cmp
,
(
png_const_bytep
sig
,
size_t
start
,
size_t
num_to_check
));
/* Simple signature checking function. This is the same as calling
* png_check_sig(sig, n) :=
!png_sig_cmp(sig, 0, n
).
* png_check_sig(sig, n) :=
(png_sig_cmp(sig, 0, n) == 0
).
*/
#define png_check_sig(sig, n)
!png_sig_cmp((sig), 0, (n))
#define png_check_sig(sig, n)
(png_sig_cmp((sig), 0, (n)) == 0)
/* DEPRECATED */
/* Allocate and initialize png_ptr struct for reading, and any other memory. */
PNG_EXPORTA
(
4
,
png_structp
,
png_create_read_struct
,
...
...
@@ -1730,12 +1730,9 @@ PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr));
PNG_EXPORT
(
98
,
void
,
png_free_data
,
(
png_const_structrp
png_ptr
,
png_inforp
info_ptr
,
png_uint_32
free_me
,
int
num
));
/* Reassign responsibility for freeing existing data, whether allocated
/* Reassign
the
responsibility for freeing existing data, whether allocated
* by libpng or by the application; this works on the png_info structure passed
* in, it does not change the state for other png_info structures.
*
* It is unlikely that this function works correctly as of 1.6.0 and using it
* may result either in memory leaks or double free of allocated data.
* in, without changing the state for other png_info structures.
*/
PNG_EXPORT
(
99
,
void
,
png_data_freer
,
(
png_const_structrp
png_ptr
,
png_inforp
info_ptr
,
int
freer
,
png_uint_32
mask
));
...
...
@@ -3207,11 +3204,18 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
#ifdef PNG_MIPS_MSA_API_SUPPORTED
# define PNG_MIPS_MSA 6
/* HARDWARE: MIPS Msa SIMD instructions supported */
#endif
#define PNG_IGNORE_ADLER32 8
#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
# define PNG_IGNORE_ADLER32 8
/* SOFTWARE: disable Adler32 check on IDAT */
#endif
#ifdef PNG_POWERPC_VSX_API_SUPPORTED
# define PNG_POWERPC_VSX 10
/* HARDWARE: PowerPC VSX SIMD instructions supported */
# define PNG_POWERPC_VSX 10
/* HARDWARE: PowerPC VSX SIMD instructions
* supported */
#endif
#define PNG_OPTION_NEXT 12
/* Next option - numbers must be even */
#ifdef PNG_MIPS_MMI_API_SUPPORTED
# define PNG_MIPS_MMI 12
/* HARDWARE: MIPS MMI SIMD instructions supported */
#endif
#define PNG_OPTION_NEXT 14
/* Next option - numbers must be even */
/* Return values: NOTE: there are four values and 'off' is *not* zero */
#define PNG_OPTION_UNSET 0
/* Unset - defaults to off */
...
...
libs/png/pngconf.h
View file @
1e5cc509
/* pngconf.h - machine-configurable file for libpng
*
* libpng version 1.6.4
0
* libpng version 1.6.4
2
*
* Copyright (c) 2018-202
2
Cosmin Truta
* Copyright (c) 2018-202
4
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.
...
...
libs/png/pngerror.c
View file @
1e5cc509
/* pngerror.c - stub functions for i/o and memory allocation
*
* Copyright (c) 2018 Cosmin Truta
* Copyright (c) 2018
-2024
Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
...
...
@@ -255,7 +255,7 @@ void
png_warning_parameter_unsigned
(
png_warning_parameters
p
,
int
number
,
int
format
,
png_alloc_size_t
value
)
{
char
buffer
[
PNG_NUMBER_BUFFER_SIZE
];
char
buffer
[
PNG_NUMBER_BUFFER_SIZE
]
=
{
0
}
;
png_warning_parameter
(
p
,
number
,
PNG_FORMAT_NUMBER
(
buffer
,
format
,
value
));
}
...
...
@@ -265,7 +265,7 @@ png_warning_parameter_signed(png_warning_parameters p, int number, int format,
{
png_alloc_size_t
u
;
png_charp
str
;
char
buffer
[
PNG_NUMBER_BUFFER_SIZE
];
char
buffer
[
PNG_NUMBER_BUFFER_SIZE
]
=
{
0
}
;
/* Avoid overflow by doing the negate in a png_alloc_size_t: */
u
=
(
png_alloc_size_t
)
value
;
...
...
@@ -858,7 +858,7 @@ png_get_error_ptr(png_const_structrp png_ptr)
if
(
png_ptr
==
NULL
)
return
NULL
;
return
(
(
png_voidp
)
png_ptr
->
error_ptr
)
;
return
(
png_voidp
)
png_ptr
->
error_ptr
;
}
...
...
@@ -933,31 +933,25 @@ png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
#endif
int
/* PRIVATE */
png_safe_execute
(
png_imagep
image
_in
,
int
(
*
function
)(
png_voidp
),
png_voidp
arg
)
png_safe_execute
(
png_imagep
image
,
int
(
*
function
)(
png_voidp
),
png_voidp
arg
)
{
volatile
png_imagep
image
=
image_in
;
volatile
int
result
;
volatile
png_voidp
saved_error_buf
;
png_voidp
saved_error_buf
=
image
->
opaque
->
error_buf
;
jmp_buf
safe_jmpbuf
;
int
result
;
/* Safely execute function(arg) with png_error returning to this function. */
saved_error_buf
=
image
->
opaque
->
error_buf
;
result
=
setjmp
(
safe_jmpbuf
)
==
0
;
if
(
result
!=
0
)
/* Safely execute function(arg), with png_error returning back here. */
if
(
setjmp
(
safe_jmpbuf
)
==
0
)
{
image
->
opaque
->
error_buf
=
safe_jmpbuf
;
result
=
function
(
arg
);
image
->
opaque
->
error_buf
=
saved_error_buf
;
return
result
;
}
/* On png_error, return via longjmp, pop the jmpbuf, and free the image. */
image
->
opaque
->
error_buf
=
saved_error_buf
;
/* And do the cleanup prior to any failure return. */
if
(
result
==
0
)
png_image_free
(
image
);
return
result
;
png_image_free
(
image
);
return
0
;
}
#endif
/* SIMPLIFIED READ || SIMPLIFIED_WRITE */
#endif
/* READ || WRITE */
libs/png/pngget.c
View file @
1e5cc509
This diff is collapsed.
Click to expand it.
libs/png/pnglibconf.h
View file @
1e5cc509
/* pnglibconf.h - library build configuration */
/* libpng version 1.6.
37
*/
/* libpng version 1.6.
42
*/
/* Copyright (c) 2018-20
19
Cosmin Truta */
/* Copyright (c) 2018-20
24
Cosmin Truta */
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
/* This code is released under the libpng license. */
...
...
@@ -27,6 +27,7 @@
#define PNG_COLORSPACE_SUPPORTED
/*#undef PNG_CONSOLE_IO_SUPPORTED*/
#define PNG_CONVERT_tIME_SUPPORTED
/*#undef PNG_DISABLE_ADLER32_CHECK_SUPPORTED*/
#define PNG_EASY_ACCESS_SUPPORTED
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
#define PNG_ERROR_TEXT_SUPPORTED
...
...
@@ -41,11 +42,15 @@
#define PNG_INCH_CONVERSIONS_SUPPORTED
#define PNG_INFO_IMAGE_SUPPORTED
#define PNG_IO_STATE_SUPPORTED
/*#undef PNG_MIPS_MMI_API_SUPPORTED*/
/*#undef PNG_MIPS_MMI_CHECK_SUPPORTED*/
/*#undef PNG_MIPS_MSA_API_SUPPORTED*/
/*#undef PNG_MIPS_MSA_CHECK_SUPPORTED*/
#define PNG_MNG_FEATURES_SUPPORTED
#define PNG_POINTER_INDEXING_SUPPORTED
/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/
/*#undef PNG_PROGRESSIVE_READ_SUPPORTED*/
#define PNG_PROGRESSIVE_READ_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED
#define PNG_READ_ALPHA_MODE_SUPPORTED
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
...
...
libs/png/pngpriv.h
View file @
1e5cc509
/* pngpriv.h - private declarations for use inside libpng
*
* Copyright (c) 2018-202
3
Cosmin Truta
* Copyright (c) 2018-202
4
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.
...
...
@@ -36,7 +36,7 @@
* still required (as of 2011-05-02.)
*/
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE 1
/* Just the POSIX 1003.1 and C89 APIs */
#
define _POSIX_SOURCE 1
/* Just the POSIX 1003.1 and C89 APIs */
#endif
#ifndef PNG_VERSION_INFO_ONLY
...
...
@@ -190,13 +190,27 @@
#endif
/* PNG_ARM_NEON_OPT > 0 */
#ifndef PNG_MIPS_MSA_OPT
# if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
# if defined(__mips_msa) && (__mips_isa_rev >= 5) && \
defined(PNG_ALIGNED_MEMORY_SUPPORTED)
# define PNG_MIPS_MSA_OPT 2
# else
# define PNG_MIPS_MSA_OPT 0
# endif
#endif
#ifndef PNG_MIPS_MMI_OPT
# ifdef PNG_MIPS_MMI
# if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64) && \
defined(PNG_ALIGNED_MEMORY_SUPPORTED)
# define PNG_MIPS_MMI_OPT 1
# else
# define PNG_MIPS_MMI_OPT 0
# endif
# else
# define PNG_MIPS_MMI_OPT 0
# endif
#endif
#ifndef PNG_POWERPC_VSX_OPT
# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
# define PNG_POWERPC_VSX_OPT 2
...
...
@@ -205,13 +219,21 @@
# endif
#endif
#ifndef PNG_LOONGARCH_LSX_OPT
# if defined(__loongarch_sx)
# define PNG_LOONGARCH_LSX_OPT 1
# else
# define PNG_LOONGARCH_LSX_OPT 0
# endif
#endif
#ifndef PNG_INTEL_SSE_OPT
# ifdef PNG_INTEL_SSE
/* Only check for SSE if the build configuration has been modified to
* enable SSE optimizations. This means that these optimizations will
* be off by default. See contrib/intel for more details.
*/
# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
#
if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
# define PNG_INTEL_SSE_OPT 1
...
...
@@ -248,7 +270,6 @@
#endif
#if PNG_MIPS_MSA_OPT > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
# if defined(__mips_msa)
# if defined(__clang__)
...
...
@@ -264,11 +285,28 @@
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
# define PNG_MIPS_MSA_IMPLEMENTATION 1
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
# endif
#else
# define PNG_MIPS_MSA_IMPLEMENTATION 0
#endif
/* PNG_MIPS_MSA_OPT > 0 */
#if PNG_MIPS_MMI_OPT > 0
# ifndef PNG_MIPS_MMI_IMPLEMENTATION
# if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64)
# define PNG_MIPS_MMI_IMPLEMENTATION 2
# else
/* !defined __mips_loongson_mmi || _MIPS_SIM != _ABI64 */
# define PNG_MIPS_MMI_IMPLEMENTATION 0
# endif
/* __mips_loongson_mmi && _MIPS_SIM == _ABI64 */
# endif
/* !PNG_MIPS_MMI_IMPLEMENTATION */
# if PNG_MIPS_MMI_IMPLEMENTATION > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
# endif
#else
# define PNG_MIPS_MMI_IMPLEMENTATION 0
#endif
/* PNG_MIPS_MMI_OPT > 0 */
#if PNG_POWERPC_VSX_OPT > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
# define PNG_POWERPC_VSX_IMPLEMENTATION 1
...
...
@@ -276,6 +314,12 @@
# define PNG_POWERPC_VSX_IMPLEMENTATION 0
#endif
#if PNG_LOONGARCH_LSX_OPT > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_lsx
# define PNG_LOONGARCH_LSX_IMPLEMENTATION 1
#else
# define PNG_LOONGARCH_LSX_IMPLEMENTATION 0
#endif
/* Is this a build of a DLL where compilation of the object modules requires
* different preprocessor settings to those required for a simple library? If
...
...
@@ -514,18 +558,8 @@
*/
# include <float.h>
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.
*/
# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
# include <fp.h>
# endif
# else
# include <math.h>
# endif
# include <math.h>
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
...
...
@@ -1306,7 +1340,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
#endif
#if PNG_MIPS_MSA_
OPT > 0
#if PNG_MIPS_MSA_
IMPLEMENTATION == 1
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_up_msa
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_sub3_msa
,(
png_row_infop
...
...
@@ -1323,6 +1357,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
#endif
#if PNG_MIPS_MMI_IMPLEMENTATION > 0
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_up_mmi
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_sub3_mmi
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_sub4_mmi
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_avg3_mmi
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_avg4_mmi
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_paeth3_mmi
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_paeth4_mmi
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
#endif
#if PNG_POWERPC_VSX_OPT > 0
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_up_vsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
...
...
@@ -1355,6 +1406,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
#endif
#if PNG_LOONGARCH_LSX_IMPLEMENTATION == 1
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_up_lsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_sub3_lsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_sub4_lsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_avg3_lsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_avg4_lsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_paeth3_lsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_paeth4_lsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
#endif
/* Choose the best filter to use and filter the row data */
PNG_INTERNAL_FUNCTION
(
void
,
png_write_find_filter
,(
png_structrp
png_ptr
,
png_row_infop
row_info
),
PNG_EMPTY
);
...
...
@@ -2094,17 +2162,27 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
(
png_structp
png_ptr
,
unsigned
int
bpp
),
PNG_EMPTY
);
#endif
#if PNG_MIPS_MSA_
OPT > 0
PNG_INTERNAL_FUNCTION
(
void
,
png_init_filter_functions_m
sa
,
#if PNG_MIPS_MSA_
IMPLEMENTATION == 1
PNG_INTERNAL_FUNCTION
(
void
,
png_init_filter_functions_m
ips
,
(
png_structp
png_ptr
,
unsigned
int
bpp
),
PNG_EMPTY
);
#endif
# if PNG_MIPS_MMI_IMPLEMENTATION > 0
PNG_INTERNAL_FUNCTION
(
void
,
png_init_filter_functions_mips
,
(
png_structp
png_ptr
,
unsigned
int
bpp
),
PNG_EMPTY
);
# endif
# if PNG_INTEL_SSE_IMPLEMENTATION > 0
PNG_INTERNAL_FUNCTION
(
void
,
png_init_filter_functions_sse2
,
(
png_structp
png_ptr
,
unsigned
int
bpp
),
PNG_EMPTY
);
# endif
#endif
#if PNG_LOONGARCH_LSX_OPT > 0
PNG_INTERNAL_FUNCTION
(
void
,
png_init_filter_functions_lsx
,
(
png_structp
png_ptr
,
unsigned
int
bpp
),
PNG_EMPTY
);
#endif
PNG_INTERNAL_FUNCTION
(
png_uint_32
,
png_check_keyword
,
(
png_structrp
png_ptr
,
png_const_charp
key
,
png_bytep
new_key
),
PNG_EMPTY
);
...
...
libs/png/pngread.c
View file @
1e5cc509
/* pngread.c - read a PNG file
*
* Copyright (c) 2018-20
19
Cosmin Truta
* Copyright (c) 2018-20
24
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.
...
...
@@ -568,7 +568,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
#endif
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
if
(
png_ptr
->
transformations
)
if
(
png_ptr
->
transformations
||
png_ptr
->
num_palette_max
>=
0
)
png_do_read_transformations
(
png_ptr
,
&
row_info
);
#endif
...
...
@@ -785,7 +785,7 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
/* Report invalid palette index; added at libng-1.5.10 */
if
(
png_ptr
->
color_type
==
PNG_COLOR_TYPE_PALETTE
&&
png_ptr
->
num_palette_max
>
png_ptr
->
num_palette
)
png_ptr
->
num_palette_max
>
=
png_ptr
->
num_palette
)
png_benign_error
(
png_ptr
,
"Read palette index exceeding num_palette"
);
#endif
...
...
@@ -1049,6 +1049,8 @@ void PNGAPI
png_read_png
(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
int
transforms
,
voidp
params
)
{
png_debug
(
1
,
"in png_read_png"
);
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
...
...
libs/png/pngrtran.c
View file @
1e5cc509
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Copyright (c) 2018-20
19
Cosmin Truta
* Copyright (c) 2018-20
24
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.
...
...
@@ -290,7 +290,7 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
int
compose
=
0
;
png_fixed_point
file_gamma
;
png_debug
(
1
,
"in png_set_alpha_mode"
);
png_debug
(
1
,
"in png_set_alpha_mode
_fixed
"
);
if
(
png_rtran_ok
(
png_ptr
,
0
)
==
0
)
return
;
...
...
@@ -970,7 +970,7 @@ void PNGFAPI
png_set_rgb_to_gray_fixed
(
png_structrp
png_ptr
,
int
error_action
,
png_fixed_point
red
,
png_fixed_point
green
)
{
png_debug
(
1
,
"in png_set_rgb_to_gray"
);
png_debug
(
1
,
"in png_set_rgb_to_gray
_fixed
"
);
/* Need the IHDR here because of the check on color_type below. */
/* TODO: fix this */
...
...
libs/png/pngrutil.c
View file @
1e5cc509
/* pngrutil.c - utilities to read a PNG file
*
* Copyright (c) 2018-202
2
Cosmin Truta
* Copyright (c) 2018-202
4
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.
...
...
@@ -26,7 +26,7 @@ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
if
(
uval
>
PNG_UINT_31_MAX
)
png_error
(
png_ptr
,
"PNG unsigned integer out of range"
);
return
(
uval
)
;
return
uval
;
}
#if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_READ_cHRM_SUPPORTED)
...
...
@@ -140,7 +140,7 @@ png_read_sig(png_structrp png_ptr, png_inforp info_ptr)
if
(
png_sig_cmp
(
info_ptr
->
signature
,
num_checked
,
num_to_check
)
!=
0
)
{
if
(
num_checked
<
4
&&
png_sig_cmp
(
info_ptr
->
signature
,
num_checked
,
num_to_check
-
4
))
png_sig_cmp
(
info_ptr
->
signature
,
num_checked
,
num_to_check
-
4
)
!=
0
)
png_error
(
png_ptr
,
"Not a PNG file"
);
else
png_error
(
png_ptr
,
"PNG file corrupted by ASCII conversion"
);
...
...
@@ -171,7 +171,7 @@ png_read_chunk_header(png_structrp png_ptr)
/* Put the chunk name into png_ptr->chunk_name. */
png_ptr
->
chunk_name
=
PNG_CHUNK_FROM_STRING
(
buf
+
4
);
png_debug2
(
0
,
"Reading
%lx chunk
, length = %lu"
,
png_debug2
(
0
,
"Reading
chunk typeid = 0x%lx
, length = %lu"
,
(
unsigned
long
)
png_ptr
->
chunk_name
,
(
unsigned
long
)
length
);
/* Reset the crc and run it over the chunk name. */
...
...
@@ -238,10 +238,10 @@ png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
else
png_chunk_error
(
png_ptr
,
"CRC error"
);
return
(
1
)
;
return
1
;
}
return
(
0
)
;
return
0
;
}
/* Compare the CRC stored in the PNG file with that calculated by libpng from
...
...
@@ -277,11 +277,11 @@ png_crc_error(png_structrp png_ptr)
if
(
need_crc
!=
0
)
{
crc
=
png_get_uint_32
(
crc_bytes
);
return
((
int
)(
crc
!=
png_ptr
->
crc
))
;
return
crc
!=
png_ptr
->
crc
;
}
else
return
(
0
)
;
return
0
;
}
#if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
...
...
@@ -421,8 +421,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
png_ptr
->
flags
|=
PNG_FLAG_ZSTREAM_INITIALIZED
;
}
#if ZLIB_VERNUM >= 0x1290 && \
defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
if
(((
png_ptr
->
options
>>
PNG_IGNORE_ADLER32
)
&
3
)
==
PNG_OPTION_ON
)
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
ret
=
inflateValidate
(
&
png_ptr
->
zstream
,
0
);
...
...
libs/png/pngset.c
View file @
1e5cc509
/* pngset.c - storage of image information into info struct
*
* Copyright (c) 2018-202
3
Cosmin Truta
* Copyright (c) 2018-202
4
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.
...
...
@@ -763,11 +763,11 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
{
int
i
;
png_debug1
(
1
,
"in
%lx storage function"
,
png_ptr
==
NULL
?
0xabadca11U
:
(
unsigned
long
)
png_ptr
->
chunk_name
);
png_debug1
(
1
,
"in
text storage function, chunk typeid = 0x%lx"
,
png_ptr
==
NULL
?
0xabadca11UL
:
(
unsigned
long
)
png_ptr
->
chunk_name
);
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
||
num_text
<=
0
||
text_ptr
==
NULL
)
return
(
0
)
;
return
0
;
/* Make sure we have enough space in the "text" array in info_struct
* to hold all of the incoming text_ptr objects. This compare can't overflow
...
...
@@ -947,7 +947,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
png_debug1
(
3
,
"transferred text chunk %d"
,
info_ptr
->
num_text
);
}
return
(
0
)
;
return
0
;
}
#endif
...
...
@@ -1063,6 +1063,8 @@ png_set_sPLT(png_const_structrp png_ptr,
{
png_sPLT_tp
np
;
png_debug1
(
1
,
"in %s storage function"
,
"sPLT"
);
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
||
nentries
<=
0
||
entries
==
NULL
)
return
;
...
...
@@ -1537,7 +1539,7 @@ void PNGAPI
png_set_rows
(
png_const_structrp
png_ptr
,
png_inforp
info_ptr
,
png_bytepp
row_pointers
)
{
png_debug
1
(
1
,
"in %s storage function"
,
"
rows"
);
png_debug
(
1
,
"in png_set_
rows"
);
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
...
...
@@ -1556,6 +1558,8 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
void
PNGAPI
png_set_compression_buffer_size
(
png_structrp
png_ptr
,
size_t
size
)
{
png_debug
(
1
,
"in png_set_compression_buffer_size"
);
if
(
png_ptr
==
NULL
)
return
;
...
...
@@ -1627,6 +1631,8 @@ void PNGAPI
png_set_user_limits
(
png_structrp
png_ptr
,
png_uint_32
user_width_max
,
png_uint_32
user_height_max
)
{
png_debug
(
1
,
"in png_set_user_limits"
);
/* Images with dimensions larger than these limits will be
* rejected by png_set_IHDR(). To accept any PNG datastream
* regardless of dimensions, set both limits to 0x7fffffff.
...
...
@@ -1642,6 +1648,8 @@ png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max,
void
PNGAPI
png_set_chunk_cache_max
(
png_structrp
png_ptr
,
png_uint_32
user_chunk_cache_max
)
{
png_debug
(
1
,
"in png_set_chunk_cache_max"
);
if
(
png_ptr
!=
NULL
)
png_ptr
->
user_chunk_cache_max
=
user_chunk_cache_max
;
}
...
...
@@ -1651,6 +1659,8 @@ void PNGAPI
png_set_chunk_malloc_max
(
png_structrp
png_ptr
,
png_alloc_size_t
user_chunk_malloc_max
)
{
png_debug
(
1
,
"in png_set_chunk_malloc_max"
);
if
(
png_ptr
!=
NULL
)
png_ptr
->
user_chunk_malloc_max
=
user_chunk_malloc_max
;
}
...
...
libs/png/pngtrans.c
View file @
1e5cc509
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Copyright (c) 2018 Cosmin Truta
* Copyright (c) 2018
-2024
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.
...
...
@@ -103,10 +103,10 @@ png_set_interlace_handling(png_structrp png_ptr)
if
(
png_ptr
!=
0
&&
png_ptr
->
interlaced
!=
0
)
{
png_ptr
->
transformations
|=
PNG_INTERLACE
;
return
(
7
)
;
return
7
;
}
return
(
1
)
;
return
1
;
}
#endif
...
...
@@ -498,6 +498,8 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
png_bytep
dp
=
row
;
/* destination pointer */
png_bytep
ep
=
row
+
row_info
->
rowbytes
;
/* One beyond end of row */
png_debug
(
1
,
"in png_do_strip_channel"
);
/* At the start sp will point to the first byte to copy and dp to where
* it is copied to. ep always points just beyond the end of the row, so
* the loop simply copies (channels-1) channels until sp reaches ep.
...
...
@@ -698,6 +700,8 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
void
/* PRIVATE */
png_do_check_palette_indexes
(
png_structrp
png_ptr
,
png_row_infop
row_info
)
{
png_debug
(
1
,
"in png_do_check_palette_indexes"
);
if
(
png_ptr
->
num_palette
<
(
1
<<
row_info
->
bit_depth
)
&&
png_ptr
->
num_palette
>
0
)
/* num_palette can be 0 in MNG files */
{
...
...
@@ -708,7 +712,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
* forms produced on either GCC or MSVC.
*/
int
padding
=
PNG_PADBITS
(
row_info
->
pixel_depth
,
row_info
->
width
);
png_bytep
rp
=
png_ptr
->
row_buf
+
row_info
->
rowbytes
-
1
;
png_bytep
rp
=
png_ptr
->
row_buf
+
row_info
->
rowbytes
;
switch
(
row_info
->
bit_depth
)
{
...
...
@@ -833,7 +837,7 @@ png_voidp PNGAPI
png_get_user_transform_ptr
(
png_const_structrp
png_ptr
)
{
if
(
png_ptr
==
NULL
)
return
(
NULL
)
;
return
NULL
;
return
png_ptr
->
user_transform_ptr
;
}
...
...
libs/png/pngwrite.c
View file @
1e5cc509
/* pngwrite.c - general routines to write a PNG file
*
* Copyright (c) 2018-202
3
Cosmin Truta
* Copyright (c) 2018-202
4
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.
...
...
@@ -369,7 +369,8 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
png_error
(
png_ptr
,
"No IDATs written into file"
);
#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
if
(
png_ptr
->
num_palette_max
>
png_ptr
->
num_palette
)
if
(
png_ptr
->
color_type
==
PNG_COLOR_TYPE_PALETTE
&&
png_ptr
->
num_palette_max
>=
png_ptr
->
num_palette
)
png_benign_error
(
png_ptr
,
"Wrote palette index exceeding num_palette"
);
#endif
...
...
@@ -714,12 +715,12 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
/* 1.5.6: moved from png_struct to be a local structure: */
png_row_info
row_info
;
if
(
png_ptr
==
NULL
)
return
;
png_debug2
(
1
,
"in png_write_row (row %u, pass %d)"
,
png_ptr
->
row_number
,
png_ptr
->
pass
);
if
(
png_ptr
==
NULL
)
return
;
/* Initialize transformations and other stuff if first time */
if
(
png_ptr
->
row_number
==
0
&&
png_ptr
->
pass
==
0
)
{
...
...
@@ -1210,6 +1211,8 @@ png_set_compression_strategy(png_structrp png_ptr, int strategy)
void
PNGAPI
png_set_compression_window_bits
(
png_structrp
png_ptr
,
int
window_bits
)
{
png_debug
(
1
,
"in png_set_compression_window_bits"
);
if
(
png_ptr
==
NULL
)
return
;
...
...
@@ -1293,6 +1296,8 @@ png_set_text_compression_strategy(png_structrp png_ptr, int strategy)
void
PNGAPI
png_set_text_compression_window_bits
(
png_structrp
png_ptr
,
int
window_bits
)
{
png_debug
(
1
,
"in png_set_text_compression_window_bits"
);
if
(
png_ptr
==
NULL
)
return
;
...
...
@@ -1330,6 +1335,8 @@ png_set_text_compression_method(png_structrp png_ptr, int method)
void
PNGAPI
png_set_write_status_fn
(
png_structrp
png_ptr
,
png_write_status_ptr
write_row_fn
)
{
png_debug
(
1
,
"in png_set_write_status_fn"
);
if
(
png_ptr
==
NULL
)
return
;
...
...
@@ -1357,6 +1364,8 @@ void PNGAPI
png_write_png
(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
int
transforms
,
voidp
params
)
{
png_debug
(
1
,
"in png_write_png"
);
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
...
...
libs/png/pngwutil.c
View file @
1e5cc509
/* pngwutil.c - utilities to write a PNG file
*
* Copyright (c) 2018-202
2
Cosmin Truta
* Copyright (c) 2018-202
4
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.
...
...
@@ -2311,7 +2311,7 @@ png_setup_sub_row(png_structrp png_ptr, png_uint_32 bpp,
break
;
}
return
(
sum
)
;
return
sum
;
}
static
void
/* PRIVATE */
...
...
@@ -2361,7 +2361,7 @@ png_setup_up_row(png_structrp png_ptr, size_t row_bytes, size_t lmins)
break
;
}
return
(
sum
)
;
return
sum
;
}
static
void
/* PRIVATE */
png_setup_up_row_only
(
png_structrp
png_ptr
,
size_t
row_bytes
)
...
...
@@ -2417,7 +2417,7 @@ png_setup_avg_row(png_structrp png_ptr, png_uint_32 bpp,
break
;
}
return
(
sum
)
;
return
sum
;
}
static
void
/* PRIVATE */
png_setup_avg_row_only
(
png_structrp
png_ptr
,
png_uint_32
bpp
,
...
...
@@ -2500,7 +2500,7 @@ png_setup_paeth_row(png_structrp png_ptr, png_uint_32 bpp,
break
;
}
return
(
sum
)
;
return
sum
;
}
static
void
/* PRIVATE */
png_setup_paeth_row_only
(
png_structrp
png_ptr
,
png_uint_32
bpp
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment