in src/common/UtilAll.cpp [199:218]
bool UtilAll::StringToInt64(const std::string& str, int64_t& val) {
char* endptr = NULL;
errno = 0; /* To distinguish success/failure after call */
val = strtoll(str.c_str(), &endptr, 10);
/* Check for various possible errors */
if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) || (errno != 0 && val == 0)) {
return false;
}
/*no digit was found Or Further characters after number*/
if (endptr == str.c_str()) {
return false;
}
/*no digit was found Or Further characters after number*/
if (*endptr != '\0') {
return false;
}
/* If we got here, strtol() successfully parsed a number */
return true;
}