Pass strings by const reference where possible
This commit is contained in:
parent
6ff3fcee59
commit
ac26f8e79f
|
@ -127,15 +127,15 @@ void SetIsFramelimiterTempDisabled(bool disable)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetStateFileName() { return s_state_filename; }
|
std::string GetStateFileName() { return s_state_filename; }
|
||||||
void SetStateFileName(std::string val) { s_state_filename = val; }
|
void SetStateFileName(const std::string& val) { s_state_filename = val; }
|
||||||
|
|
||||||
// Display messages and return values
|
// Display messages and return values
|
||||||
|
|
||||||
// Formatted stop message
|
// Formatted stop message
|
||||||
std::string StopMessage(bool bMainThread, std::string Message)
|
std::string StopMessage(bool main_thread, const std::string& message)
|
||||||
{
|
{
|
||||||
return StringFromFormat("Stop [%s %i]\t%s\t%s",
|
return StringFromFormat("Stop [%s %i]\t%s\t%s",
|
||||||
bMainThread ? "Main Thread" : "Video Thread", Common::CurrentThreadId(), MemUsage().c_str(), Message.c_str());
|
main_thread ? "Main Thread" : "Video Thread", Common::CurrentThreadId(), MemUsage().c_str(), message.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayMessage(const std::string& message, int time_in_ms)
|
void DisplayMessage(const std::string& message, int time_in_ms)
|
||||||
|
|
|
@ -40,7 +40,7 @@ enum EState
|
||||||
bool Init();
|
bool Init();
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
||||||
std::string StopMessage(bool, std::string);
|
std::string StopMessage(bool, const std::string&);
|
||||||
|
|
||||||
bool IsRunning();
|
bool IsRunning();
|
||||||
bool IsRunningAndStarted(); // is running and the CPU loop has been entered
|
bool IsRunningAndStarted(); // is running and the CPU loop has been entered
|
||||||
|
@ -59,7 +59,7 @@ void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _
|
||||||
void DisplayMessage(const std::string& message, int time_in_ms);
|
void DisplayMessage(const std::string& message, int time_in_ms);
|
||||||
|
|
||||||
std::string GetStateFileName();
|
std::string GetStateFileName();
|
||||||
void SetStateFileName(std::string val);
|
void SetStateFileName(const std::string& val);
|
||||||
|
|
||||||
void SetBlockStart(u32 addr);
|
void SetBlockStart(u32 addr);
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, std::string gameRegion, bool isSlotA)
|
void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, const std::string& gameRegion, bool isSlotA)
|
||||||
{
|
{
|
||||||
std::string ext("." + gameRegion + ".raw");
|
std::string ext("." + gameRegion + ".raw");
|
||||||
if (memcardPath.empty())
|
if (memcardPath.empty())
|
||||||
|
|
|
@ -254,7 +254,7 @@ struct SCoreStartupParameter
|
||||||
void LoadDefaults();
|
void LoadDefaults();
|
||||||
bool AutoSetup(EBootBS2 _BootBS2);
|
bool AutoSetup(EBootBS2 _BootBS2);
|
||||||
const std::string &GetUniqueID() const { return m_strUniqueID; }
|
const std::string &GetUniqueID() const { return m_strUniqueID; }
|
||||||
void CheckMemcardPath(std::string& memcardPath, std::string gameRegion, bool isSlotA);
|
void CheckMemcardPath(std::string& memcardPath, const std::string& gameRegion, bool isSlotA);
|
||||||
DiscIO::IVolume::ELanguage GetCurrentLanguage(bool wii) const;
|
DiscIO::IVolume::ELanguage GetCurrentLanguage(bool wii) const;
|
||||||
|
|
||||||
IniFile LoadDefaultGameIni() const;
|
IniFile LoadDefaultGameIni() const;
|
||||||
|
|
|
@ -140,7 +140,7 @@ void CEXIIPL::DoState(PointerWrap &p)
|
||||||
p.Do(m_FontsLoaded);
|
p.Do(m_FontsLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIIPL::LoadFileToIPL(std::string filename, u32 offset)
|
void CEXIIPL::LoadFileToIPL(const std::string& filename, u32 offset)
|
||||||
{
|
{
|
||||||
File::IOFile pStream(filename, "rb");
|
File::IOFile pStream(filename, "rb");
|
||||||
if (pStream)
|
if (pStream)
|
||||||
|
|
|
@ -68,5 +68,5 @@ private:
|
||||||
bool IsWriteCommand() const { return !!(m_uAddress & (1 << 31)); }
|
bool IsWriteCommand() const { return !!(m_uAddress & (1 << 31)); }
|
||||||
u32 CommandRegion() const { return (m_uAddress & ~(1 << 31)) >> 8; }
|
u32 CommandRegion() const { return (m_uAddress & ~(1 << 31)) >> 8; }
|
||||||
|
|
||||||
void LoadFileToIPL(std::string filename, u32 offset);
|
void LoadFileToIPL(const std::string& filename, u32 offset);
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#define SIZE_TO_Mb (1024 * 8 * 16)
|
#define SIZE_TO_Mb (1024 * 8 * 16)
|
||||||
#define MC_HDR_SIZE 0xA000
|
#define MC_HDR_SIZE 0xA000
|
||||||
|
|
||||||
MemoryCard::MemoryCard(std::string filename, int _card_index, u16 sizeMb)
|
MemoryCard::MemoryCard(const std::string& filename, int _card_index, u16 sizeMb)
|
||||||
: MemoryCardBase(_card_index, sizeMb)
|
: MemoryCardBase(_card_index, sizeMb)
|
||||||
, m_filename(filename)
|
, m_filename(filename)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ class PointerWrap;
|
||||||
class MemoryCard : public MemoryCardBase
|
class MemoryCard : public MemoryCardBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MemoryCard(std::string filename, int _card_index, u16 sizeMb = MemCard2043Mb);
|
MemoryCard(const std::string& filename, int _card_index, u16 sizeMb = MemCard2043Mb);
|
||||||
~MemoryCard();
|
~MemoryCard();
|
||||||
void FlushThread();
|
void FlushThread();
|
||||||
void MakeDirty();
|
void MakeDirty();
|
||||||
|
|
|
@ -77,7 +77,7 @@ static s32 TranslateErrorCode(s32 native_error, bool isRW)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WiiSockMan::GetNetErrorCode(s32 ret, std::string caller, bool isRW)
|
s32 WiiSockMan::GetNetErrorCode(s32 ret, const std::string& caller, bool isRW)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
s32 errorCode = WSAGetLastError();
|
s32 errorCode = WSAGetLastError();
|
||||||
|
|
|
@ -199,7 +199,7 @@ public:
|
||||||
class WiiSockMan : public ::NonCopyable
|
class WiiSockMan : public ::NonCopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static s32 GetNetErrorCode(s32 ret, std::string caller, bool isRW);
|
static s32 GetNetErrorCode(s32 ret, const std::string& caller, bool isRW);
|
||||||
static char* DecodeError(s32 ErrorCode);
|
static char* DecodeError(s32 ErrorCode);
|
||||||
|
|
||||||
static WiiSockMan& GetInstance()
|
static WiiSockMan& GetInstance()
|
||||||
|
|
|
@ -57,7 +57,7 @@ NetPlayClient::~NetPlayClient()
|
||||||
}
|
}
|
||||||
|
|
||||||
// called from ---GUI--- thread
|
// called from ---GUI--- thread
|
||||||
NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name, bool traversal, std::string centralServer, u16 centralPort)
|
NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name, bool traversal, const std::string& centralServer, u16 centralPort)
|
||||||
: m_state(Failure)
|
: m_state(Failure)
|
||||||
, m_dialog(dialog)
|
, m_dialog(dialog)
|
||||||
, m_client(nullptr)
|
, m_client(nullptr)
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
void ThreadFunc();
|
void ThreadFunc();
|
||||||
void SendAsync(sf::Packet* packet);
|
void SendAsync(sf::Packet* packet);
|
||||||
|
|
||||||
NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name, bool traversal, std::string centralServer, u16 centralPort);
|
NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name, bool traversal, const std::string& centralServer, u16 centralPort);
|
||||||
~NetPlayClient();
|
~NetPlayClient();
|
||||||
|
|
||||||
void GetPlayerList(std::string& list, std::vector<int>& pid_list);
|
void GetPlayerList(std::string& list, std::vector<int>& pid_list);
|
||||||
|
|
|
@ -52,7 +52,7 @@ NetPlayServer::~NetPlayServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
// called from ---GUI--- thread
|
// called from ---GUI--- thread
|
||||||
NetPlayServer::NetPlayServer(const u16 port, bool traversal, std::string centralServer, u16 centralPort)
|
NetPlayServer::NetPlayServer(const u16 port, bool traversal, const std::string& centralServer, u16 centralPort)
|
||||||
: is_connected(false)
|
: is_connected(false)
|
||||||
, m_is_running(false)
|
, m_is_running(false)
|
||||||
, m_do_loop(false)
|
, m_do_loop(false)
|
||||||
|
@ -717,7 +717,7 @@ std::unordered_set<std::string> NetPlayServer::GetInterfaceSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
// called from ---GUI--- thread
|
// called from ---GUI--- thread
|
||||||
std::string NetPlayServer::GetInterfaceHost(const std::string inter)
|
std::string NetPlayServer::GetInterfaceHost(const std::string& inter)
|
||||||
{
|
{
|
||||||
char buf[16];
|
char buf[16];
|
||||||
sprintf(buf, ":%d", GetPort());
|
sprintf(buf, ":%d", GetPort());
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
void ThreadFunc();
|
void ThreadFunc();
|
||||||
void SendAsyncToClients(sf::Packet* packet);
|
void SendAsyncToClients(sf::Packet* packet);
|
||||||
|
|
||||||
NetPlayServer(const u16 port, bool traversal, std::string centralServer, u16 centralPort);
|
NetPlayServer(const u16 port, bool traversal, const std::string& centralServer, u16 centralPort);
|
||||||
~NetPlayServer();
|
~NetPlayServer();
|
||||||
|
|
||||||
bool ChangeGame(const std::string& game);
|
bool ChangeGame(const std::string& game);
|
||||||
|
@ -47,7 +47,7 @@ public:
|
||||||
|
|
||||||
void SetNetPlayUI(NetPlayUI* dialog);
|
void SetNetPlayUI(NetPlayUI* dialog);
|
||||||
std::unordered_set<std::string> GetInterfaceSet();
|
std::unordered_set<std::string> GetInterfaceSet();
|
||||||
std::string GetInterfaceHost(const std::string inter);
|
std::string GetInterfaceHost(const std::string& inter);
|
||||||
|
|
||||||
bool is_connected;
|
bool is_connected;
|
||||||
|
|
||||||
|
|
|
@ -439,7 +439,7 @@ void cUIDsys::GetTitleIDs(std::vector<u64>& _TitleIDs, bool _owned)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 CNANDContentManager::Install_WiiWAD(std::string &fileName)
|
u64 CNANDContentManager::Install_WiiWAD(const std::string& fileName)
|
||||||
{
|
{
|
||||||
if (fileName.find(".wad") == std::string::npos)
|
if (fileName.find(".wad") == std::string::npos)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -69,7 +69,7 @@ class CNANDContentManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static CNANDContentManager& Access() { static CNANDContentManager instance; return instance; }
|
static CNANDContentManager& Access() { static CNANDContentManager instance; return instance; }
|
||||||
u64 Install_WiiWAD(std::string &fileName);
|
u64 Install_WiiWAD(const std::string& fileName);
|
||||||
|
|
||||||
const INANDContentLoader& GetNANDLoader(const std::string& _rName, bool forceReload = false);
|
const INANDContentLoader& GetNANDLoader(const std::string& _rName, bool forceReload = false);
|
||||||
const INANDContentLoader& GetNANDLoader(u64 _titleId, bool forceReload = false);
|
const INANDContentLoader& GetNANDLoader(u64 _titleId, bool forceReload = false);
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
std::string expr;
|
std::string expr;
|
||||||
std::string::iterator it;
|
std::string::iterator it;
|
||||||
|
|
||||||
Lexer(std::string expr_) : expr(expr_)
|
Lexer(const std::string& expr_) : expr(expr_)
|
||||||
{
|
{
|
||||||
it = expr.begin();
|
it = expr.begin();
|
||||||
}
|
}
|
||||||
|
@ -568,7 +568,7 @@ Expression::~Expression()
|
||||||
delete node;
|
delete node;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ExpressionParseStatus ParseExpressionInner(std::string str, ControlFinder &finder, Expression **expr_out)
|
static ExpressionParseStatus ParseExpressionInner(const std::string& str, ControlFinder &finder, Expression **expr_out)
|
||||||
{
|
{
|
||||||
ExpressionParseStatus status;
|
ExpressionParseStatus status;
|
||||||
Expression *expr;
|
Expression *expr;
|
||||||
|
@ -592,7 +592,7 @@ static ExpressionParseStatus ParseExpressionInner(std::string str, ControlFinder
|
||||||
return EXPRESSION_PARSE_SUCCESS;
|
return EXPRESSION_PARSE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpressionParseStatus ParseExpression(std::string str, ControlFinder &finder, Expression **expr_out)
|
ExpressionParseStatus ParseExpression(const std::string& str, ControlFinder &finder, Expression **expr_out)
|
||||||
{
|
{
|
||||||
// Add compatibility with old simple expressions, which are simple
|
// Add compatibility with old simple expressions, which are simple
|
||||||
// barewords control names.
|
// barewords control names.
|
||||||
|
|
|
@ -63,7 +63,7 @@ enum ExpressionParseStatus
|
||||||
EXPRESSION_PARSE_NO_DEVICE,
|
EXPRESSION_PARSE_NO_DEVICE,
|
||||||
};
|
};
|
||||||
|
|
||||||
ExpressionParseStatus ParseExpression(std::string expr, ControlFinder &finder, Expression **expr_out);
|
ExpressionParseStatus ParseExpression(const std::string& expr, ControlFinder &finder, Expression **expr_out);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1908,7 +1908,7 @@ namespace GLExtensions
|
||||||
_GLVersion = 330; // Get all the fun things
|
_GLVersion = 330; // Get all the fun things
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* GetFuncAddress(std::string name, void **func)
|
static void* GetFuncAddress(const std::string& name, void **func)
|
||||||
{
|
{
|
||||||
*func = GLInterface->GetFuncAddress(name);
|
*func = GLInterface->GetFuncAddress(name);
|
||||||
if (*func == nullptr)
|
if (*func == nullptr)
|
||||||
|
|
|
@ -293,7 +293,7 @@ void PostProcessingShaderConfiguration::ReloadShader()
|
||||||
m_current_shader = "";
|
m_current_shader = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessingShaderConfiguration::SetOptionf(std::string option, int index, float value)
|
void PostProcessingShaderConfiguration::SetOptionf(const std::string& option, int index, float value)
|
||||||
{
|
{
|
||||||
auto it = m_options.find(option);
|
auto it = m_options.find(option);
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ void PostProcessingShaderConfiguration::SetOptionf(std::string option, int index
|
||||||
m_any_options_dirty = true;
|
m_any_options_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessingShaderConfiguration::SetOptioni(std::string option, int index, s32 value)
|
void PostProcessingShaderConfiguration::SetOptioni(const std::string& option, int index, s32 value)
|
||||||
{
|
{
|
||||||
auto it = m_options.find(option);
|
auto it = m_options.find(option);
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ void PostProcessingShaderConfiguration::SetOptioni(std::string option, int index
|
||||||
m_any_options_dirty = true;
|
m_any_options_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessingShaderConfiguration::SetOptionb(std::string option, bool value)
|
void PostProcessingShaderConfiguration::SetOptionb(const std::string& option, bool value)
|
||||||
{
|
{
|
||||||
auto it = m_options.find(option);
|
auto it = m_options.find(option);
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,9 @@ public:
|
||||||
const ConfigurationOption& GetOption(const std::string& option) { return m_options[option]; }
|
const ConfigurationOption& GetOption(const std::string& option) { return m_options[option]; }
|
||||||
|
|
||||||
// For updating option's values
|
// For updating option's values
|
||||||
void SetOptionf(std::string option, int index, float value);
|
void SetOptionf(const std::string& option, int index, float value);
|
||||||
void SetOptioni(std::string option, int index, s32 value);
|
void SetOptioni(const std::string& option, int index, s32 value);
|
||||||
void SetOptionb(std::string option, bool value);
|
void SetOptionb(const std::string& option, bool value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_any_options_dirty;
|
bool m_any_options_dirty;
|
||||||
|
|
Loading…
Reference in New Issue