diff options
author | crupest <crupest@outlook.com> | 2022-02-03 17:55:40 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-03 17:55:40 +0800 |
commit | 3c0461b10984eaa156b95a3006f093b1ef2d918b (patch) | |
tree | 1977f3e74ca7078e6c6b2a9bb22c791cccc15dba /src/common | |
parent | 5aca7b099c46a87a859f40110efce708200a4bc8 (diff) | |
parent | f90fd5b7732a4aaeeb42e5587a7081856efb51aa (diff) | |
download | cru-3c0461b10984eaa156b95a3006f093b1ef2d918b.tar.gz cru-3c0461b10984eaa156b95a3006f093b1ef2d918b.tar.bz2 cru-3c0461b10984eaa156b95a3006f093b1ef2d918b.zip |
Merge branch 'dev' of https://github.com/crupest/cru into dev
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/platform/unix/UnixFileStream.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/common/platform/unix/UnixFileStream.cpp b/src/common/platform/unix/UnixFileStream.cpp index bb8d4207..dd883497 100644 --- a/src/common/platform/unix/UnixFileStream.cpp +++ b/src/common/platform/unix/UnixFileStream.cpp @@ -74,21 +74,13 @@ bool UnixFileStream::CanSeek() { return true; } -Index UnixFileStream::Tell() { +Index UnixFileStream::Seek(Index offset, SeekOrigin origin) { CheckClosed(); - auto result = ::lseek(file_descriptor_, 0, SEEK_CUR); - if (result == -1) { - throw ErrnoException(u"Failed to get file position."); - } - return result; -} - -void UnixFileStream::Seek(Index offset, SeekOrigin origin) { - CheckClosed(); - int result = ::lseek(file_descriptor_, offset, MapSeekOrigin(origin)); + off_t result = ::lseek(file_descriptor_, offset, MapSeekOrigin(origin)); if (result == -1) { throw ErrnoException(u"Failed to seek file."); } + return result; } bool UnixFileStream::CanRead() { |