Fix gdd string to double conversion
This is an alternative fix for the issue described in https://github.com/epics-modules/pcas/issues/4 and https://github.com/epics-extensions/ca-gateway/issues/37 that keeps the call to epicsScanDouble() before trying sscanf() first with "%lf" (ignoring extra characters) then with "%x" (to catch hex numbers). (same commit as "upstream" commit 7c168f20 in base 3.15; fixes #4)
This commit is contained in:
@@ -50,14 +50,16 @@ bool getStringAsDouble ( const char * pString,
|
||||
ftmp = itmp;
|
||||
}
|
||||
else {
|
||||
int j = epicsScanDouble( pString, &ftmp );
|
||||
if ( j != 1 ) {
|
||||
j = sscanf ( pString,"%x", &itmp );
|
||||
if ( j == 1 ) {
|
||||
ftmp = itmp;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
int j = epicsScanDouble ( pString, &ftmp );
|
||||
if ( j != 1 ) {
|
||||
j = sscanf ( pString, "%lf", &ftmp );
|
||||
if ( j != 1 ) {
|
||||
j = sscanf ( pString, "%x", &itmp );
|
||||
if ( j == 1 ) {
|
||||
ftmp = itmp;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user