[common] fix bug in framebuffer_read

This commit is contained in:
Geoffrey McRae 2019-10-09 14:11:45 +11:00
parent 4168cc8d78
commit 8ef1aee35c
2 changed files with 4 additions and 2 deletions

View File

@ -1 +1 @@
B1-7-gbca54ab1f6+1 B1-8-g4168cc8d78+1

View File

@ -31,6 +31,7 @@ struct stFrameBuffer
bool framebuffer_read(const FrameBuffer frame, void * dst, size_t size) bool framebuffer_read(const FrameBuffer frame, void * dst, size_t size)
{ {
uint8_t *d = (uint8_t*)dst;
uint64_t rp = 0; uint64_t rp = 0;
while(rp < size) while(rp < size)
{ {
@ -39,8 +40,9 @@ bool framebuffer_read(const FrameBuffer frame, void * dst, size_t size)
/* copy what we can */ /* copy what we can */
uint64_t avail = frame->wp - rp; uint64_t avail = frame->wp - rp;
memcpy(dst, frame->data + rp, avail); memcpy(d, frame->data + rp, avail);
rp += avail; rp += avail;
d += avail;
} }
return true; return true;
} }