aboutsummaryrefslogtreecommitdiff
path: root/src/core/file_sys/vfs_offset.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-09-22 17:31:53 -0400
committerLioncash <mathew1800@gmail.com>2020-09-22 17:32:33 -0400
commitff45c3957858cdf189b73e11550da06fe4337b8e (patch)
tree288ff1cc4677d6511ed8cc7e1b0db20ce2d2590f /src/core/file_sys/vfs_offset.cpp
parentc07fd2898b45032b5e4084fc49a19018ad099ba6 (diff)
General: Make use of std::nullopt where applicable
Allows some implementations to avoid completely zeroing out the internal buffer of the optional, and instead only set the validity byte within the structure. This also makes it consistent how we return empty optionals.
Diffstat (limited to 'src/core/file_sys/vfs_offset.cpp')
-rw-r--r--src/core/file_sys/vfs_offset.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/file_sys/vfs_offset.cpp b/src/core/file_sys/vfs_offset.cpp
index c96f88488..7714d3de5 100644
--- a/src/core/file_sys/vfs_offset.cpp
+++ b/src/core/file_sys/vfs_offset.cpp
@@ -58,10 +58,11 @@ std::size_t OffsetVfsFile::Write(const u8* data, std::size_t length, std::size_t
}
std::optional<u8> OffsetVfsFile::ReadByte(std::size_t r_offset) const {
- if (r_offset < size)
- return file->ReadByte(offset + r_offset);
+ if (r_offset >= size) {
+ return std::nullopt;
+ }
- return {};
+ return file->ReadByte(offset + r_offset);
}
std::vector<u8> OffsetVfsFile::ReadBytes(std::size_t r_size, std::size_t r_offset) const {