Merge changes from 3.14.12.5 (revno 12582)

This commit is contained in:
Andrew Johnson
2015-03-25 12:53:13 -05:00
5 changed files with 28 additions and 9 deletions

View File

@@ -14,6 +14,14 @@
<h2 align="center">Changes between 3.15.1 and 3.15.2</h2>
<!-- Insert new items immediately below here ... -->
<h3>aoRecord raw conversion overflows</h3>
<p>The ao record type now checks converted raw values and limits them to the
32-bit integer range before writing them to the RVAL field. Previously value
overflows relied on Undefined Behaviour which could give different results on
different platforms. The ROFF fields of the ao and ai record types are now
DBF_ULONG to allow an ROFF setting of 0x80000000 to work properly.</p>
<h3>Changes to &lt;top&gt;/cfg/* files</h3>
<p>The order in which cfg/CONFIG* and cfg/RULES* files are included from support

View File

@@ -85,7 +85,8 @@ static void sprint_long (char *ret, dbr_long_t val, IntFormatT outType)
"0x%lX" /* hex */
};
sprintf(ret, fmt[outType], val);
/* Formats have long modifier, pass value as a long */
sprintf(ret, fmt[outType], (long) val);
}
}

View File

@@ -404,8 +404,8 @@ monitoring functionality.
pp(TRUE)
interest(2)
}
field(ROFF,DBF_LONG) {
prompt("Raw Offset, obsolete")
field(ROFF,DBF_ULONG) {
prompt("Raw Offset")
pp(TRUE)
interest(2)
}

View File

@@ -498,10 +498,20 @@ static void convert(aoRecord *prec, double value)
}
value -= prec->aoff;
if (prec->aslo != 0) value /= prec->aslo;
if (value >= 0.0)
prec->rval = (epicsInt32)(value + 0.5) - prec->roff;
else
prec->rval = (epicsInt32)(value - 0.5) - prec->roff;
/* Apply raw offset and limits, round to 32-bit integer */
value -= prec->roff;
if (value >= 0.0) {
if (value >= (0x7fffffff - 0.5))
prec->rval = 0x7fffffff;
else
prec->rval = (epicsInt32)(value + 0.5);
} else {
if (value > (0.5 - 0x80000000))
prec->rval = (epicsInt32)(value - 0.5);
else
prec->rval = 0x80000000;
}
}

View File

@@ -342,8 +342,8 @@ information on these fields.
size(16)
prop(YES)
}
field(ROFF,DBF_LONG) {
prompt("Raw Offset, obsolete")
field(ROFF,DBF_ULONG) {
prompt("Raw Offset")
pp(TRUE)
interest(2)
}