From 53496f83e71f10f07a38b66984805b805d2ba003 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 23 Jan 2006 16:48:26 +0100 Subject: [PATCH] Fixed a couple of warnings on MacOS. --- libs/wine/mmap.c | 17 ++++++++++------- server/timer.c | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c index 335e148970..2e160739e3 100644 --- a/libs/wine/mmap.c +++ b/libs/wine/mmap.c @@ -140,6 +140,9 @@ static int try_mmap_fixed (void *addr, size_t len, int prot, int flags, #elif defined(__APPLE__) +#include +#include + /* * On Darwin, we can use the Mach call vm_allocate to allocate * anonymous memory at the specified address, and then use mmap with @@ -148,15 +151,15 @@ static int try_mmap_fixed (void *addr, size_t len, int prot, int flags, static int try_mmap_fixed (void *addr, size_t len, int prot, int flags, int fildes, off_t off) { - void *result; - result = addr; - if(vm_allocate(mach_task_self(),&result,len,0)) - return 0; - else + vm_address_t result = (vm_address_t)addr; + + if (!vm_allocate(mach_task_self(),&result,len,0)) { - result = mmap( addr, len, prot, flags | MAP_FIXED, fildes, off ); - return result == addr; + if (mmap( (void *)result, len, prot, flags | MAP_FIXED, fildes, off ) != MAP_FAILED) + return 1; + vm_deallocate(mach_task_self(),result,len); } + return 0; } #endif /* (__svr4__ || __NetBSD__) && !MAP_TRYFIXED */ diff --git a/server/timer.c b/server/timer.c index b87dd888f7..5debc0a8e1 100644 --- a/server/timer.c +++ b/server/timer.c @@ -176,8 +176,8 @@ static void timer_dump( struct object *obj, int verbose ) { struct timer *timer = (struct timer *)obj; assert( obj->ops == &timer_ops ); - fprintf( stderr, "Timer manual=%d when=%ld.%06ld period=%d ", - timer->manual, timer->when.tv_sec, timer->when.tv_usec, timer->period ); + fprintf( stderr, "Timer manual=%d when=%ld.%06u period=%d ", + timer->manual, timer->when.tv_sec, (unsigned int)timer->when.tv_usec, timer->period ); dump_object_name( &timer->obj ); fputc( '\n', stderr ); } -- 2.32.0.93.g670b81a890