Commit ac80e9a7 authored by Sean McBride's avatar Sean McBride Committed by Code Review
Browse files

Merge topic 'analyzer-warnings3' into master

af2526da Fixed warning about using ‘volBounds’ uninitialized
3099508a Fix clang analyzer warning by adding temp variable
92f6a354 Fixed warning about possible null deref
6e773e1d Refactor to make intent clear to clang analyzer
68294b7d Removed minor dead stores, to fix warnings
parents 694642a9 af2526da
......@@ -412,10 +412,11 @@ void vtkDataArray::InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
// in case WriteVoidPointer reallocates memory and fromData ==
// this. The vtkBitArray implementation doesn't use pointers, so skip
// the resizing in this case.
void* vto = fromData->GetDataType() != VTK_BIT ?
int dataType = fromData->GetDataType();
void* vto = dataType != VTK_BIT ?
this->WriteVoidPointer(idx, numComp) : 0;
switch (fromData->GetDataType())
switch (dataType)
{
case VTK_BIT:
{
......
......@@ -703,7 +703,7 @@ vtkIdType vtkCellLocator::FindClosestPointWithinRadius(double x[3], double radiu
int closestCell = -1;
double radius2 = radius*radius;
double minDist2 = 1.1*radius2; // something slightly bigger....
double refinedRadius = radius;
double refinedRadius;
double refinedRadius2 = radius2;
// Find bucket point is in.
......@@ -778,7 +778,6 @@ vtkIdType vtkCellLocator::FindClosestPointWithinRadius(double x[3], double radiu
cachedPoint[0] = point[0];
cachedPoint[1] = point[1];
cachedPoint[2] = point[2];
refinedRadius = sqrt(dist2);
refinedRadius2 = dist2;
}
}
......
......@@ -783,47 +783,39 @@ void vtkKdTree::BuildLocator()
this->FreeSearchStructure();
// volume bounds - push out a little if flat
double setBounds[6], volBounds[6];
bool first = true;
vtkCollectionSimpleIterator cookie;
this->DataSets->InitTraversal(cookie);
for (vtkDataSet *iset = this->DataSets->GetNextDataSet(cookie);
iset != NULL; iset = this->DataSets->GetNextDataSet(cookie))
vtkDataSet *iset = this->DataSets->GetNextDataSet(cookie);
double volBounds[6];
iset->GetBounds(volBounds);
while ((iset = this->DataSets->GetNextDataSet(cookie)))
{
if (first)
double setBounds[6];
iset->GetBounds(setBounds);
if (setBounds[0] < volBounds[0])
{
iset->GetBounds(volBounds);
first = false;
volBounds[0] = setBounds[0];
}
else
if (setBounds[2] < volBounds[2])
{
iset->GetBounds(setBounds);
if (setBounds[0] < volBounds[0])
{
volBounds[0] = setBounds[0];
}
if (setBounds[2] < volBounds[2])
{
volBounds[2] = setBounds[2];
}
if (setBounds[4] < volBounds[4])
{
volBounds[4] = setBounds[4];
}
if (setBounds[1] > volBounds[1])
{
volBounds[1] = setBounds[1];
}
if (setBounds[3] > volBounds[3])
{
volBounds[3] = setBounds[3];
}
if (setBounds[5] > volBounds[5])
{
volBounds[5] = setBounds[5];
}
volBounds[2] = setBounds[2];
}
if (setBounds[4] < volBounds[4])
{
volBounds[4] = setBounds[4];
}
if (setBounds[1] > volBounds[1])
{
volBounds[1] = setBounds[1];
}
if (setBounds[3] > volBounds[3])
{
volBounds[3] = setBounds[3];
}
if (setBounds[5] > volBounds[5])
{
volBounds[5] = setBounds[5];
}
}
......
......@@ -1097,8 +1097,8 @@ void vtkAlgorithm::AddInputConnection(int port, vtkAlgorithmOutput* input)
vtkDebugMacro("Adding connection to input port index " << consumerPort
<< " from output port index " << producerPort
<< " on algorithm "
<< (producer? producer->GetAlgorithm()->GetClassName() : "")
<< "(" << (producer? producer->GetAlgorithm() : 0) << ").");
<< producer->GetAlgorithm()->GetClassName()
<< "(" << producer->GetAlgorithm() << ").");
// Get the information object from the producer of the new input.
vtkInformation* newInfo = producer->GetOutputInformation(producerPort);
......
......@@ -65,8 +65,8 @@ struct vtkImageThreadStruct
// This can be from 1 to "total".
// If 1 is returned, the extent cannot be split.
int vtkThreadedImageAlgorithm::SplitExtent(int splitExt[6],
int startExt[6],
int num, int total)
int startExt[6],
int num, int total)
{
int splitAxis;
int min, max;
......@@ -163,6 +163,7 @@ static VTK_THREAD_RETURN_TYPE vtkThreadedImageAlgorithmThreadedExecute( void *ar
{
// if there is no output, then use UE from input, use the first input
int inPort;
bool found = false;
for (inPort = 0; inPort < str->Filter->GetNumberOfInputPorts(); ++inPort)
{
if (str->Filter->GetNumberOfInputConnections(inPort))
......@@ -173,10 +174,11 @@ static VTK_THREAD_RETURN_TYPE vtkThreadedImageAlgorithmThreadedExecute( void *ar
->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
updateExtent);
memcpy(ext,updateExtent, sizeof(int)*6);
found = true;
break;
}
}
if (inPort >= str->Filter->GetNumberOfInputPorts())
if (!found)
{
return VTK_THREAD_RETURN_VALUE;
}
......
......@@ -812,9 +812,9 @@ namespace {
double xp[3], xm[3], factor;
xp[0] = xp[1] = xp[2] = xm[0] = xm[1] = xm[2] = factor = 0;
double xxi, yxi, zxi, xeta, yeta, zeta, xzeta, yzeta, zzeta;
xxi = yxi = zxi = xeta = yeta = zeta = xzeta = yzeta = zzeta = 0;
yxi = zxi = xeta = yeta = zeta = xzeta = yzeta = zzeta = 0;
double aj, xix, xiy, xiz, etax, etay, etaz, zetax, zetay, zetaz;
aj = xix = xiy = xiz = etax = etay = etaz = zetax = zetay = zetaz = 0;
xix = xiy = xiz = etax = etay = etaz = zetax = zetay = zetaz = 0;
// for finite differencing -- the values on the "plus" side and
// "minus" side of the point to be computed at
std::vector<double> plusvalues(numberOfInputComponents);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment