It's c++11: pure use of strtoll 313/head
authorsvost <ya.nowa@yandex.ru>
Mon, 11 Apr 2016 20:43:18 +0000 (23:43 +0300)
committersvost <ya.nowa@yandex.ru>
Mon, 11 Apr 2016 20:43:18 +0000 (23:43 +0300)
src/util.cpp
src/util.h
src/wallet.h

index 4225072..c0513ef 100644 (file)
@@ -419,7 +419,7 @@ bool ParseMoney(const char* pszIn, int64_t& nRet)
         return false;
     if (nUnits < 0 || nUnits > COIN)
         return false;
-    int64_t nWhole = atoi64(strWhole);
+    int64_t nWhole = strtoll(strWhole);
     int64_t nValue = nWhole*COIN + nUnits;
 
     nRet = nValue;
@@ -547,7 +547,7 @@ string GetArg(const string& strArg, const string& strDefault)
 int64_t GetArg(const string& strArg, int64_t nDefault)
 {
     if (mapArgs.count(strArg))
-        return atoi64(mapArgs[strArg]);
+        return strtoll(mapArgs[strArg]);
     return nDefault;
 }
 
index 57b9f38..48b092f 100644 (file)
@@ -259,22 +259,14 @@ inline std::string itostr(int n)
     return strprintf("%d", n);
 }
 
-inline int64_t atoi64(const char* psz)
+inline int64_t strtoll(const char* psz)
 {
-#ifdef _MSC_VER
-    return _atoi64(psz);
-#else
     return strtoll(psz, NULL, 10);
-#endif
 }
 
-inline int64_t atoi64(const std::string& str)
+inline int64_t strtoll(const std::string& str)
 {
-#ifdef _MSC_VER
-    return _atoi64(str.c_str());
-#else
     return strtoll(str.c_str(), NULL, 10);
-#endif
 }
 
 inline int32_t strtol(const char* psz)
index 7fa62f3..1e7d780 100644 (file)
@@ -361,7 +361,7 @@ static void ReadOrderPos(int64_t& nOrderPos, mapValue_t& mapValue)
         nOrderPos = -1; // TODO: calculate elsewhere
         return;
     }
-    nOrderPos = atoi64(mapValue["n"].c_str());
+    nOrderPos = strtoll(mapValue["n"]);
 }
 
 
@@ -513,7 +513,7 @@ public:
 
             ReadOrderPos(pthis->nOrderPos, pthis->mapValue);
 
-            pthis->nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(pthis->mapValue["timesmart"]) : 0;
+            pthis->nTimeSmart = mapValue.count("timesmart") ? (unsigned int)strtoll(pthis->mapValue["timesmart"]) : 0;
         }
 
         pthis->mapValue.erase("fromaccount");