Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Andrianov <maksimandrianov1@gmail.com>2018-06-22 20:34:26 +0300
committerMaksim Andrianov <maksimandrianov1@gmail.com>2018-06-25 17:58:40 +0300
commit5ea4f835145fe8edfa6facc32e15c46452450e48 (patch)
tree94d2ce40239f76f023126f53bee456b304be5455
parent2a8cf2837351996c39bd5e43843c21009f033f5c (diff)
Review fixes
-rw-r--r--3party/freetype/CMakeLists.txt6
-rw-r--r--3party/opening_hours/CMakeLists.txt6
-rw-r--r--base/assert.hpp2
-rw-r--r--base/base_tests/levenshtein_dfa_test.cpp3
-rw-r--r--base/base_tests/stl_helpers_test.cpp8
-rw-r--r--base/levenshtein_dfa.cpp4
-rw-r--r--coding/compressed_bit_vector.cpp3
-rw-r--r--coding/point_to_integer.cpp6
-rw-r--r--coding/zlib.cpp3
-rw-r--r--drape_frontend/gui/ruler_helper.cpp3
-rw-r--r--drape_frontend/user_event_stream.cpp1
-rw-r--r--editor/edits_migration.cpp3
-rw-r--r--editor/xml_feature.cpp3
-rw-r--r--generator/osm_element.cpp3
-rw-r--r--generator/osm_o5m_source.hpp2
-rw-r--r--geometry/line2d.cpp3
-rw-r--r--indexer/feature_decl.cpp3
-rw-r--r--indexer/ftraits.hpp3
-rw-r--r--indexer/ftypes_matcher.cpp3
-rw-r--r--indexer/interval_index_builder.hpp26
-rw-r--r--indexer/mwm_set.cpp3
-rw-r--r--indexer/postcodes_matcher.cpp3
-rw-r--r--kml/serdes.cpp3
-rw-r--r--kml/types.hpp9
-rw-r--r--map/booking_filter_cache.cpp3
-rw-r--r--map/bookmark.cpp6
-rw-r--r--map/bookmark_helpers.hpp3
-rw-r--r--map/bookmark_manager.cpp13
-rw-r--r--map/chart_generator.cpp6
-rw-r--r--map/cloud.cpp3
-rw-r--r--map/cloud.hpp9
-rw-r--r--map/discovery/discovery_manager.cpp2
-rw-r--r--map/framework.cpp3
-rw-r--r--map/gps_track_filter.cpp3
-rw-r--r--map/mwm_url.cpp3
-rw-r--r--map/osm_opening_hours.hpp5
-rw-r--r--map/routing_manager.cpp7
-rw-r--r--map/routing_mark.cpp6
-rw-r--r--map/user.cpp3
-rw-r--r--map/user_mark.cpp3
-rw-r--r--openlr/openlr_match_quality/openlr_assessment_tool/traffic_mode.cpp2
-rw-r--r--partners_api/banner.hpp5
-rw-r--r--partners_api/taxi_places_loader.cpp3
-rw-r--r--partners_api/taxi_provider.hpp6
-rw-r--r--platform/country_defines.cpp3
-rw-r--r--platform/local_country_file_utils.cpp3
-rw-r--r--platform/measurement_utils.cpp15
-rw-r--r--platform/measurement_utils.hpp3
-rw-r--r--platform/mwm_traits.cpp6
-rw-r--r--platform/platform.cpp6
-rw-r--r--platform/settings.cpp6
-rw-r--r--platform/settings.hpp8
-rw-r--r--qt/mainwindow.cpp5
-rw-r--r--routing/bicycle_directions.cpp2
-rw-r--r--routing/cross_mwm_connector.cpp3
-rw-r--r--routing/cross_mwm_connector.hpp3
-rw-r--r--routing/edge_estimator.cpp3
-rw-r--r--routing/index_router.cpp14
-rw-r--r--routing/index_router.hpp3
-rw-r--r--routing/road_graph.cpp3
-rw-r--r--routing/routing_session.cpp3
-rw-r--r--routing/routing_settings.cpp3
-rw-r--r--routing/routing_tests/index_graph_test.cpp2
-rw-r--r--routing/routing_tests/restriction_test.cpp8
-rw-r--r--routing/transit_info.hpp3
-rw-r--r--routing/vehicle_mask.cpp3
-rw-r--r--search/geocoder.cpp3
-rw-r--r--search/geocoder_context.cpp9
-rw-r--r--search/geocoder_locality.cpp3
-rw-r--r--search/house_numbers_matcher.cpp9
-rw-r--r--search/keyword_matcher.cpp2
-rw-r--r--search/mwm_context.cpp3
-rw-r--r--search/nested_rects_cache.cpp3
-rw-r--r--search/ranker.cpp6
-rw-r--r--search/result.cpp2
-rw-r--r--search/retrieval.cpp3
-rw-r--r--search/search_quality/assessment_tool/main_model.cpp3
-rw-r--r--search/search_tests/keyword_matcher_test.cpp5
-rw-r--r--storage/storage_defines.cpp12
-rw-r--r--storage/storage_integration_tests/storage_http_tests.cpp8
-rw-r--r--storage/storage_tests/storage_tests.cpp6
-rw-r--r--traffic/speed_groups.cpp3
-rw-r--r--ugc/serdes.hpp2
-rw-r--r--ugc/storage.hpp3
84 files changed, 166 insertions, 233 deletions
diff --git a/3party/freetype/CMakeLists.txt b/3party/freetype/CMakeLists.txt
index d3ab9c9a70..a7e59c4fff 100644
--- a/3party/freetype/CMakeLists.txt
+++ b/3party/freetype/CMakeLists.txt
@@ -9,8 +9,10 @@ endif ()
add_compile_options("-Wall")
add_clang_compile_options("-Wno-unused-function")
-add_gcc_compile_options("-Wno-pointer-to-int-cast")
-add_gcc_compile_options("-Wno-unused-function")
+add_gcc_compile_options(
+ "-Wno-pointer-to-int-cast"
+ "-Wno-unused-function"
+)
include_directories(include)
diff --git a/3party/opening_hours/CMakeLists.txt b/3party/opening_hours/CMakeLists.txt
index 616d9fc769..ac4cc60787 100644
--- a/3party/opening_hours/CMakeLists.txt
+++ b/3party/opening_hours/CMakeLists.txt
@@ -12,8 +12,10 @@ add_compile_options(
)
add_clang_compile_options("-Wno-unused-local-typedef")
-add_gcc_compile_options("-Wno-unused-local-typedef")
-add_gcc_compile_options("-Wno-return-type")
+add_gcc_compile_options(
+ "-Wno-unused-local-typedef"
+ "-Wno-return-type"
+)
set(
SRC
diff --git a/base/assert.hpp b/base/assert.hpp
index abbd8b01b9..ab16850ed7 100644
--- a/base/assert.hpp
+++ b/base/assert.hpp
@@ -94,7 +94,7 @@ namespace my
// The macro that causes the warning to be ignored: control reaches end of
// non-void function.
-#define INCORRECT_VALUE_IN_THE_SWITCH() do { \
+#define CHECK_SWITCH() do { \
CHECK(false, ("Incorrect value in the switch statment")); \
std::abort(); \
} while(false)
diff --git a/base/base_tests/levenshtein_dfa_test.cpp b/base/base_tests/levenshtein_dfa_test.cpp
index 2c27c0ea3b..112d1e2228 100644
--- a/base/base_tests/levenshtein_dfa_test.cpp
+++ b/base/base_tests/levenshtein_dfa_test.cpp
@@ -42,8 +42,7 @@ string DebugPrint(Status status)
case Status::Rejects: return "Rejects";
case Status::Intermediate: return "Intermediate";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
string DebugPrint(Result const & result)
diff --git a/base/base_tests/stl_helpers_test.cpp b/base/base_tests/stl_helpers_test.cpp
index 59f8315455..12ebe85699 100644
--- a/base/base_tests/stl_helpers_test.cpp
+++ b/base/base_tests/stl_helpers_test.cpp
@@ -91,16 +91,16 @@ UNIT_TEST(LessBy)
std::vector<Value> v = {{2, 2}, {0, 4}, {3, 1}, {4, 0}, {1, 3}};
std::sort(v.begin(), v.end(), my::LessBy(&Value::first));
- for (int i = 0; i < static_cast<int>(v.size()); ++i)
- TEST_EQUAL(i, v[i].first, ());
+ for (size_t i = 0; i < v.size(); ++i)
+ TEST_EQUAL(i, static_cast<size_t>(v[i].first), ());
std::vector<Value const *> pv;
for (auto const & p : v)
pv.push_back(&p);
std::sort(pv.begin(), pv.end(), my::LessBy(&Value::second));
- for (int i = 0; i < static_cast<int>(pv.size()); ++i)
- TEST_EQUAL(i, pv[i]->second, ());
+ for (size_t i = 0; i < pv.size(); ++i)
+ TEST_EQUAL(i, static_cast<size_t>(pv[i]->second), ());
}
{
diff --git a/base/levenshtein_dfa.cpp b/base/levenshtein_dfa.cpp
index 82da404b61..7ea5023724 100644
--- a/base/levenshtein_dfa.cpp
+++ b/base/levenshtein_dfa.cpp
@@ -4,11 +4,11 @@
#include "base/stl_helpers.hpp"
#include <algorithm>
+#include <iterator>
#include <queue>
#include <set>
#include <sstream>
#include <vector>
-#include <iterator>
namespace strings
{
@@ -201,7 +201,7 @@ LevenshteinDFA::LevenshteinDFA(UniString const & s, size_t prefixSize,
m_alphabet.assign(s.begin(), s.end());
CHECK_LESS_OR_EQUAL(prefixSize, s.size(), ());
- auto pSize = static_cast<typename std::iterator_traits<
+ auto const pSize = static_cast<typename std::iterator_traits<
UniString::iterator>::difference_type>(prefixSize);
for (auto it = s.begin(); std::distance(it, s.begin()) < pSize; ++it)
{
diff --git a/coding/compressed_bit_vector.cpp b/coding/compressed_bit_vector.cpp
index 01ed947c15..45b00abdcb 100644
--- a/coding/compressed_bit_vector.cpp
+++ b/coding/compressed_bit_vector.cpp
@@ -461,8 +461,7 @@ string DebugPrint(CompressedBitVector::StorageStrategy strat)
case CompressedBitVector::StorageStrategy::Dense: return "Dense";
case CompressedBitVector::StorageStrategy::Sparse: return "Sparse";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
// static
diff --git a/coding/point_to_integer.cpp b/coding/point_to_integer.cpp
index 39d9cb583c..2e809e7bf1 100644
--- a/coding/point_to_integer.cpp
+++ b/coding/point_to_integer.cpp
@@ -8,8 +8,7 @@ int64_t PointToInt64Obsolete(double x, double y, uint32_t coordBits)
int64_t const res = static_cast<int64_t>(PointUToUint64Obsolete(PointDToPointU(x, y, coordBits)));
ASSERT_GREATER_OR_EQUAL(res, 0, ("Highest bits of (ix, iy) are not used, so res should be > 0."));
- ASSERT_LESS_OR_EQUAL(static_cast<uint64_t>(res),
- static_cast<uint64_t>(3ULL << 2 * POINT_COORD_BITS), ());
+ ASSERT_LESS_OR_EQUAL(static_cast<uint64_t>(res), uint64_t{3} << 2 * POINT_COORD_BITS, ());
return res;
}
@@ -21,8 +20,7 @@ int64_t PointToInt64Obsolete(m2::PointD const & pt, uint32_t coordBits)
m2::PointD Int64ToPointObsolete(int64_t v, uint32_t coordBits)
{
ASSERT_GREATER_OR_EQUAL(v, 0, ("Highest bits of (ix, iy) are not used, so res should be > 0."));
- ASSERT_LESS_OR_EQUAL(static_cast<uint64_t>(v),
- static_cast<uint64_t>(3ULL << 2 * POINT_COORD_BITS), ());
+ ASSERT_LESS_OR_EQUAL(static_cast<uint64_t>(v), uint64_t{3} << 2 * POINT_COORD_BITS, ());
return PointUToPointD(Uint64ToPointUObsolete(static_cast<uint64_t>(v)), coordBits);
}
diff --git a/coding/zlib.cpp b/coding/zlib.cpp
index 80b3c7ece5..9b156cd629 100644
--- a/coding/zlib.cpp
+++ b/coding/zlib.cpp
@@ -19,8 +19,7 @@ int ToInt(ZLib::Deflate::Level level)
case Level::BestCompression: return Z_BEST_COMPRESSION;
case Level::DefaultCompression: return Z_DEFAULT_COMPRESSION;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace
diff --git a/drape_frontend/gui/ruler_helper.cpp b/drape_frontend/gui/ruler_helper.cpp
index 498afdcf82..ba48c7e7c1 100644
--- a/drape_frontend/gui/ruler_helper.cpp
+++ b/drape_frontend/gui/ruler_helper.cpp
@@ -225,8 +225,7 @@ double RulerHelper::CalcMetresDiff(double value)
auto conversionFn = &Identity;
auto units = measurement_utils::Units::Metric;
- if (!settings::Get(settings::kMeasurementUnits, units))
- LOG(LWARNING, ("Unable to read settings:", settings::kMeasurementUnits));
+ settings::TryGet(settings::kMeasurementUnits, units);
if (units == measurement_utils::Units::Imperial)
{
diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp
index 92252f8c5d..e84b61b2a2 100644
--- a/drape_frontend/user_event_stream.cpp
+++ b/drape_frontend/user_event_stream.cpp
@@ -20,6 +20,7 @@
#include <chrono>
#include <cmath>
+#include <cstdint>
#ifdef DEBUG
#define TEST_CALL(action) if (m_testFn) m_testFn(action)
diff --git a/editor/edits_migration.cpp b/editor/edits_migration.cpp
index f0d410fa52..6e94f39f53 100644
--- a/editor/edits_migration.cpp
+++ b/editor/edits_migration.cpp
@@ -118,7 +118,6 @@ FeatureID MigrateFeatureIndex(osm::Editor::ForEachFeaturesNearByFn & forEach,
case XMLFeature::Type::Relation:
return MigrateWayOrRelatonFeatureIndex(forEach, xml, featureStatus, generateID);
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace editor
diff --git a/editor/xml_feature.cpp b/editor/xml_feature.cpp
index 1e785f06ea..596ebb7c06 100644
--- a/editor/xml_feature.cpp
+++ b/editor/xml_feature.cpp
@@ -400,8 +400,7 @@ string XMLFeature::TypeToString(Type type)
case Type::Way: return kWayType;
case Type::Relation: return kRelationType;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
// static
diff --git a/generator/osm_element.cpp b/generator/osm_element.cpp
index a6f63b7d4a..2da58ee258 100644
--- a/generator/osm_element.cpp
+++ b/generator/osm_element.cpp
@@ -28,8 +28,7 @@ std::string DebugPrint(OsmElement::EntityType e)
case OsmElement::EntityType::Member:
return "member";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
diff --git a/generator/osm_o5m_source.hpp b/generator/osm_o5m_source.hpp
index aec6d60a3e..5966ede0de 100644
--- a/generator/osm_o5m_source.hpp
+++ b/generator/osm_o5m_source.hpp
@@ -1,8 +1,8 @@
// See O5M Format definition at https://wiki.openstreetmap.org/wiki/O5m
#pragma once
-#include "base/stl_helpers.hpp"
#include "base/assert.hpp"
+#include "base/stl_helpers.hpp"
#include <algorithm>
#include <cstring>
diff --git a/geometry/line2d.cpp b/geometry/line2d.cpp
index fc94522155..d0074d37b2 100644
--- a/geometry/line2d.cpp
+++ b/geometry/line2d.cpp
@@ -61,8 +61,7 @@ string DebugPrint(LineIntersector::Result::Type type)
case Type::One: return "One";
case Type::Infinity: return "Infinity";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
string DebugPrint(LineIntersector::Result const & result)
diff --git a/indexer/feature_decl.cpp b/indexer/feature_decl.cpp
index 6379891958..37ea6c72cd 100644
--- a/indexer/feature_decl.cpp
+++ b/indexer/feature_decl.cpp
@@ -19,8 +19,7 @@ string DebugPrint(feature::EGeomType type)
case EGeomType::GEOM_LINE: return "GEOM_LINE";
case EGeomType::GEOM_AREA: return "GEOM_AREA";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
// static
diff --git a/indexer/ftraits.hpp b/indexer/ftraits.hpp
index 4af7c9874d..5fcc471c7d 100644
--- a/indexer/ftraits.hpp
+++ b/indexer/ftraits.hpp
@@ -207,8 +207,7 @@ inline std::string DebugPrint(WheelchairAvailability wheelchair)
case WheelchairAvailability::Yes: return "Yes";
case WheelchairAvailability::Limited: return "Limited";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
class Wheelchair : public TraitsBase<Wheelchair, WheelchairAvailability>
diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp
index 5caf6ae454..f8b9dc09a1 100644
--- a/indexer/ftypes_matcher.cpp
+++ b/indexer/ftypes_matcher.cpp
@@ -357,8 +357,7 @@ char const * IsHotelChecker::GetHotelTypeTag(Type type)
case Type::Resort: return "resort";
case Type::Count: CHECK(false, ("Can't get hotel type tag")); return "";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
IsWifiChecker::IsWifiChecker()
diff --git a/indexer/interval_index_builder.hpp b/indexer/interval_index_builder.hpp
index fc6a111573..c2d8f00cdf 100644
--- a/indexer/interval_index_builder.hpp
+++ b/indexer/interval_index_builder.hpp
@@ -1,16 +1,21 @@
#pragma once
+
#include "indexer/interval_index.hpp"
+
#include "coding/byte_stream.hpp"
#include "coding/endianness.hpp"
#include "coding/varint.hpp"
#include "coding/write_to_sink.hpp"
+
#include "base/assert.hpp"
#include "base/base.hpp"
#include "base/bits.hpp"
#include "base/logging.hpp"
-#include "std/vector.hpp"
+#include <cstdint>
#include <limits>
+#include <vector>
+
// +------------------------------+
// | Header |
// +------------------------------+
@@ -67,15 +72,15 @@ public:
WriteZeroesToSink(writer, 4 * (m_Levels + 2));
uint64_t const afterHeaderPos = writer.Pos();
- vector<uint32_t> levelOffset;
+ std::vector<uint32_t> levelOffset;
{
- vector<uint32_t> offsets;
+ std::vector<uint32_t> offsets;
levelOffset.push_back(static_cast<uint32_t>(writer.Pos()));
BuildLeaves(writer, beg, end, offsets);
levelOffset.push_back(static_cast<uint32_t>(writer.Pos()));
for (int i = 1; i <= static_cast<int>(m_Levels); ++i)
{
- vector<uint32_t> nextOffsets;
+ std::vector<uint32_t> nextOffsets;
BuildLevel(writer, beg, end, i, &offsets[0], &offsets[0] + offsets.size(), nextOffsets);
nextOffsets.swap(offsets);
levelOffset.push_back(static_cast<uint32_t>(writer.Pos()));
@@ -141,7 +146,8 @@ public:
for (CellIdValueIter it = beg; it != end; ++it)
{
CHECK_LESS(it->GetCell(), 1ULL << keyBits, ());
- CHECK_LESS_OR_EQUAL(it->GetValue(), std::numeric_limits<int64_t>::max(), ());
+ // We use static_cast<int64_t>(value) in BuildLeaves to store values difference as VarInt.
+ CHECK_LESS_OR_EQUAL(it->GetValue(), static_cast<uint64_t>(std::numeric_limits<int64_t>::max()), ());
}
return true;
@@ -150,10 +156,10 @@ public:
template <class SinkT>
uint32_t WriteNode(SinkT & sink, uint32_t offset, uint32_t * childSizes)
{
- vector<uint8_t> bitmapSerial, listSerial;
+ std::vector<uint8_t> bitmapSerial, listSerial;
bitmapSerial.reserve(1024);
listSerial.reserve(1024);
- PushBackByteSink<vector<uint8_t> > bitmapSink(bitmapSerial), listSink(listSerial);
+ PushBackByteSink<std::vector<uint8_t> > bitmapSink(bitmapSerial), listSink(listSerial);
WriteBitmapNode(bitmapSink, offset, childSizes);
WriteListNode(listSink, offset, childSizes);
if (bitmapSerial.size() <= listSerial.size())
@@ -173,12 +179,12 @@ public:
template <class Writer, typename CellIdValueIter>
void BuildLevel(Writer & writer, CellIdValueIter const & beg, CellIdValueIter const & end,
int level, uint32_t const * childSizesBeg, uint32_t const * childSizesEnd,
- vector<uint32_t> & sizes)
+ std::vector<uint32_t> & sizes)
{
UNUSED_VALUE(childSizesEnd);
ASSERT_GREATER(level, 0, ());
uint32_t const skipBits = m_LeafBytes * 8 + (level - 1) * m_BitsPerLevel;
- vector<uint32_t> expandedSizes(1 << m_BitsPerLevel);
+ std::vector<uint32_t> expandedSizes(1 << m_BitsPerLevel);
uint64_t prevKey = static_cast<uint64_t>(-1);
uint32_t childOffset = 0;
uint32_t nextChildOffset = 0;
@@ -206,7 +212,7 @@ public:
template <class Writer, typename CellIdValueIter>
void BuildLeaves(Writer & writer, CellIdValueIter const & beg, CellIdValueIter const & end,
- vector<uint32_t> & sizes)
+ std::vector<uint32_t> & sizes)
{
using Value = typename CellIdValueIter::value_type::ValueType;
diff --git a/indexer/mwm_set.cpp b/indexer/mwm_set.cpp
index 855555310f..9c7adfcefc 100644
--- a/indexer/mwm_set.cpp
+++ b/indexer/mwm_set.cpp
@@ -448,8 +448,7 @@ string DebugPrint(MwmSet::RegResult result)
case MwmSet::RegResult::UnsupportedFileFormat:
return "UnsupportedFileFormat";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
string DebugPrint(MwmSet::Event::Type type)
diff --git a/indexer/postcodes_matcher.cpp b/indexer/postcodes_matcher.cpp
index 031de717f0..78c2e0ad07 100644
--- a/indexer/postcodes_matcher.cpp
+++ b/indexer/postcodes_matcher.cpp
@@ -64,8 +64,7 @@ public:
case TStringSet::Status::Prefix: return isPrefix;
case TStringSet::Status::Full: return true;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
inline size_t GetMaxNumTokensInPostcode() const { return m_maxNumTokensInPostcode; }
diff --git a/kml/serdes.cpp b/kml/serdes.cpp
index a0cb2c018d..fe6dbab05b 100644
--- a/kml/serdes.cpp
+++ b/kml/serdes.cpp
@@ -122,8 +122,7 @@ std::string GetStyleForPredefinedColor(PredefinedColor color)
case PredefinedColor::Count:
return {};
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
BookmarkIcon GetIcon(std::string const & iconName)
diff --git a/kml/types.hpp b/kml/types.hpp
index ec862f1fdd..55855ea67b 100644
--- a/kml/types.hpp
+++ b/kml/types.hpp
@@ -43,8 +43,7 @@ inline std::string DebugPrint(PredefinedColor color)
case PredefinedColor::Orange: return "Orange";
case PredefinedColor::Count: return {};
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
enum class AccessRules : uint8_t
@@ -63,8 +62,7 @@ inline std::string DebugPrint(AccessRules accessRules)
case AccessRules::Public: return "Public";
case AccessRules::Count: return {};
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
enum class BookmarkIcon : uint16_t
@@ -120,8 +118,7 @@ inline std::string DebugPrint(BookmarkIcon icon)
case BookmarkIcon::Water: return "Water";
case BookmarkIcon::Count: return {};
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
struct ColorData
diff --git a/map/booking_filter_cache.cpp b/map/booking_filter_cache.cpp
index 8db2cafbb1..4a8c7aacd5 100644
--- a/map/booking_filter_cache.cpp
+++ b/map/booking_filter_cache.cpp
@@ -106,8 +106,7 @@ std::string DebugPrint(Cache::HotelStatus status)
case Cache::HotelStatus::Unavailable: return "Unavailable";
case Cache::HotelStatus::Available: return "Available";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace availability
} // namespace filter
diff --git a/map/bookmark.cpp b/map/bookmark.cpp
index 58599d4302..2ed09ae523 100644
--- a/map/bookmark.cpp
+++ b/map/bookmark.cpp
@@ -36,8 +36,7 @@ std::string GetBookmarkIconType(kml::BookmarkIcon const & icon)
ASSERT(false, ("Invalid bookmark icon type"));
return {};
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace
@@ -107,8 +106,7 @@ df::ColorConstant Bookmark::GetColorConstant() const
case kml::PredefinedColor::Count:
return "BookmarkRed";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
bool Bookmark::HasCreationAnimation() const
diff --git a/map/bookmark_helpers.hpp b/map/bookmark_helpers.hpp
index f2b4d0dad8..8ba57f344b 100644
--- a/map/bookmark_helpers.hpp
+++ b/map/bookmark_helpers.hpp
@@ -26,8 +26,7 @@ inline std::string DebugPrint(KmlFileType fileType)
case KmlFileType::Text: return "Text";
case KmlFileType::Binary: return "Binary";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
std::unique_ptr<kml::FileData> LoadKmlFile(std::string const & file, KmlFileType fileType);
diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp
index 5bb39e6960..1fc02e4dc0 100644
--- a/map/bookmark_manager.cpp
+++ b/map/bookmark_manager.cpp
@@ -97,8 +97,7 @@ bool IsValidFilterType(BookmarkManager::CategoryFilterType const filter,
case BookmarkManager::CategoryFilterType::Public: return fromCatalog;
case BookmarkManager::CategoryFilterType::Private: return !fromCatalog;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
class FindMarkFunctor
@@ -345,10 +344,11 @@ bool MigrateIfNeeded()
if (files.empty())
{
auto const newBookmarksDir = GetBookmarksDirectory();
- if (!GetPlatform().IsFileExistsByFullPath(newBookmarksDir))
+ if (!GetPlatform().IsFileExistsByFullPath(newBookmarksDir) &&
+ !GetPlatform().MkDirChecked(newBookmarksDir))
{
- if(!GetPlatform().MkDirChecked(newBookmarksDir))
- LOG(LWARNING, ("Could not create directory:", newBookmarksDir));
+ LOG(LWARNING, ("Could not create directory:", newBookmarksDir));
+ return false;
}
OnMigrationSuccess(0 /* originalCount */, 0 /* convertedCount */);
return true;
@@ -899,8 +899,7 @@ void BookmarkManager::SaveState() const
void BookmarkManager::LoadState()
{
- if(!settings::Get(kLastEditedBookmarkCategory, m_lastCategoryUrl))
- LOG(LWARNING, ("Unable to read settings:", kLastEditedBookmarkCategory));
+ settings::TryGet(kLastEditedBookmarkCategory, m_lastCategoryUrl);
uint32_t color;
if (settings::Get(kLastEditedBookmarkColor, color) &&
diff --git a/map/chart_generator.cpp b/map/chart_generator.cpp
index 792aa1d66a..8983afd2b3 100644
--- a/map/chart_generator.cpp
+++ b/map/chart_generator.cpp
@@ -63,8 +63,7 @@ agg::rgba8 GetLineColor(MapStyle mapStyle)
case MapStyleMerged:
return agg::rgba8(30, 150, 240, 255);
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
agg::rgba8 GetCurveColor(MapStyle mapStyle)
@@ -82,8 +81,7 @@ agg::rgba8 GetCurveColor(MapStyle mapStyle)
case MapStyleMerged:
return agg::rgba8(30, 150, 240, 20);
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace
diff --git a/map/cloud.cpp b/map/cloud.cpp
index 4337ff024d..c72f62a6a0 100644
--- a/map/cloud.cpp
+++ b/map/cloud.cpp
@@ -128,8 +128,7 @@ bool CanUpload(uint64_t totalUploadingSize)
return platform::GetCurrentNetworkPolicy().CanUse() &&
totalUploadingSize <= kMaxWwanUploadingSizeInBytes;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
struct SnapshotCreateRequestData
diff --git a/map/cloud.hpp b/map/cloud.hpp
index 0639b8ac64..52a5ccf446 100644
--- a/map/cloud.hpp
+++ b/map/cloud.hpp
@@ -391,8 +391,7 @@ inline std::string DebugPrint(Cloud::SynchronizationType type)
case Cloud::SynchronizationType::Backup: return "Backup";
case Cloud::SynchronizationType::Restore: return "Restore";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
inline std::string DebugPrint(Cloud::SynchronizationResult result)
@@ -406,8 +405,7 @@ inline std::string DebugPrint(Cloud::SynchronizationResult result)
case Cloud::SynchronizationResult::UserInterrupted: return "UserInterrupted";
case Cloud::SynchronizationResult::InvalidCall: return "InvalidCall";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
inline std::string DebugPrint(Cloud::RestoringRequestResult result)
@@ -418,6 +416,5 @@ inline std::string DebugPrint(Cloud::RestoringRequestResult result)
case Cloud::RestoringRequestResult::NoBackup: return "NoBackup";
case Cloud::RestoringRequestResult::NotEnoughDiskSpace: return "NotEnoughDiskSpace";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
diff --git a/map/discovery/discovery_manager.cpp b/map/discovery/discovery_manager.cpp
index 7cf9a54eb1..eec782d717 100644
--- a/map/discovery/discovery_manager.cpp
+++ b/map/discovery/discovery_manager.cpp
@@ -17,7 +17,7 @@ std::string GetQuery(discovery::ItemType const type)
case discovery::ItemType::Viator: ASSERT(false, ()); return "";
}
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace
diff --git a/map/framework.cpp b/map/framework.cpp
index ce6b0be202..494bb86889 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -1924,8 +1924,7 @@ void Framework::SetupMeasurementSystem()
GetPlatform().SetupMeasurementSystem();
auto units = measurement_utils::Units::Metric;
- if (!settings::Get(settings::kMeasurementUnits, units))
- LOG(LWARNING, ("Unable to read settings:", settings::kMeasurementUnits));
+ settings::TryGet(settings::kMeasurementUnits, units);
m_routingManager.SetTurnNotificationsUnits(units);
}
diff --git a/map/gps_track_filter.cpp b/map/gps_track_filter.cpp
index 130d97d10e..1ce1ffd57b 100644
--- a/map/gps_track_filter.cpp
+++ b/map/gps_track_filter.cpp
@@ -57,8 +57,7 @@ GpsTrackFilter::GpsTrackFilter()
, m_countLastInfo(0)
, m_countAcceptedInfo(0)
{
- if (!settings::Get(kMinHorizontalAccuracyKey, m_minAccuracy))
- LOG(LWARNING, ("Unable to read settings:", kMinHorizontalAccuracyKey));
+ settings::TryGet(kMinHorizontalAccuracyKey, m_minAccuracy);
}
void GpsTrackFilter::Process(vector<location::GpsInfo> const & inPoints,
diff --git a/map/mwm_url.cpp b/map/mwm_url.cpp
index b1eee93812..82f25f80a4 100644
--- a/map/mwm_url.cpp
+++ b/map/mwm_url.cpp
@@ -259,8 +259,7 @@ ParsedMapApi::ParsingResult ParsedMapApi::Parse(Uri const & uri)
return ParsingResult::Lead;
}
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
bool ParsedMapApi::RouteKeyValue(string const & key, string const & value, vector<string> & pattern)
diff --git a/map/osm_opening_hours.hpp b/map/osm_opening_hours.hpp
index 368ff84d6c..c173dbd7ba 100644
--- a/map/osm_opening_hours.hpp
+++ b/map/osm_opening_hours.hpp
@@ -2,6 +2,8 @@
#include "3party/opening_hours/opening_hours.hpp"
+#include "base/assert.hpp"
+
#include "std/chrono.hpp"
namespace osm
@@ -27,8 +29,7 @@ inline string DebugPrint(EPlaceState state)
case EPlaceState::CloseSoon:
return "EPlaceState::CloseSoon";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
inline EPlaceState PlaceStateCheck(string const & openingHours, time_t timestamp)
diff --git a/map/routing_manager.cpp b/map/routing_manager.cpp
index af173a578f..91739aa548 100644
--- a/map/routing_manager.cpp
+++ b/map/routing_manager.cpp
@@ -207,8 +207,7 @@ VehicleType GetVehicleType(RouterType routerType)
case RouterType::Transit: return VehicleType::Transit;
case RouterType::Count: CHECK(false, ("Invalid type", routerType)); return VehicleType::Count;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace
@@ -1039,9 +1038,7 @@ bool RoutingManager::IsTrackingReporterEnabled() const
return false;
bool enableTracking = true;
- if (!settings::Get(tracking::Reporter::kEnableTrackingKey, enableTracking))
- LOG(LWARNING, ("Unable to read settings:",
- tracking::Reporter::kEnableTrackingKey));
+ settings::TryGet(tracking::Reporter::kEnableTrackingKey, enableTracking);
return enableTracking;
}
diff --git a/map/routing_mark.cpp b/map/routing_mark.cpp
index 0ab90d534c..8a8fceefba 100644
--- a/map/routing_mark.cpp
+++ b/map/routing_mark.cpp
@@ -102,8 +102,7 @@ uint16_t RouteMarkPoint::GetPriority() const
}
}
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
uint32_t RouteMarkPoint::GetIndex() const
@@ -114,8 +113,7 @@ uint32_t RouteMarkPoint::GetIndex() const
case RouteMarkType::Finish: return 1;
case RouteMarkType::Intermediate: return static_cast<uint32_t >(m_markData.m_intermediateIndex + 2);
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
void RouteMarkPoint::SetMarkData(RouteMarkData && data)
diff --git a/map/user.cpp b/map/user.cpp
index ef4fcc8696..7f73ca2bd1 100644
--- a/map/user.cpp
+++ b/map/user.cpp
@@ -68,8 +68,7 @@ std::string AuthenticationUrl(std::string const & socialToken,
return ss.str();
}
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
std::string UserDetailsUrl()
diff --git a/map/user_mark.cpp b/map/user_mark.cpp
index f757f29f33..60d97a8947 100644
--- a/map/user_mark.cpp
+++ b/map/user_mark.cpp
@@ -86,6 +86,5 @@ string DebugPrint(UserMark::Type type)
case UserMark::Type::USER_MARK_TYPES_COUNT: return "USER_MARK_TYPES_COUNT";
case UserMark::Type::USER_MARK_TYPES_COUNT_MAX: return "USER_MARK_TYPES_COUNT_MAX";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
diff --git a/openlr/openlr_match_quality/openlr_assessment_tool/traffic_mode.cpp b/openlr/openlr_match_quality/openlr_assessment_tool/traffic_mode.cpp
index abcf4fb241..3b818c180e 100644
--- a/openlr/openlr_match_quality/openlr_assessment_tool/traffic_mode.cpp
+++ b/openlr/openlr_match_quality/openlr_assessment_tool/traffic_mode.cpp
@@ -241,7 +241,7 @@ void TrafficMode::OnItemSelected(QItemSelection const & selected, QItemSelection
auto const row = selected.front().top();
- CHECK_LESS(row, static_cast<decltype(row)>(m_segments.size()), ());
+ CHECK_LESS(static_cast<size_t>(row), m_segments.size(), ());
m_currentSegment = &m_segments[row];
auto const & partnerSegment = m_currentSegment->GetPartnerSegment();
diff --git a/partners_api/banner.hpp b/partners_api/banner.hpp
index bbee5c477f..099b38651e 100644
--- a/partners_api/banner.hpp
+++ b/partners_api/banner.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include "base/assert.hpp"
+
#include <string>
namespace ads
@@ -32,7 +34,6 @@ inline std::string DebugPrint(Banner::Type type)
case Banner::Type::Mopub: return "Mopub";
case Banner::Type::Google: return "Google";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace ads
diff --git a/partners_api/taxi_places_loader.cpp b/partners_api/taxi_places_loader.cpp
index 1bf69ae6cb..b430ff4529 100644
--- a/partners_api/taxi_places_loader.cpp
+++ b/partners_api/taxi_places_loader.cpp
@@ -55,8 +55,7 @@ std::string Loader::GetFileNameByProvider(Provider::Type const type)
case Provider::Type::Yandex: return "taxi_places/yandex.json";
case Provider::Type::Count: LOG(LERROR, ("Incorrect taxi provider")); return "";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace places
} // namespace taxi
diff --git a/partners_api/taxi_provider.hpp b/partners_api/taxi_provider.hpp
index f1ca17d852..a5536d5c03 100644
--- a/partners_api/taxi_provider.hpp
+++ b/partners_api/taxi_provider.hpp
@@ -82,8 +82,7 @@ inline std::string DebugPrint(Provider::Type type)
case Provider::Type::Maxim: return "Maxim";
case Provider::Type::Count: ASSERT(false, ()); return "";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
inline std::string DebugPrint(ErrorCode code)
@@ -93,8 +92,7 @@ inline std::string DebugPrint(ErrorCode code)
case ErrorCode::NoProducts: return "NoProducts";
case ErrorCode::RemoteError: return "RemoteError";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
inline std::string DebugPrint(ProviderError error)
diff --git a/platform/country_defines.cpp b/platform/country_defines.cpp
index 4fd2b7684a..1533887524 100644
--- a/platform/country_defines.cpp
+++ b/platform/country_defines.cpp
@@ -38,6 +38,5 @@ string DebugPrint(MapOptions options)
case MapOptions::Diff:
return "Diff";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
diff --git a/platform/local_country_file_utils.cpp b/platform/local_country_file_utils.cpp
index ac507eaf57..2afaf2f204 100644
--- a/platform/local_country_file_utils.cpp
+++ b/platform/local_country_file_utils.cpp
@@ -467,7 +467,6 @@ string DebugPrint(CountryIndexes::Index index)
case CountryIndexes::Index::Offsets:
return "Offsets";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace platform
diff --git a/platform/measurement_utils.cpp b/platform/measurement_utils.cpp
index f3352e36fa..42ab2b5fc5 100644
--- a/platform/measurement_utils.cpp
+++ b/platform/measurement_utils.cpp
@@ -56,8 +56,7 @@ bool FormatDistanceImpl(double m, string & res,
bool FormatDistance(double m, string & res)
{
auto units = Units::Metric;
- if (!Get(settings::kMeasurementUnits, units))
- LOG(LWARNING, ("Unable to read settings:", settings::kMeasurementUnits));
+ TryGet(settings::kMeasurementUnits, units);
/// @todo Put string units resources.
switch (units)
@@ -65,8 +64,7 @@ bool FormatDistance(double m, string & res)
case Units::Imperial: return FormatDistanceImpl(m, res, " mi", " ft", 1609.344, 0.3048);
case Units::Metric: return FormatDistanceImpl(m, res, " km", " m", 1000.0, 1.0);
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
@@ -167,8 +165,7 @@ void FormatMercator(m2::PointD const & mercator, string & lat, string & lon, int
string FormatAltitude(double altitudeInMeters)
{
Units units = Units::Metric;
- if (!Get(settings::kMeasurementUnits, units))
- LOG(LWARNING, ("Unable to read settings:", settings::kMeasurementUnits));
+ TryGet(settings::kMeasurementUnits, units);
ostringstream ss;
ss << fixed << setprecision(0);
@@ -185,8 +182,7 @@ string FormatAltitude(double altitudeInMeters)
string FormatSpeedWithDeviceUnits(double metersPerSecond)
{
auto units = Units::Metric;
- if (!Get(settings::kMeasurementUnits, units))
- LOG(LWARNING, ("Unable to read settings:", settings::kMeasurementUnits));
+ TryGet(settings::kMeasurementUnits, units);
return FormatSpeedWithUnits(metersPerSecond, units);
}
@@ -215,8 +211,7 @@ string FormatSpeedUnits(Units units)
case Units::Imperial: return "mph";
case Units::Metric: return "km/h";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
bool OSMDistanceToMeters(string const & osmRawValue, double & outMeters)
diff --git a/platform/measurement_utils.hpp b/platform/measurement_utils.hpp
index 3af3248ac6..d4251b509e 100644
--- a/platform/measurement_utils.hpp
+++ b/platform/measurement_utils.hpp
@@ -19,8 +19,7 @@ inline string DebugPrint(Units units)
case Units::Imperial: return "Units::Imperial";
case Units::Metric: return "Units::Metric";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
inline double MetersToMiles(double m) { return m * 0.000621371192; }
diff --git a/platform/mwm_traits.cpp b/platform/mwm_traits.cpp
index d9d3355b6c..471effd226 100644
--- a/platform/mwm_traits.cpp
+++ b/platform/mwm_traits.cpp
@@ -40,8 +40,7 @@ string DebugPrint(MwmTraits::SearchIndexFormat format)
case MwmTraits::SearchIndexFormat::CompressedBitVector:
return "CompressedBitVector";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
string DebugPrint(MwmTraits::HouseToStreetTableFormat format)
@@ -53,7 +52,6 @@ string DebugPrint(MwmTraits::HouseToStreetTableFormat format)
case MwmTraits::HouseToStreetTableFormat::Unknown:
return "Unknown";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace version
diff --git a/platform/platform.cpp b/platform/platform.cpp
index 39cb0589e3..3f2edf3d36 100644
--- a/platform/platform.cpp
+++ b/platform/platform.cpp
@@ -306,8 +306,7 @@ string DebugPrint(Platform::EError err)
case Platform::ERR_IO_ERROR: return "An I/O error occurred.";
case Platform::ERR_UNKNOWN: return "Unknown";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
string DebugPrint(Platform::ChargingStatus status)
@@ -318,6 +317,5 @@ string DebugPrint(Platform::ChargingStatus status)
case Platform::ChargingStatus::Plugged: return "Plugged";
case Platform::ChargingStatus::Unplugged: return "Unplugged";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
diff --git a/platform/settings.cpp b/platform/settings.cpp
index ac608631c7..f26b39d2e4 100644
--- a/platform/settings.cpp
+++ b/platform/settings.cpp
@@ -280,8 +280,7 @@ string ToString<measurement_utils::Units>(measurement_utils::Units const & v)
case measurement_utils::Units::Imperial: return "Foot";
case measurement_utils::Units::Metric: return "Metric";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
template <>
@@ -338,8 +337,7 @@ string ToString<Transliteration::Mode>(Transliteration::Mode const & mode)
case Transliteration::Mode::Enabled: return "Enabled";
case Transliteration::Mode::Disabled: return "Disabled";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
template <>
diff --git a/platform/settings.hpp b/platform/settings.hpp
index e6d42945da..213a535ca2 100644
--- a/platform/settings.hpp
+++ b/platform/settings.hpp
@@ -35,6 +35,14 @@ WARN_UNUSED_RESULT bool Get(string const & key, Value & outValue)
string strVal;
return StringStorage::Instance().GetValue(key, strVal) && FromString(strVal, outValue);
}
+
+template <class Value>
+void TryGet(string const & key, Value & outValue)
+{
+ bool unused = Get(key, outValue);
+ UNUSED_VALUE(unused);
+}
+
/// Automatically saves setting to external file
template <class Value>
void Set(string const & key, Value const & value)
diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp
index 09930b960e..4a3b9c80a8 100644
--- a/qt/mainwindow.cpp
+++ b/qt/mainwindow.cpp
@@ -124,9 +124,8 @@ MainWindow::MainWindow(Framework & framework, bool apiOpenGLES3, QString const &
#ifndef NO_DOWNLOADER
// Show intro dialog if necessary
bool bShow = true;
- const string showWelcome = "ShowWelcome";
- if (!settings::Get(showWelcome, bShow))
- LOG(LWARNING, ("Unable to read settings:", showWelcome));
+ string const showWelcome = "ShowWelcome";
+ settings::TryGet(showWelcome, bShow);
if (bShow)
{
diff --git a/routing/bicycle_directions.cpp b/routing/bicycle_directions.cpp
index 83ccc1073c..c4496e4229 100644
--- a/routing/bicycle_directions.cpp
+++ b/routing/bicycle_directions.cpp
@@ -345,7 +345,7 @@ void BicycleDirectionsEngine::FillPathSegmentsAndAdjacentEdgesMap(
continue;
}
- CHECK_EQUAL(prevJunctions.size(), static_cast<typename vector<Junction>::size_type>(
+ CHECK_EQUAL(prevJunctions.size(), static_cast<size_t>(
abs(static_cast<int32_t>(inSegId - startSegId)) + 1), ());
prevJunctions.push_back(currJunction);
diff --git a/routing/cross_mwm_connector.cpp b/routing/cross_mwm_connector.cpp
index 5b662b2e44..575c3467c8 100644
--- a/routing/cross_mwm_connector.cpp
+++ b/routing/cross_mwm_connector.cpp
@@ -13,8 +13,7 @@ std::string DebugPrint(WeightsLoadState state)
case WeightsLoadState::NotExists: return "NotExists";
case WeightsLoadState::Loaded: return "Loaded";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace connector
} // namespace routing
diff --git a/routing/cross_mwm_connector.hpp b/routing/cross_mwm_connector.hpp
index 7d623dbea6..deeeef2d6f 100644
--- a/routing/cross_mwm_connector.hpp
+++ b/routing/cross_mwm_connector.hpp
@@ -180,8 +180,7 @@ public:
case connector::WeightsLoadState::NotExists:
case connector::WeightsLoadState::Loaded: return true;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
template <typename CalcWeight>
diff --git a/routing/edge_estimator.cpp b/routing/edge_estimator.cpp
index 0c257d3034..6a45224845 100644
--- a/routing/edge_estimator.cpp
+++ b/routing/edge_estimator.cpp
@@ -214,8 +214,7 @@ shared_ptr<EdgeEstimator> EdgeEstimator::Create(VehicleType vehicleType, double
CHECK(false, ("Can't create EdgeEstimator for", vehicleType));
return nullptr;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
// static
diff --git a/routing/index_router.cpp b/routing/index_router.cpp
index d5f7145fdd..36653fc488 100644
--- a/routing/index_router.cpp
+++ b/routing/index_router.cpp
@@ -98,8 +98,7 @@ shared_ptr<VehicleModelFactoryInterface> CreateVehicleModelFactory(
CHECK(false, ("Can't create VehicleModelFactoryInterface for", vehicleType));
return nullptr;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
unique_ptr<IDirectionsEngine> CreateDirectionsEngine(VehicleType vehicleType,
@@ -117,8 +116,7 @@ unique_ptr<IDirectionsEngine> CreateDirectionsEngine(VehicleType vehicleType,
CHECK(false, ("Can't create DirectionsEngine for", vehicleType));
return nullptr;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
shared_ptr<TrafficStash> CreateTrafficStash(VehicleType vehicleType, shared_ptr<NumMwmIds> numMwmIds,
@@ -765,9 +763,9 @@ RouterResultCode IndexRouter::ProcessLeaps(vector<Segment> const & input,
auto const lastMwmId = input[input.size() - 2].GetMwmId();
auto const finishLeapStartIt = find_if(startLeapEndIt, input.end(),
[lastMwmId](Segment const & s) { return s.GetMwmId() == lastMwmId; });
- auto const finishLeapStart = distance(input.begin(), finishLeapStartIt);
+ auto const finishLeapStart = static_cast<size_t>(distance(input.begin(), finishLeapStartIt));
- for (vector<Segment>::difference_type i = 0; i <= finishLeapStart; ++i)
+ for (size_t i = 0; i <= finishLeapStart; ++i)
{
auto const & current = input[i];
@@ -784,7 +782,7 @@ RouterResultCode IndexRouter::ProcessLeaps(vector<Segment> const & input,
{
bool const isStartLeap = i == 0;
i = isStartLeap ? startLeapEnd : input.size() - 1;
- CHECK_LESS(static_cast<vector<Segment>::size_type>(i), input.size(), ());
+ CHECK_LESS(static_cast<size_t>(i), input.size(), ());
auto const & next = input[i];
// First start-to-mwm-exit and last mwm-enter-to-finish leaps need special processing.
@@ -811,7 +809,7 @@ RouterResultCode IndexRouter::ProcessLeaps(vector<Segment> const & input,
else
{
++i;
- CHECK_LESS(static_cast<vector<Segment>::size_type>(i), input.size(), ());
+ CHECK_LESS(static_cast<size_t>(i), input.size(), ());
auto const & next = input[i];
CHECK(!IndexGraphStarter::IsFakeSegment(current), ());
diff --git a/routing/index_router.hpp b/routing/index_router.hpp
index 893aa48fad..418115eabe 100644
--- a/routing/index_router.hpp
+++ b/routing/index_router.hpp
@@ -127,8 +127,7 @@ private:
case AStarAlgorithm<Graph>::Result::Cancelled: return RouterResultCode::Cancelled;
case AStarAlgorithm<Graph>::Result::OK: return RouterResultCode::NoError;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
template <typename Graph>
diff --git a/routing/road_graph.cpp b/routing/road_graph.cpp
index f6889ea047..db342212c3 100644
--- a/routing/road_graph.cpp
+++ b/routing/road_graph.cpp
@@ -310,8 +310,7 @@ string DebugPrint(IRoadGraph::Mode mode)
case IRoadGraph::Mode::ObeyOnewayTag: return "ObeyOnewayTag";
case IRoadGraph::Mode::IgnoreOnewayTag: return "IgnoreOnewayTag";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
IRoadGraph::RoadInfo MakeRoadInfoForTesting(bool bidirectional, double speedKMPH,
diff --git a/routing/routing_session.cpp b/routing/routing_session.cpp
index e27afd7085..32e604348f 100644
--- a/routing/routing_session.cpp
+++ b/routing/routing_session.cpp
@@ -802,7 +802,6 @@ string DebugPrint(RoutingSession::State state)
case RoutingSession::RouteNoFollowing: return "RouteNoFollowing";
case RoutingSession::RouteRebuilding: return "RouteRebuilding";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace routing
diff --git a/routing/routing_settings.cpp b/routing/routing_settings.cpp
index 1117dc1fcf..8a2994dab5 100644
--- a/routing/routing_settings.cpp
+++ b/routing/routing_settings.cpp
@@ -26,7 +26,6 @@ RoutingSettings GetRoutingSettings(VehicleType vehicleType)
CHECK(false, ("Can't create GetRoutingSettings for", vehicleType));
return {};
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace routing
diff --git a/routing/routing_tests/index_graph_test.cpp b/routing/routing_tests/index_graph_test.cpp
index c06482469d..daaeb92395 100644
--- a/routing/routing_tests/index_graph_test.cpp
+++ b/routing/routing_tests/index_graph_test.cpp
@@ -352,7 +352,7 @@ UNIT_TEST(FindPathManhattan)
// Roads y:
//
// fast road R0 * - * - * -1
-// ↗ ↘
+// ╱ ╲
// slow road R1 * - - * - - * - - * - - * 0
// J0 J1
//
diff --git a/routing/routing_tests/restriction_test.cpp b/routing/routing_tests/restriction_test.cpp
index ee4793123a..ea48b74e7f 100644
--- a/routing/routing_tests/restriction_test.cpp
+++ b/routing/routing_tests/restriction_test.cpp
@@ -217,13 +217,13 @@ UNIT_CLASS_TEST(RestrictionTest, TriangularGraph_RestrictionNoF5F2RestrictionOnl
// F4
// |
// 2 *
-// | ↖
+// | ╲
// F0 F2
-// | ↖
+// | ╲
// 1 * *
-// | ↖
+// | ╲
// F0 F2
-// | ↖
+// | ╲
// 0 *---F1--*--F1--*--F3---* Start
// 0 1 2 3
// Note. All features are two setments and two-way.
diff --git a/routing/transit_info.hpp b/routing/transit_info.hpp
index 14e84fa49b..41b5815d29 100644
--- a/routing/transit_info.hpp
+++ b/routing/transit_info.hpp
@@ -149,7 +149,6 @@ inline std::string DebugPrint(TransitInfo::Type type)
case TransitInfo::Type::Edge: return "Edge";
case TransitInfo::Type::Transfer: return "Transfer";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace routing
diff --git a/routing/vehicle_mask.cpp b/routing/vehicle_mask.cpp
index d87039b51d..d0f685deaf 100644
--- a/routing/vehicle_mask.cpp
+++ b/routing/vehicle_mask.cpp
@@ -19,8 +19,7 @@ string DebugPrint(VehicleType vehicleType)
case VehicleType::Transit: return "Transit";
case VehicleType::Count: return "Count";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
string ToString(VehicleType vehicleType) { return DebugPrint(vehicleType); }
diff --git a/search/geocoder.cpp b/search/geocoder.cpp
index 2b13b6c2ff..f6ad7d6dee 100644
--- a/search/geocoder.cpp
+++ b/search/geocoder.cpp
@@ -1414,8 +1414,7 @@ CBV Geocoder::RetrieveGeometryFeatures(MwmContext const & context, m2::RectD con
case RECT_ID_LOCALITY: return m_localityRectsCache.Get(context, rect, m_params.GetScale());
case RECT_ID_COUNT: ASSERT(false, ("Invalid RectId.")); return CBV();
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
bool Geocoder::GetTypeInGeocoding(BaseContext const & ctx, uint32_t featureId, Model::Type & type)
diff --git a/search/geocoder_context.cpp b/search/geocoder_context.cpp
index e3fabd4184..21e42e235e 100644
--- a/search/geocoder_context.cpp
+++ b/search/geocoder_context.cpp
@@ -24,8 +24,7 @@ BaseContext::TokenType BaseContext::FromModelType(Model::Type type)
case Model::TYPE_COUNTRY: return TOKEN_TYPE_COUNTRY;
case Model::TYPE_COUNT: return TOKEN_TYPE_COUNT;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
// static
@@ -37,8 +36,7 @@ BaseContext::TokenType BaseContext::FromRegionType(Region::Type type)
case Region::TYPE_COUNTRY: return TOKEN_TYPE_COUNTRY;
case Region::TYPE_COUNT: return TOKEN_TYPE_COUNT;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
size_t BaseContext::SkipUsedTokens(size_t curToken) const
@@ -101,7 +99,6 @@ string DebugPrint(BaseContext::TokenType type)
case BaseContext::TOKEN_TYPE_POSTCODE: return "POSTCODE";
case BaseContext::TOKEN_TYPE_COUNT: return "COUNT";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace search
diff --git a/search/geocoder_locality.cpp b/search/geocoder_locality.cpp
index 3e982d9645..f92b233223 100644
--- a/search/geocoder_locality.cpp
+++ b/search/geocoder_locality.cpp
@@ -13,8 +13,7 @@ Model::Type Region::ToModelType(Type type)
case Region::TYPE_COUNTRY: return Model::TYPE_COUNTRY;
case Region::TYPE_COUNT: return Model::TYPE_COUNT;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
std::string DebugPrint(Locality const & locality)
diff --git a/search/house_numbers_matcher.cpp b/search/house_numbers_matcher.cpp
index 1b6c5fee08..8ade89e197 100644
--- a/search/house_numbers_matcher.cpp
+++ b/search/house_numbers_matcher.cpp
@@ -166,8 +166,7 @@ public:
case TStrings::Status::Prefix: return isPrefix;
case TStrings::Status::Full: return true;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
private:
@@ -238,8 +237,7 @@ public:
case TPatterns::Status::Prefix: return true;
case TPatterns::Status::Full: return true;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
private:
@@ -254,8 +252,7 @@ private:
case 'U': return Token::TYPE_BUILDING_PART_OR_LETTER;
default: CHECK(false, ("Unexpected character:", c)); return Token::TYPE_SEPARATOR;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
static Token::Type TokenToType(Token const & token) { return token.m_type; }
diff --git a/search/keyword_matcher.cpp b/search/keyword_matcher.cpp
index 422ed0a3e3..4ebdb53ea6 100644
--- a/search/keyword_matcher.cpp
+++ b/search/keyword_matcher.cpp
@@ -57,7 +57,7 @@ KeywordMatcher::Score KeywordMatcher::CalcScore(strings::UniString const * token
int8_t prevTokenMatchDistance = 0;
bool prefixMatched = true;
- for (decltype(m_keywords)::size_type i = 0; i < m_keywords.size(); ++i)
+ for (size_t i = 0; i < m_keywords.size(); ++i)
{
for (size_t j = 0; j < count && !isQueryTokenMatched[i]; ++j)
{
diff --git a/search/mwm_context.cpp b/search/mwm_context.cpp
index a911e8a006..81f49d95e1 100644
--- a/search/mwm_context.cpp
+++ b/search/mwm_context.cpp
@@ -37,8 +37,7 @@ bool MwmContext::GetFeature(uint32_t index, FeatureType & ft) const
ft.SetID(FeatureID(GetId(), index));
return true;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
bool MwmContext::GetStreetIndex(uint32_t houseId, uint32_t & streetId)
diff --git a/search/nested_rects_cache.cpp b/search/nested_rects_cache.cpp
index cf20c23f50..439c223e0b 100644
--- a/search/nested_rects_cache.cpp
+++ b/search/nested_rects_cache.cpp
@@ -82,8 +82,7 @@ double NestedRectsCache::GetRadiusMeters(RectScale scale)
case RECT_SCALE_LARGE: return 2500.0;
case RECT_SCALE_COUNT: return 5000.0;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
void NestedRectsCache::Update()
diff --git a/search/ranker.cpp b/search/ranker.cpp
index a7445935ab..355f5d5f92 100644
--- a/search/ranker.cpp
+++ b/search/ranker.cpp
@@ -145,8 +145,7 @@ ftypes::Type GetLocalityIndex(feature::TypesHolder const & types)
case VILLAGE: return NONE;
case LOCALITY_COUNT: return type;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
// TODO: Format street and house number according to local country's rules.
@@ -432,8 +431,7 @@ Result Ranker::MakeResult(RankerResult const & rankerResult, bool needAddress,
case RankerResult::Type::TYPE_LATLON: return Result(r.GetCenter(), name, address);
}
ASSERT(false, ("Bad RankerResult type:", static_cast<size_t>(r.GetResultType())));
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
};
auto res = mk(rankerResult);
diff --git a/search/result.cpp b/search/result.cpp
index 5379c78be2..23f0c59ff7 100644
--- a/search/result.cpp
+++ b/search/result.cpp
@@ -193,7 +193,7 @@ bool Results::AddResult(Result && result)
if (result.IsSuggest())
{
- auto d = distance(m_results.begin(), it);
+ auto const d = distance(m_results.begin(), it);
if (d >= static_cast<decltype(d)>(kMaxNumSuggests))
return false;
diff --git a/search/retrieval.cpp b/search/retrieval.cpp
index fe80a7c2d9..8206b35c44 100644
--- a/search/retrieval.cpp
+++ b/search/retrieval.cpp
@@ -374,7 +374,6 @@ unique_ptr<coding::CompressedBitVector> Retrieval::Retrieve(Args &&... args) con
return r(*m_root1, m_context, m_cancellable, forward<Args>(args)...);
}
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace search
diff --git a/search/search_quality/assessment_tool/main_model.cpp b/search/search_quality/assessment_tool/main_model.cpp
index 9d6ae575ad..345cbaf8c6 100644
--- a/search/search_quality/assessment_tool/main_model.cpp
+++ b/search/search_quality/assessment_tool/main_model.cpp
@@ -193,8 +193,7 @@ void MainModel::OnNonFoundResultSelected(int index)
auto const & results = context.m_nonFoundResults;
CHECK_GREATER_OR_EQUAL(index, 0, ());
- CHECK_LESS(static_cast<decltype(context.m_nonFoundResults)::size_type>(index),
- results.size(), ());
+ CHECK_LESS(static_cast<size_t>(index), results.size(), ());
m_view->MoveViewportToResult(results[index]);
}
diff --git a/search/search_tests/keyword_matcher_test.cpp b/search/search_tests/keyword_matcher_test.cpp
index 1203fc4770..3112fec91b 100644
--- a/search/search_tests/keyword_matcher_test.cpp
+++ b/search/search_tests/keyword_matcher_test.cpp
@@ -260,8 +260,9 @@ string GetManyTokens(string tokenPrefix, int tokenCount, bool countForward = tru
UNIT_TEST(KeywordMatcher_QueryTooLong)
{
static_assert(kMaxNumTokens >= 2, "");
- for (int queryLength = kMaxNumTokens - 2;
- queryLength <= static_cast<int>(kMaxNumTokens + 2); ++queryLength)
+ int const minLength = kMaxNumTokens - 2;
+ int const maxLength = kMaxNumTokens + 2;
+ for (int queryLength = minLength; queryLength <= maxLength; ++queryLength)
{
string const query = GetManyTokens("Q", queryLength);
string const queryWithPrefix = query + " Prefix";
diff --git a/storage/storage_defines.cpp b/storage/storage_defines.cpp
index c4d6d07776..186e67e96e 100644
--- a/storage/storage_defines.cpp
+++ b/storage/storage_defines.cpp
@@ -34,8 +34,7 @@ string DebugPrint(Status status)
case Status::EOutOfMemFailed:
return "OutOfMemFailed"s;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
string DebugPrint(NodeStatus status)
@@ -61,8 +60,7 @@ string DebugPrint(NodeStatus status)
case NodeStatus::Partly:
return "Partly"s;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
string DebugPrint(NodeErrorCode status)
@@ -78,8 +76,7 @@ string DebugPrint(NodeErrorCode status)
case NodeErrorCode::NoInetConnection:
return "NoInetConnection"s;
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
StatusAndError ParseStatus(Status innerStatus)
@@ -107,8 +104,7 @@ StatusAndError ParseStatus(Status innerStatus)
case Status::EOutOfMemFailed:
return StatusAndError(NodeStatus::Error, NodeErrorCode::OutOfMemFailed);
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
string DebugPrint(StatusAndError statusAndError)
diff --git a/storage/storage_integration_tests/storage_http_tests.cpp b/storage/storage_integration_tests/storage_http_tests.cpp
index ad6ab5b9d7..19b06122d4 100644
--- a/storage/storage_integration_tests/storage_http_tests.cpp
+++ b/storage/storage_integration_tests/storage_http_tests.cpp
@@ -102,9 +102,9 @@ UNIT_CLASS_TEST(StorageHttpTest, StorageDownloadNodeAndDeleteNode)
NodeAttrs nodeAttrs;
m_storage.GetNodeAttrs(countryId, nodeAttrs);
- TEST_EQUAL(static_cast<decltype(nodeAttrs.m_downloadingProgress.first)>(mapSize.first),
+ TEST_EQUAL(static_cast<int64_t>(mapSize.first),
nodeAttrs.m_downloadingProgress.first, (countryId));
- TEST_EQUAL(static_cast<decltype(nodeAttrs.m_downloadingProgress.second)>(mapSize.second),
+ TEST_EQUAL(static_cast<int64_t>(mapSize.second),
nodeAttrs.m_downloadingProgress.second, (countryId));
TEST_EQUAL(countryId, kCountryId, (countryId));
};
@@ -144,9 +144,9 @@ UNIT_CLASS_TEST(StorageHttpTest, StorageDownloadAndDeleteDisputedNode)
NodeAttrs nodeAttrs;
m_storage.GetNodeAttrs(countryId, nodeAttrs);
- TEST_EQUAL(static_cast<decltype(nodeAttrs.m_downloadingProgress.first)>(mapSize.first),
+ TEST_EQUAL(static_cast<int64_t>(mapSize.first),
nodeAttrs.m_downloadingProgress.first, (countryId));
- TEST_EQUAL(static_cast<decltype(nodeAttrs.m_downloadingProgress.second)>(mapSize.second),
+ TEST_EQUAL(static_cast<int64_t>(mapSize.second),
nodeAttrs.m_downloadingProgress.second, (countryId));
};
diff --git a/storage/storage_tests/storage_tests.cpp b/storage/storage_tests/storage_tests.cpp
index 8967c6d428..e5f94f7814 100644
--- a/storage/storage_tests/storage_tests.cpp
+++ b/storage/storage_tests/storage_tests.cpp
@@ -1437,12 +1437,12 @@ UNIT_TEST(StorageTest_GetUpdateInfoSingleMwm)
storage.GetUpdateInfo("OutdatedCountry1", updateInfo);
TEST_EQUAL(updateInfo.m_numberOfMwmFilesToUpdate, 1, ());
TEST_EQUAL(updateInfo.m_totalUpdateSizeInBytes, 50, ());
- TEST_EQUAL(updateInfo.m_sizeDifference, static_cast<int64_t>(50 - country1Size), ());
+ TEST_EQUAL(updateInfo.m_sizeDifference, 50 - static_cast<int64_t>(country1Size), ());
storage.GetUpdateInfo("OutdatedCountry2", updateInfo);
TEST_EQUAL(updateInfo.m_numberOfMwmFilesToUpdate, 1, ());
TEST_EQUAL(updateInfo.m_totalUpdateSizeInBytes, 1000, ());
- TEST_EQUAL(updateInfo.m_sizeDifference, static_cast<int64_t>(1000 - country2Size), ());
+ TEST_EQUAL(updateInfo.m_sizeDifference, 1000 - static_cast<int64_t>(country2Size), ());
storage.GetUpdateInfo("Abkhazia", updateInfo);
TEST_EQUAL(updateInfo.m_numberOfMwmFilesToUpdate, 0, ());
@@ -1460,7 +1460,7 @@ UNIT_TEST(StorageTest_GetUpdateInfoSingleMwm)
TEST_EQUAL(updateInfo.m_numberOfMwmFilesToUpdate, 2, ());
TEST_EQUAL(updateInfo.m_totalUpdateSizeInBytes, 1050, ());
TEST_EQUAL(updateInfo.m_sizeDifference,
- static_cast<int64_t>((1000 + 50) - (country1Size + country2Size)), ());
+ (1000 + 50) - static_cast<int64_t>((country1Size + country2Size)), ());
}
#endif // defined(OMIM_OS_DESKTOP)
diff --git a/traffic/speed_groups.cpp b/traffic/speed_groups.cpp
index ff7e6f23a1..a136e5721d 100644
--- a/traffic/speed_groups.cpp
+++ b/traffic/speed_groups.cpp
@@ -34,7 +34,6 @@ string DebugPrint(SpeedGroup const & group)
case SpeedGroup::Unknown: return "Unknown";
case SpeedGroup::Count: return "Count";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace traffic
diff --git a/ugc/serdes.hpp b/ugc/serdes.hpp
index 2ae89cbbd1..57b58f8097 100644
--- a/ugc/serdes.hpp
+++ b/ugc/serdes.hpp
@@ -207,7 +207,7 @@ public:
{
auto const size = DesVarUint<uint32_t>();
m.reserve(size);
- for (int i = 0; i < size; ++i)
+ for (size_t i = 0; i < size; ++i)
{
std::pair<T, U> p;
(*this)(p);
diff --git a/ugc/storage.hpp b/ugc/storage.hpp
index 4a86993ad7..b9947925e2 100644
--- a/ugc/storage.hpp
+++ b/ugc/storage.hpp
@@ -59,8 +59,7 @@ inline std::string DebugPrint(Storage::SettingResult const & result)
case Storage::SettingResult::InvalidUGC: return "Invalid UGC";
case Storage::SettingResult::WritingError: return "Writing Error";
}
-
- INCORRECT_VALUE_IN_THE_SWITCH();
+ CHECK_SWITCH();
}
} // namespace ugc