Use pre-increment instead of post-increment for iterators, and use auto for some iterators

This commit is contained in:
Chin 2014-12-24 22:20:21 -05:00 committed by Henrik Rydgard
parent 37f50a3792
commit 22593cddcc
7 changed files with 11 additions and 10 deletions

View File

@ -131,7 +131,8 @@ void CWCheatEngine::Exit() {
exit2 = true; exit2 = true;
} }
static inline std::vector<std::string> makeCodeParts(const std::vector<std::string>& 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<std::string> makeCodeParts(const std::vector<std::string>& CodesList) {
std::string currentcode; std::string currentcode;
std::vector<std::string> finalList; std::vector<std::string> finalList;
char split_char = '\n'; char split_char = '\n';

View File

@ -176,7 +176,7 @@ bool ParamSFOData::WriteSFO(u8 **paramsfo, size_t *size)
total_size += sizeof(Header); total_size += sizeof(Header);
// Get size info // Get size info
for (std::map<std::string,ValueData>::iterator it = values.begin(); it != values.end(); it++) for (auto it = values.begin(); it != values.end(); ++it)
{ {
key_size += it->first.size()+1; key_size += it->first.size()+1;
data_size += it->second.max_size; 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* key_ptr = data + header.key_table_start;
u8* data_ptr = data + header.data_table_start; u8* data_ptr = data + header.data_table_start;
for (std::map<std::string,ValueData>::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)); u16 offset = (u16)(key_ptr - (data+header.key_table_start));
index_ptr->key_table_offset = offset; index_ptr->key_table_offset = offset;

View File

@ -2148,7 +2148,7 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo
if (avret < 0) { if (avret < 0) {
ERROR_LOG(ME, "swr_convert: Error while converting %d", avret); ERROR_LOG(ME, "swr_convert: Error while converting %d", avret);
} }
break; break;
} }
} }
} }

View File

@ -71,7 +71,7 @@ struct Mbx : public KernelObject
bool inserted = false; bool inserted = false;
if (nmb.attr & SCE_KERNEL_MBA_THPRI) if (nmb.attr & SCE_KERNEL_MBA_THPRI)
{ {
for (std::vector<MbxWaitingThread>::iterator it = waitingThreads.begin(); it != waitingThreads.end(); it++) for (auto it = waitingThreads.begin(); it != waitingThreads.end(); ++it)
{ {
if (__KernelGetThreadPrio(id) < __KernelGetThreadPrio(it->threadID)) if (__KernelGetThreadPrio(id) < __KernelGetThreadPrio(it->threadID))
{ {

View File

@ -3608,7 +3608,7 @@ bool __KernelCheckCallbacks() {
bool processed = false; bool processed = false;
u32 error; u32 error;
for (std::vector<SceUID>::iterator iter = threadqueue.begin(); iter != threadqueue.end(); iter++) { for (auto iter = threadqueue.begin(); iter != threadqueue.end(); ++iter) {
Thread *thread = kernelObjects.Get<Thread>(*iter, error); Thread *thread = kernelObjects.Get<Thread>(*iter, error);
if (thread && __KernelCheckThreadCallbacks(thread, false)) { if (thread && __KernelCheckThreadCallbacks(thread, false)) {
processed = true; processed = true;
@ -3690,7 +3690,7 @@ std::vector<DebugThreadInfo> GetThreadsInfo()
std::vector<DebugThreadInfo> threadList; std::vector<DebugThreadInfo> threadList;
u32 error; u32 error;
for (std::vector<SceUID>::iterator iter = threadqueue.begin(); iter != threadqueue.end(); iter++) for (auto iter = threadqueue.begin(); iter != threadqueue.end(); ++iter)
{ {
Thread *t = kernelObjects.Get<Thread>(*iter, error); Thread *t = kernelObjects.Get<Thread>(*iter, error);
if (!t) if (!t)

View File

@ -740,7 +740,7 @@ static void SaveFrame(AVFrame *pFrame, int width, int height)
// check the existence of pmp media context // check the existence of pmp media context
static bool isContextExist(u32 ctxAddr){ static bool isContextExist(u32 ctxAddr){
for (std::list<u32>::iterator it = pmp_ContextList.begin(); it != pmp_ContextList.end(); it++){ for (auto it = pmp_ContextList.begin(); it != pmp_ContextList.end(); ++it){
if (*it == ctxAddr){ if (*it == ctxAddr){
return true; return true;
} }
@ -1016,7 +1016,7 @@ void __VideoPmpInit() {
void __VideoPmpShutdown() { void __VideoPmpShutdown() {
#ifdef USE_FFMPEG #ifdef USE_FFMPEG
// We need to empty pmp_queue to not leak memory. // We need to empty pmp_queue to not leak memory.
for (std::list<AVFrame *>::iterator it = pmp_queue.begin(); it != pmp_queue.end(); it++){ for (auto it = pmp_queue.begin(); it != pmp_queue.end(); ++it){
av_free(*it); av_free(*it);
} }
pmp_queue.clear(); pmp_queue.clear();

View File

@ -1000,7 +1000,7 @@ static u32 sceNetAdhocctlAddHandler(u32 handlerPtr, u32 handlerArg) {
handler.entryPoint = handlerPtr; handler.entryPoint = handlerPtr;
handler.argument = handlerArg; handler.argument = handlerArg;
for (std::map<int, AdhocctlHandler>::iterator it = adhocctlHandlers.begin(); it != adhocctlHandlers.end(); it++) { for (auto it = adhocctlHandlers.begin(); it != adhocctlHandlers.end(); ++it) {
if (it->second.entryPoint == handlerPtr) { if (it->second.entryPoint == handlerPtr) {
foundHandler = true; foundHandler = true;
break; break;