replace epicsParse*() with std::sto*()

This commit is contained in:
Michael Davidsaver
2020-04-16 21:30:35 -07:00
parent 51663e1cfd
commit 46bcf877c9
13 changed files with 558 additions and 589 deletions
+8 -5
View File
@@ -7,7 +7,6 @@
#include <epicsAssert.h>
#include <epicsMutex.h>
#include <epicsGuard.h>
#include <epicsStdlib.h>
#include <deque>
@@ -530,11 +529,15 @@ std::shared_ptr<Subscription> MonitorBuilder::exec()
if(ackAny.type()==TypeCode::String) {
auto sval = ackAny.as<std::string>();
if(sval.size()>1 && sval.back()=='%') {
double percent=50.0;
char *units = nullptr;
if(epicsParseDouble(sval.c_str(), &percent, &units)==0 && units && units[0]=='%') {
if(percent>0.0 && percent<=100.0)
try {
auto percent = parseTo<double>(sval);
if(percent>0.0 && percent<=100.0) {
op->ackAt = uint32_t(percent * op->queueSize);
} else {
throw std::invalid_argument("not in range (0%, 100%]");
}
}catch(std::exception&){
log_warn_printf(monevt, "Error parsing as percent ackAny: \"%s\"\n", sval.c_str());
}
}