mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
(memory_stream.c) Cleanup
This commit is contained in:
parent
b5f7ccab22
commit
eccda8c39a
@ -100,14 +100,21 @@ size_t memstream_write(memstream_t *stream, const void *data, size_t bytes)
|
||||
int memstream_seek(memstream_t *stream, int offset, int whence)
|
||||
{
|
||||
size_t ptr;
|
||||
if (whence == SEEK_SET)
|
||||
ptr = offset;
|
||||
else if (whence == SEEK_CUR)
|
||||
ptr = stream->m_ptr + offset;
|
||||
else if (whence == SEEK_END)
|
||||
ptr = stream->m_size + offset;
|
||||
else
|
||||
return -1;
|
||||
|
||||
switch (whence)
|
||||
{
|
||||
case SEEK_SET:
|
||||
ptr = offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
ptr = stream->m_ptr + offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
ptr = stream->m_size + offset;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ptr <= stream->m_size)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user