Alexandre Julliard : Fixed a couple of warnings on MacOS.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jan 23 10:35:18 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 53496f83e71f10f07a38b66984805b805d2ba003
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=53496f83e71f10f07a38b66984805b805d2ba003

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan 23 16:48:26 2006 +0100

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 335e148..2e16073 100644
--- a/libs/wine/mmap.c
+++ b/libs/wine/mmap.c
@@ -140,6 +140,9 @@ static int try_mmap_fixed (void *addr, s
 
 #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, s
 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 b87dd88..5debc0a 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -176,8 +176,8 @@ static void timer_dump( struct object *o
 {
     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 );
 }




More information about the wine-cvs mailing list