From e13f9924cf6416b9bb279af5165107a3ccba4c82 Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Fri, 9 May 2014 12:02:18 +0200
Subject: [PATCH] WRG: fix warning in texture filters

---
 .../otbScalarImageToAdvancedTexturesFilter.txx            | 8 ++++----
 .../otbScalarImageToPanTexTextureFilter.txx               | 4 ++--
 Code/FeatureExtraction/otbScalarImageToTexturesFilter.txx | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.txx b/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.txx
index 0ee25281bb..6035d734c9 100644
--- a/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.txx
+++ b/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.txx
@@ -33,10 +33,10 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage>
 ::ScalarImageToAdvancedTexturesFilter()
 : m_Radius()
 , m_Offset()
-, m_HistSize(2)
 , m_NumberOfBinsPerAxis(8)
 , m_InputImageMinimum(0)
 , m_InputImageMaximum(255)
+, m_HistSize(2)
 {
   // There are 10 outputs corresponding to the 9 textures indices
   this->SetNumberOfRequiredOutputs(10);
@@ -519,14 +519,14 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage>
      * to compute hxy1. This need to force an iterator over entire histogram.
        Processing time is propotional to the histogram bin size */
     double hxy2 = 0;
-    for(int i = 0; i < histSize0; ++i)
+    for(unsigned int i = 0; i < histSize0; ++i)
       {
-      for(int j = 0; j < histSize1; ++j)
+      for(unsigned int j = 0; j < histSize1; ++j)
         {
         double pipj = hx[j] * hy[i];
         hxy2 -= (pipj > 0.0001) ? pipj * vcl_log(pipj) : 0.;
         double frequency = m_GLCIList->GetFrequency(i,j, glcList);
-        m_Dissimilarity+= ( j - i ) * (frequency * frequency);
+        m_Dissimilarity+= ( static_cast<double>(j) - static_cast<double>(i) ) * (frequency * frequency);
         }
       }
 
diff --git a/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.txx b/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.txx
index b3515e841e..42cfa9abf5 100644
--- a/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.txx
+++ b/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.txx
@@ -31,9 +31,9 @@ template <class TInputImage, class TOutputImage>
 ScalarImageToPanTexTextureFilter<TInputImage, TOutputImage>
 ::ScalarImageToPanTexTextureFilter() : m_Radius(),
   m_NumberOfBinsPerAxis(8),
-  m_HistSize(2),
   m_InputImageMinimum(0),
-  m_InputImageMaximum(255)
+  m_InputImageMaximum(255),
+  m_HistSize(2)
 {
   // There are 1 output corresponding to the Pan Tex texture indice
   this->SetNumberOfRequiredOutputs(1);
diff --git a/Code/FeatureExtraction/otbScalarImageToTexturesFilter.txx b/Code/FeatureExtraction/otbScalarImageToTexturesFilter.txx
index 77811e6ad8..b0c4db3646 100644
--- a/Code/FeatureExtraction/otbScalarImageToTexturesFilter.txx
+++ b/Code/FeatureExtraction/otbScalarImageToTexturesFilter.txx
@@ -33,10 +33,10 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage>
 ::ScalarImageToTexturesFilter()
 : m_Radius()
 , m_Offset()
-, m_HistSize(2)
 , m_NumberOfBinsPerAxis(8)
 , m_InputImageMinimum(0)
 , m_InputImageMaximum(255)
+, m_HistSize(2)
 {
   // There are 8 outputs corresponding to the 8 textures indices
   this->SetNumberOfRequiredOutputs(8);
-- 
GitLab