Cap5 support for zero-length long strings

This commit is contained in:
Andrew Johnson
2022-07-13 13:24:54 -05:00
parent 5f02bad3fc
commit d82ab819ef
2 changed files with 13 additions and 2 deletions

View File

@@ -16,6 +16,11 @@ should also be read to understand what has changed since earlier releases.
<!-- Insert new items immediately below here ... -->
### Perl CA support for empty long strings
The Perl CA bindings have been fixed to handle zero-length long string data
properly.
### `aao` gains `OMSL` and `DOL`
The `aao` record types gains the same `DOL` functionality found

View File

@@ -208,6 +208,8 @@ SV * newSVdbr(struct event_handler_args *peha) {
if (is_primitive) {
if (value_type == DBR_CHAR) {
/* Long string => Perl scalar */
if (peha->count == 0)
return newSVpvn(peha->dbr, 0);
((char *)peha->dbr) [peha->count - 1] = 0;
return newSVpv(peha->dbr, 0);
}
@@ -278,8 +280,12 @@ SV * newSVdbr(struct event_handler_args *peha) {
char *str = dbr_value_ptr(peha->dbr, peha->type);
/* Long string => Perl scalar */
str[peha->count - 1] = 0;
val = newSVpv(str, 0);
if (peha->count == 0)
val = newSVpvn(str, 0);
else {
str[peha->count - 1] = 0;
val = newSVpv(str, 0);
}
} else if (peha->count == 1) {
/* Single value => Perl scalar */
val = newSVdbf(value_type,