Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim trailing whitespace in src/*.{cpp,h} #1170

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/addrman.cpp
Expand Up @@ -174,7 +174,7 @@ int CAddrMan::ShrinkNew(int nUBucket)
nI++; nI++;
} }
CAddrInfo &info = mapInfo[nOldest]; CAddrInfo &info = mapInfo[nOldest];
if (--info.nRefCount == 0) if (--info.nRefCount == 0)
{ {
SwapRandom(info.nRandomPos, vRandom.size()-1); SwapRandom(info.nRandomPos, vRandom.size()-1);
vRandom.pop_back(); vRandom.pop_back();
Expand Down Expand Up @@ -223,7 +223,7 @@ void CAddrMan::MakeTried(CAddrInfo& info, int nId, int nOrigin)
infoOld.nRefCount = 1; infoOld.nRefCount = 1;
// do not update nTried, as we are going to move something else there immediately // do not update nTried, as we are going to move something else there immediately


// check whether there is place in that one, // check whether there is place in that one,
if (vNew.size() < ADDRMAN_NEW_BUCKET_SIZE) if (vNew.size() < ADDRMAN_NEW_BUCKET_SIZE)
{ {
// if so, move it back there // if so, move it back there
Expand Down
2 changes: 1 addition & 1 deletion src/addrman.h
Expand Up @@ -213,7 +213,7 @@ class CAddrMan
// This is the only place where actual deletes occur. // This is the only place where actual deletes occur.
// They are never deleted while in the "tried" table, only possibly evicted back to the "new" table. // They are never deleted while in the "tried" table, only possibly evicted back to the "new" table.
int ShrinkNew(int nUBucket); int ShrinkNew(int nUBucket);

// Move an entry from the "new" table(s) to the "tried" table // Move an entry from the "new" table(s) to the "tried" table
// @pre vvUnkown[nOrigin].count(nId) != 0 // @pre vvUnkown[nOrigin].count(nId) != 0
void MakeTried(CAddrInfo& info, int nId, int nOrigin); void MakeTried(CAddrInfo& info, int nId, int nOrigin);
Expand Down
2 changes: 1 addition & 1 deletion src/base58.h
Expand Up @@ -362,7 +362,7 @@ class CBitcoinSecret : public CBase58Data
{ {
public: public:
void SetSecret(const CSecret& vchSecret, bool fCompressed) void SetSecret(const CSecret& vchSecret, bool fCompressed)
{ {
assert(vchSecret.size() == 32); assert(vchSecret.size() == 32);
SetData(fTestNet ? 239 : 128, &vchSecret[0], vchSecret.size()); SetData(fTestNet ? 239 : 128, &vchSecret[0], vchSecret.size());
if (fCompressed) if (fCompressed)
Expand Down
6 changes: 3 additions & 3 deletions src/bitcoinrpc.cpp
Expand Up @@ -19,7 +19,7 @@
#include <boost/iostreams/stream.hpp> #include <boost/iostreams/stream.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/asio/ssl.hpp> #include <boost/asio/ssl.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream; typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream;


Expand Down Expand Up @@ -951,7 +951,7 @@ Value sendmany(const Array& params, bool fHelp)


CScript scriptPubKey; CScript scriptPubKey;
scriptPubKey.SetBitcoinAddress(address); scriptPubKey.SetBitcoinAddress(address);
int64 nAmount = AmountFromValue(s.value_); int64 nAmount = AmountFromValue(s.value_);
totalAmount += nAmount; totalAmount += nAmount;


vecSend.push_back(make_pair(scriptPubKey, nAmount)); vecSend.push_back(make_pair(scriptPubKey, nAmount));
Expand Down Expand Up @@ -1330,7 +1330,7 @@ Value listtransactions(const Array& params, bool fHelp)
if (ret.size() >= (nCount+nFrom)) break; if (ret.size() >= (nCount+nFrom)) break;
} }
// ret is newest to oldest // ret is newest to oldest

if (nFrom > (int)ret.size()) if (nFrom > (int)ret.size())
nFrom = ret.size(); nFrom = ret.size();
if ((nFrom + nCount) > (int)ret.size()) if ((nFrom + nCount) > (int)ret.size())
Expand Down
4 changes: 2 additions & 2 deletions src/crypter.cpp
Expand Up @@ -19,7 +19,7 @@ bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::v


// Try to keep the keydata out of swap (and be a bit over-careful to keep the IV that we don't even use out of swap) // Try to keep the keydata out of swap (and be a bit over-careful to keep the IV that we don't even use out of swap)
// Note that this does nothing about suspend-to-disk (which will put all our key data on disk) // Note that this does nothing about suspend-to-disk (which will put all our key data on disk)
// Note as well that at no point in this program is any attempt made to prevent stealing of keys by reading the memory of the running process. // Note as well that at no point in this program is any attempt made to prevent stealing of keys by reading the memory of the running process.
mlock(&chKey[0], sizeof chKey); mlock(&chKey[0], sizeof chKey);
mlock(&chIV[0], sizeof chIV); mlock(&chIV[0], sizeof chIV);


Expand All @@ -46,7 +46,7 @@ bool CCrypter::SetKey(const CKeyingMaterial& chNewKey, const std::vector<unsigne


// Try to keep the keydata out of swap // Try to keep the keydata out of swap
// Note that this does nothing about suspend-to-disk (which will put all our key data on disk) // Note that this does nothing about suspend-to-disk (which will put all our key data on disk)
// Note as well that at no point in this program is any attempt made to prevent stealing of keys by reading the memory of the running process. // Note as well that at no point in this program is any attempt made to prevent stealing of keys by reading the memory of the running process.
mlock(&chKey[0], sizeof chKey); mlock(&chKey[0], sizeof chKey);
mlock(&chIV[0], sizeof chIV); mlock(&chIV[0], sizeof chIV);


Expand Down
6 changes: 3 additions & 3 deletions src/db.cpp
Expand Up @@ -214,7 +214,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
{ // surround usage of db with extra {} { // surround usage of db with extra {}
CDB db(strFile.c_str(), "r"); CDB db(strFile.c_str(), "r");
Db* pdbCopy = new Db(&dbenv, 0); Db* pdbCopy = new Db(&dbenv, 0);

int ret = pdbCopy->open(NULL, // Txn pointer int ret = pdbCopy->open(NULL, // Txn pointer
strFileRes.c_str(), // Filename strFileRes.c_str(), // Filename
"main", // Logical db name "main", // Logical db name
Expand All @@ -226,7 +226,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
printf("Cannot create database file %s\n", strFileRes.c_str()); printf("Cannot create database file %s\n", strFileRes.c_str());
fSuccess = false; fSuccess = false;
} }

Dbc* pcursor = db.GetCursor(); Dbc* pcursor = db.GetCursor();
if (pcursor) if (pcursor)
while (fSuccess) while (fSuccess)
Expand Down Expand Up @@ -749,7 +749,7 @@ bool CAddrDB::LoadAddresses()
printf("Loaded %i addresses\n", addrman.size()); printf("Loaded %i addresses\n", addrman.size());
return true; return true;
} }

// Read pre-0.6 addr records // Read pre-0.6 addr records


vector<CAddress> vAddr; vector<CAddress> vAddr;
Expand Down
2 changes: 1 addition & 1 deletion src/irc.cpp
Expand Up @@ -291,7 +291,7 @@ void ThreadIRCSeed2(void* parg)
Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str()); Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str());
} }
} }

if (fTestNet) { if (fTestNet) {
Send(hSocket, "JOIN #bitcoinTEST\r"); Send(hSocket, "JOIN #bitcoinTEST\r");
Send(hSocket, "WHO #bitcoinTEST\r"); Send(hSocket, "WHO #bitcoinTEST\r");
Expand Down
2 changes: 1 addition & 1 deletion src/key.h
Expand Up @@ -165,7 +165,7 @@ class CKey
if (bn == NULL) if (bn == NULL)
throw key_error("CKey::GetSecret() : EC_KEY_get0_private_key failed"); throw key_error("CKey::GetSecret() : EC_KEY_get0_private_key failed");
int n=BN_bn2bin(bn,&vchRet[32 - nBytes]); int n=BN_bn2bin(bn,&vchRet[32 - nBytes]);
if (n != nBytes) if (n != nBytes)
throw key_error("CKey::GetSecret(): BN_bn2bin failed"); throw key_error("CKey::GetSecret(): BN_bn2bin failed");
fCompressed = fCompressedPubKey; fCompressed = fCompressedPubKey;
return vchRet; return vchRet;
Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Expand Up @@ -718,7 +718,7 @@ bool CWalletTx::AcceptWalletTransaction(CTxDB& txdb, bool fCheckInputs)
return false; return false;
} }


bool CWalletTx::AcceptWalletTransaction() bool CWalletTx::AcceptWalletTransaction()
{ {
CTxDB txdb("r"); CTxDB txdb("r");
return AcceptWalletTransaction(txdb); return AcceptWalletTransaction(txdb);
Expand Down Expand Up @@ -2862,7 +2862,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
if (pto->nVersion == 0) if (pto->nVersion == 0)
return true; return true;


// Keep-alive ping. We send a nonce of zero because we don't use it anywhere // Keep-alive ping. We send a nonce of zero because we don't use it anywhere
// right now. // right now.
if (pto->nLastSend && GetTime() - pto->nLastSend > 30 * 60 && pto->vSend.empty()) { if (pto->nLastSend && GetTime() - pto->nLastSend > 30 * 60 && pto->vSend.empty()) {
if (pto->nVersion > BIP0031_VERSION) if (pto->nVersion > BIP0031_VERSION)
Expand Down Expand Up @@ -3062,7 +3062,7 @@ void SHA256Transform(void* pstate, void* pinput, const void* pinit)
ctx.h[i] = ((uint32_t*)pinit)[i]; ctx.h[i] = ((uint32_t*)pinit)[i];


SHA256_Update(&ctx, data, sizeof(data)); SHA256_Update(&ctx, data, sizeof(data));
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
((uint32_t*)pstate)[i] = ctx.h[i]; ((uint32_t*)pstate)[i] = ctx.h[i];
} }


Expand Down
2 changes: 1 addition & 1 deletion src/main.h
Expand Up @@ -790,7 +790,7 @@ class CTxIndex
return !(a == b); return !(a == b);
} }
int GetDepthInMainChain() const; int GetDepthInMainChain() const;

}; };




Expand Down
4 changes: 2 additions & 2 deletions src/netbase.cpp
Expand Up @@ -352,8 +352,8 @@ bool CNetAddr::IsIPv4() const
bool CNetAddr::IsRFC1918() const bool CNetAddr::IsRFC1918() const
{ {
return IsIPv4() && ( return IsIPv4() && (
GetByte(3) == 10 || GetByte(3) == 10 ||
(GetByte(3) == 192 && GetByte(2) == 168) || (GetByte(3) == 192 && GetByte(2) == 168) ||
(GetByte(3) == 172 && (GetByte(2) >= 16 && GetByte(2) <= 31))); (GetByte(3) == 172 && (GetByte(2) >= 16 && GetByte(2) <= 31)));
} }


Expand Down
2 changes: 1 addition & 1 deletion src/util.cpp
Expand Up @@ -1329,7 +1329,7 @@ static void push_lock(void* c, const CLockLocation& locklocation, bool fTry)


static void pop_lock() static void pop_lock()
{ {
if (fDebug) if (fDebug)
{ {
const CLockLocation& locklocation = (*lockstack).rbegin()->second; const CLockLocation& locklocation = (*lockstack).rbegin()->second;
printf("Unlocked: %s\n", locklocation.ToString().c_str()); printf("Unlocked: %s\n", locklocation.ToString().c_str());
Expand Down
4 changes: 2 additions & 2 deletions src/util.h
Expand Up @@ -571,7 +571,7 @@ inline uint160 Hash160(const std::vector<unsigned char>& vch)
} }




/** Median filter over a stream of values. /** Median filter over a stream of values.
* Returns the median of the last N numbers * Returns the median of the last N numbers
*/ */
template <typename T> class CMedianFilter template <typename T> class CMedianFilter
Expand All @@ -588,7 +588,7 @@ template <typename T> class CMedianFilter
vValues.push_back(initial_value); vValues.push_back(initial_value);
vSorted = vValues; vSorted = vValues;
} }

void input(T value) void input(T value)
{ {
if(vValues.size() == nSize) if(vValues.size() == nSize)
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Expand Up @@ -17,7 +17,7 @@ static const int CLIENT_VERSION_BUILD = 1;


static const int CLIENT_VERSION = static const int CLIENT_VERSION =
1000000 * CLIENT_VERSION_MAJOR 1000000 * CLIENT_VERSION_MAJOR
+ 10000 * CLIENT_VERSION_MINOR + 10000 * CLIENT_VERSION_MINOR
+ 100 * CLIENT_VERSION_REVISION + 100 * CLIENT_VERSION_REVISION
+ 1 * CLIENT_VERSION_BUILD; + 1 * CLIENT_VERSION_BUILD;


Expand Down
2 changes: 1 addition & 1 deletion src/wallet.cpp
Expand Up @@ -567,7 +567,7 @@ void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, l


} }


void CWalletTx::GetAccountAmounts(const string& strAccount, int64& nGenerated, int64& nReceived, void CWalletTx::GetAccountAmounts(const string& strAccount, int64& nGenerated, int64& nReceived,
int64& nSent, int64& nFee) const int64& nSent, int64& nFee) const
{ {
nGenerated = nReceived = nSent = nFee = 0; nGenerated = nReceived = nSent = nFee = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/wallet.h
Expand Up @@ -298,7 +298,7 @@ class CReserveKey
}; };




/** A transaction with a bunch of additional info that only the owner cares about. /** A transaction with a bunch of additional info that only the owner cares about.
* It includes any unrecorded transactions needed to link it back to the block chain. * It includes any unrecorded transactions needed to link it back to the block chain.
*/ */
class CWalletTx : public CMerkleTx class CWalletTx : public CMerkleTx
Expand Down Expand Up @@ -533,7 +533,7 @@ class CWalletTx : public CMerkleTx
void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, std::list<std::pair<CBitcoinAddress, int64> >& listReceived, void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, std::list<std::pair<CBitcoinAddress, int64> >& listReceived,
std::list<std::pair<CBitcoinAddress, int64> >& listSent, int64& nFee, std::string& strSentAccount) const; std::list<std::pair<CBitcoinAddress, int64> >& listSent, int64& nFee, std::string& strSentAccount) const;


void GetAccountAmounts(const std::string& strAccount, int64& nGenerated, int64& nReceived, void GetAccountAmounts(const std::string& strAccount, int64& nGenerated, int64& nReceived,
int64& nSent, int64& nFee) const; int64& nSent, int64& nFee) const;


bool IsFromMe() const bool IsFromMe() const
Expand Down