From 37f50a37925244ddea56e5a3039a839ba8fb2d06 Mon Sep 17 00:00:00 2001 From: Chin Date: Wed, 24 Dec 2014 21:42:41 -0500 Subject: [PATCH] Change to pass some arguments by reference --- Core/CwCheat.cpp | 2 +- Core/Dialog/PSPOskDialog.cpp | 4 ++-- Core/Dialog/PSPOskDialog.h | 2 +- Core/Dialog/SavedataParam.cpp | 6 +++--- Core/Dialog/SavedataParam.h | 6 +++--- Core/MIPS/x86/Jit.cpp | 2 +- Core/MIPS/x86/Jit.h | 2 +- Core/MIPS/x86/JitSafeMem.cpp | 2 +- Core/MIPS/x86/JitSafeMem.h | 4 ++-- Core/MIPS/x86/RegCache.cpp | 2 +- Core/MIPS/x86/RegCache.h | 2 +- Core/MIPS/x86/RegCacheFPU.cpp | 2 +- Core/MIPS/x86/RegCacheFPU.h | 2 +- Core/MemMap.cpp | 2 +- Core/MemMap.h | 2 +- GPU/Common/SplineCommon.cpp | 4 ++-- headless/Compare.cpp | 2 +- headless/Compare.h | 2 +- 18 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Core/CwCheat.cpp b/Core/CwCheat.cpp index b1a5940aa..63b6954d1 100644 --- a/Core/CwCheat.cpp +++ b/Core/CwCheat.cpp @@ -131,7 +131,7 @@ void CWCheatEngine::Exit() { exit2 = true; } -static inline std::vector makeCodeParts(const std::vector CodesList) { //Takes a single code line and creates a two-part vector for each code. Feeds to CreateCodeList +static inline std::vector makeCodeParts(const std::vector& CodesList) { //Takes a single code line and creates a two-part vector for each code. Feeds to CreateCodeList std::string currentcode; std::vector finalList; char split_char = '\n'; diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index b1a95a4a7..e07668a9e 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -152,7 +152,7 @@ PSPOskDialog::PSPOskDialog() : PSPDialog() { PSPOskDialog::~PSPOskDialog() { } -void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer em_address) +void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer& em_address) { if (!em_address.IsValid()) { @@ -182,7 +182,7 @@ void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer em_address) +void GetWideStringFromPSPPointer(std::wstring& _string, const PSPPointer& em_address) { if (!em_address.IsValid()) { diff --git a/Core/Dialog/PSPOskDialog.h b/Core/Dialog/PSPOskDialog.h index dd4850f80..fa0ce88a6 100644 --- a/Core/Dialog/PSPOskDialog.h +++ b/Core/Dialog/PSPOskDialog.h @@ -217,7 +217,7 @@ protected: } private: - void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer em_address); + void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer& em_address); void ConvertUCS2ToUTF8(std::string& _string, const wchar_t *input); void RenderKeyboard(); #if defined(USING_WIN_UI) diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 3bbbf3961..e9a6821ac 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -579,7 +579,7 @@ bool SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &save return true; } -bool SavedataParam::LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string dirPath, bool secureMode) { +bool SavedataParam::LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string& dirPath, bool secureMode) { u8 *data_ = param->dataBuf; std::string filePath = dirPath+"/"+GetFileName(param); s64 readSize; @@ -668,7 +668,7 @@ void SavedataParam::LoadNotCryptedSave(SceUtilitySavedataParam *param, u8 *data, memcpy(data, saveData, std::min((u32)saveSize, (u32)param->dataBufSize)); } -void SavedataParam::LoadSFO(SceUtilitySavedataParam *param, const std::string dirPath) { +void SavedataParam::LoadSFO(SceUtilitySavedataParam *param, const std::string& dirPath) { ParamSFOData sfoFile; std::string sfopath = dirPath+"/" + SFO_FILENAME; PSPFileInfo sfoInfo = pspFileSystem.GetFileInfo(sfopath); @@ -720,7 +720,7 @@ std::set SavedataParam::getSecureFileNames(std::string dirPath) { return secureFileNames; } -void SavedataParam::LoadFile(const std::string dirPath, const std::string filename, PspUtilitySavedataFileData *fileData) { +void SavedataParam::LoadFile(const std::string& dirPath, const std::string& filename, PspUtilitySavedataFileData *fileData) { std::string filePath = dirPath + "/" + filename; s64 readSize = -1; if(!fileData->buf.IsValid()) diff --git a/Core/Dialog/SavedataParam.h b/Core/Dialog/SavedataParam.h index 0dc0aaae5..be8c67930 100644 --- a/Core/Dialog/SavedataParam.h +++ b/Core/Dialog/SavedataParam.h @@ -354,11 +354,11 @@ private: void SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, std::string saveName); void ClearFileInfo(SaveFileInfo &saveInfo, std::string saveName); - bool LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string dirPath, bool secureMode); + bool LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string& dirPath, bool secureMode); void LoadCryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int &saveSize, int prevCryptMode, bool &saveDone); void LoadNotCryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int &saveSize); - void LoadSFO(SceUtilitySavedataParam *param, const std::string dirPath); - void LoadFile(const std::string dirPath, const std::string filename, PspUtilitySavedataFileData *fileData); + void LoadSFO(SceUtilitySavedataParam *param, const std::string& dirPath); + void LoadFile(const std::string& dirPath, const std::string& filename, PspUtilitySavedataFileData *fileData); int DecryptSave(unsigned int mode, unsigned char *data, int *dataLen, int *alignedLen, unsigned char *cryptkey); int EncryptData(unsigned int mode, unsigned char *data, int *dataLen, int *alignedLen, unsigned char *hash, unsigned char *cryptkey); diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index 6fd834f6b..946d9592f 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -183,7 +183,7 @@ void Jit::GetStateAndFlushAll(RegCacheState &state) FlushAll(); } -void Jit::RestoreState(const RegCacheState state) +void Jit::RestoreState(const RegCacheState& state) { gpr.RestoreState(state.gpr); fpr.RestoreState(state.fpr); diff --git a/Core/MIPS/x86/Jit.h b/Core/MIPS/x86/Jit.h index a4b8c8cfa..3e3b20b6e 100644 --- a/Core/MIPS/x86/Jit.h +++ b/Core/MIPS/x86/Jit.h @@ -187,7 +187,7 @@ public: private: void GetStateAndFlushAll(RegCacheState &state); - void RestoreState(const RegCacheState state); + void RestoreState(const RegCacheState& state); void FlushAll(); void FlushPrefixV(); void WriteDowncount(int offset = 0); diff --git a/Core/MIPS/x86/JitSafeMem.cpp b/Core/MIPS/x86/JitSafeMem.cpp index 3141fb892..481f1524a 100644 --- a/Core/MIPS/x86/JitSafeMem.cpp +++ b/Core/MIPS/x86/JitSafeMem.cpp @@ -234,7 +234,7 @@ bool JitSafeMem::PrepareSlowWrite() return false; } -void JitSafeMem::DoSlowWrite(const void *safeFunc, const OpArg src, int suboffset) +void JitSafeMem::DoSlowWrite(const void *safeFunc, const OpArg& src, int suboffset) { if (iaddr_ != (u32) -1) jit_->MOV(32, R(EAX), Imm32((iaddr_ + suboffset) & alignMask_)); diff --git a/Core/MIPS/x86/JitSafeMem.h b/Core/MIPS/x86/JitSafeMem.h index 908b14659..58885ca58 100644 --- a/Core/MIPS/x86/JitSafeMem.h +++ b/Core/MIPS/x86/JitSafeMem.h @@ -36,9 +36,9 @@ public: // Emit code proceeding a slow write call, returns true if slow write is needed. bool PrepareSlowWrite(); // Emit a slow write from src. - void DoSlowWrite(const void *safeFunc, const Gen::OpArg src, int suboffset = 0); + void DoSlowWrite(const void *safeFunc, const Gen::OpArg& src, int suboffset = 0); template - void DoSlowWrite(void (*safeFunc)(T val, u32 addr), const Gen::OpArg src, int suboffset = 0) { + void DoSlowWrite(void (*safeFunc)(T val, u32 addr), const Gen::OpArg& src, int suboffset = 0) { DoSlowWrite((const void *)safeFunc, src, suboffset); } diff --git a/Core/MIPS/x86/RegCache.cpp b/Core/MIPS/x86/RegCache.cpp index 933bbb276..31b4fc492 100644 --- a/Core/MIPS/x86/RegCache.cpp +++ b/Core/MIPS/x86/RegCache.cpp @@ -396,7 +396,7 @@ void GPRRegCache::GetState(GPRRegCacheState &state) const { memcpy(state.xregs, xregs, sizeof(xregs)); } -void GPRRegCache::RestoreState(const GPRRegCacheState state) { +void GPRRegCache::RestoreState(const GPRRegCacheState& state) { memcpy(regs, state.regs, sizeof(regs)); memcpy(xregs, state.xregs, sizeof(xregs)); } diff --git a/Core/MIPS/x86/RegCache.h b/Core/MIPS/x86/RegCache.h index c63d129fd..e13f257ae 100644 --- a/Core/MIPS/x86/RegCache.h +++ b/Core/MIPS/x86/RegCache.h @@ -112,7 +112,7 @@ public: u32 GetImm(MIPSGPReg preg) const; void GetState(GPRRegCacheState &state) const; - void RestoreState(const GPRRegCacheState state); + void RestoreState(const GPRRegCacheState& state); MIPSState *mips; diff --git a/Core/MIPS/x86/RegCacheFPU.cpp b/Core/MIPS/x86/RegCacheFPU.cpp index c3aa9e20d..648a63b13 100644 --- a/Core/MIPS/x86/RegCacheFPU.cpp +++ b/Core/MIPS/x86/RegCacheFPU.cpp @@ -1066,7 +1066,7 @@ void FPURegCache::GetState(FPURegCacheState &state) const { memcpy(state.xregs, xregs, sizeof(xregs)); } -void FPURegCache::RestoreState(const FPURegCacheState state) { +void FPURegCache::RestoreState(const FPURegCacheState& state) { memcpy(regs, state.regs, sizeof(regs)); memcpy(xregs, state.xregs, sizeof(xregs)); pendingFlush = true; diff --git a/Core/MIPS/x86/RegCacheFPU.h b/Core/MIPS/x86/RegCacheFPU.h index 6c4847394..9d6ad0d91 100644 --- a/Core/MIPS/x86/RegCacheFPU.h +++ b/Core/MIPS/x86/RegCacheFPU.h @@ -206,7 +206,7 @@ public: void SimpleRegV(const u8 v, int flags); void GetState(FPURegCacheState &state) const; - void RestoreState(const FPURegCacheState state); + void RestoreState(const FPURegCacheState& state); MIPSState *mips; diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 6dbac1777..16b7ee583 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -480,7 +480,7 @@ Opcode Read_Opcode_JIT(u32 address) // WARNING! No checks! // We assume that _Address is cached -void Write_Opcode_JIT(const u32 _Address, const Opcode _Value) +void Write_Opcode_JIT(const u32 _Address, const Opcode& _Value) { Memory::WriteUnchecked_U32(_Value.encoding, _Address); } diff --git a/Core/MemMap.h b/Core/MemMap.h index 7af28ab06..2064bdaa9 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -141,7 +141,7 @@ MemoryInitedLock Lock(); // used by JIT to read instructions. Does not resolve replacements. Opcode Read_Opcode_JIT(const u32 _Address); // used by JIT. Reads in the "Locked cache" mode -void Write_Opcode_JIT(const u32 _Address, const Opcode _Value); +void Write_Opcode_JIT(const u32 _Address, const Opcode& _Value); // Should be used by analyzers, disassemblers etc. Does resolve replacements. Opcode Read_Instruction(const u32 _Address, bool resolveReplacements = false); diff --git a/GPU/Common/SplineCommon.cpp b/GPU/Common/SplineCommon.cpp index 4884fc716..f118930a6 100644 --- a/GPU/Common/SplineCommon.cpp +++ b/GPU/Common/SplineCommon.cpp @@ -121,13 +121,13 @@ inline float bern2deriv(float x) { return 3 * (2 - 3 * x) * x; } inline float bern3deriv(float x) { return 3 * x * x; } // http://en.wikipedia.org/wiki/Bernstein_polynomial -static Vec3Packedf Bernstein3D(const Vec3Packedf p0, const Vec3Packedf p1, const Vec3Packedf p2, const Vec3Packedf p3, float x) { +static Vec3Packedf Bernstein3D(const Vec3Packedf& p0, const Vec3Packedf& p1, const Vec3Packedf& p2, const Vec3Packedf& p3, float x) { if (x == 0) return p0; else if (x == 1) return p3; return p0 * bern0(x) + p1 * bern1(x) + p2 * bern2(x) + p3 * bern3(x); } -static Vec3Packedf Bernstein3DDerivative(const Vec3Packedf p0, const Vec3Packedf p1, const Vec3Packedf p2, const Vec3Packedf p3, float x) { +static Vec3Packedf Bernstein3DDerivative(const Vec3Packedf& p0, const Vec3Packedf& p1, const Vec3Packedf& p2, const Vec3Packedf& p3, float x) { return p0 * bern0deriv(x) + p1 * bern1deriv(x) + p2 * bern2deriv(x) + p3 * bern3deriv(x); } diff --git a/headless/Compare.cpp b/headless/Compare.cpp index 4fc954a20..330a0bd73 100644 --- a/headless/Compare.cpp +++ b/headless/Compare.cpp @@ -322,7 +322,7 @@ std::vector TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32 return data; } -double CompareScreenshot(const std::vector &pixels, u32 stride, u32 w, u32 h, const std::string screenshotFilename, std::string &error) +double CompareScreenshot(const std::vector &pixels, u32 stride, u32 w, u32 h, const std::string& screenshotFilename, std::string &error) { if (pixels.size() < stride * h) { diff --git a/headless/Compare.h b/headless/Compare.h index e77c80a7f..4e054ce41 100644 --- a/headless/Compare.h +++ b/headless/Compare.h @@ -32,4 +32,4 @@ std::string GetTestName(const std::string &bootFilename); bool CompareOutput(const std::string &bootFilename, const std::string &output, bool verbose); std::vector TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32 stride, u32 h); -double CompareScreenshot(const std::vector &pixels, u32 stride, u32 w, u32 h, const std::string screenshotFilename, std::string &error); \ No newline at end of file +double CompareScreenshot(const std::vector &pixels, u32 stride, u32 w, u32 h, const std::string& screenshotFilename, std::string &error); \ No newline at end of file