Fixed a couple of warnings on MacOS.

This commit is contained in:
Alexandre Julliard 2006-01-23 16:48:26 +01:00
parent 9daaab54c7
commit 53496f83e7
2 changed files with 12 additions and 9 deletions

View File

@ -140,6 +140,9 @@ static int try_mmap_fixed (void *addr, size_t len, int prot, int flags,
#elif defined(__APPLE__)
#include <mach/mach_init.h>
#include <mach/vm_map.h>
/*
* 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 */

View File

@ -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 );
}