From f0e83be2b496b74fa0dd5b8cc597a0b78141a360 Mon Sep 17 00:00:00 2001 From: Szymon Jastrzebski Date: Wed, 19 Jul 2017 12:35:55 +0200 Subject: [PATCH] [SystemInfo] Adding casting int to double + fix InchToMm constant SVACE detected problem with code NO_CAST.INTEGER_DIVISION. [Verification] Code compiles, TCT SystemInfo passed 100%. Change-Id: Ie6249780860cd61a8c331d77648b6d37b9241c4c Signed-off-by: Szymon Jastrzebski --- src/systeminfo/systeminfo_properties_manager.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/systeminfo/systeminfo_properties_manager.cc b/src/systeminfo/systeminfo_properties_manager.cc index 8a5c6e49..75bb33c3 100644 --- a/src/systeminfo/systeminfo_properties_manager.cc +++ b/src/systeminfo/systeminfo_properties_manager.cc @@ -42,7 +42,7 @@ using common::ErrorCode; namespace { const std::string kMemoryStateNormal = "NORMAL"; const std::string kMemoryStateWarinig = "WARNING"; -const double kDisplayInchToMillimeter = 2.54; +const double kDisplayInchToMillimeter = 25.4; //Battery const double kRemainingBatteryChargeMax = 100.0; const int kVconfErrorNone = 0; @@ -306,7 +306,7 @@ PlatformResult SysteminfoPropertiesManager::ReportDisplay(picojson::object* out) //FETCH PHYSICAL WIDTH if (dotsPerInchWidth != 0 && screenWidth != 0) { - physicalWidth = (screenWidth / dotsPerInchWidth) * kDisplayInchToMillimeter; + physicalWidth = (static_cast(screenWidth) / dotsPerInchWidth) * kDisplayInchToMillimeter; } else { std::string log_msg = "Failed to get physical screen width value"; LoggerE("%s, screenWidth : %d, dotsPerInchWidth: %d", log_msg.c_str(), @@ -315,7 +315,7 @@ PlatformResult SysteminfoPropertiesManager::ReportDisplay(picojson::object* out) //FETCH PHYSICAL HEIGHT if (dotsPerInchHeight != 0 && screenHeight != 0) { - physicalHeight = (screenHeight / dotsPerInchHeight) * kDisplayInchToMillimeter; + physicalHeight = (static_cast(screenHeight) / dotsPerInchHeight) * kDisplayInchToMillimeter; } else { std::string log_msg = "Failed to get physical screen height value"; LoggerE("%s, screenHeight : %d, dotsPerInchHeight: %d", log_msg.c_str(), -- 2.34.1