X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/e883aa30ce4b5f31fcacf6993dac6372d677f8e4..a5bb534ab656e9eaab163c22df0325d3baa3ce40:/stglibs/common.lib/common.cpp diff --git a/stglibs/common.lib/common.cpp b/stglibs/common.lib/common.cpp index a5899dd2..eb39da6a 100644 --- a/stglibs/common.lib/common.cpp +++ b/stglibs/common.lib/common.cpp @@ -728,6 +728,26 @@ int str2x(const std::string & str, unsigned & x) { x = strtoul(str.c_str(), NULL, 10); +if (errno == ERANGE) + return -1; + +return 0; +} +//--------------------------------------------------------------------------- +int str2x(const std::string & str, long & x) +{ +x = strtol(str.c_str(), NULL, 10); + +if (errno == ERANGE) + return -1; + +return 0; +} +//--------------------------------------------------------------------------- +int str2x(const std::string & str, unsigned long & x) +{ +x = strtoul(str.c_str(), NULL, 10); + if (errno == ERANGE) return -1;