[core] Fix modernize-return-braced-init-list errors in header files

As reported by clang-tidy-8.
This commit is contained in:
Thiago Marcos P. Santos
2020-03-27 18:30:35 +02:00
parent 46fa691596
commit 4cdc067636
6 changed files with 11 additions and 18 deletions

View File

@@ -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_;

View File

@@ -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;

View File

@@ -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<double> project(const LatLng& latLng, double scale) {

View File

@@ -72,7 +72,7 @@ struct indexable<std::shared_ptr<const mbgl::SymbolAnnotationImpl>> {
using result_type = mbgl::LatLng;
mbgl::LatLng operator()(const std::shared_ptr<const mbgl::SymbolAnnotationImpl>& v) const {
const mbgl::Point<double>& p = v->annotation.geometry;
return mbgl::LatLng(p.y, p.x);
return {p.y, p.x};
}
};

View File

@@ -35,7 +35,7 @@ public:
static optional<const JSValue*> objectMember(const JSValue* value, const char * name) {
if (!value->HasMember(name)) {
return optional<const JSValue*>();
return {};
}
const JSValue* const& member = &(*value)[name];
return {member};

View File

@@ -29,7 +29,7 @@ public:
const auto minY = static_cast<uint32_t>(util::clamp(std::floor(neProj.y), 0.0 , maxTile));
const auto maxY = static_cast<uint32_t>(util::clamp(std::floor(swProj.y), 0.0, maxTile));
return TileRange({ {minX, minY}, {maxX, maxY} }, {minZoom, maxZoom});
return {{{minX, minY}, {maxX, maxY}}, {minZoom, maxZoom}};
}
// Compute the range of tiles covered by the bounds.