diff options
author | Jeff Garzik <jgarzik@exmulti.com> | 2012-04-22 13:51:16 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2012-04-23 14:14:36 -0400 |
commit | 1d8c7a9557d596d4c7edee801a724db7a908bce5 (patch) | |
tree | 5181d28a1c69ecc7c58ba4b0b15417d6817aa949 /src/script.cpp | |
parent | c0a0a93d02251390b482d4a147531989641c5a98 (diff) |
Add casts for unavoidable signed/unsigned comparisons
At these code sites, it is preferable to cast rather than change
a variable's type.
Diffstat (limited to 'src/script.cpp')
-rw-r--r-- | src/script.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/script.cpp b/src/script.cpp index eb8200bcc3..660023ef48 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -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()); |