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:
@@ -159,10 +159,10 @@ PicturePlayer::Play(void **callBackTable, int32 tableEntries, void *userData)
|
|||||||
|
|
||||||
if ((uint32)tableEntries < kOpsTableSize) {
|
if ((uint32)tableEntries < kOpsTableSize) {
|
||||||
#if DEBUG
|
#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
|
#endif
|
||||||
functionTable = dummyTable;
|
functionTable = dummyTable;
|
||||||
memcpy(functionTable, callBackTable, (kOpsTableSize - tableEntries) * sizeof(void *));
|
memcpy(functionTable, callBackTable, tableEntries * sizeof(void *));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *data = reinterpret_cast<const char *>(fData);
|
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:
|
case B_PIC_SET_CLIPPING_RECTS:
|
||||||
{
|
{
|
||||||
// TODO: Not sure if it's compatible with R5's BPicture version
|
// TODO: Not sure if it's compatible with R5's BPicture version
|
||||||
((fnc_PBRecti)functionTable[20])(userData,
|
const uint32 numRects = *reinterpret_cast<const uint32 *>(data);
|
||||||
reinterpret_cast<const BRect *>(data + sizeof(uint32)),
|
const BRect *rects = reinterpret_cast<const BRect *>(data + sizeof(uint32));
|
||||||
*reinterpret_cast<const uint32 *>(data));
|
((fnc_PBRecti)functionTable[20])(userData, rects, numRects);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user