mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02: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:
parent
c0a0a93d02
commit
1d8c7a9557
8 changed files with 21 additions and 19 deletions
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue