1
0
Fork 0

Validate string to double using std::isfinite

This commit is contained in:
krcroft 2020-03-31 10:31:08 -07:00 committed by Patryk Obara
parent 239396fec8
commit 75dd033cb0
3 changed files with 26 additions and 16 deletions

View file

@ -35,17 +35,6 @@
#include "support.h"
#include "video.h"
bool str_to_double(const std::string& input, double &value) {
bool result = false;
size_t bytes_read = 0;
try {
value = std::stod(input, &bytes_read);
if (bytes_read == input.size())
result = true;
} catch (std::invalid_argument &) {}
return result;
}
std::string get_basename(const std::string& filename) {
// Guard against corner cases: '', '/', '\', 'a'
if (filename.length() <= 1)