Merge pull request #2654 from akohlmey/collected-small-changes

Collected small changes
This commit is contained in:
Axel Kohlmeyer
2021-03-16 19:34:54 -04:00
committed by GitHub
113 changed files with 361 additions and 203 deletions

View File

@ -394,9 +394,16 @@ template<typename TYPE>
void utils::bounds(const char *file, int line, const std::string &str,
bigint nmin, bigint nmax, TYPE &nlo, TYPE &nhi, Error *error)
{
size_t found = str.find_first_of("*");
nlo = nhi = -1;
// check for illegal charcters
size_t found = str.find_first_not_of("*-0123456789");
if (found != std::string::npos) {
if (error) error->all(file,line,fmt::format("Invalid range string: {}",str));
return;
}
found = str.find_first_of("*");
if (found == std::string::npos) { // contains no '*'
nlo = nhi = strtol(str.c_str(),nullptr,10);
} else if (str.size() == 1) { // is only '*'