• Sean McBride's avatar
    Fixed numerous warnings from the new cppcheck 1.81 · 442381f5
    Sean McBride authored
    Specifically:
    
    very strange braces!
    syntaxError,Common/DataModel/vtkHyperTreeGrid.cxx:699,error,syntax error
    
    changed size()>0 to !empty()
    stlSize,Filters/General/vtkLoopBooleanPolyDataFilter.cxx:1426,performance,Possible inefficient checking for 'nocellregion' emptiness.
    
    This useless flag has been there since code was added in 2000 in f50b0909
    knownConditionTrueFalse,Common/DataModel/vtkPointLocator.cxx:323,style,Condition 'flag' is always true
    knownConditionTrueFalse,Common/DataModel/vtkPointLocator.cxx:415,style,Condition 'flag' is always true
    knownConditionTrueFalse,Common/DataModel/vtkStaticPointLocator.cxx:788,style,Condition 'flag' is always true
    knownConditionTrueFalse,Common/DataModel/vtkStaticPointLocator.cxx:879,style,Condition 'flag' is always true
    
    This useless 'result' has been there since code was added in 2003 in dd39b9e4
    knownConditionTrueFalse,IO/XML/vtkXMLRectilinearGridReader.cxx:236,style,Condition 'result' is always true
    knownConditionTrueFalse,IO/XML/vtkXMLRectilinearGridReader.cxx:245,style,Condition 'result' is always true
    knownConditionTrueFalse,IO/XML/vtkXMLRectilinearGridReader.cxx:254,style,Condition 'result' is always true
    
    New check in cppcheck 1.81, block is indeed dead code:
    oppositeInnerCondition,Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx:272,warning,Opposite inner 'if' condition leads to a dead code block.
    oppositeInnerCondition,Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx:293,warning,Opposite inner 'if' condition leads to a dead code block.
    oppositeInnerCondition,Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx:349,warning,Opposite inner 'if' condition leads to a dead code block.
    
    false positive, suppressed with zero initialization:
    uninitvar,Filters/Statistics/vtkKMeansStatistics.cxx:810,error,Uninitialized variable: curDistance
    uninitvar,Filters/Statistics/vtkKMeansStatistics.cxx:812,error,Uninitialized variable: curDistance
    
    free(NULL) is allowed, so just remove null check
    knownConditionTrueFalse,IO/Geometry/Testing/Cxx/TestIncrementalOctreePointLocator.cxx:920,style,Condition 'truthIds' is always false
    knownConditionTrueFalse,IO/Geometry/Testing/Cxx/TestIncrementalOctreePointLocator.cxx:956,style,Condition 'diskFile' is always false
    
    Simplified the calculation, verified same codegen on x86_64 with godbolt
    shiftTooManyBitsSigned,Rendering/Volume/vtkHAVSVolumeMapper.cxx:53,error,Shifting signed 32-bit value by 31 bits is undefined behaviour
    
    These have all been thus since their inception, but a global search find the same pattern in TestDijkstraGraphGeodesicPath.cxx, from which I copied the apparent solution
    knownConditionTrueFalse,Interaction/Widgets/Testing/Cxx/TestPolygonalRepresentationHandleWidget.cxx:119,style,Condition 'distanceOffsetSpecified' is always false
    knownConditionTrueFalse,Interaction/Widgets/Testing/Cxx/TestPolygonalRepresentationHandleWidget.cxx:199,style,Condition 'distanceOffsetSpecified' is always false
    knownConditionTrueFalse,Interaction/Widgets/Testing/Cxx/TestPolygonalSurfaceConstrainedDistanceWidget.cxx:244,style,Condition 'distanceOffsetSpecified' is always false
    knownConditionTrueFalse,Interaction/Widgets/Testing/Cxx/TestPolygonalSurfaceConstrainedDistanceWidget.cxx:325,style,Condition 'distanceOffsetSpecified' is always false
    knownConditionTrueFalse,Interaction/Widgets/Testing/Cxx/TestSurfaceConstrainedHandleWidget.cxx:117,style,Condition 'distanceOffsetSpecified' is always false
    knownConditionTrueFalse,Interaction/Widgets/Testing/Cxx/TestSurfaceConstrainedHandleWidget.cxx:189,style,Condition 'distanceOffsetSpecified' is always false
    
    Toggle with #if instead
    knownConditionTrueFalse,Imaging/Hybrid/vtkSurfaceReconstructionFilter.cxx:300,style,Condition 'orientationPropagation' is always true
    
    Added parens
    clarifyCalculation,Common/DataModel/vtkLagrangeWedge.cxx:906,style,Clarify calculation precedence for '/' and '?'.
    442381f5
Name
Last commit
Last update
..
Testing Loading commit data...
CMakeLists.txt Loading commit data...
module.cmake Loading commit data...
vtkBooleanTexture.cxx Loading commit data...
vtkBooleanTexture.h Loading commit data...
vtkCheckerboardSplatter.cxx Loading commit data...
vtkCheckerboardSplatter.h Loading commit data...
vtkFastSplatter.cxx Loading commit data...
vtkFastSplatter.h Loading commit data...
vtkGaussianSplatter.cxx Loading commit data...
vtkGaussianSplatter.h Loading commit data...
vtkImageCursor3D.cxx Loading commit data...
vtkImageCursor3D.h Loading commit data...
vtkImageRectilinearWipe.cxx Loading commit data...
vtkImageRectilinearWipe.h Loading commit data...
vtkImageToPoints.cxx Loading commit data...
vtkImageToPoints.h Loading commit data...
vtkPointLoad.cxx Loading commit data...
vtkPointLoad.h Loading commit data...
vtkSampleFunction.cxx Loading commit data...
vtkSampleFunction.h Loading commit data...
vtkShepardMethod.cxx Loading commit data...
vtkShepardMethod.h Loading commit data...
vtkSliceCubes.cxx Loading commit data...
vtkSliceCubes.h Loading commit data...
vtkSurfaceReconstructionFilter.cxx Loading commit data...
vtkSurfaceReconstructionFilter.h Loading commit data...
vtkTriangularTexture.cxx Loading commit data...
vtkTriangularTexture.h Loading commit data...
vtkVoxelModeller.cxx Loading commit data...
vtkVoxelModeller.h Loading commit data...