From cd23a2ecaff7d5675dcb4399bff1e6f837e7b9a4 Mon Sep 17 00:00:00 2001 From: luxsie Date: Fri, 10 Apr 2015 19:29:45 +0800 Subject: [PATCH] CppCheck: About assert side-effect and remove_if that i don't know enough.. --- rpcs3/Emu/Cell/PPULLVMRecompiler.cpp | 4 +++- rpcs3/Emu/FS/vfsStreamMemory.cpp | 1 + rpcs3/Emu/SysCalls/Modules/cellDmux.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/Cell/PPULLVMRecompiler.cpp b/rpcs3/Emu/Cell/PPULLVMRecompiler.cpp index a42007c0cf..38a7184167 100644 --- a/rpcs3/Emu/Cell/PPULLVMRecompiler.cpp +++ b/rpcs3/Emu/Cell/PPULLVMRecompiler.cpp @@ -5820,7 +5820,9 @@ void RecompilationEngine::ProcessExecutionTrace(const ExecutionTrace & execution } } } - + // TODO:: Syphurith: It is said that just remove_if would cause some troubles.. I don't know if that would cause Memleak. From CppCheck: + // The return value of std::remove_if() is ignored. This function returns an iterator to the end of the range containing those elements that should be kept. + // Elements past new end remain valid but with unspecified values. Use the erase method of the container to delete them. std::remove_if(processed_execution_trace_i->second.begin(), processed_execution_trace_i->second.end(), [](const BlockEntry * b)->bool { return b->is_compiled; }); } diff --git a/rpcs3/Emu/FS/vfsStreamMemory.cpp b/rpcs3/Emu/FS/vfsStreamMemory.cpp index 5ce30c3a7c..2f3283318f 100644 --- a/rpcs3/Emu/FS/vfsStreamMemory.cpp +++ b/rpcs3/Emu/FS/vfsStreamMemory.cpp @@ -38,6 +38,7 @@ u64 vfsStreamMemory::Write(const void* src, u64 size) u64 vfsStreamMemory::Read(void* dst, u64 size) { + // TODO:: Syphurith: Should us do anything? Since Asserts aren't included in Release builds. assert(Tell() < GetSize()); if (Tell() + size > GetSize()) { diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp index b949c5534e..ace09d923d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp @@ -148,7 +148,7 @@ void ElementaryStream::push_au(u32 size, u64 dts, u64 pts, u64 userdata, bool ra u32 addr; { std::lock_guard lock(m_mutex); - + // TODO:: Syphurith: Should us convert this to a if statement? Since Asserts aren't included in Release builds. assert(!is_full(size)); if (put + size + 128 > memAddr + memSize)