diff --git a/Core/Config.cpp b/Core/Config.cpp index c7b194a3a3..4dc64d8518 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1838,7 +1838,7 @@ int Config::GetPSPLanguage() { } } -void PlayTimeTracker::Start(std::string gameId) { +void PlayTimeTracker::Start(const std::string &gameId) { if (gameId.empty()) { return; } @@ -1860,7 +1860,7 @@ void PlayTimeTracker::Start(std::string gameId) { tracker_[gameId] = playTime; } -void PlayTimeTracker::Stop(std::string gameId) { +void PlayTimeTracker::Stop(const std::string &gameId) { if (gameId.empty()) { return; } diff --git a/Core/Config.h b/Core/Config.h index de2d6971cb..6a2114391c 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -48,8 +48,8 @@ public: }; // It's OK to call these redundantly. - void Start(std::string gameId); - void Stop(std::string gameId); + void Start(const std::string &gameId); + void Stop(const std::string &gameId); void Load(const Section *section); void Save(Section *section); diff --git a/Core/Core.cpp b/Core/Core.cpp index 36f9fd0f83..ef7ca4e94d 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -418,7 +418,7 @@ void Core_MemoryException(u32 address, u32 accessSize, u32 pc, MemoryExceptionTy } } -void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type, std::string additionalInfo, bool forceReport) { +void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type, const std::string &additionalInfo, bool forceReport) { const char *desc = MemoryExceptionTypeAsString(type); // In jit, we only flush PC when bIgnoreBadMemAccess is off. if ((g_Config.iCpuCore == (int)CPUCore::JIT || g_Config.iCpuCore == (int)CPUCore::JIT_IR) && g_Config.bIgnoreBadMemAccess) { diff --git a/Core/Core.h b/Core/Core.h index 9024214c5d..42caf85996 100644 --- a/Core/Core.h +++ b/Core/Core.h @@ -105,7 +105,7 @@ enum class ExecExceptionType { // Separate one for without info, to avoid having to allocate a string void Core_MemoryException(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type); -void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type, std::string additionalInfo, bool forceReport); +void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExceptionType type, const std::string &additionalInfo, bool forceReport); void Core_ExecException(u32 address, u32 pc, ExecExceptionType type); void Core_Break(u32 pc); diff --git a/Core/Debugger/DisassemblyManager.cpp b/Core/Debugger/DisassemblyManager.cpp index ecea54a868..7b1c7f4c4b 100644 --- a/Core/Debugger/DisassemblyManager.cpp +++ b/Core/Debugger/DisassemblyManager.cpp @@ -820,7 +820,7 @@ void DisassemblyMacro::setMacroLi(u32 _immediate, u8 _rt) numOpcodes = 2; } -void DisassemblyMacro::setMacroMemory(std::string _name, u32 _immediate, u8 _rt, int _dataSize) +void DisassemblyMacro::setMacroMemory(const std::string &_name, u32 _immediate, u8 _rt, int _dataSize) { type = MACRO_MEMORYIMM; name = _name; diff --git a/Core/Debugger/DisassemblyManager.h b/Core/Debugger/DisassemblyManager.h index 81520818b1..c0f990d853 100644 --- a/Core/Debugger/DisassemblyManager.h +++ b/Core/Debugger/DisassemblyManager.h @@ -120,7 +120,7 @@ public: DisassemblyMacro(u32 _address): address(_address) { } void setMacroLi(u32 _immediate, u8 _rt); - void setMacroMemory(std::string _name, u32 _immediate, u8 _rt, int _dataSize); + void setMacroMemory(const std::string &_name, u32 _immediate, u8 _rt, int _dataSize); void recheck() override { }; int getNumLines() override { return 1; }; diff --git a/Core/Dialog/PSPGamedataInstallDialog.cpp b/Core/Dialog/PSPGamedataInstallDialog.cpp index 84cef563d9..3ce0f30ff2 100644 --- a/Core/Dialog/PSPGamedataInstallDialog.cpp +++ b/Core/Dialog/PSPGamedataInstallDialog.cpp @@ -49,7 +49,7 @@ static const std::string SFO_FILENAME = "PARAM.SFO"; namespace { - std::vector GetPSPFileList (std::string dirpath) { + std::vector GetPSPFileList (const std::string &dirpath) { std::vector FileList; auto Fileinfos = pspFileSystem.GetDirListing(dirpath); @@ -258,7 +258,7 @@ int PSPGamedataInstallDialog::Shutdown(bool force) { return PSPDialog::Shutdown(force); } -std::string PSPGamedataInstallDialog::GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, std::string filename) { +std::string PSPGamedataInstallDialog::GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, const std::string &filename) { if (!param) return ""; std::string GameDataInstallPath = saveBasePath + param->gameName + param->dataName + "/"; diff --git a/Core/Dialog/PSPGamedataInstallDialog.h b/Core/Dialog/PSPGamedataInstallDialog.h index bf076c751e..859d9a3d72 100644 --- a/Core/Dialog/PSPGamedataInstallDialog.h +++ b/Core/Dialog/PSPGamedataInstallDialog.h @@ -44,7 +44,7 @@ public: void DoState(PointerWrap &p) override; int Abort(); - std::string GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, std::string filename); + std::string GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, const std::string &filename); protected: // TODO: Manage status correctly. diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index 3722d89faf..6b23fde60b 100755 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -179,7 +179,7 @@ void PSPMsgDialog::FormatErrorCode(uint32_t code) { } } -void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo, bool hasOK) { +void PSPMsgDialog::DisplayMessage(const std::string &text, bool hasYesNo, bool hasOK) { auto di = GetI18NCategory(I18NCat::DIALOG); PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); diff --git a/Core/Dialog/PSPMsgDialog.h b/Core/Dialog/PSPMsgDialog.h index 32a4831640..6291cf3648 100644 --- a/Core/Dialog/PSPMsgDialog.h +++ b/Core/Dialog/PSPMsgDialog.h @@ -76,7 +76,7 @@ protected: private: void FormatErrorCode(uint32_t code); - void DisplayMessage(std::string text, bool hasYesNo = false, bool hasOK = false); + void DisplayMessage(const std::string &text, bool hasYesNo = false, bool hasOK = false); enum Flags { diff --git a/Core/Dialog/PSPNetconfDialog.cpp b/Core/Dialog/PSPNetconfDialog.cpp index 70b1a41511..c1802db9e7 100644 --- a/Core/Dialog/PSPNetconfDialog.cpp +++ b/Core/Dialog/PSPNetconfDialog.cpp @@ -103,7 +103,7 @@ void PSPNetconfDialog::DrawIndicator() { PPGeDrawImage(456, 248, 20.0f, 20.0f, 1, 10, 1, 10, 10, 10, FadedImageStyle()); } -void PSPNetconfDialog::DisplayMessage(std::string text1, std::string text2a, std::string text2b, std::string text3a, std::string text3b, bool hasYesNo, bool hasOK) { +void PSPNetconfDialog::DisplayMessage(const std::string &text1, const std::string &text2a, const std::string &text2b, const std::string &text3a, const std::string &text3b, bool hasYesNo, bool hasOK) { auto di = GetI18NCategory(I18NCat::DIALOG); PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); diff --git a/Core/Dialog/PSPNetconfDialog.h b/Core/Dialog/PSPNetconfDialog.h index 52a3ce203a..e2d06f3739 100644 --- a/Core/Dialog/PSPNetconfDialog.h +++ b/Core/Dialog/PSPNetconfDialog.h @@ -52,7 +52,7 @@ protected: } private: - void DisplayMessage(std::string text1, std::string text2a = "", std::string text2b = "", std::string text3a = "", std::string text3b = "", bool hasYesNo = false, bool hasOK = false); + void DisplayMessage(const std::string &text1, const std::string &text2a = "", const std::string &text2b = "", const std::string &text3a = "", const std::string &text3b = "", bool hasYesNo = false, bool hasOK = false); void DrawBanner(); void DrawIndicator(); diff --git a/Core/Dialog/PSPNpSigninDialog.cpp b/Core/Dialog/PSPNpSigninDialog.cpp index bc8def540e..9af12480c9 100644 --- a/Core/Dialog/PSPNpSigninDialog.cpp +++ b/Core/Dialog/PSPNpSigninDialog.cpp @@ -100,7 +100,7 @@ void PSPNpSigninDialog::DrawLogo() { PPGeDrawImage(416, 22, 64.0f, 64.0f, 1, 10, 1, 10, 64, 64, FadedImageStyle()); } -void PSPNpSigninDialog::DisplayMessage(std::string text1, std::string text2a, std::string text2b, std::string text3a, std::string text3b, bool hasYesNo, bool hasOK) { +void PSPNpSigninDialog::DisplayMessage(const std::string &text1, const std::string &text2a, const std::string &text2b, const std::string &text3a, const std::string &text3b, bool hasYesNo, bool hasOK) { auto di = GetI18NCategory(I18NCat::DIALOG); PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); diff --git a/Core/Dialog/PSPNpSigninDialog.h b/Core/Dialog/PSPNpSigninDialog.h index 2b31922735..5b67b508da 100644 --- a/Core/Dialog/PSPNpSigninDialog.h +++ b/Core/Dialog/PSPNpSigninDialog.h @@ -48,7 +48,7 @@ protected: } private: - void DisplayMessage(std::string text1, std::string text2a = "", std::string text2b = "", std::string text3a = "", std::string text3b = "", bool hasYesNo = false, bool hasOK = false); + void DisplayMessage(const std::string &text1, const std::string &text2a = "", const std::string &text2b = "", const std::string &text3a = "", const std::string &text3b = "", bool hasYesNo = false, bool hasOK = false); void DrawBanner(); void DrawIndicator(); void DrawLogo(); diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index ee388bef19..31f59b29be 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -580,7 +580,7 @@ void PSPSaveDialog::DisplaySaveDataInfo2(bool showNewData) { PPGeDrawText(saveinfoTxt.c_str(), 8, 200, textStyle); } -void PSPSaveDialog::DisplayMessage(std::string text, bool hasYesNo) +void PSPSaveDialog::DisplayMessage(const std::string &text, bool hasYesNo) { PPGeStyle textStyle = FadedStyle(PPGeAlign::BOX_CENTER, FONT_SCALE); diff --git a/Core/Dialog/PSPSaveDialog.h b/Core/Dialog/PSPSaveDialog.h index be6024ac52..d068a07a6b 100644 --- a/Core/Dialog/PSPSaveDialog.h +++ b/Core/Dialog/PSPSaveDialog.h @@ -94,7 +94,7 @@ private: void DisplaySaveIcon(bool checkExists); void DisplaySaveDataInfo1(); void DisplaySaveDataInfo2(bool showNewData = false); - void DisplayMessage(std::string text, bool hasYesNo = false); + void DisplayMessage(const std::string &text, bool hasYesNo = false); const std::string GetSelectedSaveDirName() const; void JoinIOThread(); diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 58f107b218..55437681fd 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -63,7 +63,7 @@ namespace truncate_cpy(str, strLength, value.c_str()); } - bool ReadPSPFile(std::string filename, u8 **data, s64 dataSize, s64 *readSize) + bool ReadPSPFile(const std::string &filename, u8 **data, s64 dataSize, s64 *readSize) { int handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ); if (handle < 0) @@ -86,7 +86,7 @@ namespace return result != 0; } - bool WritePSPFile(std::string filename, const u8 *data, SceSize dataSize) + bool WritePSPFile(const std::string &filename, const u8 *data, SceSize dataSize) { int handle = pspFileSystem.OpenFile(filename, (FileAccess)(FILEACCESS_WRITE | FILEACCESS_CREATE | FILEACCESS_TRUNCATE)); if (handle < 0) @@ -110,7 +110,7 @@ namespace return info; } - bool PSPMatch(std::string text, std::string regexp) + bool PSPMatch(const std::string &text, const std::string ®exp) { if(text.empty() && regexp.empty()) return true; @@ -1607,7 +1607,7 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) return 0; } -void SavedataParam::SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, std::string saveName, std::string savrDir) +void SavedataParam::SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, const std::string &saveName, const std::string &savrDir) { saveInfo.size = info.size; saveInfo.saveName = saveName; @@ -1647,7 +1647,7 @@ void SavedataParam::SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, std:: } } -void SavedataParam::SetFileInfo(int idx, PSPFileInfo &info, std::string saveName, std::string saveDir) +void SavedataParam::SetFileInfo(int idx, PSPFileInfo &info, const std::string &saveName, const std::string &saveDir) { SetFileInfo(saveDataList[idx], info, saveName, saveDir); saveDataList[idx].idx = idx; @@ -1679,7 +1679,7 @@ void SavedataParam::ClearFileInfo(SaveFileInfo &saveInfo, const std::string &sav } } -PSPFileInfo SavedataParam::GetSaveInfo(std::string saveDir) { +PSPFileInfo SavedataParam::GetSaveInfo(const std::string &saveDir) { PSPFileInfo info = pspFileSystem.GetFileInfo(saveDir); if (info.exists) { info.access = 0777; @@ -1970,7 +1970,7 @@ int SavedataParam::GetSaveCryptMode(const SceUtilitySavedataParam *param, const return 0; } -bool SavedataParam::IsInSaveDataList(std::string saveName, int count) { +bool SavedataParam::IsInSaveDataList(const std::string &saveName, int count) { for(int i = 0; i < count; ++i) { if(strcmp(saveDataList[i].saveName.c_str(),saveName.c_str()) == 0) return true; diff --git a/Core/Dialog/SavedataParam.h b/Core/Dialog/SavedataParam.h index 257fc02746..04c8dca5e4 100644 --- a/Core/Dialog/SavedataParam.h +++ b/Core/Dialog/SavedataParam.h @@ -318,7 +318,7 @@ public: int GetFilesList(SceUtilitySavedataParam* param, u32 requestAddr); bool GetSize(SceUtilitySavedataParam* param); int GetSaveCryptMode(const SceUtilitySavedataParam *param, const std::string &saveDirName); - bool IsInSaveDataList(std::string saveName, int count); + bool IsInSaveDataList(const std::string &saveName, int count); std::string GetGameName(const SceUtilitySavedataParam *param) const; std::string GetSaveName(const SceUtilitySavedataParam *param) const; @@ -361,10 +361,10 @@ public: private: void Clear(); - void SetFileInfo(int idx, PSPFileInfo &info, std::string saveName, std::string saveDir = ""); - void SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, std::string saveName, std::string saveDir = ""); + void SetFileInfo(int idx, PSPFileInfo &info, const std::string &saveName, const std::string &saveDir = ""); + void SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, const std::string &saveName, const std::string &saveDir = ""); void ClearFileInfo(SaveFileInfo &saveInfo, const std::string &saveName); - PSPFileInfo GetSaveInfo(std::string saveDir); + PSPFileInfo GetSaveInfo(const std::string &saveDir); int LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string& dirPath, bool secureMode); u32 LoadCryptedSave(SceUtilitySavedataParam *param, u8 *data, const u8 *saveData, int &saveSize, int prevCryptMode, const u8 *expectedHash, bool &saveDone); diff --git a/Core/ELF/ParamSFO.cpp b/Core/ELF/ParamSFO.cpp index d6717af0b2..3aeb92b7bf 100644 --- a/Core/ELF/ParamSFO.cpp +++ b/Core/ELF/ParamSFO.cpp @@ -43,38 +43,38 @@ struct IndexTable u32_le data_table_offset; /* Offset of the param_data from start of data_table */ }; -void ParamSFOData::SetValue(std::string key, unsigned int value, int max_size) { +void ParamSFOData::SetValue(const std::string &key, unsigned int value, int max_size) { values[key].type = VT_INT; values[key].i_value = value; values[key].max_size = max_size; } -void ParamSFOData::SetValue(std::string key, std::string value, int max_size) { +void ParamSFOData::SetValue(const std::string &key, const std::string &value, int max_size) { values[key].type = VT_UTF8; values[key].s_value = value; values[key].max_size = max_size; } -void ParamSFOData::SetValue(std::string key, const u8 *value, unsigned int size, int max_size) { +void ParamSFOData::SetValue(const std::string &key, const u8 *value, unsigned int size, int max_size) { values[key].type = VT_UTF8_SPE; values[key].SetData(value, size); values[key].max_size = max_size; } -int ParamSFOData::GetValueInt(std::string key) const { +int ParamSFOData::GetValueInt(const std::string &key) const { std::map::const_iterator it = values.find(key); if(it == values.end() || it->second.type != VT_INT) return 0; return it->second.i_value; } -std::string ParamSFOData::GetValueString(std::string key) const { +std::string ParamSFOData::GetValueString(const std::string &key) const { std::map::const_iterator it = values.find(key); if(it == values.end() || (it->second.type != VT_UTF8)) return ""; return it->second.s_value; } -const u8 *ParamSFOData::GetValueData(std::string key, unsigned int *size) const { +const u8 *ParamSFOData::GetValueData(const std::string &key, unsigned int *size) const { std::map::const_iterator it = values.find(key); if(it == values.end() || (it->second.type != VT_UTF8_SPE)) return 0; @@ -195,7 +195,7 @@ bool ParamSFOData::ReadSFO(const u8 *paramsfo, size_t size) { return true; } -int ParamSFOData::GetDataOffset(const u8 *paramsfo, std::string dataName) { +int ParamSFOData::GetDataOffset(const u8 *paramsfo, const std::string &dataName) { const Header *header = (const Header *)paramsfo; if (header->magic != 0x46535000) return -1; @@ -320,7 +320,7 @@ void ParamSFOData::ValueData::SetData(const u8* data, int size) { u_size = size; } -std::string ParamSFOData::GenerateFakeID(std::string filename) const { +std::string ParamSFOData::GenerateFakeID(const std::string &filename) const { // Generates fake gameID for homebrew based on it's folder name. // Should probably not be a part of ParamSFO, but it'll be called in same places. std::string file = PSP_CoreParameter().fileToStart.ToString(); diff --git a/Core/ELF/ParamSFO.h b/Core/ELF/ParamSFO.h index 0e5afab4bd..f132e1c5f7 100644 --- a/Core/ELF/ParamSFO.h +++ b/Core/ELF/ParamSFO.h @@ -27,16 +27,16 @@ class ParamSFOData { public: - void SetValue(std::string key, unsigned int value, int max_size); - void SetValue(std::string key, std::string value, int max_size); - void SetValue(std::string key, const u8 *value, unsigned int size, int max_size); + void SetValue(const std::string &key, unsigned int value, int max_size); + void SetValue(const std::string &key, const std::string &value, int max_size); + void SetValue(const std::string &key, const u8 *value, unsigned int size, int max_size); - int GetValueInt(std::string key) const; - std::string GetValueString(std::string key) const; - const u8 *GetValueData(std::string key, unsigned int *size) const; + int GetValueInt(const std::string &key) const; + std::string GetValueString(const std::string &key) const; + const u8 *GetValueData(const std::string &key, unsigned int *size) const; std::vector GetKeys() const; - std::string GenerateFakeID(std::string filename = "") const; + std::string GenerateFakeID(const std::string &filename = "") const; std::string GetDiscID(); @@ -51,7 +51,7 @@ public: } } - int GetDataOffset(const u8 *paramsfo, std::string dataName); + int GetDataOffset(const u8 *paramsfo, const std::string &dataName); void Clear(); diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index 0ead3b15f7..7695653c03 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -966,7 +966,7 @@ VFSFileSystem::~VFSFileSystem() { entries.clear(); } -std::string VFSFileSystem::GetLocalPath(std::string localPath) { +std::string VFSFileSystem::GetLocalPath(const std::string &localPath) { return basePath + localPath; } diff --git a/Core/FileSystems/DirectoryFileSystem.h b/Core/FileSystems/DirectoryFileSystem.h index 5edfa9a1a3..965a90f8fc 100644 --- a/Core/FileSystems/DirectoryFileSystem.h +++ b/Core/FileSystems/DirectoryFileSystem.h @@ -145,5 +145,5 @@ private: std::string basePath; IHandleAllocator *hAlloc; - std::string GetLocalPath(std::string localpath); + std::string GetLocalPath(const std::string &localpath); }; diff --git a/Core/FileSystems/ISOFileSystem.cpp b/Core/FileSystems/ISOFileSystem.cpp index 06ebac25af..4fb682684e 100644 --- a/Core/FileSystems/ISOFileSystem.cpp +++ b/Core/FileSystems/ISOFileSystem.cpp @@ -30,7 +30,7 @@ const int sectorSize = 2048; -bool parseLBN(std::string filename, u32 *sectorStart, u32 *readSize) { +bool parseLBN(const std::string &filename, u32 *sectorStart, u32 *readSize) { // The format of this is: "/sce_lbn" "0x"? HEX* ANY* "_size" "0x"? HEX* ANY* // That means that "/sce_lbn/_size1/" is perfectly valid. // Most commonly, it looks like /sce_lbn0x10_size0x100 or /sce_lbn10_size100 (always hex.) diff --git a/Core/FileSystems/ISOFileSystem.h b/Core/FileSystems/ISOFileSystem.h index 613bfcf15d..be613bee93 100644 --- a/Core/FileSystems/ISOFileSystem.h +++ b/Core/FileSystems/ISOFileSystem.h @@ -25,7 +25,7 @@ #include "BlockDevices.h" -bool parseLBN(std::string filename, u32 *sectorStart, u32 *readSize); +bool parseLBN(const std::string &filename, u32 *sectorStart, u32 *readSize); class ISOFileSystem : public IFileSystem { public: diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index c35f0e59ef..5dece8e210 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -274,7 +274,7 @@ std::string MetaFileSystem::NormalizePrefix(std::string prefix) const { return prefix; } -void MetaFileSystem::Mount(std::string prefix, std::shared_ptr system) { +void MetaFileSystem::Mount(const std::string &prefix, std::shared_ptr system) { std::lock_guard guard(lock); MountPoint x; @@ -297,7 +297,7 @@ void MetaFileSystem::UnmountAll() { currentDir.clear(); } -void MetaFileSystem::Unmount(std::string prefix) { +void MetaFileSystem::Unmount(const std::string &prefix) { for (auto iter = fileSystems.begin(); iter != fileSystems.end(); iter++) { if (iter->prefix == prefix) { fileSystems.erase(iter); @@ -306,7 +306,7 @@ void MetaFileSystem::Unmount(std::string prefix) { } } -bool MetaFileSystem::Remount(std::string prefix, std::shared_ptr system) { +bool MetaFileSystem::Remount(const std::string &prefix, std::shared_ptr system) { std::lock_guard guard(lock); for (auto &it : fileSystems) { if (it.prefix == prefix) { diff --git a/Core/FileSystems/MetaFileSystem.h b/Core/FileSystems/MetaFileSystem.h index bd18bfaf22..a735106f68 100644 --- a/Core/FileSystems/MetaFileSystem.h +++ b/Core/FileSystems/MetaFileSystem.h @@ -57,12 +57,12 @@ public: Reset(); } - void Mount(std::string prefix, std::shared_ptr system); + void Mount(const std::string &prefix, std::shared_ptr system); // Fails if there's not already a file system at prefix. - bool Remount(std::string prefix, std::shared_ptr system); + bool Remount(const std::string &prefix, std::shared_ptr system); void UnmountAll(); - void Unmount(std::string prefix); + void Unmount(const std::string &prefix); // The pointer returned from these are for temporary usage only. Do not store. IFileSystem *GetSystem(const std::string &prefix); diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index 9a1cfc94bd..32ad2b4bfb 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -1310,7 +1310,7 @@ void timeoutFriendsRecursive(SceNetAdhocctlPeerInfo * node, int32_t* count) { if (count != NULL) (*count)++; } -void sendChat(std::string chatString) { +void sendChat(const std::string &chatString) { SceNetAdhocctlChatPacketC2S chat; auto n = GetI18NCategory(I18NCat::NETWORKING); chat.base.opcode = OPCODE_CHAT; diff --git a/Core/HLE/proAdhoc.h b/Core/HLE/proAdhoc.h index bb80a10a64..49ab5c8e48 100644 --- a/Core/HLE/proAdhoc.h +++ b/Core/HLE/proAdhoc.h @@ -1038,7 +1038,7 @@ void addFriend(SceNetAdhocctlConnectPacketS2C * packet); * Send chat or get that * @param std::string ChatString */ -void sendChat(std::string chatString); +void sendChat(const std::string &chatString); std::vector getChatLog(); int GetChatChangeID(); int GetChatMessageCount(); diff --git a/Core/HLE/sceKernelMsgPipe.cpp b/Core/HLE/sceKernelMsgPipe.cpp index 5b44e57bb4..5292d90c10 100644 --- a/Core/HLE/sceKernelMsgPipe.cpp +++ b/Core/HLE/sceKernelMsgPipe.cpp @@ -125,7 +125,7 @@ struct MsgPipeWaitingThread } }; -static bool __KernelMsgPipeThreadSortPriority(MsgPipeWaitingThread thread1, MsgPipeWaitingThread thread2) +static bool __KernelMsgPipeThreadSortPriority(const MsgPipeWaitingThread &thread1, const MsgPipeWaitingThread &thread2) { return __KernelThreadSortPriority(thread1.threadID, thread2.threadID); } diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 14bca68380..00b624a67b 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -1233,7 +1233,7 @@ void __UpdateAdhocctlHandlers(u32 flag, u32 error) { adhocctlEvents.push_back({ flag, error }); } -void __UpdateMatchingHandler(MatchingArgs ArgsPtr) { +void __UpdateMatchingHandler(const MatchingArgs &ArgsPtr) { std::lock_guard adhocGuard(adhocEvtMtx); matchingEvents.push_back(ArgsPtr); } diff --git a/Core/HLE/sceNetAdhoc.h b/Core/HLE/sceNetAdhoc.h index e2f53efaf6..db9bec3b33 100644 --- a/Core/HLE/sceNetAdhoc.h +++ b/Core/HLE/sceNetAdhoc.h @@ -102,7 +102,7 @@ void __NetAdhocInit(); void __NetAdhocShutdown(); void __NetAdhocDoState(PointerWrap &p); void __UpdateAdhocctlHandlers(u32 flags, u32 error); -void __UpdateMatchingHandler(MatchingArgs params); +void __UpdateMatchingHandler(const MatchingArgs ¶ms); // I have to call this from netdialog int sceNetAdhocctlGetState(u32 ptrToStatus); diff --git a/Core/HW/AsyncIOManager.cpp b/Core/HW/AsyncIOManager.cpp index 8718bcbdb0..2156d5261a 100644 --- a/Core/HW/AsyncIOManager.cpp +++ b/Core/HW/AsyncIOManager.cpp @@ -39,7 +39,7 @@ bool AsyncIOManager::HasOperation(u32 handle) { return false; } -void AsyncIOManager::ScheduleOperation(AsyncIOEvent ev) { +void AsyncIOManager::ScheduleOperation(const AsyncIOEvent &ev) { { std::lock_guard guard(resultsLock_); if (!resultsPending_.insert(ev.handle).second) { @@ -143,7 +143,7 @@ void AsyncIOManager::Write(u32 handle, const u8 *buf, size_t bytes) { EventResult(handle, AsyncIOResult(result, usec)); } -void AsyncIOManager::EventResult(u32 handle, AsyncIOResult result) { +void AsyncIOManager::EventResult(u32 handle, const AsyncIOResult &result) { std::lock_guard guard(resultsLock_); if (results_.find(handle) != results_.end()) { ERROR_LOG_REPORT(SCEIO, "Overwriting previous result for file action on handle %d", handle); diff --git a/Core/HW/AsyncIOManager.h b/Core/HW/AsyncIOManager.h index 1145db17ac..54d24eb047 100644 --- a/Core/HW/AsyncIOManager.h +++ b/Core/HW/AsyncIOManager.h @@ -83,7 +83,7 @@ public: void DoState(PointerWrap &p); bool HasOperation(u32 handle); - void ScheduleOperation(AsyncIOEvent ev); + void ScheduleOperation(const AsyncIOEvent &ev); void Shutdown(); bool HasResult(u32 handle); @@ -102,7 +102,7 @@ private: void Read(u32 handle, u8 *buf, size_t bytes, u32 invalidateAddr); void Write(u32 handle, const u8 *buf, size_t bytes); - void EventResult(u32 handle, AsyncIOResult result); + void EventResult(u32 handle, const AsyncIOResult &result); std::mutex resultsLock_; std::condition_variable resultsWait_; diff --git a/Core/KeyMap.cpp b/Core/KeyMap.cpp index f408182e59..e3a746841d 100644 --- a/Core/KeyMap.cpp +++ b/Core/KeyMap.cpp @@ -608,7 +608,7 @@ bool IsKeyMapped(InputDeviceID device, int key) { return false; } -bool ReplaceSingleKeyMapping(int btn, int index, MultiInputMapping key) { +bool ReplaceSingleKeyMapping(int btn, int index, const MultiInputMapping &key) { std::lock_guard guard(g_controllerMapLock); // Check for duplicate for (int i = 0; i < (int)g_controllerMap[btn].size(); ++i) { diff --git a/Core/KeyMap.h b/Core/KeyMap.h index 976ed67e06..69a9bd40b9 100644 --- a/Core/KeyMap.h +++ b/Core/KeyMap.h @@ -188,7 +188,7 @@ namespace KeyMap { // Any configuration will be saved to the Core config. void SetInputMapping(int psp_key, const MultiInputMapping &key, bool replace); // Return false if bind was a duplicate and got removed - bool ReplaceSingleKeyMapping(int btn, int index, MultiInputMapping key); + bool ReplaceSingleKeyMapping(int btn, int index, const MultiInputMapping &key); MappedAnalogAxes MappedAxesForDevice(InputDeviceID deviceId); diff --git a/Core/Loaders.cpp b/Core/Loaders.cpp index 6bb5f5d343..b304af72bd 100644 --- a/Core/Loaders.cpp +++ b/Core/Loaders.cpp @@ -37,7 +37,7 @@ static std::map> factories; -void RegisterFileLoaderFactory(std::string prefix, std::unique_ptr factory) { +void RegisterFileLoaderFactory(const std::string &prefix, std::unique_ptr factory) { factories[prefix] = std::move(factory); } diff --git a/Core/Loaders.h b/Core/Loaders.h index 5bc90d3e2c..3eeb301fc3 100644 --- a/Core/Loaders.h +++ b/Core/Loaders.h @@ -152,7 +152,7 @@ public: virtual ~FileLoaderFactory() {} virtual FileLoader *ConstructFileLoader(const Path &filename) = 0; }; -void RegisterFileLoaderFactory(std::string prefix, std::unique_ptr factory); +void RegisterFileLoaderFactory(const std::string &prefix, std::unique_ptr factory); // Can modify the string filename, as it calls IdentifyFile above. bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string); diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 6d1f5a983c..3f4d8df28d 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -623,7 +623,7 @@ namespace Reporting return true; } - bool Enable(bool flag, std::string host) + bool Enable(bool flag, const std::string &host) { if (IsSupported() && IsEnabled() != flag) { diff --git a/Core/Reporting.h b/Core/Reporting.h index 1d254256f7..fff45d3b15 100644 --- a/Core/Reporting.h +++ b/Core/Reporting.h @@ -53,7 +53,7 @@ namespace Reporting // Set the current enabled state of the reporting system and desired reporting server host. // Returns if anything was changed. - bool Enable(bool flag, std::string host); + bool Enable(bool flag, const std::string &host); // Use the default reporting setting (per compiled settings) of host and enabled state. void EnableDefault(); diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index 1b0087444f..80563be08d 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -397,7 +397,7 @@ namespace SaveState pspFileSystem.DoState(p); } - void Enqueue(SaveState::Operation op) + void Enqueue(const SaveState::Operation &op) { if (Achievements::HardcoreModeActive()) { if (g_Config.bAchievementsSaveStateInHardcoreMode && ((op.type == SaveState::SAVESTATE_SAVE) || (op.type == SAVESTATE_SAVE_SCREENSHOT))) { diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index 52bc6a6821..17aa0013cd 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -86,12 +86,12 @@ Path GameManager::GetTempFilename() const { #endif } -bool GameManager::IsGameInstalled(std::string name) { +bool GameManager::IsGameInstalled(const std::string &name) { Path pspGame = GetSysDirectory(DIRECTORY_GAME); return File::Exists(pspGame / name); } -bool GameManager::DownloadAndInstall(std::string storeFileUrl) { +bool GameManager::DownloadAndInstall(const std::string &storeFileUrl) { if (curDownload_.get() != nullptr) { ERROR_LOG(HLE, "Can only process one download at a time"); return false; @@ -107,7 +107,7 @@ bool GameManager::DownloadAndInstall(std::string storeFileUrl) { return true; } -bool GameManager::IsDownloading(std::string storeZipUrl) { +bool GameManager::IsDownloading(const std::string &storeZipUrl) { if (curDownload_) return curDownload_->url() == storeZipUrl; return false; @@ -128,7 +128,7 @@ float GameManager::DownloadSpeedKBps() { return 0.0f; } -void GameManager::UninstallGame(std::string name) { +void GameManager::UninstallGame(const std::string &name) { SetCurrentThreadName("UninstallGame"); AndroidJNIThreadContext context; // Destructor detaches. @@ -285,7 +285,7 @@ ZipFileContents DetectZipFileContents(struct zip *z, ZipFileInfo *info) { } // Parameters need to be by value, since this is a thread func. -bool GameManager::InstallGame(Path url, Path fileName, bool deleteAfter) { +bool GameManager::InstallGame(const Path &url, const Path &fileName, bool deleteAfter) { SetCurrentThreadName("InstallGame"); if (installDonePending_) { diff --git a/Core/Util/GameManager.h b/Core/Util/GameManager.h index 0d6b9ce78e..ec4ad5b8c2 100644 --- a/Core/Util/GameManager.h +++ b/Core/Util/GameManager.h @@ -42,11 +42,11 @@ class GameManager { public: GameManager(); - bool IsGameInstalled(std::string name); + bool IsGameInstalled(const std::string &name); // This starts off a background process. - bool DownloadAndInstall(std::string storeZipUrl); - bool IsDownloading(std::string storeZipUrl); + bool DownloadAndInstall(const std::string &storeZipUrl); + bool IsDownloading(const std::string &storeZipUrl); // Cancels the download in progress, if any. bool CancelDownload(); @@ -79,12 +79,12 @@ public: private: // TODO: The return value on this is a bit pointless, we can't get at it. - bool InstallGame(Path url, Path tempFileName, bool deleteAfter); + bool InstallGame(const Path &url, const Path &tempFileName, bool deleteAfter); bool InstallMemstickGame(struct zip *z, const Path &zipFile, const Path &dest, const ZipFileInfo &info, bool allowRoot, bool deleteAfter); bool InstallMemstickZip(struct zip *z, const Path &zipFile, const Path &dest, const ZipFileInfo &info, bool deleteAfter); bool InstallZippedISO(struct zip *z, int isoFileIndex, const Path &zipfile, bool deleteAfter); bool InstallRawISO(const Path &zipFile, const std::string &originalName, bool deleteAfter); - void UninstallGame(std::string name); + void UninstallGame(const std::string &name); void InstallDone(); diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index 8a4f3f90f0..6c88b29a37 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -948,7 +948,7 @@ static PPGeTextDrawerImage PPGeGetTextImage(const char *text, const PPGeStyle &s return im; } -static void PPGeDrawTextImage(PPGeTextDrawerImage im, float x, float y, const PPGeStyle &style) { +static void PPGeDrawTextImage(const PPGeTextDrawerImage &im, float x, float y, const PPGeStyle &style) { if (!im.ptr) { return; }