Fix 'implicit conversion from size_t to int changes value' clang warning
authorIvan Maidanski <ivmai@mail.ru>
Wed, 14 Feb 2018 08:58:07 +0000 (11:58 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 14 Feb 2018 09:39:03 +0000 (12:39 +0300)
(fix of commit 9468065)

* misc.c (GC_get_size_map_at): Replace (size_t)(signed_word)-1 to
GC_SIZE_MAX.
* tests/test.c [!GC_GET_HEAP_USAGE_NOT_NEEDED] (check_heap_stats):
Replace (size_t)(GC_signed_word)-1 to -1.

misc.c
tests/test.c

diff --git a/misc.c b/misc.c
index 9ff518a..0245b59 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -497,7 +497,7 @@ GC_API size_t GC_CALL GC_get_total_bytes(void)
 GC_API size_t GC_CALL GC_get_size_map_at(int i)
 {
   if ((unsigned)i > MAXOBJBYTES)
-    return (size_t)(signed_word)-1;
+    return GC_SIZE_MAX;
   return GRANULES_TO_BYTES(GC_size_map[i]);
 }
 
index 4092701..1240180 100644 (file)
@@ -1737,7 +1737,7 @@ void check_heap_stats(void)
           (void)GC_get_prof_stats_unsafe(&stats, sizeof(stats));
 #       endif
       }
-      (void)GC_get_size_map_at((size_t)(GC_signed_word)-1);
+      (void)GC_get_size_map_at(-1);
       (void)GC_get_size_map_at(1);
 #   endif