[build] Fix clang format and tidy checks
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
namespace util {
|
||||
@@ -13,17 +14,19 @@ struct DefaultStyle {
|
||||
const unsigned currentVersion;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
constexpr const DefaultStyle streets = { "mapbox://styles/mapbox/streets-v11", "Streets", 11 };
|
||||
constexpr const DefaultStyle outdoors = { "mapbox://styles/mapbox/outdoors-v11", "Outdoors", 11 };
|
||||
constexpr const DefaultStyle light = { "mapbox://styles/mapbox/light-v10", "Light", 10 };
|
||||
constexpr const DefaultStyle dark = { "mapbox://styles/mapbox/dark-v10", "Dark", 10 };
|
||||
constexpr const DefaultStyle satellite = { "mapbox://styles/mapbox/satellite-v9", "Satellite", 9 };
|
||||
constexpr const DefaultStyle satelliteStreets = { "mapbox://styles/mapbox/satellite-streets-v11", "Satellite Streets", 11 };
|
||||
// clang-format on
|
||||
|
||||
const DefaultStyle orderedStyles[] = {
|
||||
streets, outdoors, light, dark, satellite, satelliteStreets,
|
||||
};
|
||||
const size_t numOrderedStyles = sizeof(orderedStyles) / sizeof(DefaultStyle);
|
||||
constexpr std::array<const DefaultStyle, 6> orderedStyles = {
|
||||
{streets, outdoors, light, dark, satellite, satelliteStreets}};
|
||||
|
||||
constexpr size_t numOrderedStyles = orderedStyles.size();
|
||||
|
||||
} // end namespace default_styles
|
||||
} // end namespace util
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
// Compiler defines for making symbols visible, otherwise they
|
||||
// will be defined as hidden by default.
|
||||
|
||||
// clang-format off
|
||||
#if defined WIN32
|
||||
#ifdef MBGL_BUILDING_LIB
|
||||
#ifdef __GNUC__
|
||||
@@ -40,3 +41,4 @@
|
||||
#else
|
||||
#define MBGL_EXPORT __attribute__((visibility ("default"))) // NOLINT
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
@@ -321,7 +321,7 @@ size_t HTTPRequest::headerCallback(char *const buffer, const size_t size, const
|
||||
// Always overwrite the modification date; We might already have a value here from the
|
||||
// Date header, but this one is more accurate.
|
||||
const std::string value { buffer + begin, length - begin - 2 }; // remove \r\n
|
||||
baton->response->modified = Timestamp{ Seconds(curl_getdate(value.c_str(), nullptr)) };
|
||||
baton->response->modified = Timestamp{Seconds(curl_getdate(value.c_str(), nullptr))};
|
||||
} else if ((begin = headerMatches("etag: ", buffer, length)) != std::string::npos) {
|
||||
baton->response->etag = std::string(buffer + begin, length - begin - 2); // remove \r\n
|
||||
} else if ((begin = headerMatches("cache-control: ", buffer, length)) != std::string::npos) {
|
||||
@@ -331,7 +331,7 @@ size_t HTTPRequest::headerCallback(char *const buffer, const size_t size, const
|
||||
baton->response->mustRevalidate = cc.mustRevalidate;
|
||||
} else if ((begin = headerMatches("expires: ", buffer, length)) != std::string::npos) {
|
||||
const std::string value { buffer + begin, length - begin - 2 }; // remove \r\n
|
||||
baton->response->expires = Timestamp{ Seconds(curl_getdate(value.c_str(), nullptr)) };
|
||||
baton->response->expires = Timestamp{Seconds(curl_getdate(value.c_str(), nullptr))};
|
||||
} else if ((begin = headerMatches("retry-after: ", buffer, length)) != std::string::npos) {
|
||||
baton->retryAfter = std::string(buffer + begin, length - begin - 2); // remove \r\n
|
||||
} else if ((begin = headerMatches("x-rate-limit-reset: ", buffer, length)) != std::string::npos) {
|
||||
@@ -357,13 +357,13 @@ void HTTPRequest::handleResult(CURLcode code) {
|
||||
case CURLE_COULDNT_CONNECT:
|
||||
case CURLE_OPERATION_TIMEDOUT:
|
||||
|
||||
response->error = std::make_unique<Error>(
|
||||
Error::Reason::Connection, std::string{ curl_easy_strerror(code) } + ": " + error);
|
||||
response->error = std::make_unique<Error>(Error::Reason::Connection,
|
||||
std::string{curl_easy_strerror(code)} + ": " + error);
|
||||
break;
|
||||
|
||||
default:
|
||||
response->error = std::make_unique<Error>(
|
||||
Error::Reason::Other, std::string{ curl_easy_strerror(code) } + ": " + error);
|
||||
response->error =
|
||||
std::make_unique<Error>(Error::Reason::Other, std::string{curl_easy_strerror(code)} + ": " + error);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -24,13 +24,13 @@ std::string formatNumber(double number, const std::string& localeId, const std::
|
||||
} else {
|
||||
ustr = icu::number::NumberFormatter::with()
|
||||
#if U_ICU_VERSION_MAJOR_NUM >= 62
|
||||
.precision(icu::number::Precision::minMaxFraction(minFractionDigits, maxFractionDigits))
|
||||
.precision(icu::number::Precision::minMaxFraction(minFractionDigits, maxFractionDigits))
|
||||
#else
|
||||
.rounding(icu::number::Rounder::minMaxFraction(minFractionDigits, maxFractionDigits))
|
||||
.rounding(icu::number::Rounder::minMaxFraction(minFractionDigits, maxFractionDigits))
|
||||
#endif
|
||||
.locale(locale)
|
||||
.formatDouble(number, status)
|
||||
.toString();
|
||||
.locale(locale)
|
||||
.formatDouble(number, status)
|
||||
.toString();
|
||||
}
|
||||
return ustr.toUTF8String(formatted);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user