]> granicus.if.org Git - gc/commitdiff
Add missing type casts in remap and register_my_thread_inner
authorIvan Maidanski <ivmai@mail.ru>
Wed, 20 Jun 2018 08:35:55 +0000 (11:35 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 20 Jun 2018 08:35:55 +0000 (11:35 +0300)
(fix of commit a825a2d)

Issue #206 (bdwgc).

* os_dep.c [USE_MUNMAP && USE_WINALLOC] (GC_remap): Cast result of
VirtualAlloc to ptr_t.
* win32_threads.c [!GC_NO_THREADS_DISCOVERY]
(GC_register_my_thread_inner): Cast the first argument of
InterlockedExchange() call to word* (instead of void*).

os_dep.c
win32_threads.c

index c24d28e30e24753d8cc2e45ef9ffca7ee8c7bee4..3a53195596ba42b282464e41e542bd9df9f15e7b 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -2603,9 +2603,10 @@ GC_INNER void GC_remap(ptr_t start, size_t bytes)
               != sizeof(mem_info))
               ABORT("Weird VirtualQuery result");
           alloc_len = (len < mem_info.RegionSize) ? len : mem_info.RegionSize;
-          result = VirtualAlloc(start_addr, alloc_len, MEM_COMMIT,
-                                GC_pages_executable ? PAGE_EXECUTE_READWRITE :
-                                                      PAGE_READWRITE);
+          result = (ptr_t)VirtualAlloc(start_addr, alloc_len, MEM_COMMIT,
+                                       GC_pages_executable
+                                                ? PAGE_EXECUTE_READWRITE
+                                                : PAGE_READWRITE);
           if (result != start_addr) {
               if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
                   GetLastError() == ERROR_OUTOFMEMORY) {
index 5ff66f225fa9056922c959c86c524bf599a7c038..e0cc09a31fe791be461c62581a223296f45a7f1a 100644 (file)
@@ -417,7 +417,7 @@ STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb,
       /* variants.                                                      */
                   /* cast away volatile qualifier */
       for (i = 0;
-           InterlockedExchange((void*)&dll_thread_table[i].tm.in_use, 1) != 0;
+           InterlockedExchange((word*)&dll_thread_table[i].tm.in_use, 1) != 0;
            i++) {
         /* Compare-and-swap would make this cleaner, but that's not     */
         /* supported before Windows 98 and NT 4.0.  In Windows 2000,    */