Commit d7641074 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Make user handles ints instead of pointers.

parent ad4605fc
......@@ -16,7 +16,7 @@
#include <winbase.h>
typedef unsigned int obj_handle_t;
typedef void *user_handle_t;
typedef unsigned int user_handle_t;
typedef unsigned short atom_t;
typedef unsigned int process_id_t;
typedef unsigned int thread_id_t;
......
......@@ -76,7 +76,7 @@ static void clipboard_dump( struct object *obj, int verbose )
{
struct clipboard *clipboard = (struct clipboard *)obj;
fprintf( stderr, "Clipboard open_thread=%p open_win=%p owner_thread=%p owner_win=%p viewer=%p seq=%u\n",
fprintf( stderr, "Clipboard open_thread=%p open_win=%08x owner_thread=%p owner_win=%08x viewer=%08x seq=%u\n",
clipboard->open_thread, clipboard->open_win, clipboard->owner_thread,
clipboard->owner_win, clipboard->viewer, clipboard->seqno );
}
......
......@@ -32,7 +32,7 @@
#include <winbase.h>
typedef unsigned int obj_handle_t;
typedef void *user_handle_t;
typedef unsigned int user_handle_t;
typedef unsigned short atom_t;
typedef unsigned int process_id_t;
typedef unsigned int thread_id_t;
......
......@@ -709,7 +709,7 @@ static int get_quit_message( struct msg_queue *queue, unsigned int flags,
{
reply->total = 0;
reply->type = MSG_POSTED;
reply->win = NULL;
reply->win = 0;
reply->msg = WM_QUIT;
reply->wparam = queue->exit_code;
reply->lparam = 0;
......@@ -889,7 +889,7 @@ static void msg_queue_poll_event( struct fd *fd, int event )
static void thread_input_dump( struct object *obj, int verbose )
{
struct thread_input *input = (struct thread_input *)obj;
fprintf( stderr, "Thread input focus=%p capture=%p active=%p\n",
fprintf( stderr, "Thread input focus=%08x capture=%08x active=%08x\n",
input->focus, input->capture, input->active );
}
......@@ -1545,7 +1545,7 @@ void post_win_event( struct thread *thread, unsigned int event,
msg->data_size = sizeof(*data) + module_size;
if (debug_level > 1)
fprintf( stderr, "post_win_event: tid %04x event %04x win %p object_id %d child_id %d\n",
fprintf( stderr, "post_win_event: tid %04x event %04x win %08x object_id %d child_id %d\n",
get_thread_id(thread), event, win, object_id, child_id );
list_add_tail( &thread->queue->msg_list[SEND_MESSAGE], &msg->entry );
set_queue_bits( thread->queue, QS_SENDMESSAGE );
......@@ -1950,7 +1950,7 @@ DECL_HANDLER(set_win_timer)
{
queue = get_current_queue();
/* look for a timer with this id */
if (id && (timer = find_timer( queue, NULL, req->msg, id )))
if (id && (timer = find_timer( queue, 0, req->msg, id )))
{
/* free and reuse id */
free_timer( queue, timer );
......
......@@ -272,7 +272,7 @@ static void sock_wake_up( struct sock *sock, int pollev )
}
if (sock->window)
{
if (debug_level) fprintf(stderr, "signalling events %x win %p\n", events, sock->window );
if (debug_level) fprintf(stderr, "signalling events %x win %08x\n", events, sock->window );
for (i = 0; i < FD_MAX_EVENTS; i++)
{
int event = event_bitorder[i];
......
......@@ -36,10 +36,10 @@ static int allocated_handles;
static struct user_handle *handle_to_entry( user_handle_t handle )
{
unsigned short generation;
int index = (((unsigned long)handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
int index = ((handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
if (index < 0 || index >= nb_handles) return NULL;
if (!handles[index].type) return NULL;
generation = (unsigned long)handle >> 16;
generation = handle >> 16;
if (generation == handles[index].generation || !generation || generation == 0xffff)
return &handles[index];
return NULL;
......@@ -47,8 +47,8 @@ static struct user_handle *handle_to_entry( user_handle_t handle )
static inline user_handle_t entry_to_handle( struct user_handle *ptr )
{
int index = ptr - handles;
return (user_handle_t)((((unsigned long)index << 1) + FIRST_USER_HANDLE) + (ptr->generation << 16));
unsigned int index = ptr - handles;
return (index << 1) + FIRST_USER_HANDLE + (ptr->generation << 16);
}
static inline struct user_handle *alloc_user_entry(void)
......@@ -113,7 +113,7 @@ user_handle_t get_user_full_handle( user_handle_t handle )
{
struct user_handle *entry;
if ((unsigned long)handle >> 16) return handle;
if (handle >> 16) return handle;
if (!(entry = handle_to_entry( handle ))) return handle;
return entry_to_handle( entry );
}
......@@ -149,7 +149,7 @@ void *next_user_handle( user_handle_t *handle, enum user_object type )
if (!*handle) entry = handles;
else
{
int index = (((unsigned long)*handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
int index = ((*handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
if (index < 0 || index >= nb_handles) return NULL;
entry = handles + index + 1; /* start from the next one */
}
......
......@@ -2031,7 +2031,7 @@ DECL_HANDLER(set_window_pos)
if (!(flags & SWP_NOZORDER))
{
switch ((int)(unsigned long)req->previous)
switch ((int)req->previous)
{
case 0: /* HWND_TOP */
previous = WINPTR_TOP;
......
......@@ -35,7 +35,7 @@ my %formats =
"data_size_t" => "%u",
"obj_handle_t" => "%04x",
"atom_t" => "%04x",
"user_handle_t" => "%p",
"user_handle_t" => "%08x",
"process_id_t" => "%04x",
"thread_id_t" => "%04x",
"timeout_t" => "&dump_timeout",
......
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