diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-05-12 13:52:51 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-05-12 14:01:48 +0200 |
commit | c3ad56f4e0b587d8d763af03d743fdfc2d180c9b (patch) | |
tree | 2d2b7e758ff288d0b273a33c9dc942f20e47a631 | |
parent | 68d5fb3cb3bf456735ff48c8caa5e4074ae8579a (diff) | |
parent | 783b182c8fa92674fa609b584c0b187469893ca4 (diff) |
Merge pull request #4138
783b182 Remove dummy PRIszX macros for formatting (Wladimir J. van der Laan)
-rw-r--r-- | src/core.cpp | 4 | ||||
-rw-r--r-- | src/init.cpp | 8 | ||||
-rw-r--r-- | src/main.cpp | 22 | ||||
-rw-r--r-- | src/miner.cpp | 2 | ||||
-rw-r--r-- | src/rpcmisc.cpp | 2 | ||||
-rw-r--r-- | src/rpcprotocol.cpp | 2 | ||||
-rw-r--r-- | src/test/util_tests.cpp | 12 | ||||
-rw-r--r-- | src/util.h | 12 | ||||
-rw-r--r-- | src/wallet.cpp | 2 | ||||
-rw-r--r-- | src/walletdb.cpp | 2 |
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 2c3bb02758..7007707855 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1080,12 +1080,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 379ca3ef74..f7c53052e1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -430,7 +430,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; } @@ -3136,7 +3136,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()), @@ -3463,7 +3463,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"); @@ -3604,7 +3604,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 @@ -3667,7 +3667,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); @@ -3706,11 +3706,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()); @@ -3818,7 +3818,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()); @@ -4003,7 +4003,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, @@ -4138,7 +4138,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 @@ -4166,7 +4166,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 50be4fad40..94fc8e3888 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -531,7 +531,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 a2694d458a..2564a3f1a6 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -187,7 +187,7 @@ CScript _createmultisig_redeemScript(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 f4ca8c0539..3811569c0a 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -310,15 +310,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 011a40e540..27a08716dd 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 418720de93..fa7aecddb6 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); |