Browse Source

Merge branch '2012_09_fixwformat' of github.com:laanwj/bitcoin

miguelfreitas
Gavin Andresen 12 years ago
parent
commit
0547b02af7
  1. 2
      bitcoin-qt.pro
  2. 2
      src/bitcoinrpc.cpp
  3. 8
      src/init.cpp
  4. 2
      src/irc.cpp
  5. 34
      src/main.cpp
  6. 6
      src/main.h
  7. 2
      src/makefile.linux-mingw
  8. 2
      src/makefile.mingw
  9. 2
      src/makefile.osx
  10. 2
      src/makefile.unix
  11. 2
      src/net.cpp
  12. 2
      src/rpcwallet.cpp
  13. 2
      src/util.cpp
  14. 14
      src/util.h
  15. 6
      src/wallet.cpp

2
bitcoin-qt.pro

@ -101,7 +101,7 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) {
DEFINES += HAVE_BUILD_INFO DEFINES += HAVE_BUILD_INFO
} }
QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wno-format -Wno-format-security -Wno-unused-parameter -Wstack-protector QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector
# Input # Input
DEPENDPATH += src src/json src/qt DEPENDPATH += src src/json src/qt

2
src/bitcoinrpc.cpp

@ -345,7 +345,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
"HTTP/1.1 %d %s\r\n" "HTTP/1.1 %d %s\r\n"
"Date: %s\r\n" "Date: %s\r\n"
"Connection: %s\r\n" "Connection: %s\r\n"
"Content-Length: %d\r\n" "Content-Length: %"PRIszu"\r\n"
"Content-Type: application/json\r\n" "Content-Type: application/json\r\n"
"Server: bitcoin-json-rpc/%s\r\n" "Server: bitcoin-json-rpc/%s\r\n"
"\r\n" "\r\n"

8
src/init.cpp

@ -767,11 +767,11 @@ bool AppInit2()
RandAddSeedPerfmon(); RandAddSeedPerfmon();
//// debug print //// debug print
printf("mapBlockIndex.size() = %d\n", mapBlockIndex.size()); printf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size());
printf("nBestHeight = %d\n", nBestHeight); printf("nBestHeight = %d\n", nBestHeight);
printf("setKeyPool.size() = %d\n", pwalletMain->setKeyPool.size()); printf("setKeyPool.size() = %"PRIszu"\n", pwalletMain->setKeyPool.size());
printf("mapWallet.size() = %d\n", pwalletMain->mapWallet.size()); printf("mapWallet.size() = %"PRIszu"\n", pwalletMain->mapWallet.size());
printf("mapAddressBook.size() = %d\n", pwalletMain->mapAddressBook.size()); printf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain->mapAddressBook.size());
if (!NewThread(StartNode, NULL)) if (!NewThread(StartNode, NULL))
InitError(_("Error: could not start node")); InitError(_("Error: could not start node"));

2
src/irc.cpp

@ -260,7 +260,7 @@ void ThreadIRCSeed2(void* parg)
if (!fNoListen && GetLocal(addrLocal, &addrIPv4) && nNameRetry<3) if (!fNoListen && GetLocal(addrLocal, &addrIPv4) && nNameRetry<3)
strMyName = EncodeAddress(GetLocalAddress(&addrConnect)); strMyName = EncodeAddress(GetLocalAddress(&addrConnect));
if (strMyName == "") if (strMyName == "")
strMyName = strprintf("x%u", GetRand(1000000000)); strMyName = strprintf("x%"PRI64u"", GetRand(1000000000));
Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str()); Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str());
Send(hSocket, strprintf("USER %s 8 * : %s\r", strMyName.c_str(), strMyName.c_str()).c_str()); Send(hSocket, strprintf("USER %s 8 * : %s\r", strMyName.c_str(), strMyName.c_str()).c_str());

34
src/main.cpp

@ -181,7 +181,7 @@ bool AddOrphanTx(const CDataStream& vMsg)
// at most 500 megabytes of orphans: // at most 500 megabytes of orphans:
if (pvMsg->size() > 5000) if (pvMsg->size() > 5000)
{ {
printf("ignoring large orphan tx (size: %u, hash: %s)\n", pvMsg->size(), hash.ToString().substr(0,10).c_str()); printf("ignoring large orphan tx (size: %"PRIszu", hash: %s)\n", pvMsg->size(), hash.ToString().substr(0,10).c_str());
delete pvMsg; delete pvMsg;
return false; return false;
} }
@ -190,7 +190,7 @@ bool AddOrphanTx(const CDataStream& vMsg)
BOOST_FOREACH(const CTxIn& txin, tx.vin) BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapOrphanTransactionsByPrev[txin.prevout.hash].insert(make_pair(hash, pvMsg)); mapOrphanTransactionsByPrev[txin.prevout.hash].insert(make_pair(hash, pvMsg));
printf("stored orphan tx %s (mapsz %u)\n", hash.ToString().substr(0,10).c_str(), printf("stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString().substr(0,10).c_str(),
mapOrphanTransactions.size()); mapOrphanTransactions.size());
return true; return true;
} }
@ -667,7 +667,7 @@ bool CTxMemPool::accept(CTxDB& txdb, CTransaction &tx, bool fCheckInputs,
if (ptxOld) if (ptxOld)
EraseFromWallets(ptxOld->GetHash()); EraseFromWallets(ptxOld->GetHash());
printf("CTxMemPool::accept() : accepted %s (poolsz %u)\n", printf("CTxMemPool::accept() : accepted %s (poolsz %"PRIszu")\n",
hash.ToString().substr(0,10).c_str(), hash.ToString().substr(0,10).c_str(),
mapTx.size()); mapTx.size());
return true; return true;
@ -1187,7 +1187,7 @@ bool CTransaction::FetchInputs(CTxDB& txdb, const map<uint256, CTxIndex>& mapTes
// Revisit this if/when transaction replacement is implemented and allows // Revisit this if/when transaction replacement is implemented and allows
// adding inputs: // adding inputs:
fInvalid = true; fInvalid = true;
return DoS(100, error("FetchInputs() : %s prevout.n out of range %d %d %d prev tx %s\n%s", GetHash().ToString().substr(0,10).c_str(), prevout.n, txPrev.vout.size(), txindex.vSpent.size(), prevout.hash.ToString().substr(0,10).c_str(), txPrev.ToString().c_str())); return DoS(100, error("FetchInputs() : %s prevout.n out of range %d %"PRIszu" %"PRIszu" prev tx %s\n%s", GetHash().ToString().substr(0,10).c_str(), prevout.n, txPrev.vout.size(), txindex.vSpent.size(), prevout.hash.ToString().substr(0,10).c_str(), txPrev.ToString().c_str()));
} }
} }
@ -1256,7 +1256,7 @@ bool CTransaction::ConnectInputs(MapPrevTx inputs,
CTransaction& txPrev = inputs[prevout.hash].second; CTransaction& txPrev = inputs[prevout.hash].second;
if (prevout.n >= txPrev.vout.size() || prevout.n >= txindex.vSpent.size()) if (prevout.n >= txPrev.vout.size() || prevout.n >= txindex.vSpent.size())
return DoS(100, error("ConnectInputs() : %s prevout.n out of range %d %d %d prev tx %s\n%s", GetHash().ToString().substr(0,10).c_str(), prevout.n, txPrev.vout.size(), txindex.vSpent.size(), prevout.hash.ToString().substr(0,10).c_str(), txPrev.ToString().c_str())); return DoS(100, error("ConnectInputs() : %s prevout.n out of range %d %"PRIszu" %"PRIszu" prev tx %s\n%s", GetHash().ToString().substr(0,10).c_str(), prevout.n, txPrev.vout.size(), txindex.vSpent.size(), prevout.hash.ToString().substr(0,10).c_str(), txPrev.ToString().c_str()));
// If prev is coinbase, check that it's matured // If prev is coinbase, check that it's matured
if (txPrev.IsCoinBase()) if (txPrev.IsCoinBase())
@ -1541,8 +1541,8 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
vConnect.push_back(pindex); vConnect.push_back(pindex);
reverse(vConnect.begin(), vConnect.end()); reverse(vConnect.begin(), vConnect.end());
printf("REORGANIZE: Disconnect %i blocks; %s..%s\n", vDisconnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexBest->GetBlockHash().ToString().substr(0,20).c_str()); printf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..%s\n", vDisconnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexBest->GetBlockHash().ToString().substr(0,20).c_str());
printf("REORGANIZE: Connect %i blocks; %s..%s\n", vConnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexNew->GetBlockHash().ToString().substr(0,20).c_str()); printf("REORGANIZE: Connect %"PRIszu" blocks; %s..%s\n", vConnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexNew->GetBlockHash().ToString().substr(0,20).c_str());
// Disconnect shorter branch // Disconnect shorter branch
vector<CTransaction> vResurrect; vector<CTransaction> vResurrect;
@ -1670,7 +1670,7 @@ bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew)
} }
if (!vpindexSecondary.empty()) if (!vpindexSecondary.empty())
printf("Postponing %i reconnects\n", vpindexSecondary.size()); printf("Postponing %"PRIszu" reconnects\n", vpindexSecondary.size());
// Switch to new best branch // Switch to new best branch
if (!Reorganize(txdb, pindexIntermediate)) if (!Reorganize(txdb, pindexIntermediate))
@ -2218,7 +2218,7 @@ void PrintBlockTree()
// print item // print item
CBlock block; CBlock block;
block.ReadFromDisk(pindex); block.ReadFromDisk(pindex);
printf("%d (%u,%u) %s %s tx %d", printf("%d (%u,%u) %s %s tx %"PRIszu"",
pindex->nHeight, pindex->nHeight,
pindex->nFile, pindex->nFile,
pindex->nBlockPos, pindex->nBlockPos,
@ -2416,7 +2416,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
static map<CService, CPubKey> mapReuseKey; static map<CService, CPubKey> mapReuseKey;
RandAddSeedPerfmon(); RandAddSeedPerfmon();
if (fDebug) if (fDebug)
printf("received: %s (%d bytes)\n", strCommand.c_str(), vRecv.size()); printf("received: %s (%"PRIszu" bytes)\n", strCommand.c_str(), vRecv.size());
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0) if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
{ {
printf("dropmessagestest DROPPING RECV MESSAGE\n"); printf("dropmessagestest DROPPING RECV MESSAGE\n");
@ -2561,7 +2561,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (vAddr.size() > 1000) if (vAddr.size() > 1000)
{ {
pfrom->Misbehaving(20); pfrom->Misbehaving(20);
return error("message addr size() = %d", vAddr.size()); return error("message addr size() = %"PRIszu"", vAddr.size());
} }
// Store the new addresses // Store the new addresses
@ -2624,7 +2624,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (vInv.size() > MAX_INV_SZ) if (vInv.size() > MAX_INV_SZ)
{ {
pfrom->Misbehaving(20); pfrom->Misbehaving(20);
return error("message inv size() = %d", vInv.size()); return error("message inv size() = %"PRIszu"", vInv.size());
} }
// find last block in inv vector // find last block in inv vector
@ -2674,11 +2674,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (vInv.size() > MAX_INV_SZ) if (vInv.size() > MAX_INV_SZ)
{ {
pfrom->Misbehaving(20); pfrom->Misbehaving(20);
return error("message getdata size() = %d", vInv.size()); return error("message getdata size() = %"PRIszu"", vInv.size());
} }
if (fDebugNet || (vInv.size() != 1)) if (fDebugNet || (vInv.size() != 1))
printf("received getdata (%d invsz)\n", vInv.size()); printf("received getdata (%"PRIszu" invsz)\n", vInv.size());
BOOST_FOREACH(const CInv& inv, vInv) BOOST_FOREACH(const CInv& inv, vInv)
{ {
@ -3072,7 +3072,7 @@ bool ProcessMessages(CNode* pfrom)
break; break;
} }
if (pstart - vRecv.begin() > 0) if (pstart - vRecv.begin() > 0)
printf("\n\nPROCESSMESSAGE SKIPPED %d BYTES\n\n", pstart - vRecv.begin()); printf("\n\nPROCESSMESSAGE SKIPPED %"PRIpdd" BYTES\n\n", pstart - vRecv.begin());
vRecv.erase(vRecv.begin(), pstart); vRecv.erase(vRecv.begin(), pstart);
// Read header // Read header
@ -3681,7 +3681,7 @@ CBlock* CreateNewBlock(CReserveKey& reservekey)
nLastBlockTx = nBlockTx; nLastBlockTx = nBlockTx;
nLastBlockSize = nBlockSize; nLastBlockSize = nBlockSize;
printf("CreateNewBlock(): total size %lu\n", nBlockSize); printf("CreateNewBlock(): total size %"PRI64u"\n", nBlockSize);
pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees); pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees);
@ -3847,7 +3847,7 @@ void static BitcoinMiner(CWallet *pwallet)
return; return;
IncrementExtraNonce(pblock.get(), pindexPrev, nExtraNonce); IncrementExtraNonce(pblock.get(), pindexPrev, nExtraNonce);
printf("Running BitcoinMiner with %d transactions in block (%u bytes)\n", pblock->vtx.size(), printf("Running BitcoinMiner with %"PRIszu" transactions in block (%u bytes)\n", pblock->vtx.size(),
::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION)); ::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));

6
src/main.h

@ -586,7 +586,7 @@ public:
std::string ToString() const std::string ToString() const
{ {
std::string str; std::string str;
str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%u, vout.size=%u, nLockTime=%u)\n", str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%"PRIszu", vout.size=%"PRIszu", nLockTime=%u)\n",
GetHash().ToString().substr(0,10).c_str(), GetHash().ToString().substr(0,10).c_str(),
nVersion, nVersion,
vin.size(), vin.size(),
@ -952,7 +952,7 @@ public:
void print() const void print() const
{ {
printf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%d)\n", printf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%"PRIszu")\n",
GetHash().ToString().substr(0,20).c_str(), GetHash().ToString().substr(0,20).c_str(),
nVersion, nVersion,
hashPrevBlock.ToString().substr(0,20).c_str(), hashPrevBlock.ToString().substr(0,20).c_str(),
@ -1128,7 +1128,7 @@ public:
std::string ToString() const std::string ToString() const
{ {
return strprintf("CBlockIndex(pprev=%08x, pnext=%08x, nFile=%u, nBlockPos=%-6u nHeight=%d, merkle=%s, hashBlock=%s)", return strprintf("CBlockIndex(pprev=%p, pnext=%p, nFile=%u, nBlockPos=%-6u nHeight=%d, merkle=%s, hashBlock=%s)",
pprev, pnext, nFile, nBlockPos, nHeight, pprev, pnext, nFile, nBlockPos, nHeight,
hashMerkleRoot.ToString().substr(0,10).c_str(), hashMerkleRoot.ToString().substr(0,10).c_str(),
GetBlockHash().ToString().substr(0,20).c_str()); GetBlockHash().ToString().substr(0,20).c_str());

2
src/makefile.linux-mingw

@ -32,7 +32,7 @@ LIBS= \
DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE
DEBUGFLAGS=-g DEBUGFLAGS=-g
CFLAGS=-O2 -w -Wall -Wextra -Wno-format -Wno-format-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) CFLAGS=-O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)

2
src/makefile.mingw

@ -27,7 +27,7 @@ LIBS= \
DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE
DEBUGFLAGS=-g DEBUGFLAGS=-g
CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wno-format -Wno-format-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)

2
src/makefile.osx vendored

@ -66,7 +66,7 @@ CFLAGS = -g
endif endif
# ppc doesn't work because we don't support big-endian # ppc doesn't work because we don't support big-endian
CFLAGS += -Wall -Wextra -Wno-format -Wno-format-security -Wno-unused-parameter \ CFLAGS += -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \
$(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
OBJS= \ OBJS= \

2
src/makefile.unix

@ -93,7 +93,7 @@ DEBUGFLAGS=-g
# CXXFLAGS can be specified on the make command line, so we use xCXXFLAGS that only # CXXFLAGS can be specified on the make command line, so we use xCXXFLAGS that only
# adds some defaults in front. Unfortunately, CXXFLAGS=... $(CXXFLAGS) does not work. # adds some defaults in front. Unfortunately, CXXFLAGS=... $(CXXFLAGS) does not work.
xCXXFLAGS=-O2 -pthread -Wall -Wextra -Wno-format -Wno-format-security -Wno-unused-parameter \ xCXXFLAGS=-O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \
$(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS) $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS)
# LDFLAGS can be specified on the make command line, so we use xLDFLAGS that only # LDFLAGS can be specified on the make command line, so we use xLDFLAGS that only

2
src/net.cpp

@ -885,7 +885,7 @@ void ThreadSocketHandler2(void* parg)
if (nPos > ReceiveBufferSize()) { if (nPos > ReceiveBufferSize()) {
if (!pnode->fDisconnect) if (!pnode->fDisconnect)
printf("socket recv flood control disconnect (%d bytes)\n", vRecv.size()); printf("socket recv flood control disconnect (%"PRIszu" bytes)\n", vRecv.size());
pnode->CloseSocketDisconnect(); pnode->CloseSocketDisconnect();
} }
else { else {

2
src/rpcwallet.cpp

@ -725,7 +725,7 @@ Value addmultisigaddress(const Array& params, bool fHelp)
if ((int)keys.size() < nRequired) if ((int)keys.size() < nRequired)
throw runtime_error( throw runtime_error(
strprintf("not enough keys supplied " strprintf("not enough keys supplied "
"(got %d keys, but need at least %d to redeem)", keys.size(), nRequired)); "(got %"PRIszu" keys, but need at least %d to redeem)", keys.size(), nRequired));
std::vector<CKey> pubkeys; std::vector<CKey> pubkeys;
pubkeys.resize(keys.size()); pubkeys.resize(keys.size());
for (unsigned int i = 0; i < keys.size(); i++) for (unsigned int i = 0; i < keys.size(); i++)

2
src/util.cpp

@ -156,7 +156,7 @@ void RandAddSeedPerfmon()
{ {
RAND_add(pdata, nSize, nSize/100.0); RAND_add(pdata, nSize, nSize/100.0);
memset(pdata, 0, nSize); memset(pdata, 0, nSize);
printf("RandAddSeed() %d bytes\n", nSize); printf("RandAddSeed() %lu bytes\n", nSize);
} }
#endif #endif
} }

14
src/util.h

@ -56,13 +56,22 @@ static const int64 CENT = 1000000;
/* Format characters for (s)size_t and ptrdiff_t */ /* Format characters for (s)size_t and ptrdiff_t */
#if defined(_MSC_VER) || defined(__MSVCRT__) #if defined(_MSC_VER) || defined(__MSVCRT__)
/* (s)size_t and ptrdiff_t have the same size specifier in MSVC:
http://msdn.microsoft.com/en-us/library/tcxf1dw6%28v=vs.100%29.aspx
*/
#define PRIszx "Ix" #define PRIszx "Ix"
#define PRIszu "Iu" #define PRIszu "Iu"
#define PRIszd "Id" #define PRIszd "Id"
#else #define PRIpdx "Ix"
#define PRIpdu "Iu"
#define PRIpdd "Id"
#else /* C99 standard */
#define PRIszx "zx" #define PRIszx "zx"
#define PRIszu "zu" #define PRIszu "zu"
#define PRIszd "zd" #define PRIszd "zd"
#define PRIpdx "tx"
#define PRIpdu "tu"
#define PRIpdd "td"
#endif #endif
// This is needed because the foreach macro can't get over the comma in pair<t1, t2> // This is needed because the foreach macro can't get over the comma in pair<t1, t2>
@ -154,6 +163,8 @@ std::string real_strprintf(const std::string &format, int dummy, ...);
#define strprintf(format, ...) real_strprintf(format, 0, __VA_ARGS__) #define strprintf(format, ...) real_strprintf(format, 0, __VA_ARGS__)
std::string vstrprintf(const char *format, va_list ap); std::string vstrprintf(const char *format, va_list ap);
bool ATTR_WARN_PRINTF(1,2) error(const char *format, ...);
/* Redefine printf so that it directs output to debug.log /* Redefine printf so that it directs output to debug.log
* *
* Do this *after* defining the other printf-like functions, because otherwise the * Do this *after* defining the other printf-like functions, because otherwise the
@ -162,7 +173,6 @@ std::string vstrprintf(const char *format, va_list ap);
*/ */
#define printf OutputDebugStringF #define printf OutputDebugStringF
bool error(const char *format, ...);
void LogException(std::exception* pex, const char* pszThread); void LogException(std::exception* pex, const char* pszThread);
void PrintException(std::exception* pex, const char* pszThread); void PrintException(std::exception* pex, const char* pszThread);
void PrintExceptionContinue(std::exception* pex, const char* pszThread); void PrintExceptionContinue(std::exception* pex, const char* pszThread);

6
src/wallet.cpp

@ -804,7 +804,7 @@ void CWallet::ReacceptWalletTransactions()
// Update fSpent if a tx got spent somewhere else by a copy of wallet.dat // Update fSpent if a tx got spent somewhere else by a copy of wallet.dat
if (txindex.vSpent.size() != wtx.vout.size()) if (txindex.vSpent.size() != wtx.vout.size())
{ {
printf("ERROR: ReacceptWalletTransactions() : txindex.vSpent.size() %d != wtx.vout.size() %d\n", txindex.vSpent.size(), wtx.vout.size()); printf("ERROR: ReacceptWalletTransactions() : txindex.vSpent.size() %"PRIszu" != wtx.vout.size() %"PRIszu"\n", txindex.vSpent.size(), wtx.vout.size());
continue; continue;
} }
for (unsigned int i = 0; i < txindex.vSpent.size(); i++) for (unsigned int i = 0; i < txindex.vSpent.size(); i++)
@ -1424,7 +1424,7 @@ void CWallet::PrintWallet(const CBlock& block)
if (mapWallet.count(block.vtx[0].GetHash())) if (mapWallet.count(block.vtx[0].GetHash()))
{ {
CWalletTx& wtx = mapWallet[block.vtx[0].GetHash()]; CWalletTx& wtx = mapWallet[block.vtx[0].GetHash()];
printf(" mine: %d %d %d", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit()); printf(" mine: %d %d %"PRI64d"", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit());
} }
} }
printf("\n"); printf("\n");
@ -1511,7 +1511,7 @@ bool CWallet::TopUpKeyPool()
if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey()))) if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey())))
throw runtime_error("TopUpKeyPool() : writing generated key failed"); throw runtime_error("TopUpKeyPool() : writing generated key failed");
setKeyPool.insert(nEnd); setKeyPool.insert(nEnd);
printf("keypool added key %"PRI64d", size=%d\n", nEnd, setKeyPool.size()); printf("keypool added key %"PRI64d", size=%"PRIszu"\n", nEnd, setKeyPool.size());
} }
} }
return true; return true;

Loading…
Cancel
Save