diff options
author | Mikhail Gorbushin <m.gorbushin@corp.mail.ru> | 2019-02-21 15:48:31 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <bykoianko@gmail.com> | 2019-02-27 13:36:17 +0300 |
commit | 7aa880286331f7dbfd6546020188295b39ea711b (patch) | |
tree | 93a872bd478e4c736e8beb75bcac8b0e88971c0f /routing_common | |
parent | bee78bf6ccf17ac92f8378798c1d0c9ea816772d (diff) |
[routing] Fix warnings from static analyzer
Diffstat (limited to 'routing_common')
-rw-r--r-- | routing_common/maxspeed_conversion.cpp | 13 | ||||
-rw-r--r-- | routing_common/vehicle_model.cpp | 5 |
2 files changed, 8 insertions, 10 deletions
diff --git a/routing_common/maxspeed_conversion.cpp b/routing_common/maxspeed_conversion.cpp index 4089b1f692..e887aa37cc 100644 --- a/routing_common/maxspeed_conversion.cpp +++ b/routing_common/maxspeed_conversion.cpp @@ -46,26 +46,29 @@ uint16_t Maxspeed::GetSpeedInUnits(bool forward) const uint16_t Maxspeed::GetSpeedKmPH(bool forward) const { - uint16_t constexpr kNoneSpeedLimitKmPH = 130; - uint16_t constexpr kWalkSpeedLimitKmPH = 6; - auto speedInUnits = GetSpeedInUnits(forward); if (speedInUnits == kInvalidSpeed) return kInvalidSpeed; // That means IsValid() returns false. if (IsNumeric(speedInUnits)) - return ToSpeedKmPH(speedInUnits, m_units); + return static_cast<uint16_t>(ToSpeedKmPH(speedInUnits, m_units)); // A feature is marked as a feature without any speed limits. (maxspeed=="none"). if (kNoneMaxSpeed) + { + uint16_t constexpr kNoneSpeedLimitKmPH = 130; return kNoneSpeedLimitKmPH; + } // If a feature is marked with the maxspeed=="walk" tag (speed == kWalkMaxSpeed) a driver // should drive with a speed of a walking person. if (kWalkMaxSpeed) + { + uint16_t constexpr kWalkSpeedLimitKmPH = 6; return kWalkSpeedLimitKmPH; + } - CHECK(false, ("Method IsNumeric() returns something wrong.")); + UNREACHABLE(); } // FeatureMaxspeed --------------------------------------------------------------------------------- diff --git a/routing_common/vehicle_model.cpp b/routing_common/vehicle_model.cpp index f4ea9d6539..88d45fc722 100644 --- a/routing_common/vehicle_model.cpp +++ b/routing_common/vehicle_model.cpp @@ -296,11 +296,6 @@ string VehicleModelFactory::GetParent(string const & country) const return m_countryParentNameGetterFn(country); } -double GetMaxWeight(VehicleModel::InOutCitySpeedKMpH const & speed) -{ - return max(speed.m_inCity.m_weight, speed.m_outCity.m_weight); -} - string DebugPrint(VehicleModelInterface::RoadAvailability const l) { switch (l) |