summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-08-07 19:47:14 +0200
committerLioncash <mathew1800@gmail.com>2018-08-07 19:51:37 +0200
commit0735a0c8a11e62bbe0c7bed52c7c8a9a861b5ce4 (patch)
tree5224ed7992e75c4f1b7c4b37caccff58029c3bb4 /src/common
parentMerge pull request #952 from lioncash/usb (diff)
downloadyuzu-0735a0c8a11e62bbe0c7bed52c7c8a9a861b5ce4.tar
yuzu-0735a0c8a11e62bbe0c7bed52c7c8a9a861b5ce4.tar.gz
yuzu-0735a0c8a11e62bbe0c7bed52c7c8a9a861b5ce4.tar.bz2
yuzu-0735a0c8a11e62bbe0c7bed52c7c8a9a861b5ce4.tar.lz
yuzu-0735a0c8a11e62bbe0c7bed52c7c8a9a861b5ce4.tar.xz
yuzu-0735a0c8a11e62bbe0c7bed52c7c8a9a861b5ce4.tar.zst
yuzu-0735a0c8a11e62bbe0c7bed52c7c8a9a861b5ce4.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/file_util.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 28697d527..430dac41c 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -8,6 +8,7 @@
#include <cstdio>
#include <fstream>
#include <functional>
+#include <limits>
#include <string>
#include <string_view>
#include <type_traits>
@@ -210,8 +211,9 @@ public:
static_assert(std::is_trivially_copyable<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);
}
@@ -220,8 +222,10 @@ public:
size_t WriteArray(const T* data, size_t length) {
static_assert(std::is_trivially_copyable<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);
}