From bb34b5302c1571c530818dd8b4e98f7e49178744 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 25 Aug 2016 11:05:03 -0700 Subject: [PATCH] upgrade to protozer 1.4.0 (#6158) --- CMakeLists.txt | 2 +- src/mbgl/tile/vector_tile.cpp | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34217e4b5..f8c882b7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ mason_use(geojsonvt VERSION 6.1.3 HEADER_ONLY) mason_use(supercluster VERSION 0.2.0 HEADER_ONLY) mason_use(kdbush VERSION 0.1.1 HEADER_ONLY) mason_use(earcut VERSION 0.11 HEADER_ONLY) -mason_use(protozero VERSION 1.3.0 HEADER_ONLY) +mason_use(protozero VERSION 1.4.0 HEADER_ONLY) mason_use(pixelmatch VERSION 0.9.0 HEADER_ONLY) mason_use(geojson VERSION 0.1.4${MASON_CXXABI_SUFFIX}) diff --git a/src/mbgl/tile/vector_tile.cpp b/src/mbgl/tile/vector_tile.cpp index 6a3c51c05..1ba30d869 100644 --- a/src/mbgl/tile/vector_tile.cpp +++ b/src/mbgl/tile/vector_tile.cpp @@ -14,8 +14,7 @@ namespace mbgl { class VectorTileLayer; -using pbf_iter_type = protozero::pbf_reader::const_uint32_iterator; -using packed_iter_type = std::pair; +using packed_iter_type = protozero::iterator_range; class VectorTileFeature : public GeometryTileFeature { public: @@ -144,8 +143,8 @@ optional VectorTileFeature::getValue(const std::string& key) const { return optional(); } - auto start_itr = tags_iter.first; - const auto & end_itr = tags_iter.second; + auto start_itr = tags_iter.begin(); + const auto & end_itr = tags_iter.end(); while (start_itr != end_itr) { uint32_t tag_key = static_cast(*start_itr++); @@ -172,8 +171,8 @@ optional VectorTileFeature::getValue(const std::string& key) const { std::unordered_map VectorTileFeature::getProperties() const { std::unordered_map properties; - auto start_itr = tags_iter.first; - const auto & end_itr = tags_iter.second; + auto start_itr = tags_iter.begin(); + const auto & end_itr = tags_iter.end(); while (start_itr != end_itr) { uint32_t tag_key = static_cast(*start_itr++); if (start_itr == end_itr) { @@ -201,10 +200,10 @@ GeometryCollection VectorTileFeature::getGeometries() const { lines.emplace_back(); GeometryCoordinates* line = &lines.back(); - auto g_itr = geometry_iter; - while (g_itr.first != g_itr.second) { + auto g_itr = geometry_iter.begin(); + while (g_itr != geometry_iter.end()) { if (length == 0) { - uint32_t cmd_length = static_cast(*g_itr.first++); + uint32_t cmd_length = static_cast(*g_itr++); cmd = cmd_length & 0x7; length = cmd_length >> 3; } @@ -212,8 +211,8 @@ GeometryCollection VectorTileFeature::getGeometries() const { --length; if (cmd == 1 || cmd == 2) { - x += protozero::decode_zigzag32(static_cast(*g_itr.first++)); - y += protozero::decode_zigzag32(static_cast(*g_itr.first++)); + x += protozero::decode_zigzag32(static_cast(*g_itr++)); + y += protozero::decode_zigzag32(static_cast(*g_itr++)); if (cmd == 1 && !line->empty()) { // moveTo lines.emplace_back();