rec: Fix precision where link not set

Don't just force the precision to 15 if an INPx link is not set,
default to PREC field instead.
This commit is contained in:
Andrew Johnson
2012-12-18 14:13:23 -06:00
parent 04ff9eb8a1
commit 615fd741b9
4 changed files with 20 additions and 19 deletions

View File

@@ -360,22 +360,25 @@ static long get_precision(DBADDR *paddr, long *pprecision)
aSubRecord *prec = (aSubRecord *)paddr->precord;
int fieldIndex = dbGetFieldIndex(paddr);
int linkNumber;
short precision;
*pprecision = prec->prec;
linkNumber = get_inlinkNumber(fieldIndex);
if (linkNumber >= 0) {
short precision;
if (dbGetPrecision(&prec->inpa + linkNumber, &precision) == 0)
*pprecision = precision;
return 0;
}
}
linkNumber = get_outlinkNumber(fieldIndex);
if (linkNumber >= 0) {
short precision;
if (dbGetPrecision(&prec->outa + linkNumber, &precision) == 0)
*pprecision = precision;
return 0;
}
recGblGetPrec(paddr, pprecision);
} else
recGblGetPrec(paddr, pprecision);
return 0;
}

View File

@@ -188,16 +188,15 @@ static long get_precision(DBADDR *paddr, long *pprecision)
int linkNumber;
*pprecision = prec->prec;
if (fieldIndex == indexof(VAL)) {
if (fieldIndex == indexof(VAL))
return 0;
}
linkNumber = get_linkNumber(fieldIndex);
if (linkNumber >= 0) {
short precision;
if (dbGetPrecision(&prec->inpa + linkNumber, &precision) == 0)
*pprecision = precision;
else
*pprecision = 15;
} else
recGblGetPrec(paddr, pprecision);
return 0;

View File

@@ -414,21 +414,21 @@ static long get_precision(DBADDR *paddr, long *pprecision)
int fieldIndex = dbGetFieldIndex(paddr);
int linkNumber;
if(fieldIndex == indexof(ODLY)) {
if (fieldIndex == indexof(ODLY)) {
*pprecision = calcoutODLYprecision;
return 0;
}
*pprecision = prec->prec;
if (fieldIndex == indexof(VAL)) {
if (fieldIndex == indexof(VAL))
return 0;
}
linkNumber = get_linkNumber(fieldIndex);
if (linkNumber >= 0) {
short precision;
if (dbGetPrecision(&prec->inpa + linkNumber, &precision) == 0)
*pprecision = precision;
else
*pprecision = 15;
} else
recGblGetPrec(paddr, pprecision);
return 0;

View File

@@ -222,16 +222,15 @@ static long get_precision(DBADDR *paddr, long *pprecision)
int linkNumber;
*pprecision = prec->prec;
if (fieldIndex == indexof(VAL)) {
return 0;
}
if (fieldIndex == indexof(VAL))
return 0;
linkNumber = get_linkNumber(fieldIndex);
if (linkNumber >= 0) {
short precision;
if (dbGetPrecision(&prec->inpa + linkNumber, &precision) == 0)
*pprecision = precision;
else
*pprecision = 15;
} else
recGblGetPrec(paddr, pprecision);
return 0;