[vtkusers] Possible bug in 3.2beta

johnny carroll norris jnorris at csar.uiuc.edu
Thu Mar 1 11:42:34 EST 2001


Hello,

I was browsing through the source for vtk3.2beta when I noticed this
interesting piece of code in vtkDataSet.cxx:

//----------------------------------------------------------------------------
// This copies all the local variables (but not objects).
void vtkDataSet::InternalDataSetCopy(vtkDataSet *src)
{
  int idx;

  this->ComputeTime = src->ComputeTime;
  this->ScalarRange[0] = src->ScalarRange[0];
  this->ScalarRange[1] = src->ScalarRange[1];
  for (idx = 0; idx < 3; ++idx)
    {
    this->Bounds[idx] = src->Bounds[idx];
    this->Bounds[idx*2] = src->Bounds[idx*2];
    }
}

I think that this for loop must be messed up.  If you unroll it, you get this:

    this->Bounds[0] = src->Bounds[0];
    this->Bounds[0] = src->Bounds[0];
    this->Bounds[1] = src->Bounds[1];
    this->Bounds[2] = src->Bounds[2];
    this->Bounds[2] = src->Bounds[2];
    this->Bounds[4] = src->Bounds[4];

This doesn't really make any sense.  Some bounds are copied twice, and some
aren't copied at all.

John
-- 
John Norris
Research Programmer
Center for Simulation of Advanced Rockets
http://www.uiuc.edu/ph/www/jnorris




More information about the vtkusers mailing list