From 382dd29452e78a08eabc418b7dfdf2a0d2da1cae Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 20 Nov 2023 08:31:10 -0800 Subject: [PATCH] qsrv: avoid sending 0 precision w/ integer value --- ioc/iocsource.cpp | 7 +++---- test/testqsingle.cpp | 3 --- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ioc/iocsource.cpp b/ioc/iocsource.cpp index 8ebabf96b..e374c079e 100644 --- a/ioc/iocsource.cpp +++ b/ioc/iocsource.cpp @@ -315,9 +315,6 @@ void getProperties(dbChannel* pChannel, db_field_log *pfl, Value& node) if(auto units = node["display.units"]) units = meta.units; } - if(options & DBR_PRECISION) { - // TODO: add in nt.cpp? - } if(options & DBR_ENUM_STRS) { if(auto choices = node["value.choices"]) { shared_array arr(meta.no_str); @@ -331,7 +328,9 @@ void getProperties(dbChannel* pChannel, db_field_log *pfl, Value& node) if(options & DBR_GR_DOUBLE) { dlL = meta.lower_disp_limit; node["display.limitHigh"] = meta.upper_disp_limit; - node["display.precision"] = meta.precision.dp; + if(options & DBR_PRECISION) { + node["display.precision"] = int32_t(meta.precision.dp); + } } if(options & DBR_CTRL_DOUBLE) { node["control.limitLow"] = meta.lower_ctrl_limit; diff --git a/test/testqsingle.cpp b/test/testqsingle.cpp index 03e4a7213..12f0ba7e6 100644 --- a/test/testqsingle.cpp +++ b/test/testqsingle.cpp @@ -289,7 +289,6 @@ void testGetScalar() "display.limitHigh int32_t = 0\n" "display.description string = \"\"\n" "display.units string = \"\"\n" - "display.precision int32_t = 0\n" "display.form.index int32_t = 0\n" "display.form.choices string[] = {7}[\"Default\", \"String\", \"Binary\", \"Decimal\", \"Hex\", \"Exponential\", \"Engineering\"]\n" "control.limitLow int32_t = 0\n" @@ -404,7 +403,6 @@ void testGetArray() "display.limitHigh int32_t = 0\n" "display.description string = \"\"\n" "display.units string = \"\"\n" - "display.precision int32_t = 0\n" "display.form.index int32_t = 0\n" "display.form.choices string[] = {7}[\"Default\", \"String\", \"Binary\", \"Decimal\", \"Hex\", \"Exponential\", \"Engineering\"]\n" "control.limitLow int32_t = 0\n" @@ -536,7 +534,6 @@ void testGetPut64() "display.limitHigh uint64_t = 0\n" "display.description string = \"\"\n" "display.units string = \"\"\n" - "display.precision int32_t = 0\n" "display.form.index int32_t = 0\n" "display.form.choices string[] = {7}[\"Default\", \"String\", \"Binary\", \"Decimal\", \"Hex\", \"Exponential\", \"Engineering\"]\n" "control.limitLow uint64_t = 0\n"