aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-03 15:02:22 +0800
committercrupest <crupest@outlook.com>2022-02-03 15:02:22 +0800
commitf90fd5b7732a4aaeeb42e5587a7081856efb51aa (patch)
tree3a72d66ba493df562d9aea42b8d048de2afabd60 /src
parentd15172cfe1ac8558567c1b1c10c2e671b0d1f033 (diff)
downloadcru-f90fd5b7732a4aaeeb42e5587a7081856efb51aa.tar.gz
cru-f90fd5b7732a4aaeeb42e5587a7081856efb51aa.tar.bz2
cru-f90fd5b7732a4aaeeb42e5587a7081856efb51aa.zip
...
Diffstat (limited to 'src')
-rw-r--r--src/common/platform/unix/UnixFileStream.cpp14
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() {