diff options
author | crupest <crupest@outlook.com> | 2023-10-05 22:02:25 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2023-10-05 22:02:25 +0800 |
commit | 1550828518ff4719db88f35e088207816866a073 (patch) | |
tree | 217e35f48f6c08152bc607d804ad78c0a292e3cd /src/common/io/CFileStream.cpp | |
parent | 90feae14e708fbb0b313503a6e76cfbd77f94ce1 (diff) | |
download | cru-1550828518ff4719db88f35e088207816866a073.tar.gz cru-1550828518ff4719db88f35e088207816866a073.tar.bz2 cru-1550828518ff4719db88f35e088207816866a073.zip |
...
Diffstat (limited to 'src/common/io/CFileStream.cpp')
-rw-r--r-- | src/common/io/CFileStream.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/io/CFileStream.cpp b/src/common/io/CFileStream.cpp index de195538..29d4819f 100644 --- a/src/common/io/CFileStream.cpp +++ b/src/common/io/CFileStream.cpp @@ -97,6 +97,7 @@ bool CFileStream::CanRead() { Index CFileStream::Read(std::byte* buffer, Index offset, Index size) { CheckClosed(); + StreamOperationNotSupportedException::CheckRead(readable_); auto count = std::fread(buffer + offset, 1, size, file_); return count; } @@ -108,6 +109,7 @@ bool CFileStream::CanWrite() { Index CFileStream::Write(const std::byte* buffer, Index offset, Index size) { CheckClosed(); + StreamOperationNotSupportedException::CheckWrite(writable_); auto count = std::fwrite(buffer + offset, 1, size, file_); return count; } @@ -125,8 +127,6 @@ void CFileStream::Close() { } void CFileStream::CheckClosed() { - if (file_ == nullptr) { - throw StreamAlreadyClosedException(u"File is closed."); - } + StreamAlreadyClosedException::Check(file_ == nullptr); } } // namespace cru::io |