changeset 2149:acc9c70bc25a

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 31 Aug 2024 07:28:51 +0200
parents bea4e7900a47
children caa397372d86 02a06434833c
files Applications/Resources/RunCppCheck.sh Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp OrthancStone/Sources/Toolbox/DicomStructuredReport.cpp OrthancStone/Sources/Toolbox/DicomStructuredReport.h
diffstat 4 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Resources/RunCppCheck.sh	Mon Aug 26 17:59:20 2024 +0200
+++ b/Applications/Resources/RunCppCheck.sh	Sat Aug 31 07:28:51 2024 +0200
@@ -29,10 +29,12 @@
 fi
 
 cat <<EOF > /tmp/cppcheck-suppressions.txt
+assertWithSideEffect:../../OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.cpp:341
+assertWithSideEffect:../../OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.cpp:342
 constParameter:../../RenderingPlugin/Sources/Plugin.cpp:778
 stlFindInsert:../../Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h
-stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:1166
-stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:523
+stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:1245
+stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:601
 unpreciseMathCall:../../OrthancStone/Sources/Scene2D/Internals/CairoFloatTextureRenderer.cpp
 unpreciseMathCall:../../OrthancStone/Sources/Scene2D/LookupTableTextureSceneLayer.cpp
 unreadVariable:../../OrthancStone/Sources/Platforms/Sdl/SdlViewport.cpp:159
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Mon Aug 26 17:59:20 2024 +0200
+++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Sat Aug 31 07:28:51 2024 +0200
@@ -239,7 +239,7 @@
   std::unique_ptr<OrthancStone::SortedFrames>  frames_;
 
 public:
-  SortedFramesCollection(OrthancStone::SortedFrames* frames)
+  explicit SortedFramesCollection(OrthancStone::SortedFrames* frames)
   {
     if (frames == NULL)
     {
--- a/OrthancStone/Sources/Toolbox/DicomStructuredReport.cpp	Mon Aug 26 17:59:20 2024 +0200
+++ b/OrthancStone/Sources/Toolbox/DicomStructuredReport.cpp	Sat Aug 31 07:28:51 2024 +0200
@@ -135,7 +135,9 @@
   DicomStructuredReport::Structure::Structure(const std::string& sopInstanceUid) :
     sopInstanceUid_(sopInstanceUid),
     hasFrameNumber_(false),
-    hasProbabilityOfCancer_(false)
+    frameNumber_(0),         // dummy initialization
+    hasProbabilityOfCancer_(false),
+    probabilityOfCancer_(0)  // dummy initialization
   {
   }
 
@@ -478,7 +480,7 @@
                       {
                         uint32_t frame;
                         if (!Orthanc::SerializationToolbox::ParseUnsignedInteger32(frame, tokens[m]) ||
-                            frame <= 0)
+                            frame == 0)
                         {
                           throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
                         }
--- a/OrthancStone/Sources/Toolbox/DicomStructuredReport.h	Mon Aug 26 17:59:20 2024 +0200
+++ b/OrthancStone/Sources/Toolbox/DicomStructuredReport.h	Sat Aug 31 07:28:51 2024 +0200
@@ -64,7 +64,7 @@
       void Copy(const Structure& other);
 
     public:
-      Structure(const std::string& sopInstanceUid);
+      explicit Structure(const std::string& sopInstanceUid);
 
       virtual ~Structure()
       {
@@ -262,9 +262,9 @@
       }
     };
 
-    DicomStructuredReport(Orthanc::ParsedDicomFile& dicom);
+    explicit DicomStructuredReport(Orthanc::ParsedDicomFile& dicom);
 
-    DicomStructuredReport(const DicomStructuredReport& other);  // Copy constructor
+    explicit DicomStructuredReport(const DicomStructuredReport& other);  // Copy constructor
 
     ~DicomStructuredReport();