Compiler warnings: Unused variables

This commit is contained in:
Shahram Najm 2024-01-11 17:59:58 +00:00
parent 52f6530493
commit eb4bf8dea7
7 changed files with 22 additions and 22 deletions

View File

@ -359,7 +359,8 @@ static int unpack(grib_accessor* a, double* dvalues, float* fvalues, size_t* len
double reference_value; double reference_value;
long binary_scale_factor; long binary_scale_factor;
long decimal_scale_factor; long decimal_scale_factor;
long j, count = 0; long j;
// long count = 0;
long *groupWidths = NULL, *groupLengths = NULL; long *groupWidths = NULL, *groupLengths = NULL;
long orderOfSPD = 0; long orderOfSPD = 0;
long* SPD = 0; long* SPD = 0;
@ -456,7 +457,7 @@ static int unpack(grib_accessor* a, double* dvalues, float* fvalues, size_t* len
&X[n]); &X[n]);
for (j = 0; j < groupLengths[i]; j++) { for (j = 0; j < groupLengths[i]; j++) {
X[n] += firstOrderValues[i]; X[n] += firstOrderValues[i];
count++; // count++;
n++; n++;
} }

View File

@ -126,7 +126,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
long primary_len = 0, secondary_len = 0; long primary_len = 0, secondary_len = 0;
double* primary_bitmap = NULL; double* primary_bitmap = NULL;
double* secondary_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; double missing_value = 0, present_value = 0;
long expand_by = 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; primary_bitmap[k++] = present_value;
for (j = 0; j < expand_by; j++) for (j = 0; j < expand_by; j++)
secondary_bitmap[m++] = val[i + j]; secondary_bitmap[m++] = val[i + j];
on++; //on++;
} }
} }

View File

@ -204,7 +204,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
size_t i = 0; size_t i = 0;
int ret = GRIB_SUCCESS; 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* scals = NULL;
/* double *pscals=NULL; */ /* double *pscals=NULL; */
@ -330,12 +331,12 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
i = 0; i = 0;
while (maxv > 0) { while (maxv > 0) {
lup = mmax; // lup = mmax;
if (sub_k >= 0) { if (sub_k >= 0) {
for (hcount = 0; hcount < sub_k + 1; hcount++) { 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));
decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes));
lup++; // lup++;
} }
sub_k--; sub_k--;
} }
@ -352,7 +353,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
reference_value); reference_value);
if (mmax == 0) if (mmax == 0)
val[i - 1] = 0; val[i - 1] = 0;
lup++; // lup++;
} }
maxv--; maxv--;

View File

@ -284,7 +284,8 @@ static int grib_load_smart_table(grib_context* c, const char* filename,
{ {
char line[1024] = {0,}; char line[1024] = {0,};
FILE* f = NULL; 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); 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); t->recomposed_name[2] = grib_context_strdup_persistent(c, recomposed_name);
} }
lineNumber = 0; // lineNumber = 0;
while (fgets(line, sizeof(line) - 1, f)) { while (fgets(line, sizeof(line) - 1, f)) {
char* s = line; char* s = line;
char* p; char* p;
line[strlen(line) - 1] = 0; line[strlen(line) - 1] = 0;
++lineNumber; // ++lineNumber;
while (*s != '\0' && isspace(*s)) while (*s != '\0' && isspace(*s))
s++; s++;

View File

@ -597,7 +597,8 @@ static grib_handle* grib_handle_new_multi(grib_context* c, unsigned char** data,
long edition = 0; long edition = 0;
size_t seclen = 0; size_t seclen = 0;
unsigned char* secbegin = 0; unsigned char* secbegin = 0;
int secnum = 0, seccount = 0; int secnum = 0;
// int seccount = 0;
int err = 0, i = 0; int err = 0, i = 0;
grib_multi_support* gm = NULL; 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]; secbegin = gm->sections[gm->section_number];
seclen = gm->sections_length[gm->section_number]; seclen = gm->sections_length[gm->section_number];
secnum = gm->section_number; secnum = gm->section_number;
seccount = 0; // seccount = 0;
while (grib2_get_next_section((unsigned char*)message, olen, &secbegin, &seclen, &secnum, &err)) { 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);*/ /*printf(" - %d - section %d length=%d\n",(int)seccount,(int)secnum,(int)seclen);*/
gm->sections[secnum] = secbegin; 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; long edition = 0;
size_t seclen = 0; size_t seclen = 0;
unsigned char* secbegin = 0; unsigned char* secbegin = 0;
int secnum = 0, seccount = 0; int secnum = 0;
// int seccount = 0;
int err = 0, i = 0; int err = 0, i = 0;
grib_multi_support* gm = NULL; grib_multi_support* gm = NULL;
off_t gts_header_offset = 0; 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]; secbegin = gm->sections[gm->section_number];
seclen = gm->sections_length[gm->section_number]; seclen = gm->sections_length[gm->section_number];
secnum = gm->section_number; secnum = gm->section_number;
seccount = 0; // seccount = 0;
while (grib2_get_next_section((unsigned char*)data, olen, &secbegin, &seclen, &secnum, &err)) { 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);*/ /*printf(" - %d - section %d length=%d\n",(int)seccount,(int)secnum,(int)seclen);*/
gm->sections[secnum] = secbegin; gm->sections[secnum] = secbegin;

View File

@ -92,7 +92,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
long* bitmap = NULL; /* bitmap array */ long* bitmap = NULL; /* bitmap array */
size_t bmp_len = 0; size_t bmp_len = 0;
double *data_values = 0, *lats = 0, *lons = 0; double *data_values = 0, *lats = 0, *lons = 0;
int n = 0;
size_t size = 0, num_bytes = 0; size_t size = 0, num_bytes = 0;
long hasMissingValues = 0; long hasMissingValues = 0;
@ -239,7 +238,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
if (print_keys) if (print_keys)
print_key_values(values, options->print_keys_count); print_key_values(values, options->print_keys_count);
fprintf(dump_file, "\n"); fprintf(dump_file, "\n");
n++;
} }
} }
else if (skip_missing == 1) { 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) if (print_keys)
print_key_values(values, options->print_keys_count); print_key_values(values, options->print_keys_count);
fprintf(dump_file, "\n"); fprintf(dump_file, "\n");
n++;
} }
} }
} }

View File

@ -1607,7 +1607,6 @@ static void cube_indexes(
int i = 0; int i = 0;
int index = 0; int index = 0;
int n = 1; int n = 1;
int ok = 0;
if (size < c) { if (size < c) {
grib_context_log(ctx, GRIB_LOG_ERROR, "Internal error in cube_indexes. size=%d < axis=%d", 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)) { if (h->compare ? h->compare[i](w, v) : (w == v)) {
index += j * n; index += j * n;
n *= dims; n *= dims;
ok++;
((hypercube*)h)->index_cache[i] = j; ((hypercube*)h)->index_cache[i] = j;
break; break;
} }