On Wed, Dec 05, 2012 at 11:06:48PM +0800, Dmitry Timoshkov wrote:
Andrew Eikum aeikum@codeweavers.com wrote:
- br = sndPlaySoundA((LPCSTR)SND_ALIAS_SYSTEMASTERISK, SND_ALIAS_ID|SND_SYNC);
- ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
This kind of test is broken.
Care to elaborate? Being this terse helps no one.
What is this code testing the return value for? Why are there all these casts?
The call is only supposed to return TRUE or FALSE, so I guess it's checking that the return value isn't 3 or something. Not very useful, sure, but it looked odd to just have a series of sndPlaySound calls in a row without ok() calls. The real test is to make sure sndPlaySound doesn't crash, as it does without my patch.
The casts are to avoid compilation warnings. sndPlaySound takes a string as its first parameter, but it also accepts symbols like SND_ALIAS_SYSTEMASTERISK, which has the value 0x2A53. A cast is needed to avoid the warning about converting an integer to a pointer.
Andrew