bmeaut / grainautline

GrainAutLine: image processing for geology and material sciences
GNU General Public License v3.0
0 stars 2 forks source link

cppcheck errors #21

Closed szotsaki closed 8 years ago

szotsaki commented 9 years ago

cppcheck gave the following warnings:

[GrainAutLine/GrainAutLine/Layers/ShowBlobsLayer.cpp:12]: (warning) Member variable 'ShowBlobsLayer::lastHighlightedBlobIdx' is not initialized in the constructor.
[MarbleCommon/UnitTests/AllTestLauncher.h:74]: (style) Class 'Test<AdtsProcessorTest>' has a constructor with 1 argument that is not explicit.
[MarbleCommon/UnitTests/AllTestLauncher.h:74]: (style) Class 'Test<AddSubAuxProcessorTest>' has a constructor with 1 argument that is not explicit.
[MarbleCommon/UnitTests/AllTestLauncher.h:74]: (style) Class 'Test<CurveTest>' has a constructor with 1 argument that is not explicit.
[MarbleCommon/UnitTests/AllTestLauncher.h:74]: (style) Class 'Test<AutoCutProcessorTestWithAStar>' has a constructor with 1 argument that is not explicit.
[MarbleCommon/UnitTests/AllTestLauncher.h:74]: (style) Class 'Test<BlobMergerTest>' has a constructor with 1 argument that is not explicit.
[MarbleCommon/UnitTests/AllTestLauncher.h:74]: (style) Class 'Test<AutoCutProcessorTestWithBFS>' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Processors/AdtsProcessor.h:19]: (style) Class 'AdtsProcessor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/UnitTests/AllTestLauncher.h:74]: (style) Class 'Test<CcAuxBorderProcessorTest>' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Processors/AuxDrawerProcessor.h:16]: (style) Class 'AuxDrawerProcessor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Processors/AuxMorphologyProcessor.h:20]: (style) Class 'AuxMorphologyProcessor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Processors/FillHolesProcessor.h:10]: (style) Class 'FillHolesProcessor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Processors/BlobMergerProcessor.h:23]: (style) Class 'BlobMergerProcessor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/ConnectedComponents.h:17]: (style) Class 'ConnectedComponents' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Blob.h:25]: (style) Class 'Blob' has a constructor with 1 argument that is not explicit.
[MarbleCommon/OverlapCounter.h:9]: (style) Class 'OverlapCounter' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobContainer.h:22]: (style) Class 'BlobContainer' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/Blob2.cpp:528]: (style) The scope of the variable 'y' can be reduced.
[MarbleCommon/BlobsAndCurves/Blob2.cpp:528]: (style) The scope of the variable 'x0' can be reduced.
[MarbleCommon/BlobsAndCurves/Blob2.cpp:528]: (style) The scope of the variable 'x1' can be reduced.
[MarbleCommon/BlobsAndCurves/Blob2Container.h:79]: (style) 'Blob2Container::operator=' should return 'Blob2Container &'.
[MarbleCommon/BlobsAndCurves/Blob2.h:47]: (style) Class 'HLine' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/Blob2.h:108]: (style) Class 'Blob2' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/Blob2.h:114]: (style) Class 'Blob2' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/Blob2Container.h:21]: (style) Class 'Blob2Container' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/Blob2.h:261]: (style) Unused private function: 'Blob2SortedBuilder::GetBuilderFromRect'
[MarbleCommon/BlobsAndCurves/Blob2.cpp:144]: (performance) Variable 'hlines' is assigned in constructor body. Consider performing initialization in initialization list.
[MarbleCommon/BlobContainer.cpp:22]: (warning) Member variable 'BlobContainer::defaultFactory' is not initialized in the constructor.
[MarbleCommon/BlobContainer.cpp:397]: (warning) Member variable 'BlobContainer::defaultFactory' is not assigned a value in 'BlobContainer::operator='.
[MarbleCommon/BlobsAndCurves/Curve.cpp:8]: (performance) Variable 'points' is assigned in constructor body. Consider performing initialization in initialization list.
[MarbleCommon/BlobsAndCurves/Curve.h:16]: (style) Class 'Curve' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/Blob2.cpp:245]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[MarbleCommon/BlobsAndCurves/Blob2.cpp:252]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[MarbleCommon/BlobsAndCurves/Blob2.cpp:262]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[MarbleCommon/BlobsAndCurves/Blob2.cpp:268]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[MarbleCommon/BlobsAndCurves/MinimalIndexer.h:12]: (style) Class 'MinimalIndexer' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/ProcessingStateDescriptor.h:12]: (style) Class 'ProcessingStateDescriptor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/ProcessingStateDescriptor.h:15]: (style) Class 'ProcessingStateDescriptor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/ProcessingStateDescriptor.h:65]: (performance) Function parameter 'filename' should be passed by reference.
[MarbleCommon/BlobsAndCurves/ProcessingStateDescriptor.cpp:15]: (warning) Member variable 'ProcessingStateDescriptor::IsSelectionDirty' is not initialized in the constructor.
[MarbleCommon/BlobsAndCurves/ProcessingStateDescriptor.cpp:162]: (performance) Function parameter 'filename' should be passed by reference.
[MarbleCommon/MinCutFinder/FlowFinder.h:43]: (style) Class 'FlowFinder' has a constructor with 1 argument that is not explicit.
[MarbleCommon/MinCutFinder/AStar.h:11]: (style) Class 'AStar' has a constructor with 1 argument that is not explicit.
[MarbleCommon/MinCutFinder/BFS.h:11]: (style) Class 'BFS' has a constructor with 1 argument that is not explicit.
[MarbleCommon/MarbleDrawStateDescriptor.cpp:24]: (style) Unused variable: line
[MarbleCommon/MarbleDrawStateDescriptor.h:14]: (style) Class 'MarbleDrawStateDescriptor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Processors/AddSubAuxProcessor.h:24]: (style) Class 'AddSubAuxProcessor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Processors/AutoCutProcessor.h:15]: (style) Class 'AutoCutProcessor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Processors/CcAuxBorderProcessor.h:19]: (style) Class 'CcAuxBorderProcessor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/OverlapIndexer.h:13]: (style) Class 'OverlapIndexer' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Skeleton/Local3x3Matcher.h:27]: (style) Class 'Local3x3Matcher' has a constructor with 1 argument that is not explicit.
[MarbleCommon/Skeleton/Local3x3Matcher.cpp:74]: (performance) Function parameter 'filenamePrefix' should be passed by reference.
[MarbleCommon/Processors/ShowImageProcessor.cpp:50]: (warning) Return value of std::remove() ignored. Elements remain in container.
[MarbleCommon/OverlapIndexer.cpp:36]: (performance) Possible inefficient checking for 'overlapMap' emptiness.
[MarbleCommon/OverlapIndexer.cpp:44]: (performance) Possible inefficient checking for 'overlapMap' emptiness.
[MarbleCommon/OverlapIndexer.cpp:89]: (performance) Possible inefficient checking for 'overlapMap' emptiness.
[MarbleCommon/Processors/SkeletonProcessor.h:11]: (style) Class 'SkeletonProcessor' has a constructor with 1 argument that is not explicit.
[MarbleCommon/UnitTests/AllTestLauncher.h:74]: (style) Class 'Test' has a constructor with 1 argument that is not explicit.
[TestMarbleCommon/TestBlob.cpp:16] -> [TestMarbleCommon/TestBlob.cpp:17]: (performance) Variable 'area' is reassigned a value before the old one has been used.

And the following functions are unused (maybe these are required anyhow):

[MarbleCommon/Skeleton/LocalMatcher.cpp:138]: (style) The function 'ApplyOnDelta' is never used.
[MarbleCommon/Skeleton/LocalMatcher.cpp:167]: (style) The function 'ApplyWithDecisionOnSignum' is never used.
[MarbleCommon/BlobsAndCurves/ProcessingStateDescriptor.cpp:180]: (style) The function 'CreateFromImage' is never used.
[MarbleCommon/misc.cpp:111]: (style) The function 'Csv2FloatVector' is never used.
[MarbleCommon/Blob.cpp:55]: (style) The function 'FilteredCopy' is never used.
[MarbleCommon/Blob.cpp:70]: (style) The function 'ForEachInBoundingBox' is never used.
[TestMarbleCommon/TestBlob2Basics.cpp:14]: (style) The function 'GetBlobA' is never used.
[MarbleCommon/BlobsAndCurves/Blob2.cpp:576]: (style) The function 'GetBuilderFromRect' is never used.
[MarbleCommon/HierarchicCannySegmenter.cpp:65]: (style) The function 'GetFirstChildIdx' is never used.
[MarbleCommon/HierarchicCannySegmenter.cpp:53]: (style) The function 'GetNextIdx' is never used.
[MarbleCommon/HierarchicCannySegmenter.cpp:71]: (style) The function 'GetParentIdx' is never used.
[MarbleCommon/HierarchicCannySegmenter.cpp:59]: (style) The function 'GetPrevIdx' is never used.
[MarbleCommon/misc.cpp:156]: (style) The function 'IsInside' is never used.
[MarbleCommon/Skeleton/Local3x3Matcher.cpp:74]: (style) The function 'SavePatternsToFiles' is never used.
[MarbleCommon/BlobContainer.cpp:176]: (style) The function 'collectClosedZeroBlob' is never used.
[MarbleCommon/MinCutFinder/GraphOfPixels.cpp:220]: (style) The function 'copyStateMatrix' is never used.
[MarbleCommon/BlobContainer.cpp:164]: (style) The function 'createDilatedOverlapCounter' is never used.
[MarbleCommon/Blob.cpp:608]: (style) The function 'getBottomRightPointOrDefault' is never used.
[MarbleCommon/misc.cpp:30]: (style) The function 'getDistance' is never used.
[MarbleCommon/Neighbourhood.cpp:6]: (style) The function 'getNeighbourhoodCode' is never used.
[MarbleCommon/Blob.cpp:139]: (style) The function 'incrementPixels' is never used.
[MarbleCommon/Neighbourhood.cpp:131]: (style) The function 'isCompatibleInLine' is never used.
csorbakristof commented 9 years ago

Warnings fixed. Unused functions preserved for later use, as we are developing a framework for long term use. (And sometimes we implement more than what is needed that time.)

szotsaki commented 9 years ago

New batch of warnings:

[MarbleCommon/BlobContainer.cpp:22]: (warning) Member variable 'BlobContainer::defaultFactory' is not initialized in the constructor.
[MarbleCommon/BlobsAndCurves/Blob2.h:274]: (style) Unused private function: 'Blob2SortedBuilder::GetBuilderFromRect'
[MarbleCommon/ColorChooser.cpp:34]: (style) The scope of the variable 'iI' can be reduced.
[MarbleCommon/ColorChooser.cpp:35]: (style) The scope of the variable 'fI' can be reduced.
[MarbleCommon/ColorChooser.cpp:35]: (style) The scope of the variable 'fF' can be reduced.
[MarbleCommon/ColorChooser.cpp:35]: (style) The scope of the variable 'p' can be reduced.
[MarbleCommon/ColorChooser.cpp:35]: (style) The scope of the variable 'q' can be reduced.
[MarbleCommon/ColorChooser.cpp:35]: (style) The scope of the variable 't' can be reduced.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.cpp:13]: (warning) Member variable 'SuperBlobContainer::lastChanged' is not initialized in the constructor.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.h:40]: (performance) Variable 'neighbourhoodVector' is assigned in constructor body. Consider performing initialization in initialization list.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.cpp:15]: (performance) Variable 'superBlobIndices' is assigned in constructor body. Consider performing initialization in initialization list.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.cpp:22]: (performance) Variable 'neighbourhood' is assigned in constructor body. Consider performing initialization in initialization list.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.cpp:28]: (performance) Variable 'neighbourhood' is assigned in constructor body. Consider performing initialization in initialization list.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.h:42]: (style) Class 'NeighbourhoodContainer' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.h:131]: (style) Class 'SuperBlobContainer' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.h:133]: (style) Class 'SuperBlobContainer' has a constructor with 1 argument that is not explicit.
[MarbleCommon/MinCutFinder/BFS.h:8]: (information) The code 'class WIN_DLL_DECLSPEC BFS :' is not handled. You can use -I or --include to add handling of this code.
[SandboxKristof/SandboxKristof/main.cpp:84]: (style) The scope of the variable 'sum' can be reduced.
[SandboxKristof/SandboxKristof/main.cpp:86]: (style) The scope of the variable 'curveLength' can be reduced.
[TestMarbleCommon/TestBlob.cpp:16] -> [TestMarbleCommon/TestBlob.cpp:17]: (performance) Variable 'area' is reassigned a value before the old one has been used.
szotsaki commented 8 years ago

Current status:

[MarbleCommon/ColorChooser.cpp:34]: (style) The scope of the variable 'iI' can be reduced.
[MarbleCommon/ColorChooser.cpp:35]: (style) The scope of the variable 'fI' can be reduced.
[MarbleCommon/ColorChooser.cpp:35]: (style) The scope of the variable 'fF' can be reduced.
[MarbleCommon/ColorChooser.cpp:35]: (style) The scope of the variable 'p' can be reduced.
[MarbleCommon/ColorChooser.cpp:35]: (style) The scope of the variable 'q' can be reduced.
[MarbleCommon/ColorChooser.cpp:35]: (style) The scope of the variable 't' can be reduced.
[MarbleCommon/BlobsAndCurves/Blob2.h:274]: (style) Unused private function: 'Blob2SortedBuilder::GetBuilderFromRect'
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.cpp:13]: (warning) Member variable 'SuperBlobContainer::lastChanged' is not initialized in the constructor.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.h:40]: (performance) Variable 'neighbourhoodVector' is assigned in constructor body. Consider performing initialization in initialization list.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.cpp:15]: (performance) Variable 'superBlobIndices' is assigned in constructor body. Consider performing initialization in initialization list.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.cpp:22]: (performance) Variable 'neighbourhood' is assigned in constructor body. Consider performing initialization in initialization list.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.cpp:28]: (performance) Variable 'neighbourhood' is assigned in constructor body. Consider performing initialization in initialization list.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.h:42]: (style) Class 'NeighbourhoodContainer' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.h:131]: (style) Class 'SuperBlobContainer' has a constructor with 1 argument that is not explicit.
[MarbleCommon/BlobsAndCurves/SuperBlobContainer.h:133]: (style) Class 'SuperBlobContainer' has a constructor with 1 argument that is not explicit.
[MarbleCommon/MinCutFinder/BFS.h:8]: (information) The code 'class BFS :' is not handled. You can use -I or --include to add handling of this code.
[SandboxKristof/SandboxKristof/main.cpp:84]: (style) The scope of the variable 'sum' can be reduced.
[SandboxKristof/SandboxKristof/main.cpp:86]: (style) The scope of the variable 'curveLength' can be reduced.
[TestMarbleCommon/TestBlob.cpp:16] -> [TestMarbleCommon/TestBlob.cpp:17]: (performance) Variable 'area' is reassigned a value before the old one has been used.
csorbakristof commented 8 years ago

Fixed. Some (SuperBlobContainer) moved to Adam Budai. TestMarbleCommon is an old, MSCV based test project. Content will be moved to the Qt environment later.