summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2019-09-03 02:17:36 +0300
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2019-09-17 12:28:55 +0300
commit83a019d021ccac037af677d6a0d19065d1e61c8a (patch)
tree64287772fc2d4c23087c5fc02df94d8a4e0dc47d
parent1304502f8182573176352bcab167d08963ba4c67 (diff)
downloadqtlocation-mapboxgl-83a019d021ccac037af677d6a0d19065d1e61c8a.tar.gz
[build] Fix clang format and tidy checks
-rw-r--r--include/mbgl/util/default_styles.hpp13
-rw-r--r--include/mbgl/util/util.hpp2
-rw-r--r--platform/default/src/mbgl/storage/http_file_source.cpp12
-rw-r--r--platform/default/src/mbgl/util/format_number.cpp10
4 files changed, 21 insertions, 16 deletions
diff --git a/include/mbgl/util/default_styles.hpp b/include/mbgl/util/default_styles.hpp
index 335d3ea5f9..e1c53178b0 100644
--- a/include/mbgl/util/default_styles.hpp
+++ b/include/mbgl/util/default_styles.hpp
@@ -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
diff --git a/include/mbgl/util/util.hpp b/include/mbgl/util/util.hpp
index 178f1cba48..52d9ad85b7 100644
--- a/include/mbgl/util/util.hpp
+++ b/include/mbgl/util/util.hpp
@@ -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
diff --git a/platform/default/src/mbgl/storage/http_file_source.cpp b/platform/default/src/mbgl/storage/http_file_source.cpp
index fad877ed08..b0390c58fc 100644
--- a/platform/default/src/mbgl/storage/http_file_source.cpp
+++ b/platform/default/src/mbgl/storage/http_file_source.cpp
@@ -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 {
diff --git a/platform/default/src/mbgl/util/format_number.cpp b/platform/default/src/mbgl/util/format_number.cpp
index f58d6e100a..d1b51e11a1 100644
--- a/platform/default/src/mbgl/util/format_number.cpp
+++ b/platform/default/src/mbgl/util/format_number.cpp
@@ -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);
}