Commit 935c9659 authored by Sean McBride's avatar Sean McBride Committed by Code Review

Merge topic 'analyzer-warnings5' into master

efc3a4e9 Fix possible null deref warnings
53c1f9fb Fix warning about use-after-free
c02f83d0 Whitespace/spelling
ea3f62ea Removed harmless-looking dead code
42815afe Added vtkErrorMacro to code paths that give null ptrs
d5feacbb Fix possible null deref of ‘dsa’
666d78c2 Advance null check to before cast
parents cde0c2a8 efc3a4e9
......@@ -589,11 +589,11 @@ void vtkPlotBar::Update()
vtkDebugMacro(<< "Updating cached values.");
this->UpdateTableCache(table);
}
else if ((this->XAxis && this->XAxis->GetMTime() > this->BuildTime) ||
(this->YAxis && this->YAxis->GetMaximum() > this->BuildTime))
else if ((this->XAxis->GetMTime() > this->BuildTime) ||
(this->YAxis->GetMTime() > this->BuildTime))
{
if (this->LogX != this->XAxis->GetLogScale() ||
this->LogY != this->YAxis->GetLogScale())
if ((this->LogX != this->XAxis->GetLogScale()) ||
(this->LogY != this->YAxis->GetLogScale()))
{
this->LogX = this->XAxis->GetLogScale();
this->LogY = this->YAxis->GetLogScale();
......
......@@ -75,11 +75,11 @@ void vtkPlotFunctionalBag::Update()
vtkDebugMacro(<< "Updating cached values.");
this->UpdateTableCache(table);
}
else if ((this->XAxis && this->XAxis->GetMTime() > this->BuildTime) ||
(this->YAxis && this->YAxis->GetMaximum() > this->BuildTime))
else if ((this->XAxis->GetMTime() > this->BuildTime) ||
(this->YAxis->GetMTime() > this->BuildTime))
{
if (this->LogX != this->XAxis->GetLogScale() ||
this->LogY != this->YAxis->GetLogScale())
if ((this->LogX != this->XAxis->GetLogScale()) ||
(this->LogY != this->YAxis->GetLogScale()))
{
this->UpdateTableCache(table);
}
......
......@@ -142,11 +142,11 @@ void vtkPlotPoints::Update()
vtkDebugMacro(<< "Updating cached values.");
this->UpdateTableCache(table);
}
else if ((this->XAxis && this->XAxis->GetMTime() > this->BuildTime) ||
(this->YAxis && this->YAxis->GetMaximum() > this->BuildTime))
else if ((this->XAxis->GetMTime() > this->BuildTime) ||
(this->YAxis->GetMTime() > this->BuildTime))
{
if (this->LogX != this->XAxis->GetLogScale() ||
this->LogY != this->YAxis->GetLogScale())
if ((this->LogX != this->XAxis->GetLogScale()) ||
(this->LogY != this->YAxis->GetLogScale()))
{
this->UpdateTableCache(table);
}
......
......@@ -631,8 +631,8 @@ void vtkPlotStacked::Update()
vtkDebugMacro(<< "Updating cached values.");
this->UpdateTableCache(table);
}
else if ((this->XAxis && this->XAxis->GetMTime() > this->BuildTime) ||
(this->YAxis && this->YAxis->GetMTime() > this->BuildTime))
else if ((this->XAxis->GetMTime() > this->BuildTime) ||
(this->YAxis->GetMTime() > this->BuildTime))
{
if (this->LogX != this->XAxis->GetLogScaleActive() ||
this->LogY != this->YAxis->GetLogScaleActive())
......@@ -653,12 +653,6 @@ bool vtkPlotStacked::Paint(vtkContext2D *painter)
return false;
}
float width = this->Pen->GetWidth() * 2.3;
if (width < 8.0)
{
width = 8.0;
}
// Now add some decorations for our selected points...
if (this->Selection)
{
......
......@@ -642,7 +642,7 @@ void vtkScatterPlotMatrix::AdvanceAnimation()
int zColumn = 0;
vtkRectf size = this->Private->BigChart->GetSize();
float zSize(size.GetWidth());
float zSize;
this->Private->FinalAngle = 90.0;
this->Private->IncAngle = this->Private->FinalAngle / this->NumberOfFrames;
......
......@@ -246,6 +246,7 @@ unsigned char *vtkBitArray::ResizeAndExtend(vtkIdType sz)
if (newSize <= 0)
{
this->Initialize();
vtkErrorMacro(<< "Memory size must be positive\n");
return 0;
}
......
......@@ -140,6 +140,7 @@ vtkIdType *vtkIdList::Resize(const vtkIdType sz)
if (newSize <= 0)
{
this->Initialize();
vtkErrorMacro(<< "Memory size must be positive\n");
return 0;
}
......
......@@ -339,6 +339,7 @@ vtkStdString * vtkStringArray::ResizeAndExtend(vtkIdType sz)
if(newSize <= 0)
{
this->Initialize();
vtkErrorMacro(<< "Memory size must be positive\n");
return 0;
}
......
......@@ -694,6 +694,7 @@ vtkVariant* vtkVariantArray::ResizeAndExtend(vtkIdType sz)
if(newSize <= 0)
{
this->Initialize();
vtkErrorMacro(<< "Memory size must be positive\n");
return 0;
}
......
......@@ -136,6 +136,7 @@ void** vtkVoidArray::ResizeAndExtend(vtkIdType sz)
if (newSize <= 0)
{
this->Initialize();
vtkErrorMacro(<< "Memory size must be positive\n");
return 0;
}
......
......@@ -195,7 +195,6 @@ int vtkProteinRibbonFilter::RequestData(vtkInformation *,
borderPoints[0].clear();
borderPoints[1].clear();
colors.clear();
ss = 0;
hasPrevCO = false;
}
currentCA.Set(xyz[0], xyz[1], xyz[2]);
......
......@@ -736,8 +736,8 @@ int vtkConvertSelection::Convert(
}
// Handle the special case where we have a pedigree id selection with a domain array.
vtkStringArray* outputDomainArr = vtkStringArray::SafeDownCast(
dsa->GetAbstractArray("domain"));
vtkStringArray* outputDomainArr = dsa ? vtkStringArray::SafeDownCast(
dsa->GetAbstractArray("domain")) : 0;
if (this->OutputType == vtkSelectionNode::PEDIGREEIDS && outputDomainArr)
{
vtkAbstractArray* outputDataArr = dsa->GetPedigreeIds();
......
......@@ -545,9 +545,6 @@ void vtkTemporalStreamTracer::AssignSeedsToProcessors(
// take points from the source object and create a particle list
//
int numSeeds = source->GetNumberOfPoints();
#ifndef NDEBUG
int numTested = numSeeds;
#endif
candidates.resize(numSeeds);
//
for (int i=0; i<numSeeds; i++) {
......@@ -576,7 +573,7 @@ void vtkTemporalStreamTracer::AssignSeedsToProcessors(
//
#ifndef NDEBUG
numTested = static_cast<int>(candidates.size());
int numTested = static_cast<int>(candidates.size());
#endif
this->TestParticles(candidates, LocalSeedPoints, LocalAssignedCount);
int TotalAssigned = LocalAssignedCount; (void)TotalAssigned;
......
......@@ -653,14 +653,14 @@ void vtkKMeansStatistics::Assess( vtkTable* inData,
reqModel,
0,
dfunc );
vtkKMeansAssessFunctor* kmfunc = static_cast<vtkKMeansAssessFunctor*>( dfunc );
if ( ! kmfunc )
if ( ! dfunc )
{
vtkWarningMacro( "Assessment could not be accommodated. Skipping." );
delete dfunc;
return;
}
vtkKMeansAssessFunctor* kmfunc = static_cast<vtkKMeansAssessFunctor*>( dfunc );
vtkIdType nv = this->AssessNames->GetNumberOfValues();
int numRuns = kmfunc->GetNumberOfRuns();
vtkStdString* names = new vtkStdString[nv*numRuns];
......
......@@ -338,7 +338,6 @@ void vtkNewickTreeReader::CountNodes(const char *buffer, vtkIdType *numNodes)
current++;
if (*current == ':')
{
start = current + 1;
while (*current != '\0' && *current != ';')
{
current++;
......
......@@ -241,6 +241,7 @@ void vtkXMLUnstructuredDataWriter::AllocatePositionArrays()
void vtkXMLUnstructuredDataWriter::DeletePositionArrays()
{
delete [] this->NumberOfPointsPositions;
this->NumberOfPointsPositions = 0;
}
//----------------------------------------------------------------------------
......
......@@ -1163,7 +1163,7 @@ void vtkImageSincInterpolatorPrecomputeWeights(
break;
default:
do
do
{
inId[l] = vtkInterpolationMath::Clamp(idx++, minExt, maxExt);
}
......
......@@ -132,7 +132,7 @@ public:
// Description:
// Specify the number of circumferential rings. If set to zero, then
// none will be shown; othewise the specified number will be shown.
// none will be shown; otherwise the specified number will be shown.
vtkSetClampMacro(NumberOfRings,int,0,VTK_INT_MAX);
vtkGetMacro(NumberOfRings,int);
......
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