Re: [PATCH] mmdevapi/tests: Prevent crash when GetMixFormat fails.
Octavian Voicu <octavian.voicu(a)gmail.com> writes:
@@ -190,25 +190,31 @@ static void test_audioclient(IAudioClient *ac) hr = IAudioClient_GetMixFormat(ac, NULL); ok(hr == E_POINTER, "GetMixFormat returns %08x\n", hr);
+ pwfx = (void *)0xdeadbeef; hr = IAudioClient_GetMixFormat(ac, &pwfx); ok(hr == S_OK, "Valid GetMixFormat returns %08x\n", hr);
- trace("Tag: %04x\n", pwfx->wFormatTag); - trace("bits: %u\n", pwfx->wBitsPerSample); - trace("chan: %u\n", pwfx->nChannels); - trace("rate: %u\n", pwfx->nSamplesPerSec); - trace("align: %u\n", pwfx->nBlockAlign); - trace("extra: %u\n", pwfx->cbSize); - ok(pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE, "wFormatTag is %x\n", pwfx->wFormatTag); - if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) + trace("pwfx: %p\n", pwfx); + if (pwfx == (void *)0xdeadbeef) pwfx = NULL; + if (pwfx)
That's ugly, you should check the function result, not a magic pointer value. -- Alexandre Julliard julliard(a)winehq.org
On Thu, Jul 29, 2010 at 6:50 PM, Alexandre Julliard <julliard(a)winehq.org> wrote:
That's ugly, you should check the function result, not a magic pointer value.
I wanted to differentiate between the various cases in which the function can fail, but I guess that's not really required. I'll send another version. What about the second issue (falling back to another device if the default device fails)? Octavian
participants (2)
-
Alexandre Julliard -
Octavian Voicu