From 8c2a9414a6517149f7b606091bbd2fcb4adcef05 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 21 Jan 2011 14:51:37 +0100 Subject: [PATCH] ole32: Cleanup return value handling in CoWaitForMultipleHandles. --- dlls/ole32/compobj.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 5dadb18eea7..a637439a27a 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -3646,28 +3646,19 @@ HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout, (dwFlags & COWAIT_ALERTABLE) ? TRUE : FALSE); } - if (res < WAIT_OBJECT_0 + cHandles) - { - /* handle signaled, store index */ - *lpdwindex = (res - WAIT_OBJECT_0); - break; - } - else if (res == WAIT_TIMEOUT) + switch (res) { + case WAIT_TIMEOUT: hr = RPC_S_CALLPENDING; break; - } - else if (res == WAIT_IO_COMPLETION) - { - *lpdwindex = WAIT_IO_COMPLETION; - break; - } - else - { - ERR("Unexpected wait termination: %d, %d\n", res, GetLastError()); - hr = E_UNEXPECTED; + case WAIT_FAILED: + hr = HRESULT_FROM_WIN32( GetLastError() ); + break; + default: + *lpdwindex = res; break; } + break; } TRACE("-- 0x%08x\n", hr); return hr;