cdvdgigaherz: Fix CreateEvent/CreateThread return value checks

CreateEvent and CreateThread return NULL on failure, not
INVALID_HANDLE_VALUE.

Spotted using Visual Studio Code Analysis Tools (Warning C6387)
This commit is contained in:
Jonathan Li 2016-08-05 00:04:39 +01:00
parent a8286e7458
commit 0477e03965
2 changed files with 7 additions and 7 deletions

View File

@ -172,13 +172,13 @@ DWORD CALLBACK keepAliveThread(PVOID param)
s32 StartKeepAliveThread() s32 StartKeepAliveThread()
{ {
hNotify_keepAlive = CreateEvent(NULL, FALSE, FALSE, NULL); hNotify_keepAlive = CreateEvent(NULL, FALSE, FALSE, NULL);
if (hNotify_keepAlive == INVALID_HANDLE_VALUE) if (hNotify_keepAlive == nullptr)
return -1; return -1;
cdvdKeepAlive_is_open = true; cdvdKeepAlive_is_open = true;
hThread_keepAlive = CreateThread(NULL, 0, keepAliveThread, NULL, 0, &pidThreadKeepAlive); hThread_keepAlive = CreateThread(NULL, 0, keepAliveThread, NULL, 0, &pidThreadKeepAlive);
if (hThread_keepAlive == INVALID_HANDLE_VALUE) { if (hThread_keepAlive == nullptr) {
cdvdKeepAlive_is_open = false; cdvdKeepAlive_is_open = false;
return -1; return -1;
} }

View File

@ -257,17 +257,17 @@ s32 cdvdStartThread()
InitializeCriticalSection( &CacheMutex ); InitializeCriticalSection( &CacheMutex );
hNotify = CreateEvent(NULL,FALSE,FALSE,NULL); hNotify = CreateEvent(NULL,FALSE,FALSE,NULL);
if(hNotify==INVALID_HANDLE_VALUE) if(hNotify == nullptr)
return -1; return -1;
hRequestComplete = CreateEvent(NULL,FALSE,FALSE,NULL); hRequestComplete = CreateEvent(NULL,FALSE,FALSE,NULL);
if(hRequestComplete==INVALID_HANDLE_VALUE) if(hRequestComplete == nullptr)
return -1; return -1;
cdvd_is_open=true; cdvd_is_open=true;
hThread = CreateThread(NULL,0,cdvdThread,NULL,0,&pidThread); hThread = CreateThread(NULL,0,cdvdThread,NULL,0,&pidThread);
if(hThread==INVALID_HANDLE_VALUE) if(hThread == nullptr)
return -1; return -1;
SetThreadPriority(hThread,THREAD_PRIORITY_NORMAL); SetThreadPriority(hThread,THREAD_PRIORITY_NORMAL);