File: C:/Redmine-4.x/redmine-4.2.9/files/180305100936_OpenOpcUa.20180305.diff
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/include/ClientSession.h OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/include/ClientSession.h
244a245
> OpcUa_Semaphore m_StopWatchingSem;
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/include/MonitoredItemsNotification.h OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/include/MonitoredItemsNotification.h
55c55
< void SetNoOfMonitoredItems(OpcUa_Int32 iVal);
---
> // void SetNoOfMonitoredItems(OpcUa_Int32 iVal);
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/include/OpenOpcUaClientLib.h OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/include/OpenOpcUaClientLib.h
95a96
> OpcUa_StatusCode OpenOpcUa_Field_Clear(OpenOpcUa_Field* pField); // Not exported
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/ClientApplication.cpp OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/ClientApplication.cpp
937c937,938
< OpcUa_Thread_Delete(&m_hInternalMessageThread);
---
> //OpcUa_Thread_Delete(m_hInternalMessageThread);
> m_hInternalMessageThread = OpcUa_Null;
942c943
< OpcUa_Thread_Delete(m_hInternalMessageThread);
---
> //OpcUa_Thread_Delete(m_hInternalMessageThread);
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/ClientSession.cpp OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/ClientSession.cpp
129c129,130
< OpcUa_Free(pData);
---
> // free callback data at the end
> //OpcUa_Free(pData);
236c237,239
< pMonitoredItems->SetNoOfMonitoredItems(pNotificationResponse->NoOfMonitoredItems);
---
> // Number of MonitoredItems should be set in SetMonitoredItemNotification
> // to maintain consistency between monitored items and its count
> //pMonitoredItems->SetNoOfMonitoredItems(pNotificationResponse->NoOfMonitoredItems);
239a243
> OpcUa_Boolean bAdded = OpcUa_False;
242a247
> {
243a249,250
> bAdded = OpcUa_True;
> }
244a252,253
> if (!bAdded)
> delete pMonitoredItems;
324a334,335
> // Free callback data
> OpcUa_Free(a_pCallbackData);
340a352
> OpcUa_Semaphore_Create(&m_StopWatchingSem,0,0x100);
394a407
> OpcUa_Semaphore_Create(&m_StopWatchingSem,0,0x100);
431a445
> OpcUa_Semaphore_Delete(&m_StopWatchingSem);
1312a1327
> delete pContinuationPoints;
1542a1558,1561
> OpcUa_ResponseHeader_Clear(&tResponseHeader);
> for (OpcUa_Int32 i = 0; i < nNoOfDiagnosticInfos && pDiagnosticInfos != OpcUa_Null; i++)
> OpcUa_DiagnosticInfo_Clear(&pDiagnosticInfos[i]);
> OpcUa_Free(pDiagnosticInfos);
1718c1737
< uStatus = OpcUa_Semaphore_TimedWait(m_WatchingSem, 15000); // 15 secondes max.
---
> uStatus = OpcUa_Semaphore_TimedWait(m_StopWatchingSem, 15000); // 15 secondes max.
1723c1742
< OpcUa_Thread_Delete(&m_hInternalWatchingThread);
---
> //OpcUa_Thread_Delete(m_hInternalWatchingThread);
1729c1748
< OpcUa_Thread_Delete(m_hInternalWatchingThread);
---
> //OpcUa_Thread_Delete(m_hInternalWatchingThread);
1883c1902
< OpcUa_Semaphore_Post(pSession->m_WatchingSem, 1);
---
> OpcUa_Semaphore_Post(pSession->m_StopWatchingSem, 1);
2038c2057
< OpcUa_Mutex_Lock(m_SubscriptionListMutex);
---
> //OpcUa_Mutex_Lock(m_SubscriptionListMutex);
2046,2047c2065,2066
< if (m_hPublishingThread)
< OpcUa_Thread_Delete(&m_hPublishingThread);
---
> //if (m_hPublishingThread)
> // OpcUa_Thread_Delete(m_hPublishingThread);
2052c2071
< OpcUa_Thread_Delete(m_hPublishingThread);
---
> //OpcUa_Thread_Delete(m_hPublishingThread);
2056c2075
< OpcUa_Mutex_Unlock(m_SubscriptionListMutex);
---
> //OpcUa_Mutex_Unlock(m_SubscriptionListMutex);
3448c3467,3468
< OpcUa_Thread_Delete(m_hAutoConnectThread);
---
> //OpcUa_Thread_Delete(m_hAutoConnectThread);
> m_hAutoConnectThread = OpcUa_Null;
3452c3472,3473
< OpcUa_Thread_Delete(m_hAutoConnectThread);
---
> //OpcUa_Thread_Delete(m_hAutoConnectThread);
> m_hAutoConnectThread = OpcUa_Null;
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/MonitoredItemsNotification.cpp OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/MonitoredItemsNotification.cpp
74,75c74,76
< m_pMonitoredItemNotification = (OpcUa_MonitoredItemNotification*)OpcUa_Alloc(iNoOfMonitoredItems*sizeof(OpcUa_MonitoredItemNotification));
< for (OpcUa_Int32 i = 0; i < iNoOfMonitoredItems; i++)
---
> m_iNoOfMonitoredItems = iNoOfMonitoredItems;
> m_pMonitoredItemNotification = (OpcUa_MonitoredItemNotification*)OpcUa_Alloc(m_iNoOfMonitoredItems*sizeof(OpcUa_MonitoredItemNotification));
> for (OpcUa_Int32 i = 0; i < m_iNoOfMonitoredItems; i++)
96a98
> /*
100c102,103
< }
\ No newline at end of file
---
> }
> */
\ No newline at end of file
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/OpenOpcUaClientLib.cpp OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/OpenOpcUaClientLib.cpp
1158c1158
< pItemsToCreateRequest[i].RequestedParameters.Filter.Body.EncodeableObject.Type = (OpcUa_EncodeableType*)OpcUa_Alloc(sizeof(OpcUa_EncodeableType));
---
> //pItemsToCreateRequest[i].RequestedParameters.Filter.Body.EncodeableObject.Type = (OpcUa_EncodeableType*)OpcUa_Alloc(sizeof(OpcUa_EncodeableType));
1197a1198
> OpcUa_MonitoredItemCreateResult_Clear(&pResult[ii]);
1198a1200
> OpcUa_Free(pResult);
1201a1204,1216
>
> // Free filter used
> for (OpcUa_UInt32 i = 0; i < NoOfItemsToCreate; i++)
> {
> OpcUa_DataChangeFilter* pDataChangeFilter = (OpcUa_DataChangeFilter*) pItemsToCreateRequest[i].RequestedParameters.Filter.Body.EncodeableObject.Object;
> if (pDataChangeFilter != OpcUa_Null)
> {
> OpcUa_DataChangeFilter_Clear(pDataChangeFilter);
> OpcUa_Free(pDataChangeFilter);
> }
> }
> OpcUa_Free(pItemsToCreateRequest);
> OpcUa_Free(hMonitoredItems);
2540a2556
> OpcUa_NodeId_Clear(&pReferenceList->m_ParentNodeId); // may overwriting pReferenceList->m_ParentNodeId
2560c2576
< delete pReferenceDescription;
---
> OpcUa_Free(pReferenceDescription);
2638c2654
< delete pReferenceDescription;
---
> OpcUa_Free(pReferenceDescription);
3665c3681
< OpcUa_StringA pEncodedData = (OpcUa_StringA)OpcUa_Alloc(dataTypeDictionnaries[i].Length);
---
> OpcUa_StringA pEncodedData = (OpcUa_StringA)OpcUa_Alloc(dataTypeDictionnaries[i].Length + 1);
3668c3684
< ZeroMemory(pEncodedData, dataTypeDictionnaries[i].Length);
---
> ZeroMemory(pEncodedData, dataTypeDictionnaries[i].Length + 1);
3689a3706,3709
> // clean up
> OpcUa_Free(pBytes);
> pBytes = OpcUa_Null;
> OpcUa_Free(pEncodedData);
3719a3740,3744
> // clean up
> OpcUa_QualifiedName_Clear(&dataTypeBrowseName);
> for (OpcUa_UInt32 i = 0; i < uiNoOfDataTypeDictionnary; i++)
> OpcUa_ByteString_Clear(&dataTypeDictionnaries[i]);
> OpcUa_Free(dataTypeDictionnaries);
4072a4098,4099
> OpcUa_ReadValueId_Clear(pNodesToRead);
> OpcUa_Free(pNodesToRead);
4082c4109
< (*ppDataTypeDictionnaries) = (OpcUa_ByteString*)OpcUa_Alloc(sizeof(OpcUa_ByteString));
---
> (*ppDataTypeDictionnaries) = (OpcUa_ByteString*)OpcUa_Alloc((*puiNodeOfDataTypeDictionnary) * sizeof(OpcUa_ByteString));
4087a4115,4117
> //
> OpcUa_ByteString_Clear(pdataTypeDisctionnary);
> OpcUa_Free(pdataTypeDisctionnary);
4095a4126,4142
>
> #define VarriantArray_SetAt(xArray, nIndex, xValue, xType) \
> { \
> (xArray)[nIndex].Datatype = (OpcUa_Byte) OpcUaType_##xType; \
> OpcUa_##xType##_Initialize(&(xArray)[nIndex].Value.xType); \
> OpcUa_##xType##_CopyTo(xValue, &(xArray)[nIndex].Value.xType); \
> }
>
> #define VarriantArray_SetAtP(xArray, nIndex, xValue, xType) \
> { \
> if (OpcUa_Null == (xArray)[nIndex].Value.xType) \
> (xArray)[nIndex].Value.xType = (OpcUa_##xType*) OpcUa_Alloc(sizeof(OpcUa_##xType)); \
> (xArray)[nIndex].Datatype = (OpcUa_Byte) OpcUaType_##xType; \
> OpcUa_##xType##_Initialize((xArray)[nIndex].Value.xType); \
> OpcUa_##xType##_CopyTo(xValue, (xArray)[nIndex].Value.xType); \
> }
>
4111a4159
> OpcUa_Boolean bHandled = OpcUa_False;
4113c4161
< for (OpcUa_UInt32 i = 0; i < uiSize; i++)
---
> if (rawValue.Value.ExtensionObject->Body.EncodeableObject.Type)
4115,4116c4163
< OpenOpcUa_Field* pField = pDefinition->m_pFields[i];
< if (pField->m_DataType.NamespaceIndex == 0)
---
> if (OpcUaId_ServerStatusDataType == rawValue.Value.ExtensionObject->Body.EncodeableObject.Type->TypeId)
4118,4205c4165,4189
< switch (pField->m_DataType.Identifier.Numeric)
< {
< case OpcUaType_Boolean:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Boolean), 1, pObject, 1);
< ((OpcUa_Byte*&)pObject) += 1; //
< }
< break;
< case OpcUaType_SByte:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.SByte), 1, pObject, 1);
< ((OpcUa_Byte*&)pObject) += 1; //
< }
< break;
< case OpcUaType_Byte:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Byte), 1, pObject, 1);
< ((OpcUa_Byte*&)pObject) += 1; //
< }
< break;
< case OpcUaType_Int16:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Int16), 2, pObject, 2);
< ((OpcUa_Byte*&)pObject) += 2; //
< }
< break;
< case OpcUaType_UInt16:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.UInt16), 2, pObject, 2);
< ((OpcUa_Byte*&)pObject) += 2; //
< }
< break;
< case OpcUaType_Int32:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Int32), 4, pObject, 4);
< ((OpcUa_Byte*&)pObject) += 4; //
< }
< break;
< case OpcUaType_UInt32:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.UInt32), 4, pObject, 4);
< ((OpcUa_Byte*&)pObject) += 4; //
< }
< break;
< case OpcUaType_Int64:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Int64), 8, pObject, 8);
< ((OpcUa_Byte*&)pObject) += 8; //
< }
< break;
< case OpcUaType_UInt64:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.UInt64), 8, pObject, 8);
< ((OpcUa_Byte*&)pObject) += 8; //
< }
< break;
< case OpcUaType_Float:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Float), 4, pObject, 4);
< ((OpcUa_Byte*&)pObject) += 4; //
< }
< break;
< case OpcUaType_Double:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Double), 8, pObject, 8);
< ((OpcUa_Byte*&)pObject) += 8; //
< }
< break;
< case OpcUaType_String:
< {
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_String_Initialize(&((*ppVariantVal)[i].Value.String));
< uStatus = InternalExtractString(pObject, &((*ppVariantVal)[i].Value.String));
< ((OpcUa_Byte*&)pObject) += 12;
< }
< break;
< case OpcUaType_DateTime:
---
> OpcUa_ServerStatusDataType* pStatus = (OpcUa_ServerStatusDataType*) pObject;
> VarriantArray_SetAt(*ppVariantVal, 0, &pStatus->StartTime, DateTime); /* StartTime */
> VarriantArray_SetAt(*ppVariantVal, 1, &pStatus->CurrentTime, DateTime); /* CurrentTime */
> VarriantArray_SetAt(*ppVariantVal, 2, &pStatus->State, Int32); /* State */
> VarriantArray_SetAt(*ppVariantVal, 3, &pStatus->BuildInfo.ProductUri, String); /* BuildInfo.ProductUri */
> VarriantArray_SetAt(*ppVariantVal, 4, &pStatus->BuildInfo.ManufacturerName, String); /* BuildInfo.ManufacturerName */
> VarriantArray_SetAt(*ppVariantVal, 5, &pStatus->BuildInfo.ProductName, String); /* BuildInfo.ProductName */
> VarriantArray_SetAt(*ppVariantVal, 6, &pStatus->BuildInfo.SoftwareVersion, String); /* BuildInfo.SoftwareVersion */
> VarriantArray_SetAt(*ppVariantVal, 7, &pStatus->BuildInfo.BuildNumber, String); /* BuildInfo.BuildNumber */
> VarriantArray_SetAt(*ppVariantVal, 8, &pStatus->BuildInfo.BuildDate, DateTime); /* BuildInfo.BuildDate */
> VarriantArray_SetAt(*ppVariantVal, 9, &pStatus->SecondsTillShutdown, UInt32); /* SecondsTillShutdown */
> VarriantArray_SetAtP(*ppVariantVal, 10, &pStatus->ShutdownReason, LocalizedText); /* ShutdownReason */
> /* clear ServerStatusDataType used */
> OpcUa_ServerStatusDataType_Clear(pStatus);
> bHandled = OpcUa_True;
> }
> }
>
> if (!bHandled)
> {
> void* pObject = rawValue.Value.ExtensionObject->Body.EncodeableObject.Object;
> for (OpcUa_UInt32 i = 0; i < uiSize; i++)
> {
> OpenOpcUa_Field* pField = pDefinition->m_pFields[i];
> if (pField->m_DataType.NamespaceIndex == 0)
4207,4214c4191,4198
< (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.DateTime.dwLowDateTime), 4, pObject, 4);
< ((OpcUa_Byte*&)pObject) += 4; //
< OpcUa_MemCpy(&((*ppVariantVal)[i].Value.DateTime.dwHighDateTime), 4, pObject, 4);
< ((OpcUa_Byte*&)pObject) += 4; //
< }
< break;
< case OpcUaType_Guid:
---
> switch (pField->m_DataType.Identifier.Numeric)
> {
> case OpcUaType_Boolean:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Boolean), 1, pObject, 1);
> ((OpcUa_Byte*&)pObject) += 1; //
> }
4216c4200,4205
< case OpcUaType_ByteString:
---
> case OpcUaType_SByte:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.SByte), 1, pObject, 1);
> ((OpcUa_Byte*&)pObject) += 1; //
> }
4218c4207,4212
< case OpcUaType_NodeId:
---
> case OpcUaType_Byte:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Byte), 1, pObject, 1);
> ((OpcUa_Byte*&)pObject) += 1; //
> }
4220c4214,4219
< case OpcUaType_ExpandedNodeId:
---
> case OpcUaType_Int16:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Int16), 2, pObject, 2);
> ((OpcUa_Byte*&)pObject) += 2; //
> }
4222c4221,4226
< case OpcUaType_StatusCode:
---
> case OpcUaType_UInt16:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.UInt16), 2, pObject, 2);
> ((OpcUa_Byte*&)pObject) += 2; //
> }
4224c4228,4233
< case OpcUaType_QualifiedName:
---
> case OpcUaType_Int32:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Int32), 4, pObject, 4);
> ((OpcUa_Byte*&)pObject) += 4; //
> }
4226c4235,4240
< case OpcUaType_LocalizedText:
---
> case OpcUaType_UInt32:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.UInt32), 4, pObject, 4);
> ((OpcUa_Byte*&)pObject) += 4; //
> }
4228,4229c4242,4247
< case OpcUaType_ExtensionObject:
< // Search for this extension object in the DataType dictionnary
---
> case OpcUaType_Int64:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Int64), 8, pObject, 8);
> ((OpcUa_Byte*&)pObject) += 8; //
> }
4231c4249,4254
< case OpcUaType_DataValue:
---
> case OpcUaType_UInt64:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.UInt64), 8, pObject, 8);
> ((OpcUa_Byte*&)pObject) += 8; //
> }
4233c4256,4261
< case OpcUaType_Variant:
---
> case OpcUaType_Float:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Float), 4, pObject, 4);
> ((OpcUa_Byte*&)pObject) += 4; //
> }
4235c4263,4268
< case OpcUaType_DiagnosticInfo:
---
> case OpcUaType_Double:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.Double), 8, pObject, 8);
> ((OpcUa_Byte*&)pObject) += 8; //
> }
4237,4239c4270,4285
< default:
<
< uStatus = OpcUa_BadNotSupported;
---
> case OpcUaType_String:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_String_Initialize(&((*ppVariantVal)[i].Value.String));
> uStatus = InternalExtractString(pObject, &((*ppVariantVal)[i].Value.String));
> ((OpcUa_Byte*&)pObject) += sizeof(OpcUa_String);
> }
> break;
> case OpcUaType_DateTime:
> {
> (*ppVariantVal)[i].Datatype = (OpcUa_Byte)pField->m_DataType.Identifier.Numeric;
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.DateTime.dwLowDateTime), 4, pObject, 4);
> ((OpcUa_Byte*&)pObject) += 4; //
> OpcUa_MemCpy(&((*ppVariantVal)[i].Value.DateTime.dwHighDateTime), 4, pObject, 4);
> ((OpcUa_Byte*&)pObject) += 4; //
> }
4240a4287,4314
> case OpcUaType_Guid:
> break;
> case OpcUaType_ByteString:
> break;
> case OpcUaType_NodeId:
> break;
> case OpcUaType_ExpandedNodeId:
> break;
> case OpcUaType_StatusCode:
> break;
> case OpcUaType_QualifiedName:
> break;
> case OpcUaType_LocalizedText:
> break;
> case OpcUaType_ExtensionObject:
> // Search for this extension object in the DataType dictionnary
> break;
> case OpcUaType_DataValue:
> break;
> case OpcUaType_Variant:
> break;
> case OpcUaType_DiagnosticInfo:
> break;
> default:
>
> uStatus = OpcUa_BadNotSupported;
> break;
> }
4333,4338c4407,4408
< OpcUa_NodeId_Clear(&pField->m_DataType);
< OpcUa_String_Clear(&pField->m_Description);
< OpcUa_String_Clear(&pField->m_Name);
< OpcUa_String_Clear(&pField->m_SymbolicName);
< OpcUa_String_Clear(&pField->m_TypeName);
< OpcUa_Variant_Clear(&pField->m_Value);
---
> OpenOpcUa_Field_Clear(pField);
> OpcUa_Free(pField);
4339a4410,4411
> OpcUa_Free(pDefinition->m_pFields);
> pDefinition->m_pFields = OpcUa_Null;
4356c4428,4430
< fieldList.push_back(Copy(pField));
---
> // Do not copy but use directly
> //fieldList.push_back(Copy(pField));
> fieldList.push_back(pField);
4363a4438
> /* No need to free since they were added back to fieldList above
4365a4441
> OpenOpcUa_Field_Clear(pDefinition->m_pFields[ii]);
4368a4445
> */
4375a4453
> /* no need to allocate memory here wich will be replaced just below
4380a4459
> */
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/SubscriptionClient.cpp OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/SubscriptionClient.cpp
117a118,120
> // Caution: may cause intermittent seg fault thrown by keep alive thread
> OpcUa_Semaphore_Delete(&m_hStopKeepAliveThreadSem);
> OpcUa_Semaphore_Delete(&m_hKeepAliveThreadSem);
292a296,299
> OpcUa_ResponseHeader_Clear(&tResponseHeader);
> for (OpcUa_Int32 i = 0; i < tNoOfDiagnosticInfos && tDiagnosticInfos != OpcUa_Null; i++)
> OpcUa_DiagnosticInfo_Clear(&tDiagnosticInfos[i]);
> OpcUa_Free(tDiagnosticInfos);
407a415
> m_hMonitoredItemsNotificationThread = OpcUa_Null;
411c419
< OpcUa_Thread_Delete(m_hMonitoredItemsNotificationThread);
---
> //OpcUa_Thread_Delete(m_hMonitoredItemsNotificationThread);
1462c1470
< OpcUa_Thread_Delete(m_hKeepAliveThread);
---
> //OpcUa_Thread_Delete(m_hKeepAliveThread);
1467c1475
< OpcUa_Thread_Delete(m_hKeepAliveThread);
---
> //OpcUa_Thread_Delete(m_hKeepAliveThread);
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/XmlElement.cpp OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/XmlElement.cpp
493a494,495
> {
> OpenOpcUa_Field_Clear(pNewField);
494a497
> }
935a939,950
>
> // create them ouside of loop to reduce unnecessary recreation
> OpcUa_String szDocumentation;
> OpcUa_String_Initialize(&szDocumentation);
> OpcUa_String_AttachCopy(&szDocumentation, "opc:Documentation");
> OpcUa_String szEnumeratedValue;
> OpcUa_String_Initialize(&szEnumeratedValue);
> OpcUa_String_AttachCopy(&szEnumeratedValue, "opc:EnumeratedValue");
> OpcUa_String szField;
> OpcUa_String_Initialize(&szField);
> OpcUa_String_AttachCopy(&szField, "opc:Field");
>
941,943d955
< OpcUa_String szEnumeratedType;
< OpcUa_String_Initialize(&szEnumeratedType);
< OpcUa_String_AttachCopy(&szEnumeratedType, "opc:EnumeratedType");
958,960d969
< OpcUa_String szStructuredType;
< OpcUa_String_Initialize(&szStructuredType);
< OpcUa_String_AttachCopy(&szStructuredType, "opc:StructuredType");
976,978d984
< OpcUa_String szDocumentation;
< OpcUa_String_Initialize(&szDocumentation);
< OpcUa_String_AttachCopy(&szDocumentation, "opc:Documentation");
987,989d992
< OpcUa_String szEnumeratedValue;
< OpcUa_String_Initialize(&szEnumeratedValue);
< OpcUa_String_AttachCopy(&szEnumeratedValue, "opc:EnumeratedValue");
1002,1004d1004
< OpcUa_String szField;
< OpcUa_String_Initialize(&szField);
< OpcUa_String_AttachCopy(&szField, "opc:Field");
1018a1019,1024
> // clear
> OpcUa_String_Clear(&szEnumeratedType);
> OpcUa_String_Clear(&szStructuredType);
> OpcUa_String_Clear(&szDocumentation);
> OpcUa_String_Clear(&szEnumeratedValue);
> OpcUa_String_Clear(&szField);
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/XmlParser.cpp OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/XmlParser.cpp
319a320,321
> // delete raw buffer used
> OpcUa_Free(pRawBuffer);
398a401
> OpcUa_Boolean bAdded = OpcUa_False;
405a409
> bAdded = OpcUa_True;
416a421
> bAdded = OpcUa_True;
419a425,431
>
> // free field not added back
> if (OpcUa_False == bAdded)
> {
> OpenOpcUa_Field_Clear(pEmbeddedField);
> OpcUa_Free(pEmbeddedField);
> }
423a436,438
> // Fields are already freed or added to fieldList
> pEmbeddedDefinition->m_uiNoOfField = 0;
> OpenOpcUa_Definition_Clear(pEmbeddedDefinition);
428a444
> OpenOpcUa_Definition_Clear(pEmbeddedDefinition);
429a446,452
> // clear unprocessed fields before break
> for (OpcUa_UInt32 ii = i; ii < (*ppDefinition)->m_uiNoOfField; ii++)
> {
> OpenOpcUa_Field* pField = (*ppDefinition)->m_pFields[ii];
> OpenOpcUa_Field_Clear(pField);
> OpcUa_Free(pField);
> }
434a458,461
>
> // free field not added back
> OpenOpcUa_Field_Clear(pField);
> OpcUa_Free(pField);
442c469,478
< if (!(*ppDefinition)->m_pFields)
---
> if ((*ppDefinition)->m_pFields)
> {
> if (fieldList.size() > (*ppDefinition)->m_uiNoOfField)
> {
> (*ppDefinition)->m_pFields = (OpenOpcUa_Field**) OpcUa_ReAlloc((*ppDefinition)->m_pFields,
> fieldList.size()*sizeof(OpenOpcUa_Field*));
> }
> }
>
> if (!(*ppDefinition)->m_pFields)
445c481
< (*ppDefinition)->m_uiNoOfField = fieldList.size();
---
> (*ppDefinition)->m_uiNoOfField = fieldList.size();
468a505,508
> // allocate and clear outside loop
> OpcUa_String szTypeDictionary;
> OpcUa_String_Initialize(&szTypeDictionary);
> OpcUa_String_AttachCopy(&szTypeDictionary, "opc:TypeDictionary");
471c511,512
< CXmlElement* pXmlElement = m_XmlElement.at(i);
---
> CXmlElement* pXmlElement = m_XmlElement.at(i);
> /* remove unused string
474a516
> */
477,479d518
< OpcUa_String szTypeDictionary;
< OpcUa_String_Initialize(&szTypeDictionary);
< OpcUa_String_AttachCopy(&szTypeDictionary, "opc:TypeDictionary");
487a527
> OpcUa_String_Clear(&szTypeDictionary);
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/stdafx.cpp OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/OpenOpcUaClientLib/source/stdafx.cpp
322,323c322
< void* pVoidResult=malloc(12);
< if (pVoidResult)
---
> if (pString)
325,329c324,325
< ZeroMemory(pVoidResult, 12);
< // Duplicate a string
< if (pString)
< {
< OpcUa_String_Initialize(pString);
---
> OpcUa_String_Initialize(pString);
> OpcUa_Byte* pData = (OpcUa_Byte*) pValue;
331,349c327,336
< // copy flag
< OpcUa_MemCpy(pVoidResult, 4, pValue, 4);
< ((OpcUa_Byte*&)pVoidResult) += 4; //
< OpcUa_MemCpy(&(pString->flags), 2, pValue, 2);
< ((OpcUa_Byte*&)pValue) += 4; // The real size is 4 because a OpcUa_String is in fact an OpcUa_StringInternal
< // copy Length
< OpcUa_MemCpy(pVoidResult, 4, pValue, 4);
< ((OpcUa_Byte*&)pVoidResult) += 4; //
< OpcUa_MemCpy(&(pString->uLength), 4, pValue, 4);
< if (pString->uLength > 0)
< {
< pString->strContent = (OpcUa_CharA*)OpcUa_Alloc(pString->uLength + 1);
< ZeroMemory(pString->strContent, pString->uLength + 1);
< }
< // Copy the content
< ((OpcUa_Byte*&)pValue) += 4;
< void* apVoid = OpcUa_Null; // OpcUa_Alloc(4);
< memcpy(&apVoid, pValue, 4);
< if (pString->uLength > 0)
---
> // copy flag
> OpcUa_MemCpy(&(pString->flags), sizeof(OpcUa_UInt16), pData, sizeof(OpcUa_UInt16));
> pData += sizeof(OpcUa_UInt); // The real size is 4 because a OpcUa_String is in fact an OpcUa_StringInternal
> // copy Length
> OpcUa_MemCpy(&(pString->uLength), sizeof(OpcUa_UInt32), pData, sizeof(OpcUa_UInt32));
> pData += sizeof(OpcUa_UInt32);
> if (pString->uLength > 0)
> {
> pString->strContent = (OpcUa_CharA*)OpcUa_Alloc(pString->uLength + 1);
> if (OpcUa_Null == pString->strContent)
351,353c338,339
< if (apVoid)
< OpcUa_MemCpy((pString->strContent), pString->uLength, ((void*)(apVoid)), pString->uLength);
< OpcUa_MemCpy(pVoidResult, 4, &(pString->strContent), 4);
---
> OpcUa_String_Initialize(pString);
> return OpcUa_BadOutOfMemory;
355c341,349
< // ici pString->strContent contient la valeur de la chaine. Les autres pointeurs ne servent qu'a transporter
---
> ZeroMemory(pString->strContent, pString->uLength + 1);
> }
> // Copy the content
> if (OpcUa_String_StrLen(pString) > 0)
> {
> void* apVoid = *(OpcUa_CharA**)pData;
> if (apVoid)
> OpcUa_MemCpy((pString->strContent), pString->uLength, ((void*)(apVoid)), pString->uLength);
> }
357,366c351,360
< // copy flag
< OpcUa_MemCpy(pVoidResult, 4, pValue, 4);
< ((OpcUa_Byte*&)pVoidResult) += 4; //
< OpcUa_MemCpy(&(pString->uReserved1), 2, pValue, 2);
< ((OpcUa_Byte*&)pValue) += 4; // The real size is 4 because a OpcUa_String is in fact an OpcUa_StringInternal
< // copy Length
< OpcUa_MemCpy(pVoidResult, 4, pValue, 4);
< ((OpcUa_Byte*&)pVoidResult) += 4; //
< OpcUa_MemCpy(&(pString->uReserved2), 4, pValue, 4);
< if (OpcUa_String_StrLen(pString) > 0)
---
> // copy flag
> OpcUa_MemCpy(&(pString->uReserved1), sizeof(OpcUa_UInt16), pData, sizeof(OpcUa_UInt16));
> pData += sizeof(OpcUa_UInt); // The real size is 4 because a OpcUa_String is in fact an OpcUa_StringInternal
> // copy Length
> OpcUa_MemCpy(&(pString->uReserved2), sizeof(OpcUa_UInt32), pData, sizeof(OpcUa_UInt32));
> pData += sizeof(OpcUa_UInt32);
> if (pString->uReserved2 > 0)
> {
> pString->uReserved4 = (OpcUa_CharA*)OpcUa_Alloc(pString->uReserved2 + 1);
> if (OpcUa_Null == pString->uReserved4)
368,369c362,363
< pString->uReserved4 = (OpcUa_CharA*)OpcUa_Alloc(pString->uReserved2 + 1);
< ZeroMemory(pString->uReserved4, pString->uReserved2 + 1);
---
> OpcUa_String_Initialize(pString);
> return OpcUa_BadOutOfMemory;
371,376c365,371
< // Copy the content
< ((OpcUa_Byte*&)pValue) += 4;
< void* apVoid = OpcUa_Alloc(4);
< memcpy(&apVoid, pValue, 4);
< if (OpcUa_String_StrLen(pString) > 0)
< {
---
> ZeroMemory(pString->uReserved4, pString->uReserved2 + 1);
> }
> // Copy the content
> if (OpcUa_String_StrLen(pString) > 0)
> {
> void* apVoid = *(OpcUa_CharA**)pData;
> if (apVoid)
378,383d372
< OpcUa_MemCpy(pVoidResult, 4, &(pString->uReserved4), 4);
< }
< #endif
< // Update the pointer
< ((OpcUa_Byte*&)(pVoidResult)) += 4; //
< ((OpcUa_Byte*&)(pValue)) += 4;
385,387c374
< else
< uStatus = OpcUa_BadInvalidArgument;
< //free(pVoidResult);
---
> #endif
390c377,378
< uStatus = OpcUa_BadOutOfMemory;
---
> uStatus = OpcUa_BadInvalidArgument;
>
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaClientSdk/include/opcua/opcua_p_types.h OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaClientSdk/include/opcua/opcua_p_types.h
83a84,101
> /*
> * printf format specifiers
> */
> #ifdef __x86_64__
> #define PRId32ua "d"
> #define PRIu32ua "u"
> #define PRIx32ua "x"
> #else
> #define PRId32ua "ld"
> #define PRIu32ua "lu"
> #define PRIx32ua "lx"
> #endif
> #if OPCUA_P_NATIVE64
> #define PRId64ua "lld"
> #define PRIu64ua "llu"
> #define PRIx64ua "llx"
> #endif
>
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaSharedLib/source/Application.cpp OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaSharedLib/source/Application.cpp
74c74,75
< OpcUa_Mutex_Create(&m_pTraceConfiguration->hTrace_Lock_Mutex);
---
> // Mutex should be created through call to IntializeTrace
> //OpcUa_Mutex_Create(&m_pTraceConfiguration->hTrace_Lock_Mutex);
161a163
> OpcUa_Free(m_pTypeTable);
711a714
> OpcUa_String_Initialize(&sApplicationUri);
744a748,749
> OpcUa_Key_Clear(&tPrivateKey);
> OpcUa_ByteString_Clear(&tCertificate);
765a771
> OpcUa_String_Clear(&sApplicationUri);
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaSharedLib/source/Utils.cpp OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaSharedLib/source/Utils.cpp
2739c2739
< OpcUa_SPrintfA(wcsLocal, "%ld", Var.Value.Int32);
---
> OpcUa_SPrintfA(wcsLocal, "%" PRId32ua, Var.Value.Int32);
2742c2742
< OpcUa_SPrintfA(wcsLocal, "%lu", Var.Value.UInt32);
---
> OpcUa_SPrintfA(wcsLocal, "%" PRIu32ua, Var.Value.UInt32);
2745c2745
< OpcUa_SPrintfA(wcsLocal, "%lld", Var.Value.Int64);
---
> OpcUa_SPrintfA(wcsLocal, "%" PRId64ua, Var.Value.Int64);
2748c2748
< OpcUa_SPrintfA(wcsLocal, "%llu", Var.Value.UInt64);
---
> OpcUa_SPrintfA(wcsLocal, "%" PRIu64ua, Var.Value.UInt64);
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaStackV1/include/shared/opcua_p_types.h OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaStackV1/include/shared/opcua_p_types.h
83a84,101
> /*
> * printf format specifiers
> */
> #ifdef __x86_64__
> #define PRId32ua "d"
> #define PRIu32ua "u"
> #define PRIx32ua "x"
> #else
> #define PRId32ua "ld"
> #define PRIu32ua "lu"
> #define PRIx32ua "lx"
> #endif
> #if OPCUA_P_NATIVE64
> #define PRId64ua "lld"
> #define PRIu64ua "llu"
> #define PRIx64ua "llx"
> #endif
>
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaStackV1/source/opcua_p_utilities.c OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaStackV1/source/opcua_p_utilities.c
237c237
< szPortLen = iPos;
---
> szPortLen = (OpcUa_Int) uUrlLength - iPos;
372a373,374
> if (pAddrInfo)
> freeaddrinfo(pAddrInfo);
379,381c381,383
< char *folder;
< char *file;
< char *currentFile;
---
> //char *folder;
> //char *file;
> //char *currentFile;
427c429,431
< folder = calloc(sizeof(char*),indexOfLastBackSlash);
---
> char* folder = calloc(sizeof(char*),indexOfLastBackSlash);
> if (NULL == folder)
> return -1;
431,432c435,440
< file = calloc(sizeof(char*),length - indexOfLastBackSlash + 1);
< file = str_sub(lpFileName,indexOfLastBackSlash+1,length);
---
> //file = calloc(sizeof(char*),length - indexOfLastBackSlash + 1);
> char *file = str_sub(lpFileName,indexOfLastBackSlash+1,length);
> if (NULL == file) {
> free(folder);
> return -1;
> }
444c452,453
<
---
> free(folder);
> free(file);
467a477,478
> free(folder);
> free(file);
481a493,494
> free(folder);
> free(file);
490a504,505
> free(folder);
> free(file);
501a517,518
> free(folder);
> free(file);
504a522,524
> closedir(dp);
> free(folder);
> free(file);
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/OpenOpcUaStackV1/source/opcua_thread.c OpenOpcUa_1_0_5_3_RC2_6_modified/OpenOpcUaStackV1/source/opcua_thread.c
105a106,108
>
> /* delete internal resources */
> OpcUa_Thread_Delete((OpcUa_Thread) Thread);
182a186,190
> /*
> * Thread may not be finished and may need to access the internal resources
> * so don't delete the resources and just exit
> */
> return;
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/include/OpenOpcUaClientSdk/OpenOpcUa_p_types.h OpenOpcUa_1_0_5_3_RC2_6_modified/include/OpenOpcUaClientSdk/OpenOpcUa_p_types.h
86a87,104
> /*
> * printf format specifiers
> */
> #ifdef __x86_64__
> #define PRId32ua "d"
> #define PRIu32ua "u"
> #define PRIx32ua "x"
> #else
> #define PRId32ua "ld"
> #define PRIu32ua "lu"
> #define PRIx32ua "lx"
> #endif
> #if OPCUA_P_NATIVE64
> #define PRId64ua "lld"
> #define PRIu64ua "llu"
> #define PRIx64ua "llx"
> #endif
>
diff -x '*.txt' -x '*.cmake' -x '*.bak' -r OpenOpcUa_1_0_5_3_RC2/include/opcua/opcua_p_types.h OpenOpcUa_1_0_5_3_RC2_6_modified/include/opcua/opcua_p_types.h
83a84,101
> /*
> * printf format specifiers
> */
> #ifdef __x86_64__
> #define PRId32ua "d"
> #define PRIu32ua "u"
> #define PRIx32ua "x"
> #else
> #define PRId32ua "ld"
> #define PRIu32ua "lu"
> #define PRIx32ua "lx"
> #endif
> #if OPCUA_P_NATIVE64
> #define PRId64ua "lld"
> #define PRIu64ua "llu"
> #define PRIx64ua "llx"
> #endif
>