Use epicsScanFloat/epicsScanDouble rather than sscanf.
This allows proper handling of Nan/Inf on all architectures.
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
* FLASE expression element not found
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <epicsStdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
@@ -347,7 +347,7 @@ long epicsShareAPI postfix(const char *pin,char *ppostfix,short *perror)
|
||||
*ppostfix++ = '\0';
|
||||
|
||||
ppostfix = pposthold;
|
||||
if ( sscanf(ppostfix,"%lg",&constant) != 1) {
|
||||
if ( epicsScanDouble(ppostfix, &constant) != 1) {
|
||||
*ppostfix = '\0';
|
||||
} else {
|
||||
memcpy(ppostfix,(void *)&constant,8);
|
||||
|
||||
4
src/libCom/env/envSubr.c
vendored
4
src/libCom/env/envSubr.c
vendored
@@ -37,7 +37,7 @@
|
||||
*-***************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <epicsStdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
@@ -198,7 +198,7 @@ double *pDouble /* O pointer to place to store value */
|
||||
|
||||
ptext = envGetConfigParam(pParam, sizeof text, text);
|
||||
if (ptext != NULL) {
|
||||
count = sscanf(text, "%lf", pDouble);
|
||||
count = epicsScanDouble(text, pDouble);
|
||||
if (count == 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "epicsStdio.h"
|
||||
|
||||
|
||||
epicsShareFunc int epicsShareAPI epicsStrScanDouble(const char *str, double *dest)
|
||||
epicsShareFunc int epicsShareAPI epicsScanDouble(const char *str, double *dest)
|
||||
{
|
||||
char *endp;
|
||||
double dtmp;
|
||||
@@ -28,7 +28,7 @@ epicsShareFunc int epicsShareAPI epicsStrScanDouble(const char *str, double *des
|
||||
return 1;
|
||||
}
|
||||
|
||||
epicsShareFunc int epicsShareAPI epicsStrScanFloat(const char *str, float *dest)
|
||||
epicsShareFunc int epicsShareAPI epicsScanFloat(const char *str, float *dest)
|
||||
{
|
||||
char *endp;
|
||||
double dtmp;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
epicsShareFunc int epicsShareAPI epicsStrScanDouble(const char *str, double *dest);
|
||||
epicsShareFunc int epicsShareAPI epicsStrScanFloat(const char *str, float *dest);
|
||||
epicsShareFunc int epicsShareAPI epicsScanDouble(const char *str, double *dest);
|
||||
epicsShareFunc int epicsShareAPI epicsScanFloat(const char *str, float *dest);
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <osdStrtod.h>
|
||||
|
||||
Reference in New Issue
Block a user