X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..05e788d7f5054a25d82e2824f6daf661d0cab38e:/stglibs/common.lib/common.cpp diff --git a/stglibs/common.lib/common.cpp b/stglibs/common.lib/common.cpp index a5899dd2..71246704 100644 --- a/stglibs/common.lib/common.cpp +++ b/stglibs/common.lib/common.cpp @@ -23,8 +23,8 @@ */ /* - $Revision: 1.41 $ - $Date: 2010/11/03 10:26:30 $ + $Revision: 1.42 $ + $Date: 2010/11/08 10:11:19 $ $Author: faust $ */ @@ -54,9 +54,18 @@ #include #endif*/ +#ifdef FREE_BSD +#include +#endif + +#ifdef WIN32 +#include +#else #include #include #include +#endif + #include #include @@ -728,6 +737,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; @@ -759,6 +788,11 @@ const std::string & x2str(unsigned x, std::string & s) return unsigned2str(x, s); } //--------------------------------------------------------------------------- +const std::string & x2str(unsigned long x, std::string & s) +{ +return unsigned2str(x, s); +} +//--------------------------------------------------------------------------- const std::string & x2str(unsigned long long x, std::string & s) { return unsigned2str(x, s);