Commit c868a18d authored by Sean McBride's avatar Sean McBride

Fixed more cppcheck 1.84 warnings

This fixed issues were:

clarifyCondition,Common/Core/vtkLargeInteger.cxx:355
identicalInnerCondition,Filters/Texture/vtkTextureMapToPlane.cxx:103,warning,Identical inner 'if' condition is always true.
nullPointerArithmeticRedundantCheck,Rendering/GL2PSOpenGL2/vtkOpenGLGL2PSHelperImpl.cxx:173,warning,Either the condition '!data' is redundant or there is pointer arithmetic with NULL pointer.
identicalInnerCondition,Filters/FlowPaths/vtkModifiedBSPTree.cxx:1069,warning,Identical inner 'if' condition is always true.
identicalInnerCondition,Rendering/OpenGL2/vtkOSOpenGLRenderWindow.cxx:199,warning,Identical inner 'if' condition is always true.
nullPointerArithmeticRedundantCheck,Infovis/BoostGraphAlgorithms/vtkBoostGraphAdapter.h:222,warning,Either the condition 'iter!=0' is redundant or there is pointer arithmetic with NULL pointer.

The vtkTestingRenderingDriver.cmake changed cause many many warnings in files generated from it.
parent ffa859d4
......@@ -14,22 +14,22 @@ SET(CMAKE_TESTDRIVER_BEFORE_TESTMAIN
interactive = 1;
continue;
}
if (strcmp(av[ii], \"-V\") == 0 && ii < ac-1)
if (ii < ac-1 && strcmp(av[ii], \"-V\") == 0)
{
vtkTestingInteractor::ValidBaseline = std::string(av[++ii]);
continue;
}
if (strcmp(av[ii], \"-T\") == 0 && ii < ac-1)
if (ii < ac-1 && strcmp(av[ii], \"-T\") == 0)
{
vtkTestingInteractor::TempDirectory = std::string(av[++ii]);
continue;
}
if (strcmp(av[ii], \"-D\") == 0 && ii < ac-1)
if (ii < ac-1 && strcmp(av[ii], \"-D\") == 0)
{
vtkTestingInteractor::DataDirectory = std::string(av[++ii]);
continue;
}
if (strcmp(av[ii], \"-E\") == 0 && ii < ac-1)
if (ii < ac-1 && strcmp(av[ii], \"-E\") == 0)
{
vtkTestingInteractor::ErrorThreshold =
static_cast<double>(atof(av[++ii]));
......
......@@ -352,9 +352,9 @@ bool vtkLargeInteger::IsGreater(const vtkLargeInteger& n) const
bool vtkLargeInteger::operator<(const vtkLargeInteger& n) const
{
if (this->Negative & !n.Negative) // try to make judgement using signs
if (this->Negative && !n.Negative) // try to make judgement using signs
return true;
else if ((!this->Negative) & n.Negative)
else if ((!this->Negative) && n.Negative)
return false;
else if (this->Negative)
return !this->IsSmaller(n);
......
......@@ -1066,10 +1066,7 @@ vtkIdListCollection *vtkModifiedBSPTree::GetLeafNodeCellInformation()
ns.pop();
if (node->mChild[0])
{ // this must be a parent node
if (node->mChild[0])
{
ns.push(node->mChild[0]);
}
ns.push(node->mChild[0]);
if (node->mChild[1])
{
ns.push(node->mChild[1]);
......
......@@ -100,10 +100,7 @@ int vtkTextureMapToPlane::RequestData(
this->Origin[2] == 0.0 && this->Point1[0] == 0.0 &&
this->Point1[1] == 0.0 && this->Point1[2] == 0.0) )
{
if ( this->AutomaticPlaneGeneration )
{
this->ComputeNormal(output);
}
this->ComputeNormal(output);
vtkMath::Normalize (this->Normal);
......
......@@ -188,7 +188,7 @@ namespace boost {
{
public:
explicit vtk_edge_iterator(vtkGraph *g = 0, vtkIdType v = 0) :
directed(false), vertex(v), lastVertex(v), iter(0), end(0), graph(g)
directed(false), vertex(v), lastVertex(v), iter(nullptr), end(nullptr), graph(g)
{
if (graph)
{
......@@ -219,20 +219,23 @@ namespace boost {
// edges
vtkIdType nedges;
graph->GetOutEdges(vertex, iter, nedges);
end = iter + nedges;
if (!directed)
if (iter)
{
while(iter != 0
&& (// Skip non-local edges
(helper && helper->GetEdgeOwner(iter->Id) != myRank)
// Skip entirely-local edges where Source > Target
|| (((helper
&& myRank == helper->GetVertexOwner(iter->Target))
|| !helper)
&& vertex > iter->Target)))
end = iter + nedges;
if (!directed)
{
this->inc();
while(iter != 0
&& (// Skip non-local edges
(helper && helper->GetEdgeOwner(iter->Id) != myRank)
// Skip entirely-local edges where Source > Target
|| (((helper
&& myRank == helper->GetVertexOwner(iter->Target))
|| !helper)
&& vertex > iter->Target)))
{
this->inc();
}
}
}
}
......
......@@ -170,6 +170,13 @@ void vtkOpenGLGL2PSHelperImpl::ProcessTransformFeedback(
typedef std::vector<vtkTransformFeedback::VaryingMetaData> VarVector;
const VarVector &vars = tfc->GetVaryings();
unsigned char *data = static_cast<unsigned char *>(tfc->GetBufferData());
if (!data)
{
vtkErrorMacro("TransformFeedback buffer is nullptr.");
return;
}
unsigned char *dataEnd = data + tfc->GetBufferSize();
size_t vertexSize = tfc->GetBytesPerVertex();
(void)vertexSize; // Only used in asserts
......@@ -180,11 +187,6 @@ void vtkOpenGLGL2PSHelperImpl::ProcessTransformFeedback(
float pointSize = this->PointSize * this->PointSizeFactor;
float lineWidth = this->LineWidth * this->LineWidthFactor;
if (!data)
{
vtkErrorMacro("TransformFeedback buffer is nullptr.");
return;
}
// Info to transform clip --> display coords
double renVp[4];
......
......@@ -173,9 +173,9 @@ void vtkOSOpenGLRenderWindow::CreateOffScreenWindow(int width, int height)
this->Internal->OffScreenWindow = vtkOSMesaCreateWindow(width,height);
this->OwnWindow = 1;
}
#if (OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 1102) && defined(OSMESA_CONTEXT_MAJOR_VERSION)
if (!this->Internal->OffScreenContextId)
{
#if (OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 1102) && defined(OSMESA_CONTEXT_MAJOR_VERSION)
static const int attribs[] = {
OSMESA_FORMAT, OSMESA_RGBA,
OSMESA_DEPTH_BITS, 32,
......@@ -194,12 +194,12 @@ void vtkOSOpenGLRenderWindow::CreateOffScreenWindow(int width, int height)
{
this->Internal->OffScreenContextId = OSMesaCreateContextAttribs(attribs, nullptr);
}
}
#endif
// if we still have no context fall back to the generic signature
if (!this->Internal->OffScreenContextId)
{
this->Internal->OffScreenContextId = OSMesaCreateContext(GL_RGBA, nullptr);
}
// if we still have no context fall back to the generic signature
if (!this->Internal->OffScreenContextId)
{
this->Internal->OffScreenContextId = OSMesaCreateContext(GL_RGBA, nullptr);
}
this->MakeCurrent();
......
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