Commit 5ca0b7a2 authored by Max Kellermann's avatar Max Kellermann

fs/io/FileReader: add "noexcept"

parent 21d621e7
......@@ -78,7 +78,7 @@ FileReader::Skip(off_t offset)
}
void
FileReader::Close()
FileReader::Close() noexcept
{
assert(IsDefined());
......@@ -144,7 +144,7 @@ FileReader::Skip(off_t offset)
}
void
FileReader::Close()
FileReader::Close() noexcept
{
assert(IsDefined());
......
......@@ -47,27 +47,27 @@ public:
explicit FileReader(Path _path);
#ifdef _WIN32
FileReader(FileReader &&other)
FileReader(FileReader &&other) noexcept
:path(std::move(other.path)),
handle(other.handle) {
other.handle = INVALID_HANDLE_VALUE;
}
#else
FileReader(FileReader &&other)
FileReader(FileReader &&other) noexcept
:path(std::move(other.path)),
fd(other.fd) {
other.fd.SetUndefined();
}
#endif
~FileReader() {
~FileReader() noexcept {
if (IsDefined())
Close();
}
protected:
bool IsDefined() const {
bool IsDefined() const noexcept {
#ifdef _WIN32
return handle != INVALID_HANDLE_VALUE;
#else
......@@ -77,12 +77,12 @@ protected:
public:
#ifndef _WIN32
FileDescriptor GetFD() const {
FileDescriptor GetFD() const noexcept {
return fd;
}
#endif
void Close();
void Close() noexcept;
FileInfo GetFileInfo() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment