From bb257b4c22d9d56d6c0988d6883336ad191f5f74 Mon Sep 17 00:00:00 2001 From: Maksim Andrianov Date: Fri, 22 Jun 2018 12:38:48 +0300 Subject: [PATCH] Fixed warn: ignoring return value --- drape_frontend/gui/ruler_helper.cpp | 3 ++- map/bookmark_manager.cpp | 9 +++++++-- map/framework.cpp | 3 ++- map/gps_track_filter.cpp | 3 ++- map/routing_manager.cpp | 5 ++++- platform/measurement_utils.cpp | 10 +++++++--- qt/mainwindow.cpp | 4 +++- search/features_layer_matcher.hpp | 3 ++- 8 files changed, 29 insertions(+), 11 deletions(-) diff --git a/drape_frontend/gui/ruler_helper.cpp b/drape_frontend/gui/ruler_helper.cpp index 22be59f7f2..498afdcf82 100644 --- a/drape_frontend/gui/ruler_helper.cpp +++ b/drape_frontend/gui/ruler_helper.cpp @@ -225,7 +225,8 @@ double RulerHelper::CalcMetresDiff(double value) auto conversionFn = &Identity; auto units = measurement_utils::Units::Metric; - UNUSED_VALUE(settings::Get(settings::kMeasurementUnits, units)); + if (!settings::Get(settings::kMeasurementUnits, units)) + LOG(LWARNING, ("Unable to read settings:", settings::kMeasurementUnits)); if (units == measurement_utils::Units::Imperial) { diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index 90c2514cf9..5bb39e6960 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -346,7 +346,10 @@ bool MigrateIfNeeded() { auto const newBookmarksDir = GetBookmarksDirectory(); if (!GetPlatform().IsFileExistsByFullPath(newBookmarksDir)) - UNUSED_VALUE(GetPlatform().MkDirChecked(newBookmarksDir)); + { + if(!GetPlatform().MkDirChecked(newBookmarksDir)) + LOG(LWARNING, ("Could not create directory:", newBookmarksDir)); + } OnMigrationSuccess(0 /* originalCount */, 0 /* convertedCount */); return true; } @@ -896,7 +899,9 @@ void BookmarkManager::SaveState() const void BookmarkManager::LoadState() { - UNUSED_VALUE(settings::Get(kLastEditedBookmarkCategory, m_lastCategoryUrl)); + if(!settings::Get(kLastEditedBookmarkCategory, m_lastCategoryUrl)) + LOG(LWARNING, ("Unable to read settings:", kLastEditedBookmarkCategory)); + uint32_t color; if (settings::Get(kLastEditedBookmarkColor, color) && color > static_cast(kml::PredefinedColor::None) && diff --git a/map/framework.cpp b/map/framework.cpp index 9f812536d1..ce6b0be202 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1924,7 +1924,8 @@ void Framework::SetupMeasurementSystem() GetPlatform().SetupMeasurementSystem(); auto units = measurement_utils::Units::Metric; - UNUSED_VALUE(settings::Get(settings::kMeasurementUnits, units)); + if (!settings::Get(settings::kMeasurementUnits, units)) + LOG(LWARNING, ("Unable to read settings:", settings::kMeasurementUnits)); m_routingManager.SetTurnNotificationsUnits(units); } diff --git a/map/gps_track_filter.cpp b/map/gps_track_filter.cpp index ef2db67c49..130d97d10e 100644 --- a/map/gps_track_filter.cpp +++ b/map/gps_track_filter.cpp @@ -57,7 +57,8 @@ GpsTrackFilter::GpsTrackFilter() , m_countLastInfo(0) , m_countAcceptedInfo(0) { - UNUSED_VALUE(settings::Get(kMinHorizontalAccuracyKey, m_minAccuracy)); + if (!settings::Get(kMinHorizontalAccuracyKey, m_minAccuracy)) + LOG(LWARNING, ("Unable to read settings:", kMinHorizontalAccuracyKey)); } void GpsTrackFilter::Process(vector const & inPoints, diff --git a/map/routing_manager.cpp b/map/routing_manager.cpp index 2347deaceb..af173a578f 100644 --- a/map/routing_manager.cpp +++ b/map/routing_manager.cpp @@ -1039,7 +1039,10 @@ bool RoutingManager::IsTrackingReporterEnabled() const return false; bool enableTracking = true; - UNUSED_VALUE(settings::Get(tracking::Reporter::kEnableTrackingKey, enableTracking)); + if (!settings::Get(tracking::Reporter::kEnableTrackingKey, enableTracking)) + LOG(LWARNING, ("Unable to read settings:", + tracking::Reporter::kEnableTrackingKey)); + return enableTracking; } diff --git a/platform/measurement_utils.cpp b/platform/measurement_utils.cpp index a0d48dc25d..f3352e36fa 100644 --- a/platform/measurement_utils.cpp +++ b/platform/measurement_utils.cpp @@ -7,6 +7,7 @@ #include "base/math.hpp" #include "base/stl_add.hpp" #include "base/string_utils.hpp" +#include "base/logging.hpp" #include "std/cstring.hpp" #include "std/iomanip.hpp" @@ -55,7 +56,8 @@ bool FormatDistanceImpl(double m, string & res, bool FormatDistance(double m, string & res) { auto units = Units::Metric; - UNUSED_VALUE(Get(settings::kMeasurementUnits, units)); + if (!Get(settings::kMeasurementUnits, units)) + LOG(LWARNING, ("Unable to read settings:", settings::kMeasurementUnits)); /// @todo Put string units resources. switch (units) @@ -165,7 +167,8 @@ void FormatMercator(m2::PointD const & mercator, string & lat, string & lon, int string FormatAltitude(double altitudeInMeters) { Units units = Units::Metric; - UNUSED_VALUE(Get(settings::kMeasurementUnits, units)); + if (!Get(settings::kMeasurementUnits, units)) + LOG(LWARNING, ("Unable to read settings:", settings::kMeasurementUnits)); ostringstream ss; ss << fixed << setprecision(0); @@ -182,7 +185,8 @@ string FormatAltitude(double altitudeInMeters) string FormatSpeedWithDeviceUnits(double metersPerSecond) { auto units = Units::Metric; - UNUSED_VALUE(Get(settings::kMeasurementUnits, units)); + if (!Get(settings::kMeasurementUnits, units)) + LOG(LWARNING, ("Unable to read settings:", settings::kMeasurementUnits)); return FormatSpeedWithUnits(metersPerSecond, units); } diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index bad2b9c906..09930b960e 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -124,7 +124,9 @@ MainWindow::MainWindow(Framework & framework, bool apiOpenGLES3, QString const & #ifndef NO_DOWNLOADER // Show intro dialog if necessary bool bShow = true; - (void)settings::Get("ShowWelcome", bShow); + const string showWelcome = "ShowWelcome"; + if (!settings::Get(showWelcome, bShow)) + LOG(LWARNING, ("Unable to read settings:", showWelcome)); if (bShow) { diff --git a/search/features_layer_matcher.hpp b/search/features_layer_matcher.hpp index 7742b6bb71..9433444d4e 100644 --- a/search/features_layer_matcher.hpp +++ b/search/features_layer_matcher.hpp @@ -377,7 +377,8 @@ private: /// Correct fix would be injection into ForEachInIntervalAndScale, so deleted features will /// never /// be emitted and used in other code. - UNUSED_VALUE(m_context->GetFeature(id, ft)); + if (!m_context->GetFeature(id, ft)) + LOG(LWARNING, ("GetFeature() returned false.")); } MwmContext * m_context;