mirror of https://github.com/fltk/fltk
Update bundled libpng to version 1.6.42
This commit is contained in:
parent
b90437119d
commit
bf938da079
|
@ -28,7 +28,7 @@ Current versions of bundled libraries (as of December 5, 2023):
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
jpeg jpeg-9e 2022-01-16 1.4.0
|
jpeg jpeg-9e 2022-01-16 1.4.0
|
||||||
nanosvg 7aeda550a8 [1] 2023-12-02 1.4.0
|
nanosvg 7aeda550a8 [1] 2023-12-02 1.4.0
|
||||||
png libpng-1.6.40 2023-06-21 1.4.0
|
png libpng-1.6.42 2024-01-29 1.4.0
|
||||||
zlib zlib-1.3.1 2024-01-22 1.4.0
|
zlib zlib-1.3.1 2024-01-22 1.4.0
|
||||||
libdecor 060fe761 [2] 2023-12-01 1.4.0
|
libdecor 060fe761 [2] 2023-12-01 1.4.0
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
|
@ -200,7 +200,6 @@ Run `make depend' in the zlib folder on a Linux system after
|
||||||
- pngprefix.h: Generate on a Linux system and merge (see above).
|
- pngprefix.h: Generate on a Linux system and merge (see above).
|
||||||
- makedepend: Keep this file.
|
- makedepend: Keep this file.
|
||||||
- png.c: Keep a change labelled with "FLTK"
|
- png.c: Keep a change labelled with "FLTK"
|
||||||
- pngerror.c: Keep two changes labelled with "FLTK"
|
|
||||||
|
|
||||||
Run `make depend' in the png folder on a Linux system after
|
Run `make depend' in the png folder on a Linux system after
|
||||||
the upgrade to update this file.
|
the upgrade to update this file.
|
||||||
|
|
37
png/CHANGES
37
png/CHANGES
|
@ -6129,6 +6129,43 @@ Version 1.6.40 [June 21, 2023]
|
||||||
Updated the configurations and the scripts for continuous integration.
|
Updated the configurations and the scripts for continuous integration.
|
||||||
Cleaned up the code, the build scripts, and the documentation.
|
Cleaned up the code, the build scripts, and the documentation.
|
||||||
|
|
||||||
|
Version 1.6.41 [January 24, 2024]
|
||||||
|
Added SIMD-optimized code for the Loongarch LSX hardware.
|
||||||
|
(Contributed by GuXiWei, JinBo and ZhangLixia)
|
||||||
|
Fixed the run-time discovery of MIPS MSA hardware.
|
||||||
|
(Contributed by Sui Jingfeng)
|
||||||
|
Fixed an off-by-one error in the function png_do_check_palette_indexes(),
|
||||||
|
which failed to recognize errors that might have existed in the first
|
||||||
|
column of a broken palette-encoded image. This was a benign regression
|
||||||
|
accidentally introduced in libpng-1.6.33. No pixel was harmed.
|
||||||
|
(Contributed by Adam Richter; reviewed by John Bowler)
|
||||||
|
Fixed, improved and modernized the contrib/pngminus programs, i.e.,
|
||||||
|
png2pnm.c and pnm2png.c
|
||||||
|
Removed old and peculiar portability hacks that were meant to silence
|
||||||
|
warnings issued by gcc version 7.1 alone.
|
||||||
|
(Contributed by John Bowler)
|
||||||
|
Fixed and modernized the CMake file, and raised the minimum required
|
||||||
|
CMake version from 3.1 to 3.6.
|
||||||
|
(Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.)
|
||||||
|
Allowed the configure script to disable the building of auxiliary tools
|
||||||
|
and tests, thus catching up with the CMake file.
|
||||||
|
(Contributed by Carlo Bramini)
|
||||||
|
Fixed a build issue on Mac.
|
||||||
|
(Contributed by Zixu Wang)
|
||||||
|
Moved the Autoconf macro files to scripts/autoconf.
|
||||||
|
Moved the CMake files (except for the main CMakeLists.txt) to
|
||||||
|
scripts/cmake and moved the list of their contributing authors to
|
||||||
|
scripts/cmake/AUTHORS.md
|
||||||
|
Updated the CI configurations and scripts.
|
||||||
|
Relicensed the CI scripts to the MIT License.
|
||||||
|
Improved the test coverage.
|
||||||
|
(Contributed by John Bowler)
|
||||||
|
|
||||||
|
Version 1.6.42 [January 29, 2024]
|
||||||
|
Fixed the implementation of the macro function png_check_sig().
|
||||||
|
This was an API regression, introduced in libpng-1.6.41.
|
||||||
|
(Reported by Matthieu Darbois)
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
||||||
Subscription is required; visit
|
Subscription is required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
|
|
|
@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
||||||
PNG Reference Library License version 2
|
PNG Reference Library License version 2
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
* Copyright (c) 1995-2023 The PNG Reference Library Authors.
|
* Copyright (c) 1995-2024 The PNG Reference Library Authors.
|
||||||
* Copyright (c) 2018-2023 Cosmin Truta.
|
* Copyright (c) 2018-2024 Cosmin Truta.
|
||||||
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger.
|
* Copyright (c) 1996-1997 Andreas Dilger.
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
README for libpng version 1.6.40
|
README for libpng version 1.6.42
|
||||||
================================
|
================================
|
||||||
|
|
||||||
See the note about version numbers near the top of `png.h`.
|
See the note about version numbers near the top of `png.h`.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
libpng-manual.txt - A description on how to use and modify libpng
|
libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
Copyright (c) 2018-2023 Cosmin Truta
|
Copyright (c) 2018-2024 Cosmin Truta
|
||||||
Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
||||||
|
|
||||||
This document is released under the libpng license.
|
This document is released under the libpng license.
|
||||||
|
@ -9,9 +9,9 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng version 1.6.36, December 2018, through 1.6.40 - June 2023
|
libpng version 1.6.36, December 2018, through 1.6.42 - January 2024
|
||||||
Updated and distributed by Cosmin Truta
|
Updated and distributed by Cosmin Truta
|
||||||
Copyright (c) 2018-2023 Cosmin Truta
|
Copyright (c) 2018-2024 Cosmin Truta
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.6.35 - July 2018
|
libpng versions 0.97, January 1998, through 1.6.35 - July 2018
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
|
@ -357,7 +357,7 @@ Customizing libpng.
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_png = !png_sig_cmp(header, 0, number);
|
is_png = (png_sig_cmp(header, 0, number) == 0);
|
||||||
if (!is_png)
|
if (!is_png)
|
||||||
{
|
{
|
||||||
return NOT_PNG;
|
return NOT_PNG;
|
||||||
|
@ -385,8 +385,7 @@ create the structure, so your application should check for that.
|
||||||
|
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr,
|
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||||
(png_infopp)NULL, (png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,14 +418,13 @@ free any memory.
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
|
||||||
&end_info);
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass (png_infopp)NULL instead of &end_info if you didn't create
|
Pass NULL instead of &end_info if you didn't create an end_info
|
||||||
an end_info structure.
|
structure.
|
||||||
|
|
||||||
If you would rather avoid the complexity of setjmp/longjmp issues,
|
If you would rather avoid the complexity of setjmp/longjmp issues,
|
||||||
you can compile libpng with PNG_NO_SETJMP, in which case
|
you can compile libpng with PNG_NO_SETJMP, in which case
|
||||||
|
@ -496,7 +494,7 @@ You can set up a callback function to handle any unknown chunks in the
|
||||||
input stream. You must supply the function
|
input stream. You must supply the function
|
||||||
|
|
||||||
read_chunk_callback(png_structp png_ptr,
|
read_chunk_callback(png_structp png_ptr,
|
||||||
png_unknown_chunkp chunk);
|
png_unknown_chunkp chunk)
|
||||||
{
|
{
|
||||||
/* The unknown chunk structure contains your
|
/* The unknown chunk structure contains your
|
||||||
chunk data, along with similar data for any other
|
chunk data, along with similar data for any other
|
||||||
|
@ -547,9 +545,9 @@ a progress meter or the like. It's demonstrated in pngtest.c.
|
||||||
You must supply a function
|
You must supply a function
|
||||||
|
|
||||||
void read_row_callback(png_structp png_ptr,
|
void read_row_callback(png_structp png_ptr,
|
||||||
png_uint_32 row, int pass);
|
png_uint_32 row, int pass)
|
||||||
{
|
{
|
||||||
/* put your code here */
|
/* put your code here */
|
||||||
}
|
}
|
||||||
|
|
||||||
(You can give it another name that you like instead of "read_row_callback")
|
(You can give it another name that you like instead of "read_row_callback")
|
||||||
|
@ -1181,21 +1179,21 @@ If you know your image size and pixel size ahead of time, you can allocate
|
||||||
row_pointers prior to calling png_read_png() with
|
row_pointers prior to calling png_read_png() with
|
||||||
|
|
||||||
if (height > PNG_UINT_32_MAX/(sizeof (png_byte)))
|
if (height > PNG_UINT_32_MAX/(sizeof (png_byte)))
|
||||||
png_error (png_ptr,
|
png_error(png_ptr,
|
||||||
"Image is too tall to process in memory");
|
"Image is too tall to process in memory");
|
||||||
|
|
||||||
if (width > PNG_UINT_32_MAX/pixel_size)
|
if (width > PNG_UINT_32_MAX/pixel_size)
|
||||||
png_error (png_ptr,
|
png_error(png_ptr,
|
||||||
"Image is too wide to process in memory");
|
"Image is too wide to process in memory");
|
||||||
|
|
||||||
row_pointers = png_malloc(png_ptr,
|
row_pointers = png_malloc(png_ptr,
|
||||||
height*(sizeof (png_bytep)));
|
height*(sizeof (png_bytep)));
|
||||||
|
|
||||||
for (int i=0; i<height, i++)
|
for (int i = 0; i < height, i++)
|
||||||
row_pointers[i]=NULL; /* security precaution */
|
row_pointers[i] = NULL; /* security precaution */
|
||||||
|
|
||||||
for (int i=0; i<height, i++)
|
for (int i = 0; i < height, i++)
|
||||||
row_pointers[i]=png_malloc(png_ptr,
|
row_pointers[i] = png_malloc(png_ptr,
|
||||||
width*pixel_size);
|
width*pixel_size);
|
||||||
|
|
||||||
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
||||||
|
@ -1205,14 +1203,14 @@ row_pointers[i] to point into the proper places in your block, but first
|
||||||
be sure that your platform is able to allocate such a large buffer:
|
be sure that your platform is able to allocate such a large buffer:
|
||||||
|
|
||||||
/* Guard against integer overflow */
|
/* Guard against integer overflow */
|
||||||
if (height > PNG_SIZE_MAX/(width*pixel_size)) {
|
if (height > PNG_SIZE_MAX/(width*pixel_size))
|
||||||
png_error(png_ptr,"image_data buffer would be too large");
|
png_error(png_ptr, "image_data buffer would be too large");
|
||||||
}
|
|
||||||
|
|
||||||
png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size);
|
png_bytep buffer = png_malloc(png_ptr,
|
||||||
|
height*width*pixel_size);
|
||||||
|
|
||||||
for (int i=0; i<height, i++)
|
for (int i = 0; i < height, i++)
|
||||||
row_pointers[i]=buffer+i*width*pixel_size;
|
row_pointers[i] = buffer + i*width*pixel_size;
|
||||||
|
|
||||||
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
||||||
|
|
||||||
|
@ -1465,25 +1463,24 @@ png_set_rgb_to_gray()).
|
||||||
non-paletted images (PNG_INFO_tRNS)
|
non-paletted images (PNG_INFO_tRNS)
|
||||||
|
|
||||||
png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif);
|
png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif);
|
||||||
(PNG_INFO_eXIf)
|
|
||||||
|
|
||||||
exif - Exif profile (array of png_byte)
|
exif - Exif profile (array of png_byte)
|
||||||
|
(PNG_INFO_eXIf)
|
||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr, &hist);
|
png_get_hIST(png_ptr, info_ptr, &hist);
|
||||||
(PNG_INFO_hIST)
|
|
||||||
|
|
||||||
hist - histogram of palette (array of
|
hist - histogram of palette (array of
|
||||||
png_uint_16)
|
png_uint_16) (PNG_INFO_hIST)
|
||||||
|
|
||||||
png_get_tIME(png_ptr, info_ptr, &mod_time);
|
png_get_tIME(png_ptr, info_ptr, &mod_time);
|
||||||
|
|
||||||
mod_time - time image was last modified
|
mod_time - time image was last modified
|
||||||
(PNG_VALID_tIME)
|
(PNG_INFO_tIME)
|
||||||
|
|
||||||
png_get_bKGD(png_ptr, info_ptr, &background);
|
png_get_bKGD(png_ptr, info_ptr, &background);
|
||||||
|
|
||||||
background - background color (of type
|
background - background color (of type
|
||||||
png_color_16p) (PNG_VALID_bKGD)
|
png_color_16p) (PNG_INFO_bKGD)
|
||||||
valid 16-bit red, green and blue
|
valid 16-bit red, green and blue
|
||||||
values, regardless of color_type
|
values, regardless of color_type
|
||||||
|
|
||||||
|
@ -1743,13 +1740,13 @@ grayscale images with bit depths of 2 or 4 or if there is a multiple-image
|
||||||
viewing application that wishes to treat all images in the same way.
|
viewing application that wishes to treat all images in the same way.
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_set_palette_to_rgb(png_ptr);
|
png_set_palette_to_rgb(png_ptr);
|
||||||
|
|
||||||
if (png_get_valid(png_ptr, info_ptr,
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||||
PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
|
png_set_tRNS_to_alpha(png_ptr);
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY &&
|
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||||
bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
|
png_set_expand_gray_1_2_4_to_8(png_ptr);
|
||||||
|
|
||||||
The first two functions are actually aliases for png_set_expand(), added
|
The first two functions are actually aliases for png_set_expand(), added
|
||||||
in libpng version 1.0.4, with the function names expanded to improve code
|
in libpng version 1.0.4, with the function names expanded to improve code
|
||||||
|
@ -1764,18 +1761,20 @@ png_set_expand(); however, the resultant channels have 16 bits rather than 8.
|
||||||
Use this when the output color or gray channels are made linear to avoid fairly
|
Use this when the output color or gray channels are made linear to avoid fairly
|
||||||
severe accuracy loss.
|
severe accuracy loss.
|
||||||
|
|
||||||
if (bit_depth < 16)
|
if (bit_depth < 16)
|
||||||
png_set_expand_16(png_ptr);
|
png_set_expand_16(png_ptr);
|
||||||
|
|
||||||
PNG can have files with 16 bits per channel. If you only can handle
|
PNG can have files with 16 bits per channel. If you only can handle
|
||||||
8 bits per channel, this will strip the pixels down to 8-bit.
|
8 bits per channel, this will strip the pixels down to 8-bit.
|
||||||
|
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16)
|
||||||
|
{
|
||||||
#if PNG_LIBPNG_VER >= 10504
|
#if PNG_LIBPNG_VER >= 10504
|
||||||
png_set_scale_16(png_ptr);
|
png_set_scale_16(png_ptr);
|
||||||
#else
|
#else
|
||||||
png_set_strip_16(png_ptr);
|
png_set_strip_16(png_ptr);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
(The more accurate "png_set_scale_16()" API became available in libpng version
|
(The more accurate "png_set_scale_16()" API became available in libpng version
|
||||||
1.5.4).
|
1.5.4).
|
||||||
|
@ -1901,7 +1900,7 @@ Note that png_set_filler() does not change the color type. If you want
|
||||||
to do that, you can add a true alpha channel with
|
to do that, you can add a true alpha channel with
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_RGB ||
|
if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
color_type == PNG_COLOR_TYPE_GRAY)
|
color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER);
|
png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER);
|
||||||
|
|
||||||
where "filler" contains the alpha value to assign to each pixel.
|
where "filler" contains the alpha value to assign to each pixel.
|
||||||
|
@ -1926,7 +1925,7 @@ with alpha.
|
||||||
if (color_type == PNG_COLOR_TYPE_RGB ||
|
if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
png_set_rgb_to_gray(png_ptr, error_action,
|
png_set_rgb_to_gray(png_ptr, error_action,
|
||||||
double red_weight, double green_weight);
|
(double)red_weight, (double)green_weight);
|
||||||
|
|
||||||
error_action = 1: silently do the conversion
|
error_action = 1: silently do the conversion
|
||||||
|
|
||||||
|
@ -1949,8 +1948,8 @@ In the corresponding fixed point API the red_weight and green_weight values are
|
||||||
simply scaled by 100,000:
|
simply scaled by 100,000:
|
||||||
|
|
||||||
png_set_rgb_to_gray(png_ptr, error_action,
|
png_set_rgb_to_gray(png_ptr, error_action,
|
||||||
png_fixed_point red_weight,
|
(png_fixed_point)red_weight,
|
||||||
png_fixed_point green_weight);
|
(png_fixed_point)green_weight);
|
||||||
|
|
||||||
If you have set error_action = 1 or 2, you can
|
If you have set error_action = 1 or 2, you can
|
||||||
later check whether the image really was gray, after processing
|
later check whether the image really was gray, after processing
|
||||||
|
@ -2186,9 +2185,8 @@ do your own check for number_of_rows*width*pixel_size if you are using
|
||||||
a multiple-row buffer:
|
a multiple-row buffer:
|
||||||
|
|
||||||
/* Guard against integer overflow */
|
/* Guard against integer overflow */
|
||||||
if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size)) {
|
if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size))
|
||||||
png_error(png_ptr,"image_data buffer would be too large");
|
png_error(png_ptr, "image_data buffer would be too large");
|
||||||
}
|
|
||||||
|
|
||||||
Remember: Before you call png_read_update_info(), the png_get_*()
|
Remember: Before you call png_read_update_info(), the png_get_*()
|
||||||
functions return the values corresponding to the original PNG image.
|
functions return the values corresponding to the original PNG image.
|
||||||
|
@ -2408,12 +2406,11 @@ separate.
|
||||||
|
|
||||||
if (!end_info)
|
if (!end_info)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
(png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_read_end(png_ptr, end_info);
|
png_read_end(png_ptr, end_info);
|
||||||
|
|
||||||
If you are not interested, you should still call png_read_end()
|
If you are not interested, you should still call png_read_end()
|
||||||
but you can pass NULL, avoiding the need to create an end_info structure.
|
but you can pass NULL, avoiding the need to create an end_info structure.
|
||||||
|
@ -2421,7 +2418,7 @@ If you do this, libpng will not process any chunks after IDAT other than
|
||||||
skipping over them and perhaps (depending on whether you have called
|
skipping over them and perhaps (depending on whether you have called
|
||||||
png_set_crc_action) checking their CRCs while looking for the IEND chunk.
|
png_set_crc_action) checking their CRCs while looking for the IEND chunk.
|
||||||
|
|
||||||
png_read_end(png_ptr, (png_infop)NULL);
|
png_read_end(png_ptr, NULL);
|
||||||
|
|
||||||
If you don't call png_read_end(), then your file pointer will be
|
If you don't call png_read_end(), then your file pointer will be
|
||||||
left pointing to the first chunk after the last IDAT, which is probably
|
left pointing to the first chunk after the last IDAT, which is probably
|
||||||
|
@ -2430,13 +2427,11 @@ the PNG datastream.
|
||||||
|
|
||||||
When you are done, you can free all memory allocated by libpng like this:
|
When you are done, you can free all memory allocated by libpng like this:
|
||||||
|
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
|
||||||
&end_info);
|
|
||||||
|
|
||||||
or, if you didn't create an end_info structure,
|
or, if you didn't create an end_info structure,
|
||||||
|
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
(png_infopp)NULL);
|
|
||||||
|
|
||||||
It is also possible to individually free the info_ptr members that
|
It is also possible to individually free the info_ptr members that
|
||||||
point to libpng-allocated storage with the following function:
|
point to libpng-allocated storage with the following function:
|
||||||
|
@ -2556,15 +2551,13 @@ png_infop info_ptr;
|
||||||
|
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr,
|
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||||
(png_infopp)NULL, (png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
(png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2597,8 +2590,7 @@ png_infop info_ptr;
|
||||||
{
|
{
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
(png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2763,8 +2755,7 @@ both "png_ptr"; you can call them anything you like, such as
|
||||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
png_destroy_write_struct(&png_ptr,
|
png_destroy_write_struct(&png_ptr, NULL);
|
||||||
(png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2790,7 +2781,7 @@ section below for more information on the libpng error handling.
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
@ -2844,9 +2835,9 @@ a progress meter or the like. It's demonstrated in pngtest.c.
|
||||||
You must supply a function
|
You must supply a function
|
||||||
|
|
||||||
void write_row_callback(png_structp png_ptr, png_uint_32 row,
|
void write_row_callback(png_structp png_ptr, png_uint_32 row,
|
||||||
int pass);
|
int pass)
|
||||||
{
|
{
|
||||||
/* put your code here */
|
/* put your code here */
|
||||||
}
|
}
|
||||||
|
|
||||||
(You can give it another name that you like instead of "write_row_callback")
|
(You can give it another name that you like instead of "write_row_callback")
|
||||||
|
@ -3116,8 +3107,8 @@ width, height, bit_depth, and color_type must be the same in each call.
|
||||||
|
|
||||||
png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif);
|
png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif);
|
||||||
|
|
||||||
exif - Exif profile (array of
|
exif - Exif profile (array of png_byte)
|
||||||
png_byte) (PNG_INFO_eXIf)
|
(PNG_INFO_eXIf)
|
||||||
|
|
||||||
png_set_hIST(png_ptr, info_ptr, hist);
|
png_set_hIST(png_ptr, info_ptr, hist);
|
||||||
|
|
||||||
|
@ -3127,12 +3118,12 @@ width, height, bit_depth, and color_type must be the same in each call.
|
||||||
png_set_tIME(png_ptr, info_ptr, mod_time);
|
png_set_tIME(png_ptr, info_ptr, mod_time);
|
||||||
|
|
||||||
mod_time - time image was last modified
|
mod_time - time image was last modified
|
||||||
(PNG_VALID_tIME)
|
(PNG_INFO_tIME)
|
||||||
|
|
||||||
png_set_bKGD(png_ptr, info_ptr, background);
|
png_set_bKGD(png_ptr, info_ptr, background);
|
||||||
|
|
||||||
background - background color (of type
|
background - background color (of type
|
||||||
png_color_16p) (PNG_VALID_bKGD)
|
png_color_16p) (PNG_INFO_bKGD)
|
||||||
|
|
||||||
png_set_text(png_ptr, info_ptr, text_ptr, num_text);
|
png_set_text(png_ptr, info_ptr, text_ptr, num_text);
|
||||||
|
|
||||||
|
@ -4218,7 +4209,7 @@ png_create_read_struct_2() or png_create_write_struct_2() to register your
|
||||||
own functions as described above. These functions also provide a void
|
own functions as described above. These functions also provide a void
|
||||||
pointer that can be retrieved via
|
pointer that can be retrieved via
|
||||||
|
|
||||||
mem_ptr=png_get_mem_ptr(png_ptr);
|
mem_ptr = png_get_mem_ptr(png_ptr);
|
||||||
|
|
||||||
Your replacement memory functions must have prototypes as follows:
|
Your replacement memory functions must have prototypes as follows:
|
||||||
|
|
||||||
|
@ -4515,7 +4506,7 @@ When PNG_DEBUG is defined but is zero, the macros aren't defined, but you
|
||||||
can still use PNG_DEBUG to control your own debugging:
|
can still use PNG_DEBUG to control your own debugging:
|
||||||
|
|
||||||
#ifdef PNG_DEBUG
|
#ifdef PNG_DEBUG
|
||||||
fprintf(stderr, ...
|
fprintf(stderr, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
||||||
|
@ -4692,7 +4683,7 @@ deprecated since libpng-1.0.16 and libpng-1.2.6.
|
||||||
The function
|
The function
|
||||||
png_check_sig(sig, num)
|
png_check_sig(sig, num)
|
||||||
was replaced with
|
was replaced with
|
||||||
!png_sig_cmp(sig, 0, num)
|
png_sig_cmp(sig, 0, num) == 0
|
||||||
It has been deprecated since libpng-0.90.
|
It has been deprecated since libpng-0.90.
|
||||||
|
|
||||||
The function
|
The function
|
||||||
|
@ -4756,8 +4747,8 @@ png_get_mmx_bitdepth_threshold(), png_get_mmx_rowbytes_threshold(),
|
||||||
png_set_asm_flags(), and png_mmx_supported()
|
png_set_asm_flags(), and png_mmx_supported()
|
||||||
|
|
||||||
We removed the obsolete png_check_sig(), png_memcpy_check(), and
|
We removed the obsolete png_check_sig(), png_memcpy_check(), and
|
||||||
png_memset_check() functions. Instead use !png_sig_cmp(), memcpy(),
|
png_memset_check() functions. Instead use png_sig_cmp() == 0,
|
||||||
and memset(), respectively.
|
memcpy(), and memset(), respectively.
|
||||||
|
|
||||||
The function png_set_gray_1_2_4_to_8() was removed. It has been
|
The function png_set_gray_1_2_4_to_8() was removed. It has been
|
||||||
deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with
|
deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with
|
||||||
|
@ -5239,7 +5230,7 @@ changed, and is unaffected by conditional compilation macros. It is the
|
||||||
best choice for use in configure scripts for detecting the presence of any
|
best choice for use in configure scripts for detecting the presence of any
|
||||||
libpng version since 0.88. In an autoconf "configure.in" you could use
|
libpng version since 0.88. In an autoconf "configure.in" you could use
|
||||||
|
|
||||||
AC_CHECK_LIB(png, png_get_io_ptr, ...
|
AC_CHECK_LIB(png, png_get_io_ptr, ...)
|
||||||
|
|
||||||
XV. Source code repository
|
XV. Source code repository
|
||||||
|
|
||||||
|
@ -5248,12 +5239,12 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files
|
||||||
going back to version 0.70. You can access the git repository (read only)
|
going back to version 0.70. You can access the git repository (read only)
|
||||||
at
|
at
|
||||||
|
|
||||||
https://github.com/glennrp/libpng or
|
https://github.com/pnggroup/libpng or
|
||||||
https://git.code.sf.net/p/libpng/code.git
|
https://git.code.sf.net/p/libpng/code.git
|
||||||
|
|
||||||
or you can browse it with a web browser at
|
or you can browse it with a web browser at
|
||||||
|
|
||||||
https://github.com/glennrp/libpng or
|
https://github.com/pnggroup/libpng or
|
||||||
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
|
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
|
||||||
|
|
||||||
Patches can be sent to png-mng-implement at lists.sourceforge.net or
|
Patches can be sent to png-mng-implement at lists.sourceforge.net or
|
||||||
|
@ -5263,7 +5254,7 @@ uploaded to the libpng bug tracker at
|
||||||
|
|
||||||
or as a "pull request" to
|
or as a "pull request" to
|
||||||
|
|
||||||
https://github.com/glennrp/libpng/pulls
|
https://github.com/pnggroup/libpng/pulls
|
||||||
|
|
||||||
We also accept patches built from the tar or zip distributions, and
|
We also accept patches built from the tar or zip distributions, and
|
||||||
simple verbal descriptions of bug fixes, reported either to the
|
simple verbal descriptions of bug fixes, reported either to the
|
||||||
|
|
147
png/libpng.3
147
png/libpng.3
|
@ -1,6 +1,6 @@
|
||||||
.TH LIBPNG 3 "June 21, 2023"
|
.TH LIBPNG 3 "January 29, 2024"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.40
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.42
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB#include <png.h>\fP
|
\fB#include <png.h>\fP
|
||||||
|
@ -519,7 +519,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
|
||||||
.SH LIBPNG.TXT
|
.SH LIBPNG.TXT
|
||||||
libpng-manual.txt - A description on how to use and modify libpng
|
libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
Copyright (c) 2018-2023 Cosmin Truta
|
Copyright (c) 2018-2024 Cosmin Truta
|
||||||
Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
||||||
|
|
||||||
This document is released under the libpng license.
|
This document is released under the libpng license.
|
||||||
|
@ -528,9 +528,9 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng version 1.6.36, December 2018, through 1.6.40 - June 2023
|
libpng version 1.6.36, December 2018, through 1.6.42 - January 2024
|
||||||
Updated and distributed by Cosmin Truta
|
Updated and distributed by Cosmin Truta
|
||||||
Copyright (c) 2018-2023 Cosmin Truta
|
Copyright (c) 2018-2024 Cosmin Truta
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.6.35 - July 2018
|
libpng versions 0.97, January 1998, through 1.6.35 - July 2018
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
|
@ -876,7 +876,7 @@ Customizing libpng.
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_png = !png_sig_cmp(header, 0, number);
|
is_png = (png_sig_cmp(header, 0, number) == 0);
|
||||||
if (!is_png)
|
if (!is_png)
|
||||||
{
|
{
|
||||||
return NOT_PNG;
|
return NOT_PNG;
|
||||||
|
@ -904,8 +904,7 @@ create the structure, so your application should check for that.
|
||||||
|
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr,
|
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||||
(png_infopp)NULL, (png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -938,14 +937,13 @@ free any memory.
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
|
||||||
&end_info);
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass (png_infopp)NULL instead of &end_info if you didn't create
|
Pass NULL instead of &end_info if you didn't create an end_info
|
||||||
an end_info structure.
|
structure.
|
||||||
|
|
||||||
If you would rather avoid the complexity of setjmp/longjmp issues,
|
If you would rather avoid the complexity of setjmp/longjmp issues,
|
||||||
you can compile libpng with PNG_NO_SETJMP, in which case
|
you can compile libpng with PNG_NO_SETJMP, in which case
|
||||||
|
@ -1015,7 +1013,7 @@ You can set up a callback function to handle any unknown chunks in the
|
||||||
input stream. You must supply the function
|
input stream. You must supply the function
|
||||||
|
|
||||||
read_chunk_callback(png_structp png_ptr,
|
read_chunk_callback(png_structp png_ptr,
|
||||||
png_unknown_chunkp chunk);
|
png_unknown_chunkp chunk)
|
||||||
{
|
{
|
||||||
/* The unknown chunk structure contains your
|
/* The unknown chunk structure contains your
|
||||||
chunk data, along with similar data for any other
|
chunk data, along with similar data for any other
|
||||||
|
@ -1066,9 +1064,9 @@ a progress meter or the like. It's demonstrated in pngtest.c.
|
||||||
You must supply a function
|
You must supply a function
|
||||||
|
|
||||||
void read_row_callback(png_structp png_ptr,
|
void read_row_callback(png_structp png_ptr,
|
||||||
png_uint_32 row, int pass);
|
png_uint_32 row, int pass)
|
||||||
{
|
{
|
||||||
/* put your code here */
|
/* put your code here */
|
||||||
}
|
}
|
||||||
|
|
||||||
(You can give it another name that you like instead of "read_row_callback")
|
(You can give it another name that you like instead of "read_row_callback")
|
||||||
|
@ -1700,21 +1698,21 @@ If you know your image size and pixel size ahead of time, you can allocate
|
||||||
row_pointers prior to calling png_read_png() with
|
row_pointers prior to calling png_read_png() with
|
||||||
|
|
||||||
if (height > PNG_UINT_32_MAX/(sizeof (png_byte)))
|
if (height > PNG_UINT_32_MAX/(sizeof (png_byte)))
|
||||||
png_error (png_ptr,
|
png_error(png_ptr,
|
||||||
"Image is too tall to process in memory");
|
"Image is too tall to process in memory");
|
||||||
|
|
||||||
if (width > PNG_UINT_32_MAX/pixel_size)
|
if (width > PNG_UINT_32_MAX/pixel_size)
|
||||||
png_error (png_ptr,
|
png_error(png_ptr,
|
||||||
"Image is too wide to process in memory");
|
"Image is too wide to process in memory");
|
||||||
|
|
||||||
row_pointers = png_malloc(png_ptr,
|
row_pointers = png_malloc(png_ptr,
|
||||||
height*(sizeof (png_bytep)));
|
height*(sizeof (png_bytep)));
|
||||||
|
|
||||||
for (int i=0; i<height, i++)
|
for (int i = 0; i < height, i++)
|
||||||
row_pointers[i]=NULL; /* security precaution */
|
row_pointers[i] = NULL; /* security precaution */
|
||||||
|
|
||||||
for (int i=0; i<height, i++)
|
for (int i = 0; i < height, i++)
|
||||||
row_pointers[i]=png_malloc(png_ptr,
|
row_pointers[i] = png_malloc(png_ptr,
|
||||||
width*pixel_size);
|
width*pixel_size);
|
||||||
|
|
||||||
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
||||||
|
@ -1724,14 +1722,14 @@ row_pointers[i] to point into the proper places in your block, but first
|
||||||
be sure that your platform is able to allocate such a large buffer:
|
be sure that your platform is able to allocate such a large buffer:
|
||||||
|
|
||||||
/* Guard against integer overflow */
|
/* Guard against integer overflow */
|
||||||
if (height > PNG_SIZE_MAX/(width*pixel_size)) {
|
if (height > PNG_SIZE_MAX/(width*pixel_size))
|
||||||
png_error(png_ptr,"image_data buffer would be too large");
|
png_error(png_ptr, "image_data buffer would be too large");
|
||||||
}
|
|
||||||
|
|
||||||
png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size);
|
png_bytep buffer = png_malloc(png_ptr,
|
||||||
|
height*width*pixel_size);
|
||||||
|
|
||||||
for (int i=0; i<height, i++)
|
for (int i = 0; i < height, i++)
|
||||||
row_pointers[i]=buffer+i*width*pixel_size;
|
row_pointers[i] = buffer + i*width*pixel_size;
|
||||||
|
|
||||||
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
||||||
|
|
||||||
|
@ -1984,25 +1982,24 @@ png_set_rgb_to_gray()).
|
||||||
non-paletted images (PNG_INFO_tRNS)
|
non-paletted images (PNG_INFO_tRNS)
|
||||||
|
|
||||||
png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif);
|
png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif);
|
||||||
(PNG_INFO_eXIf)
|
|
||||||
|
|
||||||
exif - Exif profile (array of png_byte)
|
exif - Exif profile (array of png_byte)
|
||||||
|
(PNG_INFO_eXIf)
|
||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr, &hist);
|
png_get_hIST(png_ptr, info_ptr, &hist);
|
||||||
(PNG_INFO_hIST)
|
|
||||||
|
|
||||||
hist - histogram of palette (array of
|
hist - histogram of palette (array of
|
||||||
png_uint_16)
|
png_uint_16) (PNG_INFO_hIST)
|
||||||
|
|
||||||
png_get_tIME(png_ptr, info_ptr, &mod_time);
|
png_get_tIME(png_ptr, info_ptr, &mod_time);
|
||||||
|
|
||||||
mod_time - time image was last modified
|
mod_time - time image was last modified
|
||||||
(PNG_VALID_tIME)
|
(PNG_INFO_tIME)
|
||||||
|
|
||||||
png_get_bKGD(png_ptr, info_ptr, &background);
|
png_get_bKGD(png_ptr, info_ptr, &background);
|
||||||
|
|
||||||
background - background color (of type
|
background - background color (of type
|
||||||
png_color_16p) (PNG_VALID_bKGD)
|
png_color_16p) (PNG_INFO_bKGD)
|
||||||
valid 16-bit red, green and blue
|
valid 16-bit red, green and blue
|
||||||
values, regardless of color_type
|
values, regardless of color_type
|
||||||
|
|
||||||
|
@ -2262,13 +2259,13 @@ grayscale images with bit depths of 2 or 4 or if there is a multiple-image
|
||||||
viewing application that wishes to treat all images in the same way.
|
viewing application that wishes to treat all images in the same way.
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_set_palette_to_rgb(png_ptr);
|
png_set_palette_to_rgb(png_ptr);
|
||||||
|
|
||||||
if (png_get_valid(png_ptr, info_ptr,
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||||
PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
|
png_set_tRNS_to_alpha(png_ptr);
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY &&
|
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||||
bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
|
png_set_expand_gray_1_2_4_to_8(png_ptr);
|
||||||
|
|
||||||
The first two functions are actually aliases for png_set_expand(), added
|
The first two functions are actually aliases for png_set_expand(), added
|
||||||
in libpng version 1.0.4, with the function names expanded to improve code
|
in libpng version 1.0.4, with the function names expanded to improve code
|
||||||
|
@ -2283,18 +2280,20 @@ png_set_expand(); however, the resultant channels have 16 bits rather than 8.
|
||||||
Use this when the output color or gray channels are made linear to avoid fairly
|
Use this when the output color or gray channels are made linear to avoid fairly
|
||||||
severe accuracy loss.
|
severe accuracy loss.
|
||||||
|
|
||||||
if (bit_depth < 16)
|
if (bit_depth < 16)
|
||||||
png_set_expand_16(png_ptr);
|
png_set_expand_16(png_ptr);
|
||||||
|
|
||||||
PNG can have files with 16 bits per channel. If you only can handle
|
PNG can have files with 16 bits per channel. If you only can handle
|
||||||
8 bits per channel, this will strip the pixels down to 8-bit.
|
8 bits per channel, this will strip the pixels down to 8-bit.
|
||||||
|
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16)
|
||||||
|
{
|
||||||
#if PNG_LIBPNG_VER >= 10504
|
#if PNG_LIBPNG_VER >= 10504
|
||||||
png_set_scale_16(png_ptr);
|
png_set_scale_16(png_ptr);
|
||||||
#else
|
#else
|
||||||
png_set_strip_16(png_ptr);
|
png_set_strip_16(png_ptr);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
(The more accurate "png_set_scale_16()" API became available in libpng version
|
(The more accurate "png_set_scale_16()" API became available in libpng version
|
||||||
1.5.4).
|
1.5.4).
|
||||||
|
@ -2420,7 +2419,7 @@ Note that png_set_filler() does not change the color type. If you want
|
||||||
to do that, you can add a true alpha channel with
|
to do that, you can add a true alpha channel with
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_RGB ||
|
if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
color_type == PNG_COLOR_TYPE_GRAY)
|
color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER);
|
png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER);
|
||||||
|
|
||||||
where "filler" contains the alpha value to assign to each pixel.
|
where "filler" contains the alpha value to assign to each pixel.
|
||||||
|
@ -2445,7 +2444,7 @@ with alpha.
|
||||||
if (color_type == PNG_COLOR_TYPE_RGB ||
|
if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
png_set_rgb_to_gray(png_ptr, error_action,
|
png_set_rgb_to_gray(png_ptr, error_action,
|
||||||
double red_weight, double green_weight);
|
(double)red_weight, (double)green_weight);
|
||||||
|
|
||||||
error_action = 1: silently do the conversion
|
error_action = 1: silently do the conversion
|
||||||
|
|
||||||
|
@ -2468,8 +2467,8 @@ In the corresponding fixed point API the red_weight and green_weight values are
|
||||||
simply scaled by 100,000:
|
simply scaled by 100,000:
|
||||||
|
|
||||||
png_set_rgb_to_gray(png_ptr, error_action,
|
png_set_rgb_to_gray(png_ptr, error_action,
|
||||||
png_fixed_point red_weight,
|
(png_fixed_point)red_weight,
|
||||||
png_fixed_point green_weight);
|
(png_fixed_point)green_weight);
|
||||||
|
|
||||||
If you have set error_action = 1 or 2, you can
|
If you have set error_action = 1 or 2, you can
|
||||||
later check whether the image really was gray, after processing
|
later check whether the image really was gray, after processing
|
||||||
|
@ -2705,9 +2704,8 @@ do your own check for number_of_rows*width*pixel_size if you are using
|
||||||
a multiple-row buffer:
|
a multiple-row buffer:
|
||||||
|
|
||||||
/* Guard against integer overflow */
|
/* Guard against integer overflow */
|
||||||
if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size)) {
|
if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size))
|
||||||
png_error(png_ptr,"image_data buffer would be too large");
|
png_error(png_ptr, "image_data buffer would be too large");
|
||||||
}
|
|
||||||
|
|
||||||
Remember: Before you call png_read_update_info(), the png_get_*()
|
Remember: Before you call png_read_update_info(), the png_get_*()
|
||||||
functions return the values corresponding to the original PNG image.
|
functions return the values corresponding to the original PNG image.
|
||||||
|
@ -2927,12 +2925,11 @@ separate.
|
||||||
|
|
||||||
if (!end_info)
|
if (!end_info)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
(png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_read_end(png_ptr, end_info);
|
png_read_end(png_ptr, end_info);
|
||||||
|
|
||||||
If you are not interested, you should still call png_read_end()
|
If you are not interested, you should still call png_read_end()
|
||||||
but you can pass NULL, avoiding the need to create an end_info structure.
|
but you can pass NULL, avoiding the need to create an end_info structure.
|
||||||
|
@ -2940,7 +2937,7 @@ If you do this, libpng will not process any chunks after IDAT other than
|
||||||
skipping over them and perhaps (depending on whether you have called
|
skipping over them and perhaps (depending on whether you have called
|
||||||
png_set_crc_action) checking their CRCs while looking for the IEND chunk.
|
png_set_crc_action) checking their CRCs while looking for the IEND chunk.
|
||||||
|
|
||||||
png_read_end(png_ptr, (png_infop)NULL);
|
png_read_end(png_ptr, NULL);
|
||||||
|
|
||||||
If you don't call png_read_end(), then your file pointer will be
|
If you don't call png_read_end(), then your file pointer will be
|
||||||
left pointing to the first chunk after the last IDAT, which is probably
|
left pointing to the first chunk after the last IDAT, which is probably
|
||||||
|
@ -2949,13 +2946,11 @@ the PNG datastream.
|
||||||
|
|
||||||
When you are done, you can free all memory allocated by libpng like this:
|
When you are done, you can free all memory allocated by libpng like this:
|
||||||
|
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
|
||||||
&end_info);
|
|
||||||
|
|
||||||
or, if you didn't create an end_info structure,
|
or, if you didn't create an end_info structure,
|
||||||
|
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
(png_infopp)NULL);
|
|
||||||
|
|
||||||
It is also possible to individually free the info_ptr members that
|
It is also possible to individually free the info_ptr members that
|
||||||
point to libpng-allocated storage with the following function:
|
point to libpng-allocated storage with the following function:
|
||||||
|
@ -3075,15 +3070,13 @@ png_infop info_ptr;
|
||||||
|
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr,
|
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||||
(png_infopp)NULL, (png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
(png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3116,8 +3109,7 @@ png_infop info_ptr;
|
||||||
{
|
{
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
(png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3282,8 +3274,7 @@ both "png_ptr"; you can call them anything you like, such as
|
||||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
png_destroy_write_struct(&png_ptr,
|
png_destroy_write_struct(&png_ptr, NULL);
|
||||||
(png_infopp)NULL);
|
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3309,7 +3300,7 @@ section below for more information on the libpng error handling.
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
@ -3363,9 +3354,9 @@ a progress meter or the like. It's demonstrated in pngtest.c.
|
||||||
You must supply a function
|
You must supply a function
|
||||||
|
|
||||||
void write_row_callback(png_structp png_ptr, png_uint_32 row,
|
void write_row_callback(png_structp png_ptr, png_uint_32 row,
|
||||||
int pass);
|
int pass)
|
||||||
{
|
{
|
||||||
/* put your code here */
|
/* put your code here */
|
||||||
}
|
}
|
||||||
|
|
||||||
(You can give it another name that you like instead of "write_row_callback")
|
(You can give it another name that you like instead of "write_row_callback")
|
||||||
|
@ -3635,8 +3626,8 @@ width, height, bit_depth, and color_type must be the same in each call.
|
||||||
|
|
||||||
png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif);
|
png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif);
|
||||||
|
|
||||||
exif - Exif profile (array of
|
exif - Exif profile (array of png_byte)
|
||||||
png_byte) (PNG_INFO_eXIf)
|
(PNG_INFO_eXIf)
|
||||||
|
|
||||||
png_set_hIST(png_ptr, info_ptr, hist);
|
png_set_hIST(png_ptr, info_ptr, hist);
|
||||||
|
|
||||||
|
@ -3646,12 +3637,12 @@ width, height, bit_depth, and color_type must be the same in each call.
|
||||||
png_set_tIME(png_ptr, info_ptr, mod_time);
|
png_set_tIME(png_ptr, info_ptr, mod_time);
|
||||||
|
|
||||||
mod_time - time image was last modified
|
mod_time - time image was last modified
|
||||||
(PNG_VALID_tIME)
|
(PNG_INFO_tIME)
|
||||||
|
|
||||||
png_set_bKGD(png_ptr, info_ptr, background);
|
png_set_bKGD(png_ptr, info_ptr, background);
|
||||||
|
|
||||||
background - background color (of type
|
background - background color (of type
|
||||||
png_color_16p) (PNG_VALID_bKGD)
|
png_color_16p) (PNG_INFO_bKGD)
|
||||||
|
|
||||||
png_set_text(png_ptr, info_ptr, text_ptr, num_text);
|
png_set_text(png_ptr, info_ptr, text_ptr, num_text);
|
||||||
|
|
||||||
|
@ -4737,7 +4728,7 @@ png_create_read_struct_2() or png_create_write_struct_2() to register your
|
||||||
own functions as described above. These functions also provide a void
|
own functions as described above. These functions also provide a void
|
||||||
pointer that can be retrieved via
|
pointer that can be retrieved via
|
||||||
|
|
||||||
mem_ptr=png_get_mem_ptr(png_ptr);
|
mem_ptr = png_get_mem_ptr(png_ptr);
|
||||||
|
|
||||||
Your replacement memory functions must have prototypes as follows:
|
Your replacement memory functions must have prototypes as follows:
|
||||||
|
|
||||||
|
@ -5034,7 +5025,7 @@ When PNG_DEBUG is defined but is zero, the macros aren't defined, but you
|
||||||
can still use PNG_DEBUG to control your own debugging:
|
can still use PNG_DEBUG to control your own debugging:
|
||||||
|
|
||||||
#ifdef PNG_DEBUG
|
#ifdef PNG_DEBUG
|
||||||
fprintf(stderr, ...
|
fprintf(stderr, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
||||||
|
@ -5211,7 +5202,7 @@ deprecated since libpng-1.0.16 and libpng-1.2.6.
|
||||||
The function
|
The function
|
||||||
png_check_sig(sig, num)
|
png_check_sig(sig, num)
|
||||||
was replaced with
|
was replaced with
|
||||||
!png_sig_cmp(sig, 0, num)
|
png_sig_cmp(sig, 0, num) == 0
|
||||||
It has been deprecated since libpng-0.90.
|
It has been deprecated since libpng-0.90.
|
||||||
|
|
||||||
The function
|
The function
|
||||||
|
@ -5275,8 +5266,8 @@ png_get_mmx_bitdepth_threshold(), png_get_mmx_rowbytes_threshold(),
|
||||||
png_set_asm_flags(), and png_mmx_supported()
|
png_set_asm_flags(), and png_mmx_supported()
|
||||||
|
|
||||||
We removed the obsolete png_check_sig(), png_memcpy_check(), and
|
We removed the obsolete png_check_sig(), png_memcpy_check(), and
|
||||||
png_memset_check() functions. Instead use !png_sig_cmp(), memcpy(),
|
png_memset_check() functions. Instead use png_sig_cmp() == 0,
|
||||||
and memset(), respectively.
|
memcpy(), and memset(), respectively.
|
||||||
|
|
||||||
The function png_set_gray_1_2_4_to_8() was removed. It has been
|
The function png_set_gray_1_2_4_to_8() was removed. It has been
|
||||||
deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with
|
deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with
|
||||||
|
@ -5758,7 +5749,7 @@ changed, and is unaffected by conditional compilation macros. It is the
|
||||||
best choice for use in configure scripts for detecting the presence of any
|
best choice for use in configure scripts for detecting the presence of any
|
||||||
libpng version since 0.88. In an autoconf "configure.in" you could use
|
libpng version since 0.88. In an autoconf "configure.in" you could use
|
||||||
|
|
||||||
AC_CHECK_LIB(png, png_get_io_ptr, ...
|
AC_CHECK_LIB(png, png_get_io_ptr, ...)
|
||||||
|
|
||||||
.SH XV. Source code repository
|
.SH XV. Source code repository
|
||||||
|
|
||||||
|
@ -5767,12 +5758,12 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files
|
||||||
going back to version 0.70. You can access the git repository (read only)
|
going back to version 0.70. You can access the git repository (read only)
|
||||||
at
|
at
|
||||||
|
|
||||||
https://github.com/glennrp/libpng or
|
https://github.com/pnggroup/libpng or
|
||||||
https://git.code.sf.net/p/libpng/code.git
|
https://git.code.sf.net/p/libpng/code.git
|
||||||
|
|
||||||
or you can browse it with a web browser at
|
or you can browse it with a web browser at
|
||||||
|
|
||||||
https://github.com/glennrp/libpng or
|
https://github.com/pnggroup/libpng or
|
||||||
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
|
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
|
||||||
|
|
||||||
Patches can be sent to png-mng-implement at lists.sourceforge.net or
|
Patches can be sent to png-mng-implement at lists.sourceforge.net or
|
||||||
|
@ -5782,7 +5773,7 @@ uploaded to the libpng bug tracker at
|
||||||
|
|
||||||
or as a "pull request" to
|
or as a "pull request" to
|
||||||
|
|
||||||
https://github.com/glennrp/libpng/pulls
|
https://github.com/pnggroup/libpng/pulls
|
||||||
|
|
||||||
We also accept patches built from the tar or zip distributions, and
|
We also accept patches built from the tar or zip distributions, and
|
||||||
simple verbal descriptions of bug fixes, reported either to the
|
simple verbal descriptions of bug fixes, reported either to the
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.TH LIBPNGPF 3 "June 21, 2023"
|
.TH LIBPNGPF 3 "January 29, 2024"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.40
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.42
|
||||||
(private functions)
|
(private functions)
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH PNG 5 "June 21, 2023"
|
.TH PNG 5 "January 29, 2024"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
|
|
||||||
|
|
71
png/png.c
71
png/png.c
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2023 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -14,27 +14,7 @@
|
||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef png_libpng_version_1_6_40 Your_png_h_is_not_version_1_6_40;
|
typedef png_libpng_version_1_6_42 Your_png_h_is_not_version_1_6_42;
|
||||||
|
|
||||||
#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
|
|
||||||
|
|
||||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
/* 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
|
* 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
|
int PNGAPI
|
||||||
png_sig_cmp(png_const_bytep sig, size_t start, 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};
|
static const png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||||
|
|
||||||
if (num_to_check > 8)
|
if (num_to_check > 8)
|
||||||
num_to_check = 8;
|
num_to_check = 8;
|
||||||
|
|
||||||
else if (num_to_check < 1)
|
else if (num_to_check < 1)
|
||||||
return (-1);
|
return -1;
|
||||||
|
|
||||||
if (start > 7)
|
if (start > 7)
|
||||||
return (-1);
|
return -1;
|
||||||
|
|
||||||
if (start + num_to_check > 8)
|
if (start + num_to_check > 8)
|
||||||
num_to_check = 8 - start;
|
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 */
|
#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));
|
memset(info_ptr, 0, (sizeof *info_ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following API is not called internally */
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
int freer, png_uint_32 mask)
|
int freer, png_uint_32 mask)
|
||||||
|
@ -686,9 +665,9 @@ png_voidp PNGAPI
|
||||||
png_get_io_ptr(png_const_structrp png_ptr)
|
png_get_io_ptr(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
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)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
@ -815,8 +794,8 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||||
return PNG_STRING_COPYRIGHT
|
return PNG_STRING_COPYRIGHT
|
||||||
#else
|
#else
|
||||||
return PNG_STRING_NEWLINE \
|
return PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.6.40" PNG_STRING_NEWLINE \
|
"libpng version 1.6.42" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 2018-2023 Cosmin Truta" PNG_STRING_NEWLINE \
|
"Copyright (c) 2018-2024 Cosmin Truta" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
||||||
PNG_STRING_NEWLINE \
|
PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" 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;
|
return Z_STREAM_ERROR;
|
||||||
|
|
||||||
/* WARNING: this resets the window bits to the maximum! */
|
/* WARNING: this resets the window bits to the maximum! */
|
||||||
return (inflateReset(&png_ptr->zstream));
|
return inflateReset(&png_ptr->zstream);
|
||||||
}
|
}
|
||||||
#endif /* READ */
|
#endif /* READ */
|
||||||
|
|
||||||
|
@ -986,7 +965,7 @@ png_uint_32 PNGAPI
|
||||||
png_access_version_number(void)
|
png_access_version_number(void)
|
||||||
{
|
{
|
||||||
/* Version of *.c files used when building libpng */
|
/* 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)
|
#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
|
/* Function to format a floating point value in ASCII with a given
|
||||||
* precision.
|
* 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 */
|
void /* PRIVATE */
|
||||||
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
|
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
|
||||||
double fp, unsigned int precision)
|
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. */
|
/* Here on buffer too small. */
|
||||||
png_error(png_ptr, "ASCII conversion 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 */
|
# endif /* FLOATING_POINT */
|
||||||
|
|
||||||
# ifdef PNG_FIXED_POINT_SUPPORTED
|
# 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 */
|
if (num <= 0x80000000) /* else overflowed */
|
||||||
{
|
{
|
||||||
unsigned int ndigits = 0, first = 16 /* flag value */;
|
unsigned int ndigits = 0, first = 16 /* flag value */;
|
||||||
char digits[10];
|
char digits[10] = {0};
|
||||||
|
|
||||||
while (num)
|
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 nearest .00001). Overflow and divide by zero are signalled in
|
||||||
* the result, a boolean - true on success, false on overflow.
|
* 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
|
int
|
||||||
png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
||||||
png_int_32 divisor)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
#if GCC_STRICT_OVERFLOW
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif /* GCC_STRICT_OVERFLOW */
|
|
||||||
#endif /* READ_GAMMA || INCH_CONVERSIONS */
|
#endif /* READ_GAMMA || INCH_CONVERSIONS */
|
||||||
|
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
|
||||||
|
|
52
png/png.h
52
png/png.h
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.6.40
|
* libpng version 1.6.42
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2023 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.6.35, July 2018:
|
* libpng versions 0.97, January 1998, through 1.6.35, July 2018:
|
||||||
* Glenn Randers-Pehrson
|
* Glenn Randers-Pehrson
|
||||||
* libpng versions 1.6.36, December 2018, through 1.6.40, June 2023:
|
* libpng versions 1.6.36, December 2018, through 1.6.42, January 2024:
|
||||||
* Cosmin Truta
|
* Cosmin Truta
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*/
|
*/
|
||||||
|
@ -27,8 +27,8 @@
|
||||||
* PNG Reference Library License version 2
|
* PNG Reference Library License version 2
|
||||||
* ---------------------------------------
|
* ---------------------------------------
|
||||||
*
|
*
|
||||||
* * Copyright (c) 1995-2023 The PNG Reference Library Authors.
|
* * Copyright (c) 1995-2024 The PNG Reference Library Authors.
|
||||||
* * Copyright (c) 2018-2023 Cosmin Truta.
|
* * Copyright (c) 2018-2024 Cosmin Truta.
|
||||||
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||||
* * Copyright (c) 1996-1997 Andreas Dilger.
|
* * Copyright (c) 1996-1997 Andreas Dilger.
|
||||||
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -239,7 +239,7 @@
|
||||||
* ...
|
* ...
|
||||||
* 1.5.30 15 10530 15.so.15.30[.0]
|
* 1.5.30 15 10530 15.so.15.30[.0]
|
||||||
* ...
|
* ...
|
||||||
* 1.6.40 16 10640 16.so.16.40[.0]
|
* 1.6.42 16 10641 16.so.16.41[.0]
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major and
|
* Henceforth the source version will match the shared-library major and
|
||||||
* minor numbers; the shared-library major version number will be used for
|
* minor numbers; the shared-library major version number will be used for
|
||||||
|
@ -278,8 +278,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.6.40"
|
#define PNG_LIBPNG_VER_STRING "1.6.42"
|
||||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.40 - June 21, 2023\n"
|
#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 16
|
#define PNG_LIBPNG_VER_SONUM 16
|
||||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||||
|
@ -287,7 +287,7 @@
|
||||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||||
#define PNG_LIBPNG_VER_MAJOR 1
|
#define PNG_LIBPNG_VER_MAJOR 1
|
||||||
#define PNG_LIBPNG_VER_MINOR 6
|
#define PNG_LIBPNG_VER_MINOR 6
|
||||||
#define PNG_LIBPNG_VER_RELEASE 40
|
#define PNG_LIBPNG_VER_RELEASE 42
|
||||||
|
|
||||||
/* This should be zero for a public release, or non-zero for a
|
/* This should be zero for a public release, or non-zero for a
|
||||||
* development version. [Deprecated]
|
* development version. [Deprecated]
|
||||||
|
@ -318,7 +318,7 @@
|
||||||
* From version 1.0.1 it is:
|
* From version 1.0.1 it is:
|
||||||
* XXYYZZ, where XX=major, YY=minor, ZZ=release
|
* XXYYZZ, where XX=major, YY=minor, ZZ=release
|
||||||
*/
|
*/
|
||||||
#define PNG_LIBPNG_VER 10640 /* 1.6.40 */
|
#define PNG_LIBPNG_VER 10641 /* 1.6.42 */
|
||||||
|
|
||||||
/* Library configuration: these options cannot be changed after
|
/* Library configuration: these options cannot be changed after
|
||||||
* the library has been built.
|
* the library has been built.
|
||||||
|
@ -428,7 +428,7 @@ extern "C" {
|
||||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||||
* do not agree upon the version number.
|
* do not agree upon the version number.
|
||||||
*/
|
*/
|
||||||
typedef char* png_libpng_version_1_6_40;
|
typedef char* png_libpng_version_1_6_42;
|
||||||
|
|
||||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||||
*
|
*
|
||||||
|
@ -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 */
|
#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
|
||||||
/* Added to libpng-1.5.4 */
|
/* Added to libpng-1.5.4 */
|
||||||
#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
|
#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 */
|
#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */
|
||||||
#endif
|
#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
|
/* 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
|
* PNG file. Returns zero if the supplied bytes match the 8-byte PNG
|
||||||
* signature, and non-zero otherwise. Having num_to_check == 0 or
|
* signature, and non-zero otherwise. Having num_to_check == 0 or
|
||||||
* start > 7 will always fail (ie 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,
|
PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start,
|
||||||
size_t num_to_check));
|
size_t num_to_check));
|
||||||
|
|
||||||
/* Simple signature checking function. This is the same as calling
|
/* 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. */
|
/* Allocate and initialize png_ptr struct for reading, and any other memory. */
|
||||||
PNG_EXPORTA(4, png_structp, png_create_read_struct,
|
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_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr,
|
||||||
png_inforp info_ptr, png_uint_32 free_me, int num));
|
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
|
* 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.
|
* in, without changing 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.
|
|
||||||
*/
|
*/
|
||||||
PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
|
PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
|
||||||
png_inforp info_ptr, int freer, png_uint_32 mask));
|
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
|
#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
||||||
# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */
|
# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */
|
||||||
#endif
|
#endif
|
||||||
#define PNG_IGNORE_ADLER32 8
|
#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
|
||||||
#ifdef PNG_POWERPC_VSX_API_SUPPORTED
|
# define PNG_IGNORE_ADLER32 8 /* SOFTWARE: disable Adler32 check on IDAT */
|
||||||
# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions supported */
|
|
||||||
#endif
|
#endif
|
||||||
#define PNG_OPTION_NEXT 12 /* Next option - numbers must be even */
|
#ifdef PNG_POWERPC_VSX_API_SUPPORTED
|
||||||
|
# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions
|
||||||
|
* supported */
|
||||||
|
#endif
|
||||||
|
#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 */
|
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
||||||
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
/* pngconf.h - machine-configurable file for libpng
|
/* pngconf.h - machine-configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.6.40
|
* libpng version 1.6.42
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* 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) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -255,7 +255,7 @@ void
|
||||||
png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
|
png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
|
||||||
png_alloc_size_t value)
|
png_alloc_size_t value)
|
||||||
{
|
{
|
||||||
char buffer[PNG_NUMBER_BUFFER_SIZE] = {0}; /* FLTK Issue #757 */
|
char buffer[PNG_NUMBER_BUFFER_SIZE] = {0};
|
||||||
png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
|
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_alloc_size_t u;
|
||||||
png_charp str;
|
png_charp str;
|
||||||
char buffer[PNG_NUMBER_BUFFER_SIZE] = {0}; /* FLTK Issue #757 */
|
char buffer[PNG_NUMBER_BUFFER_SIZE] = {0};
|
||||||
|
|
||||||
/* Avoid overflow by doing the negate in a png_alloc_size_t: */
|
/* Avoid overflow by doing the negate in a png_alloc_size_t: */
|
||||||
u = (png_alloc_size_t)value;
|
u = (png_alloc_size_t)value;
|
||||||
|
@ -858,7 +858,7 @@ png_get_error_ptr(png_const_structrp png_ptr)
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return 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
|
#endif
|
||||||
|
|
||||||
int /* PRIVATE */
|
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;
|
png_voidp saved_error_buf = image->opaque->error_buf;
|
||||||
volatile int result;
|
|
||||||
volatile png_voidp saved_error_buf;
|
|
||||||
jmp_buf safe_jmpbuf;
|
jmp_buf safe_jmpbuf;
|
||||||
|
int result;
|
||||||
|
|
||||||
/* Safely execute function(arg) with png_error returning to this function. */
|
/* Safely execute function(arg), with png_error returning back here. */
|
||||||
saved_error_buf = image->opaque->error_buf;
|
if (setjmp(safe_jmpbuf) == 0)
|
||||||
result = setjmp(safe_jmpbuf) == 0;
|
|
||||||
|
|
||||||
if (result != 0)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
image->opaque->error_buf = safe_jmpbuf;
|
image->opaque->error_buf = safe_jmpbuf;
|
||||||
result = function(arg);
|
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;
|
image->opaque->error_buf = saved_error_buf;
|
||||||
|
png_image_free(image);
|
||||||
/* And do the cleanup prior to any failure return. */
|
return 0;
|
||||||
if (result == 0)
|
|
||||||
png_image_free(image);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
|
#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
|
||||||
#endif /* READ || WRITE */
|
#endif /* READ || WRITE */
|
||||||
|
|
245
png/pngget.c
245
png/pngget.c
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2023 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -28,22 +28,22 @@ png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
* valid tRNS chunk in this case.
|
* valid tRNS chunk in this case.
|
||||||
*/
|
*/
|
||||||
if (flag == PNG_INFO_tRNS && png_ptr->num_trans == 0)
|
if (flag == PNG_INFO_tRNS && png_ptr->num_trans == 0)
|
||||||
return(0);
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(info_ptr->valid & flag);
|
return info_ptr->valid & flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t PNGAPI
|
size_t PNGAPI
|
||||||
png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return(info_ptr->rowbytes);
|
return info_ptr->rowbytes;
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||||
|
@ -51,9 +51,9 @@ png_bytepp PNGAPI
|
||||||
png_get_rows(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_rows(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return(info_ptr->row_pointers);
|
return info_ptr->row_pointers;
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ png_get_image_width(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->width;
|
return info_ptr->width;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
@ -74,7 +74,7 @@ png_get_image_height(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->height;
|
return info_ptr->height;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
@ -83,7 +83,7 @@ png_get_bit_depth(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->bit_depth;
|
return info_ptr->bit_depth;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
@ -92,7 +92,7 @@ png_get_color_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->color_type;
|
return info_ptr->color_type;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
@ -101,7 +101,7 @@ png_get_filter_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->filter_type;
|
return info_ptr->filter_type;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
@ -110,7 +110,7 @@ png_get_interlace_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->interlace_type;
|
return info_ptr->interlace_type;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
@ -119,7 +119,7 @@ png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return info_ptr->compression_type;
|
return info_ptr->compression_type;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
@ -127,21 +127,20 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
||||||
info_ptr)
|
info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_x_pixels_per_meter");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function",
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
||||||
"png_get_x_pixels_per_meter");
|
return info_ptr->x_pixels_per_unit;
|
||||||
|
}
|
||||||
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
|
||||||
return (info_ptr->x_pixels_per_unit);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
@ -149,42 +148,41 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
||||||
info_ptr)
|
info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_y_pixels_per_meter");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function",
|
|
||||||
"png_get_y_pixels_per_meter");
|
|
||||||
|
|
||||||
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
||||||
return (info_ptr->y_pixels_per_unit);
|
return info_ptr->y_pixels_per_unit;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_pixels_per_meter");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
|
|
||||||
|
|
||||||
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER &&
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER &&
|
||||||
info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
|
info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
|
||||||
return (info_ptr->x_pixels_per_unit);
|
return info_ptr->x_pixels_per_unit;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
@ -193,21 +191,21 @@ png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
|
||||||
info_ptr)
|
info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_READ_pHYs_SUPPORTED
|
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_pixel_aspect_ratio");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
|
|
||||||
|
|
||||||
if (info_ptr->x_pixels_per_unit != 0)
|
if (info_ptr->x_pixels_per_unit != 0)
|
||||||
return ((float)((float)info_ptr->y_pixels_per_unit
|
return (float)info_ptr->y_pixels_per_unit
|
||||||
/(float)info_ptr->x_pixels_per_unit));
|
/ (float)info_ptr->x_pixels_per_unit;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ((float)0.0);
|
return (float)0.0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -217,6 +215,8 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
|
||||||
png_const_inforp info_ptr)
|
png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_READ_pHYs_SUPPORTED
|
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_pixel_aspect_ratio_fixed");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0 &&
|
(info_ptr->valid & PNG_INFO_pHYs) != 0 &&
|
||||||
info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
|
info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
|
||||||
|
@ -225,8 +225,6 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
|
||||||
{
|
{
|
||||||
png_fixed_point res;
|
png_fixed_point res;
|
||||||
|
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio_fixed");
|
|
||||||
|
|
||||||
/* The following casts work because a PNG 4 byte integer only has a valid
|
/* The following casts work because a PNG 4 byte integer only has a valid
|
||||||
* range of 0..2^31-1; otherwise the cast might overflow.
|
* range of 0..2^31-1; otherwise the cast might overflow.
|
||||||
*/
|
*/
|
||||||
|
@ -247,80 +245,80 @@ png_int_32 PNGAPI
|
||||||
png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_x_offset_microns");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
|
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
||||||
return (info_ptr->x_offset);
|
return info_ptr->x_offset;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_int_32 PNGAPI
|
png_int_32 PNGAPI
|
||||||
png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_y_offset_microns");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
|
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
||||||
return (info_ptr->y_offset);
|
return info_ptr->y_offset;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_int_32 PNGAPI
|
png_int_32 PNGAPI
|
||||||
png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_x_offset_pixels");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
|
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
||||||
return (info_ptr->x_offset);
|
return info_ptr->x_offset;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_int_32 PNGAPI
|
png_int_32 PNGAPI
|
||||||
png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
png_debug(1, "in png_get_y_offset_pixels");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
|
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
||||||
return (info_ptr->y_offset);
|
return info_ptr->y_offset;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
PNG_UNUSED(info_ptr)
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_INCH_CONVERSIONS_SUPPORTED
|
#ifdef PNG_INCH_CONVERSIONS_SUPPORTED
|
||||||
|
@ -434,11 +432,11 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_uint_32 retval = 0;
|
png_uint_32 retval = 0;
|
||||||
|
|
||||||
|
png_debug1(1, "in %s retrieval function", "pHYs");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "pHYs");
|
|
||||||
|
|
||||||
if (res_x != NULL)
|
if (res_x != NULL)
|
||||||
{
|
{
|
||||||
*res_x = info_ptr->x_pixels_per_unit;
|
*res_x = info_ptr->x_pixels_per_unit;
|
||||||
|
@ -464,7 +462,7 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (retval);
|
return retval;
|
||||||
}
|
}
|
||||||
#endif /* pHYs */
|
#endif /* pHYs */
|
||||||
#endif /* INCH_CONVERSIONS */
|
#endif /* INCH_CONVERSIONS */
|
||||||
|
@ -478,9 +476,9 @@ png_byte PNGAPI
|
||||||
png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return(info_ptr->channels);
|
return info_ptr->channels;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
@ -488,9 +486,9 @@ png_const_bytep PNGAPI
|
||||||
png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return(info_ptr->signature);
|
return info_ptr->signature;
|
||||||
|
|
||||||
return (NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -499,17 +497,17 @@ png_uint_32 PNGAPI
|
||||||
png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_color_16p *background)
|
png_color_16p *background)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "bKGD");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_bKGD) != 0 &&
|
(info_ptr->valid & PNG_INFO_bKGD) != 0 &&
|
||||||
background != NULL)
|
background != NULL)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "bKGD");
|
|
||||||
|
|
||||||
*background = &(info_ptr->background);
|
*background = &(info_ptr->background);
|
||||||
return (PNG_INFO_bKGD);
|
return PNG_INFO_bKGD;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -524,6 +522,8 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
double *white_x, double *white_y, double *red_x, double *red_y,
|
double *white_x, double *white_y, double *red_x, double *red_y,
|
||||||
double *green_x, double *green_y, double *blue_x, double *blue_y)
|
double *green_x, double *green_y, double *blue_x, double *blue_y)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "cHRM");
|
||||||
|
|
||||||
/* Quiet API change: this code used to only return the end points if a cHRM
|
/* Quiet API change: this code used to only return the end points if a cHRM
|
||||||
* chunk was present, but the end points can also come from iCCP or sRGB
|
* chunk was present, but the end points can also come from iCCP or sRGB
|
||||||
* chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and
|
* chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and
|
||||||
|
@ -533,8 +533,6 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "cHRM");
|
|
||||||
|
|
||||||
if (white_x != NULL)
|
if (white_x != NULL)
|
||||||
*white_x = png_float(png_ptr,
|
*white_x = png_float(png_ptr,
|
||||||
info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
|
info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
|
||||||
|
@ -559,10 +557,10 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
if (blue_y != NULL)
|
if (blue_y != NULL)
|
||||||
*blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
|
*blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
|
||||||
"cHRM blue Y");
|
"cHRM blue Y");
|
||||||
return (PNG_INFO_cHRM);
|
return PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
@ -571,11 +569,11 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
|
double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
|
||||||
double *blue_Z)
|
double *blue_Z)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
|
|
||||||
|
|
||||||
if (red_X != NULL)
|
if (red_X != NULL)
|
||||||
*red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
|
*red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
|
||||||
"cHRM red X");
|
"cHRM red X");
|
||||||
|
@ -603,10 +601,10 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
if (blue_Z != NULL)
|
if (blue_Z != NULL)
|
||||||
*blue_Z = png_float(png_ptr,
|
*blue_Z = png_float(png_ptr,
|
||||||
info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
|
info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
|
||||||
return (PNG_INFO_cHRM);
|
return PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
@ -619,11 +617,11 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
|
png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
|
||||||
png_fixed_point *int_blue_Z)
|
png_fixed_point *int_blue_Z)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
|
|
||||||
|
|
||||||
if (int_red_X != NULL)
|
if (int_red_X != NULL)
|
||||||
*int_red_X = info_ptr->colorspace.end_points_XYZ.red_X;
|
*int_red_X = info_ptr->colorspace.end_points_XYZ.red_X;
|
||||||
if (int_red_Y != NULL)
|
if (int_red_Y != NULL)
|
||||||
|
@ -642,10 +640,10 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
*int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y;
|
*int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y;
|
||||||
if (int_blue_Z != NULL)
|
if (int_blue_Z != NULL)
|
||||||
*int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z;
|
*int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z;
|
||||||
return (PNG_INFO_cHRM);
|
return PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
@ -675,10 +673,10 @@ png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
*blue_x = info_ptr->colorspace.end_points_xy.bluex;
|
*blue_x = info_ptr->colorspace.end_points_xy.bluex;
|
||||||
if (blue_y != NULL)
|
if (blue_y != NULL)
|
||||||
*blue_y = info_ptr->colorspace.end_points_xy.bluey;
|
*blue_y = info_ptr->colorspace.end_points_xy.bluey;
|
||||||
return (PNG_INFO_cHRM);
|
return PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -696,10 +694,10 @@ png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
file_gamma != NULL)
|
file_gamma != NULL)
|
||||||
{
|
{
|
||||||
*file_gamma = info_ptr->colorspace.gamma;
|
*file_gamma = info_ptr->colorspace.gamma;
|
||||||
return (PNG_INFO_gAMA);
|
return PNG_INFO_gAMA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
@ -716,10 +714,10 @@ png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
{
|
{
|
||||||
*file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
|
*file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
|
||||||
"png_get_gAMA");
|
"png_get_gAMA");
|
||||||
return (PNG_INFO_gAMA);
|
return PNG_INFO_gAMA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -735,10 +733,10 @@ png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
(info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
|
(info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
|
||||||
{
|
{
|
||||||
*file_srgb_intent = info_ptr->colorspace.rendering_intent;
|
*file_srgb_intent = info_ptr->colorspace.rendering_intent;
|
||||||
return (PNG_INFO_sRGB);
|
return PNG_INFO_sRGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -762,10 +760,10 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
*/
|
*/
|
||||||
if (compression_type != NULL)
|
if (compression_type != NULL)
|
||||||
*compression_type = PNG_COMPRESSION_TYPE_BASE;
|
*compression_type = PNG_COMPRESSION_TYPE_BASE;
|
||||||
return (PNG_INFO_iCCP);
|
return PNG_INFO_iCCP;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -775,13 +773,15 @@ int PNGAPI
|
||||||
png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_sPLT_tpp spalettes)
|
png_sPLT_tpp spalettes)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "sPLT");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
|
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
|
||||||
{
|
{
|
||||||
*spalettes = info_ptr->splt_palettes;
|
*spalettes = info_ptr->splt_palettes;
|
||||||
return info_ptr->splt_palettes_num;
|
return info_ptr->splt_palettes_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -807,10 +807,10 @@ png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
{
|
{
|
||||||
*num_exif = info_ptr->num_exif;
|
*num_exif = info_ptr->num_exif;
|
||||||
*exif = info_ptr->exif;
|
*exif = info_ptr->exif;
|
||||||
return (PNG_INFO_eXIf);
|
return PNG_INFO_eXIf;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -825,10 +825,10 @@ png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
(info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
|
(info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
|
||||||
{
|
{
|
||||||
*hist = info_ptr->hist;
|
*hist = info_ptr->hist;
|
||||||
return (PNG_INFO_hIST);
|
return PNG_INFO_hIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
png_debug1(1, "in %s retrieval function", "IHDR");
|
png_debug1(1, "in %s retrieval function", "IHDR");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
if (width != NULL)
|
if (width != NULL)
|
||||||
*width = info_ptr->width;
|
*width = info_ptr->width;
|
||||||
|
@ -873,7 +873,7 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
|
info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
|
||||||
info_ptr->compression_type, info_ptr->filter_type);
|
info_ptr->compression_type, info_ptr->filter_type);
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
@ -890,10 +890,10 @@ png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
*offset_x = info_ptr->x_offset;
|
*offset_x = info_ptr->x_offset;
|
||||||
*offset_y = info_ptr->y_offset;
|
*offset_y = info_ptr->y_offset;
|
||||||
*unit_type = (int)info_ptr->offset_unit_type;
|
*unit_type = (int)info_ptr->offset_unit_type;
|
||||||
return (PNG_INFO_oFFs);
|
return PNG_INFO_oFFs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -917,10 +917,10 @@ png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
*nparams = (int)info_ptr->pcal_nparams;
|
*nparams = (int)info_ptr->pcal_nparams;
|
||||||
*units = info_ptr->pcal_units;
|
*units = info_ptr->pcal_units;
|
||||||
*params = info_ptr->pcal_params;
|
*params = info_ptr->pcal_params;
|
||||||
return (PNG_INFO_pCAL);
|
return PNG_INFO_pCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -932,6 +932,8 @@ png_uint_32 PNGAPI
|
||||||
png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
int *unit, png_fixed_point *width, png_fixed_point *height)
|
int *unit, png_fixed_point *width, png_fixed_point *height)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "sCAL");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||||
{
|
{
|
||||||
|
@ -943,10 +945,10 @@ png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
*width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
|
*width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
|
||||||
*height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
|
*height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
|
||||||
"sCAL height");
|
"sCAL height");
|
||||||
return (PNG_INFO_sCAL);
|
return PNG_INFO_sCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif /* FLOATING_ARITHMETIC */
|
# endif /* FLOATING_ARITHMETIC */
|
||||||
# endif /* FIXED_POINT */
|
# endif /* FIXED_POINT */
|
||||||
|
@ -955,32 +957,36 @@ png_uint_32 PNGAPI
|
||||||
png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
int *unit, double *width, double *height)
|
int *unit, double *width, double *height)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "sCAL(float)");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||||
{
|
{
|
||||||
*unit = info_ptr->scal_unit;
|
*unit = info_ptr->scal_unit;
|
||||||
*width = atof(info_ptr->scal_s_width);
|
*width = atof(info_ptr->scal_s_width);
|
||||||
*height = atof(info_ptr->scal_s_height);
|
*height = atof(info_ptr->scal_s_height);
|
||||||
return (PNG_INFO_sCAL);
|
return PNG_INFO_sCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
# endif /* FLOATING POINT */
|
# endif /* FLOATING POINT */
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
int *unit, png_charpp width, png_charpp height)
|
int *unit, png_charpp width, png_charpp height)
|
||||||
{
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function", "sCAL(str)");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||||
{
|
{
|
||||||
*unit = info_ptr->scal_unit;
|
*unit = info_ptr->scal_unit;
|
||||||
*width = info_ptr->scal_s_width;
|
*width = info_ptr->scal_s_width;
|
||||||
*height = info_ptr->scal_s_height;
|
*height = info_ptr->scal_s_height;
|
||||||
return (PNG_INFO_sCAL);
|
return PNG_INFO_sCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* sCAL */
|
#endif /* sCAL */
|
||||||
|
|
||||||
|
@ -1015,7 +1021,7 @@ png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (retval);
|
return retval;
|
||||||
}
|
}
|
||||||
#endif /* pHYs */
|
#endif /* pHYs */
|
||||||
|
|
||||||
|
@ -1031,10 +1037,10 @@ png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
*palette = info_ptr->palette;
|
*palette = info_ptr->palette;
|
||||||
*num_palette = info_ptr->num_palette;
|
*num_palette = info_ptr->num_palette;
|
||||||
png_debug1(3, "num_palette = %d", *num_palette);
|
png_debug1(3, "num_palette = %d", *num_palette);
|
||||||
return (PNG_INFO_PLTE);
|
return PNG_INFO_PLTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_sBIT_SUPPORTED
|
#ifdef PNG_sBIT_SUPPORTED
|
||||||
|
@ -1048,10 +1054,10 @@ png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
(info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
|
(info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
|
||||||
{
|
{
|
||||||
*sig_bit = &(info_ptr->sig_bit);
|
*sig_bit = &(info_ptr->sig_bit);
|
||||||
return (PNG_INFO_sBIT);
|
return PNG_INFO_sBIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1062,7 +1068,7 @@ png_get_text(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
|
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in 0x%lx retrieval function",
|
png_debug1(1, "in text retrieval function, chunk typeid = 0x%lx",
|
||||||
(unsigned long)png_ptr->chunk_name);
|
(unsigned long)png_ptr->chunk_name);
|
||||||
|
|
||||||
if (text_ptr != NULL)
|
if (text_ptr != NULL)
|
||||||
|
@ -1077,7 +1083,7 @@ png_get_text(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (num_text != NULL)
|
if (num_text != NULL)
|
||||||
*num_text = 0;
|
*num_text = 0;
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1092,10 +1098,10 @@ png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
(info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
|
(info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
|
||||||
{
|
{
|
||||||
*mod_time = &(info_ptr->mod_time);
|
*mod_time = &(info_ptr->mod_time);
|
||||||
return (PNG_INFO_tIME);
|
return PNG_INFO_tIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1105,11 +1111,12 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
|
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
|
||||||
{
|
{
|
||||||
png_uint_32 retval = 0;
|
png_uint_32 retval = 0;
|
||||||
|
|
||||||
|
png_debug1(1, "in %s retrieval function", "tRNS");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_tRNS) != 0)
|
(info_ptr->valid & PNG_INFO_tRNS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "tRNS");
|
|
||||||
|
|
||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
if (trans_alpha != NULL)
|
if (trans_alpha != NULL)
|
||||||
|
@ -1141,7 +1148,7 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (retval);
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1156,7 +1163,7 @@ png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
return info_ptr->unknown_chunks_num;
|
return info_ptr->unknown_chunks_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1252,7 +1259,7 @@ png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr)
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
return png_ptr->num_palette_max;
|
return png_ptr->num_palette_max;
|
||||||
|
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
|
|
||||||
/* pnglibconf.h - library build configuration */
|
/* pnglibconf.h - library build configuration */
|
||||||
|
|
||||||
/* libpng version 1.6.40 */
|
/* libpng version 1.6.42 */
|
||||||
|
|
||||||
/* Copyright (c) 2018-2023 Cosmin Truta */
|
/* Copyright (c) 2018-2024 Cosmin Truta */
|
||||||
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
|
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
|
||||||
|
|
||||||
/* This code is released under the libpng license. */
|
/* This code is released under the libpng license. */
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#define PNG_COLORSPACE_SUPPORTED
|
#define PNG_COLORSPACE_SUPPORTED
|
||||||
#define PNG_CONSOLE_IO_SUPPORTED
|
#define PNG_CONSOLE_IO_SUPPORTED
|
||||||
#define PNG_CONVERT_tIME_SUPPORTED
|
#define PNG_CONVERT_tIME_SUPPORTED
|
||||||
|
/*#undef PNG_DISABLE_ADLER32_CHECK_SUPPORTED*/
|
||||||
#define PNG_EASY_ACCESS_SUPPORTED
|
#define PNG_EASY_ACCESS_SUPPORTED
|
||||||
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
|
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
|
||||||
#define PNG_ERROR_TEXT_SUPPORTED
|
#define PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
@ -50,6 +51,10 @@
|
||||||
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
||||||
#define PNG_INFO_IMAGE_SUPPORTED
|
#define PNG_INFO_IMAGE_SUPPORTED
|
||||||
#define PNG_IO_STATE_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_MNG_FEATURES_SUPPORTED
|
||||||
#define PNG_POINTER_INDEXING_SUPPORTED
|
#define PNG_POINTER_INDEXING_SUPPORTED
|
||||||
/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
|
/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -145,10 +145,10 @@ png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
num_to_check);
|
num_to_check);
|
||||||
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
|
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
|
||||||
|
|
||||||
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
|
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
|
||||||
{
|
{
|
||||||
if (num_checked < 4 &&
|
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");
|
png_error(png_ptr, "Not a PNG file");
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -1089,7 +1089,7 @@ png_voidp PNGAPI
|
||||||
png_get_progressive_ptr(png_const_structrp png_ptr)
|
png_get_progressive_ptr(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
return png_ptr->io_ptr;
|
return png_ptr->io_ptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
/*
|
|
||||||
* FLTK symbol prefixes for libpng
|
|
||||||
* This is a generated file: see README.bundled-libs.txt
|
|
||||||
*/
|
|
||||||
#define png_sRGB_table fltk_png_sRGB_table
|
#define png_sRGB_table fltk_png_sRGB_table
|
||||||
#define png_sRGB_base fltk_png_sRGB_base
|
#define png_sRGB_base fltk_png_sRGB_base
|
||||||
#define png_sRGB_delta fltk_png_sRGB_delta
|
#define png_sRGB_delta fltk_png_sRGB_delta
|
||||||
|
|
118
png/pngpriv.h
118
png/pngpriv.h
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngpriv.h - private declarations for use inside libpng
|
/* pngpriv.h - private declarations for use inside libpng
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2023 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
* still required (as of 2011-05-02.)
|
* still required (as of 2011-05-02.)
|
||||||
*/
|
*/
|
||||||
#ifndef _POSIX_SOURCE
|
#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
|
#endif
|
||||||
|
|
||||||
#ifndef PNG_VERSION_INFO_ONLY
|
#ifndef PNG_VERSION_INFO_ONLY
|
||||||
|
@ -190,13 +190,27 @@
|
||||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||||
|
|
||||||
#ifndef PNG_MIPS_MSA_OPT
|
#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
|
# define PNG_MIPS_MSA_OPT 2
|
||||||
# else
|
# else
|
||||||
# define PNG_MIPS_MSA_OPT 0
|
# define PNG_MIPS_MSA_OPT 0
|
||||||
# endif
|
# endif
|
||||||
#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
|
#ifndef PNG_POWERPC_VSX_OPT
|
||||||
# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
|
# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
|
||||||
# define PNG_POWERPC_VSX_OPT 2
|
# define PNG_POWERPC_VSX_OPT 2
|
||||||
|
@ -205,13 +219,21 @@
|
||||||
# endif
|
# endif
|
||||||
#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
|
#ifndef PNG_INTEL_SSE_OPT
|
||||||
# ifdef PNG_INTEL_SSE
|
# ifdef PNG_INTEL_SSE
|
||||||
/* Only check for SSE if the build configuration has been modified to
|
/* Only check for SSE if the build configuration has been modified to
|
||||||
* enable SSE optimizations. This means that these optimizations will
|
* enable SSE optimizations. This means that these optimizations will
|
||||||
* be off by default. See contrib/intel for more details.
|
* 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(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
|
||||||
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
|
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
|
||||||
# define PNG_INTEL_SSE_OPT 1
|
# define PNG_INTEL_SSE_OPT 1
|
||||||
|
@ -248,7 +270,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PNG_MIPS_MSA_OPT > 0
|
#if PNG_MIPS_MSA_OPT > 0
|
||||||
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
|
|
||||||
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
||||||
# if defined(__mips_msa)
|
# if defined(__mips_msa)
|
||||||
# if defined(__clang__)
|
# if defined(__clang__)
|
||||||
|
@ -264,11 +285,28 @@
|
||||||
|
|
||||||
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
||||||
# define PNG_MIPS_MSA_IMPLEMENTATION 1
|
# define PNG_MIPS_MSA_IMPLEMENTATION 1
|
||||||
|
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define PNG_MIPS_MSA_IMPLEMENTATION 0
|
# define PNG_MIPS_MSA_IMPLEMENTATION 0
|
||||||
#endif /* PNG_MIPS_MSA_OPT > 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
|
#if PNG_POWERPC_VSX_OPT > 0
|
||||||
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
|
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
|
||||||
# define PNG_POWERPC_VSX_IMPLEMENTATION 1
|
# define PNG_POWERPC_VSX_IMPLEMENTATION 1
|
||||||
|
@ -276,6 +314,12 @@
|
||||||
# define PNG_POWERPC_VSX_IMPLEMENTATION 0
|
# define PNG_POWERPC_VSX_IMPLEMENTATION 0
|
||||||
#endif
|
#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
|
/* 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
|
* different preprocessor settings to those required for a simple library? If
|
||||||
|
@ -514,18 +558,8 @@
|
||||||
*/
|
*/
|
||||||
# include <float.h>
|
# include <float.h>
|
||||||
|
|
||||||
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
|
# include <math.h>
|
||||||
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
|
|
||||||
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
|
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
|
||||||
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
|
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
|
||||||
* MATH=68881
|
* 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);
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
#endif
|
#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_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_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
|
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);
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
#endif
|
#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
|
#if PNG_POWERPC_VSX_OPT > 0
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info,
|
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);
|
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);
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
#endif
|
#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 */
|
/* Choose the best filter to use and filter the row data */
|
||||||
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
|
||||||
png_row_infop row_info),PNG_EMPTY);
|
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);
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PNG_MIPS_MSA_OPT > 0
|
#if PNG_MIPS_MSA_IMPLEMENTATION == 1
|
||||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
|
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips,
|
||||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
#endif
|
#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
|
# if PNG_INTEL_SSE_IMPLEMENTATION > 0
|
||||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
|
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
|
||||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
# endif
|
# endif
|
||||||
#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_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
|
||||||
png_const_charp key, png_bytep new_key), PNG_EMPTY);
|
png_const_charp key, png_bytep new_key), PNG_EMPTY);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -568,7 +568,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
#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);
|
png_do_read_transformations(png_ptr, &row_info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -785,7 +785,7 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
/* Report invalid palette index; added at libng-1.5.10 */
|
/* Report invalid palette index; added at libng-1.5.10 */
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
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");
|
png_benign_error(png_ptr, "Read palette index exceeding num_palette");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1049,6 +1049,8 @@ void PNGAPI
|
||||||
png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
int transforms, voidp params)
|
int transforms, voidp params)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_read_png");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -290,7 +290,7 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
|
||||||
int compose = 0;
|
int compose = 0;
|
||||||
png_fixed_point file_gamma;
|
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)
|
if (png_rtran_ok(png_ptr, 0) == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -970,7 +970,7 @@ void PNGFAPI
|
||||||
png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
|
png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
|
||||||
png_fixed_point red, png_fixed_point green)
|
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. */
|
/* Need the IHDR here because of the check on color_type below. */
|
||||||
/* TODO: fix this */
|
/* TODO: fix this */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -26,7 +26,7 @@ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
|
||||||
if (uval > PNG_UINT_31_MAX)
|
if (uval > PNG_UINT_31_MAX)
|
||||||
png_error(png_ptr, "PNG unsigned integer out of range");
|
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)
|
#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 (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
|
||||||
{
|
{
|
||||||
if (num_checked < 4 &&
|
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");
|
png_error(png_ptr, "Not a PNG file");
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
|
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. */
|
/* Put the chunk name into png_ptr->chunk_name. */
|
||||||
png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(buf+4);
|
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);
|
(unsigned long)png_ptr->chunk_name, (unsigned long)length);
|
||||||
|
|
||||||
/* Reset the crc and run it over the chunk name. */
|
/* 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
|
else
|
||||||
png_chunk_error(png_ptr, "CRC error");
|
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
|
/* 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)
|
if (need_crc != 0)
|
||||||
{
|
{
|
||||||
crc = png_get_uint_32(crc_bytes);
|
crc = png_get_uint_32(crc_bytes);
|
||||||
return ((int)(crc != png_ptr->crc));
|
return crc != png_ptr->crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
|
#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;
|
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ZLIB_VERNUM >= 0x1290 && \
|
#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
|
||||||
defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
|
|
||||||
if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
|
if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
|
||||||
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
|
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
|
||||||
ret = inflateValidate(&png_ptr->zstream, 0);
|
ret = inflateValidate(&png_ptr->zstream, 0);
|
||||||
|
|
22
png/pngset.c
22
png/pngset.c
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2023 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -763,11 +763,11 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
png_debug1(1, "in %lx storage function", png_ptr == NULL ? 0xabadca11U :
|
png_debug1(1, "in text storage function, chunk typeid = 0x%lx",
|
||||||
(unsigned long)png_ptr->chunk_name);
|
png_ptr == NULL ? 0xabadca11UL : (unsigned long)png_ptr->chunk_name);
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
|
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
|
/* 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
|
* 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);
|
png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1063,6 +1063,8 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||||
{
|
{
|
||||||
png_sPLT_tp np;
|
png_sPLT_tp np;
|
||||||
|
|
||||||
|
png_debug1(1, "in %s storage function", "sPLT");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL || nentries <= 0 || entries == NULL)
|
if (png_ptr == NULL || info_ptr == NULL || nentries <= 0 || entries == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1537,7 +1539,7 @@ void PNGAPI
|
||||||
png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_bytepp row_pointers)
|
png_bytepp row_pointers)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s storage function", "rows");
|
png_debug(1, "in png_set_rows");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -1556,6 +1558,8 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_compression_buffer_size(png_structrp png_ptr, size_t size)
|
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)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1627,6 +1631,8 @@ void PNGAPI
|
||||||
png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max,
|
png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max,
|
||||||
png_uint_32 user_height_max)
|
png_uint_32 user_height_max)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_set_user_limits");
|
||||||
|
|
||||||
/* Images with dimensions larger than these limits will be
|
/* Images with dimensions larger than these limits will be
|
||||||
* rejected by png_set_IHDR(). To accept any PNG datastream
|
* rejected by png_set_IHDR(). To accept any PNG datastream
|
||||||
* regardless of dimensions, set both limits to 0x7fffffff.
|
* 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
|
void PNGAPI
|
||||||
png_set_chunk_cache_max(png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
|
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)
|
if (png_ptr != NULL)
|
||||||
png_ptr->user_chunk_cache_max = user_chunk_cache_max;
|
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_set_chunk_malloc_max(png_structrp png_ptr,
|
||||||
png_alloc_size_t user_chunk_malloc_max)
|
png_alloc_size_t user_chunk_malloc_max)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_set_chunk_malloc_max");
|
||||||
|
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
|
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* 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) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -103,10 +103,10 @@ png_set_interlace_handling(png_structrp png_ptr)
|
||||||
if (png_ptr != 0 && png_ptr->interlaced != 0)
|
if (png_ptr != 0 && png_ptr->interlaced != 0)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_INTERLACE;
|
png_ptr->transformations |= PNG_INTERLACE;
|
||||||
return (7);
|
return 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#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 dp = row; /* destination pointer */
|
||||||
png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */
|
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
|
/* 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
|
* 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.
|
* 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 */
|
void /* PRIVATE */
|
||||||
png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
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) &&
|
if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
|
||||||
png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */
|
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.
|
* forms produced on either GCC or MSVC.
|
||||||
*/
|
*/
|
||||||
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
|
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)
|
switch (row_info->bit_depth)
|
||||||
{
|
{
|
||||||
|
@ -833,7 +837,7 @@ png_voidp PNGAPI
|
||||||
png_get_user_transform_ptr(png_const_structrp png_ptr)
|
png_get_user_transform_ptr(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
return png_ptr->user_transform_ptr;
|
return png_ptr->user_transform_ptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2023 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -369,7 +369,8 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
png_error(png_ptr, "No IDATs written into file");
|
png_error(png_ptr, "No IDATs written into file");
|
||||||
|
|
||||||
#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
#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");
|
png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
|
||||||
#endif
|
#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: */
|
/* 1.5.6: moved from png_struct to be a local structure: */
|
||||||
png_row_info row_info;
|
png_row_info row_info;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
png_debug2(1, "in png_write_row (row %u, pass %d)",
|
png_debug2(1, "in png_write_row (row %u, pass %d)",
|
||||||
png_ptr->row_number, png_ptr->pass);
|
png_ptr->row_number, png_ptr->pass);
|
||||||
|
|
||||||
|
if (png_ptr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Initialize transformations and other stuff if first time */
|
/* Initialize transformations and other stuff if first time */
|
||||||
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
|
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
|
void PNGAPI
|
||||||
png_set_compression_window_bits(png_structrp png_ptr, int window_bits)
|
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)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1293,6 +1296,8 @@ png_set_text_compression_strategy(png_structrp png_ptr, int strategy)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_text_compression_window_bits(png_structrp png_ptr, int window_bits)
|
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)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1330,6 +1335,8 @@ png_set_text_compression_method(png_structrp png_ptr, int method)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_write_status_fn(png_structrp png_ptr, png_write_status_ptr write_row_fn)
|
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)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1357,6 +1364,8 @@ void PNGAPI
|
||||||
png_write_png(png_structrp png_ptr, png_inforp info_ptr,
|
png_write_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
int transforms, voidp params)
|
int transforms, voidp params)
|
||||||
{
|
{
|
||||||
|
png_debug(1, "in png_write_png");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2022 Cosmin Truta
|
* Copyright (c) 2018-2024 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
@ -2311,7 +2311,7 @@ png_setup_sub_row(png_structrp png_ptr, png_uint_32 bpp,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (sum);
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
|
@ -2361,7 +2361,7 @@ png_setup_up_row(png_structrp png_ptr, size_t row_bytes, size_t lmins)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (sum);
|
return sum;
|
||||||
}
|
}
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_setup_up_row_only(png_structrp png_ptr, size_t row_bytes)
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (sum);
|
return sum;
|
||||||
}
|
}
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_setup_avg_row_only(png_structrp png_ptr, png_uint_32 bpp,
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (sum);
|
return sum;
|
||||||
}
|
}
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_setup_paeth_row_only(png_structrp png_ptr, png_uint_32 bpp,
|
png_setup_paeth_row_only(png_structrp png_ptr, png_uint_32 bpp,
|
||||||
|
|
Loading…
Reference in New Issue