mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-08 09:09:04 +00:00
Add a hacky check for text file size in ReadFileToString. Fixes issue 6455.
This commit is contained in:
parent
a7e1fb81b1
commit
f0fc611f15
2 changed files with 33 additions and 3 deletions
|
@ -161,11 +161,15 @@ public:
|
|||
bool Close();
|
||||
|
||||
template <typename T>
|
||||
bool ReadArray(T* data, size_t length)
|
||||
bool ReadArray(T* data, size_t length, size_t* pReadBytes = NULL)
|
||||
{
|
||||
if (!IsOpen() || length != std::fread(data, sizeof(T), length, m_file))
|
||||
size_t read_bytes = 0;
|
||||
if (!IsOpen() || length != (read_bytes = std::fread(data, sizeof(T), length, m_file)))
|
||||
m_good = false;
|
||||
|
||||
if (pReadBytes)
|
||||
*pReadBytes = read_bytes;
|
||||
|
||||
return m_good;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue