Browse Source

fix warning: X enumeration values not handled in switch [-Wswitch-enum]

Add default cases to opcode switches to assert that they should never
occur.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
0.8
Giel van Schijndel 14 years ago
parent
commit
225f222c9f
  1. 2
      src/script.cpp

2
src/script.cpp

@ -580,6 +580,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
case OP_ABS: if (bn < bnZero) bn = -bn; break; case OP_ABS: if (bn < bnZero) bn = -bn; break;
case OP_NOT: bn = (bn == bnZero); break; case OP_NOT: bn = (bn == bnZero); break;
case OP_0NOTEQUAL: bn = (bn != bnZero); break; case OP_0NOTEQUAL: bn = (bn != bnZero); break;
default: assert(!"invalid opcode"); break;
} }
popstack(stack); popstack(stack);
stack.push_back(bn.getvch()); stack.push_back(bn.getvch());
@ -659,6 +660,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
case OP_GREATERTHANOREQUAL: bn = (bn1 >= bn2); break; case OP_GREATERTHANOREQUAL: bn = (bn1 >= bn2); break;
case OP_MIN: bn = (bn1 < bn2 ? bn1 : bn2); break; case OP_MIN: bn = (bn1 < bn2 ? bn1 : bn2); break;
case OP_MAX: bn = (bn1 > bn2 ? bn1 : bn2); break; case OP_MAX: bn = (bn1 > bn2 ? bn1 : bn2); break;
default: assert(!"invalid opcode"); break;
} }
popstack(stack); popstack(stack);
popstack(stack); popstack(stack);

Loading…
Cancel
Save