io/FileReader: remove unused method Close()
It's enough to have the destructor.
This commit is contained in:
parent
678828b56f
commit
11c49da871
@ -61,14 +61,6 @@ FileReader::Skip(off_t offset)
|
|||||||
throw MakeLastError("Failed to seek");
|
throw MakeLastError("Failed to seek");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
FileReader::Close() noexcept
|
|
||||||
{
|
|
||||||
assert(IsDefined());
|
|
||||||
|
|
||||||
CloseHandle(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
FileReader::FileReader(Path _path)
|
FileReader::FileReader(Path _path)
|
||||||
@ -123,12 +115,4 @@ FileReader::Skip(off_t offset)
|
|||||||
throw MakeErrno("Failed to seek");
|
throw MakeErrno("Failed to seek");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
FileReader::Close() noexcept
|
|
||||||
{
|
|
||||||
assert(IsDefined());
|
|
||||||
|
|
||||||
fd.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
// SPDX-License-Identifier: BSD-2-Clause
|
// SPDX-License-Identifier: BSD-2-Clause
|
||||||
// author: Max Kellermann <max.kellermann@gmail.com>
|
// author: Max Kellermann <max.kellermann@gmail.com>
|
||||||
|
|
||||||
#ifndef FILE_READER_HXX
|
#pragma once
|
||||||
#define FILE_READER_HXX
|
|
||||||
|
|
||||||
#include "Reader.hxx"
|
#include "Reader.hxx"
|
||||||
#include "fs/AllocatedPath.hxx"
|
#include "fs/AllocatedPath.hxx"
|
||||||
@ -39,8 +38,8 @@ public:
|
|||||||
handle(std::exchange(other.handle, INVALID_HANDLE_VALUE)) {}
|
handle(std::exchange(other.handle, INVALID_HANDLE_VALUE)) {}
|
||||||
|
|
||||||
~FileReader() noexcept {
|
~FileReader() noexcept {
|
||||||
if (IsDefined())
|
if (handle != INVALID_HANDLE_VALUE)
|
||||||
Close();
|
CloseHandle(handle);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
FileReader(FileReader &&other) noexcept
|
FileReader(FileReader &&other) noexcept
|
||||||
@ -65,8 +64,6 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Close() noexcept;
|
|
||||||
|
|
||||||
FileInfo GetFileInfo() const;
|
FileInfo GetFileInfo() const;
|
||||||
|
|
||||||
[[gnu::pure]]
|
[[gnu::pure]]
|
||||||
@ -105,5 +102,3 @@ public:
|
|||||||
/* virtual methods from class Reader */
|
/* virtual methods from class Reader */
|
||||||
std::size_t Read(void *data, std::size_t size) override;
|
std::size_t Read(void *data, std::size_t size) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user