From 70e2ed320de81a33b146469c87e9a1203c13c171 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Fri, 7 Feb 2014 00:26:33 +0100 Subject: [PATCH] Revert "Merge pull request #47 from lioncash/remove-stringfromint" Breaks Android build. This reverts commit 12d026c544748521332ad5edfaf123547fa18233, reversing changes made to 6d678490f51cc0154a0bdedf9dce23c77fdfb991. --- Source/Core/Common/IniFile.h | 2 +- Source/Core/Common/StringUtil.cpp | 7 +++++++ Source/Core/Common/StringUtil.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/IniFile.h b/Source/Core/Common/IniFile.h index b2b3dba5f0..abfb58b0a6 100644 --- a/Source/Core/Common/IniFile.h +++ b/Source/Core/Common/IniFile.h @@ -56,7 +56,7 @@ public: void Set(const char* key, int newValue, int defaultValue); void Set(const char* key, int newValue) { - Set(key, std::to_string(newValue).c_str()); + Set(key, StringFromInt(newValue).c_str()); } void Set(const char* key, bool newValue, bool defaultValue); diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index a0a8c739ca..7ad4ac6ca5 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -185,6 +185,13 @@ bool TryParse(const std::string &str, bool *const output) return true; } +std::string StringFromInt(int value) +{ + char temp[16]; + sprintf(temp, "%i", value); + return temp; +} + std::string StringFromBool(bool value) { return value ? "True" : "False"; diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h index ab3abc617d..7846cbee3d 100644 --- a/Source/Core/Common/StringUtil.h +++ b/Source/Core/Common/StringUtil.h @@ -55,6 +55,7 @@ std::string ThousandSeparate(I value, int spaces = 0) return oss.str(); } +std::string StringFromInt(int value); std::string StringFromBool(bool value); bool TryParse(const std::string &str, bool *output);