From 3eb42e00c7551e7fb2f0f4bad160b15d7c1d6fd1 Mon Sep 17 00:00:00 2001 From: rh101 Date: Mon, 26 Apr 2021 01:37:15 +1000 Subject: [PATCH] Convert return value to what is expected by FileStream::seek --- cocos/platform/CCPosixFileStream.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos/platform/CCPosixFileStream.cpp b/cocos/platform/CCPosixFileStream.cpp index 2b48b89b09..40ded86893 100644 --- a/cocos/platform/CCPosixFileStream.cpp +++ b/cocos/platform/CCPosixFileStream.cpp @@ -151,7 +151,8 @@ int PosixFileStream::close() int PosixFileStream::seek(long offset, int origin) { - return static_cast(_iof->seek(_handle, offset, origin)); + const auto result = _iof->seek(_handle, offset, origin); // this returns -1 for error, and resulting offset on success + return result < 0 ? -1 : 0; // return 0 for success } int PosixFileStream::read(void* buf, unsigned int size)