Merge pull request #541 from lioncash/sdio
Get rid of a few delete[] calls in WII_IPC_HLE_Device_sdio_slot0.cpp
This commit is contained in:
commit
fb18b8b689
|
@ -2,6 +2,8 @@
|
|||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/SDCardUtil.h"
|
||||
|
||||
|
@ -396,14 +398,14 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
|
|||
if (!m_Card.Seek(req.arg, SEEK_SET))
|
||||
ERROR_LOG(WII_IPC_SD, "Seek failed WTF");
|
||||
|
||||
u8* const buffer = new u8[size];
|
||||
std::vector<u8> buffer(size);
|
||||
|
||||
if (m_Card.ReadBytes(buffer, req.bsize * req.blocks))
|
||||
if (m_Card.ReadBytes(buffer.data(), size))
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
Memory::Write_U8((u8)buffer[i], req.addr++);
|
||||
Memory::Write_U8(buffer[i], req.addr++);
|
||||
}
|
||||
DEBUG_LOG(WII_IPC_SD, "Outbuffer size %i got %i", _rwBufferSize, i);
|
||||
}
|
||||
|
@ -413,8 +415,6 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
|
|||
ferror(m_Card.GetHandle()), feof(m_Card.GetHandle()));
|
||||
ret = RET_FAIL;
|
||||
}
|
||||
|
||||
delete[] buffer;
|
||||
}
|
||||
}
|
||||
Memory::Write_U32(0x900, _BufferOut);
|
||||
|
@ -434,21 +434,19 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
|
|||
if (!m_Card.Seek(req.arg, SEEK_SET))
|
||||
ERROR_LOG(WII_IPC_SD, "fseeko failed WTF");
|
||||
|
||||
u8* buffer = new u8[size];
|
||||
std::vector<u8> buffer(size);
|
||||
|
||||
for (u32 i = 0; i < size; ++i)
|
||||
{
|
||||
buffer[i] = Memory::Read_U8(req.addr++);
|
||||
}
|
||||
|
||||
if (!m_Card.WriteBytes(buffer, req.bsize * req.blocks))
|
||||
if (!m_Card.WriteBytes(buffer.data(), size))
|
||||
{
|
||||
ERROR_LOG(WII_IPC_SD, "Write Failed - error: %i, eof: %i",
|
||||
ferror(m_Card.GetHandle()), feof(m_Card.GetHandle()));
|
||||
ret = RET_FAIL;
|
||||
}
|
||||
|
||||
delete[] buffer;
|
||||
}
|
||||
}
|
||||
Memory::Write_U32(0x900, _BufferOut);
|
||||
|
|
Loading…
Reference in New Issue