From 2736648f41b0f383a514cde5510d186fde23d933 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 10 Feb 2022 10:54:58 +0000 Subject: [PATCH] Compiler warnings on Windows: C4018 and C4334 --- src/grib_accessor_class_codetable.c | 8 +++----- src/grib_accessor_class_smart_table.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/grib_accessor_class_codetable.c b/src/grib_accessor_class_codetable.c index d5319aa65..e12302b9d 100644 --- a/src/grib_accessor_class_codetable.c +++ b/src/grib_accessor_class_codetable.c @@ -371,7 +371,7 @@ static grib_codetable* load_table(grib_accessor_codetable* self) size = grib_byte_count((grib_accessor*)self) * 8; } - size = (1UL << size); /* 2^size */ + size = (1ULL << size); /* 2^size - 64bits */ t = (grib_codetable*)grib_context_malloc_clear_persistent(c, sizeof(grib_codetable) + (size - 1) * sizeof(code_table_entry)); @@ -783,10 +783,8 @@ static int get_native_type(grib_accessor* a) static int unpack_long(grib_accessor* a, long* val, size_t* len) { grib_accessor_codetable* self = (grib_accessor_codetable*)a; - long rlen = 0; - - unsigned long i = 0; - long pos = a->offset * 8; + long rlen = 0, i = 0; + long pos = a->offset * 8; grib_handle* hand = NULL; #ifdef DEBUG diff --git a/src/grib_accessor_class_smart_table.c b/src/grib_accessor_class_smart_table.c index d43f149dc..769c3e98e 100644 --- a/src/grib_accessor_class_smart_table.c +++ b/src/grib_accessor_class_smart_table.c @@ -281,7 +281,7 @@ static grib_smart_table* load_table(grib_accessor_smart_table* self) next = next->next; } - size = (1UL << self->widthOfCode); /* 2 ^ self->widthOfCode */ + size = (1ULL << self->widthOfCode); /* 2 ^ self->widthOfCode - 64 bits */ t = (grib_smart_table*)grib_context_malloc_clear_persistent(c, sizeof(grib_smart_table)); t->entries = (grib_smart_table_entry*)grib_context_malloc_clear_persistent(c, size * sizeof(grib_smart_table_entry));