Allow hex and octal strings in dbPut and dbGet

Setting EPICS_DB_CONVERT_DECIMAL_ONLY to YES/yes change the dbPut() and dbGet()
string to integer conversions to the original decimal only policy.
This commit is contained in:
2025-11-05 17:11:06 +01:00
parent d7286cd956
commit 18d61eda06
3 changed files with 6 additions and 6 deletions
+1 -2
View File
@@ -9,5 +9,4 @@ now they switch to octal mode.
For backward compatibility, this behavior can be switched off, returning
to the old decimal only conversions, by setting the environment variable
`EPICS_DB_CONVERT_DECIMAL_ONLY` to anything except the empty string or
strings starting with `n`, `N`, `f`, `F` or `0` before `iocInit`.
`EPICS_DB_CONVERT_DECIMAL_ONLY` to `YES` (case insensitive) before `iocInit`.
+4 -3
View File
@@ -31,6 +31,7 @@
#include "epicsPrint.h"
#include "epicsSignal.h"
#include "epicsThread.h"
#include "epicsString.h"
#include "errMdef.h"
#include "iocsh.h"
#include "taskwd.h"
@@ -132,10 +133,10 @@ static int iocBuild_1(void)
}
{
/* fall back to "old" decimal-only conversion if EPICS_DB_CONVERT_DECIMAL_ONLY
is set and does not look like meaning no/false/0 */
/* fall back to "old" decimal-only conversion if
EPICS_DB_CONVERT_DECIMAL_ONLY is YES (case insensitive). */
const char* dec_only = getenv("EPICS_DB_CONVERT_DECIMAL_ONLY");
if (dec_only && *dec_only && !strchr("nNfF0", *dec_only)) {
if (dec_only && epicsStrCaseCmp(dec_only, "YES") == 0) {
dbConvertBase = 10;
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ LIBCOM_API float epicsConvertDoubleToFloat(double value);
/* dbConvertBase is used in dbPut and dbGet string to integer conversions.
It defaults to 0 but is set to 10 if the EPICS_DB_CONVERT_DECIMAL_ONLY
environment variable is set.
environment variable is YES (case insensitive).
*/
LIBCOM_API extern int dbConvertBase;