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 #include #include +#include #include #include #include @@ -210,8 +211,9 @@ public: static_assert(std::is_trivially_copyable(), "Given array does not consist of trivially copyable objects"); - if (!IsOpen()) - return -1; + if (!IsOpen()) { + return std::numeric_limits::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(), "Given array does not consist of trivially copyable objects"); - if (!IsOpen()) - return -1; + if (!IsOpen()) { + return std::numeric_limits::max(); + } + return std::fwrite(data, sizeof(T), length, m_file); }