From 72a85203693070a50e6578d785d5be739ea95129 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Fri, 22 Jan 2016 11:45:06 -0600 Subject: Make new brightness code compatible with older trees libstlport does not support ifstream with std::string libstlport does not implement stoi Change-Id: I2ae3b6ee1b2a28fe4305471133f40543bd0c9746 --- data.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data.cpp b/data.cpp index e38f36641..cda6828de 100644 --- a/data.cpp +++ b/data.cpp @@ -855,7 +855,7 @@ void DataManager::SetDefaultValues() // Attempt to locate the max_brightness file string maxbrightpath = findbright.insert(findbright.rfind('/') + 1, "max_"); if (TWFunc::Path_Exists(maxbrightpath)) { - ifstream maxVal(maxbrightpath); + ifstream maxVal(maxbrightpath.c_str()); if(maxVal >> maxBrightness) { LOGINFO("Got max brightness %s from '%s'\n", maxBrightness.c_str(), maxbrightpath.c_str()); } else { @@ -863,7 +863,7 @@ void DataManager::SetDefaultValues() maxBrightness = "-1"; } } - if(stoi(maxBrightness) <= 0) + if (atoi(maxBrightness.c_str()) <= 0) { // Fallback into default ostringstream maxVal; @@ -885,7 +885,7 @@ void DataManager::SetDefaultValues() #endif #ifdef TW_DEFAULT_BRIGHTNESS int defValInt = TW_DEFAULT_BRIGHTNESS; - int maxValInt = stoi(maxBrightness); + int maxValInt = atoi(maxBrightness.c_str()); // Deliberately int so the % is always a whole number int defPctInt = ( ( (double)defValInt / maxValInt ) * 100 ); ostringstream defPct; -- cgit v1.2.3