|
@@ -505,12 +505,8 @@ UA_Variant_matchVariableDefinition(UA_Server *server, const UA_NodeId *variableD
|
|
if(!UA_NodeId_equal(valueDataTypeId, variableDataTypeId)) {
|
|
if(!UA_NodeId_equal(valueDataTypeId, variableDataTypeId)) {
|
|
/* is this a subtype? */
|
|
/* is this a subtype? */
|
|
const UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
|
|
const UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
|
|
- UA_Boolean found = false;
|
|
|
|
- UA_StatusCode retval = isNodeInTree(server->nodestore, valueDataTypeId,
|
|
|
|
- variableDataTypeId, &subtypeId, 1, &found);
|
|
|
|
- if(retval != UA_STATUSCODE_GOOD)
|
|
|
|
- return retval;
|
|
|
|
- if(found)
|
|
|
|
|
|
+ if(isNodeInTree(server->nodestore, valueDataTypeId,
|
|
|
|
+ variableDataTypeId, &subtypeId, 1))
|
|
goto check_array;
|
|
goto check_array;
|
|
|
|
|
|
const UA_DataType *variableDataType = findDataType(variableDataTypeId);
|
|
const UA_DataType *variableDataType = findDataType(variableDataTypeId);
|
|
@@ -595,13 +591,12 @@ UA_VariableNode_setDataType(UA_Server *server, UA_VariableNode *node,
|
|
|
|
|
|
/* Does the new type match the constraints of the variabletype? */
|
|
/* Does the new type match the constraints of the variabletype? */
|
|
UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
|
|
UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
|
|
- UA_Boolean found = false;
|
|
|
|
- UA_StatusCode retval = isNodeInTree(server->nodestore, dataType,
|
|
|
|
- &vt->dataType, &subtypeId, 1, &found);
|
|
|
|
- if(retval != UA_STATUSCODE_GOOD || !found)
|
|
|
|
|
|
+ if(!isNodeInTree(server->nodestore, dataType,
|
|
|
|
+ &vt->dataType, &subtypeId, 1))
|
|
return UA_STATUSCODE_BADTYPEMISMATCH;
|
|
return UA_STATUSCODE_BADTYPEMISMATCH;
|
|
|
|
|
|
/* Check if the current value would match the new type */
|
|
/* Check if the current value would match the new type */
|
|
|
|
+ UA_StatusCode retval = UA_STATUSCODE_GOOD;
|
|
if(node->value.data.value.hasValue) {
|
|
if(node->value.data.value.hasValue) {
|
|
retval = UA_Variant_matchVariableDefinition(server, dataType, node->valueRank,
|
|
retval = UA_Variant_matchVariableDefinition(server, dataType, node->valueRank,
|
|
node->arrayDimensionsSize,
|
|
node->arrayDimensionsSize,
|