From: Bruno Haible Date: Mon, 19 Dec 2016 23:18:14 +0000 (+0100) Subject: vma-iter: Fix endless loop on 64-bit Windows. X-Git-Tag: v1.0~6448 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=3a0b7b74982f44c735f4cfc2dccf538c3c4ef9e2;p=gnulib.git 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/ChangeLog b/ChangeLog index b6845fea21..5ee3396ea4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-12-19 Bruno Haible + + 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 stdint: Fix WINT_MAX to match the gnulib provided wint_t on minw. diff --git a/lib/vma-iter.c b/lib/vma-iter.c index e309032ab5..4ffe7bdb84 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__