mirror of
https://github.com/yuzu-emu/yuzu-mainline
synced 2024-11-23 21:13:33 +00:00
Merge pull request #148 from archshift/no-cstring
Removed some uses of raw c-string manipulation functions.
This commit is contained in:
commit
70058f8151
4 changed files with 10 additions and 21 deletions
|
@ -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.
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue