From 7e2aab171fd9a46c934f5d2c8c94f161f282482d Mon Sep 17 00:00:00 2001 From: Mickey Rose Date: Wed, 1 Feb 2017 03:01:38 +0100 Subject: [PATCH 1/2] include png.h outside any namespace --- src/image_options.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/image_options.cpp b/src/image_options.cpp index 441a6f0e4..fedf1f976 100644 --- a/src/image_options.cpp +++ b/src/image_options.cpp @@ -28,6 +28,13 @@ #include #pragma GCC diagnostic pop +#if defined(HAVE_PNG) +extern "C" +{ +#include +} +#endif // HAVE_PNG + namespace mapnik { namespace grammar { namespace x3 = boost::spirit::x3; @@ -76,10 +83,6 @@ image_options_map parse_image_options(std::string const& str) } #if defined(HAVE_PNG) -extern "C" -{ -#include -} int parse_png_filters(std::string const& str) { @@ -113,6 +116,7 @@ int parse_png_filters(std::string const& str) std::for_each(opts.begin(), opts.end(), [&filters] (int f) { filters |= f;}); return filters; } -#endif + +#endif // HAVE_PNG } // ns mapnik From 8e34b323b515cf4d5c1f694fada63227f7d15f1b Mon Sep 17 00:00:00 2001 From: Mickey Rose Date: Wed, 1 Feb 2017 03:02:37 +0100 Subject: [PATCH 2/2] define PNG_FAST_FILTERS if png.h doesn't have it --- src/image_util_png.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/image_util_png.cpp b/src/image_util_png.cpp index 77882b3f3..0586ded06 100644 --- a/src/image_util_png.cpp +++ b/src/image_util_png.cpp @@ -25,7 +25,10 @@ extern "C" { #include } +#ifndef PNG_FAST_FILTERS // libpng < 1.6 +#define PNG_FAST_FILTERS ( PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP ) #endif +#endif // HAVE_PNG // mapnik #if defined(HAVE_PNG)