From 19447dc7ffc598f72f74a329b5ee13f81eabdc29 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 4 Sep 2016 16:56:15 -0500 Subject: [PATCH] Make the long-string buffer for link fields bigger When representing a link field as a long string (.INP$) we have to pick some size limit for the buffer. Previously this was the max length of a PV name + 12 chars, but with JSON links that's not big enough. This commit sets it to 1KB and defines a macro so it will be easier to change in the future if necessary. --- src/ioc/db/dbAccess.c | 2 +- src/ioc/db/dbChannel.c | 2 +- src/libCom/misc/dbDefs.h | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ioc/db/dbAccess.c b/src/ioc/db/dbAccess.c index ff94a5b53..a4ba42b89 100644 --- a/src/ioc/db/dbAccess.c +++ b/src/ioc/db/dbAccess.c @@ -657,7 +657,7 @@ long dbNameToAddr(const char *pname, DBADDR *paddr) paddr->dbr_field_type = DBR_CHAR; } else if (dbfType >= DBF_INLINK && dbfType <= DBF_FWDLINK) { /* Clients see a char array, but keep original dbfType */ - paddr->no_elements = PVNAME_STRINGSZ + 12; + paddr->no_elements = PVLINK_STRINGSZ; paddr->field_size = 1; paddr->dbr_field_type = DBR_CHAR; } else { diff --git a/src/ioc/db/dbChannel.c b/src/ioc/db/dbChannel.c index 6e08f3c19..bf2b3d438 100644 --- a/src/ioc/db/dbChannel.c +++ b/src/ioc/db/dbChannel.c @@ -531,7 +531,7 @@ dbChannel * dbChannelCreate(const char *name) paddr->dbr_field_type = DBR_CHAR; } else if (dbfType >= DBF_INLINK && dbfType <= DBF_FWDLINK) { /* Clients see a char array, but keep original dbfType */ - paddr->no_elements = PVNAME_STRINGSZ + 12; + paddr->no_elements = PVLINK_STRINGSZ; paddr->field_size = 1; paddr->dbr_field_type = DBR_CHAR; } else { diff --git a/src/libCom/misc/dbDefs.h b/src/libCom/misc/dbDefs.h index 069d55c1a..e8c2bb265 100644 --- a/src/libCom/misc/dbDefs.h +++ b/src/libCom/misc/dbDefs.h @@ -60,6 +60,10 @@ #define PVNAME_STRINGSZ 61 #define PVNAME_SZ (PVNAME_STRINGSZ - 1) +/* Buffer size for the string representation of a DBF_*LINK field */ +#define PVLINK_STRINGSZ 1024 + +/* dbAccess enums/menus can have up to this many choices */ #define DB_MAX_CHOICES 30 #endif /* INC_dbDefs_H */