Permalink
Browse files

Fix read/write functions

  • Loading branch information...
1 parent 1fe73c3 commit 3363202653a50595c4892676bf8d9872f23f8ca7 @tmm1 tmm1 committed Dec 21, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 fmemopen.c
View
4 fmemopen.c
@@ -34,7 +34,7 @@ static int readfn(void *handler, char *buf, int size) {
if (size > available) {
size = available;
}
- memcpy(buf, mem->buffer, sizeof(char) * size);
+ memcpy(buf, mem->buffer + mem->pos, sizeof(char) * size);
mem->pos += size;
return size;
@@ -47,7 +47,7 @@ static int writefn(void *handler, const char *buf, int size) {
if (size > available) {
size = available;
}
- memcpy(mem->buffer, buf, sizeof(char) * size);
+ memcpy(mem->buffer + mem->pos, buf, sizeof(char) * size);
mem->pos += size;
return size;

0 comments on commit 3363202

Please sign in to comment.