diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2020-03-27 18:30:35 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2020-03-30 23:37:44 +0300 |
commit | 94d1c10727ceb2c0e245aeb3c255102da185440c (patch) | |
tree | 2f93534ca3dac24b3d3f566faa0b11fbf72177b9 /src/mbgl/util | |
parent | 2ca3fc24a1eedda8fb6fed1fa56033717376e0d7 (diff) | |
download | qtlocation-mapboxgl-94d1c10727ceb2c0e245aeb3c255102da185440c.tar.gz |
[core] Fix readability-* errors
As reported by clang-tidy-8.
Diffstat (limited to 'src/mbgl/util')
-rw-r--r-- | src/mbgl/util/geometry_within.cpp | 15 | ||||
-rw-r--r-- | src/mbgl/util/grid_index.cpp | 16 | ||||
-rw-r--r-- | src/mbgl/util/i18n.cpp | 24 | ||||
-rw-r--r-- | src/mbgl/util/intersection_tests.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/util/logging.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/util/mapbox.hpp | 12 | ||||
-rw-r--r-- | src/mbgl/util/mat2.cpp | 14 | ||||
-rw-r--r-- | src/mbgl/util/mat3.cpp | 34 | ||||
-rw-r--r-- | src/mbgl/util/mat4.cpp | 165 | ||||
-rw-r--r-- | src/mbgl/util/tile_cover.cpp | 12 | ||||
-rw-r--r-- | src/mbgl/util/tile_cover_impl.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/util/url.hpp | 2 |
12 files changed, 185 insertions, 125 deletions
diff --git a/src/mbgl/util/geometry_within.cpp b/src/mbgl/util/geometry_within.cpp index 89e3d84fc6..618567a8e1 100644 --- a/src/mbgl/util/geometry_within.cpp +++ b/src/mbgl/util/geometry_within.cpp @@ -38,7 +38,12 @@ bool lineIntersectLine(const Point<int64_t>& a, // check if p1 and p2 are in different sides of line segment q1->q2 const auto twoSided = [](const Point<int64_t>& p1, const Point<int64_t>& p2, const Point<int64_t>& q1, const Point<int64_t>& q2) { - int64_t x1, y1, x2, y2, x3, y3; + int64_t x1; + int64_t y1; + int64_t x2; + int64_t y2; + int64_t x3; + int64_t y3; // q1->p1 (x1, y1), q1->p2 (x2, y2), q1->q2 (x3, y3) x1 = p1.x - q1.x; @@ -49,17 +54,13 @@ bool lineIntersectLine(const Point<int64_t>& a, y3 = q2.y - q1.y; auto ret1 = (x1 * y3 - x3 * y1); auto ret2 = (x2 * y3 - x3 * y2); - if ((ret1 > 0 && ret2 < 0) || (ret1 < 0 && ret2 > 0)) { - return true; - } - return false; + return (ret1 > 0 && ret2 < 0) || (ret1 < 0 && ret2 > 0); }; // If lines are intersecting with each other, the relative location should be: // a and b lie in different sides of segment c->d // c and d lie in different sides of segment a->b - if (twoSided(a, b, c, d) && twoSided(c, d, a, b)) return true; - return false; + return twoSided(a, b, c, d) && twoSided(c, d, a, b); } bool lineIntersectPolygon(const Point<int64_t>& p1, const Point<int64_t>& p2, const Polygon<int64_t>& polygon) { diff --git a/src/mbgl/util/grid_index.cpp b/src/mbgl/util/grid_index.cpp index f33e889ddb..2f6f3f5488 100644 --- a/src/mbgl/util/grid_index.cpp +++ b/src/mbgl/util/grid_index.cpp @@ -32,7 +32,9 @@ void GridIndex<T>::insert(T&& t, const BBox& bbox) { auto cx2 = convertToXCellCoord(bbox.max.x); auto cy2 = convertToYCellCoord(bbox.max.y); - std::size_t x, y, cellIndex; + std::size_t x; + std::size_t y; + std::size_t cellIndex; for (x = cx1; x <= cx2; ++x) { for (y = cy1; y <= cy2; ++y) { cellIndex = xCellCount * y + x; @@ -52,7 +54,9 @@ void GridIndex<T>::insert(T&& t, const BCircle& bcircle) { auto cx2 = convertToXCellCoord(bcircle.center.x + bcircle.radius); auto cy2 = convertToYCellCoord(bcircle.center.y + bcircle.radius); - std::size_t x, y, cellIndex; + std::size_t x; + std::size_t y; + std::size_t cellIndex; for (x = cx1; x <= cx2; ++x) { for (y = cy1; y <= cy2; ++y) { cellIndex = xCellCount * y + x; @@ -153,7 +157,9 @@ void GridIndex<T>::query(const BBox& queryBBox, std::function<bool (const T&, co auto cx2 = convertToXCellCoord(queryBBox.max.x); auto cy2 = convertToYCellCoord(queryBBox.max.y); - std::size_t x, y, cellIndex; + std::size_t x; + std::size_t y; + std::size_t cellIndex; for (x = cx1; x <= cx2; ++x) { for (y = cy1; y <= cy2; ++y) { cellIndex = xCellCount * y + x; @@ -216,7 +222,9 @@ void GridIndex<T>::query(const BCircle& queryBCircle, std::function<bool (const auto cx2 = convertToXCellCoord(queryBCircle.center.x + queryBCircle.radius); auto cy2 = convertToYCellCoord(queryBCircle.center.y + queryBCircle.radius); - std::size_t x, y, cellIndex; + std::size_t x; + std::size_t y; + std::size_t cellIndex; for (x = cx1; x <= cx2; ++x) { for (y = cy1; y <= cy2; ++y) { cellIndex = xCellCount * y + x; diff --git a/src/mbgl/util/i18n.cpp b/src/mbgl/util/i18n.cpp index ce3ef65f3a..c8379a6703 100644 --- a/src/mbgl/util/i18n.cpp +++ b/src/mbgl/util/i18n.cpp @@ -614,21 +614,19 @@ bool charInSupportedScript(char16_t chr) { // actually depends on the properties of the font being used // and whether differences from the ideal rendering are considered // semantically significant. - + // Even in Latin script, we "can't render" combinations such as the fi // ligature, but we don't consider that semantically significant.n false; - if ((chr >= 0x0900 && chr <= 0x0DFF) || - // Main blocks for Indic scripts and Sinhala - (chr >= 0x0F00 && chr <= 0x109F) || - // Main blocks for Tibetan and Myanmar - isInKhmer(chr)) { - // These blocks cover common scripts that require - // complex text shaping, based on unicode script metadata: - // http://www.unicode.org/repos/cldr/trunk/common/properties/scriptMetadata.txt - // where "Web Rank <= 32" "Shaping Required = YES" - return false; - } - return true; + + // These blocks cover common scripts that require + // complex text shaping, based on unicode script metadata: + // http://www.unicode.org/repos/cldr/trunk/common/properties/scriptMetadata.txt + // where "Web Rank <= 32" "Shaping Required = YES" + return !((chr >= 0x0900 && chr <= 0x0DFF) || + // Main blocks for Indic scripts and Sinhala + (chr >= 0x0F00 && chr <= 0x109F) || + // Main blocks for Tibetan and Myanmar + isInKhmer(chr)); } bool isStringInSupportedScript(const std::string& input) { diff --git a/src/mbgl/util/intersection_tests.cpp b/src/mbgl/util/intersection_tests.cpp index 780fce98f9..e236a1999f 100644 --- a/src/mbgl/util/intersection_tests.cpp +++ b/src/mbgl/util/intersection_tests.cpp @@ -30,7 +30,7 @@ bool pointIntersectsBufferedLine(const GeometryCoordinate& p, const GeometryCoor const float radiusSquared = radius * radius; if (line.size() == 1) return util::distSqr<float>(p, line.at(0)) < radiusSquared; - if (line.size() == 0) return false; + if (line.empty()) return false; for (auto i = line.begin() + 1; i != line.end(); i++) { // Find line segments that have a distance <= radius^2 to p @@ -52,7 +52,7 @@ bool lineSegmentIntersectsLineSegment(const GeometryCoordinate& a0, const Geomet isCounterClockwise(a0, a1, b0) != isCounterClockwise(a0, a1, b1); } bool lineIntersectsLine(const GeometryCoordinates& lineA, const GeometryCoordinates& lineB) { - if (lineA.size() == 0 || lineB.size() == 0) return false; + if (lineA.empty() || lineB.empty()) return false; for (auto i = lineA.begin(); i != lineA.end() - 1; i++) { auto& a0 = *i; auto& a1 = *(i + 1); @@ -120,9 +120,7 @@ bool polygonIntersectsPolygon(const GeometryCoordinates& polygonA, const Geometr if (polygonContainsPoint(polygonA, p)) return true; } - if (lineIntersectsLine(polygonA, polygonB)) return true; - - return false; + return lineIntersectsLine(polygonA, polygonB); } bool polygonIntersectsMultiPolygon(const GeometryCoordinates& polygon, const GeometryCollection& multiPolygon) { diff --git a/src/mbgl/util/logging.cpp b/src/mbgl/util/logging.cpp index fd3f14825d..366f9f1a05 100644 --- a/src/mbgl/util/logging.cpp +++ b/src/mbgl/util/logging.cpp @@ -10,7 +10,7 @@ namespace mbgl { namespace { -static std::unique_ptr<Log::Observer> currentObserver; +std::unique_ptr<Log::Observer> currentObserver; } // namespace diff --git a/src/mbgl/util/mapbox.hpp b/src/mbgl/util/mapbox.hpp index aa128f2667..815b338cab 100644 --- a/src/mbgl/util/mapbox.hpp +++ b/src/mbgl/util/mapbox.hpp @@ -12,14 +12,14 @@ namespace mapbox { bool isMapboxURL(const std::string& url); -std::string normalizeSourceURL(const std::string& baseURL, const std::string& url, const std::string& accessToken); -std::string normalizeStyleURL(const std::string& baseURL, const std::string& url, const std::string& accessToken); -std::string normalizeSpriteURL(const std::string& baseURL, const std::string& url, const std::string& accessToken); -std::string normalizeGlyphsURL(const std::string& baseURL, const std::string& url, const std::string& accessToken); -std::string normalizeTileURL(const std::string& baseURL, const std::string& url, const std::string& accessToken); +std::string normalizeSourceURL(const std::string& baseURL, const std::string& str, const std::string& accessToken); +std::string normalizeStyleURL(const std::string& baseURL, const std::string& str, const std::string& accessToken); +std::string normalizeSpriteURL(const std::string& baseURL, const std::string& str, const std::string& accessToken); +std::string normalizeGlyphsURL(const std::string& baseURL, const std::string& str, const std::string& accessToken); +std::string normalizeTileURL(const std::string& baseURL, const std::string& str, const std::string& accessToken); // Return a "mapbox://tiles/..." URL (suitable for normalizeTileURL) for the given Mapbox tile URL. -std::string canonicalizeTileURL(const std::string& url, style::SourceType, uint16_t tileSize); +std::string canonicalizeTileURL(const std::string& str, style::SourceType, uint16_t tileSize); // Replace URL templates with "mapbox://tiles/..." URLs (suitable for normalizeTileURL). void canonicalizeTileset(Tileset&, const std::string& url, style::SourceType, uint16_t tileSize); diff --git a/src/mbgl/util/mat2.cpp b/src/mbgl/util/mat2.cpp index 4fb5abafb8..89617d8449 100644 --- a/src/mbgl/util/mat2.cpp +++ b/src/mbgl/util/mat2.cpp @@ -34,9 +34,12 @@ void matrix::identity(mat2& out) { } void matrix::rotate(mat2& out, const mat2& a, double rad) { - double a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], - s = std::sin(rad), - c = std::cos(rad); + double a0 = a[0]; + double a1 = a[1]; + double a2 = a[2]; + double a3 = a[3]; + double s = std::sin(rad); + double c = std::cos(rad); out[0] = a0 * c + a2 * s; out[1] = a1 * c + a3 * s; out[2] = a0 * -s + a2 * c; @@ -44,7 +47,10 @@ void matrix::rotate(mat2& out, const mat2& a, double rad) { } void matrix::scale(mat2& out, const mat2& a, double v0, double v1) { - double a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; + double a0 = a[0]; + double a1 = a[1]; + double a2 = a[2]; + double a3 = a[3]; out[0] = a0 * v0; out[1] = a1 * v0; out[2] = a2 * v1; diff --git a/src/mbgl/util/mat3.cpp b/src/mbgl/util/mat3.cpp index 107be81985..9ecc0b8e95 100644 --- a/src/mbgl/util/mat3.cpp +++ b/src/mbgl/util/mat3.cpp @@ -40,9 +40,15 @@ void identity(mat3& out) { } void translate(mat3& out, const mat3& a, double x, double y) { - double a00 = a[0], a01 = a[1], a02 = a[2], - a10 = a[3], a11 = a[4], a12 = a[5], - a20 = a[6], a21 = a[7], a22 = a[8]; + double a00 = a[0]; + double a01 = a[1]; + double a02 = a[2]; + double a10 = a[3]; + double a11 = a[4]; + double a12 = a[5]; + double a20 = a[6]; + double a21 = a[7]; + double a22 = a[8]; out[0] = a00; out[1] = a01; @@ -58,17 +64,17 @@ void translate(mat3& out, const mat3& a, double x, double y) { } void rotate(mat3& out, const mat3& a, double rad) { - double s = std::sin(rad), - c = std::cos(rad), - a00 = a[0], - a01 = a[1], - a02 = a[2], - a10 = a[3], - a11 = a[4], - a12 = a[5], - a20 = a[6], - a21 = a[7], - a22 = a[8]; + double s = std::sin(rad); + double c = std::cos(rad); + double a00 = a[0]; + double a01 = a[1]; + double a02 = a[2]; + double a10 = a[3]; + double a11 = a[4]; + double a12 = a[5]; + double a20 = a[6]; + double a21 = a[7]; + double a22 = a[8]; out[0] = c * a00 + s * a10; out[1] = c * a01 + s * a11; diff --git a/src/mbgl/util/mat4.cpp b/src/mbgl/util/mat4.cpp index 2f7d35a5be..9909b7e3ee 100644 --- a/src/mbgl/util/mat4.cpp +++ b/src/mbgl/util/mat4.cpp @@ -48,26 +48,36 @@ void identity(mat4& out) { } bool invert(mat4& out, const mat4& a) { - double a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], - a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], - a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], - a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], - - b00 = a00 * a11 - a01 * a10, - b01 = a00 * a12 - a02 * a10, - b02 = a00 * a13 - a03 * a10, - b03 = a01 * a12 - a02 * a11, - b04 = a01 * a13 - a03 * a11, - b05 = a02 * a13 - a03 * a12, - b06 = a20 * a31 - a21 * a30, - b07 = a20 * a32 - a22 * a30, - b08 = a20 * a33 - a23 * a30, - b09 = a21 * a32 - a22 * a31, - b10 = a21 * a33 - a23 * a31, - b11 = a22 * a33 - a23 * a32, - - // Calculate the determinant - det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + double a00 = a[0]; + double a01 = a[1]; + double a02 = a[2]; + double a03 = a[3]; + double a10 = a[4]; + double a11 = a[5]; + double a12 = a[6]; + double a13 = a[7]; + double a20 = a[8]; + double a21 = a[9]; + double a22 = a[10]; + double a23 = a[11]; + double a30 = a[12]; + double a31 = a[13]; + double a32 = a[14]; + double a33 = a[15]; + double b00 = a00 * a11 - a01 * a10; + double b01 = a00 * a12 - a02 * a10; + double b02 = a00 * a13 - a03 * a10; + double b03 = a01 * a12 - a02 * a11; + double b04 = a01 * a13 - a03 * a11; + double b05 = a02 * a13 - a03 * a12; + double b06 = a20 * a31 - a21 * a30; + double b07 = a20 * a32 - a22 * a30; + double b08 = a20 * a33 - a23 * a30; + double b09 = a21 * a32 - a22 * a31; + double b10 = a21 * a33 - a23 * a31; + double b11 = a22 * a33 - a23 * a32; + double // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (!det) { return true; @@ -95,9 +105,9 @@ bool invert(mat4& out, const mat4& a) { } void ortho(mat4& out, double left, double right, double bottom, double top, double near, double far) { - double lr = 1.0f / (left - right), - bt = 1.0f / (bottom - top), - nf = 1.0f / (near - far); + double lr = 1.0f / (left - right); + double bt = 1.0f / (bottom - top); + double nf = 1.0f / (near - far); out[0] = -2.0f * lr; out[1] = 0.0f; out[2] = 0.0f; @@ -117,8 +127,8 @@ void ortho(mat4& out, double left, double right, double bottom, double top, doub } void perspective(mat4& out, double fovy, double aspect, double near, double far) { - double f = 1.0f / std::tan(fovy / 2.0f), - nf = 1.0f / (near - far); + double f = 1.0f / std::tan(fovy / 2.0f); + double nf = 1.0f / (near - far); out[0] = f / aspect; out[1] = 0.0f; out[2] = 0.0f; @@ -163,9 +173,18 @@ void translate(mat4& out, const mat4& a, double x, double y, double z) { out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; } else { - double a00, a01, a02, a03, - a10, a11, a12, a13, - a20, a21, a22, a23; + double a00; + double a01; + double a02; + double a03; + double a10; + double a11; + double a12; + double a13; + double a20; + double a21; + double a22; + double a23; a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; @@ -183,16 +202,16 @@ void translate(mat4& out, const mat4& a, double x, double y, double z) { } void rotate_x(mat4& out, const mat4& a, double rad) { - double s = std::sin(rad), - c = std::cos(rad), - a10 = a[4], - a11 = a[5], - a12 = a[6], - a13 = a[7], - a20 = a[8], - a21 = a[9], - a22 = a[10], - a23 = a[11]; + double s = std::sin(rad); + double c = std::cos(rad); + double a10 = a[4]; + double a11 = a[5]; + double a12 = a[6]; + double a13 = a[7]; + double a20 = a[8]; + double a21 = a[9]; + double a22 = a[10]; + double a23 = a[11]; if (&a != &out) { // If the source and destination differ, copy the unchanged rows out[0] = a[0]; @@ -217,16 +236,16 @@ void rotate_x(mat4& out, const mat4& a, double rad) { } void rotate_y(mat4& out, const mat4& a, double rad) { - double s = std::sin(rad), - c = std::cos(rad), - a00 = a[0], - a01 = a[1], - a02 = a[2], - a03 = a[3], - a20 = a[8], - a21 = a[9], - a22 = a[10], - a23 = a[11]; + double s = std::sin(rad); + double c = std::cos(rad); + double a00 = a[0]; + double a01 = a[1]; + double a02 = a[2]; + double a03 = a[3]; + double a20 = a[8]; + double a21 = a[9]; + double a22 = a[10]; + double a23 = a[11]; if (&a != &out) { // If the source and destination differ, copy the unchanged rows out[4] = a[4]; @@ -251,16 +270,16 @@ void rotate_y(mat4& out, const mat4& a, double rad) { } void rotate_z(mat4& out, const mat4& a, double rad) { - double s = std::sin(rad), - c = std::cos(rad), - a00 = a[0], - a01 = a[1], - a02 = a[2], - a03 = a[3], - a10 = a[4], - a11 = a[5], - a12 = a[6], - a13 = a[7]; + double s = std::sin(rad); + double c = std::cos(rad); + double a00 = a[0]; + double a01 = a[1]; + double a02 = a[2]; + double a03 = a[3]; + double a10 = a[4]; + double a11 = a[5]; + double a12 = a[6]; + double a13 = a[7]; if (&a != &out) { // If the source and destination differ, copy the unchanged last row out[8] = a[8]; @@ -304,13 +323,28 @@ void scale(mat4& out, const mat4& a, double x, double y, double z) { } void multiply(mat4& out, const mat4& a, const mat4& b) { - double a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], - a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], - a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], - a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + double a00 = a[0]; + double a01 = a[1]; + double a02 = a[2]; + double a03 = a[3]; + double a10 = a[4]; + double a11 = a[5]; + double a12 = a[6]; + double a13 = a[7]; + double a20 = a[8]; + double a21 = a[9]; + double a22 = a[10]; + double a23 = a[11]; + double a30 = a[12]; + double a31 = a[13]; + double a32 = a[14]; + double a33 = a[15]; // Cache only the current line of the second matrix - double b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + double b0 = b[0]; + double b1 = b[1]; + double b2 = b[2]; + double b3 = b[3]; out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; @@ -336,7 +370,10 @@ void multiply(mat4& out, const mat4& a, const mat4& b) { } void transformMat4(vec4& out, const vec4& a, const mat4& m) { - double x = a[0], y = a[1], z = a[2], w = a[3]; + double x = a[0]; + double y = a[1]; + double z = a[2]; + double w = a[3]; out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; diff --git a/src/mbgl/util/tile_cover.cpp b/src/mbgl/util/tile_cover.cpp index 106ad9aa57..cf774abf00 100644 --- a/src/mbgl/util/tile_cover.cpp +++ b/src/mbgl/util/tile_cover.cpp @@ -34,7 +34,7 @@ struct edge { }; // scan-line conversion -static void scanSpans(edge e0, edge e1, int32_t ymin, int32_t ymax, ScanLine& scanLine) { +void scanSpans(edge e0, edge e1, int32_t ymin, int32_t ymax, ScanLine& scanLine) { double y0 = ::fmax(ymin, std::floor(e1.y0)); double y1 = ::fmin(ymax, std::ceil(e1.y1)); @@ -58,7 +58,12 @@ static void scanSpans(edge e0, edge e1, int32_t ymin, int32_t ymax, ScanLine& sc } // scan-line conversion -static void scanTriangle(const Point<double>& a, const Point<double>& b, const Point<double>& c, int32_t ymin, int32_t ymax, ScanLine& scanLine) { +void scanTriangle(const Point<double>& a, + const Point<double>& b, + const Point<double>& c, + int32_t ymin, + int32_t ymax, + ScanLine& scanLine) { edge ab = edge(a, b); edge bc = edge(b, c); edge ca = edge(c, a); @@ -98,7 +103,8 @@ std::vector<UnwrappedTileID> tileCover(const Point<double>& tl, int32_t x; if (y >= 0 && y <= tiles) { for (x = x0; x < x1; ++x) { - const auto dx = x + 0.5 - c.x, dy = y + 0.5 - c.y; + const auto dx = x + 0.5 - c.x; + const auto dy = y + 0.5 - c.y; t.emplace_back(ID{ x, y, dx * dx + dy * dy }); } } diff --git a/src/mbgl/util/tile_cover_impl.cpp b/src/mbgl/util/tile_cover_impl.cpp index f97ddeff48..cca58ca7e8 100644 --- a/src/mbgl/util/tile_cover_impl.cpp +++ b/src/mbgl/util/tile_cover_impl.cpp @@ -281,7 +281,7 @@ TileCover::Impl::Impl(int32_t z, const Geometry<double>& geom, bool project) BuildBoundsMap toBoundsMap(z, project); boundsMap = apply_visitor(toBoundsMap, geom); - if (boundsMap.size() == 0) return; + if (boundsMap.empty()) return; //Iniitalize the active edge table, and current row span currentBounds = boundsMap.begin(); @@ -300,7 +300,7 @@ TileCover::Impl::Impl(int32_t z, const Geometry<double>& geom, bool project) void TileCover::Impl::nextRow() { // Update activeBounds for next row if (currentBounds != boundsMap.end()) { - if (activeBounds.size() == 0 && currentBounds->first > tileY) { + if (activeBounds.empty() && currentBounds->first > tileY) { //For multi-geoms: use the next row with an edge table starting point tileY = currentBounds->first; } @@ -312,7 +312,7 @@ void TileCover::Impl::nextRow() { } //Scan the active bounds and update currentRange with x_min, x_max pairs auto xps = util::scan_row(tileY, activeBounds); - if (xps.size() == 0) { + if (xps.empty()) { return; } diff --git a/src/mbgl/util/url.hpp b/src/mbgl/util/url.hpp index 70fdfd8a36..33522b416c 100644 --- a/src/mbgl/util/url.hpp +++ b/src/mbgl/util/url.hpp @@ -45,7 +45,7 @@ public: // * {filename} == "baz" // * {extension} == ".png" // The query string of the source URL will always be appended. -std::string transformURL(const std::string& tpl, const std::string& url, const URL&); +std::string transformURL(const std::string& tpl, const std::string& str, const URL&); inline std::string transformURL(const std::string& tpl, const std::string& url) { return transformURL(tpl, url, URL(url)); } |