Stefan Profanter пре 7 година
родитељ
комит
50074dd5e3
2 измењених фајлова са 35 додато и 35 уклоњено
  1. 3 3
      plugins/ua_nodestore_default.c
  2. 32 32
      src/server/ua_nodes.c

+ 3 - 3
plugins/ua_nodestore_default.c

@@ -330,9 +330,9 @@ UA_NodeMap_insertNode(void *context, UA_Node *node,
     if(tempNodeid.identifierType == UA_NODEIDTYPE_NUMERIC &&
        tempNodeid.identifier.numeric == 0) {
         /* create a random nodeid */
-		/* start at least with 50,000 to make sure we don not conflict with nodes from the spec */
-		/* E.g. adding a nodeset will create children while there are still other nodes which need to be created */
-		/* Thus the node id's may collide */
+        /* start at least with 50,000 to make sure we don not conflict with nodes from the spec */
+        /* E.g. adding a nodeset will create children while there are still other nodes which need to be created */
+        /* Thus the node id's may collide */
         UA_UInt32 identifier = 50000 + ns->count+1; // start value
         UA_UInt32 size = ns->size;
         UA_UInt32 increase = mod2(ns->count+1, size);

+ 32 - 32
src/server/ua_nodes.c

@@ -251,38 +251,38 @@ copyCommonVariableAttributes(UA_VariableNode *node,
 
     /* Copy the value */
     node->valueSource = UA_VALUESOURCE_DATA;
-	UA_NodeId extensionObject = UA_NODEID_NUMERIC(0, UA_NS0ID_STRUCTURE);
-	/* if we have an extension object which is still encoded (e.g. from the nodeset compiler)
-	 * we need to decode it and set the decoded value instead of the encoded object */
-	UA_Boolean valueSet = false;
-	if (attr->value.type != NULL && UA_NodeId_equal(&attr->value.type->typeId, &extensionObject)) {
-		const UA_ExtensionObject *obj = (const UA_ExtensionObject *)attr->value.data;
-		if (obj->encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) {
-
-			const UA_DataType *type = UA_findDataTypeByBinary(&obj->content.encoded.typeId);
-
-			if (type) {
-				void *dst = UA_Array_new(attr->value.arrayLength, type);
-				uint8_t *tmpPos = (uint8_t *)dst;
-
-				for (size_t i=0; i<attr->value.arrayLength; i++) {
-					size_t offset =0;
-					const UA_ExtensionObject *curr = &((const UA_ExtensionObject *)attr->value.data)[i];
-					UA_StatusCode ret = UA_decodeBinary(&curr->content.encoded.body, &offset, tmpPos, type, 0, NULL);
-					if (ret != UA_STATUSCODE_GOOD) {
-						return ret;
-					}
-					tmpPos += type->memSize;
-				}
-
-				UA_Variant_setArray(&node->value.data.value.value, dst, attr->value.arrayLength, type);
-				valueSet = true;
-			}
-		}
-	}
-
-	if (!valueSet)
-		retval |= UA_Variant_copy(&attr->value, &node->value.data.value.value);
+    UA_NodeId extensionObject = UA_NODEID_NUMERIC(0, UA_NS0ID_STRUCTURE);
+    /* if we have an extension object which is still encoded (e.g. from the nodeset compiler)
+     * we need to decode it and set the decoded value instead of the encoded object */
+    UA_Boolean valueSet = false;
+    if (attr->value.type != NULL && UA_NodeId_equal(&attr->value.type->typeId, &extensionObject)) {
+        const UA_ExtensionObject *obj = (const UA_ExtensionObject *)attr->value.data;
+        if (obj->encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) {
+
+            const UA_DataType *type = UA_findDataTypeByBinary(&obj->content.encoded.typeId);
+
+            if (type) {
+                void *dst = UA_Array_new(attr->value.arrayLength, type);
+                uint8_t *tmpPos = (uint8_t *)dst;
+
+                for (size_t i=0; i<attr->value.arrayLength; i++) {
+                    size_t offset =0;
+                    const UA_ExtensionObject *curr = &((const UA_ExtensionObject *)attr->value.data)[i];
+                    UA_StatusCode ret = UA_decodeBinary(&curr->content.encoded.body, &offset, tmpPos, type, 0, NULL);
+                    if (ret != UA_STATUSCODE_GOOD) {
+                        return ret;
+                    }
+                    tmpPos += type->memSize;
+                }
+
+                UA_Variant_setArray(&node->value.data.value.value, dst, attr->value.arrayLength, type);
+                valueSet = true;
+            }
+        }
+    }
+
+    if (!valueSet)
+        retval |= UA_Variant_copy(&attr->value, &node->value.data.value.value);
 
     node->value.data.value.hasValue = true;