Stefan Profanter vor 7 Jahren
Ursprung
Commit
eb26a1e34b
3 geänderte Dateien mit 52 neuen und 52 gelöschten Zeilen
  1. 39 39
      src/server/ua_nodes.c
  2. 12 12
      src/server/ua_services_nodemanagement.c
  3. 1 1
      tests/testing-plugins/testing_clock.c

+ 39 - 39
src/server/ua_nodes.c

@@ -220,45 +220,45 @@ UA_Node_copy(const UA_Node *src, UA_Node *dst) {
 
 UA_Node *
 UA_Node_copy_alloc(const UA_Node *src) {
-	// use dstPtr to trick static code analysis in accepting dirty cast
-	void *dstPtr;
-	switch(src->nodeClass) {
-		case UA_NODECLASS_OBJECT:
-			dstPtr = UA_malloc(sizeof(UA_ObjectNode));
-			break;
-		case UA_NODECLASS_VARIABLE:
-			dstPtr =UA_malloc(sizeof(UA_VariableNode));
-			break;
-		case UA_NODECLASS_METHOD:
-			dstPtr = UA_malloc(sizeof(UA_MethodNode));
-			break;
-		case UA_NODECLASS_OBJECTTYPE:
-			dstPtr = UA_malloc(sizeof(UA_ObjectTypeNode));
-			break;
-		case UA_NODECLASS_VARIABLETYPE:
-			dstPtr = UA_malloc(sizeof(UA_VariableTypeNode));
-			break;
-		case UA_NODECLASS_REFERENCETYPE:
-			dstPtr = UA_malloc(sizeof(UA_ReferenceTypeNode));
-			break;
-		case UA_NODECLASS_DATATYPE:
-			dstPtr = UA_malloc(sizeof(UA_DataTypeNode));
-			break;
-		case UA_NODECLASS_VIEW:
-			dstPtr = UA_malloc(sizeof(UA_ViewNode));
-			break;
-		default:
-			return NULL;
-	}
-	UA_Node *dst = (UA_Node*)dstPtr;
-	dst->nodeClass = src->nodeClass;
-
-	UA_StatusCode retval = UA_Node_copy(src, dst);
-	if (retval != UA_STATUSCODE_GOOD){
-		UA_free(dst);
-		return NULL;
-	}
-	return dst;
+    // use dstPtr to trick static code analysis in accepting dirty cast
+    void *dstPtr;
+    switch(src->nodeClass) {
+        case UA_NODECLASS_OBJECT:
+            dstPtr = UA_malloc(sizeof(UA_ObjectNode));
+            break;
+        case UA_NODECLASS_VARIABLE:
+            dstPtr =UA_malloc(sizeof(UA_VariableNode));
+            break;
+        case UA_NODECLASS_METHOD:
+            dstPtr = UA_malloc(sizeof(UA_MethodNode));
+            break;
+        case UA_NODECLASS_OBJECTTYPE:
+            dstPtr = UA_malloc(sizeof(UA_ObjectTypeNode));
+            break;
+        case UA_NODECLASS_VARIABLETYPE:
+            dstPtr = UA_malloc(sizeof(UA_VariableTypeNode));
+            break;
+        case UA_NODECLASS_REFERENCETYPE:
+            dstPtr = UA_malloc(sizeof(UA_ReferenceTypeNode));
+            break;
+        case UA_NODECLASS_DATATYPE:
+            dstPtr = UA_malloc(sizeof(UA_DataTypeNode));
+            break;
+        case UA_NODECLASS_VIEW:
+            dstPtr = UA_malloc(sizeof(UA_ViewNode));
+            break;
+        default:
+            return NULL;
+    }
+    UA_Node *dst = (UA_Node*)dstPtr;
+    dst->nodeClass = src->nodeClass;
+
+    UA_StatusCode retval = UA_Node_copy(src, dst);
+    if (retval != UA_STATUSCODE_GOOD){
+        UA_free(dst);
+        return NULL;
+    }
+    return dst;
 }
 /******************************/
 /* Copy Attributes into Nodes */

+ 12 - 12
src/server/ua_services_nodemanagement.c

@@ -649,9 +649,9 @@ Operation_addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId
             referenceTypeId = &hasSubtype;
         const UA_Node *parentNode = UA_Nodestore_get(server, parentNodeId);
         if (parentNode) {
-			if (parentNode->nodeClass == node->nodeClass)
-				typeDefinitionId = parentNodeId;
-			UA_Nodestore_release(server, parentNode);
+            if (parentNode->nodeClass == node->nodeClass)
+                typeDefinitionId = parentNodeId;
+            UA_Nodestore_release(server, parentNode);
         }
     }
 
@@ -794,15 +794,15 @@ Operation_addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId
        node->nodeClass == UA_NODECLASS_OBJECT) {
         UA_assert(type != NULL); /* see above */
         /* Add (mandatory) child nodes from the type definition */
-		if (!server->bootstrapNS0) {
-			retval = addChildren(server, session, node, type);
-			if(retval != UA_STATUSCODE_GOOD) {
-				UA_LOG_INFO_SESSION(server->config.logger, session,
-									"AddNodes: Adding child nodes failed with error code %s",
-									UA_StatusCode_name(retval));
-				goto cleanup;
-			}
-		}
+        if (!server->bootstrapNS0) {
+            retval = addChildren(server, session, node, type);
+            if(retval != UA_STATUSCODE_GOOD) {
+                UA_LOG_INFO_SESSION(server->config.logger, session,
+                                    "AddNodes: Adding child nodes failed with error code %s",
+                                    UA_StatusCode_name(retval));
+                goto cleanup;
+            }
+        }
 
         /* Add a hasTypeDefinition reference */
         retval = addTypeDefRef(server, session, node, type);

+ 1 - 1
tests/testing-plugins/testing_clock.c

@@ -44,7 +44,7 @@ UA_fakeSleep(UA_UInt32 duration) {
 
 void
 UA_realSleep(UA_UInt32 duration) {
-	Sleep(duration);
+    Sleep(duration);
 }
 
 #else