diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-02-24 09:08:56 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-02-24 09:08:56 +0100 |
commit | f48742c2bf6002f7c1afaf1d1723659b85d4a3ac (patch) | |
tree | 70025f3ea0d6ad42058dbcf034180d0c961d305b /src/util.cpp | |
parent | 4fd082ded7af28929e909843eba5c801fe755257 (diff) |
Get rid of C99 PRI?64 usage in source files
Amend to d5f1e72. It turns out that BerkelyDB was including inttypes.h
indirectly, so we cannot fix this with just macros.
Trivial commit: apply the following script to all .cpp and .h files:
# Middle
sed -i 's/"PRIx64"/x/g' "$1"
sed -i 's/"PRIu64"/u/g' "$1"
sed -i 's/"PRId64"/d/g' "$1"
# Initial
sed -i 's/PRIx64"/"x/g' "$1"
sed -i 's/PRIu64"/"u/g' "$1"
sed -i 's/PRId64"/"d/g' "$1"
# Trailing
sed -i 's/"PRIx64/x"/g' "$1"
sed -i 's/"PRIu64/u"/g' "$1"
sed -i 's/"PRId64/d"/g' "$1"
After this commit, `git grep` for PRI.64 should turn up nothing except
the defines in util.h.
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util.cpp b/src/util.cpp index 8cfd1c2e03..4e326ffcf4 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -330,7 +330,7 @@ string FormatMoney(int64_t n, bool fPlus) int64_t n_abs = (n > 0 ? n : -n); int64_t quotient = n_abs/COIN; int64_t remainder = n_abs%COIN; - string str = strprintf("%"PRId64".%08"PRId64, quotient, remainder); + string str = strprintf("%d.%08d", quotient, remainder); // Right-trim excess zeros before the decimal point: int nTrim = 0; @@ -1278,7 +1278,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nTime) // Add data static CMedianFilter<int64_t> vTimeOffsets(200,0); vTimeOffsets.input(nOffsetSample); - LogPrintf("Added time data, samples %d, offset %+"PRId64" (%+"PRId64" minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60); + LogPrintf("Added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60); if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1) { int64_t nMedian = vTimeOffsets.median(); @@ -1313,10 +1313,10 @@ void AddTimeData(const CNetAddr& ip, int64_t nTime) } if (fDebug) { BOOST_FOREACH(int64_t n, vSorted) - LogPrintf("%+"PRId64" ", n); + LogPrintf("%+d ", n); LogPrintf("| "); } - LogPrintf("nTimeOffset = %+"PRId64" (%+"PRId64" minutes)\n", nTimeOffset, nTimeOffset/60); + LogPrintf("nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset/60); } } |