Address several issues reported by cppcheck all over the place.
* src/bin/common_finput.cc, src/tgbaalgos/lbtt.cc: Use !empty() instead of size() > 0. * src/bin/ltl2tgta.cc, src/kripke/kripkeexplicit.cc, src/tgbatest/complementation.cc: Avoid useless assignments. * src/bin/ltlcross.cc: Correct mistaken assignment inside assert(). * src/evtgba/symbol.hh, src/tgba/tgbabddcoredata.cc, src/tgba/tgbabddcoredata.hh, src/tgba/tgbasafracomplement.cc (operator=): Do not return a const reference. * src/evtgbatest/ltl2evtgba.cc, src/evtgbatest/product.cc, src/evtgbatest/product.cc: Check indices before using them, not after. * src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh, src/tgbatest/randtgba.cc: Pass constant strings by reference. * src/kripke/kripkeprint.cc, src/tgbaalgos/simulation.cc: Remove a useless operation. * src/ltlvisit/simplify.cc: Remove a duplicate condition. * src/misc/formater.hh: Remove unused attribute. * src/misc/modgray.cc: Initialize done_ in the constructor. * src/saba/explicitstateconjunction.cc, src/saba/explicitstateconjunction.hh (operator=): Fix prototype. * src/saba/sabacomplementtgba.cc: Remove unused default constructor. * src/ta/taexplicit.cc, src/ta/taproduct.cc, src/ta/tgtaproduct.cc, src/ta/tgtaproduct.hh, src/taalgos/emptinessta.cc, src/taalgos/minimize.cc, src/taalgos/reachiter.cc, src/taalgos/tgba2ta.cc, src/tgbaalgos/cutscc.cc: Use C++ casts, and ++it instead of it++. * src/taalgos/dotty.cc, src/tgbatest/ltl2tgba.cc: Refine the scope of variables. * src/tgba/tgbakvcomplement.hh (bdd_order): Always initialize bdd_. * src/tgba/tgbasgba.cc, src/tgba/wdbacomp.cc: Use the initialization line to initialize all members.
This commit is contained in:
parent
a3b49f1108
commit
a577850eb3
36 changed files with 117 additions and 123 deletions
|
|
@ -151,7 +151,7 @@ namespace spot
|
|||
bool transition_found = false;
|
||||
|
||||
for (it_trans = trans_by_condition->begin(); (it_trans
|
||||
!= trans_by_condition->end() && !transition_found); it_trans++)
|
||||
!= trans_by_condition->end() && !transition_found); ++it_trans)
|
||||
{
|
||||
transition_found = ((*it_trans)->dest == t->dest);
|
||||
if (transition_found)
|
||||
|
|
@ -240,7 +240,7 @@ namespace spot
|
|||
int
|
||||
state_ta_explicit::compare(const spot::state* other) const
|
||||
{
|
||||
const state_ta_explicit* o = down_cast<const state_ta_explicit*> (other);
|
||||
const state_ta_explicit* o = down_cast<const state_ta_explicit*>(other);
|
||||
assert(o);
|
||||
|
||||
int compare_value = tgba_state_->compare(o->tgba_state_);
|
||||
|
|
@ -286,7 +286,8 @@ namespace spot
|
|||
state_ta_explicit* dest = (*it_trans)->dest;
|
||||
bool is_stuttering_transition = (get_tgba_condition()
|
||||
== (dest)->get_tgba_condition());
|
||||
bool dest_is_livelock_accepting = dest->is_livelock_accepting_state();
|
||||
bool dest_is_livelock_accepting =
|
||||
dest->is_livelock_accepting_state();
|
||||
|
||||
//Before deleting stuttering transitions, propaged back livelock
|
||||
//and initial state's properties
|
||||
|
|
@ -329,7 +330,7 @@ namespace spot
|
|||
// We don't destroy the transitions in the state's destructor because
|
||||
// they are not cloned.
|
||||
if (trans != 0)
|
||||
for (it_trans = trans->begin(); it_trans != trans->end(); it_trans++)
|
||||
for (it_trans = trans->begin(); it_trans != trans->end(); ++it_trans)
|
||||
{
|
||||
delete *it_trans;
|
||||
}
|
||||
|
|
@ -369,9 +370,9 @@ namespace spot
|
|||
ta_explicit::~ta_explicit()
|
||||
{
|
||||
ta::states_set_t::iterator it;
|
||||
for (it = states_set_.begin(); it != states_set_.end(); it++)
|
||||
for (it = states_set_.begin(); it != states_set_.end(); ++it)
|
||||
{
|
||||
state_ta_explicit* s = down_cast<state_ta_explicit*> (*it);
|
||||
state_ta_explicit* s = down_cast<state_ta_explicit*>(*it);
|
||||
|
||||
s->free_transitions();
|
||||
s->get_tgba_state()->destroy();
|
||||
|
|
@ -388,14 +389,13 @@ namespace spot
|
|||
std::pair<ta::states_set_t::iterator, bool> add_state_to_ta =
|
||||
states_set_.insert(s);
|
||||
|
||||
return static_cast<state_ta_explicit*> (*add_state_to_ta.first);
|
||||
return static_cast<state_ta_explicit*>(*add_state_to_ta.first);
|
||||
}
|
||||
|
||||
void
|
||||
ta_explicit::add_to_initial_states_set(state* state, bdd condition)
|
||||
{
|
||||
state_ta_explicit * s = down_cast<state_ta_explicit*> (state);
|
||||
assert(s);
|
||||
state_ta_explicit* s = down_cast<state_ta_explicit*>(state);
|
||||
s->set_initial_state(true);
|
||||
if (condition == bddfalse)
|
||||
condition = get_state_condition(s);
|
||||
|
|
@ -403,15 +403,17 @@ namespace spot
|
|||
initial_states_set_.insert(s);
|
||||
if (get_artificial_initial_state() != 0)
|
||||
if (add_state.second)
|
||||
create_transition((state_ta_explicit*) get_artificial_initial_state(),
|
||||
condition, bddfalse, s);
|
||||
|
||||
{
|
||||
state_ta_explicit* i =
|
||||
down_cast<state_ta_explicit*>(get_artificial_initial_state());
|
||||
create_transition(i, condition, bddfalse, s);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ta_explicit::delete_stuttering_and_hole_successors(spot::state* s)
|
||||
{
|
||||
state_ta_explicit * state = down_cast<state_ta_explicit*> (s);
|
||||
state_ta_explicit * state = down_cast<state_ta_explicit*>(s);
|
||||
assert(state);
|
||||
state->delete_stuttering_and_hole_successors();
|
||||
if (state->is_initial_state())
|
||||
|
|
@ -421,7 +423,8 @@ namespace spot
|
|||
|
||||
void
|
||||
ta_explicit::create_transition(state_ta_explicit* source, bdd condition,
|
||||
bdd acceptance_conditions, state_ta_explicit* dest, bool add_at_beginning)
|
||||
bdd acceptance_conditions,
|
||||
state_ta_explicit* dest, bool add_at_beginning)
|
||||
{
|
||||
state_ta_explicit::transition* t = new state_ta_explicit::transition;
|
||||
t->dest = dest;
|
||||
|
|
@ -442,7 +445,7 @@ namespace spot
|
|||
ta_explicit::get_state_condition(const spot::state* initial_state) const
|
||||
{
|
||||
const state_ta_explicit* sta =
|
||||
down_cast<const state_ta_explicit*> (initial_state);
|
||||
down_cast<const state_ta_explicit*>(initial_state);
|
||||
assert(sta);
|
||||
return sta->get_tgba_condition();
|
||||
}
|
||||
|
|
@ -450,7 +453,7 @@ namespace spot
|
|||
bool
|
||||
ta_explicit::is_accepting_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s);
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*>(s);
|
||||
assert(sta);
|
||||
return sta->is_accepting_state();
|
||||
}
|
||||
|
|
@ -458,7 +461,7 @@ namespace spot
|
|||
bool
|
||||
ta_explicit::is_initial_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s);
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*>(s);
|
||||
assert(sta);
|
||||
return sta->is_initial_state();
|
||||
}
|
||||
|
|
@ -466,7 +469,7 @@ namespace spot
|
|||
bool
|
||||
ta_explicit::is_livelock_accepting_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s);
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*>(s);
|
||||
assert(sta);
|
||||
return sta->is_livelock_accepting_state();
|
||||
}
|
||||
|
|
@ -474,7 +477,7 @@ namespace spot
|
|||
ta_succ_iterator*
|
||||
ta_explicit::succ_iter(const spot::state* state) const
|
||||
{
|
||||
const state_ta_explicit* s = down_cast<const state_ta_explicit*> (state);
|
||||
const state_ta_explicit* s = down_cast<const state_ta_explicit*>(state);
|
||||
assert(s);
|
||||
return new ta_explicit_succ_iterator(s);
|
||||
}
|
||||
|
|
@ -482,7 +485,7 @@ namespace spot
|
|||
ta_succ_iterator*
|
||||
ta_explicit::succ_iter(const spot::state* state, bdd condition) const
|
||||
{
|
||||
const state_ta_explicit* s = down_cast<const state_ta_explicit*> (state);
|
||||
const state_ta_explicit* s = down_cast<const state_ta_explicit*>(state);
|
||||
assert(s);
|
||||
return new ta_explicit_succ_iterator(s, condition);
|
||||
}
|
||||
|
|
@ -502,7 +505,7 @@ namespace spot
|
|||
std::string
|
||||
ta_explicit::format_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s);
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*>(s);
|
||||
assert(sta);
|
||||
|
||||
if (sta->get_tgba_condition() == bddtrue)
|
||||
|
|
@ -517,11 +520,11 @@ namespace spot
|
|||
ta_explicit::delete_stuttering_transitions()
|
||||
{
|
||||
ta::states_set_t::iterator it;
|
||||
for (it = states_set_.begin(); it != states_set_.end(); it++)
|
||||
for (it = states_set_.begin(); it != states_set_.end(); ++it)
|
||||
{
|
||||
|
||||
const state_ta_explicit* source =
|
||||
static_cast<const state_ta_explicit*> (*it);
|
||||
static_cast<const state_ta_explicit*>(*it);
|
||||
|
||||
state_ta_explicit::transitions* trans = source->get_transitions();
|
||||
state_ta_explicit::transitions::iterator it_trans;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue