Merge pull request #4061 from zhaowenlan1779/port-yuzu-967

Port "file_util: Avoid sign-conversions in WriteArray() and ReadArray()" from yuzu
This commit is contained in:
James Rowe 2018-08-09 09:40:26 -06:00 committed by GitHub
commit 22c0575cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#include <cstdio>
#include <fstream>
#include <functional>
#include <limits>
#include <string>
#include <type_traits>
#include <vector>
@ -183,7 +184,7 @@ public:
if (!IsOpen()) {
m_good = false;
return -1;
return std::numeric_limits<size_t>::max();
}
size_t items_read = std::fread(data, sizeof(T), length, m_file);
@ -204,7 +205,7 @@ public:
if (!IsOpen()) {
m_good = false;
return -1;
return std::numeric_limits<size_t>::max();
}
size_t items_written = std::fwrite(data, sizeof(T), length, m_file);