From 59c24f737306176e778b495077ce8c61fec2c5c7 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 30 Aug 2011 19:08:40 +0930 Subject: [PATCH] Fix compile error with libpng >= 1.5.0 libpng 1.5.0 changed one of the types in the png_set_iCCP() function prototype. --- goo/PNGWriter.cc | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/goo/PNGWriter.cc b/goo/PNGWriter.cc index d47efa6..f88c3a7 100644 --- a/goo/PNGWriter.cc +++ b/goo/PNGWriter.cc @@ -56,6 +56,13 @@ void PNGWriter::setSRGBProfile() bool PNGWriter::init(FILE *f, int width, int height, int hDPI, int vDPI) { + /* libpng changed the png_set_iCCP() prototype in 1.5.0 */ +#if PNG_LIBPNG_VER < 10500 + png_charp icc_data_ptr = (png_charp)icc_data; +#else + png_const_bytep icc_data_ptr = (png_const_bytep)icc_data; +#endif + /* initialize stuff */ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { @@ -112,7 +119,7 @@ bool PNGWriter::init(FILE *f, int width, int height, int hDPI, int vDPI) png_set_pHYs(png_ptr, info_ptr, hDPI/0.0254, vDPI/0.0254, PNG_RESOLUTION_METER); if (icc_data) - png_set_iCCP(png_ptr, info_ptr, icc_name, PNG_COMPRESSION_TYPE_BASE, (char*)icc_data, icc_data_size); + png_set_iCCP(png_ptr, info_ptr, icc_name, PNG_COMPRESSION_TYPE_BASE, icc_data_ptr, icc_data_size); else if (sRGB_profile) png_set_sRGB(png_ptr, info_ptr, PNG_sRGB_INTENT_RELATIVE); -- 1.7.4.1