From eb4bf8dea7f161621eb0ece14dd8eeed9fcaeaa3 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 11 Jan 2024 17:59:58 +0000 Subject: [PATCH] Compiler warnings: Unused variables --- ...data_g1second_order_general_extended_packing.cc | 5 +++-- src/grib_accessor_class_data_g2secondary_bitmap.cc | 4 ++-- src/grib_accessor_class_data_sh_packed.cc | 9 +++++---- src/grib_accessor_class_smart_table.cc | 7 ++++--- src/grib_handle.cc | 14 ++++++++------ tools/grib_get_data.cc | 3 --- tools/grib_to_netcdf.cc | 2 -- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc b/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc index e8dc5b1bb..4bc5a7900 100644 --- a/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc +++ b/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc @@ -359,7 +359,8 @@ static int unpack(grib_accessor* a, double* dvalues, float* fvalues, size_t* len double reference_value; long binary_scale_factor; long decimal_scale_factor; - long j, count = 0; + long j; + // long count = 0; long *groupWidths = NULL, *groupLengths = NULL; long orderOfSPD = 0; long* SPD = 0; @@ -456,7 +457,7 @@ static int unpack(grib_accessor* a, double* dvalues, float* fvalues, size_t* len &X[n]); for (j = 0; j < groupLengths[i]; j++) { X[n] += firstOrderValues[i]; - count++; + // count++; n++; } diff --git a/src/grib_accessor_class_data_g2secondary_bitmap.cc b/src/grib_accessor_class_data_g2secondary_bitmap.cc index 7511b78cf..cceb3d765 100644 --- a/src/grib_accessor_class_data_g2secondary_bitmap.cc +++ b/src/grib_accessor_class_data_g2secondary_bitmap.cc @@ -126,7 +126,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) long primary_len = 0, secondary_len = 0; double* primary_bitmap = NULL; double* secondary_bitmap = NULL; - long i = 0, j = 0, on = 0, k = 0, m = 0; + long i = 0, j = 0, k = 0, m = 0; double missing_value = 0, present_value = 0; long expand_by = 0; @@ -177,7 +177,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) primary_bitmap[k++] = present_value; for (j = 0; j < expand_by; j++) secondary_bitmap[m++] = val[i + j]; - on++; + //on++; } } diff --git a/src/grib_accessor_class_data_sh_packed.cc b/src/grib_accessor_class_data_sh_packed.cc index a02d60275..25687d262 100644 --- a/src/grib_accessor_class_data_sh_packed.cc +++ b/src/grib_accessor_class_data_sh_packed.cc @@ -204,7 +204,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) size_t i = 0; int ret = GRIB_SUCCESS; - long hcount = 0, lcount = 0, hpos = 0, lup = 0, mmax = 0, n_vals = 0; + // long lup = 0; + long hcount = 0, lcount = 0, hpos = 0, mmax = 0, n_vals = 0; double* scals = NULL; /* double *pscals=NULL; */ @@ -330,12 +331,12 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) i = 0; while (maxv > 0) { - lup = mmax; + // lup = mmax; if (sub_k >= 0) { for (hcount = 0; hcount < sub_k + 1; hcount++) { decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); - lup++; + // lup++; } sub_k--; } @@ -352,7 +353,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) reference_value); if (mmax == 0) val[i - 1] = 0; - lup++; + // lup++; } maxv--; diff --git a/src/grib_accessor_class_smart_table.cc b/src/grib_accessor_class_smart_table.cc index 61b5d49e3..dd6cfcd41 100644 --- a/src/grib_accessor_class_smart_table.cc +++ b/src/grib_accessor_class_smart_table.cc @@ -284,7 +284,8 @@ static int grib_load_smart_table(grib_context* c, const char* filename, { char line[1024] = {0,}; FILE* f = NULL; - int lineNumber, numberOfColumns, code; + // int lineNumber; + int numberOfColumns, code; grib_context_log(c, GRIB_LOG_DEBUG, "Loading code table from %s", filename); @@ -313,14 +314,14 @@ static int grib_load_smart_table(grib_context* c, const char* filename, t->recomposed_name[2] = grib_context_strdup_persistent(c, recomposed_name); } - lineNumber = 0; + // lineNumber = 0; while (fgets(line, sizeof(line) - 1, f)) { char* s = line; char* p; line[strlen(line) - 1] = 0; - ++lineNumber; + // ++lineNumber; while (*s != '\0' && isspace(*s)) s++; diff --git a/src/grib_handle.cc b/src/grib_handle.cc index f476ab9f2..e2dd6ec7c 100644 --- a/src/grib_handle.cc +++ b/src/grib_handle.cc @@ -597,7 +597,8 @@ static grib_handle* grib_handle_new_multi(grib_context* c, unsigned char** data, long edition = 0; size_t seclen = 0; unsigned char* secbegin = 0; - int secnum = 0, seccount = 0; + int secnum = 0; + // int seccount = 0; int err = 0, i = 0; grib_multi_support* gm = NULL; @@ -631,9 +632,9 @@ static grib_handle* grib_handle_new_multi(grib_context* c, unsigned char** data, secbegin = gm->sections[gm->section_number]; seclen = gm->sections_length[gm->section_number]; secnum = gm->section_number; - seccount = 0; + // seccount = 0; while (grib2_get_next_section((unsigned char*)message, olen, &secbegin, &seclen, &secnum, &err)) { - seccount++; + // seccount++; /*printf(" - %d - section %d length=%d\n",(int)seccount,(int)secnum,(int)seclen);*/ gm->sections[secnum] = secbegin; @@ -716,7 +717,8 @@ static grib_handle* grib_handle_new_from_file_multi(grib_context* c, FILE* f, in long edition = 0; size_t seclen = 0; unsigned char* secbegin = 0; - int secnum = 0, seccount = 0; + int secnum = 0; + // int seccount = 0; int err = 0, i = 0; grib_multi_support* gm = NULL; off_t gts_header_offset = 0; @@ -784,9 +786,9 @@ static grib_handle* grib_handle_new_from_file_multi(grib_context* c, FILE* f, in secbegin = gm->sections[gm->section_number]; seclen = gm->sections_length[gm->section_number]; secnum = gm->section_number; - seccount = 0; + // seccount = 0; while (grib2_get_next_section((unsigned char*)data, olen, &secbegin, &seclen, &secnum, &err)) { - seccount++; + // seccount++; /*printf(" - %d - section %d length=%d\n",(int)seccount,(int)secnum,(int)seclen);*/ gm->sections[secnum] = secbegin; diff --git a/tools/grib_get_data.cc b/tools/grib_get_data.cc index 54185ac61..814664ef0 100644 --- a/tools/grib_get_data.cc +++ b/tools/grib_get_data.cc @@ -92,7 +92,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) long* bitmap = NULL; /* bitmap array */ size_t bmp_len = 0; double *data_values = 0, *lats = 0, *lons = 0; - int n = 0; size_t size = 0, num_bytes = 0; long hasMissingValues = 0; @@ -239,7 +238,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) if (print_keys) print_key_values(values, options->print_keys_count); fprintf(dump_file, "\n"); - n++; } } else if (skip_missing == 1) { @@ -259,7 +257,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) if (print_keys) print_key_values(values, options->print_keys_count); fprintf(dump_file, "\n"); - n++; } } } diff --git a/tools/grib_to_netcdf.cc b/tools/grib_to_netcdf.cc index b46145123..47c9e8335 100644 --- a/tools/grib_to_netcdf.cc +++ b/tools/grib_to_netcdf.cc @@ -1607,7 +1607,6 @@ static void cube_indexes( int i = 0; int index = 0; int n = 1; - int ok = 0; if (size < c) { grib_context_log(ctx, GRIB_LOG_ERROR, "Internal error in cube_indexes. size=%d < axis=%d", size, c); @@ -1649,7 +1648,6 @@ static void cube_indexes( if (h->compare ? h->compare[i](w, v) : (w == v)) { index += j * n; n *= dims; - ok++; ((hypercube*)h)->index_cache[i] = j; break; }