bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

vma-iter: port to 64-bit Windows


From: Bruno Haible
Subject: vma-iter: port to 64-bit Windows
Date: Tue, 20 Dec 2016 00:20:15 +0100
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

On 64-bit Windows, the vma_iterate runs into an endless loop.
Seen in the 'test-dprintf-posix2.sh' test. This fixes it.


2016-12-19  Bruno Haible  <address@hidden>

        vma-iter: Fix endless loop on 64-bit Windows.
        * lib/vma-iter.c (vma_iterate): On Windows, use 'uintptr_t' instead of
        'unsigned long'.

diff --git a/lib/vma-iter.c b/lib/vma-iter.c
index e309032..4ffe7bd 100644
--- a/lib/vma-iter.c
+++ b/lib/vma-iter.c
@@ -424,7 +424,7 @@ vma_iterate (vma_iterate_callback_fn callback, void *data)
   /* Windows platform.  Use the native Windows API.  */
 
   MEMORY_BASIC_INFORMATION info;
-  unsigned long address = 0;
+  uintptr_t address = 0;
 
   while (VirtualQuery ((void*)address, &info, sizeof(info)) == sizeof(info))
     {
@@ -435,10 +435,10 @@ vma_iterate (vma_iterate_callback_fn callback, void *data)
            distinguished from areas reserved for future malloc().  */
         if (info.State != MEM_RESERVE)
           {
-            unsigned long start, end;
+            uintptr_t start, end;
             unsigned int flags;
 
-            start = (unsigned long)info.BaseAddress;
+            start = (uintptr_t)info.BaseAddress;
             end = start + info.RegionSize;
             switch (info.Protect & ~(PAGE_GUARD|PAGE_NOCACHE))
               {
@@ -468,7 +468,7 @@ vma_iterate (vma_iterate_callback_fn callback, void *data)
             if (callback (data, start, end, flags))
               break;
           }
-      address = (unsigned long)info.BaseAddress + info.RegionSize;
+      address = (uintptr_t)info.BaseAddress + info.RegionSize;
     }
 
 #elif defined __BEOS__ || defined __HAIKU__




reply via email to

[Prev in Thread] Current Thread [Next in Thread]