forked from len0rd/rockbox
For the git migration we want a nice clean repository with UNIX line endings. git does not use svn:eol-style, we just need the file contents to be sane. Sorry everybody. I know this messes up blame. Scumbag *NIX developer says migrating to git will make line ending issues go away; commits giant change to svn which changes line endings anyway. :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30924 a1c6a512-1295-4272-9138-f99709370657
16 lines
335 B
C
16 lines
335 B
C
|
|
/* Memory buffer reader, simulates file read
|
|
@ gama
|
|
*/
|
|
|
|
#include "mbreader.h"
|
|
|
|
int mbread(struct mbreader_t *md, void *buf, size_t n)
|
|
{
|
|
if (!md) return -1;
|
|
size_t read_bytes = (md->offset+n) > md->size ?
|
|
md->size-md->offset : n;
|
|
memcpy(buf,md->ptr + md->offset,read_bytes);
|
|
md->offset += read_bytes;
|
|
return read_bytes;
|
|
}
|