mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-03 22:03:01 +01:00
Add casts for unavoidable signed/unsigned comparisons
At these code sites, it is preferable to cast rather than change a variable's type.
This commit is contained in:
@@ -536,7 +536,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
|
||||
return false;
|
||||
int n = CastToBigNum(stacktop(-1)).getint();
|
||||
popstack(stack);
|
||||
if (n < 0 || n >= stack.size())
|
||||
if (n < 0 || n >= (int)stack.size())
|
||||
return false;
|
||||
valtype vch = stacktop(-n-1);
|
||||
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();
|
||||
if (nBegin < 0 || nEnd < nBegin)
|
||||
return false;
|
||||
if (nBegin > vch.size())
|
||||
if (nBegin > (int)vch.size())
|
||||
nBegin = vch.size();
|
||||
if (nEnd > vch.size())
|
||||
if (nEnd > (int)vch.size())
|
||||
nEnd = vch.size();
|
||||
vch.erase(vch.begin() + nEnd, vch.end());
|
||||
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();
|
||||
if (nSize < 0)
|
||||
return false;
|
||||
if (nSize > vch.size())
|
||||
if (nSize > (int)vch.size())
|
||||
nSize = vch.size();
|
||||
if (opcode == OP_LEFT)
|
||||
vch.erase(vch.begin() + nSize, vch.end());
|
||||
|
||||
Reference in New Issue
Block a user