summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/emu_window.h12
-rw-r--r--src/common/string_util.cpp11
-rw-r--r--src/common/string_util.h1
-rw-r--r--src/common/timer.cpp7
4 files changed, 10 insertions, 21 deletions
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
index 34cecb40b..4d09acb8b 100644
--- a/src/common/emu_window.h
+++ b/src/common/emu_window.h
@@ -6,7 +6,7 @@
6 6
7#include "common/common.h" 7#include "common/common.h"
8#include "common/scm_rev.h" 8#include "common/scm_rev.h"
9 9#include "common/string_util.h"
10#include "common/key_map.h" 10#include "common/key_map.h"
11 11
12// Abstraction class used to provide an interface between emulation code and the frontend (e.g. SDL, 12// Abstraction class used to provide an interface between emulation code and the frontend (e.g. SDL,
@@ -75,11 +75,11 @@ public:
75 } 75 }
76 76
77protected: 77protected:
78 EmuWindow() : m_client_area_width(640), m_client_area_height(480) { 78 EmuWindow():
79 char window_title[255]; 79 m_client_area_width(640),
80 sprintf(window_title, "Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); 80 m_client_area_height(480),
81 m_window_title = window_title; 81 m_window_title(Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc))
82 } 82 {}
83 virtual ~EmuWindow() {} 83 virtual ~EmuWindow() {}
84 84
85 std::string m_window_title; ///< Current window title, should be used by window impl. 85 std::string m_window_title; ///< Current window title, should be used by window impl.
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index 9199e30bc..61f0939c4 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -186,9 +186,9 @@ bool TryParse(const std::string &str, u32 *const output)
186 186
187bool TryParse(const std::string &str, bool *const output) 187bool TryParse(const std::string &str, bool *const output)
188{ 188{
189 if ("1" == str || !strcasecmp("true", str.c_str())) 189 if ("1" == str || "true" == ToLower(str))
190 *output = true; 190 *output = true;
191 else if ("0" == str || !strcasecmp("false", str.c_str())) 191 else if ("0" == str || "false" == ToLower(str))
192 *output = false; 192 *output = false;
193 else 193 else
194 return false; 194 return false;
@@ -196,13 +196,6 @@ bool TryParse(const std::string &str, bool *const output)
196 return true; 196 return true;
197} 197}
198 198
199std::string StringFromInt(int value)
200{
201 char temp[16];
202 sprintf(temp, "%i", value);
203 return temp;
204}
205
206std::string StringFromBool(bool value) 199std::string StringFromBool(bool value)
207{ 200{
208 return value ? "True" : "False"; 201 return value ? "True" : "False";
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 16ce39bc1..a41ccc691 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -54,7 +54,6 @@ std::string ThousandSeparate(I value, int spaces = 0)
54 return oss.str(); 54 return oss.str();
55} 55}
56 56
57std::string StringFromInt(int value);
58std::string StringFromBool(bool value); 57std::string StringFromBool(bool value);
59 58
60bool TryParse(const std::string &str, bool *output); 59bool TryParse(const std::string &str, bool *output);
diff --git a/src/common/timer.cpp b/src/common/timer.cpp
index f8e1fadca..ded4a344e 100644
--- a/src/common/timer.cpp
+++ b/src/common/timer.cpp
@@ -169,7 +169,6 @@ std::string Timer::GetTimeFormatted()
169{ 169{
170 time_t sysTime; 170 time_t sysTime;
171 struct tm * gmTime; 171 struct tm * gmTime;
172 char formattedTime[13];
173 char tmp[13]; 172 char tmp[13];
174 173
175 time(&sysTime); 174 time(&sysTime);
@@ -181,14 +180,12 @@ std::string Timer::GetTimeFormatted()
181#ifdef _WIN32 180#ifdef _WIN32
182 struct timeb tp; 181 struct timeb tp;
183 (void)::ftime(&tp); 182 (void)::ftime(&tp);
184 sprintf(formattedTime, "%s:%03i", tmp, tp.millitm); 183 return StringFromFormat("%s:%03i", tmp, tp.millitm);
185#else 184#else
186 struct timeval t; 185 struct timeval t;
187 (void)gettimeofday(&t, NULL); 186 (void)gettimeofday(&t, NULL);
188 sprintf(formattedTime, "%s:%03d", tmp, (int)(t.tv_usec / 1000)); 187 return StringFromFormat("%s:%03d", tmp, (int)(t.tv_usec / 1000));
189#endif 188#endif
190
191 return std::string(formattedTime);
192} 189}
193 190
194// Returns a timestamp with decimals for precise time comparisons 191// Returns a timestamp with decimals for precise time comparisons