aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-05-06 15:25:01 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-05-06 15:29:16 +0200
commit783b182c8fa92674fa609b584c0b187469893ca4 (patch)
treea350421cd300a76f3004547793d0a74faadd9c32
parentb733288d95842d13a6559477bc9e8b5a93457ef0 (diff)
Remove dummy PRIszX macros for formatting
Size specifiers are no longer needed now that we use typesafe tinyformat for string formatting, instead of the system's sprintf. No functional changes. This continues the work in #3735.
-rw-r--r--src/core.cpp4
-rw-r--r--src/init.cpp8
-rw-r--r--src/main.cpp22
-rw-r--r--src/miner.cpp2
-rw-r--r--src/rpcmisc.cpp2
-rw-r--r--src/rpcprotocol.cpp2
-rw-r--r--src/test/util_tests.cpp12
-rw-r--r--src/util.h12
-rw-r--r--src/wallet.cpp2
-rw-r--r--src/walletdb.cpp2
10 files changed, 28 insertions, 40 deletions
diff --git a/src/core.cpp b/src/core.cpp
index cbdd24e806..7651ce9957 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -140,7 +140,7 @@ double CTransaction::ComputePriority(double dPriorityInputs, unsigned int nTxSiz
std::string CTransaction::ToString() const
{
std::string str;
- str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%"PRIszu", vout.size=%"PRIszu", nLockTime=%u)\n",
+ str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%u, vout.size=%u, nLockTime=%u)\n",
GetHash().ToString().substr(0,10),
nVersion,
vin.size(),
@@ -269,7 +269,7 @@ uint256 CBlock::CheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMer
void CBlock::print() const
{
- LogPrintf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%"PRIszu")\n",
+ LogPrintf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n",
GetHash().ToString(),
nVersion,
hashPrevBlock.ToString(),
diff --git a/src/init.cpp b/src/init.cpp
index 77c32d0b49..821ac4c875 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1078,12 +1078,12 @@ bool AppInit2(boost::thread_group& threadGroup)
RandAddSeedPerfmon();
//// debug print
- LogPrintf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size());
+ LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size());
LogPrintf("nBestHeight = %d\n", chainActive.Height());
#ifdef ENABLE_WALLET
- LogPrintf("setKeyPool.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0);
- LogPrintf("mapWallet.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapWallet.size() : 0);
- LogPrintf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
+ LogPrintf("setKeyPool.size() = %u\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0);
+ LogPrintf("mapWallet.size() = %u\n", pwalletMain ? pwalletMain->mapWallet.size() : 0);
+ LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
#endif
StartNode(threadGroup);
diff --git a/src/main.cpp b/src/main.cpp
index 40c713ce93..77418bbd15 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -432,7 +432,7 @@ bool AddOrphanTx(const CTransaction& tx)
BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash);
- LogPrint("mempool", "stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString(),
+ LogPrint("mempool", "stored orphan tx %s (mapsz %u)\n", hash.ToString(),
mapOrphanTransactions.size());
return true;
}
@@ -3044,7 +3044,7 @@ void PrintBlockTree()
// print item
CBlock block;
ReadBlockFromDisk(block, pindex);
- LogPrintf("%d (blk%05u.dat:0x%x) %s tx %"PRIszu"\n",
+ LogPrintf("%d (blk%05u.dat:0x%x) %s tx %u\n",
pindex->nHeight,
pindex->GetBlockPos().nFile, pindex->GetBlockPos().nPos,
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()),
@@ -3371,7 +3371,7 @@ void static ProcessGetData(CNode* pfrom)
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{
RandAddSeedPerfmon();
- LogPrint("net", "received: %s (%"PRIszu" bytes)\n", strCommand, vRecv.size());
+ LogPrint("net", "received: %s (%u bytes)\n", strCommand, vRecv.size());
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
{
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
@@ -3515,7 +3515,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (vAddr.size() > 1000)
{
Misbehaving(pfrom->GetId(), 20);
- return error("message addr size() = %"PRIszu"", vAddr.size());
+ return error("message addr size() = %u", vAddr.size());
}
// Store the new addresses
@@ -3578,7 +3578,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (vInv.size() > MAX_INV_SZ)
{
Misbehaving(pfrom->GetId(), 20);
- return error("message inv size() = %"PRIszu"", vInv.size());
+ return error("message inv size() = %u", vInv.size());
}
LOCK(cs_main);
@@ -3617,11 +3617,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (vInv.size() > MAX_INV_SZ)
{
Misbehaving(pfrom->GetId(), 20);
- return error("message getdata size() = %"PRIszu"", vInv.size());
+ return error("message getdata size() = %u", vInv.size());
}
if (fDebug || (vInv.size() != 1))
- LogPrint("net", "received getdata (%"PRIszu" invsz)\n", vInv.size());
+ LogPrint("net", "received getdata (%u invsz)\n", vInv.size());
if ((fDebug && vInv.size() > 0) || (vInv.size() == 1))
LogPrint("net", "received getdata for: %s\n", vInv[0].ToString());
@@ -3729,7 +3729,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
vEraseQueue.push_back(inv.hash);
- LogPrint("mempool", "AcceptToMemoryPool: %s %s : accepted %s (poolsz %"PRIszu")\n",
+ LogPrint("mempool", "AcceptToMemoryPool: %s %s : accepted %s (poolsz %u)\n",
pfrom->addr.ToString(), pfrom->cleanSubVer,
tx.GetHash().ToString(),
mempool.mapTx.size());
@@ -3914,7 +3914,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
}
if (!(sProblem.empty())) {
- LogPrint("net", "pong %s %s: %s, %x expected, %x received, %"PRIszu" bytes\n",
+ LogPrint("net", "pong %s %s: %s, %x expected, %x received, %u bytes\n",
pfrom->addr.ToString(),
pfrom->cleanSubVer,
sProblem,
@@ -4049,7 +4049,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
bool ProcessMessages(CNode* pfrom)
{
//if (fDebug)
- // LogPrintf("ProcessMessages(%"PRIszu" messages)\n", pfrom->vRecvMsg.size());
+ // LogPrintf("ProcessMessages(%u messages)\n", pfrom->vRecvMsg.size());
//
// Message format
@@ -4077,7 +4077,7 @@ bool ProcessMessages(CNode* pfrom)
CNetMessage& msg = *it;
//if (fDebug)
- // LogPrintf("ProcessMessages(message %u msgsz, %"PRIszu" bytes, complete:%s)\n",
+ // LogPrintf("ProcessMessages(message %u msgsz, %u bytes, complete:%s)\n",
// msg.hdr.nMessageSize, msg.vRecv.size(),
// msg.complete() ? "Y" : "N");
diff --git a/src/miner.cpp b/src/miner.cpp
index 3351908e65..6bc6edf34f 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -528,7 +528,7 @@ void static BitcoinMiner(CWallet *pwallet)
CBlock *pblock = &pblocktemplate->block;
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
- LogPrintf("Running BitcoinMiner with %"PRIszu" transactions in block (%u bytes)\n", pblock->vtx.size(),
+ LogPrintf("Running BitcoinMiner with %u transactions in block (%u bytes)\n", pblock->vtx.size(),
::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));
//
diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp
index ae154f2ae4..6964b97be3 100644
--- a/src/rpcmisc.cpp
+++ b/src/rpcmisc.cpp
@@ -187,7 +187,7 @@ CScript _createmultisig(const Array& params)
if ((int)keys.size() < nRequired)
throw runtime_error(
strprintf("not enough keys supplied "
- "(got %"PRIszu" keys, but need at least %d to redeem)", keys.size(), nRequired));
+ "(got %u keys, but need at least %d to redeem)", keys.size(), nRequired));
std::vector<CPubKey> pubkeys;
pubkeys.resize(keys.size());
for (unsigned int i = 0; i < keys.size(); i++)
diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp
index 652b14d187..5cbaa535ab 100644
--- a/src/rpcprotocol.cpp
+++ b/src/rpcprotocol.cpp
@@ -92,7 +92,7 @@ string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
"HTTP/1.1 %d %s\r\n"
"Date: %s\r\n"
"Connection: %s\r\n"
- "Content-Length: %"PRIszu"\r\n"
+ "Content-Length: %u\r\n"
"Content-Type: application/json\r\n"
"Server: bitcoin-json-rpc/%s\r\n"
"\r\n"
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
index b8f107f644..44998cbda7 100644
--- a/src/test/util_tests.cpp
+++ b/src/test/util_tests.cpp
@@ -321,15 +321,15 @@ BOOST_AUTO_TEST_CASE(strprintf_numbers)
size_t st = 12345678; /* unsigned size_t test value */
ssize_t sst = -12345678; /* signed size_t test value */
- BOOST_CHECK(strprintf("%s %"PRIszd" %s", B, sst, E) == B" -12345678 "E);
- BOOST_CHECK(strprintf("%s %"PRIszu" %s", B, st, E) == B" 12345678 "E);
- BOOST_CHECK(strprintf("%s %"PRIszx" %s", B, st, E) == B" bc614e "E);
+ BOOST_CHECK(strprintf("%s %d %s", B, sst, E) == B" -12345678 "E);
+ BOOST_CHECK(strprintf("%s %u %s", B, st, E) == B" 12345678 "E);
+ BOOST_CHECK(strprintf("%s %x %s", B, st, E) == B" bc614e "E);
ptrdiff_t pt = 87654321; /* positive ptrdiff_t test value */
ptrdiff_t spt = -87654321; /* negative ptrdiff_t test value */
- BOOST_CHECK(strprintf("%s %"PRIpdd" %s", B, spt, E) == B" -87654321 "E);
- BOOST_CHECK(strprintf("%s %"PRIpdu" %s", B, pt, E) == B" 87654321 "E);
- BOOST_CHECK(strprintf("%s %"PRIpdx" %s", B, pt, E) == B" 5397fb1 "E);
+ BOOST_CHECK(strprintf("%s %d %s", B, spt, E) == B" -87654321 "E);
+ BOOST_CHECK(strprintf("%s %u %s", B, pt, E) == B" 87654321 "E);
+ BOOST_CHECK(strprintf("%s %x %s", B, pt, E) == B" 5397fb1 "E);
}
#undef B
#undef E
diff --git a/src/util.h b/src/util.h
index fbd841f7a8..55d9308ab6 100644
--- a/src/util.h
+++ b/src/util.h
@@ -44,18 +44,6 @@ static const int64_t CENT = 1000000;
#define UEND(a) ((unsigned char*)&((&(a))[1]))
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
-/* Format characters for (s)size_t, ptrdiff_t.
- *
- * Define these as empty as the tinyformat-based formatting system is
- * type-safe, no special format characters are needed to specify sizes.
- */
-#define PRIszx "x"
-#define PRIszu "u"
-#define PRIszd "d"
-#define PRIpdx "x"
-#define PRIpdu "u"
-#define PRIpdd "d"
-
// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
#define PAIRTYPE(t1, t2) std::pair<t1, t2>
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 7cf2361096..22df7a9ad8 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -1638,7 +1638,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey())))
throw runtime_error("TopUpKeyPool() : writing generated key failed");
setKeyPool.insert(nEnd);
- LogPrintf("keypool added key %d, size=%"PRIszu"\n", nEnd, setKeyPool.size());
+ LogPrintf("keypool added key %d, size=%u\n", nEnd, setKeyPool.size());
}
}
return true;
diff --git a/src/walletdb.cpp b/src/walletdb.cpp
index 359a1cef61..80e9dded5f 100644
--- a/src/walletdb.cpp
+++ b/src/walletdb.cpp
@@ -894,7 +894,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
LogPrintf("Salvage(aggressive) found no records in %s.\n", newFilename);
return false;
}
- LogPrintf("Salvage(aggressive) found %"PRIszu" records\n", salvagedData.size());
+ LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size());
bool fSuccess = allOK;
Db* pdbCopy = new Db(&dbenv.dbenv, 0);