mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 12:04:16 +01:00
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:
commit
22c0575cf4
@ -8,6 +8,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -183,7 +184,7 @@ public:
|
|||||||
|
|
||||||
if (!IsOpen()) {
|
if (!IsOpen()) {
|
||||||
m_good = false;
|
m_good = false;
|
||||||
return -1;
|
return std::numeric_limits<size_t>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t items_read = std::fread(data, sizeof(T), length, m_file);
|
size_t items_read = std::fread(data, sizeof(T), length, m_file);
|
||||||
@ -204,7 +205,7 @@ public:
|
|||||||
|
|
||||||
if (!IsOpen()) {
|
if (!IsOpen()) {
|
||||||
m_good = false;
|
m_good = false;
|
||||||
return -1;
|
return std::numeric_limits<size_t>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t items_written = std::fwrite(data, sizeof(T), length, m_file);
|
size_t items_written = std::fwrite(data, sizeof(T), length, m_file);
|
||||||
|
Loading…
Reference in New Issue
Block a user