summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2023-12-11 12:21:02 +0100
committerGravatar Nikias Bassen2023-12-11 12:21:02 +0100
commit6096480407bcb8e6e74389f8a6780c1056a0aaf3 (patch)
tree1043e0ce950b69af8467d7f084cf0d120888a763
parente314faac7850ebe9076b7cf5807f87ae6bd122fa (diff)
downloadlibimobiledevice-glue-6096480407bcb8e6e74389f8a6780c1056a0aaf3.tar.gz
libimobiledevice-glue-6096480407bcb8e6e74389f8a6780c1056a0aaf3.tar.bz2
win32: Remove windows.h from public headers
-rw-r--r--include/libimobiledevice-glue/thread.h7
-rw-r--r--include/libimobiledevice-glue/utils.h4
-rw-r--r--src/thread.c13
3 files changed, 12 insertions, 12 deletions
diff --git a/include/libimobiledevice-glue/thread.h b/include/libimobiledevice-glue/thread.h
index 2aadc6e..a960410 100644
--- a/include/libimobiledevice-glue/thread.h
+++ b/include/libimobiledevice-glue/thread.h
@@ -25,14 +25,15 @@
#include <stddef.h>
#ifdef WIN32
-#include <windows.h>
+typedef void* HANDLE;
typedef HANDLE THREAD_T;
-typedef CRITICAL_SECTION mutex_t;
+struct _RTL_CRITICAL_SECTION;
+typedef struct _RTL_CRITICAL_SECTION mutex_t;
typedef struct {
HANDLE sem;
} cond_t;
typedef volatile struct {
- LONG lock;
+ long lock;
int state;
} thread_once_t;
#define THREAD_ONCE_INIT {0, 0}
diff --git a/include/libimobiledevice-glue/utils.h b/include/libimobiledevice-glue/utils.h
index 1a21871..f7f60f2 100644
--- a/include/libimobiledevice-glue/utils.h
+++ b/include/libimobiledevice-glue/utils.h
@@ -29,10 +29,6 @@
#include <config.h>
#endif
-#ifdef WIN32
-#include <windows.h>
-#endif
-
#include <stdio.h>
#include <stdint.h>
diff --git a/src/thread.c b/src/thread.c
index 6efacec..e2c3b63 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -22,13 +22,16 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#ifdef WIN32
+#include <windows.h>
+#endif
#include "common.h"
#include "libimobiledevice-glue/thread.h"
LIBIMOBILEDEVICE_GLUE_API int thread_new(THREAD_T *thread, thread_func_t thread_func, void* data)
{
#ifdef WIN32
- HANDLE th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)thread_func, data, 0, NULL);
+ HANDLE th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)(void*)thread_func, data, 0, NULL);
if (th == NULL) {
return -1;
}
@@ -93,7 +96,7 @@ LIBIMOBILEDEVICE_GLUE_API int thread_cancel(THREAD_T thread)
LIBIMOBILEDEVICE_GLUE_API void mutex_init(mutex_t* mutex)
{
#ifdef WIN32
- InitializeCriticalSection(mutex);
+ InitializeCriticalSection((LPCRITICAL_SECTION)mutex);
#else
pthread_mutex_init(mutex, NULL);
#endif
@@ -102,7 +105,7 @@ LIBIMOBILEDEVICE_GLUE_API void mutex_init(mutex_t* mutex)
LIBIMOBILEDEVICE_GLUE_API void mutex_destroy(mutex_t* mutex)
{
#ifdef WIN32
- DeleteCriticalSection(mutex);
+ DeleteCriticalSection((LPCRITICAL_SECTION)mutex);
#else
pthread_mutex_destroy(mutex);
#endif
@@ -111,7 +114,7 @@ LIBIMOBILEDEVICE_GLUE_API void mutex_destroy(mutex_t* mutex)
LIBIMOBILEDEVICE_GLUE_API void mutex_lock(mutex_t* mutex)
{
#ifdef WIN32
- EnterCriticalSection(mutex);
+ EnterCriticalSection((LPCRITICAL_SECTION)mutex);
#else
pthread_mutex_lock(mutex);
#endif
@@ -120,7 +123,7 @@ LIBIMOBILEDEVICE_GLUE_API void mutex_lock(mutex_t* mutex)
LIBIMOBILEDEVICE_GLUE_API void mutex_unlock(mutex_t* mutex)
{
#ifdef WIN32
- LeaveCriticalSection(mutex);
+ LeaveCriticalSection((LPCRITICAL_SECTION)mutex);
#else
pthread_mutex_unlock(mutex);
#endif