From eccda8c39a49ac4f5dbaa8cc3f1b0a57c9ad7836 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 13 Sep 2015 09:45:41 +0200 Subject: [PATCH] (memory_stream.c) Cleanup --- libretro-common/file/memory_stream.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libretro-common/file/memory_stream.c b/libretro-common/file/memory_stream.c index f702027ebb..9e0de2dd3d 100644 --- a/libretro-common/file/memory_stream.c +++ b/libretro-common/file/memory_stream.c @@ -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) {