Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

Merge pull request #966 from lioncash/modernize

bunnei5ae565742147
diff --cc src/common/file_util.h
index 430dac41c4,7f2a5cb639..d0987fb572
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@@ -208,24 -207,21 +208,24 @@@ public
template <typename T>
size_t ReadArray(T* data, size_t length) const {
- static_assert(std::is_trivially_copyable<T>(),
+ static_assert(std::is_trivially_copyable_v<T>,
"Given array does not consist of trivially copyable objects");
- if (!IsOpen())
- return -1;
+ if (!IsOpen()) {
+ return std::numeric_limits<size_t>::max();
+ }
return std::fread(data, sizeof(T), length, m_file);
}
template <typename T>
size_t WriteArray(const T* data, size_t length) {
- static_assert(std::is_trivially_copyable<T>(),
+ static_assert(std::is_trivially_copyable_v<T>,
"Given array does not consist of trivially copyable objects");
- if (!IsOpen())
- return -1;
+ if (!IsOpen()) {
+ return std::numeric_limits<size_t>::max();
+ }
+
return std::fwrite(data, sizeof(T), length, m_file);
}