changeset 4889:d8c8274d4e41

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 19 Feb 2022 12:17:41 +0100
parents 8523078f3f4b
children 6d4e8d90ca02
files OrthancFramework/Sources/Images/ImageProcessing.cpp OrthancServer/Resources/RunCppCheck.sh
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/Images/ImageProcessing.cpp	Fri Feb 18 15:45:28 2022 +0100
+++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp	Sat Feb 19 12:17:41 2022 +0100
@@ -2059,14 +2059,16 @@
     if (onlyHorizontalSegments)
     {
       // Degenerate case: There are only horizontal lines. If this is
-      // the case, "GetPolygonPreviousY()" will be an infinite loop
+      // the case, "GetPolygonPreviousY()" would be an infinite loop
       int x1 = points[0].GetX();
-      int x2 = points[0].GetX();
+      int x2 = x1;
       for (size_t i = 1; i < points.size(); i++)
       {
         assert(points[i].GetY() == points[0].GetY());
-        x1 = std::min(x1, points[i].GetX());
-        x2 = std::max(x2, points[i].GetX());
+
+        const int x = points[i].GetX();
+        x1 = std::min(x1, x);
+        x2 = std::max(x2, x);
       }
       filler.Fill(points[0].GetY(), x1, x2);
       return;
--- a/OrthancServer/Resources/RunCppCheck.sh	Fri Feb 18 15:45:28 2022 +0100
+++ b/OrthancServer/Resources/RunCppCheck.sh	Sat Feb 19 12:17:41 2022 +0100
@@ -26,7 +26,7 @@
 syntaxError:../../OrthancServer/UnitTestsSources/UnitTestsMain.cpp:322
 uninitMemberVar:../../OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp:428
 unreadVariable:../../OrthancFramework/Sources/FileStorage/StorageAccessor.cpp
-unreadVariable:../../OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp:1125
+unreadVariable:../../OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp:1127
 unusedFunction
 useInitializationList:../../OrthancFramework/Sources/Images/PngReader.cpp:90
 useInitializationList:../../OrthancFramework/Sources/Images/PngWriter.cpp:98