Value stored to unread variable in map_io/

Bug #1205901 reported by Hans Joachim Desserud on 2013-07-28
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

On line 271 map_io/, the variable done is assigned the value true. However, the next line breaks out of the loop and that variable is never read beyond that point.

Found by scan-build in r6675.

cghislai (charlyghislain) wrote :

yes that var is useless. The block could be replaced by
 // iterate through all buildings to find first predecessor
 const Tribe_Descr & t = b.descr().tribe();
 while (true) {
  const Building_Descr * oldest = b.m_old_buildings.front();
  if (!oldest->is_enhanced()) {
  const Building_Index & oldest_idx = t.building_index(oldest->name());
  for (Building_Index i = Building_Index::First(); i < t.get_nrbuildings(); ++i) {
   Building_Descr const * ob = t.get_building_descr(i);
   if (ob->enhancements().count(oldest_idx)) {
    b.m_old_buildings.insert(b.m_old_buildings.begin(), ob);

Changed in widelands:
status: New → Confirmed
assignee: nobody → cghislai (charlyghislain)
milestone: none → build18-rc1
SirVer (sirver) wrote :

Fixed in r6677.

Changed in widelands:
status: Confirmed → Fix Committed
SirVer (sirver) wrote :

Released in build-18 rc1.

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers