From 7e2aab171fd9a46c934f5d2c8c94f161f282482d Mon Sep 17 00:00:00 2001 From: Mickey Rose Date: Wed, 1 Feb 2017 03:01:38 +0100 Subject: [PATCH 1/3] 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/3] 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) From f85636f769efa49af8f9da8410cf1ca1e04ed982 Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 3 Feb 2017 10:10:09 +0100 Subject: [PATCH 3/3] mapnik-index - log and return on invalid bounding box if `validate_features` is set. --- utils/mapnik-index/process_geojson_file_x3.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/mapnik-index/process_geojson_file_x3.cpp b/utils/mapnik-index/process_geojson_file_x3.cpp index d0472738e..c55989bc7 100644 --- a/utils/mapnik-index/process_geojson_file_x3.cpp +++ b/utils/mapnik-index/process_geojson_file_x3.cpp @@ -316,6 +316,11 @@ std::pair process_geojson_file_x3(T & b } } } + else if (validate_features) + { + if (verbose) std::clog << "Invalid bbox encountered " << item.first << std::endl; + return std::make_pair(false, extent); + } } return std::make_pair(true, extent); }