Fixed network port object to accept host name option of host-n-port writes. (#997)
This commit is contained in:
@@ -498,6 +498,35 @@ bool characterstring_ansi_copy(
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Copy a BACnetCharacterString into a buffer with null padding
|
||||
* @param dest Pointer to the destination buffer.
|
||||
* @param dest_max_len Size of the destination buffer.
|
||||
* @param src Pointer to the source BACnetCharacterString.
|
||||
* @return Length of the copied BACnetCharacterString, or 0 if the string
|
||||
* exceeds the destination buffer size.
|
||||
*/
|
||||
size_t characterstring_copy_value(
|
||||
char *dest, size_t dest_max_len, const BACNET_CHARACTER_STRING *src)
|
||||
{
|
||||
size_t i = 0, length = 0;
|
||||
|
||||
if (dest && src) {
|
||||
if (src->length < dest_max_len) {
|
||||
length = src->length;
|
||||
for (i = 0; i < dest_max_len; i++) {
|
||||
if (i < src->length) {
|
||||
dest[i] = src->value[i];
|
||||
} else {
|
||||
dest[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the character encoding and string
|
||||
* contents are the same.
|
||||
|
||||
Reference in New Issue
Block a user