diff OrthancFramework/Sources/Images/ImageProcessing.cpp @ 4201:2d5209153b32

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Sep 2020 08:18:28 +0200
parents bf7b9edf6b81
children 9279de56a405
line wrap: on
line diff
--- a/OrthancFramework/Sources/Images/ImageProcessing.cpp	Wed Sep 16 20:53:31 2020 +0200
+++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp	Thu Sep 17 08:18:28 2020 +0200
@@ -418,7 +418,7 @@
     for (unsigned int y = 0; y < height; y++)
     {
       TargetType* p = reinterpret_cast<TargetType*>(target.GetRow(y));
-      const SourceType* q = reinterpret_cast<const SourceType*>(source.GetRow(y));
+      const SourceType* q = reinterpret_cast<const SourceType*>(source.GetConstRow(y));
 
       for (unsigned int x = 0; x < width; x++, p++, q++)
       {
@@ -1860,15 +1860,15 @@
 
     std::vector<int32_t> nodeX;
     nodeX.resize(cpSize);
-    int  nodes, pixelX, pixelY, i, j, swap ;
+    int  pixelX, pixelY, i, swap ;
 
     //  Loop through the rows of the image.
     for (pixelY = top; pixelY < bottom; pixelY++)
     {
       double y = (double)pixelY;
       //  Build a list of nodes.
-      nodes = 0;
-      j = static_cast<int>(cpSize) - 1;
+      int nodes = 0;
+      int j = static_cast<int>(cpSize) - 1;
 
       for (i = 0; i < static_cast<int>(cpSize); i++)
       {
@@ -2047,7 +2047,7 @@
   void ImageProcessing::Resize(ImageAccessor& target,
                                const ImageAccessor& source)
   {
-    if (source.GetFormat() != source.GetFormat())
+    if (source.GetFormat() != target.GetFormat())
     {
       throw OrthancException(ErrorCode_IncompatibleImageFormat);
     }