From 56453a518d11a5d7695fd5341c2c47c967648fb1 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Fri, 17 Mar 2017 22:08:02 +0100 Subject: [PATCH] Fix issue with windows (Use make check CC="i686-w64-mingw32-gcc -std=c99" VALGRIND=wine) --- example/ex06.c | 2 +- m-mutex.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/example/ex06.c b/example/ex06.c index 023d7e85..b9463f6e 100644 --- a/example/ex06.c +++ b/example/ex06.c @@ -28,7 +28,7 @@ int main(void) list_string_get_str (tmpstr, grow, false); // print out - printf("Number of elements = %lu\n", list_string_size(grow)); + printf("Number of elements = %lu\n", (unsigned long) list_string_size(grow)); printf("Final string = %s\n", string_get_cstr(tmpstr)); // Another way to print the list diff --git a/m-mutex.h b/m-mutex.h index f1c77186..036d8ca5 100644 --- a/m-mutex.h +++ b/m-mutex.h @@ -110,7 +110,7 @@ static inline void m_oncei_call(m_oncei_t o, void (*func)(void)) /****************************** WIN32 version ******************************/ -#include +#include typedef HANDLE m_mutex_t[1]; typedef HANDLE m_cond_t[1]; @@ -140,9 +140,9 @@ static inline void m_mutex_unlock(m_mutex_t m) // Internal function, not exported #define M_MUTEXI_INIT_VALUE { NULL } -static inline m_mutexi_lazy_lock (m_mutex_t m) +static inline void m_mutexi_lazy_lock (m_mutex_t m) { - volatile HANDLE *addr = m; + HANDLE *addr = m; if (*addr == NULL) { /* Try to create one, affect it atomicaly and otherwise clears it */ HANDLE h = CreateMutex(NULL, FALSE, NULL); @@ -156,7 +156,7 @@ static inline m_mutexi_lazy_lock (m_mutex_t m) static inline void m_cond_init(m_cond_t c) { - *c = = CreateEvent (NULL, FALSE, FALSE, NULL); + *c = CreateEvent (NULL, FALSE, FALSE, NULL); M_ASSERT_INIT (*c != NULL); } @@ -180,7 +180,7 @@ static inline void m_cond_wait(m_cond_t c, m_mutex_t m) static inline void m_thread_create(m_thread_t t, void (*func)(void*), void *arg) { - *t = CreateThread(NULL, 0, (unsigned int (*)(void*)) func, arg, 0, NULL); + *t = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) func, arg, 0, NULL); M_ASSERT_INIT (*t != NULL); }