From cc5efa45ba41fd5e6ad19abbce049ddaf96b11bb Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 22 Nov 2011 19:44:13 -0800 Subject: [PATCH] Fix two bugs and use the more efficient !empty() vs size() > 0 These two bugs were found with a recent cppcheck addition. It also changes one occurrence of size() > 0 for the more efficient ! empty(). --- tgt-vhdl/stmt.cc | 2 +- tgt-vvp/eval_expr.c | 2 +- vhdlpp/architec_emit.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tgt-vhdl/stmt.cc b/tgt-vhdl/stmt.cc index 4e2f6c1af..8186b0648 100644 --- a/tgt-vhdl/stmt.cc +++ b/tgt-vhdl/stmt.cc @@ -65,7 +65,7 @@ static int draw_stask_finish(vhdl_procedural *proc, stmt_container *container, static char parse_octal(const char *p) { assert(*p && *(p+1) && *(p+2)); - assert(isdigit(*p) && isdigit(*(p+1)) && isdigit(*(p+1))); + assert(isdigit(*p) && isdigit(*(p+1)) && isdigit(*(p+2))); return (*p - '0') * 64 + (*(p+1) - '0') * 8 diff --git a/tgt-vvp/eval_expr.c b/tgt-vvp/eval_expr.c index 049ff0fd0..5af817e48 100644 --- a/tgt-vvp/eval_expr.c +++ b/tgt-vvp/eval_expr.c @@ -3299,7 +3299,7 @@ static struct vector_info draw_unary_expr(ivl_expr_t expr, unsigned wid) /* Handle special case that value is 0 or 1. */ if (res.base == 0 || res.base == 1) break; - if (res.base == 2 || res.base == 2) { + if (res.base == 2 || res.base == 3) { res.base = 0; break; } diff --git a/vhdlpp/architec_emit.cc b/vhdlpp/architec_emit.cc index 5a8e5f2e0..c2a855b61 100644 --- a/vhdlpp/architec_emit.cc +++ b/vhdlpp/architec_emit.cc @@ -136,7 +136,7 @@ int ComponentInstantiation::emit(ostream&out, Entity*ent, Architecture*arc) int errors = 0; out << cname_; - if (generic_map_.size() > 0) { + if (! generic_map_.empty()) { out << " #("; comma = ""; for (map::iterator cur = generic_map_.begin()