From c8ffdabb3586223daa2ec1522c97e6534c645cad Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 4 Sep 2008 08:22:00 +0000 Subject: [PATCH] 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 --- src/kits/interface/PicturePlayer.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/kits/interface/PicturePlayer.cpp b/src/kits/interface/PicturePlayer.cpp index 6bf55b2a02..0237429907 100644 --- a/src/kits/interface/PicturePlayer.cpp +++ b/src/kits/interface/PicturePlayer.cpp @@ -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(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(data + sizeof(uint32)), - *reinterpret_cast(data)); + const uint32 numRects = *reinterpret_cast(data); + const BRect *rects = reinterpret_cast(data + sizeof(uint32)); + ((fnc_PBRecti)functionTable[20])(userData, rects, numRects); + break; }