[ddraw] Fix bug 3487 take 2
Peter Berg Larsen
pebl at math.ku.dk
Mon Oct 10 19:46:46 CDT 2005
On Mon, 10 Oct 2005, Lionel Ulmer wrote:
>> I still havent got the grasp of what dwSize is for if it does not reflect
>> the size allocated?, nor the size of the struct current in the mem.
> As the DDSURFACEDESC2 structure starts exactly like the DDSURFACEDESC2 one,
> the hack here is to use 'dwSize' to magically cast one structure to the
> other to be able to share code.
Hmm, then it does reflect the size of the struct currently in the memory.
So in theory it's:
assert(to != from);
DWORD __copysize = MIN((to)->dwSize,(from)->dwSize);
memcpy((to),(from),__copysize);
in practise, because of debug and bug 2070:
assert(to != from);
DWORD __tosize = MIN(sizeof(*(to), ,(to)->dwSize);
DWORD __fromsize = MIN(sizeof(*(from),(from)->dwSize);
DWORD __copysize = MIN(__tosize,__fromsize);
memcpy((to),(from),__copysize);
memset((to)+__copysize,0,__tosize-__copysize);
Or am I still off?
Peter
More information about the wine-devel
mailing list