[mapnik-vector-tile] 03/15: Imported Upstream version 0.8.3+dfsg

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Sat Sep 12 11:06:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository mapnik-vector-tile.

commit 1e0d82855e0b1ae2095ceee78600c57bf24c967c
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri Sep 11 22:55:09 2015 +0200

    Imported Upstream version 0.8.3+dfsg
---
 CHANGELOG.md                         |  6 +++++
 Makefile                             |  2 +-
 examples/c++/tileinfo.cpp            | 42 ++++++++++++++++----------------
 gyp/build.gyp                        |  8 ++++--
 package.json                         |  2 +-
 src/vector_tile_backend_pbf.hpp      |  1 +
 src/vector_tile_backend_pbf.ipp      |  5 ++--
 src/vector_tile_datasource.ipp       |  5 ++++
 src/vector_tile_geometry_decoder.hpp |  5 ++++
 src/vector_tile_geometry_encoder.hpp | 47 +++++++++++++++++++++++++-----------
 src/vector_tile_processor.ipp        |  8 +++---
 src/vector_tile_util.ipp             |  5 ++++
 test/clipper_test.cpp                |  5 ++--
 test/encoding_util.hpp               |  3 ++-
 test/test_utils.cpp                  | 11 ++++-----
 test/vector_tile.cpp                 | 13 +++++-----
 test/vector_tile_pbf.cpp             |  7 +++++-
 17 files changed, 112 insertions(+), 63 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0f40bc6..ad096c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
 # Changelog
 
+## 0.8.3
+
+ - Minor optimization in attribute encoding by using `emplace` instead of `insert`
+ - Now depends on `pbf_writer.hpp` for zigzag implementation (no change in behavior)
+ - Minor code cleanup to avoid unnecessary compiler warnings
+
 ## 0.8.2
 
  - Optimized coordinate transform that skips proj4 failures (#116)
diff --git a/Makefile b/Makefile
index a518b5a..58085e4 100755
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 MAPNIK_PLUGINDIR := $(shell mapnik-config --input-plugins)
 BUILDTYPE ?= Release
 
-CLIPPER_REVISION=bfad32e
+CLIPPER_REVISION=e0973e0802
 PBF_REVISION=1df6453
 GYP_REVISION=3464008
 
diff --git a/examples/c++/tileinfo.cpp b/examples/c++/tileinfo.cpp
index 7a9ddca..fb1e532 100644
--- a/examples/c++/tileinfo.cpp
+++ b/examples/c++/tileinfo.cpp
@@ -83,16 +83,16 @@ int main(int argc, char** argv)
             }
         }
         if (!verbose) {
-            std::cout << "layers: " << tile.layers_size() << "\n";
-            for (unsigned i=0;i<tile.layers_size();++i)
+            std::cout << "layers: " << static_cast<std::size_t>(tile.layers_size()) << "\n";
+            for (std::size_t i=0;i<static_cast<std::size_t>(tile.layers_size());++i)
             {
                 vector_tile::Tile_Layer const& layer = tile.layers(i);
                 std::cout << layer.name() << ":\n";
                 std::cout << "  version: " << layer.version() << "\n";
                 std::cout << "  extent: " << layer.extent() << "\n";
-                std::cout << "  features: " << layer.features_size() << "\n";
-                std::cout << "  keys: " << layer.keys_size() << "\n";
-                std::cout << "  values: " << layer.values_size() << "\n";
+                std::cout << "  features: " << static_cast<std::size_t>(layer.features_size()) << "\n";
+                std::cout << "  keys: " << static_cast<std::size_t>(layer.keys_size()) << "\n";
+                std::cout << "  values: " << static_cast<std::size_t>(layer.values_size()) << "\n";
                 unsigned total_repeated = 0;
                 unsigned num_commands = 0;
                 unsigned num_move_to = 0;
@@ -100,7 +100,7 @@ int main(int argc, char** argv)
                 unsigned num_close = 0;
                 unsigned num_empty = 0;
                 unsigned degenerate = 0;
-                for (unsigned j=0;j<layer.features_size();++j)
+                for (std::size_t j=0;j<static_cast<std::size_t>(layer.features_size());++j)
                 {
                     vector_tile::Tile_Feature const & f = layer.features(j);
                     total_repeated += f.geometry_size();
@@ -158,26 +158,26 @@ int main(int argc, char** argv)
                 std::cout << "    empty geoms: " << num_empty << "\n";
             }
         } else {
-            for (unsigned i=0;i<tile.layers_size();++i)
+            for (std::size_t j=0;j<static_cast<std::size_t>(tile.layers_size());++j)
             {
-                vector_tile::Tile_Layer const& layer = tile.layers(i);
+                vector_tile::Tile_Layer const& layer = tile.layers(j);
                 std::cout << "layer: " << layer.name() << "\n";
                 std::cout << "  version: " << layer.version() << "\n";
                 std::cout << "  extent: " << layer.extent() << "\n";
                 std::cout << "  keys: ";
-                for (unsigned i=0;i<layer.keys_size();++i)
+                for (std::size_t k=0;k<static_cast<std::size_t>(layer.keys_size());++k)
                 {
-                     std::string const& key = layer.keys(i);
+                     std::string const& key = layer.keys(k);
                      std::cout << key;
-                     if (i<layer.keys_size()-1) {
+                     if (k<static_cast<std::size_t>(layer.keys_size())-1) {
                         std::cout << ",";
                      }
                 }
                 std::cout << "\n";
                 std::cout << "  values: ";
-                for (unsigned i=0;i<layer.values_size();++i)
+                for (std::size_t l=0;l<static_cast<std::size_t>(layer.values_size());++l)
                 {
-                     vector_tile::Tile_Value const & value = layer.values(i);
+                     vector_tile::Tile_Value const & value = layer.values(l);
                      if (value.has_string_value()) {
                           std::cout << value.string_value();
                      } else if (value.has_int_value()) {
@@ -195,14 +195,14 @@ int main(int argc, char** argv)
                      } else {
                           std::cout << "null";
                      }
-                     if (i<layer.values_size()-1) {
+                     if (l<static_cast<std::size_t>(layer.values_size())-1) {
                         std::cout << ",";
                      }
                  }
                  std::cout << "\n";
-                 for (unsigned i=0;i<layer.features_size();++i)
+                 for (std::size_t l=0;l<static_cast<std::size_t>(layer.features_size());++l)
                  {
-                     vector_tile::Tile_Feature const & feat = layer.features(i);
+                     vector_tile::Tile_Feature const & feat = layer.features(l);
                      std::cout << "  feature: " << feat.id() << "\n";
                      std::cout << "    type: ";
                      unsigned feat_type = feat.type();
@@ -217,21 +217,21 @@ int main(int argc, char** argv)
                      }
                      std::cout << "\n";
                      std::cout << "    tags: ";
-                     for (unsigned j=0;j<feat.tags_size();++j)
+                     for (std::size_t m=0;m<static_cast<std::size_t>(feat.tags_size());++m)
                      {
                           uint32_t tag = feat.tags(j);
                           std::cout << tag;
-                          if (j<feat.tags_size()-1) {
+                          if (m<static_cast<std::size_t>(feat.tags_size())-1) {
                             std::cout << ",";
                           }
                      }
                      std::cout << "\n";
                      std::cout << "    geometries: ";
-                     for (unsigned j=0;j<feat.geometry_size();++j)
+                     for (std::size_t m=0;m<static_cast<std::size_t>(feat.geometry_size());++m)
                      {
-                          uint32_t geom = feat.geometry(j);
+                          uint32_t geom = feat.geometry(m);
                           std::cout << geom;
-                          if (j<feat.geometry_size()-1) {
+                          if (m<static_cast<std::size_t>(feat.geometry_size())-1) {
                             std::cout << ",";
                           }
                      }
diff --git a/gyp/build.gyp b/gyp/build.gyp
index 5b976bc..5f363e6 100644
--- a/gyp/build.gyp
+++ b/gyp/build.gyp
@@ -46,12 +46,16 @@
       ],
       'cflags_cc' : [
           '-D_THREAD_SAFE',
-          '<!@(mapnik-config --cflags)' # assume protobuf headers are here
+          '<!@(mapnik-config --cflags)', # assume protobuf headers are here
+          '-Wno-sign-compare',
+          '-Wno-sign-conversion'
       ],
       'xcode_settings': {
         'OTHER_CPLUSPLUSFLAGS':[
            '-D_THREAD_SAFE',
-           '<!@(mapnik-config --cflags)' # assume protobuf headers are here
+           '<!@(mapnik-config --cflags)', # assume protobuf headers are here
+           '-Wno-sign-compare',
+           '-Wno-sign-conversion'
         ],
       },
       'direct_dependent_settings': {
diff --git a/package.json b/package.json
index 66b7b07..311f840 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
     "name": "mapnik-vector-tile",
-    "version": "0.8.2",
+    "version": "0.8.3",
     "description": "Mapnik vector tile API",
     "main": "./package.json",
     "repository"   :  {
diff --git a/src/vector_tile_backend_pbf.hpp b/src/vector_tile_backend_pbf.hpp
index 05c2bbe..3198e19 100644
--- a/src/vector_tile_backend_pbf.hpp
+++ b/src/vector_tile_backend_pbf.hpp
@@ -4,6 +4,7 @@
 // vector tile
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
 #include "vector_tile.pb.h"
 #pragma GCC diagnostic pop
 
diff --git a/src/vector_tile_backend_pbf.ipp b/src/vector_tile_backend_pbf.ipp
index 8b1792d..ee285c0 100644
--- a/src/vector_tile_backend_pbf.ipp
+++ b/src/vector_tile_backend_pbf.ipp
@@ -7,6 +7,7 @@
 // vector tile
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
 #include "vector_tile.pb.h"
 #pragma GCC diagnostic pop
 
@@ -110,7 +111,7 @@ void backend_pbf::start_tile_feature(mapnik::feature_impl const& feature)
                     // The key doesn't exist yet in the dictionary.
                     current_layer_->add_keys(name.c_str(), name.length());
                     size_t index = keys_.size();
-                    keys_.insert(keys_container::value_type(name, index));
+                    keys_.emplace(name, index);
                     current_feature_->add_tags(index);
                 }
                 else
@@ -126,7 +127,7 @@ void backend_pbf::start_tile_feature(mapnik::feature_impl const& feature)
                     to_tile_value visitor(current_layer_->add_values());
                     mapnik::util::apply_visitor(visitor, val);
                     size_t index = values_.size();
-                    values_.insert(values_container::value_type(val, index));
+                    values_.emplace(val, index);
                     current_feature_->add_tags(index);
                 }
                 else
diff --git a/src/vector_tile_datasource.ipp b/src/vector_tile_datasource.ipp
index 3ee0dc4..994a46a 100644
--- a/src/vector_tile_datasource.ipp
+++ b/src/vector_tile_datasource.ipp
@@ -1,4 +1,9 @@
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
 #include "vector_tile.pb.h"
+#pragma GCC diagnostic pop
+
 #include "vector_tile_projection.hpp"
 #include "vector_tile_geometry_decoder.hpp"
 
diff --git a/src/vector_tile_geometry_decoder.hpp b/src/vector_tile_geometry_decoder.hpp
index c0f1510..1a5d9da 100644
--- a/src/vector_tile_geometry_decoder.hpp
+++ b/src/vector_tile_geometry_decoder.hpp
@@ -1,7 +1,12 @@
 #ifndef __MAPNIK_VECTOR_TILE_GEOMETRY_DECODER_H__
 #define __MAPNIK_VECTOR_TILE_GEOMETRY_DECODER_H__
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
 #include "vector_tile.pb.h"
+#pragma GCC diagnostic pop
+
 #include "pbf_reader.hpp"
 
 #include <mapnik/util/is_clockwise.hpp>
diff --git a/src/vector_tile_geometry_encoder.hpp b/src/vector_tile_geometry_encoder.hpp
index dd95f8e..a4aae3d 100644
--- a/src/vector_tile_geometry_encoder.hpp
+++ b/src/vector_tile_geometry_encoder.hpp
@@ -2,9 +2,16 @@
 #define __MAPNIK_VECTOR_TILE_GEOMETRY_ENCODER_H__
 
 // vector tile
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
 #include "vector_tile.pb.h"
+#pragma GCC diagnostic pop
+
 #include <mapnik/geometry.hpp>
 #include "vector_tile_config.hpp"
+#include "pbf_writer.hpp"
+
 #include <cstdlib>
 #include <cmath>
 #include <sstream>
@@ -21,20 +28,29 @@ inline unsigned encode_geometry(mapnik::geometry::point<std::int64_t> const& pt,
     int32_t dx = pt.x - start_x;
     int32_t dy = pt.y - start_y;
     // Manual zigzag encoding.
-    current_feature.add_geometry((static_cast<unsigned>(dx) << 1) ^ (dx >> 31));
-    current_feature.add_geometry((static_cast<unsigned>(dy) << 1) ^ (dy >> 31));
+    current_feature.add_geometry(mapbox::util::pbf_writer::encode_zigzag32(dx));
+    current_feature.add_geometry(mapbox::util::pbf_writer::encode_zigzag32(dy));
     start_x = pt.x;
     start_y = pt.y;
     return 1;
 }
 
+inline unsigned encode_length(unsigned len)
+{
+    return (len << 3u) | 2u;
+}
+
 inline unsigned encode_geometry(mapnik::geometry::line_string<std::int64_t> const& line,
                         vector_tile::Tile_Feature & current_feature,
                         int32_t & start_x,
                         int32_t & start_y)
 {
-    const int cmd_bits = 3;
-    int32_t line_to_length = static_cast<int32_t>(line.size()) - 1;
+    std::size_t line_size = line.size();
+    if (line_size <= 0)
+    {
+        return 0;
+    }
+    unsigned line_to_length = static_cast<unsigned>(line_size) - 1;
 
     enum {
         move_to = 1,
@@ -52,13 +68,13 @@ inline unsigned encode_geometry(mapnik::geometry::line_string<std::int64_t> cons
         else if (status == line_to)
         {
             status = coords;
-            current_feature.add_geometry((line_to_length << cmd_bits) | 2); // len | (line_to << 3)
+            current_feature.add_geometry(encode_length(line_to_length));
         }
         int32_t dx = pt.x - start_x;
         int32_t dy = pt.y - start_y;
         // Manual zigzag encoding.
-        current_feature.add_geometry((static_cast<unsigned>(dx) << 1) ^ (dx >> 31));
-        current_feature.add_geometry((static_cast<unsigned>(dy) << 1) ^ (dy >> 31));
+        current_feature.add_geometry(mapbox::util::pbf_writer::encode_zigzag32(dx));
+        current_feature.add_geometry(mapbox::util::pbf_writer::encode_zigzag32(dy));
         start_x = pt.x;
         start_y = pt.y;
     }
@@ -70,10 +86,13 @@ inline unsigned encode_geometry(mapnik::geometry::linear_ring<std::int64_t> cons
                         int32_t & start_x,
                         int32_t & start_y)
 {
-    if (ring.size() < 3) return 0;
-    const int cmd_bits = 3;
-    int32_t line_to_length = static_cast<int32_t>(ring.size()) - 1;
-    int count = 0;
+    std::size_t ring_size = ring.size();
+    if (ring_size < 3)
+    {
+        return 0;
+    }
+    unsigned line_to_length = static_cast<unsigned>(ring_size) - 1;
+    unsigned count = 0;
     enum {
         move_to = 1,
         line_to = 2,
@@ -100,7 +119,7 @@ inline unsigned encode_geometry(mapnik::geometry::linear_ring<std::int64_t> cons
         else if (status == line_to)
         {
             status = coords;
-            current_feature.add_geometry((line_to_length<< cmd_bits) | 2); // len | (line_to << 3)
+            current_feature.add_geometry(encode_length(line_to_length));
         }
         else if (drop_last && count == line_to_length + 1)
         {
@@ -109,8 +128,8 @@ inline unsigned encode_geometry(mapnik::geometry::linear_ring<std::int64_t> cons
         int32_t dx = pt.x - start_x;
         int32_t dy = pt.y - start_y;
         // Manual zigzag encoding.
-        current_feature.add_geometry((static_cast<unsigned>(dx) << 1) ^ (dx >> 31));
-        current_feature.add_geometry((static_cast<unsigned>(dy) << 1) ^ (dy >> 31));
+        current_feature.add_geometry(mapbox::util::pbf_writer::encode_zigzag32(dx));
+        current_feature.add_geometry(mapbox::util::pbf_writer::encode_zigzag32(dy));
         start_x = pt.x;
         start_y = pt.y;
         ++count;
diff --git a/src/vector_tile_processor.ipp b/src/vector_tile_processor.ipp
index 27f7368..31ea8bf 100644
--- a/src/vector_tile_processor.ipp
+++ b/src/vector_tile_processor.ipp
@@ -28,9 +28,6 @@
 #include <mapnik/geometry_adapters.hpp>
 #include <mapnik/geometry_transform.hpp>
 
-// agg
-#include "agg_path_storage.h"
-
 // http://www.angusj.com/delphi/clipper.php
 #include "clipper.hpp"
 
@@ -51,6 +48,7 @@
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
 #include "vector_tile.pb.h"
 #pragma GCC diagnostic pop
 
@@ -861,7 +859,7 @@ struct encoder_visitor {
       buffered_query_ext_(buffered_query_ext),
       area_threshold_(area_threshold) {}
 
-    unsigned operator() (mapnik::geometry::geometry_empty const& geom)
+    unsigned operator() (mapnik::geometry::geometry_empty const&)
     {
         return 0;
     }
@@ -1222,7 +1220,7 @@ struct simplify_visitor {
         return count;
     }
 
-    unsigned operator() (mapnik::geometry::geometry_empty const& geom)
+    unsigned operator() (mapnik::geometry::geometry_empty const&)
     {
         return 0;
     }
diff --git a/src/vector_tile_util.ipp b/src/vector_tile_util.ipp
index 807659c..f7dfe44 100644
--- a/src/vector_tile_util.ipp
+++ b/src/vector_tile_util.ipp
@@ -1,4 +1,9 @@
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
 #include "vector_tile.pb.h"
+#pragma GCC diagnostic pop
+
 #include <mapnik/vertex.hpp>
 #include <mapnik/box2d.hpp>
 #include <mapnik/geometry.hpp>
diff --git a/test/clipper_test.cpp b/test/clipper_test.cpp
index d06b2bc..e3ae16a 100644
--- a/test/clipper_test.cpp
+++ b/test/clipper_test.cpp
@@ -22,7 +22,7 @@ TEST_CASE( "vector_tile_strategy", "should not overflow" ) {
     {
         mapnik::vector_tile_impl::vector_tile_strategy vs(prj_trans, tr, 16);
         // even an invalid point is not expected to result in values beyond hirange
-        mapnik::geometry::point<std::int64_t> g(-20037508.342789*2,-20037508.342789*2);
+        mapnik::geometry::point<double> g(-20037508.342789*2.0,-20037508.342789*2.0);
         mapnik::geometry::geometry<std::int64_t> new_geom = mapnik::geometry::transform<std::int64_t>(g, vs);
         REQUIRE( new_geom.is<mapnik::geometry::point<std::int64_t>>() );
         auto const& pt = mapnik::util::get<mapnik::geometry::point<std::int64_t>>(new_geom);
@@ -32,7 +32,7 @@ TEST_CASE( "vector_tile_strategy", "should not overflow" ) {
         REQUIRE( (-pt.y < ClipperLib::hiRange) );
     }
     merc_tiler.xyz(0,0,0,minx,miny,maxx,maxy);
-    mapnik::geometry::polygon<std::int64_t> g;
+    mapnik::geometry::polygon<double> g;
     g.exterior_ring.add_coord(minx,miny);
     g.exterior_ring.add_coord(maxx,miny);
     g.exterior_ring.add_coord(maxx,maxy);
@@ -73,7 +73,6 @@ TEST_CASE( "vector_tile_strategy", "should not overflow" ) {
                     ));
         }
     }
-
 }
 
 TEST_CASE( "clipper IntPoint", "should accept 64bit values" ) {
diff --git a/test/encoding_util.hpp b/test/encoding_util.hpp
index 5568c48..98b9fda 100644
--- a/test/encoding_util.hpp
+++ b/test/encoding_util.hpp
@@ -16,8 +16,9 @@ struct print
         std::cerr << "EMPTY" << std::endl;
     }
     template <typename T>
-    void operator() (geometry_collection<T> const& collection) const
+    void operator() (geometry_collection<T> const&) const
     {
+        std::cerr << "COLLECTION" << std::endl;
     }
     template <typename T>
     void operator() (T const& geom) const
diff --git a/test/test_utils.cpp b/test/test_utils.cpp
index b156662..02c2012 100644
--- a/test/test_utils.cpp
+++ b/test/test_utils.cpp
@@ -42,12 +42,11 @@ std::shared_ptr<mapnik::memory_datasource> build_ds(double x,double y, bool seco
     ds->push(feature);
     if (second) {
         ctx->push("name2");
-        mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1));
-        mapnik::transcoder tr("utf-8");
-        feature->put("name",tr.transcode("null island"));
-        feature->put("name2",tr.transcode("null island 2"));
-        feature->set_geometry(mapnik::geometry::point<double>(x+1,y+1));
-        ds->push(feature);
+        mapnik::feature_ptr feature2(mapnik::feature_factory::create(ctx,1));
+        feature2->put("name",tr.transcode("null island"));
+        feature2->put("name2",tr.transcode("null island 2"));
+        feature2->set_geometry(mapnik::geometry::point<double>(x+1,y+1));
+        ds->push(feature2);
     }
     return ds;
 }
diff --git a/test/vector_tile.cpp b/test/vector_tile.cpp
index 886c6f7..00ee133 100644
--- a/test/vector_tile.cpp
+++ b/test/vector_tile.cpp
@@ -33,6 +33,7 @@
 
 // vector input api
 #include "vector_tile_datasource.hpp"
+#include "pbf_writer.hpp"
 
 /*
 TEST_CASE( "vector tile negative id", "hmm" ) {
@@ -306,7 +307,7 @@ TEST_CASE( "vector tile datasource", "should filter features outside extent" ) {
     std::string key("");
     CHECK(false == mapnik::vector_tile_impl::is_solid_extent(tile,key));
     CHECK("" == key);
-    CHECK(1 == tile.layers_size());
+    REQUIRE(1 == tile.layers_size());
     vector_tile::Tile_Layer const& layer = tile.layers(0);
     CHECK(std::string("layer") == layer.name());
     CHECK(1 == layer.features_size());
@@ -430,7 +431,7 @@ TEST_CASE( "encoding multi line as one path", "should maintain second move_to co
     std::string key("");
     CHECK(false == mapnik::vector_tile_impl::is_solid_extent(tile,key));
     CHECK("" == key);
-    CHECK(1 == tile.layers_size());
+    REQUIRE(1 == tile.layers_size());
     vector_tile::Tile_Layer const& layer = tile.layers(0);
     CHECK(1 == layer.features_size());
     vector_tile::Tile_Feature const& f = layer.features(0);
@@ -499,7 +500,7 @@ TEST_CASE( "encoding single line 1", "should maintain start/end vertex" ) {
     std::string key("");
     CHECK(false == mapnik::vector_tile_impl::is_solid_extent(tile,key));
     CHECK("" == key);
-    CHECK(1 == tile.layers_size());
+    REQUIRE(1 == tile.layers_size());
     vector_tile::Tile_Layer const& layer = tile.layers(0);
     CHECK(1 == layer.features_size());
     vector_tile::Tile_Feature const& f = layer.features(0);
@@ -530,7 +531,7 @@ TEST_CASE( "encoding single line 1", "should maintain start/end vertex" ) {
     // 5th and 6th are the x,y of the first line_to command
     // due zigzag encoding the 2,2 should be 4,4
     // delta encoding has no impact since the previous coordinate was 0,0
-    unsigned four = (2 << 1) ^ (2 >> 31);
+    unsigned four = mapbox::util::pbf_writer::encode_zigzag32(2u);
     CHECK(4 == four);
     CHECK(4 == f.geometry(4));
     CHECK(4 == f.geometry(5));
@@ -576,7 +577,7 @@ TEST_CASE( "encoding single line 2", "should maintain start/end vertex" ) {
     std::string key("");
     CHECK(false == mapnik::vector_tile_impl::is_solid_extent(tile,key));
     CHECK("" == key);
-    CHECK(1 == tile.layers_size());
+    REQUIRE(1 == tile.layers_size());
     vector_tile::Tile_Layer const& layer = tile.layers(0);
     CHECK(1 == layer.features_size());
     vector_tile::Tile_Feature const& f = layer.features(0);
@@ -952,7 +953,7 @@ TEST_CASE( "vector tile from simplified geojson", "should create vector tile wit
     renderer_type ren(backend,map,m_req);
     ren.apply();
     CHECK( ren.painted() == true );
-    CHECK(1 == tile.layers_size());
+    REQUIRE(1 == tile.layers_size());
     vector_tile::Tile_Layer const& layer = tile.layers(0);
     CHECK(std::string("layer") == layer.name());
     CHECK(1 == layer.features_size());
diff --git a/test/vector_tile_pbf.cpp b/test/vector_tile_pbf.cpp
index a74f93b..47e8bf0 100644
--- a/test/vector_tile_pbf.cpp
+++ b/test/vector_tile_pbf.cpp
@@ -1,5 +1,9 @@
 #include "catch.hpp"
 
+// override pbf_assert to disable assertions and allow
+// all tests below to check exceptions even in Debug mode
+#define pbf_assert(x)
+
 // test utils
 #include "test_utils.hpp"
 #include <mapnik/memory_datasource.hpp>
@@ -34,6 +38,7 @@
 // vector input api
 #include "vector_tile_datasource.hpp"
 #include "vector_tile_datasource_pbf.hpp"
+
 #include "pbf_reader.hpp"
 
 #include <string>
@@ -355,7 +360,7 @@ TEST_CASE( "pbf decoding some truncated buffers", "should throw exception" ) {
     // it off at a point that would be valid anyway.
     std::string buffer;
     tile.SerializeToString(&buffer);
-    for (int i=1; i< buffer.size(); i++) 
+    for (std::size_t i=1; i< buffer.size(); ++i)
     {
       CHECK_THROWS({
           mapbox::util::pbf pbf_tile(buffer.c_str(), i);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapnik-vector-tile.git



More information about the Pkg-grass-devel mailing list