Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: Raise libPNG minimum to 1.6.0 #4355

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
deps: Raise libPNG minimum to 1.6.0
Raised from 1.5.13 (maybe? we never carefully checked) to 1.6.0
minimum, which was released in 2013 (so absolutely nobody should be
bothered by this).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
  • Loading branch information
lgritz committed Jul 22, 2024
commit a613b7b83ee81a1497591a09a9e696a8187d5f43
2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
* **Python >= 3.7** (tested through 3.12)
* **pybind11 >= 2.7** (tested through 2.12)
* NumPy
* If you want support for PNG files:
* **libPNG >= 1.6.0** (tested though 1.6.43)
* If you want support for camera "RAW" formats:
* **LibRaw >= 0.20** (tested though 0.21.2)
* If you want support for a wide variety of video formats:
Expand Down
2 changes: 1 addition & 1 deletion src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ endif ()
# Dependencies for optional formats and features. If these are not found,
# we will continue building, but the related functionality will be disabled.

checked_find_package (PNG)
checked_find_package (PNG VERSION_MIN 1.6.0)

checked_find_package (BZip2) # Used by ffmpeg and freetype
if (NOT BZIP2_FOUND)
Expand Down
17 changes: 3 additions & 14 deletions src/png.imageio/png_pvt.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,8 @@ read_info(png_structp& sp, png_infop& ip, int& bit_depth, int& color_type,
}

if (png_get_valid(sp, ip, PNG_INFO_iCCP)) {
png_charp profile_name = NULL;
#if OIIO_LIBPNG_VERSION > 10500 /* PNG function signatures changed */
png_bytep profile_data = NULL;
#else
png_charp profile_data = NULL;
#endif
png_charp profile_name = nullptr;
png_bytep profile_data = nullptr;
png_uint_32 profile_length = 0;
int compression_type;
png_get_iCCP(sp, ip, &profile_name, &compression_type, &profile_data,
Expand Down Expand Up @@ -628,21 +624,14 @@ write_info(png_structp& sp, png_infop& ip, int& color_type, ImageSpec& spec,
// Write ICC profile, if we have anything
const ParamValue* icc_profile_parameter = spec.find_attribute(
ICC_PROFILE_ATTR);
if (icc_profile_parameter != NULL) {
if (icc_profile_parameter != nullptr) {
unsigned int length = icc_profile_parameter->type().size();
if (setjmp(png_jmpbuf(sp))) // NOLINT(cert-err52-cpp)
return "Could not set PNG iCCP chunk";
#if OIIO_LIBPNG_VERSION > 10500 /* PNG function signatures changed */
unsigned char* icc_profile
= (unsigned char*)icc_profile_parameter->data();
if (icc_profile && length)
png_set_iCCP(sp, ip, "Embedded Profile", 0, icc_profile, length);
#else
char* icc_profile = (char*)icc_profile_parameter->data();
if (icc_profile && length)
png_set_iCCP(sp, ip, (png_charp) "Embedded Profile", 0, icc_profile,
length);
#endif
}

if (false && !spec.find_attribute("DateTime")) {
Expand Down
Loading