dsound/tests: DirectSound3DListener_QueryInterface should accept IKsPropertySet
Joerg-Cyril.Hoehle at t-systems.com
Joerg-Cyril.Hoehle at t-systems.com
Thu Feb 11 03:24:27 CST 2010
Hi,
I don't know how others feel about this pattern:
+ ok(rc==DS_OK && temp_buffer!=NULL, ...
+ if(temp_buffer) IKsPropertySet_Release(temp_buffer);
I'd rather code like this
if (rc==DS_OK && temp_buffer) Release().
The reason is that the typical invariant is
"Any output variable is correctly set if and only
if the called function indicated success on return".
And the corollar:
If it failed, output variables may generally be filled with garbage.
Similarly, access errno only after an I/O function returned failure.
I do not dispute that it is good style for the callee to only set output
variables when returning success. But that is a requirement hard to maintain
in SW and often violated.
E.g. there's a lot of code like:
...
if (some) return ERROR;
*outparam1= xyz;
...
if (more) return ERROR;
...
*outparam2= abc;
...
return SUCCESS;
See how p1 may contain garbage?
Regards,
Jörg Höhle
More information about the wine-devel
mailing list