diff --git a/src/action_class_section.c b/src/action_class_section.c index cc6ca27a5..5dd474929 100644 --- a/src/action_class_section.c +++ b/src/action_class_section.c @@ -177,7 +177,7 @@ static int notify_change(grib_action* act, grib_accessor* notified, if (err) { if (err == GRIB_NOT_FOUND && strcmp(act->name, "dataValues") == 0) { /* FIXME: Allow this error. Needed when changing some packingTypes e.g. CCSDS to Simple */ - err = GRIB_SUCCESS; + /*err = GRIB_SUCCESS;*/ } else { return err; diff --git a/src/grib_accessor_class_bufr_extract_datetime_subsets.c b/src/grib_accessor_class_bufr_extract_datetime_subsets.c index 500fa3b23..a8dd2ffb0 100644 --- a/src/grib_accessor_class_bufr_extract_datetime_subsets.c +++ b/src/grib_accessor_class_bufr_extract_datetime_subsets.c @@ -330,6 +330,7 @@ static int select_datetime(grib_accessor* a) ret = 0; second[0] = 0; n = 1; + (void)ret; } if (n != numberOfSubsets) { if (n == 1) { diff --git a/src/grib_accessor_class_data_complex_packing.c b/src/grib_accessor_class_data_complex_packing.c index b1c5bc0e9..fade0feb8 100644 --- a/src/grib_accessor_class_data_complex_packing.c +++ b/src/grib_accessor_class_data_complex_packing.c @@ -724,7 +724,6 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) mmax = 0; maxv = pen_j + 1; i = 0; - lcount = 0; hcount = 0; sub_k = sub_j; @@ -804,8 +803,6 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) mmax = 0; maxv = pen_j + 1; - i = 0; - lcount = 0; hcount = 0; sub_k = sub_j; diff --git a/src/grib_accessor_class_data_png_packing.c b/src/grib_accessor_class_data_png_packing.c index 7632bb403..cb7e2d04b 100644 --- a/src/grib_accessor_class_data_png_packing.c +++ b/src/grib_accessor_class_data_png_packing.c @@ -402,10 +402,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) long number_of_data_points; long nn = 0; - self->dirty = 1; - n_vals = 0; err = grib_value_count(a, &nn); n_vals = nn; if (err) @@ -542,8 +540,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) buflen++; } } - /* buflen = n_vals*(bits_per_value/8);*/ - + /* buflen = n_vals*(bits_per_value/8); */ grib_context_log(a->context, GRIB_LOG_DEBUG, "grib_accessor_data_png_packing : pack_double : packing %s, %d values", a->name, n_vals); buf = grib_context_buffer_malloc_clear(a->context, buflen); diff --git a/src/grib_accessor_class_data_sh_packed.c b/src/grib_accessor_class_data_sh_packed.c index 28f3336e4..ba30e1a3c 100644 --- a/src/grib_accessor_class_data_sh_packed.c +++ b/src/grib_accessor_class_data_sh_packed.c @@ -240,7 +240,6 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) long n_vals = 0; double* scals = NULL; /* double *pscals=NULL; */ - double dummy = 0; double s = 0; double d = 0; @@ -375,9 +374,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) lup = mmax; if (sub_k >= 0) { for (hcount = 0; hcount < sub_k + 1; hcount++) { - dummy = decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); - dummy = decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); - (void)dummy; + decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); + decode_float(grib_decode_unsigned_long(hres, &hpos, 8 * bytes)); lup++; } sub_k--; diff --git a/src/grib_accessor_class_data_sh_unpacked.c b/src/grib_accessor_class_data_sh_unpacked.c index 31485bedd..4e669f81f 100644 --- a/src/grib_accessor_class_data_sh_unpacked.c +++ b/src/grib_accessor_class_data_sh_unpacked.c @@ -371,6 +371,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) /* pscals=scals+lup; */ for (lcount = hcount; lcount < maxv; lcount++) { dummy = d * (double)((grib_decode_unsigned_long(lres, &lpos, bits_per_value) * s) + reference_value); + (void)dummy; dummy = d * (double)((grib_decode_unsigned_long(lres, &lpos, bits_per_value) * s) + reference_value); (void)dummy; /* suppress gcc warning */ lup++; diff --git a/src/grib_accessor_class_latitudes.c b/src/grib_accessor_class_latitudes.c index 522a6b262..b9490f63c 100644 --- a/src/grib_accessor_class_latitudes.c +++ b/src/grib_accessor_class_latitudes.c @@ -194,7 +194,6 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) grib_iterator* iter = NULL; self->save = 1; - size = 0; ret = value_count(a, &count); if (ret) return ret; diff --git a/src/grib_dumper_class_bufr_encode_C.c b/src/grib_dumper_class_bufr_encode_C.c index 0409a9334..23fb8bf2b 100644 --- a/src/grib_dumper_class_bufr_encode_C.c +++ b/src/grib_dumper_class_bufr_encode_C.c @@ -173,7 +173,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; double value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; double* values = NULL; int err = 0; int i, r, icount; @@ -187,15 +187,16 @@ static void dump_values(grib_dumper* d, grib_accessor* a) return; grib_value_count(a, &count); - size = count; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size); + err = grib_unpack_double(a, values, &size2); } else { - err = grib_unpack_double(a, &value, &size); + err = grib_unpack_double(a, &value, &size2); } + Assert(size2 == size); self->empty = 0; @@ -280,8 +281,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* return; grib_value_count(a, &count); - size = count; - size2 = size; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); @@ -290,7 +290,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* else { err = grib_unpack_double(a, &value, &size2); } - Assert(size == size2); + Assert(size2 == size); self->empty = 0; @@ -349,7 +349,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_encode_C* self = (grib_dumper_bufr_encode_C*)d; long value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; long* values = NULL; int err = 0; int i, r, icount; @@ -365,7 +365,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) doing_unexpandedDescriptors = (strcmp(a->name, "unexpandedDescriptors") == 0); grib_value_count(a, &count); - size = count; + size = size2 = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { if (self->isLeaf == 0) { @@ -391,11 +391,12 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size); + err = grib_unpack_long(a, values, &size2); } else { - err = grib_unpack_long(a, &value, &size); + err = grib_unpack_long(a, &value, &size2); } + Assert(size2 == size); self->empty = 0; diff --git a/src/grib_dumper_class_bufr_encode_filter.c b/src/grib_dumper_class_bufr_encode_filter.c index 259b1a617..1c3d2bc8e 100644 --- a/src/grib_dumper_class_bufr_encode_filter.c +++ b/src/grib_dumper_class_bufr_encode_filter.c @@ -154,7 +154,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) { grib_dumper_bufr_encode_filter* self = (grib_dumper_bufr_encode_filter*)d; double value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; double* values = NULL; int err = 0; int i, r; @@ -167,15 +167,16 @@ static void dump_values(grib_dumper* d, grib_accessor* a) return; grib_value_count(a, &count); - size = count; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size); + err = grib_unpack_double(a, values, &size2); } else { - err = grib_unpack_double(a, &value, &size); + err = grib_unpack_double(a, &value, &size2); } + Assert(size2 == size); self->begin = 0; self->empty = 0; @@ -256,8 +257,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* return; grib_value_count(a, &count); - size = count; - size2 = size; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); @@ -266,7 +266,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* else { err = grib_unpack_double(a, &value, &size2); } - Assert(size == size2); + Assert(size2 == size); self->empty = 0; @@ -316,7 +316,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_encode_filter* self = (grib_dumper_bufr_encode_filter*)d; long value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; long* values = NULL; int err = 0; int i, r, icount; @@ -329,7 +329,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) return; grib_value_count(a, &count); - size = count; + size = size2 = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { if (self->isLeaf == 0) { @@ -355,11 +355,12 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size); + err = grib_unpack_long(a, values, &size2); } else { - err = grib_unpack_long(a, &value, &size); + err = grib_unpack_long(a, &value, &size2); } + Assert(size2 == size); self->begin = 0; self->empty = 0; @@ -426,7 +427,7 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr { grib_dumper_bufr_encode_filter* self = (grib_dumper_bufr_encode_filter*)d; long value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; long* values = NULL; int err = 0; int i, icount; @@ -438,15 +439,16 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr return; grib_value_count(a, &count); - size = count; + size = size2 = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size); + err = grib_unpack_long(a, values, &size2); } else { - err = grib_unpack_long(a, &value, &size); + err = grib_unpack_long(a, &value, &size2); } + Assert(size2 == size); self->empty = 0; diff --git a/src/grib_dumper_class_bufr_encode_fortran.c b/src/grib_dumper_class_bufr_encode_fortran.c index b8a2cff78..a3fcf5534 100644 --- a/src/grib_dumper_class_bufr_encode_fortran.c +++ b/src/grib_dumper_class_bufr_encode_fortran.c @@ -221,7 +221,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; double value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; double* values = NULL; int err = 0; int i, r, icount; @@ -235,15 +235,16 @@ static void dump_values(grib_dumper* d, grib_accessor* a) return; grib_value_count(a, &count); - size = count; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size); + err = grib_unpack_double(a, values, &size2); } else { - err = grib_unpack_double(a, &value, &size); + err = grib_unpack_double(a, &value, &size2); } + Assert(size2 == size); self->empty = 0; @@ -328,8 +329,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* return; grib_value_count(a, &count); - size = count; - size2 = size; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); @@ -338,7 +338,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* else { err = grib_unpack_double(a, &value, &size2); } - Assert(size == size2); + Assert(size2 == size); self->empty = 0; @@ -397,7 +397,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_encode_fortran* self = (grib_dumper_bufr_encode_fortran*)d; long value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; long* values = NULL; int err = 0; int i, r, icount; @@ -413,7 +413,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) doing_unexpandedDescriptors = (strcmp(a->name, "unexpandedDescriptors") == 0); grib_value_count(a, &count); - size = count; + size = size2 = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { if (self->isLeaf == 0) { @@ -439,11 +439,12 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size); + err = grib_unpack_long(a, values, &size2); } else { - err = grib_unpack_long(a, &value, &size); + err = grib_unpack_long(a, &value, &size2); } + Assert(size2 == size); self->empty = 0; @@ -540,8 +541,7 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr return; grib_value_count(a, &count); - size = count; - size2 = size; + size = size2 = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); @@ -550,7 +550,7 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr else { err = grib_unpack_long(a, &value, &size2); } - Assert(size == size2); + Assert(size2 == size); self->empty = 0; diff --git a/src/grib_dumper_class_bufr_encode_python.c b/src/grib_dumper_class_bufr_encode_python.c index 94572253c..57ddaa8b6 100644 --- a/src/grib_dumper_class_bufr_encode_python.c +++ b/src/grib_dumper_class_bufr_encode_python.c @@ -173,7 +173,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) { grib_dumper_bufr_encode_python* self = (grib_dumper_bufr_encode_python*)d; double value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; double* values = NULL; int err = 0; int i, r, icount; @@ -187,15 +187,16 @@ static void dump_values(grib_dumper* d, grib_accessor* a) return; grib_value_count(a, &count); - size = count; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size); + err = grib_unpack_double(a, values, &size2); } else { - err = grib_unpack_double(a, &value, &size); + err = grib_unpack_double(a, &value, &size2); } + Assert(size2 == size); self->empty = 0; @@ -281,8 +282,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* return; grib_value_count(a, &count); - size = count; - size2 = size; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); @@ -291,7 +291,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* else { err = grib_unpack_double(a, &value, &size2); } - Assert(size == size2); + Assert(size2 == size); self->empty = 0; @@ -351,7 +351,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_encode_python* self = (grib_dumper_bufr_encode_python*)d; long value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; long* values = NULL; int err = 0; int i, r, icount; @@ -367,7 +367,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) doing_unexpandedDescriptors = (strcmp(a->name, "unexpandedDescriptors") == 0); grib_value_count(a, &count); - size = count; + size = size2 = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { if (self->isLeaf == 0) { @@ -393,11 +393,12 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size); + err = grib_unpack_long(a, values, &size2); } else { - err = grib_unpack_long(a, &value, &size); + err = grib_unpack_long(a, &value, &size2); } + Assert(size2 == size); self->empty = 0; diff --git a/src/grib_dumper_class_bufr_simple.c b/src/grib_dumper_class_bufr_simple.c index abff5602f..e8e54b5d0 100644 --- a/src/grib_dumper_class_bufr_simple.c +++ b/src/grib_dumper_class_bufr_simple.c @@ -151,7 +151,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) { grib_dumper_bufr_simple* self = (grib_dumper_bufr_simple*)d; double value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; double* values = NULL; int err = 0; int i, r; @@ -164,15 +164,16 @@ static void dump_values(grib_dumper* d, grib_accessor* a) return; grib_value_count(a, &count); - size = count; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size); + err = grib_unpack_double(a, values, &size2); } else { - err = grib_unpack_double(a, &value, &size); + err = grib_unpack_double(a, &value, &size2); } + Assert(size2 == size); self->empty = 0; @@ -241,7 +242,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* { grib_dumper_bufr_simple* self = (grib_dumper_bufr_simple*)d; double value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; double* values = NULL; int err = 0; int i, icount; @@ -253,15 +254,16 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* return; grib_value_count(a, &count); - size = count; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size); + err = grib_unpack_double(a, values, &size2); } else { - err = grib_unpack_double(a, &value, &size); + err = grib_unpack_double(a, &value, &size2); } + Assert(size2 == size); self->empty = 0; @@ -312,7 +314,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_bufr_simple* self = (grib_dumper_bufr_simple*)d; long value = 0; - size_t size = 0; + size_t size = 0, size2 = 0; long* values = NULL; int err = 0; int i, r, icount; @@ -325,7 +327,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) return; grib_value_count(a, &count); - size = count; + size = size2 = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { if (self->isLeaf == 0) { @@ -360,11 +362,12 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size); + err = grib_unpack_long(a, values, &size2); } else { - err = grib_unpack_long(a, &value, &size); + err = grib_unpack_long(a, &value, &size2); } + Assert(size2 == size); self->empty = 0; diff --git a/src/grib_dumper_class_json.c b/src/grib_dumper_class_json.c index 5defedad4..bd2dd0b97 100644 --- a/src/grib_dumper_class_json.c +++ b/src/grib_dumper_class_json.c @@ -144,8 +144,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) h = grib_handle_of_accessor(a); grib_value_count(a, &count); - size = count; - size2 = size; + size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(a->context, sizeof(double) * size); @@ -154,7 +153,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) else { err = grib_unpack_double(a, &value, &size2); } - Assert(size == size2); + Assert(size2 == size); (void)err; /* TODO */ if (self->begin == 0 && self->empty == 0 && self->isAttribute == 0) @@ -227,7 +226,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_json* self = (grib_dumper_json*)d; long value = 0; - size_t size = 1; + size_t size = 1, size2 = 0; long* values = NULL; int err = 0; int i; @@ -238,15 +237,16 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) return; grib_value_count(a, &count); - size = count; + size = size2 = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size); + err = grib_unpack_long(a, values, &size2); } else { - err = grib_unpack_long(a, &value, &size); + err = grib_unpack_long(a, &value, &size2); } + Assert(size2 == size); if (self->begin == 0 && self->empty == 0 && self->isAttribute == 0) fprintf(self->dumper.out, ","); diff --git a/src/grib_handle.c b/src/grib_handle.c index 3d355012f..84ea5a79e 100644 --- a/src/grib_handle.c +++ b/src/grib_handle.c @@ -1510,7 +1510,7 @@ static int grib2_has_next_section(unsigned char* msgbegin, size_t msglen, unsign return 0; } - secbegin += seclen; + /*secbegin += seclen;*/ return 1; }