diff --git a/src/accessor/grib_accessor_class_change_scanning_direction.cc b/src/accessor/grib_accessor_class_change_scanning_direction.cc index e4f618d20..f85d80674 100644 --- a/src/accessor/grib_accessor_class_change_scanning_direction.cc +++ b/src/accessor/grib_accessor_class_change_scanning_direction.cc @@ -45,18 +45,17 @@ int grib_accessor_change_scanning_direction_t::pack_long(const long* val, size_t double* values = NULL; const grib_context* c = context_; grib_handle* h = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; if (*val == 0) return GRIB_SUCCESS; /* Make sure Ni / Nj are not missing */ if (grib_is_missing(h, Ni_, &err) && !err) { - grib_context_log(c, GRIB_LOG_ERROR, "%s: Key %s cannot be 'missing'!", cclass_name, Ni_); + grib_context_log(c, GRIB_LOG_ERROR, "%s: Key %s cannot be 'missing'!", class_name_, Ni_); return GRIB_WRONG_GRID; } if (grib_is_missing(h, Nj_, &err) && !err) { - grib_context_log(c, GRIB_LOG_ERROR, "%s: Key %s cannot be 'missing'!", cclass_name, Nj_); + grib_context_log(c, GRIB_LOG_ERROR, "%s: Key %s cannot be 'missing'!", class_name_, Nj_); return GRIB_WRONG_GRID; } @@ -79,7 +78,7 @@ int grib_accessor_change_scanning_direction_t::pack_long(const long* val, size_t return err; if (size > Ni * Nj) { - grib_context_log(c, GRIB_LOG_ERROR, "%s: Wrong values size!=Ni*Nj (%ld!=%ld*%ld)", cclass_name, size, Ni, Nj); + grib_context_log(c, GRIB_LOG_ERROR, "%s: Wrong values size!=Ni*Nj (%ld!=%ld*%ld)", class_name_, size, Ni, Nj); return GRIB_WRONG_ARRAY_SIZE; } diff --git a/src/accessor/grib_accessor_class_codetable.cc b/src/accessor/grib_accessor_class_codetable.cc index ed6d4ad4b..9e40583af 100644 --- a/src/accessor/grib_accessor_class_codetable.cc +++ b/src/accessor/grib_accessor_class_codetable.cc @@ -592,10 +592,9 @@ int grib_accessor_codetable_t::unpack_string(char* buffer, size_t* len) l = strlen(tmp) + 1; if (*len < l) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, l, *len); + class_name_, name_, l, *len); *len = l; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_codetable_title.cc b/src/accessor/grib_accessor_class_codetable_title.cc index 7617a4e90..d9b4e9bad 100644 --- a/src/accessor/grib_accessor_class_codetable_title.cc +++ b/src/accessor/grib_accessor_class_codetable_title.cc @@ -1,4 +1,3 @@ - /* * (C) Copyright 2005- ECMWF. * @@ -37,7 +36,7 @@ int grib_accessor_codetable_title_t::unpack_string(char* buffer, size_t* len) long value; int err = GRIB_SUCCESS; char tmp[1024]; - size_t l = 1024; + size_t l = 1024; grib_accessor_codetable_t* ca = (grib_accessor_codetable_t*)grib_find_accessor(grib_handle_of_accessor(this), codetable_); if ((err = ((grib_accessor*)ca)->unpack_long(&value, &size)) != GRIB_SUCCESS) @@ -55,10 +54,9 @@ int grib_accessor_codetable_title_t::unpack_string(char* buffer, size_t* len) l = strlen(tmp) + 1; if (*len < l) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, l, *len); + class_name_, name_, l, *len); *len = l; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_codetable_units.cc b/src/accessor/grib_accessor_class_codetable_units.cc index 949459917..e0f1cf3de 100644 --- a/src/accessor/grib_accessor_class_codetable_units.cc +++ b/src/accessor/grib_accessor_class_codetable_units.cc @@ -1,4 +1,3 @@ - /* * (C) Copyright 2005- ECMWF. * @@ -56,10 +55,9 @@ int grib_accessor_codetable_units_t::unpack_string(char* buffer, size_t* len) l = strlen(tmp) + 1; if (*len < l) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, l, *len); + class_name_, name_, l, *len); *len = l; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_concept.cc b/src/accessor/grib_accessor_class_concept.cc index 9d654c4fc..532db4f26 100644 --- a/src/accessor/grib_accessor_class_concept.cc +++ b/src/accessor/grib_accessor_class_concept.cc @@ -400,9 +400,8 @@ int grib_accessor_concept_t::pack_long(const long* val, size_t* len) long newParamId = 0; if (grib_get_long(h, "paramIdForConversion", &newParamId) == GRIB_SUCCESS && newParamId > 0) { if (context_->debug) { - const char* cclass_name = class_name_; fprintf(stderr, "ECCODES DEBUG %s::%s: Changing %s from %ld to %ld\n", - cclass_name, __func__, name_, *val, newParamId); + class_name_, __func__, name_, *val, newParamId); } snprintf(buf, sizeof(buf), "%ld", newParamId); } diff --git a/src/accessor/grib_accessor_class_data_ccsds_packing.cc b/src/accessor/grib_accessor_class_data_ccsds_packing.cc index 0db790cce..de30c0545 100644 --- a/src/accessor/grib_accessor_class_data_ccsds_packing.cc +++ b/src/accessor/grib_accessor_class_data_ccsds_packing.cc @@ -89,7 +89,6 @@ static void print_aec_stream_info(struct aec_stream* strm, const char* func) int grib_accessor_data_ccsds_packing_t::pack_double(const double* val, size_t* len) { grib_handle* hand = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; int err = GRIB_SUCCESS; size_t buflen = 0, i = 0; bool is_constant_field = false; @@ -175,7 +174,7 @@ int grib_accessor_data_ccsds_packing_t::pack_double(const double* val, size_t* l #endif if (grib_get_nearest_smaller_value(hand, reference_value_, val[0], &reference_value) != GRIB_SUCCESS) { grib_context_log(context_, GRIB_LOG_ERROR, - "%s %s: Unable to find nearest_smaller_value of %g for %s", cclass_name, __func__, min, reference_value_); + "%s %s: Unable to find nearest_smaller_value of %g for %s", class_name_, __func__, min, reference_value_); return GRIB_INTERNAL_ERROR; } if ((err = grib_set_double_internal(hand, reference_value_, reference_value)) != GRIB_SUCCESS) @@ -202,13 +201,13 @@ int grib_accessor_data_ccsds_packing_t::pack_double(const double* val, size_t* l if (grib_get_nearest_smaller_value(hand, reference_value_, min, &reference_value) != GRIB_SUCCESS) { grib_context_log(context_, GRIB_LOG_ERROR, - "%s %s: Unable to find nearest_smaller_value of %g for %s", cclass_name, __func__, min, reference_value_); + "%s %s: Unable to find nearest_smaller_value of %g for %s", class_name_, __func__, min, reference_value_); return GRIB_INTERNAL_ERROR; } if (reference_value > min) { grib_context_log(context_, GRIB_LOG_ERROR, - "%s %s: reference_value=%g min_value=%g diff=%g", cclass_name, __func__, reference_value, min, reference_value - min); + "%s %s: reference_value=%g min_value=%g diff=%g", class_name_, __func__, reference_value, min, reference_value - min); DEBUG_ASSERT(reference_value <= min); return GRIB_INTERNAL_ERROR; } @@ -247,7 +246,7 @@ int grib_accessor_data_ccsds_packing_t::pack_double(const double* val, size_t* l if (grib_get_nearest_smaller_value(hand, reference_value_, min, &reference_value) != GRIB_SUCCESS) { grib_context_log(context_, GRIB_LOG_ERROR, - "%s %s: Unable to find nearest_smaller_value of %g for %s", cclass_name, __func__, min, reference_value_); + "%s %s: Unable to find nearest_smaller_value of %g for %s", class_name_, __func__, min, reference_value_); return GRIB_INTERNAL_ERROR; } d = codes_power(decimal_scale_factor, 10); @@ -305,12 +304,12 @@ int grib_accessor_data_ccsds_packing_t::pack_double(const double* val, size_t* l break; default: grib_context_log(context_, GRIB_LOG_ERROR, "%s pack_double: packing %s, bitsPerValue=%ld (max %ld)", - cclass_name, name_, bits_per_value, MAX_BITS_PER_VALUE); + class_name_, name_, bits_per_value, MAX_BITS_PER_VALUE); err = GRIB_INVALID_BPV; goto cleanup; } - grib_context_log(context_, GRIB_LOG_DEBUG, "%s pack_double: packing %s, %zu values", cclass_name, name_, n_vals); + grib_context_log(context_, GRIB_LOG_DEBUG, "%s pack_double: packing %s, %zu values", class_name_, name_, n_vals); // ECC-1431: GRIB2: CCSDS encoding failure AEC_STREAM_ERROR buflen = (nbytes * n_vals) * 67 / 64 + 256; @@ -329,7 +328,7 @@ int grib_accessor_data_ccsds_packing_t::pack_double(const double* val, size_t* l grib_get_double_internal(hand, reference_value_, &ref); if (ref != reference_value) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: %s (ref=%.10e != reference_value=%.10e)", - cclass_name, __func__, reference_value_, ref, reference_value); + class_name_, __func__, reference_value_, ref, reference_value); return GRIB_INTERNAL_ERROR; } } @@ -357,7 +356,7 @@ int grib_accessor_data_ccsds_packing_t::pack_double(const double* val, size_t* l if ((err = aec_buffer_encode(&strm)) != AEC_OK) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: aec_buffer_encode error %d (%s)", - cclass_name, __func__, err, aec_get_error_message(err)); + class_name_, __func__, err, aec_get_error_message(err)); err = GRIB_ENCODING_ERROR; goto cleanup; } @@ -383,7 +382,6 @@ int grib_accessor_data_ccsds_packing_t::unpack(T* val, size_t* len) { static_assert(std::is_floating_point::value, "Requires floating point numbers"); grib_handle* hand = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; int err = GRIB_SUCCESS, i = 0; size_t buflen = 0; @@ -476,7 +474,7 @@ int grib_accessor_data_ccsds_packing_t::unpack(T* val, size_t* len) if ((err = aec_buffer_decode(&strm)) != AEC_OK) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: aec_buffer_decode error %d (%s)", - cclass_name, __func__, err, aec_get_error_message(err)); + class_name_, __func__, err, aec_get_error_message(err)); err = GRIB_DECODING_ERROR; goto cleanup; } @@ -503,7 +501,7 @@ int grib_accessor_data_ccsds_packing_t::unpack(T* val, size_t* len) break; default: grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: unpacking %s, bitsPerValue=%ld (max %ld)", - cclass_name, __func__, name_, bits_per_value, MAX_BITS_PER_VALUE); + class_name_, __func__, name_, bits_per_value, MAX_BITS_PER_VALUE); err = GRIB_INVALID_BPV; goto cleanup; } diff --git a/src/accessor/grib_accessor_class_data_complex_packing.cc b/src/accessor/grib_accessor_class_data_complex_packing.cc index fd4c42930..57871fdf0 100644 --- a/src/accessor/grib_accessor_class_data_complex_packing.cc +++ b/src/accessor/grib_accessor_class_data_complex_packing.cc @@ -168,8 +168,7 @@ double calculate_pfactor(const grib_context* ctx, const double* spectralField, l int grib_accessor_data_complex_packing_t::pack_double(const double* val, size_t* len) { - grib_handle* gh = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; + grib_handle* gh = grib_handle_of_accessor(this); size_t i = 0; int ret = GRIB_SUCCESS; @@ -279,7 +278,7 @@ int grib_accessor_data_complex_packing_t::pack_double(const double* val, size_t* } if (sub_j != sub_k || sub_j != sub_m || pen_j != pen_k || pen_j != pen_m) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s: Invalid pentagonal resolution parameters", cclass_name); + grib_context_log(context_, GRIB_LOG_ERROR, "%s: Invalid pentagonal resolution parameters", class_name_); return GRIB_ENCODING_ERROR; } @@ -287,7 +286,7 @@ int grib_accessor_data_complex_packing_t::pack_double(const double* val, size_t* if (*len != n_vals) { grib_context_log(context_, GRIB_LOG_ERROR, "%s: Wrong number of values, expected %ld - got %zu", - cclass_name, n_vals, *len); + class_name_, n_vals, *len); return GRIB_INTERNAL_ERROR; } @@ -399,7 +398,7 @@ int grib_accessor_data_complex_packing_t::pack_double(const double* val, size_t* &reference_value); if (ret != GRIB_SUCCESS) { grib_context_log(gh->context, GRIB_LOG_ERROR, - "%s: Unable to find nearest_smaller_value of %g for %s", cclass_name, min, reference_value_); + "%s: Unable to find nearest_smaller_value of %g for %s", class_name_, min, reference_value_); return GRIB_INTERNAL_ERROR; } d = codes_power(+decimal_scale_factor, 10); @@ -408,7 +407,7 @@ int grib_accessor_data_complex_packing_t::pack_double(const double* val, size_t* d = codes_power(+decimal_scale_factor, 10); if (grib_get_nearest_smaller_value(gh, reference_value_, d * min, &reference_value) != GRIB_SUCCESS) { grib_context_log(gh->context, GRIB_LOG_ERROR, - "%s: Unable to find nearest_smaller_value of %g for %s", cclass_name, d * min, reference_value_); + "%s: Unable to find nearest_smaller_value of %g for %s", class_name_, d * min, reference_value_); return GRIB_INTERNAL_ERROR; } binary_scale_factor = grib_get_binary_scale_fact(d * max, reference_value, bits_per_value, &ret); @@ -419,7 +418,7 @@ int grib_accessor_data_complex_packing_t::pack_double(const double* val, size_t* } else { if (ret != GRIB_SUCCESS) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s: Cannot compute binary_scale_factor", cclass_name); + grib_context_log(context_, GRIB_LOG_ERROR, "%s: Cannot compute binary_scale_factor", class_name_); return ret; } } @@ -464,13 +463,13 @@ int grib_accessor_data_complex_packing_t::pack_double(const double* val, size_t* current_val = (((((val[i++] * d) * scals[lup]) - reference_value) * s) + 0.5); if (current_val < 0) grib_context_log(context_, GRIB_LOG_ERROR, - "%s: negative coput before packing (%g)", cclass_name, current_val); + "%s: negative coput before packing (%g)", class_name_, current_val); grib_encode_unsigned_longb(lres, current_val, &lpos, bits_per_value); current_val = (((((val[i++] * d) * scals[lup]) - reference_value) * s) + 0.5); if (current_val < 0) grib_context_log(context_, GRIB_LOG_ERROR, - "%s: negative coput before packing (%g)", cclass_name, current_val); + "%s: negative coput before packing (%g)", class_name_, current_val); grib_encode_unsigned_longb(lres, current_val, &lpos, bits_per_value); lup++; } @@ -480,13 +479,13 @@ int grib_accessor_data_complex_packing_t::pack_double(const double* val, size_t* current_val = (((((val[i++] * d) * scals[lup]) - reference_value) * s) + 0.5); if (current_val < 0) grib_context_log(context_, GRIB_LOG_ERROR, - "%s: negative coput before packing (%g)", cclass_name, current_val); + "%s: negative coput before packing (%g)", class_name_, current_val); grib_encode_unsigned_long(lres, current_val, &lpos, bits_per_value); current_val = (((((val[i++] * d) * scals[lup]) - reference_value) * s) + 0.5); if (current_val < 0) grib_context_log(context_, GRIB_LOG_ERROR, - "%s: negative coput before packing (%g)", cclass_name, current_val); + "%s: negative coput before packing (%g)", class_name_, current_val); grib_encode_unsigned_long(lres, current_val, &lpos, bits_per_value); lup++; } @@ -500,7 +499,7 @@ int grib_accessor_data_complex_packing_t::pack_double(const double* val, size_t* if (((hpos / 8) != hsize) && ((lpos / 8) != lsize)) { grib_context_log(context_, GRIB_LOG_ERROR, - "%s: Mismatch in packing between high resolution and low resolution part", cclass_name); + "%s: Mismatch in packing between high resolution and low resolution part", class_name_); grib_context_free(context_, buf); grib_context_free(context_, scals); return GRIB_INTERNAL_ERROR; @@ -516,7 +515,7 @@ int grib_accessor_data_complex_packing_t::pack_double(const double* val, size_t* grib_get_double_internal(gh, reference_value_, &ref); if (ref != reference_value) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: %s (ref=%.10e != reference_value=%.10e)", - cclass_name, __func__, reference_value_, ref, reference_value); + class_name_, __func__, reference_value_, ref, reference_value); return GRIB_INTERNAL_ERROR; } } @@ -538,7 +537,6 @@ int grib_accessor_data_complex_packing_t::unpack_real(T* val, size_t* len) { static_assert(std::is_floating_point::value, "Requires floating point numbers"); grib_handle* gh = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; size_t i = 0; int ret = GRIB_SUCCESS; @@ -650,7 +648,7 @@ int grib_accessor_data_complex_packing_t::unpack_real(T* val, size_t* len) } if (sub_j != sub_k || sub_j != sub_m || pen_j != pen_k || pen_j != pen_m) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s: Invalid pentagonal resolution parameters", cclass_name); + grib_context_log(context_, GRIB_LOG_ERROR, "%s: Invalid pentagonal resolution parameters", class_name_); return GRIB_DECODING_ERROR; } @@ -690,7 +688,7 @@ int grib_accessor_data_complex_packing_t::unpack_real(T* val, size_t* len) scals[i] = (1.0 / operat); else { grib_context_log(context_, GRIB_LOG_WARNING, - "%s: Problem with operator div by zero at index %d of %d", cclass_name, i, maxv); + "%s: Problem with operator div by zero at index %d of %d", class_name_, i, maxv); scals[i] = 0; } } @@ -749,7 +747,7 @@ int grib_accessor_data_complex_packing_t::unpack_real(T* val, size_t* len) //Assert(*len >= i); if (*len < i) { grib_context_log(context_, GRIB_LOG_ERROR, "%s::%s: Invalid values *len=%zu and i=%zu.", - cclass_name, __func__, *len, i); + class_name_, __func__, *len, i); grib_context_log(context_, GRIB_LOG_ERROR, "Make sure your array is large enough."); ret = GRIB_ARRAY_TOO_SMALL; } else { diff --git a/src/accessor/grib_accessor_class_data_g1second_order_constant_width_packing.cc b/src/accessor/grib_accessor_class_data_g1second_order_constant_width_packing.cc index e650fb4f0..0d7cd7e45 100644 --- a/src/accessor/grib_accessor_class_data_g1second_order_constant_width_packing.cc +++ b/src/accessor/grib_accessor_class_data_g1second_order_constant_width_packing.cc @@ -178,8 +178,7 @@ int grib_accessor_data_g1second_order_constant_width_packing_t::unpack_double(do int grib_accessor_data_g1second_order_constant_width_packing_t::pack_double(const double* cval, size_t* len) { - const char* cclass_name = class_name_; - grib_context_log(context_, GRIB_LOG_ERROR, "%s: %s: Not implemented", cclass_name, __func__); + grib_context_log(context_, GRIB_LOG_ERROR, "%s: %s: Not implemented", class_name_, __func__); return GRIB_NOT_IMPLEMENTED; } diff --git a/src/accessor/grib_accessor_class_data_g22order_packing.cc b/src/accessor/grib_accessor_class_data_g22order_packing.cc index 9097f87f7..4669f1638 100644 --- a/src/accessor/grib_accessor_class_data_g22order_packing.cc +++ b/src/accessor/grib_accessor_class_data_g22order_packing.cc @@ -774,8 +774,7 @@ static void merge_j(struct section* h, int ref_bits, int width_bits, int has_und int grib_accessor_data_g22order_packing_t::pack_double(const double* val, size_t* len) { - grib_handle* gh = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; + grib_handle* gh = grib_handle_of_accessor(this); int err = 0; @@ -906,7 +905,7 @@ int grib_accessor_data_g22order_packing_t::pack_double(const double* val, size_t size_t ndata = *len; double* data = reinterpret_cast(grib_context_malloc_clear(context_, ndata * sizeof(double))); if (data == NULL) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: unable to allocate %zu bytes", cclass_name, ndata * sizeof(double)); + grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: unable to allocate %zu bytes", class_name_, ndata * sizeof(double)); return GRIB_OUT_OF_MEMORY; } memcpy(data, val, sizeof(*data) * ndata); @@ -926,11 +925,11 @@ int grib_accessor_data_g22order_packing_t::pack_double(const double* val, size_t v = reinterpret_cast(grib_context_malloc(context_, nndata * sizeof(int))); if (v == NULL) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: unable to allocate %zu bytes", cclass_name, nndata * sizeof(int)); + grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: unable to allocate %zu bytes", class_name_, nndata * sizeof(int)); return GRIB_OUT_OF_MEMORY; } if (min_max_array(data, ndata, &mn, &mx) != GRIB_SUCCESS) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: failed to get min max of data", cclass_name); + grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: failed to get min max of data", class_name_); return GRIB_ENCODING_ERROR; } min_val = mn; @@ -1109,7 +1108,7 @@ int grib_accessor_data_g22order_packing_t::pack_double(const double* val, size_t list = reinterpret_cast(grib_context_malloc_clear(context_, nstruct * sizeof(section))); if (list == NULL) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: memory allocation of list failed", cclass_name); + grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: memory allocation of list failed", class_name_); return GRIB_OUT_OF_MEMORY; } @@ -1139,7 +1138,7 @@ int grib_accessor_data_g22order_packing_t::pack_double(const double* val, size_t start.tail = &list[0]; if (nstruct != ii + 1) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: nstruct=%zu wanted %zu", cclass_name, nstruct, ii + 1); + grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: nstruct=%zu wanted %zu", class_name_, nstruct, ii + 1); return GRIB_ENCODING_ERROR; } for (i = 1; i < nstruct; i++) { @@ -1167,7 +1166,7 @@ int grib_accessor_data_g22order_packing_t::pack_double(const double* val, size_t list_backup = reinterpret_cast(grib_context_malloc(context_, nstruct * sizeof(section))); if (list_backup == NULL) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: memory allocation of list_backup failed", cclass_name); + grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: memory allocation of list_backup failed", class_name_); return GRIB_OUT_OF_MEMORY; } @@ -1247,7 +1246,7 @@ int grib_accessor_data_g22order_packing_t::pack_double(const double* val, size_t itmp2 = reinterpret_cast(grib_context_malloc(context_, ngroups * sizeof(int))); if (lens == NULL || widths == NULL || refs == NULL || itmp == NULL || itmp2 == NULL) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: memory alloc of lens/widths/refs/itmp/itmp2 failed", cclass_name); + grib_context_log(context_, GRIB_LOG_ERROR, "%s packing: memory alloc of lens/widths/refs/itmp/itmp2 failed", class_name_); return GRIB_OUT_OF_MEMORY; } @@ -1382,7 +1381,7 @@ int grib_accessor_data_g22order_packing_t::pack_double(const double* val, size_t unsigned char* sec7 = reinterpret_cast(grib_context_malloc(context_, size_sec7)); if (sec7 == NULL) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s: Unable to allocate %d bytes", cclass_name, size_sec7); + grib_context_log(context_, GRIB_LOG_ERROR, "%s: Unable to allocate %d bytes", class_name_, size_sec7); return GRIB_OUT_OF_MEMORY; } @@ -1464,7 +1463,7 @@ template int grib_accessor_data_g22order_packing_t::unpack(T* val, size_t* len) { static_assert(std::is_floating_point::value, "Requires floating points numbers"); - const char* cclass_name = class_name_; + const char* class_name_ = class_name_; grib_handle* gh = grib_handle_of_accessor(this); size_t i = 0; @@ -1688,7 +1687,7 @@ int grib_accessor_data_g22order_packing_t::unpack(T* val, size_t* len) // For Complex packing and spatial differencing, order == 1 or 2 (code table 5.6) if (orderOfSpatialDifferencing != 1 && orderOfSpatialDifferencing != 2) { grib_context_log(context_, GRIB_LOG_ERROR, - "%s unpacking: Unsupported order of spatial differencing %ld", cclass_name, orderOfSpatialDifferencing); + "%s unpacking: Unsupported order of spatial differencing %ld", class_name_, orderOfSpatialDifferencing); return GRIB_INTERNAL_ERROR; } diff --git a/src/accessor/grib_accessor_class_data_g2bifourier_packing.cc b/src/accessor/grib_accessor_class_data_g2bifourier_packing.cc index d887635e0..0126e83e8 100644 --- a/src/accessor/grib_accessor_class_data_g2bifourier_packing.cc +++ b/src/accessor/grib_accessor_class_data_g2bifourier_packing.cc @@ -539,8 +539,7 @@ cleanup: int grib_accessor_data_g2bifourier_packing_t::pack_double(const double* val, size_t* len) { - grib_handle* gh = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; + grib_handle* gh = grib_handle_of_accessor(this); size_t buflen = 0; size_t hsize = 0; @@ -714,7 +713,7 @@ int grib_accessor_data_g2bifourier_packing_t::pack_double(const double* val, siz grib_get_double_internal(gh, reference_value_, &ref); if (ref != bt->reference_value) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: %s (ref=%.10e != reference_value=%.10e)", - cclass_name, __func__, reference_value_, ref, bt->reference_value); + class_name_, __func__, reference_value_, ref, bt->reference_value); return GRIB_INTERNAL_ERROR; } } diff --git a/src/accessor/grib_accessor_class_data_jpeg2000_packing.cc b/src/accessor/grib_accessor_class_data_jpeg2000_packing.cc index 65893b8f1..7a98e6725 100644 --- a/src/accessor/grib_accessor_class_data_jpeg2000_packing.cc +++ b/src/accessor/grib_accessor_class_data_jpeg2000_packing.cc @@ -217,7 +217,6 @@ int grib_accessor_data_jpeg2000_packing_t::pack_double(const double* cval, size_ double units_factor = 1.0; double units_bias = 0.0; double* val = (double*)cval; - const char* cclass_name = class_name_; dirty_ = 1; @@ -258,7 +257,7 @@ int grib_accessor_data_jpeg2000_packing_t::pack_double(const double* cval, size_ case GRIB_SUCCESS: break; default: - grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: Unable to compute packing parameters", cclass_name, __func__); + grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: Unable to compute packing parameters", class_name_, __func__); return ret; } @@ -324,7 +323,7 @@ int grib_accessor_data_jpeg2000_packing_t::pack_double(const double* cval, size_ if (width * height != *len) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: width=%ld height=%ld len=%zu. width*height should equal len!", - cclass_name, __func__, width, height, *len); + class_name_, __func__, width, height, *len); /* ECC-802: We cannot bomb out here as the user might have changed Ni/Nj and the packingType * but has not yet submitted the new data values. So len will be out of sync! * So issue a warning but proceed. @@ -339,7 +338,7 @@ int grib_accessor_data_jpeg2000_packing_t::pack_double(const double* cval, size_ if (target_compression_ratio != 255) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: When %s=0 (Lossless), %s must be set to 255", - cclass_name, __func__, type_of_compression_used, target_compression_ratio_); + class_name_, __func__, type_of_compression_used, target_compression_ratio_); return GRIB_ENCODING_ERROR; } helper.compression = 0; @@ -349,7 +348,7 @@ int grib_accessor_data_jpeg2000_packing_t::pack_double(const double* cval, size_ if (target_compression_ratio == 255 || target_compression_ratio == 0) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: When %s=1 (Lossy), %s must be specified", - cclass_name, __func__, type_of_compression_used, target_compression_ratio_); + class_name_, __func__, type_of_compression_used, target_compression_ratio_); return GRIB_ENCODING_ERROR; } Assert(target_compression_ratio != 255); @@ -371,7 +370,7 @@ int grib_accessor_data_jpeg2000_packing_t::pack_double(const double* cval, size_ const long bits_per_value_adjusted = 1; grib_context_log(context_, GRIB_LOG_DEBUG, "%s (%s) : bits per value was zero, changed to %ld", - cclass_name, jpeg_lib_ == OPENJPEG_LIB ? "openjpeg" : "jasper", bits_per_value_adjusted); + class_name_, jpeg_lib_ == OPENJPEG_LIB ? "openjpeg" : "jasper", bits_per_value_adjusted); bits_per_value = bits_per_value_adjusted; } helper.bits_per_value = bits_per_value; @@ -398,7 +397,7 @@ int grib_accessor_data_jpeg2000_packing_t::pack_double(const double* cval, size_ if (helper.jpeg_length > simple_packing_size) grib_context_log(context_, GRIB_LOG_WARNING, "%s (%s) : jpeg data (%ld) larger than input data (%ld)", - cclass_name, jpeg_lib_ == OPENJPEG_LIB ? "openjpeg" : "jasper", + class_name_, jpeg_lib_ == OPENJPEG_LIB ? "openjpeg" : "jasper", helper.jpeg_length, simple_packing_size); Assert(helper.jpeg_length <= helper.buffer_size); diff --git a/src/accessor/grib_accessor_class_data_png_packing.cc b/src/accessor/grib_accessor_class_data_png_packing.cc index 481f4dee2..ad024215b 100644 --- a/src/accessor/grib_accessor_class_data_png_packing.cc +++ b/src/accessor/grib_accessor_class_data_png_packing.cc @@ -235,9 +235,7 @@ static bool is_constant(const double* values, size_t n_vals) int grib_accessor_data_png_packing_t::pack_double(const double* val, size_t* len) { - const char* cclass_name = class_name_; - - int err = GRIB_SUCCESS; + int err = GRIB_SUCCESS; bool is_constant_field = false; int i, j; size_t buflen = 0; @@ -310,7 +308,7 @@ int grib_accessor_data_png_packing_t::pack_double(const double* val, size_t* len grib_get_double_internal(grib_handle_of_accessor(this), reference_value_, &ref); if (ref != reference_value) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: %s (ref=%.10e != reference_value=%.10e)", - cclass_name, __func__, reference_value_, ref, reference_value); + class_name_, __func__, reference_value_, ref, reference_value); return GRIB_INTERNAL_ERROR; } } @@ -363,7 +361,7 @@ int grib_accessor_data_png_packing_t::pack_double(const double* val, size_t* len if (width * height != *len) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: width=%ld height=%ld len=%ld. width*height should equal len!", - cclass_name, __func__, (long)width, (long)height, (long)*len); + class_name_, __func__, (long)width, (long)height, (long)*len); /* ECC-802: We cannot bomb out here as the user might have changed Ni/Nj and the packingType * but has not yet submitted the new data values. So len will be out of sync! * So issue a warning but proceed. @@ -441,7 +439,7 @@ int grib_accessor_data_png_packing_t::pack_double(const double* val, size_t* len grib_get_double_internal(grib_handle_of_accessor(this), reference_value_, &ref); if (ref != reference_value) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: %s (ref=%.10e != reference_value=%.10e)", - cclass_name, __func__, reference_value_, ref, reference_value); + class_name_, __func__, reference_value_, ref, reference_value); return GRIB_INTERNAL_ERROR; } } diff --git a/src/accessor/grib_accessor_class_data_run_length_packing.cc b/src/accessor/grib_accessor_class_data_run_length_packing.cc index ed40266cc..6f550ce29 100644 --- a/src/accessor/grib_accessor_class_data_run_length_packing.cc +++ b/src/accessor/grib_accessor_class_data_run_length_packing.cc @@ -36,7 +36,6 @@ int grib_accessor_data_run_length_packing_t::value_count(long* number_of_values) int grib_accessor_data_run_length_packing_t::unpack_double(double* val, size_t* len) { grib_handle* gh = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; int err = GRIB_SUCCESS; long seclen, number_of_values, bits_per_value, max_level_value, number_of_level_values, decimal_scale_factor; long* level_values = NULL; @@ -82,7 +81,7 @@ int grib_accessor_data_run_length_packing_t::unpack_double(double* val, size_t* grib_context_log(context_, GRIB_LOG_ERROR, "%s: parameters are invalid: max_level_value=%ld(>0, <=number_of_level_values), " "number_of_level_values=%ld(>0, >=max_level_value), range=%ld(>0)", - cclass_name, max_level_value, number_of_level_values, range); + class_name_, max_level_value, number_of_level_values, range); return GRIB_DECODING_ERROR; } if (decimal_scale_factor > 127) { @@ -107,7 +106,7 @@ int grib_accessor_data_run_length_packing_t::unpack_double(double* val, size_t* grib_context_log(context_, GRIB_LOG_ERROR, "%s: numberOfValues mismatch: i=%ld, " "compressed_values[i]=%ld, max_level_value=%ld", - cclass_name, i, compressed_values[i], max_level_value); + class_name_, i, compressed_values[i], max_level_value); break; } v = compressed_values[i++]; @@ -120,7 +119,7 @@ int grib_accessor_data_run_length_packing_t::unpack_double(double* val, size_t* } if (n > number_of_values) { grib_context_log(context_, GRIB_LOG_ERROR, "%s: numberOfValues mismatch: n=%ld, number_of_values=%ld", - cclass_name, n, number_of_values); + class_name_, n, number_of_values); break; } for (k = 0; k < n; k++) { @@ -132,7 +131,7 @@ int grib_accessor_data_run_length_packing_t::unpack_double(double* val, size_t* grib_context_free(context_, compressed_values); if (j != number_of_values) { grib_context_log(context_, GRIB_LOG_ERROR, "%s: numberOfValues mismatch: j=%ld, number_of_values=%ld", - cclass_name, j, number_of_values); + class_name_, j, number_of_values); return GRIB_DECODING_ERROR; } return err; @@ -141,7 +140,6 @@ int grib_accessor_data_run_length_packing_t::unpack_double(double* val, size_t* int grib_accessor_data_run_length_packing_t::pack_double(const double* val, size_t* len) { grib_handle* gh = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; int err = GRIB_SUCCESS; long number_of_values, bits_per_value, max_level_value, number_of_level_values, decimal_scale_factor; long* level_values = NULL; @@ -167,7 +165,7 @@ int grib_accessor_data_run_length_packing_t::pack_double(const double* val, size if (n_vals != number_of_values) { grib_context_log(context_, GRIB_LOG_ERROR, "%s: Parameters are invalid: n_vals=%ld(==number_of_values), number_of_values=%ld(==n_vals)", - cclass_name, n_vals, number_of_values); + class_name_, n_vals, number_of_values); return GRIB_ENCODING_ERROR; } @@ -188,7 +186,7 @@ int grib_accessor_data_run_length_packing_t::pack_double(const double* val, size for (i = 0; i < number_of_level_values; i++) { if (missingValueLong == level_values[i]) { grib_context_log(context_, GRIB_LOG_ERROR, "%s: Parameters are invalid: level_values[%ld]=%ld, missingValueLong=%ld", - cclass_name, i, level_values[i], missingValueLong); + class_name_, i, level_values[i], missingValueLong); return GRIB_ENCODING_ERROR; } } @@ -197,7 +195,7 @@ int grib_accessor_data_run_length_packing_t::pack_double(const double* val, size grib_context_log(context_, GRIB_LOG_ERROR, "%s: Parameters are invalid: max_level_value=%ld(>0, <=number_of_level_values), " "number_of_level_values=%ld(>0, >=max_level_value), range=%ld(>0)", - cclass_name, max_level_value, number_of_level_values, range); + class_name_, max_level_value, number_of_level_values, range); return GRIB_ENCODING_ERROR; } buf = (unsigned char*)grib_context_malloc(context_, 2 * number_of_values); @@ -220,7 +218,7 @@ int grib_accessor_data_run_length_packing_t::pack_double(const double* val, size if (err != GRIB_SUCCESS) { grib_context_log(context_, GRIB_LOG_ERROR, "%s: Values and/or parameters are invalid: val[%ld]=%lf, level_value=%ld, max_level_value=%ld", - cclass_name, i, val[i], k, max_level_value); + class_name_, i, val[i], k, max_level_value); return GRIB_ENCODING_ERROR; } if (i == 0) { diff --git a/src/accessor/grib_accessor_class_data_sh_packed.cc b/src/accessor/grib_accessor_class_data_sh_packed.cc index 561c705eb..e753b7d07 100644 --- a/src/accessor/grib_accessor_class_data_sh_packed.cc +++ b/src/accessor/grib_accessor_class_data_sh_packed.cc @@ -39,9 +39,8 @@ void grib_accessor_data_sh_packed_t::init(const long v, grib_arguments* args) int grib_accessor_data_sh_packed_t::value_count(long* count) { - grib_handle* hand = grib_handle_of_accessor(this); - int ret = 0; - const char* cclass_name = class_name_; + grib_handle* hand = grib_handle_of_accessor(this); + int ret = 0; long sub_j = 0; long sub_k = 0; @@ -66,7 +65,7 @@ int grib_accessor_data_sh_packed_t::value_count(long* count) if (pen_j != pen_k || pen_j != pen_m) { grib_context_log(context_, GRIB_LOG_ERROR, "%s: pen_j=%ld, pen_k=%ld, pen_m=%ld\n", - cclass_name, pen_j, pen_k, pen_m); + class_name_, pen_j, pen_k, pen_m); return GRIB_DECODING_ERROR; } *count = (pen_j + 1) * (pen_j + 2) - (sub_j + 1) * (sub_j + 2); diff --git a/src/accessor/grib_accessor_class_data_simple_packing.cc b/src/accessor/grib_accessor_class_data_simple_packing.cc index 22e484507..cf9e10ad8 100644 --- a/src/accessor/grib_accessor_class_data_simple_packing.cc +++ b/src/accessor/grib_accessor_class_data_simple_packing.cc @@ -68,8 +68,6 @@ int grib_accessor_data_simple_packing_t::value_count(long* number_of_values) int grib_accessor_data_simple_packing_t::unpack_double_element(size_t idx, double* val) { - const char* cclass_name = class_name_; - long n_vals = 0; int err = 0; grib_handle* gh = grib_handle_of_accessor(this); @@ -113,7 +111,7 @@ int grib_accessor_data_simple_packing_t::unpack_double_element(size_t idx, doubl grib_context_log(context_, GRIB_LOG_DEBUG, "%s: %s: creating %s, %ld values (idx=%zu)", - cclass_name, __func__, name_, n_vals, idx); + class_name_, __func__, name_, n_vals, idx); buf += byte_offset(); /*Assert(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */ @@ -121,7 +119,7 @@ int grib_accessor_data_simple_packing_t::unpack_double_element(size_t idx, doubl if (bits_per_value % 8) { grib_context_log(context_, GRIB_LOG_DEBUG, "%s: calling outline function : bpv %ld, rv: %g, bsf: %ld, dsf: %ld ", - cclass_name, bits_per_value, reference_value, binary_scale_factor, decimal_scale_factor); + class_name_, bits_per_value, reference_value, binary_scale_factor, decimal_scale_factor); pos = idx * bits_per_value; *val = (double)(((grib_decode_unsigned_long(buf, &pos, bits_per_value) * s) + reference_value) * d); /* val[i] = grib_decode_unsigned_long(buf, &pos, bits_per_value); */ @@ -163,7 +161,6 @@ int grib_accessor_data_simple_packing_t::unpack(T* val, size_t* len) { static_assert(std::is_floating_point::value, "Requires floating point numbers"); - const char* cclass_name = class_name_; grib_handle* gh = grib_handle_of_accessor(this); unsigned char* buf = (unsigned char*)grib_handle_of_accessor(this)->buffer->data; @@ -243,7 +240,7 @@ int grib_accessor_data_simple_packing_t::unpack(T* val, size_t* len) d = codes_power(-decimal_scale_factor, 10); grib_context_log(context_, GRIB_LOG_DEBUG, - "%s %s: Creating %s, %zu values", cclass_name, __func__, name_, n_vals); + "%s %s: Creating %s, %zu values", class_name_, __func__, name_, n_vals); offsetBeforeData = byte_offset(); buf += offsetBeforeData; @@ -261,7 +258,7 @@ int grib_accessor_data_simple_packing_t::unpack(T* val, size_t* len) grib_context_log(context_, GRIB_LOG_ERROR, "%s: Data section size mismatch: " "offset before data=%ld, offset after data=%ld (num values=%zu, bits per value=%ld)", - cclass_name, offsetBeforeData, offsetAfterData, n_vals, bits_per_value); + class_name_, offsetBeforeData, offsetAfterData, n_vals, bits_per_value); return GRIB_DECODING_ERROR; } } @@ -276,7 +273,7 @@ int grib_accessor_data_simple_packing_t::unpack(T* val, size_t* len) grib_context_log(context_, GRIB_LOG_DEBUG, "%s %s: calling outline function: bpv: %ld, rv: %g, bsf: %ld, dsf: %ld", - cclass_name, __func__, bits_per_value, reference_value, binary_scale_factor, decimal_scale_factor); + class_name_, __func__, bits_per_value, reference_value, binary_scale_factor, decimal_scale_factor); grib_decode_array(buf, &pos, bits_per_value, reference_value, s, d, n_vals, val); *len = (long)n_vals; @@ -315,7 +312,7 @@ int grib_accessor_data_simple_packing_t::_unpack_double(double* val, size_t* len { grib_accessor_data_simple_packing_t* self = (grib_accessor_data_simple_packing_t*)this; grib_handle* gh = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; + const char* class_name_ = class_name_; size_t i = 0; int err = 0; @@ -385,7 +382,7 @@ int grib_accessor_data_simple_packing_t::_unpack_double(double* val, size_t* len d = codes_power(-decimal_scale_factor, 10); grib_context_log(context_, GRIB_LOG_DEBUG, - "%s %s: Creating %s, %zu values", cclass_name, __func__, name_, n_vals); + "%s %s: Creating %s, %zu values", class_name_, __func__, name_, n_vals); offsetBeforeData = byte_offset(); buf += offsetBeforeData; @@ -459,7 +456,7 @@ int grib_accessor_data_simple_packing_t::unpack_double_subarray(double* val, siz int grib_accessor_data_simple_packing_t::pack_double(const double* val, size_t* len) { grib_handle* gh = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; + const char* class_name_ = class_name_; size_t i = 0; size_t n_vals = *len; @@ -534,7 +531,7 @@ int grib_accessor_data_simple_packing_t::pack_double(const double* val, size_t* grib_get_double_internal(gh, reference_value_, &ref); if (ref != reference_value) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: %s (ref=%.10e != reference_value=%.10e)", - cclass_name, __func__, reference_value_, ref, reference_value); + class_name_, __func__, reference_value_, ref, reference_value); return GRIB_INTERNAL_ERROR; } } @@ -596,7 +593,7 @@ int grib_accessor_data_simple_packing_t::pack_double(const double* val, size_t* if (err) { grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: Range of values too large. Try a smaller value for decimal precision (less than %ld)", - cclass_name, __func__, decimal_scale_factor); + class_name_, __func__, decimal_scale_factor); return err; } diff --git a/src/accessor/grib_accessor_class_double.cc b/src/accessor/grib_accessor_class_double.cc index c77242efb..91b22280d 100644 --- a/src/accessor/grib_accessor_class_double.cc +++ b/src/accessor/grib_accessor_class_double.cc @@ -1,4 +1,3 @@ - /* * (C) Copyright 2005- ECMWF. * @@ -26,7 +25,6 @@ int grib_accessor_double_t::unpack_string(char* v, size_t* len) char repres[1024]; char format[32] = "%g"; grib_handle* h = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; unpack_double(&val, &l); if ((val == GRIB_MISSING_DOUBLE) && ((flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0)) { @@ -43,7 +41,7 @@ int grib_accessor_double_t::unpack_string(char* v, size_t* len) if (l > *len) { grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, l, *len); + class_name_, name_, l, *len); *len = l; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_g1_message_length.cc b/src/accessor/grib_accessor_class_g1_message_length.cc index 7ce162c86..d09f1dd0a 100644 --- a/src/accessor/grib_accessor_class_g1_message_length.cc +++ b/src/accessor/grib_accessor_class_g1_message_length.cc @@ -1,4 +1,3 @@ - /* * (C) Copyright 2005- ECMWF. * @@ -108,11 +107,10 @@ int grib_accessor_g1_message_length_t::pack_long(const long* val, size_t* len) grib_find_accessor(grib_handle_of_accessor(this), sec4_length_), &total_length, &sec4_length); if (total_length != *val) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s %s: Failed to set GRIB1 message length to %ld" " (actual length=%ld)", - cclass_name, __func__, *val, total_length); + class_name_, __func__, *val, total_length); grib_context_log(context_, GRIB_LOG_ERROR, "Hint: Try encoding as GRIB2\n"); return GRIB_ENCODING_ERROR; } diff --git a/src/accessor/grib_accessor_class_gaussian_grid_name.cc b/src/accessor/grib_accessor_class_gaussian_grid_name.cc index d34b18176..f8a34e06f 100644 --- a/src/accessor/grib_accessor_class_gaussian_grid_name.cc +++ b/src/accessor/grib_accessor_class_gaussian_grid_name.cc @@ -64,10 +64,9 @@ int grib_accessor_gaussian_grid_name_t::unpack_string(char* v, size_t* len) length = strlen(tmp) + 1; if (*len < length) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, length, *len); + class_name_, name_, length, *len); *len = length; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_long.cc b/src/accessor/grib_accessor_class_long.cc index 5fcf00106..25f290e84 100644 --- a/src/accessor/grib_accessor_class_long.cc +++ b/src/accessor/grib_accessor_class_long.cc @@ -52,10 +52,9 @@ int grib_accessor_long_t::unpack_string(char* v, size_t* len) l = strlen(repres) + 1; if (*len < l) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, l, *len); + class_name_, name_, l, *len); *len = l; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_mars_step.cc b/src/accessor/grib_accessor_class_mars_step.cc index 9bf10d6e3..d7fa6902d 100644 --- a/src/accessor/grib_accessor_class_mars_step.cc +++ b/src/accessor/grib_accessor_class_mars_step.cc @@ -53,10 +53,9 @@ int grib_accessor_mars_step_t::unpack_string(char* val, size_t* len) size_t buflen = 100; long step; grib_accessor* stepRangeAcc = grib_find_accessor(grib_handle_of_accessor(this), stepRange_); - const char* cclass_name = class_name_; if (!stepRangeAcc) { - grib_context_log(context_, GRIB_LOG_ERROR, "%s: %s not found", cclass_name, stepRange_); + grib_context_log(context_, GRIB_LOG_ERROR, "%s: %s not found", class_name_, stepRange_); return GRIB_NOT_FOUND; } @@ -66,7 +65,7 @@ int grib_accessor_mars_step_t::unpack_string(char* val, size_t* len) if (*len < buflen) { grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, buflen, *len); + class_name_, name_, buflen, *len); *len = buflen; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_md5.cc b/src/accessor/grib_accessor_class_md5.cc index 345b28184..8099f5f6f 100644 --- a/src/accessor/grib_accessor_class_md5.cc +++ b/src/accessor/grib_accessor_class_md5.cc @@ -1,4 +1,3 @@ - /* * (C) Copyright 2005- ECMWF. * @@ -89,10 +88,9 @@ int grib_accessor_md5_t::unpack_string(char* v, size_t* len) struct grib_md5_state md5c; if (*len < 32) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %d bytes long (len=%zu)", - cclass_name, name_, 32, *len); + class_name_, name_, 32, *len); *len = 32; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_offset_file.cc b/src/accessor/grib_accessor_class_offset_file.cc index 599ab7d8d..8be03b020 100644 --- a/src/accessor/grib_accessor_class_offset_file.cc +++ b/src/accessor/grib_accessor_class_offset_file.cc @@ -31,11 +31,8 @@ int grib_accessor_offset_file_t::unpack_string(char* v, size_t* len) { double val = 0; size_t l = 1; - char repres[1024] = { - 0, - }; - int err = 0; - const char* cclass_name = class_name_; + char repres[1024] = {0,}; + int err = 0; err = unpack_double(&val, &l); if (err) return err; @@ -46,7 +43,7 @@ int grib_accessor_offset_file_t::unpack_string(char* v, size_t* len) if (l > *len) { grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, l, *len); + class_name_, name_, l, *len); *len = l; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_optimal_step_units.cc b/src/accessor/grib_accessor_class_optimal_step_units.cc index 31e12212f..feeb90a2a 100644 --- a/src/accessor/grib_accessor_class_optimal_step_units.cc +++ b/src/accessor/grib_accessor_class_optimal_step_units.cc @@ -46,7 +46,6 @@ int grib_accessor_optimal_step_units_t::pack_expression(grib_expression* e) long lval = 0; size_t len = 1; grib_handle* hand = grib_handle_of_accessor(this); - const char* cclass_name = class_name_; if (strcmp(e->cclass->name, "long") == 0) { grib_expression_evaluate_long(hand, e, &lval); /* TODO: check return value */ @@ -59,7 +58,7 @@ int grib_accessor_optimal_step_units_t::pack_expression(grib_expression* e) if (ret != GRIB_SUCCESS) { grib_context_log(context_, GRIB_LOG_ERROR, "%s.%s: Unable to evaluate string %s to be set in %s", - cclass_name, __func__, grib_expression_get_name(e), name_); + class_name_, __func__, grib_expression_get_name(e), name_); return ret; } len = strlen(cval) + 1; diff --git a/src/accessor/grib_accessor_class_proj_string.cc b/src/accessor/grib_accessor_class_proj_string.cc index 8ca95b8c7..b42da8c45 100644 --- a/src/accessor/grib_accessor_class_proj_string.cc +++ b/src/accessor/grib_accessor_class_proj_string.cc @@ -1,4 +1,3 @@ - /* * (C) Copyright 2005- ECMWF. * @@ -218,10 +217,9 @@ int grib_accessor_proj_string_t::unpack_string(char* v, size_t* len) size_t l = 100; // Safe bet if (*len < l) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is at least %zu bytes long (len=%zu)", - cclass_name, name_, l, *len); + class_name_, name_, l, *len); *len = l; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_to_integer.cc b/src/accessor/grib_accessor_class_to_integer.cc index 93b13ffef..3743f4342 100644 --- a/src/accessor/grib_accessor_class_to_integer.cc +++ b/src/accessor/grib_accessor_class_to_integer.cc @@ -67,10 +67,9 @@ int grib_accessor_to_integer_t::unpack_string(char* val, size_t* len) size_t length = string_length(); if (*len < length + 1) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, length + 1, *len); + class_name_, name_, length + 1, *len); *len = length + 1; return GRIB_BUFFER_TOO_SMALL; } diff --git a/src/accessor/grib_accessor_class_to_string.cc b/src/accessor/grib_accessor_class_to_string.cc index 09642825f..eaf12033d 100644 --- a/src/accessor/grib_accessor_class_to_string.cc +++ b/src/accessor/grib_accessor_class_to_string.cc @@ -58,17 +58,14 @@ long grib_accessor_to_string_t::get_native_type() int grib_accessor_to_string_t::unpack_string(char* val, size_t* len) { int err = 0; - char buff[512] = { - 0, - }; + char buff[512] = {0,}; size_t length = string_length(); if (*len < length + 1) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, length + 1, *len); + class_name_, name_, length + 1, *len); *len = length + 1; return GRIB_BUFFER_TOO_SMALL; } @@ -91,9 +88,7 @@ int grib_accessor_to_string_t::unpack_string(char* val, size_t* len) int grib_accessor_to_string_t::unpack_long(long* v, size_t* len) { - char val[1024] = { - 0, - }; + char val[1024] = {0,}; size_t l = sizeof(val); char* last = NULL; int err = unpack_string(val, &l); diff --git a/src/accessor/grib_accessor_class_validity_time.cc b/src/accessor/grib_accessor_class_validity_time.cc index 2e2ead2ab..d4b6f4865 100644 --- a/src/accessor/grib_accessor_class_validity_time.cc +++ b/src/accessor/grib_accessor_class_validity_time.cc @@ -99,10 +99,9 @@ int grib_accessor_validity_time_t::unpack_string(char* val, size_t* len) if (err) return err; if (*len < lmin) { - const char* cclass_name = class_name_; grib_context_log(context_, GRIB_LOG_ERROR, "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, name_, lmin, *len); + class_name_, name_, lmin, *len); *len = lmin; return GRIB_BUFFER_TOO_SMALL; }