Update ied_connection.c

During my test, it was observed that when there are 2 logical nodes with same string repeats, ( such as almGGIO1 and almGGIO10) in those cases, these 2 below functions add the DOs from almGGIO1 to almGGIO10. and model discovery will show invalid DOs under almGGIO10. My test was done in 1.5 version, I think this change is relevent in current version also.

IedConnection_getLogicalNodeDirectory
IedConnection_getLogicalNodeVariables
pull/521/head
aravindmithra 12 months ago committed by GitHub
parent 519b0208cc
commit 8f77fbdc6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2783,21 +2783,22 @@ IedConnection_getLogicalNodeDirectory(IedConnection self, IedClientError* error,
goto next_element; goto next_element;
int lnNameLen = (int)(fcPos - variableName); int lnNameLen = (int)(fcPos - variableName);
if (strlen(logicalNodeName) == lnNameLen){
if (strncmp(variableName, logicalNodeName, lnNameLen) == 0) if (strncmp(variableName, logicalNodeName, lnNameLen) == 0)
{
char* fcEndPos = strchr(fcPos + 1, '$');
if (fcEndPos)
{ {
char* nameEndPos = strchr(fcEndPos + 1, '$'); char* fcEndPos = strchr(fcPos + 1, '$');
if (nameEndPos == NULL) if (fcEndPos)
{ {
char* dataObjectName = StringUtils_copyString(fcEndPos + 1); char* nameEndPos = strchr(fcEndPos + 1, '$');
if (!addToStringSet(lnDirectory, dataObjectName)) if (nameEndPos == NULL)
GLOBAL_FREEMEM(dataObjectName); {
char* dataObjectName = StringUtils_copyString(fcEndPos + 1);
if (!addToStringSet(lnDirectory, dataObjectName))
GLOBAL_FREEMEM(dataObjectName);
}
} }
} }
} }
@ -2929,10 +2930,11 @@ IedConnection_getLogicalNodeVariables(IedConnection self, IedClientError* error,
if (fcPos) if (fcPos)
{ {
int lnNameLen = (int)(fcPos - variableName); int lnNameLen = (int)(fcPos - variableName);
if (strlen(logicalNodeName) == lnNameLen){
if (strncmp(variableName, logicalNodeName, lnNameLen) == 0) if (strncmp(variableName, logicalNodeName, lnNameLen) == 0)
{ {
LinkedList_add(lnDirectory, StringUtils_copyString(fcPos + 1)); LinkedList_add(lnDirectory, StringUtils_copyString(fcPos + 1));
}
} }
} }

Loading…
Cancel
Save