mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 09:40:06 +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
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
|
#include "common/string_util.h"
|
||||||
#include "common/key_map.h"
|
#include "common/key_map.h"
|
||||||
|
|
||||||
// Abstraction class used to provide an interface between emulation code and the frontend (e.g. SDL,
|
// Abstraction class used to provide an interface between emulation code and the frontend (e.g. SDL,
|
||||||
@ -75,11 +75,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EmuWindow() : m_client_area_width(640), m_client_area_height(480) {
|
EmuWindow():
|
||||||
char window_title[255];
|
m_client_area_width(640),
|
||||||
sprintf(window_title, "Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
|
m_client_area_height(480),
|
||||||
m_window_title = window_title;
|
m_window_title(Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc))
|
||||||
}
|
{}
|
||||||
virtual ~EmuWindow() {}
|
virtual ~EmuWindow() {}
|
||||||
|
|
||||||
std::string m_window_title; ///< Current window title, should be used by window impl.
|
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)
|
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;
|
*output = true;
|
||||||
else if ("0" == str || !strcasecmp("false", str.c_str()))
|
else if ("0" == str || "false" == ToLower(str))
|
||||||
*output = false;
|
*output = false;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@ -196,13 +196,6 @@ bool TryParse(const std::string &str, bool *const output)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string StringFromInt(int value)
|
|
||||||
{
|
|
||||||
char temp[16];
|
|
||||||
sprintf(temp, "%i", value);
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string StringFromBool(bool value)
|
std::string StringFromBool(bool value)
|
||||||
{
|
{
|
||||||
return value ? "True" : "False";
|
return value ? "True" : "False";
|
||||||
|
@ -54,7 +54,6 @@ std::string ThousandSeparate(I value, int spaces = 0)
|
|||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string StringFromInt(int value);
|
|
||||||
std::string StringFromBool(bool value);
|
std::string StringFromBool(bool value);
|
||||||
|
|
||||||
bool TryParse(const std::string &str, bool *output);
|
bool TryParse(const std::string &str, bool *output);
|
||||||
|
@ -169,7 +169,6 @@ std::string Timer::GetTimeFormatted()
|
|||||||
{
|
{
|
||||||
time_t sysTime;
|
time_t sysTime;
|
||||||
struct tm * gmTime;
|
struct tm * gmTime;
|
||||||
char formattedTime[13];
|
|
||||||
char tmp[13];
|
char tmp[13];
|
||||||
|
|
||||||
time(&sysTime);
|
time(&sysTime);
|
||||||
@ -181,14 +180,12 @@ std::string Timer::GetTimeFormatted()
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
struct timeb tp;
|
struct timeb tp;
|
||||||
(void)::ftime(&tp);
|
(void)::ftime(&tp);
|
||||||
sprintf(formattedTime, "%s:%03i", tmp, tp.millitm);
|
return StringFromFormat("%s:%03i", tmp, tp.millitm);
|
||||||
#else
|
#else
|
||||||
struct timeval t;
|
struct timeval t;
|
||||||
(void)gettimeofday(&t, NULL);
|
(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
|
#endif
|
||||||
|
|
||||||
return std::string(formattedTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a timestamp with decimals for precise time comparisons
|
// Returns a timestamp with decimals for precise time comparisons
|
||||||
|
Loading…
Reference in New Issue
Block a user