[PATCH 4/5] ddraw: Accept all 3 versions of D3DFINDDEVICERESULT

Henri Verbeet hverbeet at gmail.com
Mon Oct 5 03:57:00 CDT 2015


On 5 October 2015 at 09:21, Stefan Dösinger <stefandoesinger at gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Am 2015-10-04 um 19:52 schrieb Andrew D'Addesio:
>> +    /* Write ddHwDesc */
>> +    desc_ptr = (BYTE*)&fdr->ddHwDesc;
>> +    memcpy(desc_ptr, &desc1, desc_size);
>> +    ((D3DDEVICEDESC*)desc_ptr)->dwSize = desc_size;
>> +
>> +    /* Write ddSwDesc */
>> +    desc_ptr += desc_size;
>> +    memcpy(desc_ptr, &desc1, desc_size);
>> +    ((D3DDEVICEDESC*)desc_ptr)->dwSize = desc_size;
> Is there a nicer way? I can't think of one to be honest, but this code
> feels somewhat unsatisfying.
>
One way would be to just declare different versions of the structure
for internal use (i.e., D3DFINDDEVICERESULTv1, etc.), and then pick
the right one based on fdr->dwSize. That would probably simplify a
couple of other things in the patch as well. There are also a couple
of style issues in these patches. Please follow the style of the
surrounding code, or that of wined3d when in doubt.



More information about the wine-devel mailing list