|
@@ -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 */
|