From 6c7fd1db481ff10a16ecab958c6542784fa60b9c Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Wed, 30 Oct 2024 09:51:54 -0500 Subject: Use std::byte* instead of void* for allocators. --- source/fud_file.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'source/fud_file.cpp') 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 dirFdOption, - Allocator* allocator) + Option 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 dirFdOption, - Allocator* allocator) + Option 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(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(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; -- cgit v1.2.3