ddraw: Assign to structs instead of using memcpy
Andrew.Talbot at talbotville.com
Sat Feb 16 18:38:50 CST 2008
Stefan Dösinger wrote:
> Am Samstag, 16. Februar 2008 23:33:37 schrieb Andrew Talbot:
>> Here, I am assuming that the "dwSize" elements in all these cases should
>> be set to the size of the struct each is in, respectively. Please advise
>> if this assumption is wrong.
> It's not necessarily true. Sometimes there are multiple versions of the
> same structure. You can check ddraw.h and d3dtypes.h. If there is only one
> version your assumption should be true.
> If there isn't, then your assumption may still be true. In that case there
> are some tests how the Setter methods deal with newer or older
> structures(in some cases we may need more tests)
I checked that I wasn't assigning between entities whose types had different
suffixes, such as assigning to a D3DVIEWPORT variable from one of type
D3DVIEWPORT2, for example. (In fact, the only one I had to avoid was the
assignment to a DDSURFACEDESC type variable from a DDSURFACEDESC2 one, in
ddraw/ddraw_thunks.c.) And I presume that if the underlying struct tags are
different between two similar types, then the compiler would warn of type
incompatibility if such an assignment were attempted.
More information about the wine-devel