Fixed memcpy in case a smaller function table is provided. Improved readability of the SET_CLIPPING_RECT op block.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27315 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2008-09-04 08:22:00 +00:00
parent 537d081817
commit c8ffdabb35

View File

@ -159,10 +159,10 @@ PicturePlayer::Play(void **callBackTable, int32 tableEntries, void *userData)
if ((uint32)tableEntries < kOpsTableSize) {
#if DEBUG
fprintf(file, "A smaller than needed function table was supplied.\n");
fprintf(file, "PicturePlayer: A smaller than needed function table was supplied.\n");
#endif
functionTable = dummyTable;
memcpy(functionTable, callBackTable, (kOpsTableSize - tableEntries) * sizeof(void *));
memcpy(functionTable, callBackTable, tableEntries * sizeof(void *));
}
const char *data = reinterpret_cast<const char *>(fData);
@ -352,9 +352,10 @@ PicturePlayer::Play(void **callBackTable, int32 tableEntries, void *userData)
case B_PIC_SET_CLIPPING_RECTS:
{
// TODO: Not sure if it's compatible with R5's BPicture version
((fnc_PBRecti)functionTable[20])(userData,
reinterpret_cast<const BRect *>(data + sizeof(uint32)),
*reinterpret_cast<const uint32 *>(data));
const uint32 numRects = *reinterpret_cast<const uint32 *>(data);
const BRect *rects = reinterpret_cast<const BRect *>(data + sizeof(uint32));
((fnc_PBRecti)functionTable[20])(userData, rects, numRects);
break;
}