diff --git a/src/iec61850/server/mms_mapping/mms_mapping.c b/src/iec61850/server/mms_mapping/mms_mapping.c index 813f9566..8e63e66c 100644 --- a/src/iec61850/server/mms_mapping/mms_mapping.c +++ b/src/iec61850/server/mms_mapping/mms_mapping.c @@ -139,7 +139,7 @@ createNamedVariableFromDataAttribute(DataAttribute* attribute) sizeof(MmsVariableSpecification)); namedVariable = namedVariable->typeSpec.array.elementTypeSpec; - if (attribute->firstChild && ((DataAttribute*)(attribute->firstChild))->type != IEC61850_CONSTRUCTED) { + if (attribute->type != IEC61850_CONSTRUCTED) { isBasicArray = true; } } @@ -160,7 +160,8 @@ createNamedVariableFromDataAttribute(DataAttribute* attribute) DataAttribute* subDataAttribute = (DataAttribute*) attribute->firstChild; int i = 0; - while (subDataAttribute != NULL) { + while (subDataAttribute) + { namedVariable->typeSpec.structure.elements[i] = createNamedVariableFromDataAttribute(subDataAttribute); diff --git a/src/iec61850/server/model/dynamic_model.c b/src/iec61850/server/model/dynamic_model.c index 9b0a53fd..790c9be3 100644 --- a/src/iec61850/server/model/dynamic_model.c +++ b/src/iec61850/server/model/dynamic_model.c @@ -688,7 +688,7 @@ DataAttribute_create(const char* name, ModelNode* parent, DataAttributeType type self->triggerOptions = triggerOptions; self->sAddr = sAddr; - if ((arrayElements > 0) && (type != IEC61850_CONSTRUCTED)) { + if (arrayElements > 0) { int i; for (i = 0; i < arrayElements; i++) { @@ -703,7 +703,7 @@ DataAttribute_create(const char* name, ModelNode* parent, DataAttributeType type arrayElement->fc = fc; arrayElement->firstChild = NULL; arrayElement->mmsValue = NULL; - arrayElement->parent = parent; + arrayElement->parent = (ModelNode*)self; arrayElement->sibling = NULL; arrayElement->triggerOptions = triggerOptions; arrayElement->sAddr = sAddr;