mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
refactor: Enforce C-str fmt strings in WalletLogPrintf()
This commit is contained in:
parent
fa244f3321
commit
fa6dc57760
5 changed files with 15 additions and 13 deletions
|
@ -37,9 +37,9 @@ class CWallet
|
|||
|
||||
public:
|
||||
template <typename... Params>
|
||||
void WalletLogPrintf(std::string fmt, Params... parameters) const
|
||||
void WalletLogPrintf(const char* fmt, Params... parameters) const
|
||||
{
|
||||
LogPrintf(("%s " + fmt).c_str(), GetDisplayName(), parameters...);
|
||||
LogPrintf(("%s " + std::string{fmt}).c_str(), GetDisplayName(), parameters...);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -249,9 +249,10 @@ public:
|
|||
virtual std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys() const { return {}; };
|
||||
|
||||
/** Prepends the wallet name in logging output to ease debugging in multi-wallet use cases */
|
||||
template<typename... Params>
|
||||
void WalletLogPrintf(std::string fmt, Params... parameters) const {
|
||||
LogPrintf(("%s " + fmt).c_str(), m_storage.GetDisplayName(), parameters...);
|
||||
template <typename... Params>
|
||||
void WalletLogPrintf(const char* fmt, Params... parameters) const
|
||||
{
|
||||
LogPrintf(("%s " + std::string{fmt}).c_str(), m_storage.GetDisplayName(), parameters...);
|
||||
};
|
||||
|
||||
/** Watch-only address added */
|
||||
|
|
|
@ -2319,7 +2319,7 @@ OutputType CWallet::TransactionChangeType(const std::optional<OutputType>& chang
|
|||
void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector<std::pair<std::string, std::string>> orderForm)
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
WalletLogPrintf("CommitTransaction:\n%s", tx->ToString());
|
||||
WalletLogPrintf("CommitTransaction:\n%s", tx->ToString()); // NOLINT(bitcoin-unterminated-logprintf)
|
||||
|
||||
// Add tx to wallet, because if it has change it's also ours,
|
||||
// otherwise just for transaction history.
|
||||
|
|
|
@ -890,9 +890,10 @@ public:
|
|||
};
|
||||
|
||||
/** Prepends the wallet name in logging output to ease debugging in multi-wallet use cases */
|
||||
template<typename... Params>
|
||||
void WalletLogPrintf(std::string fmt, Params... parameters) const {
|
||||
LogPrintf(("%s " + fmt).c_str(), GetDisplayName(), parameters...);
|
||||
template <typename... Params>
|
||||
void WalletLogPrintf(const char* fmt, Params... parameters) const
|
||||
{
|
||||
LogPrintf(("%s " + std::string{fmt}).c_str(), GetDisplayName(), parameters...);
|
||||
};
|
||||
|
||||
/** Upgrade the wallet */
|
||||
|
|
|
@ -20,10 +20,10 @@ FALSE_POSITIVES = [
|
|||
("src/clientversion.cpp", "strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION)"),
|
||||
("src/test/translation_tests.cpp", "strprintf(format, arg)"),
|
||||
("src/validationinterface.cpp", "LogPrint(BCLog::VALIDATION, fmt \"\\n\", __VA_ARGS__)"),
|
||||
("src/wallet/wallet.h", "WalletLogPrintf(std::string fmt, Params... parameters)"),
|
||||
("src/wallet/wallet.h", "LogPrintf((\"%s \" + fmt).c_str(), GetDisplayName(), parameters...)"),
|
||||
("src/wallet/scriptpubkeyman.h", "WalletLogPrintf(std::string fmt, Params... parameters)"),
|
||||
("src/wallet/scriptpubkeyman.h", "LogPrintf((\"%s \" + fmt).c_str(), m_storage.GetDisplayName(), parameters...)"),
|
||||
("src/wallet/wallet.h", "WalletLogPrintf(const char* fmt, Params... parameters)"),
|
||||
("src/wallet/wallet.h", "LogPrintf((\"%s \" + std::string{fmt}).c_str(), GetDisplayName(), parameters...)"),
|
||||
("src/wallet/scriptpubkeyman.h", "WalletLogPrintf(const char* fmt, Params... parameters)"),
|
||||
("src/wallet/scriptpubkeyman.h", "LogPrintf((\"%s \" + std::string{fmt}).c_str(), m_storage.GetDisplayName(), parameters...)"),
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue