Skip to content

Commit c3ad56f

Browse files
committed
Merge pull request #4138
783b182 Remove dummy PRIszX macros for formatting (Wladimir J. van der Laan)
2 parents 68d5fb3 + 783b182 commit c3ad56f

File tree

10 files changed

+28
-40
lines changed

10 files changed

+28
-40
lines changed

src/core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ double CTransaction::ComputePriority(double dPriorityInputs, unsigned int nTxSiz
140140
std::string CTransaction::ToString() const
141141
{
142142
std::string str;
143-
str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%"PRIszu", vout.size=%"PRIszu", nLockTime=%u)\n",
143+
str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%u, vout.size=%u, nLockTime=%u)\n",
144144
GetHash().ToString().substr(0,10),
145145
nVersion,
146146
vin.size(),
@@ -269,7 +269,7 @@ uint256 CBlock::CheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMer
269269

270270
void CBlock::print() const
271271
{
272-
LogPrintf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%"PRIszu")\n",
272+
LogPrintf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%u)\n",
273273
GetHash().ToString(),
274274
nVersion,
275275
hashPrevBlock.ToString(),

src/init.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,12 +1080,12 @@ bool AppInit2(boost::thread_group& threadGroup)
10801080
RandAddSeedPerfmon();
10811081

10821082
//// debug print
1083-
LogPrintf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size());
1083+
LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size());
10841084
LogPrintf("nBestHeight = %d\n", chainActive.Height());
10851085
#ifdef ENABLE_WALLET
1086-
LogPrintf("setKeyPool.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0);
1087-
LogPrintf("mapWallet.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapWallet.size() : 0);
1088-
LogPrintf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
1086+
LogPrintf("setKeyPool.size() = %u\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0);
1087+
LogPrintf("mapWallet.size() = %u\n", pwalletMain ? pwalletMain->mapWallet.size() : 0);
1088+
LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
10891089
#endif
10901090

10911091
StartNode(threadGroup);

src/main.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ bool AddOrphanTx(const CTransaction& tx)
430430
BOOST_FOREACH(const CTxIn& txin, tx.vin)
431431
mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash);
432432

433-
LogPrint("mempool", "stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString(),
433+
LogPrint("mempool", "stored orphan tx %s (mapsz %u)\n", hash.ToString(),
434434
mapOrphanTransactions.size());
435435
return true;
436436
}
@@ -3136,7 +3136,7 @@ void PrintBlockTree()
31363136
// print item
31373137
CBlock block;
31383138
ReadBlockFromDisk(block, pindex);
3139-
LogPrintf("%d (blk%05u.dat:0x%x) %s tx %"PRIszu"\n",
3139+
LogPrintf("%d (blk%05u.dat:0x%x) %s tx %u\n",
31403140
pindex->nHeight,
31413141
pindex->GetBlockPos().nFile, pindex->GetBlockPos().nPos,
31423142
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()),
@@ -3463,7 +3463,7 @@ void static ProcessGetData(CNode* pfrom)
34633463
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
34643464
{
34653465
RandAddSeedPerfmon();
3466-
LogPrint("net", "received: %s (%"PRIszu" bytes)\n", strCommand, vRecv.size());
3466+
LogPrint("net", "received: %s (%u bytes)\n", strCommand, vRecv.size());
34673467
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
34683468
{
34693469
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
@@ -3604,7 +3604,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
36043604
if (vAddr.size() > 1000)
36053605
{
36063606
Misbehaving(pfrom->GetId(), 20);
3607-
return error("message addr size() = %"PRIszu"", vAddr.size());
3607+
return error("message addr size() = %u", vAddr.size());
36083608
}
36093609

36103610
// Store the new addresses
@@ -3667,7 +3667,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
36673667
if (vInv.size() > MAX_INV_SZ)
36683668
{
36693669
Misbehaving(pfrom->GetId(), 20);
3670-
return error("message inv size() = %"PRIszu"", vInv.size());
3670+
return error("message inv size() = %u", vInv.size());
36713671
}
36723672

36733673
LOCK(cs_main);
@@ -3706,11 +3706,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
37063706
if (vInv.size() > MAX_INV_SZ)
37073707
{
37083708
Misbehaving(pfrom->GetId(), 20);
3709-
return error("message getdata size() = %"PRIszu"", vInv.size());
3709+
return error("message getdata size() = %u", vInv.size());
37103710
}
37113711

37123712
if (fDebug || (vInv.size() != 1))
3713-
LogPrint("net", "received getdata (%"PRIszu" invsz)\n", vInv.size());
3713+
LogPrint("net", "received getdata (%u invsz)\n", vInv.size());
37143714

37153715
if ((fDebug && vInv.size() > 0) || (vInv.size() == 1))
37163716
LogPrint("net", "received getdata for: %s\n", vInv[0].ToString());
@@ -3818,7 +3818,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
38183818
vEraseQueue.push_back(inv.hash);
38193819

38203820

3821-
LogPrint("mempool", "AcceptToMemoryPool: %s %s : accepted %s (poolsz %"PRIszu")\n",
3821+
LogPrint("mempool", "AcceptToMemoryPool: %s %s : accepted %s (poolsz %u)\n",
38223822
pfrom->addr.ToString(), pfrom->cleanSubVer,
38233823
tx.GetHash().ToString(),
38243824
mempool.mapTx.size());
@@ -4003,7 +4003,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
40034003
}
40044004

40054005
if (!(sProblem.empty())) {
4006-
LogPrint("net", "pong %s %s: %s, %x expected, %x received, %"PRIszu" bytes\n",
4006+
LogPrint("net", "pong %s %s: %s, %x expected, %x received, %u bytes\n",
40074007
pfrom->addr.ToString(),
40084008
pfrom->cleanSubVer,
40094009
sProblem,
@@ -4138,7 +4138,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
41384138
bool ProcessMessages(CNode* pfrom)
41394139
{
41404140
//if (fDebug)
4141-
// LogPrintf("ProcessMessages(%"PRIszu" messages)\n", pfrom->vRecvMsg.size());
4141+
// LogPrintf("ProcessMessages(%u messages)\n", pfrom->vRecvMsg.size());
41424142

41434143
//
41444144
// Message format
@@ -4166,7 +4166,7 @@ bool ProcessMessages(CNode* pfrom)
41664166
CNetMessage& msg = *it;
41674167

41684168
//if (fDebug)
4169-
// LogPrintf("ProcessMessages(message %u msgsz, %"PRIszu" bytes, complete:%s)\n",
4169+
// LogPrintf("ProcessMessages(message %u msgsz, %u bytes, complete:%s)\n",
41704170
// msg.hdr.nMessageSize, msg.vRecv.size(),
41714171
// msg.complete() ? "Y" : "N");
41724172

src/miner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ void static BitcoinMiner(CWallet *pwallet)
531531
CBlock *pblock = &pblocktemplate->block;
532532
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
533533

534-
LogPrintf("Running BitcoinMiner with %"PRIszu" transactions in block (%u bytes)\n", pblock->vtx.size(),
534+
LogPrintf("Running BitcoinMiner with %u transactions in block (%u bytes)\n", pblock->vtx.size(),
535535
::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));
536536

537537
//

src/rpcmisc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ CScript _createmultisig_redeemScript(const Array& params)
187187
if ((int)keys.size() < nRequired)
188188
throw runtime_error(
189189
strprintf("not enough keys supplied "
190-
"(got %"PRIszu" keys, but need at least %d to redeem)", keys.size(), nRequired));
190+
"(got %u keys, but need at least %d to redeem)", keys.size(), nRequired));
191191
std::vector<CPubKey> pubkeys;
192192
pubkeys.resize(keys.size());
193193
for (unsigned int i = 0; i < keys.size(); i++)

src/rpcprotocol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
9292
"HTTP/1.1 %d %s\r\n"
9393
"Date: %s\r\n"
9494
"Connection: %s\r\n"
95-
"Content-Length: %"PRIszu"\r\n"
95+
"Content-Length: %u\r\n"
9696
"Content-Type: application/json\r\n"
9797
"Server: bitcoin-json-rpc/%s\r\n"
9898
"\r\n"

src/test/util_tests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,15 @@ BOOST_AUTO_TEST_CASE(strprintf_numbers)
310310

311311
size_t st = 12345678; /* unsigned size_t test value */
312312
ssize_t sst = -12345678; /* signed size_t test value */
313-
BOOST_CHECK(strprintf("%s %"PRIszd" %s", B, sst, E) == B" -12345678 "E);
314-
BOOST_CHECK(strprintf("%s %"PRIszu" %s", B, st, E) == B" 12345678 "E);
315-
BOOST_CHECK(strprintf("%s %"PRIszx" %s", B, st, E) == B" bc614e "E);
313+
BOOST_CHECK(strprintf("%s %d %s", B, sst, E) == B" -12345678 "E);
314+
BOOST_CHECK(strprintf("%s %u %s", B, st, E) == B" 12345678 "E);
315+
BOOST_CHECK(strprintf("%s %x %s", B, st, E) == B" bc614e "E);
316316

317317
ptrdiff_t pt = 87654321; /* positive ptrdiff_t test value */
318318
ptrdiff_t spt = -87654321; /* negative ptrdiff_t test value */
319-
BOOST_CHECK(strprintf("%s %"PRIpdd" %s", B, spt, E) == B" -87654321 "E);
320-
BOOST_CHECK(strprintf("%s %"PRIpdu" %s", B, pt, E) == B" 87654321 "E);
321-
BOOST_CHECK(strprintf("%s %"PRIpdx" %s", B, pt, E) == B" 5397fb1 "E);
319+
BOOST_CHECK(strprintf("%s %d %s", B, spt, E) == B" -87654321 "E);
320+
BOOST_CHECK(strprintf("%s %u %s", B, pt, E) == B" 87654321 "E);
321+
BOOST_CHECK(strprintf("%s %x %s", B, pt, E) == B" 5397fb1 "E);
322322
}
323323
#undef B
324324
#undef E

src/util.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ static const int64_t CENT = 1000000;
4444
#define UEND(a) ((unsigned char*)&((&(a))[1]))
4545
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
4646

47-
/* Format characters for (s)size_t, ptrdiff_t.
48-
*
49-
* Define these as empty as the tinyformat-based formatting system is
50-
* type-safe, no special format characters are needed to specify sizes.
51-
*/
52-
#define PRIszx "x"
53-
#define PRIszu "u"
54-
#define PRIszd "d"
55-
#define PRIpdx "x"
56-
#define PRIpdu "u"
57-
#define PRIpdd "d"
58-
5947
// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
6048
#define PAIRTYPE(t1, t2) std::pair<t1, t2>
6149

src/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
16381638
if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey())))
16391639
throw runtime_error("TopUpKeyPool() : writing generated key failed");
16401640
setKeyPool.insert(nEnd);
1641-
LogPrintf("keypool added key %d, size=%"PRIszu"\n", nEnd, setKeyPool.size());
1641+
LogPrintf("keypool added key %d, size=%u\n", nEnd, setKeyPool.size());
16421642
}
16431643
}
16441644
return true;

src/walletdb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
894894
LogPrintf("Salvage(aggressive) found no records in %s.\n", newFilename);
895895
return false;
896896
}
897-
LogPrintf("Salvage(aggressive) found %"PRIszu" records\n", salvagedData.size());
897+
LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size());
898898

899899
bool fSuccess = allOK;
900900
Db* pdbCopy = new Db(&dbenv.dbenv, 0);

0 commit comments

Comments
 (0)