summaryrefslogtreecommitdiff
path: root/apps/codecs/libgme/inflate/mbreader.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libgme/inflate/mbreader.c')
-rw-r--r--apps/codecs/libgme/inflate/mbreader.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/apps/codecs/libgme/inflate/mbreader.c b/apps/codecs/libgme/inflate/mbreader.c
index 96e45cd6c8..825787927c 100644
--- a/apps/codecs/libgme/inflate/mbreader.c
+++ b/apps/codecs/libgme/inflate/mbreader.c
@@ -1,16 +1,16 @@
1 1
2/* Memory buffer reader, simulates file read 2/* Memory buffer reader, simulates file read
3 @ gama 3 @ gama
4*/ 4*/
5 5
6#include "mbreader.h" 6#include "mbreader.h"
7 7
8int mbread(struct mbreader_t *md, void *buf, size_t n) 8int mbread(struct mbreader_t *md, void *buf, size_t n)
9{ 9{
10 if (!md) return -1; 10 if (!md) return -1;
11 size_t read_bytes = (md->offset+n) > md->size ? 11 size_t read_bytes = (md->offset+n) > md->size ?
12 md->size-md->offset : n; 12 md->size-md->offset : n;
13 memcpy(buf,md->ptr + md->offset,read_bytes); 13 memcpy(buf,md->ptr + md->offset,read_bytes);
14 md->offset += read_bytes; 14 md->offset += read_bytes;
15 return read_bytes; 15 return read_bytes;
16} 16}