diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index 1af38ee3bb..c1b1857cf5 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -434,8 +434,8 @@ int filestream_close(RFILE *stream) munmap(stream->mapped, stream->mapsize); #endif - if (stream->fd > 0) - close(stream->fd); + if (stream->fd > 0) + close(stream->fd); #endif free(stream); diff --git a/libretro-common/streams/memory_stream.c b/libretro-common/streams/memory_stream.c index 9c1d3ce70e..8c4a1718a9 100644 --- a/libretro-common/streams/memory_stream.c +++ b/libretro-common/streams/memory_stream.c @@ -32,9 +32,9 @@ static size_t last_file_size = 0; struct memstream { - uint8_t *m_buf; - size_t m_size; - size_t m_ptr; + uint8_t *buf; + size_t size; + size_t ptr; }; void memstream_set_buffer(uint8_t *buffer, size_t size) @@ -50,9 +50,9 @@ size_t memstream_get_last_size(void) static void memstream_init(memstream_t *stream, uint8_t *buffer, size_t max_size) { - stream->m_buf = buffer; - stream->m_size = max_size; - stream->m_ptr = 0; + stream->buf = buffer; + stream->size = max_size; + stream->ptr = 0; } memstream_t *memstream_open(void) @@ -71,29 +71,29 @@ memstream_t *memstream_open(void) void memstream_close(memstream_t *stream) { - last_file_size = stream->m_ptr; + last_file_size = stream->ptr; free(stream); } size_t memstream_read(memstream_t *stream, void *data, size_t bytes) { - size_t avail = stream->m_size - stream->m_ptr; + size_t avail = stream->size - stream->ptr; if (bytes > avail) bytes = avail; - memcpy(data, stream->m_buf + stream->m_ptr, bytes); - stream->m_ptr += bytes; + memcpy(data, stream->buf + stream->ptr, bytes); + stream->ptr += bytes; return bytes; } size_t memstream_write(memstream_t *stream, const void *data, size_t bytes) { - size_t avail = stream->m_size - stream->m_ptr; + size_t avail = stream->size - stream->ptr; if (bytes > avail) bytes = avail; - memcpy(stream->m_buf + stream->m_ptr, data, bytes); - stream->m_ptr += bytes; + memcpy(stream->buf + stream->ptr, data, bytes); + stream->ptr += bytes; return bytes; } @@ -107,18 +107,18 @@ int memstream_seek(memstream_t *stream, int offset, int whence) ptr = offset; break; case SEEK_CUR: - ptr = stream->m_ptr + offset; + ptr = stream->ptr + offset; break; case SEEK_END: - ptr = stream->m_size + offset; + ptr = stream->size + offset; break; default: return -1; } - if (ptr <= stream->m_size) + if (ptr <= stream->size) { - stream->m_ptr = ptr; + stream->ptr = ptr; return 0; } return -1; @@ -126,7 +126,7 @@ int memstream_seek(memstream_t *stream, int offset, int whence) size_t memstream_pos(memstream_t *stream) { - return stream->m_ptr; + return stream->ptr; } char *memstream_gets(memstream_t *stream, char *buffer, size_t len) @@ -136,7 +136,7 @@ char *memstream_gets(memstream_t *stream, char *buffer, size_t len) int memstream_getc(memstream_t *stream) { - if (stream->m_ptr >= stream->m_size) + if (stream->ptr >= stream->size) return EOF; - return stream->m_buf[stream->m_ptr++]; + return stream->buf[stream->ptr++]; }