diff options
author | Brandon Dahler <brandon.dahler@gmail.com> | 2013-04-13 00:13:08 -0500 |
---|---|---|
committer | Brandon Dahler <brandon.dahler@gmail.com> | 2013-11-10 09:36:28 -0600 |
commit | 51ed9ec971614aebdbfbd9527aba365dd0afd437 (patch) | |
tree | d2f910390e55aef857023812fbdaefdd66cd99ff /src/core.cpp | |
parent | 7c4c207be8420d394a5abc4368d1bb69ad4f8067 (diff) |
Cleanup code using forward declarations.
Use misc methods of avoiding unnecesary header includes.
Replace int typedefs with int##_t from stdint.h.
Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h.
Normalize QT_VERSION ifs where possible.
Resolve some indirect dependencies as direct ones.
Remove extern declarations from .cpp files.
Diffstat (limited to 'src/core.cpp')
-rw-r--r-- | src/core.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core.cpp b/src/core.cpp index 5512f81b61..26c2cfc5c5 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -4,8 +4,11 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "core.h" + #include "util.h" +#include <stdint.h> + std::string COutPoint::ToString() const { return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10).c_str(), n); @@ -50,7 +53,7 @@ void CTxIn::print() const LogPrintf("%s\n", ToString().c_str()); } -CTxOut::CTxOut(int64 nValueIn, CScript scriptPubKeyIn) +CTxOut::CTxOut(int64_t nValueIn, CScript scriptPubKeyIn) { nValue = nValueIn; scriptPubKey = scriptPubKeyIn; @@ -63,7 +66,7 @@ uint256 CTxOut::GetHash() const std::string CTxOut::ToString() const { - return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str()); + return strprintf("CTxOut(nValue=%"PRId64".%08"PRId64", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str()); } void CTxOut::print() const @@ -135,7 +138,7 @@ void CTransaction::print() const // * if e==9, we only know the resulting number is not zero, so output 1 + 10*(n - 1) + 9 // (this is decodable, as d is in [1-9] and e is in [0-9]) -uint64 CTxOutCompressor::CompressAmount(uint64 n) +uint64_t CTxOutCompressor::CompressAmount(uint64_t n) { if (n == 0) return 0; @@ -154,7 +157,7 @@ uint64 CTxOutCompressor::CompressAmount(uint64 n) } } -uint64 CTxOutCompressor::DecompressAmount(uint64 x) +uint64_t CTxOutCompressor::DecompressAmount(uint64_t x) { // x = 0 OR x = 1+10*(9*n + d - 1) + e OR x = 1+10*(n - 1) + 9 if (x == 0) @@ -163,7 +166,7 @@ uint64 CTxOutCompressor::DecompressAmount(uint64 x) // x = 10*(9*n + d - 1) + e int e = x % 10; x /= 10; - uint64 n = 0; + uint64_t n = 0; if (e < 9) { // x = 9*n + d - 1 int d = (x % 9) + 1; |