summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-10-25 21:19:05 +0200
committerbunnei <bunneidev@gmail.com>2014-10-25 21:19:05 +0200
commit70058f8151a9c6599bbcd9d5772b87c9602ed0fa (patch)
treeb7f0711f1d817b18f041fea31cfcf0ebe9cbba69 /src
parentMerge pull request #112 from bunnei/skyeye-dyncom-interpreter (diff)
parentRemoved uses of raw c-string manipulation functions. (diff)
downloadyuzu-70058f8151a9c6599bbcd9d5772b87c9602ed0fa.tar
yuzu-70058f8151a9c6599bbcd9d5772b87c9602ed0fa.tar.gz
yuzu-70058f8151a9c6599bbcd9d5772b87c9602ed0fa.tar.bz2
yuzu-70058f8151a9c6599bbcd9d5772b87c9602ed0fa.tar.lz
yuzu-70058f8151a9c6599bbcd9d5772b87c9602ed0fa.tar.xz
yuzu-70058f8151a9c6599bbcd9d5772b87c9602ed0fa.tar.zst
yuzu-70058f8151a9c6599bbcd9d5772b87c9602ed0fa.zip
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 @@
#include "common/common.h"
#include "common/scm_rev.h"
-
+#include "common/string_util.h"
#include "common/key_map.h"
// Abstraction class used to provide an interface between emulation code and the frontend (e.g. SDL,
@@ -75,11 +75,11 @@ public:
}
protected:
- EmuWindow() : m_client_area_width(640), m_client_area_height(480) {
- char window_title[255];
- sprintf(window_title, "Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
- m_window_title = window_title;
- }
+ EmuWindow():
+ m_client_area_width(640),
+ m_client_area_height(480),
+ m_window_title(Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc))
+ {}
virtual ~EmuWindow() {}
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)
bool TryParse(const std::string &str, bool *const output)
{
- if ("1" == str || !strcasecmp("true", str.c_str()))
+ if ("1" == str || "true" == ToLower(str))
*output = true;
- else if ("0" == str || !strcasecmp("false", str.c_str()))
+ else if ("0" == str || "false" == ToLower(str))
*output = false;
else
return false;
@@ -196,13 +196,6 @@ 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/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)
return oss.str();
}
-std::string StringFromInt(int value);
std::string StringFromBool(bool value);
bool 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()
{
time_t sysTime;
struct tm * gmTime;
- char formattedTime[13];
char tmp[13];
time(&sysTime);
@@ -181,14 +180,12 @@ std::string Timer::GetTimeFormatted()
#ifdef _WIN32
struct timeb tp;
(void)::ftime(&tp);
- sprintf(formattedTime, "%s:%03i", tmp, tp.millitm);
+ return StringFromFormat("%s:%03i", tmp, tp.millitm);
#else
struct timeval t;
(void)gettimeofday(&t, NULL);
- sprintf(formattedTime, "%s:%03d", tmp, (int)(t.tv_usec / 1000));
+ return StringFromFormat("%s:%03d", tmp, (int)(t.tv_usec / 1000));
#endif
-
- return std::string(formattedTime);
}
// Returns a timestamp with decimals for precise time comparisons