goo/PNGWriter.cc |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit bf2cb5c9c47b4a61192101f0a48771657228e383
Author: Adrian Johnson <[email protected]>
Date:   Tue Aug 30 19:08:40 2011 +0930

    Fix compile error with libpng >= 1.5.0
    
    libpng 1.5.0 changed one of the types in the png_set_iCCP() function 
prototype.

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);
 
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to