Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
f4e682d7
Commit
f4e682d7
authored
Jul 28, 2018
by
Rémi Verschelde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libpng: Update to upstream version 1.6.35
parent
4e4702e3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
205 additions
and
176 deletions
+205
-176
COPYRIGHT.txt
COPYRIGHT.txt
+1
-1
README.md
thirdparty/README.md
+2
-1
LICENSE
thirdparty/libpng/LICENSE
+3
-3
png.c
thirdparty/libpng/png.c
+20
-20
png.h
thirdparty/libpng/png.h
+0
-0
pngconf.h
thirdparty/libpng/pngconf.h
+15
-14
pngget.c
thirdparty/libpng/pngget.c
+9
-8
pnginfo.h
thirdparty/libpng/pnginfo.h
+7
-7
pnglibconf.h
thirdparty/libpng/pnglibconf.h
+3
-3
pngpread.c
thirdparty/libpng/pngpread.c
+19
-19
pngpriv.h
thirdparty/libpng/pngpriv.h
+25
-19
pngread.c
thirdparty/libpng/pngread.c
+6
-6
pngrio.c
thirdparty/libpng/pngrio.c
+6
-6
pngrtran.c
thirdparty/libpng/pngrtran.c
+0
-0
pngrutil.c
thirdparty/libpng/pngrutil.c
+46
-25
pngset.c
thirdparty/libpng/pngset.c
+9
-9
pngstruct.h
thirdparty/libpng/pngstruct.h
+11
-11
pngtrans.c
thirdparty/libpng/pngtrans.c
+9
-9
pngwio.c
thirdparty/libpng/pngwio.c
+5
-5
pngwrite.c
thirdparty/libpng/pngwrite.c
+4
-5
pngwtran.c
thirdparty/libpng/pngwtran.c
+5
-5
pngwutil.c
thirdparty/libpng/pngwutil.c
+0
-0
No files found.
COPYRIGHT.txt
View file @
f4e682d7
...
...
@@ -185,7 +185,7 @@ Files: ./thirdparty/libpng/
Comment: libpng
Copyright: 1995-1996, Guy Eric Schalnat, Group 42, Inc.
1996-1997, Andreas Dilger
1998-201
6
, Glenn Randers-Pehrson
1998-201
8
, Glenn Randers-Pehrson
License: Zlib
Files: ./thirdparty/libsimplewebm/
...
...
thirdparty/README.md
View file @
f4e682d7
...
...
@@ -152,7 +152,7 @@ Files extracted from upstream source:
## libpng
-
Upstream: http://libpng.org/pub/png/libpng.html
-
Version: 1.6.3
4
-
Version: 1.6.3
5
-
License: libpng/zlib
Files extracted from upstream source:
...
...
@@ -161,6 +161,7 @@ Files extracted from upstream source:
`example.c`
and
`pngtest.c`
-
the arm/ folder
-
`scripts/pnglibconf.h.prebuilt`
as
`pnglibconf.h`
-
`LICENSE`
## libsimplewebm
...
...
thirdparty/libpng/LICENSE
View file @
f4e682d7
...
...
@@ -10,8 +10,8 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.0.7, July 1, 2000 through 1.6.3
4, September 29, 2017
are
Copyright (c) 2000-2002, 2004, 2006-201
7
Glenn Randers-Pehrson, are
libpng versions 1.0.7, July 1, 2000 through 1.6.3
5, July 15, 2018
are
Copyright (c) 2000-2002, 2004, 2006-201
8
Glenn Randers-Pehrson, are
derived from libpng-1.0.6, and are distributed according to the same
disclaimer and license as libpng-1.0.6 with the following individuals
added to the list of Contributing Authors:
...
...
@@ -130,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
September 29, 2017
July 15, 2018
thirdparty/libpng/png.c
View file @
f4e682d7
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.6.3
3 [September 28, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.3
5 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -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_3
4
Your_png_h_is_not_version_1_6_34
;
typedef
png_libpng_version_1_6_3
5
Your_png_h_is_not_version_1_6_35
;
#ifdef __GNUC__
/* The version tests may need to be added to, but the problem warning has
...
...
@@ -71,7 +71,7 @@ png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
* PNG signature (this is the same behavior as strcmp, memcmp, etc).
*/
int
PNGAPI
png_sig_cmp
(
png_const_bytep
sig
,
png_size_t
start
,
png_
size_t
num_to_check
)
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
};
...
...
@@ -136,7 +136,7 @@ png_reset_crc(png_structrp png_ptr)
* trouble of calculating it.
*/
void
/* PRIVATE */
png_calculate_crc
(
png_structrp
png_ptr
,
png_const_bytep
ptr
,
png_
size_t
length
)
png_calculate_crc
(
png_structrp
png_ptr
,
png_const_bytep
ptr
,
size_t
length
)
{
int
need_crc
=
1
;
...
...
@@ -421,7 +421,7 @@ png_destroy_info_struct(png_const_structrp png_ptr, png_infopp info_ptr_ptr)
* those cases where it does anything other than a memset.
*/
PNG_FUNCTION
(
void
,
PNGAPI
png_info_init_3
,(
png_infopp
ptr_ptr
,
png_
size_t
png_info_struct_size
),
png_info_init_3
,(
png_infopp
ptr_ptr
,
size_t
png_info_struct_size
),
PNG_DEPRECATED
)
{
png_inforp
info_ptr
=
*
ptr_ptr
;
...
...
@@ -816,15 +816,15 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return
PNG_STRING_NEWLINE
\
"libpng version 1.6.3
4 - September 29, 2017
"
PNG_STRING_NEWLINE
\
"Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson"
\
"libpng version 1.6.3
5 - July 15, 2018
"
PNG_STRING_NEWLINE
\
"Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson"
\
PNG_STRING_NEWLINE
\
"Copyright (c) 1996-1997 Andreas Dilger"
PNG_STRING_NEWLINE
\
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."
\
PNG_STRING_NEWLINE
;
# else
return
"libpng version 1.6.3
4 - September 29, 2017
\
Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson\
return
"libpng version 1.6.3
5 - July 15, 2018
\
Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."
;
# endif
...
...
@@ -942,7 +942,7 @@ png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name)
/* The code is the fifth byte after each four byte string. Historically this
* code was always searched from the end of the list, this is no longer
* necessary because the 'set' routine handles duplicate entries correcty.
* necessary because the 'set' routine handles duplicate entries correct
l
y.
*/
do
/* num_chunk_list > 0, so at least one */
{
...
...
@@ -2067,7 +2067,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
*/
/* Data checks (could be skipped). These checks must be independent of the
* version number; however, the version number doesn't accomodate changes in
* version number; however, the version number doesn't accom
m
odate changes in
* the header fields (just the known tags and the interpretation of the
* data.)
*/
...
...
@@ -2707,7 +2707,7 @@ png_check_IHDR(png_const_structrp png_ptr,
#if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
/* ASCII to fp functions */
/* Check an ASCII formated floating point value, see the more detailed
/* Check an ASCII format
t
ed floating point value, see the more detailed
* comments in pngpriv.h
*/
/* The following is used internally to preserve the sticky flags */
...
...
@@ -2715,11 +2715,11 @@ png_check_IHDR(png_const_structrp png_ptr,
#define png_fp_set(state, value) ((state) = (value) | ((state) & PNG_FP_STICKY))
int
/* PRIVATE */
png_check_fp_number
(
png_const_charp
string
,
png_
size_t
size
,
int
*
statep
,
png_check_fp_number
(
png_const_charp
string
,
size_t
size
,
int
*
statep
,
png_size_tp
whereami
)
{
int
state
=
*
statep
;
png_
size_t
i
=
*
whereami
;
size_t
i
=
*
whereami
;
while
(
i
<
size
)
{
...
...
@@ -2842,10 +2842,10 @@ PNG_FP_End:
/* The same but for a complete string. */
int
png_check_fp_string
(
png_const_charp
string
,
png_
size_t
size
)
png_check_fp_string
(
png_const_charp
string
,
size_t
size
)
{
int
state
=
0
;
png_
size_t
char_index
=
0
;
size_t
char_index
=
0
;
if
(
png_check_fp_number
(
string
,
size
,
&
state
,
&
char_index
)
!=
0
&&
(
char_index
==
size
||
string
[
char_index
]
==
0
))
...
...
@@ -2906,7 +2906,7 @@ png_pow10(int power)
#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
,
png_
size_t
size
,
png_ascii_from_fp
(
png_const_structrp
png_ptr
,
png_charp
ascii
,
size_t
size
,
double
fp
,
unsigned
int
precision
)
{
/* We use standard functions from math.h, but not printf because
...
...
@@ -3237,7 +3237,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
*/
void
/* PRIVATE */
png_ascii_from_fixed
(
png_const_structrp
png_ptr
,
png_charp
ascii
,
png_
size_t
size
,
png_fixed_point
fp
)
size_t
size
,
png_fixed_point
fp
)
{
/* Require space for 10 decimal digits, a decimal point, a minus sign and a
* trailing \0, 13 characters:
...
...
@@ -4344,7 +4344,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
png_uint_32
setting
=
(
2U
+
(
onoff
!=
0
))
<<
option
;
png_uint_32
current
=
png_ptr
->
options
;
png_ptr
->
options
=
(
png_uint_32
)((
(
current
&
~
mask
)
|
setting
)
&
0xff
);
png_ptr
->
options
=
(
png_uint_32
)((
current
&
~
mask
)
|
setting
);
return
(
int
)(
current
&
mask
)
>>
option
;
}
...
...
thirdparty/libpng/png.h
View file @
f4e682d7
This diff is collapsed.
Click to expand it.
thirdparty/libpng/pngconf.h
View file @
f4e682d7
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.6.3
4, September 29, 2017
* libpng version 1.6.3
5, July 15, 2018
*
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2016
,2018
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -127,7 +127,7 @@
*
* These cases only differ if the operating system does not use the C
* calling convention, at present this just means the above cases
* (x86 DOS/Windows sytems) and, even then, this does not apply to
* (x86 DOS/Windows sy
s
tems) and, even then, this does not apply to
* Cygwin running on those systems.
*
* Note that the value must be defined in pnglibconf.h so that what
...
...
@@ -515,8 +515,10 @@
# error "libpng requires an unsigned 32-bit (or more) type"
#endif
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
* requires an ISOC90 compiler and relies on consistent behavior of sizeof.
/* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t.
* From 1.6.0 onwards, an ISO C90 compiler, as well as a standard-compliant
* behavior of sizeof and ptrdiff_t are required.
* The legacy typedefs are provided here for backwards compatibility.
*/
typedef
size_t
png_size_t
;
typedef
ptrdiff_t
png_ptrdiff_t
;
...
...
@@ -537,13 +539,12 @@ typedef ptrdiff_t png_ptrdiff_t;
# endif
#endif
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no
* smaller than png_uint_32. Casts from png_size_t or png_uint_32 to
* png_alloc_size_t are not necessary; in fact, it is recommended not to use
* them at all so that the compiler can complain when something turns out to be
* problematic.
/* png_alloc_size_t is guaranteed to be no smaller than size_t, and no smaller
* than png_uint_32. Casts from size_t or png_uint_32 to png_alloc_size_t are
* not necessary; in fact, it is recommended not to use them at all, so that
* the compiler can complain when something turns out to be problematic.
*
* Casts in the other direction (from png_alloc_size_t to
png_
size_t or
* Casts in the other direction (from png_alloc_size_t to size_t or
* png_uint_32) should be explicitly applied; however, we do not expect to
* encounter practical situations that require such conversions.
*
...
...
@@ -553,7 +554,7 @@ typedef ptrdiff_t png_ptrdiff_t;
#ifdef PNG_SMALL_SIZE_T
typedef
png_uint_32
png_alloc_size_t
;
#else
typedef
png_
size_t
png_alloc_size_t
;
typedef
size_t
png_alloc_size_t
;
#endif
/* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
...
...
@@ -589,8 +590,8 @@ typedef char * png_charp;
typedef
const
char
*
png_const_charp
;
typedef
png_fixed_point
*
png_fixed_point_p
;
typedef
const
png_fixed_point
*
png_const_fixed_point_p
;
typedef
png_size_t
*
png_size_tp
;
typedef
const
png_size_t
*
png_const_size_tp
;
typedef
size_t
*
png_size_tp
;
typedef
const
size_t
*
png_const_size_tp
;
#ifdef PNG_STDIO_SUPPORTED
typedef
FILE
*
png_FILE_p
;
...
...
thirdparty/libpng/pngget.c
View file @
f4e682d7
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.6.3
2 [August 24, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.3
5 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -26,7 +26,7 @@ png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
return
(
0
);
}
png_
size_t
PNGAPI
size_t
PNGAPI
png_get_rowbytes
(
png_const_structrp
png_ptr
,
png_const_inforp
info_ptr
)
{
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
...
...
@@ -367,7 +367,7 @@ png_get_y_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
static
png_fixed_point
png_fixed_inches_from_microns
(
png_const_structrp
png_ptr
,
png_int_32
microns
)
{
/* Convert from met
re
s * 1,000,000 to inches * 100,000, meters to
/* Convert from met
er
s * 1,000,000 to inches * 100,000, meters to
* inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
* Notice that this can overflow - a warning is output and 0 is
* returned.
...
...
@@ -741,8 +741,7 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
(
info_ptr
->
valid
&
PNG_INFO_iCCP
)
!=
0
&&
name
!=
NULL
&&
compression_type
!=
NULL
&&
profile
!=
NULL
&&
proflen
!=
NULL
)
name
!=
NULL
&&
profile
!=
NULL
&&
proflen
!=
NULL
)
{
*
name
=
info_ptr
->
iccp_name
;
*
profile
=
info_ptr
->
iccp_profile
;
...
...
@@ -750,11 +749,13 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
/* This is somewhat irrelevant since the profile data returned has
* actually been uncompressed.
*/
*
compression_type
=
PNG_COMPRESSION_TYPE_BASE
;
if
(
compression_type
!=
NULL
)
*
compression_type
=
PNG_COMPRESSION_TYPE_BASE
;
return
(
PNG_INFO_iCCP
);
}
return
(
0
);
}
#endif
...
...
@@ -1164,7 +1165,7 @@ png_get_user_chunk_ptr(png_const_structrp png_ptr)
}
#endif
png_
size_t
PNGAPI
size_t
PNGAPI
png_get_compression_buffer_size
(
png_const_structrp
png_ptr
)
{
if
(
png_ptr
==
NULL
)
...
...
thirdparty/libpng/pnginfo.h
View file @
f4e682d7
/* pnginfo.h - header file for PNG reference library
*
* Last changed in libpng 1.6.
1 [March 28, 2013
]
* Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-2013
,2018
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -55,10 +55,10 @@
struct
png_info_def
{
/* The following are necessary for every PNG file */
png_uint_32
width
;
/* width of image in pixels (from IHDR) */
png_uint_32
height
;
/* height of image in pixels (from IHDR) */
png_uint_32
valid
;
/* valid chunk data (see PNG_INFO_ below) */
png_size_t
rowbytes
;
/* bytes needed to hold an untransformed row */
png_uint_32
width
;
/* width of image in pixels (from IHDR) */
png_uint_32
height
;
/* height of image in pixels (from IHDR) */
png_uint_32
valid
;
/* valid chunk data (see PNG_INFO_ below) */
size_t
rowbytes
;
/* bytes needed to hold an untransformed row */
png_colorp
palette
;
/* array of color values (valid & PNG_INFO_PLTE) */
png_uint_16
num_palette
;
/* number of color entries in "palette" (PLTE) */
png_uint_16
num_trans
;
/* number of transparent palette color (tRNS) */
...
...
@@ -247,7 +247,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
/* The sCAL chunk describes the actual physical dimensions of the
* subject matter of the graphic. The chunk contains a unit specification
* a byte value, and two ASCII strings representing floating-point
* values. The values are width and height correspon
s
ing to one pixel
* values. The values are width and height correspon
d
ing to one pixel
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
* non-zero.
*/
...
...
thirdparty/libpng/pnglibconf.h
View file @
f4e682d7
/* libpng 1.6.3
4
STANDARD API DEFINITION */
/* libpng 1.6.3
5
STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
/* Libpng version 1.6.3
4 - September 29, 2017
*/
/* Libpng version 1.6.3
5 - July 15, 2018
*/
/* Copyright (c) 1998-201
7
Glenn Randers-Pehrson */
/* Copyright (c) 1998-201
8
Glenn Randers-Pehrson */
/* This code is released under the libpng license. */
/* For conditions of distribution and use, see the disclaimer */
...
...
thirdparty/libpng/pngpread.c
View file @
f4e682d7
/* pngpread.c - read a png file in push mode
*
* Last changed in libpng 1.6.3
2 [August 24, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.3
5 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -34,7 +34,7 @@ if (png_ptr->buffer_size < N) \
void
PNGAPI
png_process_data
(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
png_bytep
buffer
,
png_
size_t
buffer_size
)
png_bytep
buffer
,
size_t
buffer_size
)
{
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
...
...
@@ -47,7 +47,7 @@ png_process_data(png_structrp png_ptr, png_inforp info_ptr,
}
}
png_
size_t
PNGAPI
size_t
PNGAPI
png_process_data_pause
(
png_structrp
png_ptr
,
int
save
)
{
if
(
png_ptr
!=
NULL
)
...
...
@@ -60,7 +60,7 @@ png_process_data_pause(png_structrp png_ptr, int save)
else
{
/* This includes any pending saved bytes: */
png_
size_t
remaining
=
png_ptr
->
buffer_size
;
size_t
remaining
=
png_ptr
->
buffer_size
;
png_ptr
->
buffer_size
=
0
;
/* So subtract the saved buffer size, unless all the data
...
...
@@ -133,8 +133,8 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
void
/* PRIVATE */
png_push_read_sig
(
png_structrp
png_ptr
,
png_inforp
info_ptr
)
{
png_size_t
num_checked
=
png_ptr
->
sig_bytes
,
/* SAFE, does not exceed 8 */
num_to_check
=
8
-
num_checked
;
size_t
num_checked
=
png_ptr
->
sig_bytes
;
/* SAFE, does not exceed 8 */
size_t
num_to_check
=
8
-
num_checked
;
if
(
png_ptr
->
buffer_size
<
num_to_check
)
{
...
...
@@ -418,7 +418,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
}
void
PNGCBAPI
png_push_fill_buffer
(
png_structp
png_ptr
,
png_bytep
buffer
,
png_
size_t
length
)
png_push_fill_buffer
(
png_structp
png_ptr
,
png_bytep
buffer
,
size_t
length
)
{
png_bytep
ptr
;
...
...
@@ -428,7 +428,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
ptr
=
buffer
;
if
(
png_ptr
->
save_buffer_size
!=
0
)
{
png_
size_t
save_size
;
size_t
save_size
;
if
(
length
<
png_ptr
->
save_buffer_size
)
save_size
=
length
;
...
...
@@ -445,7 +445,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
}
if
(
length
!=
0
&&
png_ptr
->
current_buffer_size
!=
0
)
{
png_
size_t
save_size
;
size_t
save_size
;
if
(
length
<
png_ptr
->
current_buffer_size
)
save_size
=
length
;
...
...
@@ -467,7 +467,7 @@ png_push_save_buffer(png_structrp png_ptr)
{
if
(
png_ptr
->
save_buffer_ptr
!=
png_ptr
->
save_buffer
)
{
png_
size_t
i
,
istop
;
size_t
i
,
istop
;
png_bytep
sp
;
png_bytep
dp
;
...
...
@@ -482,7 +482,7 @@ png_push_save_buffer(png_structrp png_ptr)
if
(
png_ptr
->
save_buffer_size
+
png_ptr
->
current_buffer_size
>
png_ptr
->
save_buffer_max
)
{
png_
size_t
new_max
;
size_t
new_max
;
png_bytep
old_buffer
;
if
(
png_ptr
->
save_buffer_size
>
PNG_SIZE_MAX
-
...
...
@@ -494,7 +494,7 @@ png_push_save_buffer(png_structrp png_ptr)
new_max
=
png_ptr
->
save_buffer_size
+
png_ptr
->
current_buffer_size
+
256
;
old_buffer
=
png_ptr
->
save_buffer
;
png_ptr
->
save_buffer
=
(
png_bytep
)
png_malloc_warn
(
png_ptr
,
(
png_
size_t
)
new_max
);
(
size_t
)
new_max
);
if
(
png_ptr
->
save_buffer
==
NULL
)
{
...
...
@@ -522,7 +522,7 @@ png_push_save_buffer(png_structrp png_ptr)
void
/* PRIVATE */
png_push_restore_buffer
(
png_structrp
png_ptr
,
png_bytep
buffer
,
png_
size_t
buffer_length
)
size_t
buffer_length
)
{
png_ptr
->
current_buffer
=
buffer
;
png_ptr
->
current_buffer_size
=
buffer_length
;
...
...
@@ -562,7 +562,7 @@ png_push_read_IDAT(png_structrp png_ptr)
if
(
png_ptr
->
idat_size
!=
0
&&
png_ptr
->
save_buffer_size
!=
0
)
{
png_
size_t
save_size
=
png_ptr
->
save_buffer_size
;
size_t
save_size
=
png_ptr
->
save_buffer_size
;
png_uint_32
idat_size
=
png_ptr
->
idat_size
;
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they
...
...
@@ -572,7 +572,7 @@ png_push_read_IDAT(png_structrp png_ptr)
* will break on either 16-bit or 64-bit platforms.
*/
if
(
idat_size
<
save_size
)
save_size
=
(
png_
size_t
)
idat_size
;
save_size
=
(
size_t
)
idat_size
;
else
idat_size
=
(
png_uint_32
)
save_size
;
...
...
@@ -589,7 +589,7 @@ png_push_read_IDAT(png_structrp png_ptr)
if
(
png_ptr
->
idat_size
!=
0
&&
png_ptr
->
current_buffer_size
!=
0
)
{
png_
size_t
save_size
=
png_ptr
->
current_buffer_size
;
size_t
save_size
=
png_ptr
->
current_buffer_size
;
png_uint_32
idat_size
=
png_ptr
->
idat_size
;
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they
...
...
@@ -598,7 +598,7 @@ png_push_read_IDAT(png_structrp png_ptr)
* larger - this cannot overflow.
*/
if
(
idat_size
<
save_size
)
save_size
=
(
png_
size_t
)
idat_size
;
save_size
=
(
size_t
)
idat_size
;
else
idat_size
=
(
png_uint_32
)
save_size
;
...
...
@@ -625,7 +625,7 @@ png_push_read_IDAT(png_structrp png_ptr)
void
/* PRIVATE */
png_process_IDAT_data
(
png_structrp
png_ptr
,
png_bytep
buffer
,
png_
size_t
buffer_length
)
size_t
buffer_length
)
{
/* The caller checks for a non-zero buffer length. */
if
(
!
(
buffer_length
>
0
)
||
buffer
==
NULL
)
...
...
thirdparty/libpng/pngpriv.h
View file @
f4e682d7
/* pngpriv.h - private declarations for use inside libpng
*
* Last changed in libpng 1.6.3
2 [August 24, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.3
5 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -210,7 +210,11 @@
defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
# define PNG_INTEL_SSE_OPT 1
# else
# define PNG_INTEL_SSE_OPT 0
# endif
# else
# define PNG_INTEL_SSE_OPT 0
# endif
#endif
...
...
@@ -234,6 +238,8 @@
# if PNG_INTEL_SSE_IMPLEMENTATION > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
# endif
#else
# define PNG_INTEL_SSE_IMPLEMENTATION 0
#endif
#if PNG_MIPS_MSA_OPT > 0
...
...
@@ -728,8 +734,8 @@
/* Added to libpng-1.2.6 JB */
#define PNG_ROWBYTES(pixel_bits, width) \
((pixel_bits) >= 8 ? \
((
png_size_t)(width) * (((png_
size_t)(pixel_bits)) >> 3)) : \
(( ((
png_size_t)(width) * ((png_
size_t)(pixel_bits))) + 7) >> 3) )
((
size_t)(width) * (((
size_t)(pixel_bits)) >> 3)) : \
(( ((
size_t)(width) * ((
size_t)(pixel_bits))) + 7) >> 3) )
/* This returns the number of trailing bits in the last byte of a row, 0 if the
* last byte is completely full of pixels. It is, in principle, (pixel_bits x
...
...
@@ -917,7 +923,7 @@
* PNG files the -I directives must match.
*
* The most likely explanation is that you passed a -I in CFLAGS. This will
* not work; all the preprocessor direct
ori
es and in particular all the -I
* not work; all the preprocessor direct
iv
es and in particular all the -I
* directives must be in CPPFLAGS.
*/
#endif
...
...
@@ -1046,15 +1052,15 @@ PNG_INTERNAL_FUNCTION(void,png_zfree,(voidpf png_ptr, voidpf ptr),PNG_EMPTY);
*/
PNG_INTERNAL_FUNCTION
(
void
PNGCBAPI
,
png_default_read_data
,(
png_structp
png_ptr
,
png_bytep
data
,
png_
size_t
length
),
PNG_EMPTY
);
png_bytep
data
,
size_t
length
),
PNG_EMPTY
);
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
PNGCBAPI
,
png_push_fill_buffer
,(
png_structp
png_ptr
,
png_bytep
buffer
,
png_
size_t
length
),
PNG_EMPTY
);
png_bytep
buffer
,
size_t
length
),
PNG_EMPTY
);
#endif
PNG_INTERNAL_FUNCTION
(
void
PNGCBAPI
,
png_default_write_data
,(
png_structp
png_ptr
,
png_bytep
data
,
png_
size_t
length
),
PNG_EMPTY
);
png_bytep
data
,
size_t
length
),
PNG_EMPTY
);
#ifdef PNG_WRITE_FLUSH_SUPPORTED
# ifdef PNG_STDIO_SUPPORTED
...
...
@@ -1068,7 +1074,7 @@ PNG_INTERNAL_FUNCTION(void,png_reset_crc,(png_structrp png_ptr),PNG_EMPTY);
/* Write the "data" buffer to whatever output you are using */
PNG_INTERNAL_FUNCTION
(
void
,
png_write_data
,(
png_structrp
png_ptr
,
png_const_bytep
data
,
png_
size_t
length
),
PNG_EMPTY
);
png_const_bytep
data
,
size_t
length
),
PNG_EMPTY
);
/* Read and check the PNG file signature */
PNG_INTERNAL_FUNCTION
(
void
,
png_read_sig
,(
png_structrp
png_ptr
,
...
...
@@ -1080,7 +1086,7 @@ PNG_INTERNAL_FUNCTION(png_uint_32,png_read_chunk_header,(png_structrp png_ptr),
/* Read data from whatever input you are using into the "data" buffer */
PNG_INTERNAL_FUNCTION
(
void
,
png_read_data
,(
png_structrp
png_ptr
,
png_bytep
data
,
png_
size_t
length
),
PNG_EMPTY
);
size_t
length
),
PNG_EMPTY
);
/* Read bytes into buf, and update png_ptr->crc */
PNG_INTERNAL_FUNCTION
(
void
,
png_crc_read
,(
png_structrp
png_ptr
,
png_bytep
buf
,
...
...
@@ -1098,7 +1104,7 @@ PNG_INTERNAL_FUNCTION(int,png_crc_error,(png_structrp png_ptr),PNG_EMPTY);
* since this is the maximum buffer size we can specify.
*/
PNG_INTERNAL_FUNCTION
(
void
,
png_calculate_crc
,(
png_structrp
png_ptr
,
png_const_bytep
ptr
,
png_
size_t
length
),
PNG_EMPTY
);
png_const_bytep
ptr
,
size_t
length
),
PNG_EMPTY
);
#ifdef PNG_WRITE_FLUSH_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_flush
,(
png_structrp
png_ptr
),
PNG_EMPTY
);
...
...
@@ -1181,7 +1187,7 @@ PNG_INTERNAL_FUNCTION(void,png_write_hIST,(png_structrp png_ptr,
/* Chunks that have keywords */
#ifdef PNG_WRITE_tEXt_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_write_tEXt
,(
png_structrp
png_ptr
,
png_const_charp
key
,
png_const_charp
text
,
png_
size_t
text_len
),
PNG_EMPTY
);
png_const_charp
key
,
png_const_charp
text
,
size_t
text_len
),
PNG_EMPTY
);
#endif
#ifdef PNG_WRITE_zTXt_SUPPORTED
...
...
@@ -1574,10 +1580,10 @@ PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
PNG_INTERNAL_FUNCTION
(
void
,
png_push_save_buffer
,(
png_structrp
png_ptr
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_push_restore_buffer
,(
png_structrp
png_ptr
,
png_bytep
buffer
,
png_
size_t
buffer_length
),
PNG_EMPTY
);
png_bytep
buffer
,
size_t
buffer_length
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_push_read_IDAT
,(
png_structrp
png_ptr
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_process_IDAT_data
,(
png_structrp
png_ptr
,
png_bytep
buffer
,
png_
size_t
buffer_length
),
PNG_EMPTY
);
png_bytep
buffer
,
size_t
buffer_length
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_push_process_row
,(
png_structrp
png_ptr
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_push_handle_unknown
,(
png_structrp
png_ptr
,
...
...
@@ -1847,13 +1853,13 @@ PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_ascii_from_fp
,(
png_const_structrp
png_ptr
,
png_charp
ascii
,
png_
size_t
size
,
double
fp
,
unsigned
int
precision
),
png_charp
ascii
,
size_t
size
,
double
fp
,
unsigned
int
precision
),
PNG_EMPTY
);
#endif
/* FLOATING_POINT */
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_ascii_from_fixed
,(
png_const_structrp
png_ptr
,
png_charp
ascii
,
png_
size_t
size
,
png_fixed_point
fp
),
PNG_EMPTY
);
png_charp
ascii
,
size_t
size
,
png_fixed_point
fp
),
PNG_EMPTY
);
#endif
/* FIXED_POINT */
#endif
/* sCAL */
...
...
@@ -1946,7 +1952,7 @@ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
* the problem character.) This has not been tested within libpng.
*/
PNG_INTERNAL_FUNCTION
(
int
,
png_check_fp_number
,(
png_const_charp
string
,
png_
size_t
size
,
int
*
statep
,
png_size_tp
whereami
),
PNG_EMPTY
);
size_t
size
,
int
*
statep
,
png_size_tp
whereami
),
PNG_EMPTY
);
/* This is the same but it checks a complete string and returns true
* only if it just contains a floating point number. As of 1.5.4 this
...
...
@@ -1955,7 +1961,7 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
* for negative or zero values using the sticky flag.
*/
PNG_INTERNAL_FUNCTION
(
int
,
png_check_fp_string
,(
png_const_charp
string
,
png_
size_t
size
),
PNG_EMPTY
);
size_t
size
),
PNG_EMPTY
);
#endif
/* pCAL || sCAL */
#if defined(PNG_GAMMA_SUPPORTED) ||\
...
...
@@ -2030,7 +2036,7 @@ typedef struct png_control
png_voidp
error_buf
;
/* Always a jmp_buf at present. */
png_const_bytep
memory
;
/* Memory buffer. */
png_size_t
size
;
/* Size of the memory buffer. */
size_t
size
;
/* Size of the memory buffer. */
unsigned
int
for_write
:
1
;
/* Otherwise it is a read structure */
unsigned
int
owned_file
:
1
;
/* We own the file in io_ptr */
...
...
thirdparty/libpng/pngread.c
View file @
f4e682d7
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.6.3
3 [September 28, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.3
5 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -1532,7 +1532,7 @@ png_image_begin_read_from_file(png_imagep image, const char *file_name)
#endif
/* STDIO */
static
void
PNGCBAPI
png_image_memory_read
(
png_structp
png_ptr
,
png_bytep
out
,
png_
size_t
need
)
png_image_memory_read
(
png_structp
png_ptr
,
png_bytep
out
,
size_t
need
)
{
if
(
png_ptr
!=
NULL
)
{
...
...
@@ -1543,7 +1543,7 @@ png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
if
(
cp
!=
NULL
)
{
png_const_bytep
memory
=
cp
->
memory
;
png_
size_t
size
=
cp
->
size
;
size_t
size
=
cp
->
size
;
if
(
memory
!=
NULL
&&
size
>=
need
)
{
...
...
@@ -1562,7 +1562,7 @@ png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
}
int
PNGAPI
png_image_begin_read_from_memory
(
png_imagep
image
,
png_const_voidp
memory
,
png_
size_t
size
)
png_const_voidp
memory
,
size_t
size
)
{
if
(
image
!=
NULL
&&
image
->
version
==
PNG_IMAGE_VERSION
)
{
...
...
@@ -4150,7 +4150,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
*
* NOTE: this will be changed in 1.7 because PNG_IMAGE_BUFFER_SIZE
* will be changed to use png_alloc_size_t; bigger images can be
* accomodated on 64-bit systems.
* accom
m
odated on 64-bit systems.
*/
if
(
image
->
height
<=
0xffffffffU
/
PNG_IMAGE_PIXEL_COMPONENT_SIZE
(
image
->
format
)
/
check
)
...
...
thirdparty/libpng/pngrio.c
View file @
f4e682d7
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.6.
24 [August 4, 2016
]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-2016
,2018
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -29,7 +29,7 @@
* to read more than 64K on a 16-bit machine.
*/
void
/* PRIVATE */
png_read_data
(
png_structrp
png_ptr
,
png_bytep
data
,
png_
size_t
length
)
png_read_data
(
png_structrp
png_ptr
,
png_bytep
data
,
size_t
length
)
{
png_debug1
(
4
,
"reading %d bytes"
,
(
int
)
length
);
...
...
@@ -47,14 +47,14 @@ png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
* than changing the library.
*/
void
PNGCBAPI
png_default_read_data
(
png_structp
png_ptr
,
png_bytep
data
,
png_
size_t
length
)
png_default_read_data
(
png_structp
png_ptr
,
png_bytep
data
,
size_t
length
)
{
png_
size_t
check
;
size_t
check
;
if
(
png_ptr
==
NULL
)
return
;
/* fread() returns 0 on error, so it is OK to store this in a
png_
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.
*/
check
=
fread
(
data
,
1
,
length
,
png_voidcast
(
png_FILE_p
,
png_ptr
->
io_ptr
));
...
...
thirdparty/libpng/pngrtran.c
View file @
f4e682d7
This diff is collapsed.
Click to expand it.
thirdparty/libpng/pngrutil.c
View file @
f4e682d7
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.6.3
3 [September 28, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.3
5 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -102,7 +102,7 @@ png_get_int_32)(png_const_bytep buf)
png_uint_16
(
PNGAPI
png_get_uint_16
)(
png_const_bytep
buf
)
{
/* ANSI-C requires an int value to accomodate at least 16 bits so this
/* ANSI-C requires an int value to accom
m
odate at least 16 bits so this
* works and allows the compiler not to worry about possible narrowing
* on 32-bit systems. (Pre-ANSI systems did not make integers smaller
* than 16 bits either.)
...
...
@@ -120,7 +120,7 @@ png_get_uint_16)(png_const_bytep buf)
void
/* PRIVATE */
png_read_sig
(
png_structrp
png_ptr
,
png_inforp
info_ptr
)
{
png_
size_t
num_checked
,
num_to_check
;
size_t
num_checked
,
num_to_check
;
/* Exit if the user application does not expect a signature. */
if
(
png_ptr
->
sig_bytes
>=
8
)
...
...
@@ -1648,7 +1648,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
int
entry_size
,
i
;
png_uint_32
skip
=
0
;
png_uint_32
dl
;
png_
size_t
max_dl
;
size_t
max_dl
;
png_debug
(
1
,
"in png_handle_sPLT"
);
...
...
@@ -1997,6 +1997,15 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
else
if
((
png_ptr
->
color_type
&
PNG_COLOR_MASK_COLOR
)
==
0
)
/* GRAY */
{
if
(
png_ptr
->
bit_depth
<=
8
)
{
if
(
buf
[
0
]
!=
0
||
buf
[
1
]
>=
(
unsigned
int
)(
1
<<
png_ptr
->
bit_depth
))
{
png_chunk_benign_error
(
png_ptr
,
"invalid gray level"
);
return
;
}
}
background
.
index
=
0
;
background
.
red
=
background
.
green
=
...
...
@@ -2006,6 +2015,15 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
else
{
if
(
png_ptr
->
bit_depth
<=
8
)
{
if
(
buf
[
0
]
!=
0
||
buf
[
2
]
!=
0
||
buf
[
4
]
!=
0
)
{
png_chunk_benign_error
(
png_ptr
,
"invalid color"
);
return
;
}
}
background
.
index
=
0
;
background
.
red
=
png_get_uint_16
(
buf
);
background
.
green
=
png_get_uint_16
(
buf
+
2
);
...
...
@@ -2359,7 +2377,7 @@ void /* PRIVATE */
png_handle_sCAL
(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
png_uint_32
length
)
{
png_bytep
buffer
;
png_
size_t
i
;
size_t
i
;
int
state
;
png_debug
(
1
,
"in png_handle_sCAL"
);
...
...
@@ -2429,7 +2447,7 @@ png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
else
{
png_
size_t
heighti
=
i
;
size_t
heighti
=
i
;
state
=
0
;
if
(
png_check_fp_number
((
png_const_charp
)
buffer
,
length
,
...
...
@@ -2867,7 +2885,7 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
{
PNG_CSTRING_FROM_CHUNK
(
png_ptr
->
unknown_chunk
.
name
,
png_ptr
->
chunk_name
);
/* The following is safe because of the PNG_SIZE_MAX init above */
png_ptr
->
unknown_chunk
.
size
=
(
png_
size_t
)
length
/*SAFE*/
;
png_ptr
->
unknown_chunk
.
size
=
(
size_t
)
length
/*SAFE*/
;
/* 'mode' is a flag array, only the bottom four bits matter here */
png_ptr
->
unknown_chunk
.
location
=
(
png_byte
)
png_ptr
->
mode
/*SAFE*/
;
...
...
@@ -3149,10 +3167,13 @@ png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
{
png_alloc_size_t
idat_limit
=
PNG_UINT_31_MAX
;
size_t
row_factor
=
(
png_ptr
->
width
*
png_ptr
->
channels
*
(
png_ptr
->
bit_depth
>
8
?
2
:
1
)
+
1
+
(
png_ptr
->
interlaced
?
6
:
0
));
(
size_t
)
png_ptr
->
width
*
(
size_t
)
png_ptr
->
channels
*
(
png_ptr
->
bit_depth
>
8
?
2
:
1
)
+
1
+
(
png_ptr
->
interlaced
?
6
:
0
);
if
(
png_ptr
->
height
>
PNG_UINT_32_MAX
/
row_factor
)
idat_limit
=
PNG_UINT_31_MAX
;
idat_limit
=
PNG_UINT_31_MAX
;
else
idat_limit
=
png_ptr
->
height
*
row_factor
;
row_factor
=
row_factor
>
32566
?
32566
:
row_factor
;
...
...
@@ -3679,8 +3700,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
{
case
1
:
{
png_bytep
sp
=
row
+
(
png_
size_t
)((
row_info
->
width
-
1
)
>>
3
);
png_bytep
dp
=
row
+
(
png_
size_t
)((
final_width
-
1
)
>>
3
);
png_bytep
sp
=
row
+
(
size_t
)((
row_info
->
width
-
1
)
>>
3
);
png_bytep
dp
=
row
+
(
size_t
)((
final_width
-
1
)
>>
3
);
unsigned
int
sshift
,
dshift
;
unsigned
int
s_start
,
s_end
;
int
s_inc
;
...
...
@@ -3806,8 +3827,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
case
4
:
{
png_bytep
sp
=
row
+
(
png_
size_t
)((
row_info
->
width
-
1
)
>>
1
);
png_bytep
dp
=
row
+
(
png_
size_t
)((
final_width
-
1
)
>>
1
);
png_bytep
sp
=
row
+
(
size_t
)((
row_info
->
width
-
1
)
>>
1
);
png_bytep
dp
=
row
+
(
size_t
)((
final_width
-
1
)
>>
1
);
unsigned
int
sshift
,
dshift
;
unsigned
int
s_start
,
s_end
;
int
s_inc
;
...
...
@@ -3869,12 +3890,12 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
default
:
{
png_
size_t
pixel_bytes
=
(
row_info
->
pixel_depth
>>
3
);
size_t
pixel_bytes
=
(
row_info
->
pixel_depth
>>
3
);
png_bytep
sp
=
row
+
(
png_
size_t
)(
row_info
->
width
-
1
)
png_bytep
sp
=
row
+
(
size_t
)(
row_info
->
width
-
1
)
*
pixel_bytes
;
png_bytep
dp
=
row
+
(
png_
size_t
)(
final_width
-
1
)
*
pixel_bytes
;
png_bytep
dp
=
row
+
(
size_t
)(
final_width
-
1
)
*
pixel_bytes
;
int
jstop
=
(
int
)
png_pass_inc
[
pass
];
png_uint_32
i
;
...
...
@@ -3911,8 +3932,8 @@ static void
png_read_filter_row_sub
(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
)
{
png_
size_t
i
;
png_
size_t
istop
=
row_info
->
rowbytes
;
size_t
i
;
size_t
istop
=
row_info
->
rowbytes
;
unsigned
int
bpp
=
(
row_info
->
pixel_depth
+
7
)
>>
3
;
png_bytep
rp
=
row
+
bpp
;
...
...
@@ -3929,8 +3950,8 @@ static void
png_read_filter_row_up
(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
)
{
png_
size_t
i
;
png_
size_t
istop
=
row_info
->
rowbytes
;
size_t
i
;
size_t
istop
=
row_info
->
rowbytes
;
png_bytep
rp
=
row
;
png_const_bytep
pp
=
prev_row
;
...
...
@@ -3945,11 +3966,11 @@ static void
png_read_filter_row_avg
(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
)
{
png_
size_t
i
;
size_t
i
;
png_bytep
rp
=
row
;
png_const_bytep
pp
=
prev_row
;
unsigned
int
bpp
=
(
row_info
->
pixel_depth
+
7
)
>>
3
;
png_
size_t
istop
=
row_info
->
rowbytes
-
bpp
;
size_t
istop
=
row_info
->
rowbytes
-
bpp
;
for
(
i
=
0
;
i
<
bpp
;
i
++
)
{
...
...
@@ -4385,7 +4406,7 @@ png_read_start_row(png_structrp png_ptr)
static
PNG_CONST
png_byte
png_pass_yinc
[
7
]
=
{
8
,
8
,
8
,
4
,
4
,
2
,
2
};
unsigned
int
max_pixel_depth
;
png_
size_t
row_bytes
;
size_t
row_bytes
;
png_debug
(
1
,
"in png_read_start_row"
);
...
...
thirdparty/libpng/pngset.c
View file @
f4e682d7
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.6.3
2 [August 24, 2017
]
* Copyright (c) 1998-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.3
5 [July 15, 2018
]
* Copyright (c) 1998-201
8
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -313,7 +313,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
png_const_charp
purpose
,
png_int_32
X0
,
png_int_32
X1
,
int
type
,
int
nparams
,
png_const_charp
units
,
png_charpp
params
)
{
png_
size_t
length
;
size_t
length
;
int
i
;
png_debug1
(
1
,
"in %s storage function"
,
"pCAL"
);
...
...
@@ -390,7 +390,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
memcpy
(
info_ptr
->
pcal_units
,
units
,
length
);
info_ptr
->
pcal_params
=
png_voidcast
(
png_charpp
,
png_malloc_warn
(
png_ptr
,
(
png_
size_t
)(((
unsigned
int
)
nparams
+
1
)
*
(
sizeof
(
png_charp
)))));
(
size_t
)(((
unsigned
int
)
nparams
+
1
)
*
(
sizeof
(
png_charp
)))));
if
(
info_ptr
->
pcal_params
==
NULL
)
{
...
...
@@ -430,7 +430,7 @@ void PNGAPI
png_set_sCAL_s
(
png_const_structrp
png_ptr
,
png_inforp
info_ptr
,
int
unit
,
png_const_charp
swidth
,
png_const_charp
sheight
)
{
png_
size_t
lengthw
=
0
,
lengthh
=
0
;
size_t
lengthw
=
0
,
lengthh
=
0
;
png_debug1
(
1
,
"in %s storage function"
,
"sCAL"
);
...
...
@@ -691,7 +691,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
{
png_charp
new_iccp_name
;
png_bytep
new_iccp_profile
;
png_
size_t
length
;
size_t
length
;
png_debug1
(
1
,
"in %s storage function"
,
"iCCP"
);
...
...
@@ -1018,7 +1018,7 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
info_ptr
->
trans_alpha
=
png_voidcast
(
png_bytep
,
png_malloc
(
png_ptr
,
PNG_MAX_PALETTE_LENGTH
));
memcpy
(
info_ptr
->
trans_alpha
,
trans_alpha
,
(
png_
size_t
)
num_trans
);
memcpy
(
info_ptr
->
trans_alpha
,
trans_alpha
,
(
size_t
)
num_trans
);
}
png_ptr
->
trans_alpha
=
info_ptr
->
trans_alpha
;
}
...
...
@@ -1098,7 +1098,7 @@ png_set_sPLT(png_const_structrp png_ptr,
do
{
png_
size_t
length
;
size_t
length
;
/* Skip invalid input entries */
if
(
entries
->
name
==
NULL
||
entries
->
entries
==
NULL
)
...
...
@@ -1563,7 +1563,7 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
#endif
void
PNGAPI
png_set_compression_buffer_size
(
png_structrp
png_ptr
,
png_
size_t
size
)
png_set_compression_buffer_size
(
png_structrp
png_ptr
,
size_t
size
)
{
if
(
png_ptr
==
NULL
)
return
;
...
...
thirdparty/libpng/pngstruct.h
View file @
f4e682d7
/* pngstruct.h - header file for PNG reference library
*
* Last changed in libpng 1.6.3
2 [August 24, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.3
5 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -47,7 +47,7 @@
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
* can handle at once. This type need be no larger than 16 bits (so maximum of
* 65535), this define allows us to discover how big it is, but limited by the
* maximu
um for png_size_t. The value can be overri
den in a library build
* maximu
m for size_t. The value can be overrid
den in a library build
* (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
* lower value (e.g. 255 works). A lower value may help memory usage (slightly)
* and may even improve performance on some systems (and degrade it on others.)
...
...
@@ -214,7 +214,7 @@ struct png_struct_def
png_uint_32
height
;
/* height of image in pixels */
png_uint_32
num_rows
;
/* number of rows in current pass */
png_uint_32
usr_width
;
/* width of row at start of write */
png_size_t
rowbytes
;
/* size of row in bytes */
size_t
rowbytes
;
/* size of row in bytes */
png_uint_32
iwidth
;
/* width of current interlaced row in pixels */
png_uint_32
row_number
;
/* current row in interlace pass */
png_uint_32
chunk_name
;
/* PNG_CHUNK() id of current chunk */
...
...
@@ -232,7 +232,7 @@ struct png_struct_def
png_bytep
try_row
;
/* buffer to save trial row when filtering */
png_bytep
tst_row
;
/* buffer to save best trial row when filtering */
#endif
png_size_t
info_rowbytes
;
/* Added in 1.5.4: cache of updated row bytes */
size_t
info_rowbytes
;
/* Added in 1.5.4: cache of updated row bytes */
png_uint_32
idat_size
;
/* current IDAT size for read */
png_uint_32
crc
;
/* current chunk CRC value */
...
...
@@ -307,7 +307,7 @@ struct png_struct_def
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
png_color_8
shift
;
/* shift for significant bit tranformation */
png_color_8
shift
;
/* shift for significant bit tran
s
formation */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
...
...
@@ -328,10 +328,10 @@ struct png_struct_def
png_bytep
current_buffer
;
/* buffer for recently used data */
png_uint_32
push_length
;
/* size of current input chunk */
png_uint_32
skip_length
;
/* bytes to skip in input data */
png_size_t
save_buffer_size
;
/* amount of data now in save_buffer */
png_size_t
save_buffer_max
;
/* total size of save_buffer */
png_size_t
buffer_size
;
/* total amount of available input data */
png_size_t
current_buffer_size
;
/* amount of data now in current_buffer */
size_t
save_buffer_size
;
/* amount of data now in save_buffer */
size_t
save_buffer_max
;
/* total size of save_buffer */
size_t
buffer_size
;
/* total amount of available input data */
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 */
...
...
@@ -451,7 +451,7 @@ struct png_struct_def
#endif
/* New member added in libpng-1.2.26 */
png_
size_t
old_big_row_buf_size
;
size_t
old_big_row_buf_size
;
#ifdef PNG_READ_SUPPORTED
/* New member added in libpng-1.2.30 */
...
...
thirdparty/libpng/pngtrans.c
View file @
f4e682d7
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Last changed in libpng 1.6.3
3 [September 28, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.3
5 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -269,8 +269,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
if
(
row_info
->
color_type
==
PNG_COLOR_TYPE_GRAY
)
{
png_bytep
rp
=
row
;
png_
size_t
i
;
png_
size_t
istop
=
row_info
->
rowbytes
;
size_t
i
;
size_t
istop
=
row_info
->
rowbytes
;
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
...
...
@@ -283,8 +283,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
row_info
->
bit_depth
==
8
)
{
png_bytep
rp
=
row
;
png_
size_t
i
;
png_
size_t
istop
=
row_info
->
rowbytes
;
size_t
i
;
size_t
istop
=
row_info
->
rowbytes
;
for
(
i
=
0
;
i
<
istop
;
i
+=
2
)
{
...
...
@@ -298,8 +298,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
row_info
->
bit_depth
==
16
)
{
png_bytep
rp
=
row
;
png_
size_t
i
;
png_
size_t
istop
=
row_info
->
rowbytes
;
size_t
i
;
size_t
istop
=
row_info
->
rowbytes
;
for
(
i
=
0
;
i
<
istop
;
i
+=
4
)
{
...
...
@@ -609,7 +609,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
return
;
/* The filler channel has gone already */
/* Fix the rowbytes value. */
row_info
->
rowbytes
=
(
png_
size_t
)(
dp
-
row
);
row_info
->
rowbytes
=
(
size_t
)(
dp
-
row
);
}
#endif
...
...
thirdparty/libpng/pngwio.c
View file @
f4e682d7
/* pngwio.c - functions for data output
*
* Last changed in libpng 1.6.
24 [August 4, 2016
]
* Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-2014,2016
,2018
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -30,7 +30,7 @@
*/
void
/* PRIVATE */
png_write_data
(
png_structrp
png_ptr
,
png_const_bytep
data
,
png_
size_t
length
)
png_write_data
(
png_structrp
png_ptr
,
png_const_bytep
data
,
size_t
length
)
{
/* NOTE: write_data_fn must not change the buffer! */
if
(
png_ptr
->
write_data_fn
!=
NULL
)
...
...
@@ -48,9 +48,9 @@ png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length)
* than changing the library.
*/
void
PNGCBAPI
png_default_write_data
(
png_structp
png_ptr
,
png_bytep
data
,
png_
size_t
length
)
png_default_write_data
(
png_structp
png_ptr
,
png_bytep
data
,
size_t
length
)
{
png_
size_t
check
;
size_t
check
;
if
(
png_ptr
==
NULL
)
return
;
...
...
thirdparty/libpng/pngwrite.c
View file @
f4e682d7
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.6.3
2 [August 24, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.3
5 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -1636,7 +1636,7 @@ png_write_image_16bit(png_voidp argument)
* calculation can be done to 15 bits of accuracy; however, the output needs to
* be scaled in the range 0..255*65535, so include that scaling here.
*/
# define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+(
alpha>>1))/alpha
)
# define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+(
(alpha)>>1))/(alpha)
)
static
png_byte
png_unpremultiply
(
png_uint_32
component
,
png_uint_32
alpha
,
...
...
@@ -2162,8 +2162,7 @@ png_image_write_main(png_voidp argument)
static
void
(
PNGCBAPI
image_memory_write
)(
png_structp
png_ptr
,
png_bytep
/*const*/
data
,
png_size_t
size
)
image_memory_write
)(
png_structp
png_ptr
,
png_bytep
/*const*/
data
,
size_t
size
)
{
png_image_write_control
*
display
=
png_voidcast
(
png_image_write_control
*
,
png_ptr
->
io_ptr
/*backdoor: png_get_io_ptr(png_ptr)*/
);
...
...
thirdparty/libpng/pngwtran.c
View file @
f4e682d7
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.6.
26 [October 20, 2016
]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-2016
,2018
Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
...
...
@@ -212,9 +212,9 @@ png_do_shift(png_row_infop row_info, png_bytep row,
if
(
row_info
->
bit_depth
<
8
)
{
png_bytep
bp
=
row
;
png_
size_t
i
;
size_t
i
;
unsigned
int
mask
;
png_
size_t
row_bytes
=
row_info
->
rowbytes
;
size_t
row_bytes
=
row_info
->
rowbytes
;
if
(
bit_depth
->
gray
==
1
&&
row_info
->
bit_depth
==
2
)
mask
=
0x55
;
...
...
@@ -514,7 +514,7 @@ png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
(
png_ptr
,
/* png_ptr */
row_info
,
/* row_info: */
/* png_uint_32 width; width of row */
/*
png_size_t rowbytes;
number of bytes in row */
/*
size_t rowbytes;
number of bytes in row */
/* png_byte color_type; color type of pixels */
/* png_byte bit_depth; bit depth of samples */
/* png_byte channels; number of channels (1-4) */
...
...
thirdparty/libpng/pngwutil.c
View file @
f4e682d7
This diff is collapsed.
Click to expand it.
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