]> Savannah Git Hosting - gnulib.git/commitdiff
vma-iter: Fix endless loop on 64-bit Windows.
authorBruno Haible <bruno@clisp.org>
Mon, 19 Dec 2016 23:18:14 +0000 (00:18 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 19 Dec 2016 23:18:14 +0000 (00:18 +0100)
* lib/vma-iter.c (vma_iterate): On Windows, use 'uintptr_t' instead of
'unsigned long'.

ChangeLog
lib/vma-iter.c

index b6845fea213512298589b5c88c2181c76368a6e0..5ee3396ea4e2f5a11a9f003f9e9ab93e81d6210c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-12-19  Bruno Haible  <bruno@clisp.org>
+
+       vma-iter: Fix endless loop on 64-bit Windows.
+       * lib/vma-iter.c (vma_iterate): On Windows, use 'uintptr_t' instead of
+       'unsigned long'.
+
 2016-12-19  Bruno Haible  <bruno@clisp.org>
 
        stdint: Fix WINT_MAX to match the gnulib provided wint_t on minw.
index e309032ab5276f5cb11310214d9ee549aaeee76b..4ffe7bdb843757f00bd196f4a31885846b38a3bb 100644 (file)
@@ -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__