eventfd_synchronization: Fix compile warnings.

Why, GCC, did you think this was a good idea?
This commit is contained in:
Elizabeth Figura 2024-08-12 16:55:29 -05:00
parent 761b7f72d0
commit cd2cce28cc

View File

@ -0,0 +1,126 @@
From fed04f8ef69b829fa2cf3c7051160a6f822912dd Mon Sep 17 00:00:00 2001
From: Elizabeth Figura <zfigura@codeweavers.com>
Date: Mon, 12 Aug 2024 16:54:44 -0500
Subject: [PATCH] ntdll: Compile warning fixes for esync.
---
dlls/ntdll/unix/esync.c | 26 +++++++++++++-------------
dlls/ntdll/unix/esync.h | 4 ++--
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c
index f4748e405ef..86809b610c7 100644
--- a/dlls/ntdll/unix/esync.c
+++ b/dlls/ntdll/unix/esync.c
@@ -73,29 +73,29 @@ int do_esync(void)
struct esync
{
- enum esync_type type;
+ LONG type;
int fd;
void *shm;
};
struct semaphore
{
- int max;
- int count;
+ LONG max;
+ LONG count;
};
C_ASSERT(sizeof(struct semaphore) == 8);
struct mutex
{
- DWORD tid;
- int count; /* recursion count */
+ LONG tid;
+ LONG count; /* recursion count */
};
C_ASSERT(sizeof(struct mutex) == 8);
struct event
{
- int signaled;
- int locked;
+ LONG signaled;
+ LONG locked;
};
C_ASSERT(sizeof(struct event) == 8);
@@ -182,7 +182,7 @@ static struct esync *add_to_list( HANDLE handle, enum esync_type type, int fd, v
}
}
- if (!InterlockedCompareExchange( (int *)&esync_list[entry][idx].type, type, 0 ))
+ if (!InterlockedCompareExchange( &esync_list[entry][idx].type, type, 0 ))
{
esync_list[entry][idx].fd = fd;
esync_list[entry][idx].shm = shm;
@@ -206,7 +206,7 @@ static struct esync *get_cached_object( HANDLE handle )
* message queue, etc.) */
static NTSTATUS get_object( HANDLE handle, struct esync **obj )
{
- NTSTATUS ret = STATUS_SUCCESS;
+ int ret = STATUS_SUCCESS;
enum esync_type type = 0;
unsigned int shm_idx = 0;
obj_handle_t fd_handle;
@@ -274,7 +274,7 @@ NTSTATUS esync_close( HANDLE handle )
if (entry < ESYNC_LIST_ENTRIES && esync_list[entry])
{
- if (InterlockedExchange((int *)&esync_list[entry][idx].type, 0))
+ if (InterlockedExchange(&esync_list[entry][idx].type, 0))
{
close( esync_list[entry][idx].fd );
return STATUS_SUCCESS;
@@ -370,7 +370,7 @@ static NTSTATUS open_esync( enum esync_type type, HANDLE *handle,
}
extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
- const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max)
+ const OBJECT_ATTRIBUTES *attr, int initial, int max)
{
TRACE("name %s, initial %d, max %d.\n",
attr ? debugstr_us(attr->ObjectName) : "<no name>", initial, max);
@@ -386,7 +386,7 @@ NTSTATUS esync_open_semaphore( HANDLE *handle, ACCESS_MASK access,
return open_esync( ESYNC_SEMAPHORE, handle, access, attr );
}
-NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev )
+NTSTATUS esync_release_semaphore( HANDLE handle, unsigned int count, ULONG *prev )
{
struct esync *obj;
struct semaphore *semaphore;
@@ -800,7 +800,7 @@ static BOOL update_grabbed_object( struct esync *obj )
/* A value of STATUS_NOT_IMPLEMENTED returned from this function means that we
* need to delegate to server_select(). */
-static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any,
+static NTSTATUS __esync_wait_objects( unsigned int count, const HANDLE *handles, BOOLEAN wait_any,
BOOLEAN alertable, const LARGE_INTEGER *timeout )
{
static const LARGE_INTEGER zero;
diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h
index 59f8809fc1a..9102cf911aa 100644
--- a/dlls/ntdll/unix/esync.h
+++ b/dlls/ntdll/unix/esync.h
@@ -23,11 +23,11 @@ extern void esync_init(void);
extern NTSTATUS esync_close( HANDLE handle );
extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
- const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max);
+ const OBJECT_ATTRIBUTES *attr, int initial, int max);
extern NTSTATUS esync_open_semaphore( HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr );
extern NTSTATUS esync_query_semaphore( HANDLE handle, void *info, ULONG *ret_len );
-extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev );
+extern NTSTATUS esync_release_semaphore( HANDLE handle, unsigned int count, ULONG *prev );
extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial );
--
2.45.2