]> granicus.if.org Git - gc/commitdiff
Workaround 'checking if unsigned i < 0' cppcheck FP in is_heap_base
authorIvan Maidanski <ivmai@mail.ru>
Thu, 30 May 2019 06:17:54 +0000 (09:17 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 30 May 2019 06:17:54 +0000 (09:17 +0300)
* os_dep.c [MSWIN32 || MSWINCE || CYGWIN32] (GC_is_heap_base): Change
type for i local variable from unsigned to int; cast GC_n_heap_bases to
int.

os_dep.c

index 224c5da870a97b0f2eb2127a666af28f21437a78..27afee1cbea3469370842f7c16e6ad8857a0259e 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -1853,14 +1853,14 @@ void GC_register_data_segments(void)
   /* heap sections?                                             */
   GC_INNER GC_bool GC_is_heap_base(void *p)
   {
-     unsigned i;
+     int i;
 #    ifndef REDIRECT_MALLOC
        if (GC_root_size > GC_max_root_size) GC_max_root_size = GC_root_size;
 #      ifdef USE_WINALLOC
          if (GC_is_malloc_heap_base(p)) return TRUE;
 #      endif
 #    endif
-     for (i = 0; i < GC_n_heap_bases; i++) {
+     for (i = 0; i < (int)GC_n_heap_bases; i++) {
          if (GC_heap_bases[i] == p) return TRUE;
      }
      return FALSE;