From 4cdc067636ca7f9201faddf1410b6e781dd7c4c5 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Fri, 27 Mar 2020 18:30:35 +0200 Subject: [core] Fix modernize-return-braced-init-list errors in header files As reported by clang-tidy-8. --- include/mbgl/util/char_array_buffer.hpp | 2 +- include/mbgl/util/geo.hpp | 17 +++++------------ include/mbgl/util/projection.hpp | 4 ++-- 3 files changed, 8 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/mbgl/util/char_array_buffer.hpp b/include/mbgl/util/char_array_buffer.hpp index 177f005477..80eeb2db62 100644 --- a/include/mbgl/util/char_array_buffer.hpp +++ b/include/mbgl/util/char_array_buffer.hpp @@ -43,7 +43,7 @@ private: if (dir == std::ios_base::beg) current_ = std::min(begin_ + off, end_); else if (dir == std::ios_base::cur) current_ = std::min(current_ + off, end_); else current_ = std::max(end_ - off, begin_); // dir == std::ios_base::end - return pos_type(off_type(current_ - begin_)); + return {off_type(current_ - begin_)}; } char const * const begin_; diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp index 58e5c834ab..a653d053f5 100644 --- a/include/mbgl/util/geo.hpp +++ b/include/mbgl/util/geo.hpp @@ -82,14 +82,10 @@ public: class LatLngBounds { public: // Return a bounds covering the entire (unwrapped) world. - static LatLngBounds world() { - return LatLngBounds({-90, -180}, {90, 180}); - } + static LatLngBounds world() { return {{-90, -180}, {90, 180}}; } // Return the bounds consisting of the single point. - static LatLngBounds singleton(const LatLng& a) { - return LatLngBounds(a, a); - } + static LatLngBounds singleton(const LatLng& a) { return {a, a}; } // Return the convex hull of two points; the smallest bounds that contains both. static LatLngBounds hull(const LatLng& a, const LatLng& b) { @@ -126,13 +122,10 @@ public: LatLng southwest() const { return sw; } LatLng northeast() const { return ne; } - LatLng southeast() const { return LatLng(south(), east()); } - LatLng northwest() const { return LatLng(north(), west()); } + LatLng southeast() const { return {south(), east()}; } + LatLng northwest() const { return {north(), west()}; } - LatLng center() const { - return LatLng((sw.latitude() + ne.latitude()) / 2, - (sw.longitude() + ne.longitude()) / 2); - } + LatLng center() const { return {(sw.latitude() + ne.latitude()) / 2, (sw.longitude() + ne.longitude()) / 2}; } LatLng constrain(const LatLng& p) const; diff --git a/include/mbgl/util/projection.hpp b/include/mbgl/util/projection.hpp index f0b9115eb0..f8563719d6 100644 --- a/include/mbgl/util/projection.hpp +++ b/include/mbgl/util/projection.hpp @@ -61,7 +61,7 @@ public: const double easting = util::EARTH_RADIUS_M * constrainedLongitude * util::DEG2RAD; const double northing = 0.5 * util::EARTH_RADIUS_M * std::log((1 + f) / (1 - f)); - return ProjectedMeters(northing, easting); + return {northing, easting}; } static LatLng latLngForProjectedMeters(const ProjectedMeters& projectedMeters) { @@ -71,7 +71,7 @@ public: latitude = util::clamp(latitude, -util::LATITUDE_MAX, util::LATITUDE_MAX); longitude = util::clamp(longitude, -util::LONGITUDE_MAX, util::LONGITUDE_MAX); - return LatLng(latitude, longitude); + return {latitude, longitude}; } static Point project(const LatLng& latLng, double scale) { -- cgit v1.2.1