mirror of https://github.com/ecmwf/eccodes.git
Modernisation: get class name via function call
This commit is contained in:
parent
ca1dc5e270
commit
768d41983d
|
@ -49,7 +49,7 @@ int grib_accessor_ascii_t::unpack_string(char* val, size_t* len)
|
|||
if (*len < (alen + 1)) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR,
|
||||
"%s: Buffer too small for %s. It is %zu bytes long (len=%zu)",
|
||||
class_name_, name_, alen + 1, *len);
|
||||
getClassName().get().c_str(), name_, alen + 1, *len);
|
||||
*len = alen + 1;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ int grib_accessor_bitmap_t::unpack_string(char* val, size_t* len)
|
|||
if (*len < l) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR,
|
||||
"%s: Buffer too small for %s. It is %zu bytes long (len=%zu)",
|
||||
class_name_, name_, l, *len);
|
||||
getClassName().get().c_str(), name_, l, *len);
|
||||
*len = l;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ grib_accessor* grib_accessor_bufr_data_element_t::make_clone(grib_section* s, in
|
|||
creator.name_space = (char*)"";
|
||||
creator.set = 0;
|
||||
creator.name = (char*)"unknown";
|
||||
if (strcmp(class_name_, "bufr_data_element")) {
|
||||
grib_context_log(context_, GRIB_LOG_FATAL, "wrong accessor type: '%s' should be '%s'", class_name_, "bufr_data_element");
|
||||
if (strcmp(getClassName().get().c_str(), "bufr_data_element")) {
|
||||
grib_context_log(context_, GRIB_LOG_FATAL, "wrong accessor type: '%s' should be '%s'", getClassName().get().c_str(), "bufr_data_element");
|
||||
}
|
||||
*err = 0;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
if (*val == 0)
|
||||
return GRIB_SUCCESS;
|
||||
|
|
|
@ -443,7 +443,7 @@ int codes_codetable_get_contents_malloc(const grib_handle* h, const char* key, c
|
|||
grib_accessor* aa = grib_find_accessor(h, key);
|
||||
if (!aa) return GRIB_NOT_FOUND;
|
||||
|
||||
if (!STR_EQUAL(aa->class_name_, "codetable")) {
|
||||
if (!STR_EQUAL(aa->getClassName().get().c_str(), "codetable")) {
|
||||
return GRIB_INVALID_ARGUMENT; // key is not a codetable
|
||||
}
|
||||
|
||||
|
@ -607,7 +607,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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);
|
||||
|
|
|
@ -54,7 +54,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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);
|
||||
|
|
|
@ -55,7 +55,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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);
|
||||
|
|
|
@ -399,7 +399,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
fprintf(stderr, "ECCODES DEBUG %s::%s: Changing %s from %ld to %ld\n",
|
||||
cclass_name, __func__, name_, *val, newParamId);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
int err = GRIB_SUCCESS;
|
||||
size_t buflen = 0, i = 0;
|
||||
bool is_constant_field = false;
|
||||
|
@ -381,7 +381,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len)
|
|||
grib_accessor_data_ccsds_packing_t* self = (grib_accessor_data_ccsds_packing_t*)a;
|
||||
static_assert(std::is_floating_point<T>::value, "Requires floating point numbers");
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
const char* cclass_name = a->class_name_;
|
||||
const char* cclass_name = a->getClassName().get().c_str();
|
||||
|
||||
int err = GRIB_SUCCESS, i = 0;
|
||||
size_t buflen = 0;
|
||||
|
|
|
@ -168,7 +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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
size_t i = 0;
|
||||
int ret = GRIB_SUCCESS;
|
||||
|
@ -539,7 +539,7 @@ static int unpack_real(grib_accessor* a, T* val, size_t* len)
|
|||
grib_accessor_data_complex_packing_t* self = (grib_accessor_data_complex_packing_t*)a;
|
||||
static_assert(std::is_floating_point<T>::value, "Requires floating point numbers");
|
||||
grib_handle* gh = grib_handle_of_accessor(a);
|
||||
const char* cclass_name = a->class_name_;
|
||||
const char* cclass_name = a->getClassName().get().c_str();
|
||||
|
||||
size_t i = 0;
|
||||
int ret = GRIB_SUCCESS;
|
||||
|
|
|
@ -177,7 +177,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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
grib_context_log(context_, GRIB_LOG_ERROR, "%s: %s: Not implemented", cclass_name, __func__);
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -774,7 +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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
int err = 0;
|
||||
|
||||
|
@ -1464,7 +1464,7 @@ static int unpack(grib_accessor* a, T* val, const size_t* len)
|
|||
{
|
||||
grib_accessor_data_g22order_packing_t* self = reinterpret_cast<grib_accessor_data_g22order_packing_t*>(a);
|
||||
static_assert(std::is_floating_point<T>::value, "Requires floating points numbers");
|
||||
const char* cclass_name = a->class_name_;
|
||||
const char* cclass_name = a->getClassName().get().c_str();
|
||||
grib_handle* gh = grib_handle_of_accessor(a);
|
||||
|
||||
size_t i = 0;
|
||||
|
|
|
@ -566,7 +566,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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
size_t buflen = 0;
|
||||
size_t hsize = 0;
|
||||
|
|
|
@ -216,7 +216,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
dirty_ = 1;
|
||||
|
||||
|
|
|
@ -234,7 +234,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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
int err = GRIB_SUCCESS;
|
||||
bool is_constant_field = false;
|
||||
|
|
|
@ -35,7 +35,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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;
|
||||
|
@ -140,7 +140,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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;
|
||||
|
|
|
@ -40,7 +40,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
long sub_j = 0;
|
||||
long sub_k = 0;
|
||||
|
|
|
@ -67,7 +67,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
long n_vals = 0;
|
||||
int err = 0;
|
||||
|
@ -163,7 +163,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len)
|
|||
grib_accessor_data_simple_packing_t* self = (grib_accessor_data_simple_packing_t*)a;
|
||||
static_assert(std::is_floating_point<T>::value, "Requires floating point numbers");
|
||||
|
||||
const char* cclass_name = a->class_name_;
|
||||
const char* cclass_name = a->getClassName().get().c_str();
|
||||
grib_handle* gh = grib_handle_of_accessor(a);
|
||||
unsigned char* buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data;
|
||||
|
||||
|
@ -315,7 +315,7 @@ static int _unpack_double(grib_accessor* a, double* val, size_t* len, unsigned c
|
|||
{
|
||||
grib_accessor_data_simple_packing_t* self = (grib_accessor_data_simple_packing_t*)a;
|
||||
grib_handle* gh = grib_handle_of_accessor(a);
|
||||
const char* cclass_name = a->class_name_;
|
||||
const char* cclass_name = a->getClassName().get().c_str();
|
||||
|
||||
size_t i = 0;
|
||||
int err = 0;
|
||||
|
@ -459,7 +459,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* cclass_name = getClassName().get().c_str();
|
||||
|
||||
size_t i = 0;
|
||||
size_t n_vals = *len;
|
||||
|
|
|
@ -25,7 +25,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
unpack_double(&val, &l);
|
||||
if ((val == GRIB_MISSING_DOUBLE) && ((flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0)) {
|
||||
|
|
|
@ -65,7 +65,7 @@ int grib_accessor_from_scale_factor_scaled_value_t::pack_double(const double* va
|
|||
factor_accessor_num_bits = factor_accessor->length_ * 8;
|
||||
maxval_value = (1UL << value_accessor_num_bits) - 2; // exclude missing
|
||||
maxval_factor = (1UL << factor_accessor_num_bits) - 2; // exclude missing
|
||||
if (strcmp(factor_accessor->class_name_, "signed") == 0) {
|
||||
if (strcmp(factor_accessor->getClassName().get().c_str(), "signed") == 0) {
|
||||
maxval_factor = (1UL << (factor_accessor_num_bits - 1)) - 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
grib_context_log(context_, GRIB_LOG_ERROR,
|
||||
"%s %s: Failed to set GRIB1 message length to %ld"
|
||||
" (actual length=%ld)",
|
||||
|
|
|
@ -65,7 +65,7 @@ int grib_accessor_g2date_t::pack_long(const long* val, size_t* len)
|
|||
if (!is_date_valid(year, month, day, 0, 0, 0)) {
|
||||
// ECC-1777: For now just a warning. Will later change to an error
|
||||
fprintf(stderr, "ECCODES WARNING : %s:%s: Date is not valid! year=%ld month=%ld day=%ld\n",
|
||||
class_name_, __func__, year, month, day);
|
||||
getClassName().get().c_str(), __func__, year, month, day);
|
||||
}
|
||||
|
||||
if ((ret = grib_set_long_internal(grib_handle_of_accessor(this), day_, day)) != GRIB_SUCCESS)
|
||||
|
|
|
@ -495,7 +495,7 @@ static int pack_long_(grib_accessor* a, const long end_step_value, const long en
|
|||
grib_context_log(h->context, GRIB_LOG_ERROR,
|
||||
"%s:%s: Date/Time is not valid! "
|
||||
"year=%ld month=%ld day=%ld hour=%ld minute=%ld second=%ld",
|
||||
a->class_name_, __func__, year, month, day, hour, minute, second);
|
||||
a->getClassName().get().c_str(), __func__, year, month, day, hour, minute, second);
|
||||
return GRIB_DECODING_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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);
|
||||
|
|
|
@ -112,7 +112,7 @@ long grib_accessor_gen_t::byte_count()
|
|||
long grib_accessor_gen_t::get_native_type()
|
||||
{
|
||||
grib_context_log(context_, GRIB_LOG_ERROR,
|
||||
"Accessor %s [%s] must implement 'get_native_type'", name_, class_name_);
|
||||
"Accessor %s [%s] must implement 'get_native_type'", name_, getClassName().get().c_str());
|
||||
return GRIB_TYPE_UNDEFINED;
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ int grib_accessor_gen_t::pack_double(const double* v, size_t* len)
|
|||
is_overridden_[PACK_DOUBLE] = 0;
|
||||
grib_context* c = context_;
|
||||
|
||||
if (is_overridden_[PACK_LONG] || strcmp(class_name_, "codetable") == 0) {
|
||||
if (is_overridden_[PACK_LONG] || strcmp(getClassName().get().c_str(), "codetable") == 0) {
|
||||
/* ECC-648: Special case of codetable */
|
||||
return pack_double_array_as_long(this, v, len);
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ int grib_accessor_gen_t::notify_change(grib_accessor* observed)
|
|||
void grib_accessor_gen_t::update_size(size_t s)
|
||||
{
|
||||
grib_context_log(context_, GRIB_LOG_FATAL,
|
||||
"Accessor %s [%s] must implement 'update_size'", name_, class_name_);
|
||||
"Accessor %s [%s] must implement 'update_size'", name_, getClassName().get().c_str());
|
||||
}
|
||||
|
||||
grib_accessor* grib_accessor_gen_t::next_accessor()
|
||||
|
@ -540,7 +540,7 @@ int grib_accessor_gen_t::unpack_double_subarray(double* val, size_t start, size_
|
|||
grib_accessor* grib_accessor_gen_t::clone(grib_section* s, int* err)
|
||||
{
|
||||
grib_context* ct = context_;
|
||||
grib_context_log(ct, GRIB_LOG_DEBUG, "clone %s ==> %s", class_name_, name_);
|
||||
grib_context_log(ct, GRIB_LOG_DEBUG, "clone %s ==> %s", getClassName().get().c_str(), name_);
|
||||
return make_clone(s, err);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ int grib_accessor_group_t::unpack_string(char* val, size_t* len)
|
|||
if (*len < l) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR,
|
||||
"%s: Buffer too small for %s. It is %zu bytes long (len=%zu)",
|
||||
class_name_, name_, l, *len);
|
||||
getClassName().get().c_str(), name_, l, *len);
|
||||
*len = l;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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);
|
||||
|
|
|
@ -57,7 +57,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
if (!stepRangeAcc) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR, "%s: %s not found", cclass_name, stepRange_);
|
||||
|
|
|
@ -88,7 +88,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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);
|
||||
|
|
|
@ -34,7 +34,7 @@ void grib_accessor_message_t::update_size(size_t new_size)
|
|||
|
||||
void grib_accessor_message_t::resize(size_t new_size)
|
||||
{
|
||||
grib_context_log(context_, GRIB_LOG_FATAL, "%s %s: Not supported", class_name_, __func__);
|
||||
grib_context_log(context_, GRIB_LOG_FATAL, "%s %s: Not supported", getClassName().get().c_str(), __func__);
|
||||
|
||||
// void* zero = grib_context_malloc_clear(context_ , new_size);
|
||||
// grib_buffer_replace(a, (const unsigned char*)zero, new_size, 1, 0);
|
||||
|
@ -59,7 +59,7 @@ int grib_accessor_message_t::unpack_string(char* val, size_t* len)
|
|||
if (*len < l) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR,
|
||||
"%s: Buffer too small for %s. It is %zu bytes long (len=%zu)",
|
||||
class_name_, name_, l, *len);
|
||||
getClassName().get().c_str(), name_, l, *len);
|
||||
*len = l;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ int grib_accessor_offset_file_t::unpack_string(char* v, size_t* len)
|
|||
0,
|
||||
};
|
||||
int err = 0;
|
||||
const char* cclass_name = class_name_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
err = unpack_double(&val, &l);
|
||||
if (err) return err;
|
||||
|
|
|
@ -45,7 +45,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
|
||||
if (strcmp(e->cclass->name, "long") == 0) {
|
||||
grib_expression_evaluate_long(hand, e, &lval); /* TODO: check return value */
|
||||
|
|
|
@ -41,7 +41,7 @@ void grib_accessor_padding_t::resize(size_t new_size)
|
|||
|
||||
grib_context_log(context_, GRIB_LOG_DEBUG,
|
||||
"grib_accessor_padding::resize new_size=%zu length_ =%ld %s %s",
|
||||
new_size, length_, class_name_, name_);
|
||||
new_size, length_, getClassName().get().c_str(), name_);
|
||||
Assert(new_size == length_);
|
||||
}
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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);
|
||||
|
|
|
@ -69,7 +69,7 @@ int grib_accessor_time_t::pack_long(const long* val, size_t* len)
|
|||
if (!is_time_valid(v)) {
|
||||
// ECC-1777: For now just a warning. Will later change to an error
|
||||
fprintf(stderr, "ECCODES WARNING : %s:%s: Time is not valid! hour=%ld min=%ld sec=%ld\n",
|
||||
class_name_, __func__, hour, minute, second);
|
||||
getClassName().get().c_str(), __func__, hour, minute, second);
|
||||
// return GRIB_ENCODING_ERROR;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ int grib_accessor_time_t::unpack_string(char* val, size_t* len)
|
|||
if (*len < lmin) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR,
|
||||
"%s: Buffer too small for %s. It is %zu bytes long (len=%zu)",
|
||||
class_name_, name_, lmin, *len);
|
||||
getClassName().get().c_str(), name_, lmin, *len);
|
||||
*len = lmin;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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);
|
||||
|
|
|
@ -64,7 +64,7 @@ int grib_accessor_to_string_t::unpack_string(char* val, size_t* len)
|
|||
size_t length = string_length();
|
||||
|
||||
if (*len < length + 1) {
|
||||
const char* cclass_name = class_name_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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);
|
||||
|
|
|
@ -98,7 +98,7 @@ 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_;
|
||||
const char* cclass_name = getClassName().get().c_str();
|
||||
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);
|
||||
|
|
|
@ -227,7 +227,7 @@ int grib_accessor_variable_t::unpack_string(char* val, size_t* len)
|
|||
if (*len < slen) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR,
|
||||
"%s: Buffer too small for %s. It is %zu bytes long (len=%zu)",
|
||||
class_name_, name_, slen, *len);
|
||||
getClassName().get().c_str(), name_, slen, *len);
|
||||
*len = slen;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator,
|
|||
else {
|
||||
grib_context_log(p->h->context, GRIB_LOG_DEBUG,
|
||||
"CREATE: name=%s class=%s offset=%ld length=%ld action=",
|
||||
a->name_, a->class_name_, a->offset_, a->length_);
|
||||
a->name_, a->getClassName().get().c_str(), a->offset_, a->length_);
|
||||
|
||||
grib_grow_buffer(p->h->context, p->h->buffer, size);
|
||||
p->h->buffer->ulength = size;
|
||||
|
|
|
@ -105,7 +105,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
|
|||
|
||||
if ((a->flags_ & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0 &&
|
||||
(d->option_flags & GRIB_DUMP_FLAG_READ_ONLY) == 0 &&
|
||||
(strcmp(a->class_name_, "lookup") != 0))
|
||||
(strcmp(a->getClassName().get().c_str(), "lookup") != 0))
|
||||
return;
|
||||
|
||||
if (((a->flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && (value == GRIB_MISSING_LONG))
|
||||
|
@ -114,7 +114,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
|
|||
fprintf(self->dumper.out, "%s = %ld", a->name_, value);
|
||||
|
||||
if (((a->flags_ & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) &&
|
||||
(strcmp(a->class_name_, "lookup") != 0))
|
||||
(strcmp(a->getClassName().get().c_str(), "lookup") != 0))
|
||||
fprintf(self->dumper.out, " (read_only)");
|
||||
|
||||
//if(comment) fprintf(self->dumper.out," [%s]",comment);
|
||||
|
|
|
@ -681,7 +681,7 @@ int grib_accessor_can_be_missing(grib_accessor* a, int* err)
|
|||
if (a->flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) {
|
||||
return 1;
|
||||
}
|
||||
if (STR_EQUAL(a->class_name_, "codetable")) {
|
||||
if (STR_EQUAL(a->getClassName().get().c_str(), "codetable")) {
|
||||
// Special case of Code Table keys
|
||||
// The vast majority have a 'Missing' entry
|
||||
return 1;
|
||||
|
|
|
@ -647,7 +647,7 @@ static int test_bit(long a, long b)
|
|||
/* If the accessor represents a codeflag key, then return its binary rep in 'result' */
|
||||
static int codeflag_to_bitstr(grib_accessor* a, long val, char* result)
|
||||
{
|
||||
if (a && grib_inline_strcmp(a->class_name_, "codeflag") == 0) {
|
||||
if (a && grib_inline_strcmp(a->getClassName().get().c_str(), "codeflag") == 0) {
|
||||
long i;
|
||||
const long bytelen = a->length_ * 8;
|
||||
for (i = 0; i < bytelen; i++) {
|
||||
|
|
Loading…
Reference in New Issue