[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [digikam] core/libs/dimg/filters/nr: fix clang warnings
From:       Gilles Caulier <null () kde ! org>
Date:       2018-09-27 14:45:29
Message-ID: E1g5XXl-0007Bg-ES () code ! kde ! org
[Download RAW message or body]

Git commit 93627c420dfd96d390acd49198521de266253a0a by Gilles Caulier.
Committed on 27/09/2018 at 14:45.
Pushed by cgilles into branch 'master'.

fix clang warnings

M  +29   -35   core/libs/dimg/filters/nr/nrestimate.cpp

https://commits.kde.org/digikam/93627c420dfd96d390acd49198521de266253a0a

diff --git a/core/libs/dimg/filters/nr/nrestimate.cpp \
b/core/libs/dimg/filters/nr/nrestimate.cpp index 4011c01a2e..bcc06cc006 100644
--- a/core/libs/dimg/filters/nr/nrestimate.cpp
+++ b/core/libs/dimg/filters/nr/nrestimate.cpp
@@ -59,7 +59,7 @@ public:
       : clusterCount(30),
         size(512)
     {
-        for (int c = 0 ; c < 3 ; c++)
+        for (int c = 0 ; c < 3 ; ++c)
         {
             fimg[c] = 0;
         }
@@ -99,16 +99,16 @@ void NREstimate::readImage() const
 {
     DColor col;
 
-    for (int c = 0 ; runningFlag() && (c < 3) ; c++)
+    for (int c = 0 ; runningFlag() && (c < 3) ; ++c)
     {
         d->fimg[c] = new float[m_orgImage.numPixels()];
     }
 
     int j = 0;
 
-    for (uint y = 0 ; runningFlag() && (y < m_orgImage.height()) ; y++)
+    for (uint y = 0 ; runningFlag() && (y < m_orgImage.height()) ; ++y)
     {
-        for (uint x = 0 ; runningFlag() && (x < m_orgImage.width()) ; x++)
+        for (uint x = 0 ; runningFlag() && (x < m_orgImage.width()) ; ++x)
         {
             col           = m_orgImage.getPixelColor(x, y);
             d->fimg[0][j] = col.red();
@@ -143,9 +143,9 @@ void NREstimate::startAnalyse()
     // pointer variable to handle the CvMat* points (the image in CvMat format)
     float* pointsPtr = reinterpret_cast<float*>(points->data.ptr);
 
-    for (uint x = 0 ; runningFlag() && (x < m_orgImage.numPixels()) ; x++)
+    for (uint x = 0 ; runningFlag() && (x < m_orgImage.numPixels()) ; ++x)
     {
-        for (int y = 0 ; runningFlag() && (y < 3) ; y++)
+        for (int y = 0 ; runningFlag() && (y < 3) ; ++y)
         {
             *pointsPtr++ = (float)d->fimg[y][x];
         }
@@ -174,7 +174,7 @@ void NREstimate::startAnalyse()
 
     //the row position array would just make the hold the number of elements in each \
cluster  
-    for (uint i = 0 ; runningFlag() && (i < d->clusterCount) ; i++)
+    for (uint i = 0 ; runningFlag() && (i < d->clusterCount) ; ++i)
     {
         //initializing the cluster count array
         rowPosition[i] = 0;
@@ -182,7 +182,7 @@ void NREstimate::startAnalyse()
 
     int rowIndex, columnIndex;
 
-    for (uint i = 0 ; runningFlag() && (i < m_orgImage.numPixels()) ; i++)
+    for (uint i = 0 ; runningFlag() && (i < m_orgImage.numPixels()) ; ++i)
     {
         columnIndex = clusters->data.i[i];
         rowPosition[columnIndex]++;
@@ -204,7 +204,7 @@ void NREstimate::startAnalyse()
 
     int max = rowPosition[0];
 
-    for (uint i = 1 ; runningFlag() && (i < d->clusterCount) ; i++)
+    for (uint i = 1 ; runningFlag() && (i < d->clusterCount) ; ++i)
     {
         if (rowPosition[i] > max)
         {
@@ -233,7 +233,7 @@ void NREstimate::startAnalyse()
 
     QScopedArrayPointer<int> rPosition(new int[d->clusterCount]);
 
-    for (uint i = 0 ; runningFlag() && (i < d->clusterCount) ; i++)
+    for (uint i = 0 ; runningFlag() && (i < d->clusterCount) ; ++i)
     {
         rPosition[i] = 0;
     }
@@ -243,7 +243,7 @@ void NREstimate::startAnalyse()
     qCDebug(DIGIKAM_DIMG_LOG) << "The rowPosition array is ready!";
     postProgress(40);
 
-    for (uint i=0 ; runningFlag() && (i < m_orgImage.numPixels()) ; i++)
+    for (uint i = 0 ; runningFlag() && (i < m_orgImage.numPixels()) ; ++i)
     {
         columnIndex = clusters->data.i[i];
         rowIndex    = rPosition[columnIndex];
@@ -252,15 +252,15 @@ void NREstimate::startAnalyse()
         ptr         = reinterpret_cast<float*>(sd->data.ptr + rowIndex*(sd->step));
 
         //moving to the right column
-        for (int j = 0 ; runningFlag() && (j < columnIndex) ; j++)
+        for (int j = 0 ; runningFlag() && (j < columnIndex) ; ++j)
         {
-            for (int z = 0 ; runningFlag() && (z < (points->cols)) ; z++)
+            for (int z = 0 ; runningFlag() && (z < (points->cols)) ; ++z)
             {
                 ptr++;
             }
         }
 
-        for (int z = 0 ; runningFlag() && (z < (points->cols)) ; z++)
+        for (int z = 0 ; runningFlag() && (z < (points->cols)) ; ++z)
         {
             *ptr++ = cvGet2D(points, i, z).val[0];
         }
@@ -281,22 +281,19 @@ void NREstimate::startAnalyse()
     float*   stdStorePtr  = 0;
     int      totalcount   = 0; // Number of non-empty clusters
 
-    if (runningFlag())
-    {
-        meanStore    = cvCreateMat(d->clusterCount, points->cols, CV_32FC1);
-        stdStore     = cvCreateMat(d->clusterCount, points->cols, CV_32FC1);
-        meanStorePtr = reinterpret_cast<float*>(meanStore->data.ptr);
-        stdStorePtr  = reinterpret_cast<float*>(stdStore->data.ptr);
-    }
+    meanStore    = cvCreateMat(d->clusterCount, points->cols, CV_32FC1);
+    stdStore     = cvCreateMat(d->clusterCount, points->cols, CV_32FC1);
+    meanStorePtr = reinterpret_cast<float*>(meanStore->data.ptr);
+    stdStorePtr  = reinterpret_cast<float*>(stdStore->data.ptr);
 
-    for (int i = 0 ; runningFlag() && (i < sd->cols) ; i++)
+    for (int i = 0 ; runningFlag() && (i < sd->cols) ; ++i)
     {
         if (runningFlag() && (rowPosition[(i/points->cols)] >= 1))
         {
             CvMat* workingArr = cvCreateMat(rowPosition[(i / points->cols)], 1, \
                CV_32FC1);
             ptr               = reinterpret_cast<float*>(workingArr->data.ptr);
 
-            for (int j = 0 ; runningFlag() && (j < rowPosition[(i / \
(points->cols))]) ; j++) +            for (int j = 0 ; runningFlag() && (j < \
rowPosition[(i / (points->cols))]) ; ++j)  {
                 *ptr++ = cvGet2D(sd, j, i).val[0];
             }
@@ -314,11 +311,8 @@ void NREstimate::startAnalyse()
 
     // -----------------------------------------------------------------------------------------------------------------
  
-    if (runningFlag())
-    {
-        meanStorePtr = reinterpret_cast<float*>(meanStore->data.ptr);
-        stdStorePtr  = reinterpret_cast<float*>(stdStore->data.ptr);
-    }
+    meanStorePtr = reinterpret_cast<float*>(meanStore->data.ptr);
+    stdStorePtr  = reinterpret_cast<float*>(stdStore->data.ptr);
 
     if (runningFlag() && !d->path.isEmpty())
     {
@@ -334,7 +328,7 @@ void NREstimate::startAnalyse()
             QTextStream oms(&filems);
             oms << "Mean Data\n";
 
-            for (int i = 0 ; i < totalcount ; i++)
+            for (int i = 0 ; i < totalcount ; ++i)
             {
                 oms << *meanStorePtr++;
                 oms << "\t";
@@ -347,7 +341,7 @@ void NREstimate::startAnalyse()
 
             oms << "\nStd Data\n";
 
-            for (int i = 0 ; i < totalcount ; i++)
+            for (int i = 0 ; i < totalcount ; ++i)
             {
                 oms << *stdStorePtr++;
                 oms << "\t";
@@ -389,18 +383,18 @@ void NREstimate::startAnalyse()
     float   weightedStd  = 0.0f;
     float   datasd[3]    = {0.0f, 0.0f, 0.0f};
 
-    for (int j = 0 ; runningFlag() && (j < points->cols) ; j++)
+    for (int j = 0 ; runningFlag() && (j < points->cols) ; ++j)
     {
         meanStorePtr = reinterpret_cast<float*>(meanStore->data.ptr);
         stdStorePtr  = reinterpret_cast<float*>(stdStore->data.ptr);
 
-        for (int moveToChannel = 0 ; moveToChannel <= j ; moveToChannel++)
+        for (int moveToChannel = 0 ; moveToChannel <= j ; ++moveToChannel)
         {
             meanStorePtr++;
             stdStorePtr++;
         }
 
-        for (uint i = 0 ; i < d->clusterCount ; i++)
+        for (uint i = 0 ; i < d->clusterCount ; ++i)
         {
             if (rowPosition[i] >= 1)
             {
@@ -447,7 +441,7 @@ void NREstimate::startAnalyse()
         // for 16 bits images only
         if (m_orgImage.sixteenBit())
         {
-            for (int i = 0 ; i < points->cols ; i++)
+            for (int i = 0 ; i < points->cols ; ++i)
             {
                 datasd[i] = datasd[i] / 256;
             }
@@ -507,7 +501,7 @@ void NREstimate::startAnalyse()
     cvReleaseMat(&points);
     cvReleaseMat(&clusters);
 
-    for (uint i = 0 ; i < 3 ; i++)
+    for (uint i = 0 ; i < 3 ; ++i)
     {
         delete [] d->fimg[i];
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic