Cleanup filestream_tell

This commit is contained in:
twinaphex 2016-04-07 04:20:09 +02:00
parent 55a28eb8a3
commit 9b4bb51c2e

View File

@ -308,12 +308,12 @@ ssize_t filestream_tell(RFILE *stream)
if (!stream) if (!stream)
goto error; goto error;
#if defined(VITA) || defined(PSP) #if defined(VITA) || defined(PSP)
return sceIoLseek(stream->fd, 0, SEEK_CUR); if (sceIoLseek(stream->fd, 0, SEEK_CUR) < 0)
goto error;
#elif defined(__CELLOS_LV2__) #elif defined(__CELLOS_LV2__)
uint64_t pos = 0; uint64_t pos = 0;
if (cellFsLseek(stream->fd, 0, CELL_FS_SEEK_CUR, &pos) != CELL_FS_SUCCEEDED) if (cellFsLseek(stream->fd, 0, CELL_FS_SEEK_CUR, &pos) != CELL_FS_SUCCEEDED)
goto error; goto error;
return 0;
#else #else
#if defined(HAVE_BUFFERED_IO) #if defined(HAVE_BUFFERED_IO)
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0) if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
@ -325,9 +325,12 @@ ssize_t filestream_tell(RFILE *stream)
if (stream->mapped && stream->hints & RFILE_HINT_MMAP) if (stream->mapped && stream->hints & RFILE_HINT_MMAP)
return stream->mappos; return stream->mappos;
#endif #endif
return lseek(stream->fd, 0, SEEK_CUR); if (lseek(stream->fd, 0, SEEK_CUR) < 0)
goto error;
#endif #endif
return 0;
error: error:
return -1; return -1;
} }