mirror of https://github.com/ecmwf/eccodes.git
Initialize all data members
This commit is contained in:
parent
78578782f7
commit
f6d42954d2
|
@ -61,26 +61,26 @@ int grib_accessor::add_attribute(grib_accessor* attr, int nest_if_clash)
|
|||
{
|
||||
int id = 0;
|
||||
int idx = 0;
|
||||
grib_accessor* same = NULL;
|
||||
grib_accessor* aloc = this;
|
||||
grib_accessor* pSame = NULL;
|
||||
grib_accessor* pAloc = this;
|
||||
|
||||
if (this->has_attributes()) {
|
||||
same = this->get_attribute_index(attr->name, &id);
|
||||
pSame = this->get_attribute_index(attr->name, &id);
|
||||
}
|
||||
|
||||
if (same) {
|
||||
if (pSame) {
|
||||
if (nest_if_clash == 0)
|
||||
return GRIB_ATTRIBUTE_CLASH;
|
||||
aloc = same;
|
||||
pAloc = pSame;
|
||||
}
|
||||
|
||||
for (id = 0; id < MAX_ACCESSOR_ATTRIBUTES; id++) {
|
||||
if (aloc->attributes[id] == NULL) {
|
||||
if (pAloc->attributes[id] == NULL) {
|
||||
// attr->parent=a->parent;
|
||||
aloc->attributes[id] = attr;
|
||||
attr->parent_as_attribute = aloc;
|
||||
if (aloc->same)
|
||||
attr->same = aloc->same->get_attribute_index(attr->name, &idx);
|
||||
pAloc->attributes[id] = attr;
|
||||
attr->parent_as_attribute = pAloc;
|
||||
if (pAloc->same)
|
||||
attr->same = pAloc->same->get_attribute_index(attr->name, &idx);
|
||||
|
||||
grib_context_log(this->context, GRIB_LOG_DEBUG, "added attribute %s->%s", this->name, attr->name);
|
||||
return GRIB_SUCCESS;
|
||||
|
|
|
@ -16,7 +16,11 @@
|
|||
class grib_accessor
|
||||
{
|
||||
public:
|
||||
grib_accessor() : name(nullptr), name_space(nullptr), context(nullptr), h(nullptr), creator(nullptr), length(0), offset(0), parent(nullptr), next_(nullptr), previous_(nullptr), cclass(nullptr), flags(0), sub_section(nullptr), dirty(0), same(nullptr), loop(0), vvalue(nullptr), set(nullptr), parent_as_attribute(nullptr) {}
|
||||
grib_accessor() :
|
||||
name(nullptr), name_space(nullptr), context(nullptr), h(nullptr), creator(nullptr),
|
||||
length(0), offset(0), parent(nullptr), next_(nullptr), previous_(nullptr), cclass(nullptr),
|
||||
flags(0), sub_section(nullptr), dirty(0), same(nullptr), loop(0), vvalue(nullptr),
|
||||
set(nullptr), parent_as_attribute(nullptr) {}
|
||||
virtual ~grib_accessor() {}
|
||||
|
||||
virtual void init_accessor(const long, grib_arguments*) = 0;
|
||||
|
@ -78,15 +82,15 @@ public:
|
|||
unsigned long flags; /** < Various flags */
|
||||
grib_section* sub_section;
|
||||
|
||||
const char* all_names[MAX_ACCESSOR_NAMES]; /** < name of the accessor */
|
||||
const char* all_name_spaces[MAX_ACCESSOR_NAMES]; /** < namespace to which the accessor belongs */
|
||||
const char* all_names[MAX_ACCESSOR_NAMES]= {0,}; /** < name of the accessor */
|
||||
const char* all_name_spaces[MAX_ACCESSOR_NAMES] = {0,}; /** < namespace to which the accessor belongs */
|
||||
int dirty;
|
||||
|
||||
grib_accessor* same; /** < accessors with the same name */
|
||||
long loop; /** < used in lists */
|
||||
grib_virtual_value* vvalue; /** < virtual value used when transient flag on **/
|
||||
const char* set;
|
||||
grib_accessor* attributes[MAX_ACCESSOR_ATTRIBUTES]; /** < attributes are accessors */
|
||||
grib_accessor* attributes[MAX_ACCESSOR_ATTRIBUTES] = {0,}; /** < attributes are accessors */
|
||||
grib_accessor* parent_as_attribute;
|
||||
};
|
||||
|
||||
|
@ -141,5 +145,3 @@ public:
|
|||
virtual int clear(grib_accessor*) = 0;
|
||||
virtual grib_accessor* make_clone(grib_accessor*, grib_section*, int*) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue