Fixed warn: ignoring return value

This commit is contained in:
Maksim Andrianov 2018-06-22 12:38:48 +03:00
parent e5811353c1
commit bb257b4c22
8 changed files with 29 additions and 11 deletions

View file

@ -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)
{

View file

@ -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<uint32_t>(kml::PredefinedColor::None) &&

View file

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

View file

@ -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<location::GpsInfo> const & inPoints,

View file

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

View file

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

View file

@ -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)
{

View file

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