changeset 1817:385c268e8b56

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 May 2021 19:51:45 +0200
parents dccdc7e59929
children 101e7e0079d5
files Applications/Resources/RunCppCheck.sh OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.cpp OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h OrthancStone/Sources/Scene2D/CopyStyleConfigurator.h OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp
diffstat 5 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Resources/RunCppCheck.sh	Tue May 25 19:30:37 2021 +0200
+++ b/Applications/Resources/RunCppCheck.sh	Tue May 25 19:51:45 2021 +0200
@@ -29,8 +29,8 @@
 
 cat <<EOF > /tmp/cppcheck-suppressions.txt
 stlFindInsert:../../Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h
-stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:374
-stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:969
+stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:387
+stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:982
 unpreciseMathCall:../../OrthancStone/Sources/Scene2D/Internals/CairoFloatTextureRenderer.cpp
 unpreciseMathCall:../../OrthancStone/Sources/Scene2D/LookupTableTextureSceneLayer.cpp
 unreadVariable:../../OrthancStone/Sources/Viewport/SdlViewport.cpp:143
--- a/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.cpp	Tue May 25 19:30:37 2021 +0200
+++ b/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.cpp	Tue May 25 19:51:45 2021 +0200
@@ -158,7 +158,7 @@
     GeometricPrimitives     primitives_;
       
   public:
-    Annotation(AnnotationsSceneLayer& that) :
+    explicit Annotation(AnnotationsSceneLayer& that) :
       that_(that)
     {
       that.AddAnnotation(this);
@@ -612,7 +612,8 @@
          Annotation& parentAnnotation) :
       GeometricPrimitive(parentAnnotation, 2),
       that_(that),
-      first_(true)
+      first_(true),
+      subLayer_(0)  // dummy initialization
     {
     }
 
--- a/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h	Tue May 25 19:30:37 2021 +0200
+++ b/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h	Tue May 25 19:51:45 2021 +0200
@@ -81,7 +81,7 @@
     void TagSubLayerToRemove(size_t subLayerIndex);
     
   public:
-    AnnotationsSceneLayer(size_t macroLayerIndex);
+    explicit AnnotationsSceneLayer(size_t macroLayerIndex);
     
     ~AnnotationsSceneLayer()
     {
--- a/OrthancStone/Sources/Scene2D/CopyStyleConfigurator.h	Tue May 25 19:30:37 2021 +0200
+++ b/OrthancStone/Sources/Scene2D/CopyStyleConfigurator.h	Tue May 25 19:51:45 2021 +0200
@@ -29,20 +29,22 @@
   class CopyStyleConfigurator : public ILayerStyleConfigurator
   {
   public:
-    virtual uint64_t GetRevision() const
+    virtual uint64_t GetRevision() const ORTHANC_OVERRIDE
     {
       return 0; // No parameter for this type of configurator
     }
     
-    virtual TextureBaseSceneLayer* CreateTextureFromImage(const Orthanc::ImageAccessor& image) const;
+    virtual TextureBaseSceneLayer* CreateTextureFromImage(
+      const Orthanc::ImageAccessor& image) const ORTHANC_OVERRIDE;
 
-    virtual TextureBaseSceneLayer* CreateTextureFromDicom(const Orthanc::ImageAccessor& frame,
-                                                          const DicomInstanceParameters& parameters) const
+    virtual TextureBaseSceneLayer* CreateTextureFromDicom(
+      const Orthanc::ImageAccessor& frame,
+      const DicomInstanceParameters& parameters) const ORTHANC_OVERRIDE
     {
       return CreateTextureFromImage(frame);
     }
 
-    virtual void ApplyStyle(ISceneLayer& layer) const
+    virtual void ApplyStyle(ISceneLayer& layer) const ORTHANC_OVERRIDE
     {
     }
   };
--- a/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp	Tue May 25 19:30:37 2021 +0200
+++ b/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp	Tue May 25 19:51:45 2021 +0200
@@ -147,9 +147,11 @@
         if (frameOffsets_.size() >= 2)
         {
           double sliceThickness = frameOffsets_[1] - frameOffsets_[0];
-          bool sameSized = true;
+          
           if (sliceThickness > 0)
           {
+            bool sameSized = true;
+            
             for (size_t i = 2; i < frameOffsets_.size(); ++i)
             {
               double currentThickness = frameOffsets_[i] - frameOffsets_[i-1];
@@ -160,6 +162,7 @@
                 break;
               }
             }
+            
             if (sameSized)
             {
               sliceThickness_ = sliceThickness;