aboutsummaryrefslogtreecommitdiff
path: root/src/utilmoneystr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilmoneystr.cpp')
-rw-r--r--src/utilmoneystr.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/utilmoneystr.cpp b/src/utilmoneystr.cpp
index 1bd48d8d4..0f3203432 100644
--- a/src/utilmoneystr.cpp
+++ b/src/utilmoneystr.cpp
@@ -1,11 +1,17 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2014 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "utilmoneystr.h"
-#include "core.h"
+#include "primitives/transaction.h"
#include "tinyformat.h"
+#include "utilstrencodings.h"
using namespace std;
-string FormatMoney(int64_t n, bool fPlus)
+std::string FormatMoney(const CAmount& n)
{
// Note: not using straight sprintf here because we do NOT want
// localized number formatting.
@@ -23,18 +29,16 @@ string FormatMoney(int64_t n, bool fPlus)
if (n < 0)
str.insert((unsigned int)0, 1, '-');
- else if (fPlus && n > 0)
- str.insert((unsigned int)0, 1, '+');
return str;
}
-bool ParseMoney(const string& str, int64_t& nRet)
+bool ParseMoney(const string& str, CAmount& nRet)
{
return ParseMoney(str.c_str(), nRet);
}
-bool ParseMoney(const char* pszIn, int64_t& nRet)
+bool ParseMoney(const char* pszIn, CAmount& nRet)
{
string strWhole;
int64_t nUnits = 0;
@@ -68,7 +72,7 @@ bool ParseMoney(const char* pszIn, int64_t& nRet)
if (nUnits < 0 || nUnits > COIN)
return false;
int64_t nWhole = atoi64(strWhole);
- int64_t nValue = nWhole*COIN + nUnits;
+ CAmount nValue = nWhole*COIN + nUnits;
nRet = nValue;
return true;