Fixed 64 bit compiler warnings from Tom Palaia/MacOS.

This commit is contained in:
Andrew Johnson
2009-04-23 18:49:40 +00:00
parent b1234b4667
commit 31d149d8d9
17 changed files with 226 additions and 210 deletions

View File

@@ -313,7 +313,7 @@ static int create_break( struct brkCreateInfo *pbci, brkInt *pabrkInt,
*************************************************************************/
/* Must start with table entry corresponding to engLow; */
i = ilow;
i = (int) ilow;
if (i >= ntable - 1)
i = ntable - 2;
rawBeg = table[i] + (table[i + 1] - table[i]) * (ilow - (double) i);

View File

@@ -216,8 +216,8 @@ static void get_graphics(DBADDR *paddr, char **ppbuffer,
if(got_data) {
struct dbr_grLong *pgr=(struct dbr_grLong*)pbuffer;
pgr->upper_disp_limit = grd.upper_disp_limit;
pgr->lower_disp_limit = grd.lower_disp_limit;
pgr->upper_disp_limit = (epicsInt32)grd.upper_disp_limit;
pgr->lower_disp_limit = (epicsInt32)grd.lower_disp_limit;
} else {
memset(pbuffer,'\0',dbr_grLong_size);
*options = (*options) ^ DBR_GR_LONG; /*Turn off option*/
@@ -256,8 +256,8 @@ static void get_control(DBADDR *paddr, char **ppbuffer,
if(got_data) {
struct dbr_ctrlLong *pctrl=(struct dbr_ctrlLong*)pbuffer;
pctrl->upper_ctrl_limit = ctrld.upper_ctrl_limit;
pctrl->lower_ctrl_limit = ctrld.lower_ctrl_limit;
pctrl->upper_ctrl_limit = (epicsInt32)ctrld.upper_ctrl_limit;
pctrl->lower_ctrl_limit = (epicsInt32)ctrld.lower_ctrl_limit;
} else {
memset(pbuffer,'\0',dbr_ctrlLong_size);
*options = (*options) ^ DBR_CTRL_LONG; /*Turn off option*/
@@ -297,10 +297,10 @@ static void get_alarm(DBADDR *paddr, char **ppbuffer,
if(got_data) {
struct dbr_alLong *pal=(struct dbr_alLong*)pbuffer;
pal->upper_alarm_limit = ald.upper_alarm_limit;
pal->upper_warning_limit = ald.upper_warning_limit;
pal->lower_warning_limit = ald.lower_warning_limit;
pal->lower_alarm_limit = ald.lower_alarm_limit;
pal->upper_alarm_limit = (epicsInt32)ald.upper_alarm_limit;
pal->upper_warning_limit = (epicsInt32)ald.upper_warning_limit;
pal->lower_warning_limit = (epicsInt32)ald.lower_warning_limit;
pal->lower_alarm_limit = (epicsInt32)ald.lower_alarm_limit;
} else {
memset(pbuffer,'\0',dbr_alLong_size);
*options = (*options) ^ DBR_AL_LONG; /*Turn off option*/

View File

@@ -315,7 +315,7 @@ static long getStringFloat(
*pbuffer = value;
return(0);
} else if(strlen(psrc) == 0) {
*pbuffer = 0.0;
*pbuffer = 0;
return(0);
} else {
return(-1);
@@ -326,7 +326,7 @@ static long getStringFloat(
if(epicsScanFloat(psrc, &value) == 1) {
*pbuffer = value;
} else if(strlen(psrc) == 0) {
*pbuffer = 0.0;
*pbuffer = 0;
} else {
return(-1);
}
@@ -1935,12 +1935,12 @@ static long getDoubleLong(
double *psrc=(double *)(paddr->pfield);
if(nRequest==1 && offset==0) {
*pbuffer = *psrc;
*pbuffer = (epicsInt32)*psrc;
return(0);
}
psrc += offset;
while (nRequest) {
*pbuffer++ = *psrc++;
*pbuffer++ = (epicsInt32)*psrc++;
if(++offset==no_elements) psrc=(double *)paddr->pfield;
nRequest--;
}
@@ -1955,12 +1955,12 @@ static long getDoubleUlong(
double *psrc=(double *)(paddr->pfield);
if(nRequest==1 && offset==0) {
*pbuffer = *psrc;
*pbuffer = (epicsUInt32)*psrc;
return(0);
}
psrc += offset;
while (nRequest) {
*pbuffer++ = *psrc++;
*pbuffer++ = (epicsUInt32)*psrc++;
if(++offset==no_elements) psrc=(double *)paddr->pfield;
nRequest--;
}
@@ -4249,12 +4249,12 @@ static long putDoubleLong(
epicsInt32 *pdest=(epicsInt32 *)(paddr->pfield);
if(nRequest==1 && offset==0) {
*pdest = *pbuffer;
*pdest = (epicsInt32)*pbuffer;
return(0);
}
pdest += offset;
while (nRequest) {
*pdest++ = *pbuffer++;
*pdest++ = (epicsInt32)*pbuffer++;
if(++offset==no_elements) pdest=(epicsInt32 *)paddr->pfield;
nRequest--;
}
@@ -4269,12 +4269,12 @@ static long putDoubleUlong(
epicsUInt32 *pdest=(epicsUInt32 *)(paddr->pfield);
if(nRequest==1 && offset==0) {
*pdest = *pbuffer;
*pdest = (epicsUInt32)*pbuffer;
return(0);
}
pdest += offset;
while (nRequest) {
*pdest++ = *pbuffer++;
*pdest++ = (epicsUInt32)*pbuffer++;
if(++offset==no_elements) pdest=(epicsUInt32 *)paddr->pfield;
nRequest--;
}

View File

@@ -222,7 +222,7 @@ static long cvt_st_f(
float value;
if (*from == 0) {
*to = 0.0;
*to = 0;
return 0;
}
if (epicsScanFloat(from, &value) == 1) {
@@ -909,14 +909,14 @@ static long cvt_d_l(
epicsFloat64 *from,
epicsInt32 *to,
const dbAddr *paddr)
{ *to=*from; return(0); }
{ *to=(epicsInt32)*from; return(0); }
/* Convert Double to Unsigned Long */
static long cvt_d_ul(
epicsFloat64 *from,
epicsUInt32 *to,
const dbAddr *paddr)
{ *to=*from; return(0); }
{ *to=(epicsUInt32)*from; return(0); }
/* Convert Double to Float */
static long cvt_d_f(

View File

@@ -811,8 +811,8 @@ long epicsShareAPI dbAddPath(DBBASE *pdbbase,const char *path)
expectingPath = FALSE;
sawMissingPath = FALSE;
while (*path) {
int len;
size_t len;
/* preceding white space is removed */
if (isspace((int)*path)) {
path++;
@@ -2540,7 +2540,7 @@ char * epicsShareAPI dbVerify(DBENTRY *pdbentry,const char *pstring)
if(strstr(pstring,"$(") || strstr(pstring,"${")) return(NULL);
switch (pflddes->field_type) {
case DBF_STRING: {
unsigned int length;
size_t length;
length=strlen(pstring);
if(length>=pflddes->size) {

View File

@@ -57,83 +57,92 @@ static void ulongToHexString(epicsUInt32 source,char *pdest)
return;
}
static double delta[2]={1e-6,1e-15};
static int precision[2]={6,14};
static void realToString(double value,char *preturn,int isdouble)
static double delta[2] = {1e-6, 1e-15};
static int precision[2] = {6, 14};
static void realToString(double value, char *preturn, int isdouble)
{
double absvalue;
int logval,prec,end;
char tstr[30];
char *ptstr=&tstr[0];
char *ptstr = &tstr[0];
int round;
int ise=FALSE;
char *loce=NULL;
int ise = FALSE;
char *loce = NULL;
if(value==0.0) {strcpy(preturn,"0"); return;};
absvalue = (value<0.0 ? -value: value);
if(absvalue<(double)INT_MAX) {
epicsInt32 intval;
double diff;
intval=value;
diff = value - intval;
if(diff<0.0) diff =-diff;
if(diff < absvalue*delta[isdouble]) {
cvtLongToString(intval,preturn);
return;
}
if (value == 0) {
strcpy(preturn, "0");
return;
}
/*Now starts the hard cases*/
if(value<0.0) {*preturn++ = '-'; value = -value;}
logval = (int)log10(value);
if(logval>6 || logval<-2 ) {
int nout;
ise=TRUE;
prec = precision[isdouble];
nout = sprintf(ptstr,"%.*e",prec,value);
loce = strchr(ptstr,'e');
if(!loce) {
ptstr[nout] = 0;
strcpy(preturn,ptstr);
absvalue = value < 0 ? -value : value;
if (absvalue < (double)INT_MAX) {
epicsInt32 intval = (epicsInt32) value;
double diff = value - intval;
if (diff < 0) diff = -diff;
if (diff < absvalue * delta[isdouble]) {
cvtLongToString(intval, preturn);
return;
}
*loce++ = 0;
}
/*Now starts the hard cases*/
if (value < 0) {
*preturn++ = '-';
value = -value;
}
logval = (int)log10(value);
if (logval > 6 || logval < -2) {
int nout;
ise = TRUE;
prec = precision[isdouble];
nout = sprintf(ptstr, "%.*e", prec, value);
loce = strchr(ptstr, 'e');
if (!loce) {
ptstr[nout] = 0;
strcpy(preturn, ptstr);
return;
}
*loce++ = 0;
} else {
prec = precision[isdouble]-logval;
if(prec<0)prec=0;
sprintf(ptstr,"%.*f",prec,value);
prec = precision[isdouble] - logval;
if ( prec < 0) prec = 0;
sprintf(ptstr, "%.*f", prec, value);
}
if(prec>0) {
end = strlen(ptstr) -1;
round=FALSE;
while(TRUE) {
if(end<=0)break;
if(tstr[end]=='.'){end--; break;}
if(tstr[end]=='0'){end--; continue;}
if(!round && end<precision[isdouble]) break;
if(!round && tstr[end]<'8') break;
if(tstr[end-1]=='.') {
if(round)end = end-2;
break;
}
if(tstr[end-1]!='9') break;
round=TRUE;
end--;
}
tstr[end+1]=0;
while (round) {
if(tstr[end]<'9') {tstr[end]++; break;}
if(end==0) { *preturn++='1'; tstr[end]='0'; break;}
tstr[end--]='0';
}
if (prec > 0) {
end = strlen(ptstr) - 1;
round = FALSE;
while (end > 0) {
if (tstr[end] == '.') {end--; break;}
if (tstr[end] == '0') {end--; continue;}
if (!round && end < precision[isdouble]) break;
if (!round && tstr[end] < '8') break;
if (tstr[end-1] == '.') {
if (round) end = end-2;
break;
}
if (tstr[end-1] != '9') break;
round = TRUE;
end--;
}
tstr[end+1] = 0;
while (round) {
if (tstr[end] < '9') {tstr[end]++; break;}
if (end == 0) { *preturn++ = '1'; tstr[end] = '0'; break;}
tstr[end--] = '0';
}
}
strcpy(preturn,&tstr[0]);
if(ise) {
if(!(strchr(preturn,'.'))) strcat(preturn,".0");
strcat(preturn,"e");
strcat(preturn,loce);
strcpy(preturn, &tstr[0]);
if (ise) {
if (!(strchr(preturn, '.'))) strcat(preturn, ".0");
strcat(preturn, "e");
strcat(preturn, loce);
}
return;
}
static void floatToString(float value,char *preturn)
@@ -573,8 +582,8 @@ long dbPutStringNum(DBENTRY *pdbentry,const char *pstring)
value = epicsStrtod(pstring,&endp);
if(*endp!=0) status = S_dbLib_badField;
if(pflddes->field_type==DBF_FLOAT)
*(float *)pfield = value;
if(pflddes->field_type == DBF_FLOAT)
*(float *)pfield = (float)value;
else
*(double *)pfield = value;
}

View File

@@ -186,7 +186,8 @@ static int
}
while (pel >= ptable) {
int len = strlen(pel->name);
size_t len = strlen(pel->name);
if (epicsStrnCaseCmp(*ppsrc, pel->name, len) == 0) {
*ppel = pel;
*ppsrc += len;

View File

@@ -1,8 +1,7 @@
/*************************************************************************\
* Copyright (c) 2003 The University of Chicago, as Operator of Argonne
* Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* $Id$
@@ -15,8 +14,8 @@
#include <string.h>
#define epicsExportSharedSymbols
#include <epicsAssert.h>
#include <epicsString.h>
#include "cantProceed.h"
#include "epicsString.h"
#include "macLib.h"
char * epicsShareAPI
@@ -24,23 +23,21 @@ macEnvExpand(const char *str)
{
MAC_HANDLE *handle;
static char *pairs[] = { "", "environ", NULL, NULL };
long status;
int destCapacity = 128;
long destCapacity = 128;
char *dest = NULL;
int n;
status = macCreateHandle(&handle, pairs);
assert(status == 0);
if (macCreateHandle(&handle, pairs))
cantProceed("macEnvExpand: macCreateHandle failed.");
do {
destCapacity *= 2;
/*
* Use free/malloc rather than realloc since there's no need to
* bother copying the contents if realloc needs to move the buffer
* keep the original contents.
*/
free(dest);
dest = malloc(destCapacity);
assert(dest != 0);
dest = mallocMustSucceed(destCapacity, "macEnvExpand");
n = macExpandString(handle, str, dest, destCapacity);
} while (n >= (destCapacity - 1));
@@ -48,12 +45,13 @@ macEnvExpand(const char *str)
free(dest);
dest = NULL;
} else {
int unused = destCapacity - ++n;
size_t unused = destCapacity - ++n;
if (unused >= 20)
dest = realloc(dest, n);
}
status = macDeleteHandle(handle);
assert(status == 0);
if (macDeleteHandle(handle))
cantProceed("macEnvExpand: macDeleteHandle failed.");
return dest;
}

View File

@@ -8,11 +8,11 @@
\*************************************************************************/
/*epicsConvert.c*/
#include <epicsMath.h>
#include <float.h>
#include <limits.h>
#define epicsExportSharedSymbols
#include "epicsMath.h"
#include "epicsConvert.h"
#include "cantProceed.h"
@@ -20,20 +20,20 @@ epicsShareFunc float epicsConvertDoubleToFloat(double value)
{
float rtnvalue;
if (value == 0.0) {
rtnvalue = 0.0;
if (value == 0) {
rtnvalue = 0;
} else if (!finite(value)) {
rtnvalue = (float)value;
} else {
double abs = fabs(value);
if (abs >= FLT_MAX) {
if (value > 0.0)
if (value > 0)
rtnvalue = FLT_MAX;
else
rtnvalue = -FLT_MAX;
} else if(abs <= FLT_MIN) {
if (value > 0.0)
} else if (abs <= FLT_MIN) {
if (value > 0)
rtnvalue = FLT_MIN;
else
rtnvalue = -FLT_MIN;

View File

@@ -1,20 +1,19 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* Copyright (c) 2009 UChicago Argonna LLC, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*epicsStdlib.c*/
/*Author: Eric Norum */
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#define epicsExportSharedSymbols
#include "epicsMath.h"
#include "epicsStdlib.h"
#include "epicsString.h"
@@ -39,32 +38,33 @@ epicsShareFunc int epicsScanFloat(const char *str, float *dest)
dtmp = epicsStrtod(str, &endp);
if (endp == str)
return 0;
*dest = dtmp;
*dest = (float)dtmp;
return 1;
}
/* Systems with a working strtod() just #define epicsStrtod strtod */
#ifndef epicsStrtod
epicsShareFunc double epicsStrtod(
const char *str, char **endp)
epicsShareFunc double epicsStrtod(const char *str, char **endp)
{
const unsigned char *cp = (const unsigned char *) str;
double num = 1.0;
double den = 0.0;
const char *cp = str;
int negative = 0;
double res;
while (isspace((int)*cp))
cp++;
if (*cp == '+') {
cp++;
}
else if (*cp == '-') {
num = -1.0;
} else if (*cp == '-') {
negative = 1;
cp++;
}
if (!isalpha((int)*cp))
return strtod(str, endp);
if (epicsStrnCaseCmp("NAN", (const char *) cp, 3) == 0) {
num = 0.0;
if (epicsStrnCaseCmp("NAN", cp, 3) == 0) {
res = epicsNAN;
cp += 3;
if (*cp == '(') {
cp++;
@@ -72,19 +72,20 @@ epicsShareFunc double epicsStrtod(
continue;
}
}
else if (epicsStrnCaseCmp("INF", (const char *) cp, 3) == 0) {
else if (epicsStrnCaseCmp("INF", cp, 3) == 0) {
res = negative ? -epicsINF : epicsINF;
cp += 3;
if (epicsStrnCaseCmp("INITY", (const char *) cp, 5) == 0) {
if (epicsStrnCaseCmp("INITY", cp, 5) == 0) {
cp += 5;
}
} else {
cp = str;
res = 0;
}
else {
cp = (const unsigned char *) str;
num = 0.0;
den = 1.0;
}
if (endp)
*endp = (char *)cp;
return num / den;
return res;
}
#endif

View File

@@ -1,8 +1,6 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* Copyright (c) 2009 UChicago Argonna LLC, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
@@ -13,20 +11,14 @@
static float makeNAN ( void )
{
float a,b,c;
a = 0.0;
b = 0.0;
c = a / b;
return c;
float a = 0, b = 0;
return a / b;
}
static float makeINF ( void )
{
float a,b,c;
a = 1.0;
b = 0.0;
c = a / b;
return c;
float a = 1, b = 0;
return a / b;
}
epicsShareDef float epicsNAN = makeNAN();

View File

@@ -1,7 +1,6 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
@@ -15,5 +14,16 @@
#include <sys/time.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
epicsShareFunc void convertDoubleToWakeTime(double timeout,
struct timespec *wakeTime);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ifndef osdTimeh */

View File

@@ -1,10 +1,9 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* osi/os/posix/osdEvent.c */
@@ -20,7 +19,6 @@
#include <unistd.h>
#include <pthread.h>
#define epicsExportSharedSymbols
#include "epicsEvent.h"
#include "cantProceed.h"

View File

@@ -11,17 +11,17 @@
#include "epicsUnitTest.h"
#include "epicsAlgorithm.h"
#include "epicsMath.h"
#include "testMain.h"
MAIN(epicsAlgorithm)
{
testPlan(22);
float f0 = 0.0;
float f1 = 3.3f;
float f2 = 3.4f;
float Inf = 1.0 / f0;
float NaN = 0.0 / f0;
float Inf = epicsINF;
float NaN = epicsNAN;
testOk(epicsMin(f1, f2) == f1, "epicsMin(f1, f2)");
testOk(epicsMin(f1, -Inf) == -Inf, "epicsMin(f1, -Inf)");
@@ -43,20 +43,20 @@ MAIN(epicsAlgorithm)
testOk(isnan(epicsMax(f1, NaN)), "epicsMax(f1, NaN)");
testOk(epicsMax(f1, Inf) == Inf, "epicsMax(f1, Inf)");
epicsSwap(f1,f2);
epicsSwap(f1, f2);
testOk(f1==3.4f && f2==3.3f, "epicsSwap(f1, f2)");
int i1 = 3;
int i2 = 4;
testOk(epicsMin(i1,i2)==i1, "epicsMin(i1,i2)");
testOk(epicsMin(i2,i1)==i1, "epicsMin(i2,i1)");
testOk(epicsMin(i1, i2) == i1, "epicsMin(i1,i2)");
testOk(epicsMin(i2, i1) == i1, "epicsMin(i2,i1)");
testOk(epicsMax(i1,i2)==i2, "epicsMax(i1,i2)");
testOk(epicsMax(i2,i1)==i2, "epicsMax(i2,i1)");
testOk(epicsMax(i1, i2) == i2, "epicsMax(i1,i2)");
testOk(epicsMax(i2, i1) == i2, "epicsMax(i2,i1)");
epicsSwap(i1,i2);
testOk(i1==4 && i2==3, "epicsSwap(i1,i2)");
epicsSwap(i1, i2);
testOk(i1 == 4 && i2 == 3, "epicsSwap(i1, i2)");
return testDone();
}

View File

@@ -32,7 +32,7 @@
static void testEpicsSnprintf(void) {
char exbuffer[80], buffer[80];
const int ivalue = 1234;
const float fvalue = 1.23e4;
const float fvalue = 1.23e4f;
const char *svalue = "OneTwoThreeFour";
const char *format = "int %d float %8.2e string %s";
const char *expected = exbuffer;

View File

@@ -419,46 +419,53 @@ static long fetch_value(aoRecord *prec,double *pvalue)
static void convert(aoRecord *prec, double value)
{
/* check drive limits */
if(prec->drvh > prec->drvl) {
if (value > prec->drvh) value = prec->drvh;
else if (value < prec->drvl) value = prec->drvl;
}
prec->val = value;
prec->pval = value;
/* check drive limits */
if (prec->drvh > prec->drvl) {
if (value > prec->drvh)
value = prec->drvh;
else if (value < prec->drvl)
value = prec->drvl;
}
prec->val = value;
prec->pval = value;
/* now set value equal to desired output value */
/* apply the output rate of change */
if ( (prec->oroc) != 0.0 ){/*must be defined and >0*/
double diff;
/* now set value equal to desired output value */
/* apply the output rate of change */
if (prec->oroc != 0){/*must be defined and >0*/
double diff;
diff = value - prec->oval;
if (diff < 0){
if (prec->oroc < -diff) value = prec->oval - prec->oroc;
}else if (prec->oroc < diff) value = prec->oval + prec->oroc;
diff = value - prec->oval;
if (diff < 0) {
if (prec->oroc < -diff)
value = prec->oval - prec->oroc;
} else if (prec->oroc < diff)
value = prec->oval + prec->oroc;
}
prec->omod = (prec->oval!=value);
prec->oval = value;
/* convert */
switch (prec->linr) {
case menuConvertNO_CONVERSION:
break; /* do nothing*/
case menuConvertLINEAR:
case menuConvertSLOPE:
if (prec->eslo == 0.0) value = 0;
else value = (value - prec->eoff) / prec->eslo;
break;
default:
if (cvtEngToRawBpt(&value, prec->linr, prec->init,
(void *)&prec->pbrk, &prec->lbrk) != 0) {
recGblSetSevr(prec, SOFT_ALARM, MAJOR_ALARM);
return;
}
prec->omod = (prec->oval!=value);
prec->oval = value;
/* convert */
switch (prec->linr) {
case menuConvertNO_CONVERSION:
break; /* do nothing*/
case menuConvertLINEAR:
case menuConvertSLOPE:
if (prec->eslo == 0.0) value = 0;
else value = (value - prec->eoff) / prec->eslo;
break;
default:
if(cvtEngToRawBpt(&value,prec->linr,prec->init,(void *)&prec->pbrk,&prec->lbrk)!=0){
recGblSetSevr(prec,SOFT_ALARM,MAJOR_ALARM);
return;
}
}
value -= prec->aoff;
if(prec->aslo!=0.0) value /= prec->aslo;
if (value >= 0.0) prec->rval = value + 0.5 - prec->roff;
else prec->rval = value - 0.5 - prec->roff;
}
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;
}

View File

@@ -330,7 +330,7 @@ static long add_count(histogramRecord *prec)
if (temp<=(double)i*prec->wdth) break;
}
pdest=prec->bptr+i-1;
if (*pdest == (epicsUInt32) ULONG_MAX) *pdest=0.0;
if (*pdest == (epicsUInt32) UINT_MAX) *pdest=0;
(*pdest)++;
prec->mcnt++;
@@ -339,14 +339,14 @@ static long add_count(histogramRecord *prec)
static long clear_histogram(histogramRecord *prec)
{
int i;
int i;
for (i=0;i<=prec->nelm-1;i++)
*(prec->bptr+i)=0.0;
prec->mcnt=prec->mdel+1;
prec->udf=FALSE;
for (i = 0; i < prec->nelm; i++)
prec->bptr[i] = 0;
prec->mcnt = prec->mdel + 1;
prec->udf = FALSE;
return(0);
return(0);
}
static long readValue(histogramRecord *prec)