Commit 21942001 authored by Jean-Paul Saman's avatar Jean-Paul Saman

audio_output/amem.c: win32 semaphore fixes.

Make sure the proper object handle is given to windows semaphore primitives.
parent 40cebf0a
...@@ -152,7 +152,7 @@ static void ExitSharedMem(aout_instance_t *); ...@@ -152,7 +152,7 @@ static void ExitSharedMem(aout_instance_t *);
static void amem_sem_init(vlc_sem_t *sem, unsigned value) static void amem_sem_init(vlc_sem_t *sem, unsigned value)
{ {
#if defined(_WIN32_WINNT) || defined(WIN32) #if defined(_WIN32_WINNT) || defined(WIN32)
sem = CreateSemaphore(NULL /*LPSECURITY_ATTRIBUTES*/, 1, 1, NULL); sem = (vlc_sem_t *) CreateSemaphore(NULL /*LPSECURITY_ATTRIBUTES*/, 1, 1, NULL);
if (sem == NULL) if (sem == NULL)
abort(); abort();
#else #else
...@@ -168,7 +168,7 @@ static int amem_sem_trywait(vlc_sem_t *sem) ...@@ -168,7 +168,7 @@ static int amem_sem_trywait(vlc_sem_t *sem)
do do
{ {
#if defined(_WIN32_WINNT) || defined(WIN32) #if defined(_WIN32_WINNT) || defined(WIN32)
DWORD wait = WaitForSingleObject(sem, 0L); DWORD wait = WaitForSingleObject((HANDLE) *sem, 0L);
switch(wait) switch(wait)
{ {
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
...@@ -197,7 +197,7 @@ static int amem_sem_trywait(vlc_sem_t *sem) ...@@ -197,7 +197,7 @@ static int amem_sem_trywait(vlc_sem_t *sem)
static void amem_sem_wait(vlc_sem_t *sem) static void amem_sem_wait(vlc_sem_t *sem)
{ {
#if defined(_WIN32_WINNT) || defined(WIN32) #if defined(_WIN32_WINNT) || defined(WIN32)
DWORD wait = WaitForSingleObject(sem, 0L); DWORD wait = WaitForSingleObject((HANDLE) *sem, 0L);
assert(wait == WAIT_OBJECT_0); assert(wait == WAIT_OBJECT_0);
#else #else
vlc_sem_wait(sem); vlc_sem_wait(sem);
...@@ -207,7 +207,7 @@ static void amem_sem_wait(vlc_sem_t *sem) ...@@ -207,7 +207,7 @@ static void amem_sem_wait(vlc_sem_t *sem)
static void amem_sem_post(vlc_sem_t *sem) static void amem_sem_post(vlc_sem_t *sem)
{ {
#if defined(_WIN32_WINNT) || defined(WIN32) #if defined(_WIN32_WINNT) || defined(WIN32)
BOOL ret = ReleaseSemaphore(sem, 1, NULL); BOOL ret = ReleaseSemaphore((HANDLE) *sem, 1, NULL);
#else #else
int ret = vlc_sem_post(sem); int ret = vlc_sem_post(sem);
#endif #endif
...@@ -217,7 +217,7 @@ static void amem_sem_post(vlc_sem_t *sem) ...@@ -217,7 +217,7 @@ static void amem_sem_post(vlc_sem_t *sem)
static void amem_sem_destroy(vlc_sem_t *sem) static void amem_sem_destroy(vlc_sem_t *sem)
{ {
#if defined(_WIN32_WINNT) || defined(WIN32) #if defined(_WIN32_WINNT) || defined(WIN32)
BOOL ret = CloseHandle(sem); BOOL ret = CloseHandle((HANDLE) *sem);
assert(ret >= 0); assert(ret >= 0);
#else #else
vlc_sem_destroy(sem); vlc_sem_destroy(sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment