]> git.stg.codes - stg.git/blobdiff - stglibs/common.lib/common.cpp
Синхронізовано з CVS
[stg.git] / stglibs / common.lib / common.cpp
index a5899dd2c2fdaaea9311b2ef3b1a81a648ab7ca9..b8d2b0e2184124fc6d5730f08778f421d3bbbcb8 100644 (file)
@@ -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 $
  */
 
@@ -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;
 
@@ -759,6 +779,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);