wrong timing and offset for buffer shifting in reading

This commit is contained in:
Yuichi Nishiwaki 2014-01-16 19:52:42 +09:00
parent 9aef0cdac0
commit 2ff0a5061b
1 changed files with 1 additions and 1 deletions

View File

@ -185,8 +185,8 @@ pic_fread(void *ptr, size_t block, size_t nitems, pic_file *file)
avail = file->c - file->s; avail = file->c - file->s;
if (size <= avail) { if (size <= avail) {
memcpy(dst, file->s, size); memcpy(dst, file->s, size);
memmove(file->s, file->s + size, avail - size);
file->c -= size; file->c -= size;
memmove(file->s, file->c, avail - size);
break; break;
} }
else { else {