From 22593cddcc1aa27135ada8fefe264c01dabc7762 Mon Sep 17 00:00:00 2001 From: Chin Date: Wed, 24 Dec 2014 22:20:21 -0500 Subject: [PATCH] Use pre-increment instead of post-increment for iterators, and use auto for some iterators --- Core/CwCheat.cpp | 3 ++- Core/ELF/ParamSFO.cpp | 4 ++-- Core/HLE/sceAtrac.cpp | 2 +- Core/HLE/sceKernelMbx.cpp | 2 +- Core/HLE/sceKernelThread.cpp | 4 ++-- Core/HLE/sceMpeg.cpp | 4 ++-- Core/HLE/sceNetAdhoc.cpp | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Core/CwCheat.cpp b/Core/CwCheat.cpp index 63b6954d1..991e857c4 100644 --- a/Core/CwCheat.cpp +++ b/Core/CwCheat.cpp @@ -131,7 +131,8 @@ 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 +// 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) { std::string currentcode; std::vector finalList; char split_char = '\n'; diff --git a/Core/ELF/ParamSFO.cpp b/Core/ELF/ParamSFO.cpp index 542101a23..4c2b65fa9 100644 --- a/Core/ELF/ParamSFO.cpp +++ b/Core/ELF/ParamSFO.cpp @@ -176,7 +176,7 @@ bool ParamSFOData::WriteSFO(u8 **paramsfo, size_t *size) total_size += sizeof(Header); // Get size info - for (std::map::iterator it = values.begin(); it != values.end(); it++) + for (auto it = values.begin(); it != values.end(); ++it) { key_size += it->first.size()+1; data_size += it->second.max_size; @@ -205,7 +205,7 @@ bool ParamSFOData::WriteSFO(u8 **paramsfo, size_t *size) u8* key_ptr = data + header.key_table_start; u8* data_ptr = data + header.data_table_start; - for (std::map::iterator it = values.begin(); it != values.end(); it++) + for (auto it = values.begin(); it != values.end(); ++it) { u16 offset = (u16)(key_ptr - (data+header.key_table_start)); index_ptr->key_table_offset = offset; diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index 19dcd6416..4875a0606 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -2148,7 +2148,7 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo if (avret < 0) { ERROR_LOG(ME, "swr_convert: Error while converting %d", avret); } - break; + break; } } } diff --git a/Core/HLE/sceKernelMbx.cpp b/Core/HLE/sceKernelMbx.cpp index 9b72de4c5..c90d19dd4 100644 --- a/Core/HLE/sceKernelMbx.cpp +++ b/Core/HLE/sceKernelMbx.cpp @@ -71,7 +71,7 @@ struct Mbx : public KernelObject bool inserted = false; if (nmb.attr & SCE_KERNEL_MBA_THPRI) { - for (std::vector::iterator it = waitingThreads.begin(); it != waitingThreads.end(); it++) + for (auto it = waitingThreads.begin(); it != waitingThreads.end(); ++it) { if (__KernelGetThreadPrio(id) < __KernelGetThreadPrio(it->threadID)) { diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index d95b0dd85..e7675c28c 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -3608,7 +3608,7 @@ bool __KernelCheckCallbacks() { bool processed = false; u32 error; - for (std::vector::iterator iter = threadqueue.begin(); iter != threadqueue.end(); iter++) { + for (auto iter = threadqueue.begin(); iter != threadqueue.end(); ++iter) { Thread *thread = kernelObjects.Get(*iter, error); if (thread && __KernelCheckThreadCallbacks(thread, false)) { processed = true; @@ -3690,7 +3690,7 @@ std::vector GetThreadsInfo() std::vector threadList; u32 error; - for (std::vector::iterator iter = threadqueue.begin(); iter != threadqueue.end(); iter++) + for (auto iter = threadqueue.begin(); iter != threadqueue.end(); ++iter) { Thread *t = kernelObjects.Get(*iter, error); if (!t) diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 43ceee7b4..cbb655398 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -740,7 +740,7 @@ static void SaveFrame(AVFrame *pFrame, int width, int height) // check the existence of pmp media context static bool isContextExist(u32 ctxAddr){ - for (std::list::iterator it = pmp_ContextList.begin(); it != pmp_ContextList.end(); it++){ + for (auto it = pmp_ContextList.begin(); it != pmp_ContextList.end(); ++it){ if (*it == ctxAddr){ return true; } @@ -1016,7 +1016,7 @@ void __VideoPmpInit() { void __VideoPmpShutdown() { #ifdef USE_FFMPEG // We need to empty pmp_queue to not leak memory. - for (std::list::iterator it = pmp_queue.begin(); it != pmp_queue.end(); it++){ + for (auto it = pmp_queue.begin(); it != pmp_queue.end(); ++it){ av_free(*it); } pmp_queue.clear(); diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index d2f056e7e..abf53ff78 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -1000,7 +1000,7 @@ static u32 sceNetAdhocctlAddHandler(u32 handlerPtr, u32 handlerArg) { handler.entryPoint = handlerPtr; handler.argument = handlerArg; - for (std::map::iterator it = adhocctlHandlers.begin(); it != adhocctlHandlers.end(); it++) { + for (auto it = adhocctlHandlers.begin(); it != adhocctlHandlers.end(); ++it) { if (it->second.entryPoint == handlerPtr) { foundHandler = true; break;