diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-10-30 09:51:54 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-10-30 09:51:54 -0500 |
commit | 6c7fd1db481ff10a16ecab958c6542784fa60b9c (patch) | |
tree | e0162f930ec44a7c53b07061311d52910c36e481 /source/fud_file.cpp | |
parent | 8dcb1de91e15ff7fc66279cd9cd9ad8a70f624e0 (diff) |
Use std::byte* instead of void* for allocators.
Diffstat (limited to 'source/fud_file.cpp')
-rw-r--r-- | source/fud_file.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/source/fud_file.cpp b/source/fud_file.cpp index 8f84648..94f1f27 100644 --- a/source/fud_file.cpp +++ b/source/fud_file.cpp @@ -30,13 +30,8 @@ FileResult RegularFile::open( StringView filename, FileAccessMode mode, OpenFlags flags, - Option<int> dirFdOption, - Allocator* allocator) + Option<int> dirFdOption) { - if (allocator == nullptr) { - return FileResult::error(FudStatus::NullPointer); - } - if (!filename.nullTerminated()) { return FileResult::error(FudStatus::ArgumentInvalid); } @@ -115,6 +110,8 @@ FileResult RegularFile::open( return FileResult::error(FudStatus::ObjectInvalid); } + file.m_openFlags = flags; + return FileResult::okay(std::move(file)); } @@ -124,13 +121,8 @@ FileResult RegularFile::create( OpenFlags flags, Permissions permissions, bool exclusive, - Option<int> dirFdOption, - Allocator* allocator) + Option<int> dirFdOption) { - if (allocator == nullptr) { - return FileResult::error(FudStatus::NullPointer); - } - if (!filename.nullTerminated()) { return FileResult::error(FudStatus::ArgumentInvalid); } @@ -218,7 +210,7 @@ RegularFile::~RegularFile() static_cast<void>(this->close()); } -RegularFile::RegularFile(RegularFile&& rhs) noexcept : m_fd{rhs.m_fd}, m_modeFlags{rhs.m_modeFlags} +RegularFile::RegularFile(RegularFile&& rhs) noexcept : m_fd{rhs.m_fd}, m_openFlags{rhs.m_openFlags}, m_modeFlags{rhs.m_modeFlags} { rhs.m_fd = -1; } @@ -232,6 +224,7 @@ RegularFile& RegularFile::operator=(RegularFile&& rhs) noexcept static_cast<void>(this->close()); m_fd = rhs.m_fd; + m_openFlags = rhs.m_openFlags; m_modeFlags = rhs.m_modeFlags; rhs.m_fd = -1; @@ -250,6 +243,7 @@ FudStatus RegularFile::take(RegularFile& rhs) } m_fd = rhs.m_fd; + m_openFlags = rhs.m_openFlags; m_modeFlags = rhs.m_modeFlags; rhs.m_fd = -1; |