Merge pull request #1140 from jgarzik/sign-compare
Address many more sign comparison warnings
This commit is contained in:
commit
c2e8c8acd8
13 changed files with 74 additions and 64 deletions
|
@ -117,9 +117,9 @@ public:
|
||||||
{
|
{
|
||||||
unsigned long n = BN_get_word(this);
|
unsigned long n = BN_get_word(this);
|
||||||
if (!BN_is_negative(this))
|
if (!BN_is_negative(this))
|
||||||
return (n > std::numeric_limits<int>::max() ? std::numeric_limits<int>::max() : n);
|
return (n > (unsigned long)std::numeric_limits<int>::max() ? std::numeric_limits<int>::max() : n);
|
||||||
else
|
else
|
||||||
return (n > std::numeric_limits<int>::max() ? std::numeric_limits<int>::min() : -(int)n);
|
return (n > (unsigned long)std::numeric_limits<int>::max() ? std::numeric_limits<int>::min() : -(int)n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setint64(int64 n)
|
void setint64(int64 n)
|
||||||
|
@ -222,7 +222,7 @@ public:
|
||||||
if (vch.size() > 4)
|
if (vch.size() > 4)
|
||||||
vch[4] &= 0x7f;
|
vch[4] &= 0x7f;
|
||||||
uint256 n = 0;
|
uint256 n = 0;
|
||||||
for (int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
|
for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
|
||||||
((unsigned char*)&n)[i] = vch[j];
|
((unsigned char*)&n)[i] = vch[j];
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -999,7 +999,7 @@ Value addmultisigaddress(const Array& params, bool fHelp)
|
||||||
strAccount = AccountFromValue(params[2]);
|
strAccount = AccountFromValue(params[2]);
|
||||||
|
|
||||||
// Gather public keys
|
// Gather public keys
|
||||||
if (nRequired < 1 || keys.size() < nRequired)
|
if ((nRequired < 1) || ((int)keys.size() < nRequired))
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
strprintf("wrong number of keys"
|
strprintf("wrong number of keys"
|
||||||
"(got %d, need at least %d)", keys.size(), nRequired));
|
"(got %d, need at least %d)", keys.size(), nRequired));
|
||||||
|
@ -1331,8 +1331,10 @@ Value listtransactions(const Array& params, bool fHelp)
|
||||||
}
|
}
|
||||||
// ret is newest to oldest
|
// ret is newest to oldest
|
||||||
|
|
||||||
if (nFrom > ret.size()) nFrom = ret.size();
|
if (nFrom > (int)ret.size())
|
||||||
if (nFrom+nCount > ret.size()) nCount = ret.size()-nFrom;
|
nFrom = ret.size();
|
||||||
|
if ((nFrom + nCount) > (int)ret.size())
|
||||||
|
nCount = ret.size() - nFrom;
|
||||||
Array::iterator first = ret.begin();
|
Array::iterator first = ret.begin();
|
||||||
std::advance(first, nFrom);
|
std::advance(first, nFrom);
|
||||||
Array::iterator last = ret.begin();
|
Array::iterator last = ret.begin();
|
||||||
|
@ -2202,7 +2204,7 @@ int ReadHTTP(std::basic_istream<char>& stream, map<string, string>& mapHeadersRe
|
||||||
|
|
||||||
// Read header
|
// Read header
|
||||||
int nLen = ReadHTTPHeader(stream, mapHeadersRet);
|
int nLen = ReadHTTPHeader(stream, mapHeadersRet);
|
||||||
if (nLen < 0 || nLen > MAX_SIZE)
|
if (nLen < 0 || nLen > (int)MAX_SIZE)
|
||||||
return 500;
|
return 500;
|
||||||
|
|
||||||
// Read message
|
// Read message
|
||||||
|
|
|
@ -648,7 +648,7 @@ bool CTxDB::LoadBlockIndex()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check level 4: check whether spent txouts were spent within the main chain
|
// check level 4: check whether spent txouts were spent within the main chain
|
||||||
int nOutput = 0;
|
unsigned int nOutput = 0;
|
||||||
if (nCheckLevel>3)
|
if (nCheckLevel>3)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent)
|
BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent)
|
||||||
|
|
43
src/main.cpp
43
src/main.cpp
|
@ -195,9 +195,9 @@ void static EraseOrphanTx(uint256 hash)
|
||||||
mapOrphanTransactions.erase(hash);
|
mapOrphanTransactions.erase(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LimitOrphanTxSize(int nMaxOrphans)
|
unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans)
|
||||||
{
|
{
|
||||||
int nEvicted = 0;
|
unsigned int nEvicted = 0;
|
||||||
while (mapOrphanTransactions.size() > nMaxOrphans)
|
while (mapOrphanTransactions.size() > nMaxOrphans)
|
||||||
{
|
{
|
||||||
// Evict a random orphan:
|
// Evict a random orphan:
|
||||||
|
@ -297,6 +297,8 @@ bool CTransaction::AreInputsStandard(const MapPrevTx& mapInputs) const
|
||||||
if (!Solver(prevScript, whichType, vSolutions))
|
if (!Solver(prevScript, whichType, vSolutions))
|
||||||
return false;
|
return false;
|
||||||
int nArgsExpected = ScriptSigArgsExpected(whichType, vSolutions);
|
int nArgsExpected = ScriptSigArgsExpected(whichType, vSolutions);
|
||||||
|
if (nArgsExpected < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Transactions with extra stuff in their scriptSigs are
|
// Transactions with extra stuff in their scriptSigs are
|
||||||
// non-standard. Note that this EvalScript() call will
|
// non-standard. Note that this EvalScript() call will
|
||||||
|
@ -318,20 +320,25 @@ bool CTransaction::AreInputsStandard(const MapPrevTx& mapInputs) const
|
||||||
return false;
|
return false;
|
||||||
if (whichType2 == TX_SCRIPTHASH)
|
if (whichType2 == TX_SCRIPTHASH)
|
||||||
return false;
|
return false;
|
||||||
nArgsExpected += ScriptSigArgsExpected(whichType2, vSolutions2);
|
|
||||||
|
int tmpExpected;
|
||||||
|
tmpExpected = ScriptSigArgsExpected(whichType2, vSolutions2);
|
||||||
|
if (tmpExpected < 0)
|
||||||
|
return false;
|
||||||
|
nArgsExpected += tmpExpected;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.size() != nArgsExpected)
|
if (stack.size() != (unsigned int)nArgsExpected)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
unsigned int
|
||||||
CTransaction::GetLegacySigOpCount() const
|
CTransaction::GetLegacySigOpCount() const
|
||||||
{
|
{
|
||||||
int nSigOps = 0;
|
unsigned int nSigOps = 0;
|
||||||
BOOST_FOREACH(const CTxIn& txin, vin)
|
BOOST_FOREACH(const CTxIn& txin, vin)
|
||||||
{
|
{
|
||||||
nSigOps += txin.scriptSig.GetSigOpCount(false);
|
nSigOps += txin.scriptSig.GetSigOpCount(false);
|
||||||
|
@ -369,10 +376,10 @@ int CMerkleTx::SetMerkleBranch(const CBlock* pblock)
|
||||||
hashBlock = pblock->GetHash();
|
hashBlock = pblock->GetHash();
|
||||||
|
|
||||||
// Locate the transaction
|
// Locate the transaction
|
||||||
for (nIndex = 0; nIndex < pblock->vtx.size(); nIndex++)
|
for (nIndex = 0; nIndex < (int)pblock->vtx.size(); nIndex++)
|
||||||
if (pblock->vtx[nIndex] == *(CTransaction*)this)
|
if (pblock->vtx[nIndex] == *(CTransaction*)this)
|
||||||
break;
|
break;
|
||||||
if (nIndex == pblock->vtx.size())
|
if (nIndex == (int)pblock->vtx.size())
|
||||||
{
|
{
|
||||||
vMerkleBranch.clear();
|
vMerkleBranch.clear();
|
||||||
nIndex = -1;
|
nIndex = -1;
|
||||||
|
@ -1079,12 +1086,12 @@ int64 CTransaction::GetValueIn(const MapPrevTx& inputs) const
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTransaction::GetP2SHSigOpCount(const MapPrevTx& inputs) const
|
unsigned int CTransaction::GetP2SHSigOpCount(const MapPrevTx& inputs) const
|
||||||
{
|
{
|
||||||
if (IsCoinBase())
|
if (IsCoinBase())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int nSigOps = 0;
|
unsigned int nSigOps = 0;
|
||||||
for (unsigned int i = 0; i < vin.size(); i++)
|
for (unsigned int i = 0; i < vin.size(); i++)
|
||||||
{
|
{
|
||||||
const CTxOut& prevout = GetOutputFor(vin[i], inputs);
|
const CTxOut& prevout = GetOutputFor(vin[i], inputs);
|
||||||
|
@ -1284,7 +1291,7 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex)
|
||||||
|
|
||||||
map<uint256, CTxIndex> mapQueuedChanges;
|
map<uint256, CTxIndex> mapQueuedChanges;
|
||||||
int64 nFees = 0;
|
int64 nFees = 0;
|
||||||
int nSigOps = 0;
|
unsigned int nSigOps = 0;
|
||||||
BOOST_FOREACH(CTransaction& tx, vtx)
|
BOOST_FOREACH(CTransaction& tx, vtx)
|
||||||
{
|
{
|
||||||
nSigOps += tx.GetLegacySigOpCount();
|
nSigOps += tx.GetLegacySigOpCount();
|
||||||
|
@ -1645,7 +1652,7 @@ bool CBlock::CheckBlock() const
|
||||||
if (!tx.CheckTransaction())
|
if (!tx.CheckTransaction())
|
||||||
return DoS(tx.nDoS, error("CheckBlock() : CheckTransaction failed"));
|
return DoS(tx.nDoS, error("CheckBlock() : CheckTransaction failed"));
|
||||||
|
|
||||||
int nSigOps = 0;
|
unsigned int nSigOps = 0;
|
||||||
BOOST_FOREACH(const CTransaction& tx, vtx)
|
BOOST_FOREACH(const CTransaction& tx, vtx)
|
||||||
{
|
{
|
||||||
nSigOps += tx.GetLegacySigOpCount();
|
nSigOps += tx.GetLegacySigOpCount();
|
||||||
|
@ -2583,9 +2590,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||||
AddOrphanTx(vMsg);
|
AddOrphanTx(vMsg);
|
||||||
|
|
||||||
// DoS prevention: do not allow mapOrphanTransactions to grow unbounded
|
// DoS prevention: do not allow mapOrphanTransactions to grow unbounded
|
||||||
int nEvicted = LimitOrphanTxSize(MAX_ORPHAN_TRANSACTIONS);
|
unsigned int nEvicted = LimitOrphanTxSize(MAX_ORPHAN_TRANSACTIONS);
|
||||||
if (nEvicted > 0)
|
if (nEvicted > 0)
|
||||||
printf("mapOrphan overflow, removed %d tx\n", nEvicted);
|
printf("mapOrphan overflow, removed %u tx\n", nEvicted);
|
||||||
}
|
}
|
||||||
if (tx.nDoS) pfrom->Misbehaving(tx.nDoS);
|
if (tx.nDoS) pfrom->Misbehaving(tx.nDoS);
|
||||||
}
|
}
|
||||||
|
@ -2743,7 +2750,7 @@ bool ProcessMessages(CNode* pfrom)
|
||||||
int nHeaderSize = vRecv.GetSerializeSize(CMessageHeader());
|
int nHeaderSize = vRecv.GetSerializeSize(CMessageHeader());
|
||||||
if (vRecv.end() - pstart < nHeaderSize)
|
if (vRecv.end() - pstart < nHeaderSize)
|
||||||
{
|
{
|
||||||
if (vRecv.size() > nHeaderSize)
|
if ((int)vRecv.size() > nHeaderSize)
|
||||||
{
|
{
|
||||||
printf("\n\nPROCESSMESSAGE MESSAGESTART NOT FOUND\n\n");
|
printf("\n\nPROCESSMESSAGE MESSAGESTART NOT FOUND\n\n");
|
||||||
vRecv.erase(vRecv.begin(), vRecv.end() - nHeaderSize);
|
vRecv.erase(vRecv.begin(), vRecv.end() - nHeaderSize);
|
||||||
|
@ -3077,7 +3084,7 @@ unsigned int static ScanHash_CryptoPP(char* pmidstate, char* pdata, char* phash1
|
||||||
if ((nNonce & 0xffff) == 0)
|
if ((nNonce & 0xffff) == 0)
|
||||||
{
|
{
|
||||||
nHashesDone = 0xffff+1;
|
nHashesDone = 0xffff+1;
|
||||||
return -1;
|
return (unsigned int) -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3209,7 +3216,7 @@ CBlock* CreateNewBlock(CReserveKey& reservekey)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Legacy limits on sigOps:
|
// Legacy limits on sigOps:
|
||||||
int nTxSigOps = tx.GetLegacySigOpCount();
|
unsigned int nTxSigOps = tx.GetLegacySigOpCount();
|
||||||
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
|
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -3454,7 +3461,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
||||||
(char*)&hash, nHashesDone);
|
(char*)&hash, nHashesDone);
|
||||||
|
|
||||||
// Check if something found
|
// Check if something found
|
||||||
if (nNonceFound != -1)
|
if (nNonceFound != (unsigned int) -1)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < sizeof(hash)/4; i++)
|
for (unsigned int i = 0; i < sizeof(hash)/4; i++)
|
||||||
((unsigned int*)&hash)[i] = ByteReverse(((unsigned int*)&hash)[i]);
|
((unsigned int*)&hash)[i] = ByteReverse(((unsigned int*)&hash)[i]);
|
||||||
|
|
15
src/main.h
15
src/main.h
|
@ -28,8 +28,8 @@ class CNode;
|
||||||
|
|
||||||
static const unsigned int MAX_BLOCK_SIZE = 1000000;
|
static const unsigned int MAX_BLOCK_SIZE = 1000000;
|
||||||
static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
|
static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
|
||||||
static const int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
|
static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
|
||||||
static const int MAX_ORPHAN_TRANSACTIONS = MAX_BLOCK_SIZE/100;
|
static const unsigned int MAX_ORPHAN_TRANSACTIONS = MAX_BLOCK_SIZE/100;
|
||||||
static const int64 MIN_TX_FEE = 50000;
|
static const int64 MIN_TX_FEE = 50000;
|
||||||
static const int64 MIN_RELAY_TX_FEE = 10000;
|
static const int64 MIN_RELAY_TX_FEE = 10000;
|
||||||
static const int64 MAX_MONEY = 21000000 * COIN;
|
static const int64 MAX_MONEY = 21000000 * COIN;
|
||||||
|
@ -437,7 +437,7 @@ public:
|
||||||
nBlockHeight = nBestHeight;
|
nBlockHeight = nBestHeight;
|
||||||
if (nBlockTime == 0)
|
if (nBlockTime == 0)
|
||||||
nBlockTime = GetAdjustedTime();
|
nBlockTime = GetAdjustedTime();
|
||||||
if ((int64)nLockTime < (nLockTime < LOCKTIME_THRESHOLD ? (int64)nBlockHeight : nBlockTime))
|
if ((int64)nLockTime < ((int64)nLockTime < LOCKTIME_THRESHOLD ? (int64)nBlockHeight : nBlockTime))
|
||||||
return true;
|
return true;
|
||||||
BOOST_FOREACH(const CTxIn& txin, vin)
|
BOOST_FOREACH(const CTxIn& txin, vin)
|
||||||
if (!txin.IsFinal())
|
if (!txin.IsFinal())
|
||||||
|
@ -495,7 +495,7 @@ public:
|
||||||
@return number of sigops this transaction's outputs will produce when spent
|
@return number of sigops this transaction's outputs will produce when spent
|
||||||
@see CTransaction::FetchInputs
|
@see CTransaction::FetchInputs
|
||||||
*/
|
*/
|
||||||
int GetLegacySigOpCount() const;
|
unsigned int GetLegacySigOpCount() const;
|
||||||
|
|
||||||
/** Count ECDSA signature operations in pay-to-script-hash inputs.
|
/** Count ECDSA signature operations in pay-to-script-hash inputs.
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ public:
|
||||||
@return maximum number of sigops required to validate this transaction's inputs
|
@return maximum number of sigops required to validate this transaction's inputs
|
||||||
@see CTransaction::FetchInputs
|
@see CTransaction::FetchInputs
|
||||||
*/
|
*/
|
||||||
int GetP2SHSigOpCount(const MapPrevTx& mapInputs) const;
|
unsigned int GetP2SHSigOpCount(const MapPrevTx& mapInputs) const;
|
||||||
|
|
||||||
/** Amount of bitcoins spent by this transaction.
|
/** Amount of bitcoins spent by this transaction.
|
||||||
@return sum of all outputs (note: does not include fees)
|
@return sum of all outputs (note: does not include fees)
|
||||||
|
@ -944,9 +944,10 @@ public:
|
||||||
fileout << FLATDATA(pchMessageStart) << nSize;
|
fileout << FLATDATA(pchMessageStart) << nSize;
|
||||||
|
|
||||||
// Write block
|
// Write block
|
||||||
nBlockPosRet = ftell(fileout);
|
long fileOutPos = ftell(fileout);
|
||||||
if (nBlockPosRet == -1)
|
if (fileOutPos < 0)
|
||||||
return error("CBlock::WriteToDisk() : ftell failed");
|
return error("CBlock::WriteToDisk() : ftell failed");
|
||||||
|
nBlockPosRet = fileOutPos;
|
||||||
fileout << *this;
|
fileout << *this;
|
||||||
|
|
||||||
// Flush stdio buffers and commit to disk before returning
|
// Flush stdio buffers and commit to disk before returning
|
||||||
|
|
|
@ -498,7 +498,7 @@ void ThreadSocketHandler2(void* parg)
|
||||||
{
|
{
|
||||||
printf("ThreadSocketHandler started\n");
|
printf("ThreadSocketHandler started\n");
|
||||||
list<CNode*> vNodesDisconnected;
|
list<CNode*> vNodesDisconnected;
|
||||||
int nPrevNodeCount = 0;
|
unsigned int nPrevNodeCount = 0;
|
||||||
|
|
||||||
loop
|
loop
|
||||||
{
|
{
|
||||||
|
|
|
@ -128,7 +128,7 @@ bool operator<(const CInv& a, const CInv& b)
|
||||||
|
|
||||||
bool CInv::IsKnownType() const
|
bool CInv::IsKnownType() const
|
||||||
{
|
{
|
||||||
return (type >= 1 && type < ARRAYLEN(ppszTypeName));
|
return (type >= 1 && type < (int)ARRAYLEN(ppszTypeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* CInv::GetCommand() const
|
const char* CInv::GetCommand() const
|
||||||
|
|
|
@ -38,7 +38,7 @@ CBigNum CastToBigNum(const valtype& vch)
|
||||||
|
|
||||||
bool CastToBool(const valtype& vch)
|
bool CastToBool(const valtype& vch)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < vch.size(); i++)
|
for (unsigned int i = 0; i < vch.size(); i++)
|
||||||
{
|
{
|
||||||
if (vch[i] != 0)
|
if (vch[i] != 0)
|
||||||
{
|
{
|
||||||
|
@ -536,7 +536,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
|
||||||
return false;
|
return false;
|
||||||
int n = CastToBigNum(stacktop(-1)).getint();
|
int n = CastToBigNum(stacktop(-1)).getint();
|
||||||
popstack(stack);
|
popstack(stack);
|
||||||
if (n < 0 || n >= stack.size())
|
if (n < 0 || n >= (int)stack.size())
|
||||||
return false;
|
return false;
|
||||||
valtype vch = stacktop(-n-1);
|
valtype vch = stacktop(-n-1);
|
||||||
if (opcode == OP_ROLL)
|
if (opcode == OP_ROLL)
|
||||||
|
@ -604,9 +604,9 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
|
||||||
int nEnd = nBegin + CastToBigNum(stacktop(-1)).getint();
|
int nEnd = nBegin + CastToBigNum(stacktop(-1)).getint();
|
||||||
if (nBegin < 0 || nEnd < nBegin)
|
if (nBegin < 0 || nEnd < nBegin)
|
||||||
return false;
|
return false;
|
||||||
if (nBegin > vch.size())
|
if (nBegin > (int)vch.size())
|
||||||
nBegin = vch.size();
|
nBegin = vch.size();
|
||||||
if (nEnd > vch.size())
|
if (nEnd > (int)vch.size())
|
||||||
nEnd = vch.size();
|
nEnd = vch.size();
|
||||||
vch.erase(vch.begin() + nEnd, vch.end());
|
vch.erase(vch.begin() + nEnd, vch.end());
|
||||||
vch.erase(vch.begin(), vch.begin() + nBegin);
|
vch.erase(vch.begin(), vch.begin() + nBegin);
|
||||||
|
@ -625,7 +625,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
|
||||||
int nSize = CastToBigNum(stacktop(-1)).getint();
|
int nSize = CastToBigNum(stacktop(-1)).getint();
|
||||||
if (nSize < 0)
|
if (nSize < 0)
|
||||||
return false;
|
return false;
|
||||||
if (nSize > vch.size())
|
if (nSize > (int)vch.size())
|
||||||
nSize = vch.size();
|
nSize = vch.size();
|
||||||
if (opcode == OP_LEFT)
|
if (opcode == OP_LEFT)
|
||||||
vch.erase(vch.begin() + nSize, vch.end());
|
vch.erase(vch.begin() + nSize, vch.end());
|
||||||
|
@ -655,7 +655,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
|
||||||
if (stack.size() < 1)
|
if (stack.size() < 1)
|
||||||
return false;
|
return false;
|
||||||
valtype& vch = stacktop(-1);
|
valtype& vch = stacktop(-1);
|
||||||
for (int i = 0; i < vch.size(); i++)
|
for (unsigned int i = 0; i < vch.size(); i++)
|
||||||
vch[i] = ~vch[i];
|
vch[i] = ~vch[i];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -672,17 +672,17 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
|
||||||
MakeSameSize(vch1, vch2);
|
MakeSameSize(vch1, vch2);
|
||||||
if (opcode == OP_AND)
|
if (opcode == OP_AND)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < vch1.size(); i++)
|
for (unsigned int i = 0; i < vch1.size(); i++)
|
||||||
vch1[i] &= vch2[i];
|
vch1[i] &= vch2[i];
|
||||||
}
|
}
|
||||||
else if (opcode == OP_OR)
|
else if (opcode == OP_OR)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < vch1.size(); i++)
|
for (unsigned int i = 0; i < vch1.size(); i++)
|
||||||
vch1[i] |= vch2[i];
|
vch1[i] |= vch2[i];
|
||||||
}
|
}
|
||||||
else if (opcode == OP_XOR)
|
else if (opcode == OP_XOR)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < vch1.size(); i++)
|
for (unsigned int i = 0; i < vch1.size(); i++)
|
||||||
vch1[i] ^= vch2[i];
|
vch1[i] ^= vch2[i];
|
||||||
}
|
}
|
||||||
popstack(stack);
|
popstack(stack);
|
||||||
|
@ -939,7 +939,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
|
||||||
{
|
{
|
||||||
// ([sig ...] num_of_signatures [pubkey ...] num_of_pubkeys -- bool)
|
// ([sig ...] num_of_signatures [pubkey ...] num_of_pubkeys -- bool)
|
||||||
|
|
||||||
int i = 1;
|
unsigned int i = 1;
|
||||||
if (stack.size() < i)
|
if (stack.size() < i)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1050,7 +1050,7 @@ uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int
|
||||||
scriptCode.FindAndDelete(CScript(OP_CODESEPARATOR));
|
scriptCode.FindAndDelete(CScript(OP_CODESEPARATOR));
|
||||||
|
|
||||||
// Blank out other inputs' signatures
|
// Blank out other inputs' signatures
|
||||||
for (int i = 0; i < txTmp.vin.size(); i++)
|
for (unsigned int i = 0; i < txTmp.vin.size(); i++)
|
||||||
txTmp.vin[i].scriptSig = CScript();
|
txTmp.vin[i].scriptSig = CScript();
|
||||||
txTmp.vin[nIn].scriptSig = scriptCode;
|
txTmp.vin[nIn].scriptSig = scriptCode;
|
||||||
|
|
||||||
|
@ -1061,7 +1061,7 @@ uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int
|
||||||
txTmp.vout.clear();
|
txTmp.vout.clear();
|
||||||
|
|
||||||
// Let the others update at will
|
// Let the others update at will
|
||||||
for (int i = 0; i < txTmp.vin.size(); i++)
|
for (unsigned int i = 0; i < txTmp.vin.size(); i++)
|
||||||
if (i != nIn)
|
if (i != nIn)
|
||||||
txTmp.vin[i].nSequence = 0;
|
txTmp.vin[i].nSequence = 0;
|
||||||
}
|
}
|
||||||
|
@ -1075,11 +1075,11 @@ uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
txTmp.vout.resize(nOut+1);
|
txTmp.vout.resize(nOut+1);
|
||||||
for (int i = 0; i < nOut; i++)
|
for (unsigned int i = 0; i < nOut; i++)
|
||||||
txTmp.vout[i].SetNull();
|
txTmp.vout[i].SetNull();
|
||||||
|
|
||||||
// Let the others update at will
|
// Let the others update at will
|
||||||
for (int i = 0; i < txTmp.vin.size(); i++)
|
for (unsigned int i = 0; i < txTmp.vin.size(); i++)
|
||||||
if (i != nIn)
|
if (i != nIn)
|
||||||
txTmp.vin[i].nSequence = 0;
|
txTmp.vin[i].nSequence = 0;
|
||||||
}
|
}
|
||||||
|
@ -1360,9 +1360,9 @@ bool IsStandard(const CScript& scriptPubKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int HaveKeys(const vector<valtype>& pubkeys, const CKeyStore& keystore)
|
unsigned int HaveKeys(const vector<valtype>& pubkeys, const CKeyStore& keystore)
|
||||||
{
|
{
|
||||||
int nResult = 0;
|
unsigned int nResult = 0;
|
||||||
BOOST_FOREACH(const valtype& pubkey, pubkeys)
|
BOOST_FOREACH(const valtype& pubkey, pubkeys)
|
||||||
{
|
{
|
||||||
CBitcoinAddress address;
|
CBitcoinAddress address;
|
||||||
|
@ -1449,7 +1449,7 @@ bool ExtractAddresses(const CScript& scriptPubKey, txnouttype& typeRet, vector<C
|
||||||
if (typeRet == TX_MULTISIG)
|
if (typeRet == TX_MULTISIG)
|
||||||
{
|
{
|
||||||
nRequiredRet = vSolutions.front()[0];
|
nRequiredRet = vSolutions.front()[0];
|
||||||
for (int i = 1; i < vSolutions.size()-1; i++)
|
for (unsigned int i = 1; i < vSolutions.size()-1; i++)
|
||||||
{
|
{
|
||||||
CBitcoinAddress address;
|
CBitcoinAddress address;
|
||||||
address.SetPubKey(vSolutions[i]);
|
address.SetPubKey(vSolutions[i]);
|
||||||
|
@ -1566,9 +1566,9 @@ bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsig
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CScript::GetSigOpCount(bool fAccurate) const
|
unsigned int CScript::GetSigOpCount(bool fAccurate) const
|
||||||
{
|
{
|
||||||
int n = 0;
|
unsigned int n = 0;
|
||||||
const_iterator pc = begin();
|
const_iterator pc = begin();
|
||||||
opcodetype lastOpcode = OP_INVALIDOPCODE;
|
opcodetype lastOpcode = OP_INVALIDOPCODE;
|
||||||
while (pc < end())
|
while (pc < end())
|
||||||
|
@ -1590,7 +1590,7 @@ int CScript::GetSigOpCount(bool fAccurate) const
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CScript::GetSigOpCount(const CScript& scriptSig) const
|
unsigned int CScript::GetSigOpCount(const CScript& scriptSig) const
|
||||||
{
|
{
|
||||||
if (!IsPayToScriptHash())
|
if (!IsPayToScriptHash())
|
||||||
return GetSigOpCount(true);
|
return GetSigOpCount(true);
|
||||||
|
|
|
@ -467,7 +467,7 @@ public:
|
||||||
opcodetype opcode;
|
opcodetype opcode;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
while (end() - pc >= b.size() && memcmp(&pc[0], &b[0], b.size()) == 0)
|
while (end() - pc >= (long)b.size() && memcmp(&pc[0], &b[0], b.size()) == 0)
|
||||||
{
|
{
|
||||||
erase(pc, pc + b.size());
|
erase(pc, pc + b.size());
|
||||||
++nFound;
|
++nFound;
|
||||||
|
@ -491,11 +491,11 @@ public:
|
||||||
// CHECKMULTISIGs serialized in scriptSigs are
|
// CHECKMULTISIGs serialized in scriptSigs are
|
||||||
// counted more accurately, assuming they are of the form
|
// counted more accurately, assuming they are of the form
|
||||||
// ... OP_N CHECKMULTISIG ...
|
// ... OP_N CHECKMULTISIG ...
|
||||||
int GetSigOpCount(bool fAccurate) const;
|
unsigned int GetSigOpCount(bool fAccurate) const;
|
||||||
|
|
||||||
// Accurately count sigOps, including sigOps in
|
// Accurately count sigOps, including sigOps in
|
||||||
// pay-to-script-hash transactions:
|
// pay-to-script-hash transactions:
|
||||||
int GetSigOpCount(const CScript& scriptSig) const;
|
unsigned int GetSigOpCount(const CScript& scriptSig) const;
|
||||||
|
|
||||||
bool IsPayToScriptHash() const;
|
bool IsPayToScriptHash() const;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
// Tests this internal-to-main.cpp method:
|
// Tests this internal-to-main.cpp method:
|
||||||
extern void AddOrphanTx(const CDataStream& vMsg);
|
extern void AddOrphanTx(const CDataStream& vMsg);
|
||||||
extern int LimitOrphanTxSize(int nMaxOrphans);
|
extern unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans);
|
||||||
extern std::map<uint256, CDataStream*> mapOrphanTransactions;
|
extern std::map<uint256, CDataStream*> mapOrphanTransactions;
|
||||||
extern std::multimap<uint256, CDataStream*> mapOrphanTransactionsByPrev;
|
extern std::multimap<uint256, CDataStream*> mapOrphanTransactionsByPrev;
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,7 @@ int my_snprintf(char* buffer, size_t limit, const char* format, ...)
|
||||||
va_start(arg_ptr, format);
|
va_start(arg_ptr, format);
|
||||||
int ret = _vsnprintf(buffer, limit, format, arg_ptr);
|
int ret = _vsnprintf(buffer, limit, format, arg_ptr);
|
||||||
va_end(arg_ptr);
|
va_end(arg_ptr);
|
||||||
if (ret < 0 || ret >= limit)
|
if (ret < 0 || ret >= (int)limit)
|
||||||
{
|
{
|
||||||
ret = limit - 1;
|
ret = limit - 1;
|
||||||
buffer[limit-1] = 0;
|
buffer[limit-1] = 0;
|
||||||
|
|
|
@ -579,9 +579,9 @@ template <typename T> class CMedianFilter
|
||||||
private:
|
private:
|
||||||
std::vector<T> vValues;
|
std::vector<T> vValues;
|
||||||
std::vector<T> vSorted;
|
std::vector<T> vSorted;
|
||||||
int nSize;
|
unsigned int nSize;
|
||||||
public:
|
public:
|
||||||
CMedianFilter(int size, T initial_value):
|
CMedianFilter(unsigned int size, T initial_value):
|
||||||
nSize(size)
|
nSize(size)
|
||||||
{
|
{
|
||||||
vValues.reserve(size);
|
vValues.reserve(size);
|
||||||
|
|
|
@ -1391,8 +1391,8 @@ bool CWallet::TopUpKeyPool()
|
||||||
CWalletDB walletdb(strWalletFile);
|
CWalletDB walletdb(strWalletFile);
|
||||||
|
|
||||||
// Top up key pool
|
// Top up key pool
|
||||||
int64 nTargetSize = max(GetArg("-keypool", 100), (int64)0);
|
unsigned int nTargetSize = max(GetArg("-keypool", 100), 0LL);
|
||||||
while (setKeyPool.size() < nTargetSize+1)
|
while (setKeyPool.size() < (nTargetSize + 1))
|
||||||
{
|
{
|
||||||
int64 nEnd = 1;
|
int64 nEnd = 1;
|
||||||
if (!setKeyPool.empty())
|
if (!setKeyPool.empty())
|
||||||
|
|
Loading…
Reference in a new issue