From 1567da13661e2a87e78cdc4df947d8897b55e33e Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Fri, 29 Nov 2024 10:47:03 +0100 Subject: [PATCH] correct mask for finding field in linkGrp It worked before because the get_xxx functions are never called for the links (bit0 = 1), but checking both bits looks cleaner. --- modules/database/src/std/rec/seqRecord.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/database/src/std/rec/seqRecord.c b/modules/database/src/std/rec/seqRecord.c index 76890e2868..44d8599c49 100644 --- a/modules/database/src/std/rec/seqRecord.c +++ b/modules/database/src/std/rec/seqRecord.c @@ -285,7 +285,7 @@ static long get_units(DBADDR *paddr, char *units) int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0); if (fieldOffset >= 0) - switch (fieldOffset & 2) { + switch (fieldOffset & 3) { case 0: /* DLYn */ strcpy(units, "s"); break; @@ -303,7 +303,7 @@ static long get_precision(const DBADDR *paddr, long *pprecision) short precision; if (fieldOffset >= 0) - switch (fieldOffset & 2) { + switch (fieldOffset & 3) { case 0: /* DLYn */ *pprecision = seqDLYprecision; return 0; @@ -324,7 +324,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0); if (fieldOffset >= 0) - switch (fieldOffset & 2) { + switch (fieldOffset & 3) { case 0: /* DLYn */ pgd->lower_disp_limit = 0.0; pgd->lower_disp_limit = 10.0; @@ -343,7 +343,7 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) { int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0); - if (fieldOffset >= 0 && (fieldOffset & 2) == 0) { /* DLYn */ + if (fieldOffset >= 0 && (fieldOffset & 3) == 0) { /* DLYn */ pcd->lower_ctrl_limit = 0.0; pcd->upper_ctrl_limit = seqDLYlimit; } @@ -357,7 +357,7 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad) seqRecord *prec = (seqRecord *) paddr->precord; int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0); - if (fieldOffset >= 0 && (fieldOffset & 2) == 2) /* DOn */ + if (fieldOffset >= 0 && (fieldOffset & 3) == 2) /* DOn */ dbGetAlarmLimits(get_dol(prec, fieldOffset), &pad->lower_alarm_limit, &pad->lower_warning_limit, &pad->upper_warning_limit, &pad->upper_alarm_limit);