Added a character string compare function to be able to unit test.
This commit is contained in:
@@ -235,6 +235,33 @@ bool characterstring_copy(
|
||||
characterstring_length(src));
|
||||
}
|
||||
|
||||
bool characterstring_same(
|
||||
BACNET_CHARACTER_STRING *dest,
|
||||
BACNET_CHARACTER_STRING *src)
|
||||
{
|
||||
size_t i; /* counter */
|
||||
bool same_status = false;
|
||||
|
||||
if (src && dest)
|
||||
{
|
||||
if ((src->length == dest->length) &&
|
||||
(src->encoding == dest->encoding))
|
||||
{
|
||||
same_status = true;
|
||||
for (i = 0; i < src->length; i++)
|
||||
{
|
||||
if (src->value[i] != dest->value[i])
|
||||
{
|
||||
same_status = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return same_status;
|
||||
}
|
||||
|
||||
/* returns false if the string exceeds capacity */
|
||||
bool characterstring_append(
|
||||
BACNET_CHARACTER_STRING *char_string,
|
||||
|
||||
@@ -102,6 +102,10 @@ bool characterstring_init_ansi(
|
||||
bool characterstring_copy(
|
||||
BACNET_CHARACTER_STRING *dest,
|
||||
BACNET_CHARACTER_STRING *src);
|
||||
/* returns true if the strings are the same length, encoding, value */
|
||||
bool characterstring_same(
|
||||
BACNET_CHARACTER_STRING *dest,
|
||||
BACNET_CHARACTER_STRING *src);
|
||||
/* returns false if the string exceeds capacity */
|
||||
bool characterstring_append(
|
||||
BACNET_CHARACTER_STRING *char_string,
|
||||
|
||||
Reference in New Issue
Block a user