(libretro-common) Cleanups
This commit is contained in:
parent
dba04c73e4
commit
cce0320bb5
|
@ -263,7 +263,6 @@ ssize_t filestream_seek(RFILE *stream, ssize_t offset, int whence)
|
||||||
#if defined(HAVE_BUFFERED_IO)
|
#if defined(HAVE_BUFFERED_IO)
|
||||||
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
||||||
return fseek(stream->fp, (long)offset, whence);
|
return fseek(stream->fp, (long)offset, whence);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
/* Need to check stream->mapped because this function is
|
/* Need to check stream->mapped because this function is
|
||||||
|
@ -300,12 +299,9 @@ ssize_t filestream_seek(RFILE *stream, ssize_t offset, int whence)
|
||||||
|
|
||||||
return stream->mappos;
|
return stream->mappos;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
ret = lseek(stream->fd, offset, whence);
|
ret = lseek(stream->fd, offset, whence);
|
||||||
return ret < 0 ? -1 : ret;
|
return ret < 0 ? -1 : ret;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,14 +320,12 @@ ssize_t filestream_tell(RFILE *stream)
|
||||||
#if defined(HAVE_BUFFERED_IO)
|
#if defined(HAVE_BUFFERED_IO)
|
||||||
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
||||||
return ftell(stream->fp);
|
return ftell(stream->fp);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
/* Need to check stream->mapped because this function
|
/* Need to check stream->mapped because this function
|
||||||
* is called in filestream_open() */
|
* is called in filestream_open() */
|
||||||
if (stream->mapped && stream->hints & RFILE_HINT_MMAP)
|
if (stream->mapped && stream->hints & RFILE_HINT_MMAP)
|
||||||
return stream->mappos;
|
return stream->mappos;
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
return lseek(stream->fd, 0, SEEK_CUR);
|
return lseek(stream->fd, 0, SEEK_CUR);
|
||||||
#endif
|
#endif
|
||||||
|
@ -357,7 +351,6 @@ ssize_t filestream_read(RFILE *stream, void *s, size_t len)
|
||||||
#if defined(HAVE_BUFFERED_IO)
|
#if defined(HAVE_BUFFERED_IO)
|
||||||
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
||||||
return fread(s, 1, len, stream->fp);
|
return fread(s, 1, len, stream->fp);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
if (stream->hints & RFILE_HINT_MMAP)
|
if (stream->hints & RFILE_HINT_MMAP)
|
||||||
|
@ -373,7 +366,6 @@ ssize_t filestream_read(RFILE *stream, void *s, size_t len)
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
return read(stream->fd, s, len);
|
return read(stream->fd, s, len);
|
||||||
#endif
|
#endif
|
||||||
|
@ -394,12 +386,10 @@ ssize_t filestream_write(RFILE *stream, const void *s, size_t len)
|
||||||
#if defined(HAVE_BUFFERED_IO)
|
#if defined(HAVE_BUFFERED_IO)
|
||||||
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
|
||||||
return fwrite(s, 1, len, stream->fp);
|
return fwrite(s, 1, len, stream->fp);
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
if (stream->hints & RFILE_HINT_MMAP)
|
if (stream->hints & RFILE_HINT_MMAP)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
return write(stream->fd, s, len);
|
return write(stream->fd, s, len);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue