From fb7a390941b27b8fc2f19deb33c937847785f783 Mon Sep 17 00:00:00 2001
From: Sean McBride <sean@rogue-research.com>
Date: Sun, 21 Feb 2016 22:12:03 -0500
Subject: [PATCH] Fixed many 'redundantAssignment' cppcheck warnings

---
 CMake/VTKcppcheckSuppressions.txt                   |  6 ++++++
 Charts/Core/vtkAxis.cxx                             |  5 ++---
 Common/DataModel/Testing/Cxx/TestAMRBox.cxx         |  3 +--
 Common/DataModel/Testing/Cxx/TestDispatchers.cxx    |  1 +
 .../DataModel/Testing/Cxx/TestStaticCellLinks.cxx   |  8 ++------
 .../DataModel/vtkIncrementalOctreePointLocator.cxx  |  6 ++----
 Common/DataModel/vtkPolygon.cxx                     |  4 ----
 Common/System/vtkTimerLog.cxx                       |  6 +++---
 Domains/Chemistry/vtkSimpleBondPerceiver.cxx        |  9 ++-------
 Examples/AMR/Cxx/Generate2DAMRDataSetWithPulse.cxx  |  6 ++----
 Examples/AMR/Cxx/Generate3DAMRDataSetWithPulse.cxx  |  6 ++----
 Examples/GUI/Qt/GraphicsView/OpenGLScene.cpp        | 12 ++++++------
 .../Testing/Cxx/TestExtractRectilinearGrid.cxx      |  3 +--
 Filters/Extraction/vtkExtractSelection.cxx          |  1 -
 Filters/Extraction/vtkProbeSelectedLocations.cxx    |  1 -
 .../General/Testing/Cxx/TestQuadraturePoints.cxx    |  6 +++---
 .../Testing/Cxx/TestStructuredGridConnectivity.cxx  |  3 +--
 .../Cxx/TestPUnstructuredGridConnectivity.cxx       |  3 +--
 .../Testing/Cxx/TestImplicitConnectivity.cxx        |  3 +--
 Filters/StatisticsGnuR/vtkRInterface.cxx            |  8 ++++----
 IO/Export/vtkX3DExporter.cxx                        |  1 -
 IO/GDAL/vtkGDALRasterReader.cxx                     | 13 +++++++++++--
 .../Cxx/TestIncrementalOctreePointLocator.cxx       |  2 +-
 IO/Geometry/vtkCGMWriter.cxx                        |  7 +++----
 IO/Geometry/vtkTecplotReader.cxx                    |  3 +--
 IO/Import/vtkOBJImporterInternals.h                 |  5 +++--
 IO/Infovis/vtkXMLTreeReader.cxx                     |  3 +--
 IO/MINC/vtkMINCImageReader.cxx                      |  3 +--
 IO/XML/Testing/Cxx/TestHyperOctreeIO.cxx            |  4 ++--
 Infovis/Layout/vtkPerturbCoincidentVertices.cxx     |  5 +----
 Rendering/Core/vtkPropAssembly.cxx                  |  6 ++----
 .../OpenGL/Testing/Cxx/TestFBOImplementation.cxx    |  3 +--
 Rendering/OpenGL/vtkScalarsToColorsPainter.cxx      |  1 -
 Rendering/ParallelLIC/vtkParallelTimer.cxx          |  6 ++----
 Rendering/Qt/vtkQtTreeRingLabelMapper.cxx           |  5 ++---
 .../vtkOpenGLGPUVolumeRayCastMapper.cxx             |  4 +---
 Web/WebGLExporter/vtkWebGLWidget.cxx                |  3 +--
 Wrapping/Tools/vtkWrapJava.c                        |  3 +--
 38 files changed, 74 insertions(+), 103 deletions(-)

diff --git a/CMake/VTKcppcheckSuppressions.txt b/CMake/VTKcppcheckSuppressions.txt
index 83ad7583384..4470aa3c4f7 100644
--- a/CMake/VTKcppcheckSuppressions.txt
+++ b/CMake/VTKcppcheckSuppressions.txt
@@ -78,6 +78,12 @@ nullPointerRedundantCheck:Filters/General/vtkMultiThreshold.cxx
 oppositeInnerCondition:Rendering/VolumeOpenGL/vtkOpenGLVolumeTextureMapper3D.cxx
 pointerPositive:Common/DataModel/vtkUnstructuredGridCellIterator.cxx
 redundantAssignInSwitch:Wrapping/Tools/vtkWrapPythonOverload.c
+redundantAssignment:Filters/General/vtkApproximatingSubdivisionFilter.cxx
+redundantAssignment:Filters/General/vtkInterpolatingSubdivisionFilter.cxx
+redundantAssignment:Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx
+redundantAssignment:Rendering/OpenGL2/vtkRenderbuffer.cxx
+redundantAssignment:Rendering/OpenGL2/vtkTextureObject.cxx
+redundantAssignment:Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx
 stlIfStrFind:Infovis/Core/vtkPipelineGraphSource.cxx
 unassignedVariable:Common/Transforms/vtkHomogeneousTransform.cxx
 unassignedVariable:Filters/Core/vtkFlyingEdges3D.cxx
diff --git a/Charts/Core/vtkAxis.cxx b/Charts/Core/vtkAxis.cxx
index 93b42b3ec35..59146ef39d2 100644
--- a/Charts/Core/vtkAxis.cxx
+++ b/Charts/Core/vtkAxis.cxx
@@ -1667,17 +1667,16 @@ double vtkAxis::LogScaleTickMark(double number,
                                  bool &niceValue,
                                  int &order)
 {
-  double result(0.0);
-  niceValue = false;
   // We need to retrive the order of our number.
   order = static_cast<int>(floor(log10(number)));
 
   // We retrive the basis of our number depending on roundUp and return it as
   // result.
   number = number * pow(10.0, static_cast<double>(order*(-1)));
-  result = roundUp ? ceil(number) : floor(number);
+  double result = roundUp ? ceil(number) : floor(number);
 
   // If result is 1.0, 2.0 or 5.0 we mark the result as "nice value".
+  niceValue = false;
   if (result == 1.0 || result == 2.0 || result == 5.0)
     {
     niceValue = true;
diff --git a/Common/DataModel/Testing/Cxx/TestAMRBox.cxx b/Common/DataModel/Testing/Cxx/TestAMRBox.cxx
index 9a308c29d65..449667a96fc 100644
--- a/Common/DataModel/Testing/Cxx/TestAMRBox.cxx
+++ b/Common/DataModel/Testing/Cxx/TestAMRBox.cxx
@@ -251,11 +251,10 @@ int TestAMRBoxIntersection()
 
   // Save the initial
   A0 = A;
-  bool doesIntersect = false;
 
   B = A;
   B.Shrink( 2 );
-  doesIntersect = A.Intersect( B );
+  bool doesIntersect = A.Intersect( B );
   if( !doesIntersect || (A != B) )
     {
     std::cerr << "ERROR: Intersecting a fully encompassing box failed!\n";
diff --git a/Common/DataModel/Testing/Cxx/TestDispatchers.cxx b/Common/DataModel/Testing/Cxx/TestDispatchers.cxx
index 0bf8f69c564..8235beddeae 100644
--- a/Common/DataModel/Testing/Cxx/TestDispatchers.cxx
+++ b/Common/DataModel/Testing/Cxx/TestDispatchers.cxx
@@ -255,6 +255,7 @@ bool TestMixedDispatch()
 
   int result = dispatcher.Go(as<vtkDataArray>(doubleArray.GetPointer()));
   result = dispatcher.Go(intArray.GetPointer());
+  test_expression(result==2,"unexpected");
   result = dispatcher.Go(doubleArray.GetPointer());
   test_expression(result==3,"statefull functor failed with int and double");
 
diff --git a/Common/DataModel/Testing/Cxx/TestStaticCellLinks.cxx b/Common/DataModel/Testing/Cxx/TestStaticCellLinks.cxx
index 2d9fcd77876..4a02b8508a7 100644
--- a/Common/DataModel/Testing/Cxx/TestStaticCellLinks.cxx
+++ b/Common/DataModel/Testing/Cxx/TestStaticCellLinks.cxx
@@ -99,9 +99,7 @@ int TestStaticCellLinks( int, char *[] )
   extract->Update();
 
   // Grab the output, build links on unstructured grid
-  vtkSmartPointer<vtkUnstructuredGrid> ugrid =
-    vtkSmartPointer<vtkUnstructuredGrid>::New();
-  ugrid = extract->GetOutput();
+  vtkSmartPointer<vtkUnstructuredGrid> ugrid = extract->GetOutput();
 
   vtkStaticCellLinksTemplate<int> slinks;
   slinks.BuildLinks(ugrid);
@@ -157,9 +155,7 @@ int TestStaticCellLinks( int, char *[] )
   ss->SetPhiResolution(10);
   ss->Update();
 
-  vtkSmartPointer<vtkPolyData> pdata =
-    vtkSmartPointer<vtkPolyData>::New();
-  pdata = ss->GetOutput();
+  vtkSmartPointer<vtkPolyData> pdata = ss->GetOutput();
 
   slinks.Initialize(); //reuse
   slinks.BuildLinks(pdata);
diff --git a/Common/DataModel/vtkIncrementalOctreePointLocator.cxx b/Common/DataModel/vtkIncrementalOctreePointLocator.cxx
index a1fcb554f52..8ef8ef8ae39 100644
--- a/Common/DataModel/vtkIncrementalOctreePointLocator.cxx
+++ b/Common/DataModel/vtkIncrementalOctreePointLocator.cxx
@@ -254,11 +254,9 @@ vtkIdType vtkIncrementalOctreePointLocator::FindClosestInsertedPoint
   double    miniDist2 = this->OctreeMaxDimSize * this->OctreeMaxDimSize * 4.0;
   double    elseDist2;      // inter-node search
   vtkIdType elsePntId;      // inter-node search
-  vtkIdType pointIndx = -1;
-  vtkIncrementalOctreeNode * pLeafNode = NULL;
 
-  pLeafNode = this->GetLeafContainer( this->OctreeRootNode, x );
-  pointIndx = this->FindClosestPointInLeafNode( pLeafNode, x, &miniDist2 );
+  vtkIncrementalOctreeNode * pLeafNode = this->GetLeafContainer( this->OctreeRootNode, x );
+  vtkIdType pointIndx = this->FindClosestPointInLeafNode( pLeafNode, x, &miniDist2 );
 
   if ( miniDist2 > 0.0 )
     {
diff --git a/Common/DataModel/vtkPolygon.cxx b/Common/DataModel/vtkPolygon.cxx
index 9dc762209f7..9ef26e9acbe 100644
--- a/Common/DataModel/vtkPolygon.cxx
+++ b/Common/DataModel/vtkPolygon.cxx
@@ -568,10 +568,6 @@ int vtkPolygon::ParameterizePolygon(double *p0, double *p10, double& l10,
       {
       p[j] = x1[j] - p0[j];
       }
-#ifdef BAD_WITH_NODEBUG
-    s = vtkMath::Dot(p,p10) / l10;
-    t = vtkMath::Dot(p,p20) / l20;
-#endif
     s = (p[0]*p10[0] + p[1]*p10[1] + p[2]*p10[2]) / l10;
     t = (p[0]*p20[0] + p[1]*p20[1] + p[2]*p20[2]) / l20;
     sbounds[0] = (s<sbounds[0]?s:sbounds[0]);
diff --git a/Common/System/vtkTimerLog.cxx b/Common/System/vtkTimerLog.cxx
index 451d93166c1..c5fba701b59 100644
--- a/Common/System/vtkTimerLog.cxx
+++ b/Common/System/vtkTimerLog.cxx
@@ -556,11 +556,11 @@ double vtkTimerLog::GetUniversalTime()
 //----------------------------------------------------------------------------
 double vtkTimerLog::GetCPUTime()
 {
-  double   currentCPUTime = 1.0;
 #ifndef _WIN32_WCE
-  currentCPUTime = static_cast<double>(clock()) /static_cast<double>(CLOCKS_PER_SEC);
+  return static_cast<double>(clock()) /static_cast<double>(CLOCKS_PER_SEC);
+#else
+  return 1.0;
 #endif
-  return currentCPUTime;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Domains/Chemistry/vtkSimpleBondPerceiver.cxx b/Domains/Chemistry/vtkSimpleBondPerceiver.cxx
index aa29b0d2a0b..679a6837a5b 100644
--- a/Domains/Chemistry/vtkSimpleBondPerceiver.cxx
+++ b/Domains/Chemistry/vtkSimpleBondPerceiver.cxx
@@ -69,13 +69,8 @@ int vtkSimpleBondPerceiver::RequestData(
   output->ShallowCopyAttributes(input);
 
   // Get pointers to data
-  vtkSmartPointer<vtkUnsignedShortArray> numArr =
-      vtkSmartPointer<vtkUnsignedShortArray>::New();
-  vtkSmartPointer<vtkPoints> posArr =
-      vtkSmartPointer<vtkPoints>::New();
-
-  posArr = output->GetAtomicPositionArray();
-  numArr = output->GetAtomicNumberArray();
+  vtkSmartPointer<vtkPoints> posArr = output->GetAtomicPositionArray();
+  vtkSmartPointer<vtkUnsignedShortArray> numArr = output->GetAtomicNumberArray();
 
   // Cache atomic radii
   vtkNew<vtkPeriodicTable> pTab;
diff --git a/Examples/AMR/Cxx/Generate2DAMRDataSetWithPulse.cxx b/Examples/AMR/Cxx/Generate2DAMRDataSetWithPulse.cxx
index adf5f6a6836..9a713637bb8 100644
--- a/Examples/AMR/Cxx/Generate2DAMRDataSetWithPulse.cxx
+++ b/Examples/AMR/Cxx/Generate2DAMRDataSetWithPulse.cxx
@@ -141,15 +141,13 @@ vtkOverlappingAMR* GetAMRDataSet()
 
   double h[3];
   int    ndim[3];
-  int    blockId = -1;
-  int    level   = -1;
 
   // Root Block -- Block 0,0
   ndim[0]   = 6; ndim[1]   = 5; ndim[2] = 1;
   h[0]      = h[1]      = h[2]      = 1.0;
 
-  blockId   = 0;
-  level     = 0;
+  int    blockId   = 0;
+  int    level     = 0;
   vtkUniformGrid *root = AMRCommon::GetGrid(origin, h, ndim);
   vtkAMRBox box(origin, ndim, h, data->GetOrigin(), data->GetGridDescription());
   AttachPulseToGrid( root );
diff --git a/Examples/AMR/Cxx/Generate3DAMRDataSetWithPulse.cxx b/Examples/AMR/Cxx/Generate3DAMRDataSetWithPulse.cxx
index 42811678279..4243ed917d1 100644
--- a/Examples/AMR/Cxx/Generate3DAMRDataSetWithPulse.cxx
+++ b/Examples/AMR/Cxx/Generate3DAMRDataSetWithPulse.cxx
@@ -138,15 +138,13 @@ vtkOverlappingAMR* GetAMRDataSet()
   double origin[3];
   double h[3];
   int    ndim[3];
-  int    blockId = -1;
-  int    level   = -1;
 
   // Root Block -- Block 0
   ndim[0]   = 6; ndim[1]   = ndim[2]   = 5;
   h[0]      = h[1]      = h[2]      = 1.0;
   origin[0] = origin[1] = origin[2] = -2.0;
-  blockId   = 0;
-  level     = 0;
+  int    blockId   = 0;
+  int    level     = 0;
   vtkUniformGrid *root = AMRCommon::GetGrid(origin,h,ndim);
   vtkAMRBox box(origin,ndim,h,data->GetOrigin(), data->GetGridDescription());
   AttachPulseToGrid( root );
diff --git a/Examples/GUI/Qt/GraphicsView/OpenGLScene.cpp b/Examples/GUI/Qt/GraphicsView/OpenGLScene.cpp
index f9f96769bc5..c0f7a55b42d 100644
--- a/Examples/GUI/Qt/GraphicsView/OpenGLScene.cpp
+++ b/Examples/GUI/Qt/GraphicsView/OpenGLScene.cpp
@@ -107,12 +107,12 @@ OpenGLScene::OpenGLScene(QGLContext* ctx, QObject* p)
   trans->addAnimation(new QBoolAnimation(1.0, mTreeRingView, "enabled")); // enable at end of transition
 
   // non animated transitions
-  trans = state1->addTransition(this, SIGNAL(enterState4()), state4);
-  trans = state2->addTransition(this, SIGNAL(enterState4()), state4);
-  trans = state3->addTransition(this, SIGNAL(enterState4()), state4);
-  trans = state4->addTransition(this, SIGNAL(enterState1()), state1);
-  trans = state4->addTransition(this, SIGNAL(enterState2()), state2);
-  trans = state4->addTransition(this, SIGNAL(enterState3()), state3);
+  state1->addTransition(this, SIGNAL(enterState4()), state4);
+  state2->addTransition(this, SIGNAL(enterState4()), state4);
+  state3->addTransition(this, SIGNAL(enterState4()), state4);
+  state4->addTransition(this, SIGNAL(enterState1()), state1);
+  state4->addTransition(this, SIGNAL(enterState2()), state2);
+  state4->addTransition(this, SIGNAL(enterState3()), state3);
 
   machine.start();
 
diff --git a/Filters/Extraction/Testing/Cxx/TestExtractRectilinearGrid.cxx b/Filters/Extraction/Testing/Cxx/TestExtractRectilinearGrid.cxx
index d8f8d0d6587..c443c02df98 100644
--- a/Filters/Extraction/Testing/Cxx/TestExtractRectilinearGrid.cxx
+++ b/Filters/Extraction/Testing/Cxx/TestExtractRectilinearGrid.cxx
@@ -34,8 +34,7 @@
 
 double exponential_distribution(const int i, const double beta)
 {
-  double xi=0.0;
-  xi = ( ( exp( i*beta ) - 1 ) /( exp( beta ) - 1 ) );
+  double xi = ( ( exp( i*beta ) - 1 ) /( exp( beta ) - 1 ) );
   return( xi );
 }
 
diff --git a/Filters/Extraction/vtkExtractSelection.cxx b/Filters/Extraction/vtkExtractSelection.cxx
index 9c1b6bed4ea..b3432091e07 100644
--- a/Filters/Extraction/vtkExtractSelection.cxx
+++ b/Filters/Extraction/vtkExtractSelection.cxx
@@ -380,7 +380,6 @@ vtkDataObject* vtkExtractSelection::RequestDataFromBlock(
   tp->SetOutput(tempSel);
   subFilter->SetInputConnection(1, tp->GetOutputPort());
   tp->Delete();
-  tp = 0;
 
   vtkDataObject* inputCopy = input->NewInstance();
   inputCopy->ShallowCopy(input);
diff --git a/Filters/Extraction/vtkProbeSelectedLocations.cxx b/Filters/Extraction/vtkProbeSelectedLocations.cxx
index e5dccabc408..93dadf328da 100644
--- a/Filters/Extraction/vtkProbeSelectedLocations.cxx
+++ b/Filters/Extraction/vtkProbeSelectedLocations.cxx
@@ -129,7 +129,6 @@ int vtkProbeSelectedLocations::RequestData(vtkInformation *vtkNotUsed(request),
   subFilter->SetInputConnection(1, tp->GetOutputPort());
   inputClone->Delete();
   tp->Delete();
-  tp = 0;
 
   tp = vtkTrivialProducer::New();
   tp->SetOutput(tempInput);
diff --git a/Filters/General/Testing/Cxx/TestQuadraturePoints.cxx b/Filters/General/Testing/Cxx/TestQuadraturePoints.cxx
index 0727114c198..42cdd3a372f 100644
--- a/Filters/General/Testing/Cxx/TestQuadraturePoints.cxx
+++ b/Filters/General/Testing/Cxx/TestQuadraturePoints.cxx
@@ -213,7 +213,7 @@ int TestQuadraturePoints(int argc,char *argv[])
   camera->Elevation(95.0);
   camera->SetViewUp(0.0,0.0,1.0);
   camera->Azimuth(180.0);
-  camera=0;
+
   // Setup upper right pane.
   vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();
   ren1->SetViewport(0.5,0.5,1.0,1.0);
@@ -228,7 +228,7 @@ int TestQuadraturePoints(int argc,char *argv[])
   camera->OrthogonalizeViewUp();
   camera->Elevation(-10.0);
   camera->Azimuth(55.0);
-  camera=0;
+
   // Setup lower right pane.
   vtkSmartPointer<vtkRenderer> ren2 = vtkSmartPointer<vtkRenderer>::New();
   ren2->SetViewport(0.5,0.0,1.0,0.5);
@@ -236,7 +236,7 @@ int TestQuadraturePoints(int argc,char *argv[])
   ren2->SetBackground(0.328125, 0.347656, 0.425781);
   ren2->AddActor(surfaceActor);
   ren2->ResetCamera();
-  camera=0;
+
   // If interactive mode then we show wireframes for
   // reference.
   if (testHelper->IsInteractiveModeSpecified())
diff --git a/Filters/Geometry/Testing/Cxx/TestStructuredGridConnectivity.cxx b/Filters/Geometry/Testing/Cxx/TestStructuredGridConnectivity.cxx
index 06c53a419a9..20852114982 100644
--- a/Filters/Geometry/Testing/Cxx/TestStructuredGridConnectivity.cxx
+++ b/Filters/Geometry/Testing/Cxx/TestStructuredGridConnectivity.cxx
@@ -708,8 +708,7 @@ bool CompareFieldsForGrid( vtkUniformGrid *grid )
           grid->GetCellData()->GetArray( "EXPECTED-CellXYZ" ) );
   assert( "pre: expectedCellData is NULL" && (expectedCellData != NULL) );
 
-  bool status = true;
-  status = CheckArrays( computedCellData, expectedCellData );
+  bool status = CheckArrays( computedCellData, expectedCellData );
   if( !status )
     {
     return status;
diff --git a/Filters/ParallelGeometry/Testing/Cxx/TestPUnstructuredGridConnectivity.cxx b/Filters/ParallelGeometry/Testing/Cxx/TestPUnstructuredGridConnectivity.cxx
index a59fccd89c8..56ac8748743 100644
--- a/Filters/ParallelGeometry/Testing/Cxx/TestPUnstructuredGridConnectivity.cxx
+++ b/Filters/ParallelGeometry/Testing/Cxx/TestPUnstructuredGridConnectivity.cxx
@@ -41,7 +41,6 @@
 int TestPUnstructuredGridConnectivity(int argc, char* argv[])
 {
   int rc             = 0;
-  double ellapsed    = 0.0;
   vtkTimerLog* timer = vtkTimerLog::New();
 
   // STEP 0: Initialize
@@ -64,7 +63,7 @@ int TestPUnstructuredGridConnectivity(int argc, char* argv[])
   timer->StartTimer();
   ghostGen->BuildGhostZoneConnectivity();
   timer->StopTimer();
-  ellapsed = timer->GetElapsedTime();
+  double ellapsed = timer->GetElapsedTime();
   vtkMPIUtilities::Printf(cntrl,"[DONE]\n");
 
   // get some performance statistics
diff --git a/Filters/ParallelMPI/Testing/Cxx/TestImplicitConnectivity.cxx b/Filters/ParallelMPI/Testing/Cxx/TestImplicitConnectivity.cxx
index 35edebf0d8a..de66b13264d 100644
--- a/Filters/ParallelMPI/Testing/Cxx/TestImplicitConnectivity.cxx
+++ b/Filters/ParallelMPI/Testing/Cxx/TestImplicitConnectivity.cxx
@@ -219,8 +219,7 @@ vtkMultiBlockDataSet* GetDataSet(
 //------------------------------------------------------------------------------
 double exponential_distribution(const int i, const double beta)
 {
-  double xi=0.0;
-  xi = ( ( exp( i*beta ) - 1 ) /( exp( beta ) - 1 ) );
+  double xi = ( ( exp( i*beta ) - 1 ) /( exp( beta ) - 1 ) );
   return( xi );
 }
 
diff --git a/Filters/StatisticsGnuR/vtkRInterface.cxx b/Filters/StatisticsGnuR/vtkRInterface.cxx
index 8b5951e7802..dfc19368bc0 100644
--- a/Filters/StatisticsGnuR/vtkRInterface.cxx
+++ b/Filters/StatisticsGnuR/vtkRInterface.cxx
@@ -119,14 +119,14 @@ public:
 #endif
 
     ParseStatus status;
-    SEXP cmdSexp, cmdexpr = R_NilValue;
     int error;
 
 
+    SEXP cmdSexp;
     PROTECT(cmdSexp = allocVector(STRSXP, 1));
     SET_STRING_ELT(cmdSexp, 0, mkChar(rcommand.c_str()));
 
-    cmdexpr = PROTECT(R_ParseVector(cmdSexp, -1, &status, R_NilValue));
+    SEXP cmdexpr = PROTECT(R_ParseVector(cmdSexp, -1, &status, R_NilValue));
     for(int i = 0; i < length(cmdexpr); i++)
       {
       R_tryEval(VECTOR_ELT(cmdexpr, i),NULL,&error);
@@ -227,15 +227,15 @@ int vtkRInterface::EvalRscript(const char *string, bool showRoutput)
 {
 
   ParseStatus status;
-  SEXP cmdSexp, cmdexpr = R_NilValue;
   SEXP ans;
   int i;
   int error;
 
+  SEXP cmdSexp;
   PROTECT(cmdSexp = allocVector(STRSXP, 1));
   SET_STRING_ELT(cmdSexp, 0, mkChar(string));
 
-  cmdexpr = PROTECT(R_ParseVector(cmdSexp, -1, &status, R_NilValue));
+  SEXP cmdexpr = PROTECT(R_ParseVector(cmdSexp, -1, &status, R_NilValue));
   switch (status)
     {
     case PARSE_OK:
diff --git a/IO/Export/vtkX3DExporter.cxx b/IO/Export/vtkX3DExporter.cxx
index 91fd4c920a4..50dbbf62613 100644
--- a/IO/Export/vtkX3DExporter.cxx
+++ b/IO/Export/vtkX3DExporter.cxx
@@ -637,7 +637,6 @@ void vtkX3DExporter::WriteATextActor2D(vtkActor2D *anTextActor2D,
 
   ta = static_cast<vtkTextActor*>(anTextActor2D);
   tp = ta->GetTextProperty();
-  ds = NULL;
   ds = ta->GetInput();
 
   if (ds==NULL)
diff --git a/IO/GDAL/vtkGDALRasterReader.cxx b/IO/GDAL/vtkGDALRasterReader.cxx
index abb445c79d3..5d122e6e017 100644
--- a/IO/GDAL/vtkGDALRasterReader.cxx
+++ b/IO/GDAL/vtkGDALRasterReader.cxx
@@ -357,21 +357,25 @@ void vtkGDALRasterReader::vtkGDALRasterReaderInternal::GenericReadData()
               static_cast<void*>(reinterpret_cast<GByte*>(&rawUniformGridData[0]) +
               0 * bandSpace), destWidth, destHeight,
               this->TargetDataType, pixelSpace, lineSpace);
+      assert(err == CE_None);
       err = greenBand->RasterIO(
               GF_Read, windowX, windowY,  windowWidth, windowHeight,
               static_cast<void*>(reinterpret_cast<GByte*>(&rawUniformGridData[0]) +
               1 * bandSpace), destWidth, destHeight,
               this->TargetDataType, pixelSpace, lineSpace);
+      assert(err == CE_None);
       err = blueBand->RasterIO(
               GF_Read, windowX, windowY,  windowWidth, windowHeight,
               static_cast<void*>(reinterpret_cast<GByte*>(&rawUniformGridData[0]) +
               2 * bandSpace), destWidth, destHeight,
               this->TargetDataType, pixelSpace, lineSpace);
+      assert(err == CE_None);
       err = alphaBand->RasterIO(
               GF_Read, windowX, windowY,  windowWidth, windowHeight,
               static_cast<void*>(reinterpret_cast<GByte*>(&rawUniformGridData[0]) +
               3 * bandSpace), destWidth, destHeight,
               this->TargetDataType, pixelSpace, lineSpace);
+      assert(err == CE_None);
       }
     else
       {
@@ -383,14 +387,17 @@ void vtkGDALRasterReader::vtkGDALRasterReaderInternal::GenericReadData()
               static_cast<void*>(reinterpret_cast<GByte*>(&rawUniformGridData[0]) +
               0 * bandSpace), destWidth, destHeight,
               this->TargetDataType, 0, 0);
+      assert(err == CE_None);
       err = greenBand->RasterIO(GF_Read, windowX, windowY,  windowWidth, windowHeight,
               static_cast<void*>(reinterpret_cast<GByte*>(&rawUniformGridData[0]) +
               1 * bandSpace), destWidth, destHeight,
               this->TargetDataType, 0,0);
+      assert(err == CE_None);
       err = blueBand->RasterIO(GF_Read, windowX, windowY,  windowWidth, windowHeight,
               static_cast<void*>(reinterpret_cast<GByte*>(&rawUniformGridData[0]) +
               2 * bandSpace), destWidth, destHeight,
               this->TargetDataType, 0,0);
+      assert(err == CE_None);
       }
     }
   else if (greyBand)
@@ -406,11 +413,13 @@ void vtkGDALRasterReader::vtkGDALRasterReaderInternal::GenericReadData()
               static_cast<void*>(reinterpret_cast<GByte*>(&rawUniformGridData[0]) +
               0 * bandSpace), destWidth, destHeight,
               this->TargetDataType, pixelSpace, lineSpace);
+      assert(err == CE_None);
       err =  alphaBand->RasterIO(
                GF_Read, windowX, windowY,  windowWidth, windowHeight,
                static_cast<void*>(reinterpret_cast<GByte*>(&rawUniformGridData[0]) +
                1 * bandSpace), destWidth, destHeight,
                this->TargetDataType, pixelSpace, lineSpace);
+      assert(err == CE_None);
       }
     else
       {
@@ -422,6 +431,7 @@ void vtkGDALRasterReader::vtkGDALRasterReaderInternal::GenericReadData()
               static_cast<void*>(reinterpret_cast<GByte*>(&rawUniformGridData[0]) +
               0 * bandSpace), destWidth, destHeight,
               this->TargetDataType, pixelSpace, lineSpace);
+      assert(err == CE_None);
       }
     }
   else
@@ -429,8 +439,7 @@ void vtkGDALRasterReader::vtkGDALRasterReaderInternal::GenericReadData()
     std::cerr << "Unknown raster band type \n";
     return;
     }
-  ((void)err);//unused
-  assert(err == CE_None);
+  (void)err; //unused
 
   const double* d = GetGeoCornerPoints();
   double geoSpacing[] = {(d[4]-d[0])/this->Reader->RasterDimensions[0],
diff --git a/IO/Geometry/Testing/Cxx/TestIncrementalOctreePointLocator.cxx b/IO/Geometry/Testing/Cxx/TestIncrementalOctreePointLocator.cxx
index 63ff25d123a..518908270be 100644
--- a/IO/Geometry/Testing/Cxx/TestIncrementalOctreePointLocator.cxx
+++ b/IO/Geometry/Testing/Cxx/TestIncrementalOctreePointLocator.cxx
@@ -147,7 +147,7 @@ int TestIncrementalOctreePointLocator( int argc, char * argv[] )
                                ( argc, argv, "Data/post.vtk" );
   ugReader = vtkUnstructuredGridReader::New();
   ugReader->SetFileName( fileName );
-  delete []  fileName;  fileName = NULL;
+  delete []  fileName;
   ugReader->Update();
   unstruct = ugReader->GetOutput();
   dataPnts = unstruct->GetPoints();
diff --git a/IO/Geometry/vtkCGMWriter.cxx b/IO/Geometry/vtkCGMWriter.cxx
index 5b4eb2b393a..828a9c32f2d 100644
--- a/IO/Geometry/vtkCGMWriter.cxx
+++ b/IO/Geometry/vtkCGMWriter.cxx
@@ -3001,14 +3001,13 @@ static int cgmImageColorAllocate(cgmImagePtr im, int r, int g, int b)
 #ifdef VTK_NOT_DEFINED
 static int cgmImageColor16(cgmImagePtr im)
 {
-  int si, ei, li;
-  si = cgmImageAddColorIndex(im, 255, 255, 255);
+  int si = cgmImageAddColorIndex(im, 255, 255, 255);
   if (si == -1)
     {
     return 0;
     }
-  li = -1; ei=si;
-  ei = cgmImageAddColorIndex(im, 0, 0, 0);
+  int li = -1;
+  int ei = cgmImageAddColorIndex(im, 0, 0, 0);
   if (ei != -1)
     {
     li = ei;
diff --git a/IO/Geometry/vtkTecplotReader.cxx b/IO/Geometry/vtkTecplotReader.cxx
index 7c275171856..8626ee8773b 100644
--- a/IO/Geometry/vtkTecplotReader.cxx
+++ b/IO/Geometry/vtkTecplotReader.cxx
@@ -1307,7 +1307,6 @@ void vtkTecplotReader::GetDataArraysList()
   int             guessedYid = -1;
   int             guessedZid = -1;
   bool            tokenReady = false;
-  std::string  theTpToken = "";
   std::string  noSpaceTok = "";
 
   this->Variables.clear();
@@ -1315,7 +1314,7 @@ void vtkTecplotReader::GetDataArraysList()
 
   this->Internal->Init();
   this->Internal->ASCIIStream.open( this->FileName );
-  theTpToken = this->Internal->GetNextToken();
+  std::string theTpToken = this->Internal->GetNextToken();
 
   while ( !this->Internal->NextCharEOF )
     {
diff --git a/IO/Import/vtkOBJImporterInternals.h b/IO/Import/vtkOBJImporterInternals.h
index cbf4fa3873f..8c4589b7d7e 100644
--- a/IO/Import/vtkOBJImporterInternals.h
+++ b/IO/Import/vtkOBJImporterInternals.h
@@ -81,9 +81,10 @@ public:
     TexturePath = std::string(arg);
     if(TexturePath.empty())
       return;
-    char sep    = '/';
 #if defined(_WIN32)
-    sep = '\\';
+    const char sep = '\\';
+#else
+    const char sep = '/';
 #endif
     if(TexturePath.at(TexturePath.size()-1) != sep )
       TexturePath += sep;
diff --git a/IO/Infovis/vtkXMLTreeReader.cxx b/IO/Infovis/vtkXMLTreeReader.cxx
index 42c7d5ddaf8..3ff34d130b0 100644
--- a/IO/Infovis/vtkXMLTreeReader.cxx
+++ b/IO/Infovis/vtkXMLTreeReader.cxx
@@ -108,8 +108,7 @@ static void vtkXMLTreeReaderProcessElement(vtkMutableDirectedGraph *tree,
       continue;
       }
 
-    vtkIdType vertex = -1;
-    vertex = tree->AddVertex();
+    vtkIdType vertex = tree->AddVertex();
     if (parent != -1)
       {
       tree->AddEdge(parent, vertex);
diff --git a/IO/MINC/vtkMINCImageReader.cxx b/IO/MINC/vtkMINCImageReader.cxx
index 54e9153f34d..1c2cd29a9e1 100644
--- a/IO/MINC/vtkMINCImageReader.cxx
+++ b/IO/MINC/vtkMINCImageReader.cxx
@@ -190,9 +190,8 @@ int vtkMINCImageReader::CanReadFile(const char* fname)
 
   // Do a more thorough check of the image:version attribute, since
   // there are lots of NetCDF files out there that aren't minc files.
-  int status = NC_NOERR;
   int ncid = 0;
-  status = nc_open(fname, 0, &ncid);
+  int status = nc_open(fname, 0, &ncid);
   if (status != NC_NOERR)
     {
     return 0;
diff --git a/IO/XML/Testing/Cxx/TestHyperOctreeIO.cxx b/IO/XML/Testing/Cxx/TestHyperOctreeIO.cxx
index 15a9816a2e0..6fcffb69198 100644
--- a/IO/XML/Testing/Cxx/TestHyperOctreeIO.cxx
+++ b/IO/XML/Testing/Cxx/TestHyperOctreeIO.cxx
@@ -344,14 +344,14 @@ int TestHyperOctreeIO(int argc, char* argv[])
   cam->Azimuth(180);
   renWin->Render();
 
-  int retVal = 1;
 #ifdef HYPEROCTREEIO_STANDALONE
+  int retVal = 1;
   if (interactive)
     {
     iren->Start();
     }
 #else
-  retVal = vtkRegressionTestImage( renWin );
+  int retVal = vtkRegressionTestImage( renWin );
   if ( retVal == vtkRegressionTester::DO_INTERACTOR )
     {
     iren->Start();
diff --git a/Infovis/Layout/vtkPerturbCoincidentVertices.cxx b/Infovis/Layout/vtkPerturbCoincidentVertices.cxx
index e47a6caf0d8..fea4a572dcc 100644
--- a/Infovis/Layout/vtkPerturbCoincidentVertices.cxx
+++ b/Infovis/Layout/vtkPerturbCoincidentVertices.cxx
@@ -153,12 +153,9 @@ void vtkPerturbCoincidentVertices::SpiralPerturbation(vtkGraph *input, vtkGraph
 
   double spiralPoint[3];
   double point[3];
-  //double distance = sqrt(vtkMath::Distance2BetweenPoints(point1, point2));
-  double scale = 1.0;
-  //scale = (distance * 1.4)/numPoints;
 
   // use the smallest metric to scale the spiral vertices.
-  scale = shortestEdge < averageDistance ? shortestEdge/4 : averageDistance/4;
+  double scale = shortestEdge < averageDistance ? shortestEdge/4 : averageDistance/4;
   vtkSmartPointer<vtkPoints> offsets = vtkSmartPointer<vtkPoints>::New();
 
   coincidentPoints->InitTraversal();
diff --git a/Rendering/Core/vtkPropAssembly.cxx b/Rendering/Core/vtkPropAssembly.cxx
index 70931910b77..96e432f6241 100644
--- a/Rendering/Core/vtkPropAssembly.cxx
+++ b/Rendering/Core/vtkPropAssembly.cxx
@@ -171,12 +171,11 @@ int vtkPropAssembly::RenderOpaqueGeometry(vtkViewport *ren)
   vtkAssemblyPath *path;
   double fraction;
   int   renderedSomething=0;
-  double numberOfItems = 0.0;
 
   // Make sure the paths are up-to-date
   this->UpdatePaths();
 
-  numberOfItems =  static_cast<double>(this->Parts->GetNumberOfItems());
+  double numberOfItems =  static_cast<double>(this->Parts->GetNumberOfItems());
   fraction = numberOfItems >= 1.0 ?
     this->AllocatedRenderTime / numberOfItems : this->AllocatedRenderTime;
 
@@ -204,12 +203,11 @@ int vtkPropAssembly::RenderOverlay(vtkViewport *ren)
   vtkAssemblyPath *path;
   double fraction;
   int   renderedSomething=0;
-  double numberOfItems = 0.0;
 
   // Make sure the paths are up-to-date
   this->UpdatePaths();
 
-  numberOfItems =  static_cast<double>(this->Parts->GetNumberOfItems());
+  double numberOfItems =  static_cast<double>(this->Parts->GetNumberOfItems());
   fraction = numberOfItems >= 1.0 ?
     this->AllocatedRenderTime / numberOfItems : this->AllocatedRenderTime;
 
diff --git a/Rendering/OpenGL/Testing/Cxx/TestFBOImplementation.cxx b/Rendering/OpenGL/Testing/Cxx/TestFBOImplementation.cxx
index 6777e878ac6..ae0c06ac75d 100644
--- a/Rendering/OpenGL/Testing/Cxx/TestFBOImplementation.cxx
+++ b/Rendering/OpenGL/Testing/Cxx/TestFBOImplementation.cxx
@@ -2196,9 +2196,8 @@ int main(int vtkNotUsed(argc), char *vtkNotUsed(argv)[])
   // extensions returned by the driver.
 
   // clean glError
-  GLenum errorCode=glGetError();
   glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA16,64,64,0, GL_RGBA, GL_FLOAT, NULL );
-  errorCode=glGetError();
+  GLenum errorCode=glGetError();
   if(errorCode!=GL_NO_ERROR)
     {
     cout << "Loading a power-of-two texture failed with the following error:"
diff --git a/Rendering/OpenGL/vtkScalarsToColorsPainter.cxx b/Rendering/OpenGL/vtkScalarsToColorsPainter.cxx
index 3b28ef167a8..c56c90a0548 100644
--- a/Rendering/OpenGL/vtkScalarsToColorsPainter.cxx
+++ b/Rendering/OpenGL/vtkScalarsToColorsPainter.cxx
@@ -627,7 +627,6 @@ void vtkScalarsToColorsPainter::MapScalars(vtkDataSet* output,
     }
 
   // Get rid of old colors.
-  colors = 0;
   orig_alpha = lut->GetAlpha();
   lut->SetAlpha(alpha);
   colors = lut->MapScalars(abstractScalars, this->ColorMode, arraycomponent);
diff --git a/Rendering/ParallelLIC/vtkParallelTimer.cxx b/Rendering/ParallelLIC/vtkParallelTimer.cxx
index 355a967c0b9..51b7ed5ee34 100644
--- a/Rendering/ParallelLIC/vtkParallelTimer.cxx
+++ b/Rendering/ParallelLIC/vtkParallelTimer.cxx
@@ -510,10 +510,9 @@ void vtkParallelTimer::StartEvent(const char *event)
   cerr << "=====vtkParallelTimer::StartEvent" << endl;
   #endif
 
-  double walls = 0.0;
   timeval wallt;
   gettimeofday(&wallt, 0x0);
-  walls = static_cast<double>(wallt.tv_sec)
+  double walls = static_cast<double>(wallt.tv_sec)
     + static_cast<double>(wallt.tv_usec)/1.0E6;
 
   #if vtkParallelTimerDEBUG < 0
@@ -544,10 +543,9 @@ void vtkParallelTimer::EndEvent(const char *event)
   cerr << "=====vtkParallelTimer::EndEvent" << endl;
   #endif
 
-  double walle = 0.0;
   timeval wallt;
   gettimeofday(&wallt, 0x0);
-  walle = static_cast<double>(wallt.tv_sec)
+  double walle = static_cast<double>(wallt.tv_sec)
     + static_cast<double>(wallt.tv_usec)/1.0E6;
 
   #if vtkParallelTimerDEBUG > 0
diff --git a/Rendering/Qt/vtkQtTreeRingLabelMapper.cxx b/Rendering/Qt/vtkQtTreeRingLabelMapper.cxx
index c447e88c246..1b6d9a891b8 100644
--- a/Rendering/Qt/vtkQtTreeRingLabelMapper.cxx
+++ b/Rendering/Qt/vtkQtTreeRingLabelMapper.cxx
@@ -523,7 +523,6 @@ bool vtkQtTreeRingLabelMapper::PointInWindow(double *sinfo, double *newDim,
   if( dc[1] < 0 || dc[1] > winSize[1] )
     return_value = false;
 
-  double height = 0., width = 0.;
   double xlc = sinfo[2] * cos( vtkMath::RadiansFromDegrees(sinfo[0]) );
   double xuc = sinfo[3] * cos( vtkMath::RadiansFromDegrees(sinfo[0]) );
   double ylc = sinfo[2] * sin( vtkMath::RadiansFromDegrees(sinfo[0]) );
@@ -536,10 +535,10 @@ bool vtkQtTreeRingLabelMapper::PointInWindow(double *sinfo, double *newDim,
   int *dc2 = VCoord->GetComputedDisplayValue(0);
   double dc2x = dc2[0];
   double dc2y = dc2[1];
-  height = sqrt( ((dc2x-dc1x)*(dc2x-dc1x)) + ((dc2y-dc1y)*(dc2y-dc1y)) );
+  double height = sqrt( ((dc2x-dc1x)*(dc2x-dc1x)) + ((dc2y-dc1y)*(dc2y-dc1y)) );
 
   double widthWC = r * vtkMath::RadiansFromDegrees( sinfo[1] - sinfo[0] );
-  width = widthWC * height / sqrt( (xuc-xlc)*(xuc-xlc) + (yuc-ylc)*(yuc-ylc) );
+  double width = widthWC * height / sqrt( (xuc-xlc)*(xuc-xlc) + (yuc-ylc)*(yuc-ylc) );
   newDim[0] = width;
   newDim[1] = height;
 
diff --git a/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx b/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx
index acc4f352ca7..0c74a199c32 100644
--- a/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx
+++ b/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx
@@ -583,10 +583,8 @@ bool vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::LoadVolume(
     {
     supportsFloat = true;
     }
-#else
-#if GL_ES_VERSION_3_0 == 1
+#elif GL_ES_VERSION_3_0 == 1
   supportsFloat = true;
-#endif
 #endif
 
   // scale and bias
diff --git a/Web/WebGLExporter/vtkWebGLWidget.cxx b/Web/WebGLExporter/vtkWebGLWidget.cxx
index 46322f5c5f6..6aa7fa3e1ff 100644
--- a/Web/WebGLExporter/vtkWebGLWidget.cxx
+++ b/Web/WebGLExporter/vtkWebGLWidget.cxx
@@ -62,8 +62,7 @@ int vtkWebGLWidget::GetBinarySize(int vtkNotUsed(part))
 void vtkWebGLWidget::GenerateBinaryData()
   {
   delete[] this->binaryData;
-  std::string oldMD5 = "qqehissorapaz";
-  oldMD5 = this->MD5;
+  std::string oldMD5 = this->MD5;
 
   size_t pos = 0;
   //Calculate the size used
diff --git a/Wrapping/Tools/vtkWrapJava.c b/Wrapping/Tools/vtkWrapJava.c
index 8f974b48319..9a75468bf90 100644
--- a/Wrapping/Tools/vtkWrapJava.c
+++ b/Wrapping/Tools/vtkWrapJava.c
@@ -1045,7 +1045,6 @@ int checkFunctionSignature(ClassInfo *data)
 void outputFunction(FILE *fp, ClassInfo *data)
 {
   int i;
-  int args_ok = 1;
   unsigned int rType =
     (currentFunction->ReturnType & VTK_PARSE_UNQUALIFIED_TYPE);
   const char *jniFunction = 0;
@@ -1054,7 +1053,7 @@ void outputFunction(FILE *fp, ClassInfo *data)
   size_t j;
   CurrentData = data;
 
-  args_ok = checkFunctionSignature(data);
+  int args_ok = checkFunctionSignature(data);
 
   /* handle DataReader SetBinaryInputString as a special case */
   if (!strcmp("SetBinaryInputString",currentFunction->Name) &&
-- 
GitLab