CppCheck: About assert side-effect and remove_if that i don't know enough..

This commit is contained in:
luxsie 2015-04-10 19:29:45 +08:00
parent d072eba687
commit cd23a2ecaf
3 changed files with 5 additions and 2 deletions

View File

@ -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; });
}

View File

@ -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())
{

View File

@ -148,7 +148,7 @@ void ElementaryStream::push_au(u32 size, u64 dts, u64 pts, u64 userdata, bool ra
u32 addr;
{
std::lock_guard<std::mutex> 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)