changeset 1990:f03a827f8b47

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 31 Oct 2022 21:05:49 +0100
parents e8b9a2ba1df1
children 892e407c1b15
files Applications/Resources/RunCppCheck.sh OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.cpp
diffstat 2 files changed, 28 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Resources/RunCppCheck.sh	Mon Oct 31 20:59:59 2022 +0100
+++ b/Applications/Resources/RunCppCheck.sh	Mon Oct 31 21:05:49 2022 +0100
@@ -30,12 +30,12 @@
 
 cat <<EOF > /tmp/cppcheck-suppressions.txt
 stlFindInsert:../../Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h
-stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:516
-stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:1159
+stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:519
+stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:1162
 unpreciseMathCall:../../OrthancStone/Sources/Scene2D/Internals/CairoFloatTextureRenderer.cpp
 unpreciseMathCall:../../OrthancStone/Sources/Scene2D/LookupTableTextureSceneLayer.cpp
-unreadVariable:../../OrthancStone/Sources/Viewport/SdlViewport.cpp:143
-unreadVariable:../../OrthancStone/Sources/Viewport/SdlViewport.cpp:197
+unreadVariable:../../OrthancStone/Sources/Viewport/SdlViewport.cpp:159
+unreadVariable:../../OrthancStone/Sources/Viewport/SdlViewport.cpp:213
 unusedFunction
 EOF
 
--- a/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.cpp	Mon Oct 31 20:59:59 2022 +0100
+++ b/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.cpp	Mon Oct 31 21:05:49 2022 +0100
@@ -1680,17 +1680,19 @@
       double y1 = handle1_.GetCenter().GetY();
       double x2 = handle2_.GetCenter().GetX();
       double y2 = handle2_.GetCenter().GetY();
-        
-      // Put the label to the right of the right-most handle
-      //const double y = std::min(y1, y2);
-      const double y = (y1 + y2) / 2.0;
-      if (x1 < x2)
+
       {
-        label_.SetPosition(x2, y);
-      }
-      else
-      {
-        label_.SetPosition(x1, y);
+        // Put the label to the right of the right-most handle
+        //const double y = std::min(y1, y2);
+        const double y = (y1 + y2) / 2.0;
+        if (x1 < x2)
+        {
+          label_.SetPosition(x2, y);
+        }
+        else
+        {
+          label_.SetPosition(x1, y);
+        }
       }
 
       std::string text;
@@ -1932,17 +1934,19 @@
       double y1 = handle1_.GetCenter().GetY();
       double x2 = handle2_.GetCenter().GetX();
       double y2 = handle2_.GetCenter().GetY();
-        
-      // Put the label to the right of the right-most handle
-      //const double y = std::min(y1, y2);
-      const double y = (y1 + y2) / 2.0;
-      if (x1 < x2)
+
       {
-        label_.SetPosition(x2, y);
-      }
-      else
-      {
-        label_.SetPosition(x1, y);
+        // Put the label to the right of the right-most handle
+        //const double y = std::min(y1, y2);
+        const double y = (y1 + y2) / 2.0;
+        if (x1 < x2)
+        {
+          label_.SetPosition(x2, y);
+        }
+        else
+        {
+          label_.SetPosition(x1, y);
+        }
       }
 
       std::string text;