IOS HLE: Replace some loops with range-based loops
This commit is contained in:
parent
36c4dda4ed
commit
13c374b118
|
@ -106,11 +106,8 @@ IPCCommandResult CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress)
|
||||||
|
|
||||||
// Prepare the out buffer(s) with zeros as a safety precaution
|
// Prepare the out buffer(s) with zeros as a safety precaution
|
||||||
// to avoid returning bad values
|
// to avoid returning bad values
|
||||||
for (u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++)
|
for (const auto& buffer : CommandBuffer.PayloadBuffer)
|
||||||
{
|
Memory::Memset(buffer.m_Address, 0, buffer.m_Size);
|
||||||
Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0,
|
|
||||||
CommandBuffer.PayloadBuffer[i].m_Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 ReturnValue = 0;
|
u32 ReturnValue = 0;
|
||||||
switch (CommandBuffer.Parameter)
|
switch (CommandBuffer.Parameter)
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
*/
|
*/
|
||||||
// =============
|
// =============
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
@ -241,22 +242,15 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
|
||||||
|
|
||||||
// Prepare the out buffer(s) with zeroes as a safety precaution
|
// Prepare the out buffer(s) with zeroes as a safety precaution
|
||||||
// to avoid returning bad values
|
// to avoid returning bad values
|
||||||
// XXX: is this still necessary?
|
for (const auto& buffer : Buffer.PayloadBuffer)
|
||||||
for (u32 i = 0; i < Buffer.NumberPayloadBuffer; i++)
|
|
||||||
{
|
{
|
||||||
u32 j;
|
// Don't zero an out buffer which is also one of the in buffers.
|
||||||
for (j = 0; j < Buffer.NumberInBuffer; j++)
|
if (std::any_of(Buffer.InBuffer.begin(), Buffer.InBuffer.end(),
|
||||||
|
[&](const auto& in_buffer) { return in_buffer.m_Address == buffer.m_Address; }))
|
||||||
{
|
{
|
||||||
if (Buffer.InBuffer[j].m_Address == Buffer.PayloadBuffer[i].m_Address)
|
continue;
|
||||||
{
|
|
||||||
// The out buffer is the same as one of the in buffers. Don't zero it.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (j == Buffer.NumberInBuffer)
|
|
||||||
{
|
|
||||||
Memory::Memset(Buffer.PayloadBuffer[i].m_Address, 0, Buffer.PayloadBuffer[i].m_Size);
|
|
||||||
}
|
}
|
||||||
|
Memory::Memset(buffer.m_Address, 0, buffer.m_Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Buffer.Parameter)
|
switch (Buffer.Parameter)
|
||||||
|
|
|
@ -78,11 +78,8 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||||
|
|
||||||
// Prepare the out buffer(s) with zeros as a safety precaution
|
// Prepare the out buffer(s) with zeros as a safety precaution
|
||||||
// to avoid returning bad values
|
// to avoid returning bad values
|
||||||
for (u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++)
|
for (const auto& buffer : CommandBuffer.PayloadBuffer)
|
||||||
{
|
Memory::Memset(buffer.m_Address, 0, buffer.m_Size);
|
||||||
Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0,
|
|
||||||
CommandBuffer.PayloadBuffer[i].m_Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (CommandBuffer.Parameter)
|
switch (CommandBuffer.Parameter)
|
||||||
{
|
{
|
||||||
|
|
|
@ -245,11 +245,8 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress)
|
||||||
|
|
||||||
// Prepare the out buffer(s) with zeros as a safety precaution
|
// Prepare the out buffer(s) with zeros as a safety precaution
|
||||||
// to avoid returning bad values
|
// to avoid returning bad values
|
||||||
for (u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++)
|
for (const auto& buffer : CommandBuffer.PayloadBuffer)
|
||||||
{
|
Memory::Memset(buffer.m_Address, 0, buffer.m_Size);
|
||||||
Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0,
|
|
||||||
CommandBuffer.PayloadBuffer[i].m_Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 ReturnValue = 0;
|
u32 ReturnValue = 0;
|
||||||
switch (CommandBuffer.Parameter)
|
switch (CommandBuffer.Parameter)
|
||||||
|
|
Loading…
Reference in New Issue