From 4187f86079a7f1a5155e03f522e61de22881ef48 Mon Sep 17 00:00:00 2001
From: Rashad Kanavath <mohammed.rashad-km@cnes.fr>
Date: Sat, 2 Aug 2014 09:24:06 +0200
Subject: [PATCH] WRG: unused typedefs in examples and other warnings

---
 .../otbHyperspectralUnmixing.cxx              |  3 --
 .../otbVertexComponentAnalysis.cxx            |  2 --
 .../otbBijectionCoherencyFilter.txx           | 13 ++++---
 .../otbDisparityTranslateFilter.txx           | 35 ++++++++++---------
 .../DisparityMap/otbMulti3DMapToDEMFilter.txx |  6 ++--
 .../otbHaralickTexturesImageFunction.txx      | 10 ------
 Code/Simulation/otbReduceSpectralResponse.txx |  2 +-
 .../GeometriesChangeSpatialReference.cxx      |  2 +-
 Examples/IO/OGRWrappersExample.cxx            |  2 +-
 .../EstimateAffineTransformationExample.cxx   |  3 --
 Examples/Patented/SIFTDensityExample.cxx      |  2 +-
 .../Patented/SIFTDisparityMapEstimation.cxx   |  6 ----
 Examples/Patented/SIFTExample.cxx             |  2 --
 13 files changed, 35 insertions(+), 53 deletions(-)

diff --git a/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx b/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx
index d419b7e841..41f9305980 100644
--- a/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx
+++ b/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx
@@ -27,14 +27,11 @@
 
 #include "otbVectorImageToMatrixImageFilter.h"
 
-
 namespace otb
 {
 namespace Wrapper
 {
 
-const unsigned int Dimension = 2;
-
 typedef otb::StreamingStatisticsVectorImageFilter<DoubleVectorImageType> StreamingStatisticsVectorImageFilterType;
 
 typedef otb::UnConstrainedLeastSquareImageFilter<DoubleVectorImageType, DoubleVectorImageType, double> UCLSUnmixingFilterType;
diff --git a/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx b/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx
index 5cf08ee534..0668258929 100644
--- a/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx
+++ b/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx
@@ -21,13 +21,11 @@
 #include "otbVcaImageFilter.h"
 #include "otbVectorImageToMatrixImageFilter.h"
 
-
 namespace otb
 {
 namespace Wrapper
 {
 
-const unsigned int Dimension = 2;
 
 typedef otb::VCAImageFilter<DoubleVectorImageType>                 VCAFilterType;
 typedef otb::VectorImageToMatrixImageFilter<DoubleVectorImageType> VectorImageToMatrixImageFilterType;
diff --git a/Code/DisparityMap/otbBijectionCoherencyFilter.txx b/Code/DisparityMap/otbBijectionCoherencyFilter.txx
index ed2f32b8bd..1723af892e 100644
--- a/Code/DisparityMap/otbBijectionCoherencyFilter.txx
+++ b/Code/DisparityMap/otbBijectionCoherencyFilter.txx
@@ -251,13 +251,18 @@ BijectionCoherencyFilter<TDisparityImage,TOutputImage>
     if (directVmap) tmpIndex[1] += directVertiIter.Get();
 
     // Interpolate in reverse disparity map
+    typedef typename IndexType::IndexValueType IndexValueType;
     IndexType ul,ur,ll,lr;
     ul[0] = static_cast<long>(vcl_floor(tmpIndex[0]));
     ul[1] = static_cast<long>(vcl_floor(tmpIndex[1]));
-    if (ul[0]<buffered.GetIndex()[0]) ul[0]=buffered.GetIndex()[0];
-    if (ul[1]<buffered.GetIndex()[1]) ul[1]=buffered.GetIndex()[1];
-    if (ul[0]>(unsigned int)(buffered.GetIndex()[0]+buffered.GetSize()[0]-1)) ul[0]=(buffered.GetIndex()[0]+buffered.GetSize()[0]-1);
-    if (ul[1]>(unsigned int)(buffered.GetIndex()[1]+buffered.GetSize()[1]-1)) ul[1]=(buffered.GetIndex()[1]+buffered.GetSize()[1]-1);
+    if (ul[0] < buffered.GetIndex()[0])
+      ul[0] = buffered.GetIndex()[0];
+    if (ul[1] < buffered.GetIndex()[1])
+      ul[1] = buffered.GetIndex()[1];
+    if (ul[0] > static_cast<IndexValueType>(buffered.GetIndex()[0] + buffered.GetSize()[0]-1))
+      ul[0]=(buffered.GetIndex()[0]+buffered.GetSize()[0]-1);
+    if (ul[1] > static_cast<IndexValueType>(buffered.GetIndex()[1] + buffered.GetSize()[1]-1))
+      ul[1] = (buffered.GetIndex()[1]+buffered.GetSize()[1]-1);
 
     ur = ul;
     ur[0] += 1;
diff --git a/Code/DisparityMap/otbDisparityTranslateFilter.txx b/Code/DisparityMap/otbDisparityTranslateFilter.txx
index bc37aa9212..2a0932c883 100644
--- a/Code/DisparityMap/otbDisparityTranslateFilter.txx
+++ b/Code/DisparityMap/otbDisparityTranslateFilter.txx
@@ -268,10 +268,12 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage>
     IndexType ul;
     ul[0] = static_cast<long>(vcl_floor(indexGrid[0]));
     ul[1] = static_cast<long>(vcl_floor(indexGrid[1]));
-    if (ul[0]<gridLargest.GetIndex()[0]) ul[0]=gridLargest.GetIndex()[0];
-    if (ul[1]<gridLargest.GetIndex()[1]) ul[1]=gridLargest.GetIndex()[1];
-    if (ul[0]>(unsigned int)(gridLargest.GetIndex()[0]+gridLargest.GetSize()[0]-2)) ul[0]=(gridLargest.GetIndex()[0]+gridLargest.GetSize()[0]-2);
-    if (ul[1]>(unsigned int)(gridLargest.GetIndex()[1]+gridLargest.GetSize()[1]-2)) ul[1]=(gridLargest.GetIndex()[1]+gridLargest.GetSize()[1]-2);
+    if (ul[0] < gridLargest.GetIndex()[0]) ul[0] = gridLargest.GetIndex()[0];
+    if (ul[1] < gridLargest.GetIndex()[1]) ul[1] = gridLargest.GetIndex()[1];
+    if (ul[0] > static_cast<IndexValueType>(gridLargest.GetIndex()[0] + gridLargest.GetSize()[0]-2))
+      ul[0] = (gridLargest.GetIndex()[0] + gridLargest.GetSize()[0]-2);
+    if (ul[1] > static_cast<IndexValueType>(gridLargest.GetIndex()[1] + gridLargest.GetSize()[1]-2))
+      ul[1] = (gridLargest.GetIndex()[1] + gridLargest.GetSize()[1]-2);
 
     IndexType ur = ul;
     ur[0] += 1;
@@ -365,15 +367,16 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage>
       leftGrid->TransformPhysicalPointToContinuousIndex(pointSensor, indexGrid);
 
       // Interpolate in left grid
+      typedef typename IndexType::IndexValueType IndexValueType;
       IndexType ul;
       ul[0] = static_cast<long> (vcl_floor(indexGrid[0]));
       ul[1] = static_cast<long> (vcl_floor(indexGrid[1]));
       if (ul[0] < leftLargest.GetIndex()[0]) ul[0] = leftLargest.GetIndex()[0];
       if (ul[1] < leftLargest.GetIndex()[1]) ul[1] = leftLargest.GetIndex()[1];
-      if (ul[0] > (unsigned int) (leftLargest.GetIndex()[0] + leftLargest.GetSize()[0] - 2)) ul[0] = (
-          leftLargest.GetIndex()[0] + leftLargest.GetSize()[0] - 2);
-      if (ul[1] > (unsigned int) (leftLargest.GetIndex()[1] + leftLargest.GetSize()[1] - 2)) ul[1] = (
-          leftLargest.GetIndex()[1] + leftLargest.GetSize()[1] - 2);
+      if (ul[0] > static_cast<IndexValueType>(leftLargest.GetIndex()[0] + leftLargest.GetSize()[0] - 2))
+        ul[0] = (leftLargest.GetIndex()[0] + leftLargest.GetSize()[0] - 2);
+      if (ul[1] > static_cast<IndexValueType>(leftLargest.GetIndex()[1] + leftLargest.GetSize()[1] - 2))
+        ul[1] = (leftLargest.GetIndex()[1] + leftLargest.GetSize()[1] - 2);
 
       IndexType ur = ul;
       ur[0] += 1;
@@ -400,10 +403,10 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage>
       ul[1] = static_cast<long> (vcl_floor(indexEpi[1]));
       if (ul[0] < buffered.GetIndex()[0]) ul[0] = buffered.GetIndex()[0];
       if (ul[1] < buffered.GetIndex()[1]) ul[1] = buffered.GetIndex()[1];
-      if (ul[0] > (unsigned int) (buffered.GetIndex()[0] + buffered.GetSize()[0] - 2)) ul[0] = (buffered.GetIndex()[0]
-          + buffered.GetSize()[0] - 2);
-      if (ul[1] > (unsigned int) (buffered.GetIndex()[1] + buffered.GetSize()[1] - 2)) ul[1] = (buffered.GetIndex()[1]
-          + buffered.GetSize()[1] - 2);
+      if (ul[0] > static_cast<IndexValueType>(buffered.GetIndex()[0] + buffered.GetSize()[0] - 2))
+        ul[0] = (buffered.GetIndex()[0] + buffered.GetSize()[0] - 2);
+      if (ul[1] > static_cast<IndexValueType>(buffered.GetIndex()[1] + buffered.GetSize()[1] - 2))
+        ul[1] = (buffered.GetIndex()[1] + buffered.GetSize()[1] - 2);
 
       ur = ul;
       ur[0] += 1;
@@ -441,10 +444,10 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage>
         ul[1] = static_cast<long> (vcl_floor(indexGridRight[1]));
         if (ul[0] < rightLargest.GetIndex()[0]) ul[0] = rightLargest.GetIndex()[0];
         if (ul[1] < rightLargest.GetIndex()[1]) ul[1] = rightLargest.GetIndex()[1];
-        if (ul[0] > (unsigned int) (rightLargest.GetIndex()[0] + rightLargest.GetSize()[0] - 2)) ul[0] = (
-            rightLargest.GetIndex()[0] + rightLargest.GetSize()[0] - 2);
-        if (ul[1] > (unsigned int) (rightLargest.GetIndex()[1] + rightLargest.GetSize()[1] - 2)) ul[1] = (
-            rightLargest.GetIndex()[1] + rightLargest.GetSize()[1] - 2);
+        if (ul[0] > static_cast<IndexValueType>(rightLargest.GetIndex()[0] + rightLargest.GetSize()[0] - 2))
+          ul[0] = (rightLargest.GetIndex()[0] + rightLargest.GetSize()[0] - 2);
+        if (ul[1] > static_cast<IndexValueType>(rightLargest.GetIndex()[1] + rightLargest.GetSize()[1] - 2))
+          ul[1] = (rightLargest.GetIndex()[1] + rightLargest.GetSize()[1] - 2);
 
         ur = ul;
         ur[0] += 1;
diff --git a/Code/DisparityMap/otbMulti3DMapToDEMFilter.txx b/Code/DisparityMap/otbMulti3DMapToDEMFilter.txx
index 14b9699036..1b1f76aa9b 100644
--- a/Code/DisparityMap/otbMulti3DMapToDEMFilter.txx
+++ b/Code/DisparityMap/otbMulti3DMapToDEMFilter.txx
@@ -556,9 +556,9 @@ void Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::ThreadedGener
   InputInternalPixelType regionLong2 = pointRef[0] + size[0] * step[0];
   InputInternalPixelType regionLat2 = pointRef[1] + size[1] * step[1];
   InputInternalPixelType minLong = std::min(regionLong1, regionLong2);
-  InputInternalPixelType minLat = std::min(regionLat1, regionLat2);
-  InputInternalPixelType maxLong = std::max(regionLong1, regionLong2);
-  InputInternalPixelType maxLat = std::max(regionLat1, regionLat2);
+  // InputInternalPixelType minLat = std::min(regionLat1, regionLat2);
+  // InputInternalPixelType maxLong = std::max(regionLong1, regionLong2);
+  // InputInternalPixelType maxLat = std::max(regionLat1, regionLat2);
 
   TOutputDEMImage * tmpDEM = NULL;
   AccumulatorImageType *tmpAcc = NULL;
diff --git a/Code/FeatureExtraction/otbHaralickTexturesImageFunction.txx b/Code/FeatureExtraction/otbHaralickTexturesImageFunction.txx
index dfe736fe0e..0503767b67 100644
--- a/Code/FeatureExtraction/otbHaralickTexturesImageFunction.txx
+++ b/Code/FeatureExtraction/otbHaralickTexturesImageFunction.txx
@@ -199,16 +199,6 @@ HaralickTexturesImageFunction<TInputImage, TCoordRep>
     pixelVarianceSquared = 1.;
     }
 
-  //Initalize texture variables;
-  PixelValueType energy      = itk::NumericTraits< PixelValueType >::Zero;
-  PixelValueType entropy     = itk::NumericTraits< PixelValueType >::Zero;
-  PixelValueType correlation = itk::NumericTraits< PixelValueType >::Zero;
-  PixelValueType inverseDifferenceMoment      = itk::NumericTraits< PixelValueType >::Zero;
-  PixelValueType inertia             = itk::NumericTraits< PixelValueType >::Zero;
-  PixelValueType clusterShade        = itk::NumericTraits< PixelValueType >::Zero;
-  PixelValueType clusterProminence   = itk::NumericTraits< PixelValueType >::Zero;
-  PixelValueType haralickCorrelation = itk::NumericTraits< PixelValueType >::Zero;
-
   //Compute textures
   constVectorIt = glcVector.begin();
   while( constVectorIt != glcVector.end())
diff --git a/Code/Simulation/otbReduceSpectralResponse.txx b/Code/Simulation/otbReduceSpectralResponse.txx
index e1ef267c7d..bc76c02312 100644
--- a/Code/Simulation/otbReduceSpectralResponse.txx
+++ b/Code/Simulation/otbReduceSpectralResponse.txx
@@ -90,7 +90,7 @@ ReduceSpectralResponse<TSpectralResponse , TRSR>
       {
       PrecisionType lambda1 = (*(it-1)).first;
       PrecisionType lambda2 = (*it).first;
-      PrecisionType deltaLambda = lambda2-lambda1;
+//      PrecisionType deltaLambda = lambda2-lambda1;
       ValuePrecisionType rsr1 = (*(it-1)).second;
       ValuePrecisionType rsr2 = (*it).second;
       ValuePrecisionType spectrum1 = (*m_InputSpectralResponse)(lambda1);
diff --git a/Examples/Filtering/GeometriesChangeSpatialReference.cxx b/Examples/Filtering/GeometriesChangeSpatialReference.cxx
index 41a030f565..a896631fdf 100644
--- a/Examples/Filtering/GeometriesChangeSpatialReference.cxx
+++ b/Examples/Filtering/GeometriesChangeSpatialReference.cxx
@@ -104,7 +104,7 @@ protected:
 
 private:
 
-  virtual OGRSpatialReference*     DoDefineNewLayerSpatialReference(otb::ogr::Layer const& source) const
+  virtual OGRSpatialReference*     DoDefineNewLayerSpatialReference(otb::ogr::Layer const& itkNotUsed(source)) const
     {
     return m_osr.get();
     }
diff --git a/Examples/IO/OGRWrappersExample.cxx b/Examples/IO/OGRWrappersExample.cxx
index 94ff1823b2..23afc27e91 100644
--- a/Examples/IO/OGRWrappersExample.cxx
+++ b/Examples/IO/OGRWrappersExample.cxx
@@ -265,7 +265,7 @@ AnyListFieldList_t prepareNewFields(
   OGRFeatureDefn /*const*/& defn, otb::ogr::Layer & destLayer)
 {
   AnyListFieldList_t fields;
-  for (size_t i=0, N=defn.GetFieldCount(); i!=N; ++i)
+  for (int i=0, N=defn.GetFieldCount(); i!=N; ++i)
     {
     const char* name = defn.GetFieldDefn(i)->GetNameRef();
     OGRFieldType type  = static_cast<OGRFieldType>(-1);
diff --git a/Examples/Patented/EstimateAffineTransformationExample.cxx b/Examples/Patented/EstimateAffineTransformationExample.cxx
index c138ab45ce..f79807168a 100644
--- a/Examples/Patented/EstimateAffineTransformationExample.cxx
+++ b/Examples/Patented/EstimateAffineTransformationExample.cxx
@@ -137,14 +137,11 @@ int main(int argc, char* argv[])
   // Software Guide : BeginCodeSnippet
   typedef PointSetType::PointType         PointType;
   typedef std::pair<PointType, PointType> MatchType;
-  typedef std::vector<MatchType>          MatchVectorType;
   typedef EuclideanDistanceMetricMatchingFilterType::LandmarkListType
   LandmarkListType;
 
   typedef PointSetType::PointsContainer    PointsContainerType;
-  typedef PointsContainerType::Iterator    PointsIteratorType;
   typedef PointSetType::PointDataContainer PointDataContainerType;
-  typedef PointDataContainerType::Iterator PointDataIteratorType;
   // Software Guide : EndCodeSnippet
 
   // Software Guide : BeginLatex
diff --git a/Examples/Patented/SIFTDensityExample.cxx b/Examples/Patented/SIFTDensityExample.cxx
index 129773bb2d..d5859f8793 100644
--- a/Examples/Patented/SIFTDensityExample.cxx
+++ b/Examples/Patented/SIFTDensityExample.cxx
@@ -48,7 +48,7 @@
 // Software Guide : EndCodeSnippet
 #include "otbImageToSIFTKeyPointSetFilter.h"
 
-int main(int argc, char* argv[])
+int main(int itkNotUsed(argc), char* argv[])
 {
   const char *       infname = argv[1];
   const char *       outfname = argv[2];
diff --git a/Examples/Patented/SIFTDisparityMapEstimation.cxx b/Examples/Patented/SIFTDisparityMapEstimation.cxx
index cc7981e7a5..bada56d854 100644
--- a/Examples/Patented/SIFTDisparityMapEstimation.cxx
+++ b/Examples/Patented/SIFTDisparityMapEstimation.cxx
@@ -128,10 +128,6 @@ int main(int argc, char* argv[])
   typedef EuclideanDistanceMetricMatchingFilterType::LandmarkListType
   LandmarkListType;
 
-  typedef PointSetType::PointsContainer    PointsContainerType;
-  typedef PointsContainerType::Iterator    PointsIteratorType;
-  typedef PointSetType::PointDataContainer PointDataContainerType;
-  typedef PointDataContainerType::Iterator PointDataIteratorType;
   // Software Guide : EndCodeSnippet
 
   // Software Guide : BeginLatex
@@ -318,8 +314,6 @@ int main(int argc, char* argv[])
   //
   // Software Guide : EndLatex
   // Software Guide : BeginCodeSnippet
-  typedef DisplacementSourceType::LandmarkContainerPointer
-  LandmarkContainerPointer;
   typedef DisplacementSourceType::LandmarkContainer
   LandmarkContainerType;
   typedef DisplacementSourceType::LandmarkPointType LandmarkPointType;
diff --git a/Examples/Patented/SIFTExample.cxx b/Examples/Patented/SIFTExample.cxx
index 9cfd05068f..f495b88688 100644
--- a/Examples/Patented/SIFTExample.cxx
+++ b/Examples/Patented/SIFTExample.cxx
@@ -120,8 +120,6 @@ int main(int argc, char * argv[])
 // Software Guide : BeginCodeSnippet
   typedef PointSetType::PointsContainer    PointsContainerType;
   typedef PointsContainerType::Iterator    PointsIteratorType;
-  typedef PointSetType::PointDataContainer PointDataContainerType;
-  typedef PointDataContainerType::Iterator PointDataIteratorType;
 // Software Guide : EndCodeSnippet
 
 // Software Guide : BeginLatex
-- 
GitLab