From 6ef46f294e16ba7651a3c1e02ef4f18456c5d2b0 Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Tue, 12 May 2009 15:27:49 +0800
Subject: [PATCH] BUG: include for gcc 4.4

---
 .../otbossim/src/ossim/base/ossimDms.cpp      | 207 +++++++++---------
 .../src/ossim/base/ossimEquTokenizer.cpp      |   9 +-
 .../otbossim/src/ossim/base/ossimGeoref.cpp   |  27 +--
 .../otbossim/src/ossim/base/ossimRegExp.cpp   |  59 ++---
 .../src/ossim/support_data/ossimDemUtil.cpp   |   5 +-
 5 files changed, 156 insertions(+), 151 deletions(-)

diff --git a/Utilities/otbossim/src/ossim/base/ossimDms.cpp b/Utilities/otbossim/src/ossim/base/ossimDms.cpp
index 451589ad1f..84bead3fc8 100644
--- a/Utilities/otbossim/src/ossim/base/ossimDms.cpp
+++ b/Utilities/otbossim/src/ossim/base/ossimDms.cpp
@@ -12,6 +12,7 @@
 
 #include <cmath>
 #include <cstring> /* for strcpy */
+#include <cstdio>
 #include <iomanip>
 #include <sstream>
 
@@ -70,16 +71,16 @@ ossimDms::ossimDms(const std::string& value)
 ossimDms& ossimDms::setDegrees(double degrees)
 {
    theDegrees = degrees;
-   
+
    return *this;
 }
 
 bool ossimDms::setDegrees(const std::string& cdegrees)
 {
    bool status = true;
-   
+
    ossimString copy = cdegrees;
-   
+
    double degrees, factor, dividend, units;
    int i;
    bool afterdelim;
@@ -101,9 +102,9 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
       cptr++;
    }
 
-   while(*cptr != '\0') 
+   while(*cptr != '\0')
    {
-      switch (*cptr) 
+      switch (*cptr)
       {
 
          // north, west and + values will change sign of degrees to plus.
@@ -131,7 +132,7 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
          }
 
          // south, east and - values will change sign of degrees to minus
-         
+
          case '-':
          {
             theSign = -1;
@@ -154,7 +155,7 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
             theLatFlag = false;
             break;
          }
-         
+
          case '0':
          case '1':
          case '2':
@@ -164,14 +165,14 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
          case '6':
          case '7':
          case '8':
-         case '9': 
+         case '9':
          {
             c = *cptr;
             i = (c - '0');
-            
-            if (afterdelim == true) 
+
+            if (afterdelim == true)
             {
-               if (theAfterDot == true) 
+               if (theAfterDot == true)
                {
                   units = units + (((double)i * factor) / dividend);
                }
@@ -180,7 +181,7 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
                   units = (units * factor) + ((double)i / dividend);
                }
             }
-            else 
+            else
             {
                if (theAfterDot == true)
                {
@@ -199,7 +200,7 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
             {
                factor = 10.;
             }
-            
+
             cptr++;
             break;
          }
@@ -208,7 +209,7 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
          // a decimal point indicates a change in the factor used
          // to calculate degrees or units (minutes or seconds)
          //---
-         case '.': 
+         case '.':
          {
             factor = .10;
             theAfterDot = true;
@@ -217,7 +218,7 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
          }
 
          // after a delimiter the value contains minutes, first time through
-         case ' ': 
+         case ' ':
          case '\"':
          case '\'':
          {
@@ -225,10 +226,10 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
             {
                cptr++;
             }
-            
+
             degrees = degrees + units;
             units = 0.0;
-            
+
             if (afterdelim == true) 	/* must be seconds */
             {
                dividend = dividend * dividend;
@@ -237,18 +238,18 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
             {
                afterdelim = true;
             }
-            
+
             factor = 1.;
-            
+
             cptr++;
-            
+
             // skip any leading zeroes after delimiter */
-            
+
             while (*cptr == '0')
             {
                cptr++;
             }
-            
+
             break;
          }
 
@@ -257,10 +258,10 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
          // isspace allows: space, tab, cr, nl, vt, ff
          // ispunct allows: punctuation char != space or control or letter
          //---
-         default: 
+         default:
          {
-            if(isspace(*cptr) || 
-               ispunct(*cptr) || 
+            if(isspace(*cptr) ||
+               ispunct(*cptr) ||
                ((ossim_uint8)(*cptr) == theDegreeSign))
             {
                *cptr = ' ';
@@ -271,21 +272,21 @@ bool ossimDms::setDegrees(const std::string& cdegrees)
                ++cptr;
             }
          }
-         
+
       }	// end switch
 
       if (status == false)
       {
          break;
       }
-      
+
    } //  end while loop
 
    // add any units that may have been calculated (minutes or seconds)
    degrees     = degrees + units;
-   
+
    theDegrees = (degrees * (double)theSign);
-   
+
    return status;
 }
 
@@ -301,11 +302,11 @@ ossimString ossimDms::toString(const ossimString& formatString)const
 
    stringIter = tempFormatString.begin();
    int i, d_s;
-   
+
 /* assign a default format if none is given */
-      
+
    init_values(theDegrees);
-   
+
    while(stringIter != tempFormatString.end())
    {
       switch(*stringIter)
@@ -316,7 +317,7 @@ ossimString ossimDms::toString(const ossimString& formatString)const
             stringIter++;
             break;
          }
-         
+
          case 'c':
          case 'C':
          {
@@ -329,7 +330,7 @@ ossimString ossimDms::toString(const ossimString& formatString)const
             {
                temp= (theLatFlag == true) ? ('N') : ('E');
             }
-            
+
             if(*stringIter == 'c')
             {
                temp = tolower(temp);
@@ -338,7 +339,7 @@ ossimString ossimDms::toString(const ossimString& formatString)const
             stringIter++;
             break;
          }
-         
+
          case 'd':
          case 'D':
          {			/* how many 'd's until not 'd' */
@@ -383,7 +384,7 @@ ossimString ossimDms::toString(const ossimString& formatString)const
 //             {
 //                if(theAfterDot)
 //                {
-                  
+
 //                   while(d_s > 0)
 //                   {
 //                      temp+='0';
@@ -401,14 +402,14 @@ ossimString ossimDms::toString(const ossimString& formatString)const
 //                   temp = prefix + temp;
 //                }
 //             }
-            
+
             break;
          }
- 
+
          case ' ':
-         {			
+         {
             result += *stringIter;
-            
+
             while (*stringIter == ' ')
             {
                result += *stringIter;
@@ -416,14 +417,14 @@ ossimString ossimDms::toString(const ossimString& formatString)const
             }
             break;
          }
-         
-         case '.': 
+
+         case '.':
          {
-            theAfterDot = true;              
+            theAfterDot = true;
             result +=  *stringIter++;
             break;
          }
-         
+
          case 'm':
          case 'M':
          case 's':
@@ -434,11 +435,11 @@ ossimString ossimDms::toString(const ossimString& formatString)const
             {
                theDoingSeconds = true;
             }
-            
+
             calc_mins_or_secs(&theDecDegs, stringIter, result);
             break;
          }
-         
+
          // This is code that I added so you can do additional
          // formatting.
          //
@@ -464,8 +465,8 @@ ossimString ossimDms::toString(const ossimString& formatString)const
          }
       }	/* end switch statement */
    }	/* end while loop */
-   
-   return result;   
+
+   return result;
 }
 
 // The functions that follow are all dts stuff
@@ -478,9 +479,9 @@ ossimString ossimDms::degree_to_string(double degrees,
    char str_fmt[10];
    char *rptr, *fptr, *sptr;
    int i, d_s;
-   
+
 /* assign a default format if none is given */
-   
+
    if (format[0] == '\0')
    {
       set_default(format, cdegrees);
@@ -490,17 +491,17 @@ ossimString ossimDms::degree_to_string(double degrees,
       memset(cdegrees, ' ', 64);
 //       strcpy(cdegrees, SPACES);
    }
-   
+
    init_values(degrees);
-   
+
    rptr = cdegrees;
    fptr = format;
    sptr = str_fmt;
-   
+
 /* cycle through characters of the format and plug in values */
-   
+
    while (*fptr != '\0') {
-      
+
 	 switch (*fptr) {
 
 	   case '-': {
@@ -515,7 +516,7 @@ ossimString ossimDms::degree_to_string(double degrees,
 		   (lat_flag == true) ? (*rptr = 'S') : (*rptr = 'W');
 		else
 		   (lat_flag == true) ? (*rptr = 'N') : (*rptr = 'E');
-		
+
 		rptr++, fptr++;
 		break;
 	   }
@@ -649,7 +650,7 @@ void ossimDms::calc_mins_or_secs(double *dd,
            if(*dd < 0.0) *dd = 0.0;
 	}
         std::ostringstream out;
-        
+
         out << std::setw(numunits)
             << std::setfill('0')
             << std::setiosflags(std::ios::right)
@@ -657,7 +658,7 @@ void ossimDms::calc_mins_or_secs(double *dd,
             << ires
             << std::ends;
         result+=out.str().c_str();
-        
+
 
 //        result += ossimString::toString(ires);
 }
@@ -709,7 +710,7 @@ int ossimDms::calc_mins_or_secs(double *dd,
 	}
 	setup_printf(numunits, str_fmt);
 	sprintf(res, str_fmt, ires);
-        
+
 	return(numunits);
 }
 
@@ -725,7 +726,7 @@ int ossimDms::calc_mins_or_secs(double *dd,
 void ossimDms::setup_printf(int ival, char *fmt)const
 {
 	char precis[3];
-	
+
 	strcpy(fmt, "%");
 	sprintf(precis, "%d", ival);
 	strcat(fmt,precis);
@@ -744,7 +745,7 @@ void ossimDms::setup_printf(int ival, char *fmt)const
  *	may have been placed therein prior to the call here.	*
  ****************************************************************/
 
- 
+
 void ossimDms::set_default(char *fp, char *rp)const
 {
 	strcpy(fp, DEFAULT_FORMAT); 	/* assign default format */
@@ -766,11 +767,11 @@ void ossimDms::init_values(double d)const
    theSign = 1;
    if (d < 0.0)
       theSign = -1;
-   
+
    theWorking = d;
    theIntDegs = (int)theWorking * theSign;
    theDecDegs = (theWorking  * theSign) - theIntDegs;
-   
+
    return;
 }
 
@@ -814,14 +815,14 @@ double ossimDms::string_to_degree(const std::string& cdegrees)
    // original pointer so we can delete it at the bottom.
    //---
    char* cptr = copy;
-   
+
    strcpy(cptr, cdegrees.c_str());
-   
+
    double degrees, factor, dividend, units;
    int i;
    bool afterdelim;
    char c;
-   
+
    theAfterDot = false;
    afterdelim = false;
    degrees = 0.0;
@@ -829,23 +830,23 @@ double ossimDms::string_to_degree(const std::string& cdegrees)
    factor = 1.0;
    dividend = 60.0;
    theSign = 1;
-   
+
    /* get rid of leading spaces */
-   
+
    while (*cptr == ' ')
       cptr++;
-   
+
    while(*cptr != '\0')
    {
       switch (*cptr)
       {
-         
+
          /* north, west and + values will change sign of degrees to plus */
          case '+':
          case 'n':
          case 'N':
          case 'e':
-         case 'E': 
+         case 'E':
          {
             if(toupper(*cptr) == 'N')
             {
@@ -859,14 +860,14 @@ double ossimDms::string_to_degree(const std::string& cdegrees)
             cptr++;
             break;
          }
-         
+
          /* south, east and - values will change sign of degrees to minus */
-         
+
          case '-':
          case 's':
          case 'S':
          case 'w':
-         case 'W': 
+         case 'W':
          {
             if(toupper(*cptr) == 'S')
             {
@@ -880,7 +881,7 @@ double ossimDms::string_to_degree(const std::string& cdegrees)
             cptr++;
             break;
          }
-         
+
          case '0':
          case '1':
          case '2':
@@ -894,34 +895,34 @@ double ossimDms::string_to_degree(const std::string& cdegrees)
          {
             c = *cptr;
             i = (c - '0');
-            
+
             if (afterdelim == true) {
-               
-               if (theAfterDot == true) 
+
+               if (theAfterDot == true)
                   units = units + (((double)i * factor) / dividend);
                else
                   units = (units * factor) + ((double)i / dividend);
             }
             else {
-               
+
                if (theAfterDot == true)
                   degrees = degrees + ((double)i * factor);
                else
                   degrees = (degrees * factor) + (double)i;
             }
-            
-            if (theAfterDot == true) 
+
+            if (theAfterDot == true)
                factor = factor * .10;
             else
                factor = 10.;
-            
+
             cptr++;
             break;
          }
-            
+
          /* a decimal point indicates a change in the factor used */
          /* to calculate degrees or units (minutes or seconds)    */
-            
+
          case '.':
          {
             factor = .10;
@@ -929,51 +930,51 @@ double ossimDms::string_to_degree(const std::string& cdegrees)
             cptr++;
             break;
          }
-         
+
          /* after a delimiter the value contains minutes, first time through */
-         
+
          case ' ':
          {
-            
-            while (*(cptr + 1) == ' ') 
+
+            while (*(cptr + 1) == ' ')
                cptr++;
-            
+
             degrees = degrees + units;
             units = 0.0;
-            
+
             if (afterdelim == true) 	/* must be seconds */
                dividend = dividend * dividend;
-            else 
+            else
                afterdelim = true;
-            
+
             factor = 1.;
-            
+
             cptr++;
-            
+
             /* skip any leading zeroes after delimiter */
-            
+
             while (*cptr == '0')
                cptr++;
-            
+
             break;
          }
-            
+
          /* check for a delimiter that is allowable:
             isspace allows: space, tab, cr, nl, vt, ff
             ispunct allows: punctuation char != space or control or letter */
-         
+
          default:
          {
             if (isspace(*cptr) || ispunct(*cptr))
                *cptr = ' ';
          }
-         
+
       }	/* end switch */
-      
+
    }	/* end while loop */
-   
+
    /* add any units that may have been calculated (minutes or seconds) */
-   
+
    degrees = degrees + units;
 
    //---
@@ -982,6 +983,6 @@ double ossimDms::string_to_degree(const std::string& cdegrees)
    //---
    delete [] copy;
    copy = 0;
-   
+
    return(degrees * (double)theSign);
 }
diff --git a/Utilities/otbossim/src/ossim/base/ossimEquTokenizer.cpp b/Utilities/otbossim/src/ossim/base/ossimEquTokenizer.cpp
index 552a15dfd3..437c47a9b6 100644
--- a/Utilities/otbossim/src/ossim/base/ossimEquTokenizer.cpp
+++ b/Utilities/otbossim/src/ossim/base/ossimEquTokenizer.cpp
@@ -25,6 +25,7 @@
 
 #include <stdlib.h>
 #include <iostream>
+#include <fstream>
 using namespace std;
 
 /* Use prototypes in function declarations. */
@@ -657,21 +658,21 @@ YY_RULE_SETUP
 case 6:
 YY_RULE_SETUP
 #line 33 "ossimEquTokenizer.l"
-{ 
+{
                return OSSIM_EQU_TOKEN_OR_BAR;
            }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
 #line 37 "ossimEquTokenizer.l"
-{ 
+{
                return OSSIM_EQU_TOKEN_AMPERSAND;
            }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
 #line 40 "ossimEquTokenizer.l"
-{ 
+{
                return OSSIM_EQU_TOKEN_TILDE;
            }
 	YY_BREAK
@@ -771,7 +772,7 @@ YY_RULE_SETUP
 #line 84 "ossimEquTokenizer.l"
 {
                return OSSIM_EQU_TOKEN_EXP;
-           } 
+           }
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
diff --git a/Utilities/otbossim/src/ossim/base/ossimGeoref.cpp b/Utilities/otbossim/src/ossim/base/ossimGeoref.cpp
index 48835806c5..e414f2a937 100644
--- a/Utilities/otbossim/src/ossim/base/ossimGeoref.cpp
+++ b/Utilities/otbossim/src/ossim/base/ossimGeoref.cpp
@@ -2,6 +2,7 @@
 
 #include <cstdlib>
 #include <cstring>
+#include <cstdio>
 #include <cmath>
 #include <cctype>
 
@@ -25,7 +26,7 @@ ossimGeoref::ossimGeoref(const ossimString &georefString,
                          long precision)
 {
    double lat, lon;
-   
+
    long result = Convert_GEOREF_To_Geodetic(const_cast<char*>(georefString.c_str()),
                                             &lat,
                                             &lon);
@@ -48,7 +49,7 @@ ossimGeoref::ossimGeoref()
 ossimString ossimGeoref::toString(long precision)
 {
    char resultString[100];
-   
+
    long result = Convert_Geodetic_To_GEOREF(thePt.latr(),
                                             thePt.lonr(),
                                             precision,
@@ -93,7 +94,7 @@ ossimString ossimGeoref::toString(long precision)
 
 /***************************************************************************/
 /*
- *                              FUNCTIONS     
+ *                              FUNCTIONS
  */
 
 
@@ -101,8 +102,8 @@ long Extract_Degrees (char *georef,
                       double *latitude,
                       double *longitude)
 { /* BEGIN Extract_Degrees */
-/*    
- *  This function extracts the latitude and longitude degree parts of the 
+/*
+ *  This function extracts the latitude and longitude degree parts of the
  *  GEOREF string.  The latitude and longitude degree parts are the first four
  *  characters.
  *
@@ -153,7 +154,7 @@ long Extract_Minutes (char *georef,
                       long ERROR_TYPE,
                       double *minutes)
 { /* BEGIN Extract_Minutes */
-/*    
+/*
  *  This function extracts the minutes from the GEOREF string.  The minutes
  *  part begins at position start and has length length.  The ERROR_TYPE is
  *  to allow this function to work with both latitude and longitude minutes.
@@ -206,7 +207,7 @@ void Convert_Minutes_To_String(double minutes,
                                long precision,
                                char *str)
 { /* BEGIN Convert_Minutes_To_String */
-/*    
+/*
  *  This function converts minutes to a string of length precision.
  *
  *    minutes       : Minutes to be converted                  (input)
@@ -227,7 +228,7 @@ void Convert_Minutes_To_String(double minutes,
 
 
 long ossimGeoref::Convert_GEOREF_To_Geodetic (char *georef,
-                                              double *latitude, 
+                                              double *latitude,
                                               double *longitude)
 { /* BEGIN Convert_GEOREF_To_Geodetic */
 /*
@@ -255,7 +256,7 @@ long ossimGeoref::Convert_GEOREF_To_Geodetic (char *georef,
   origin_long = (double)LONGITUDE_LOW;
   origin_lat = (double)LATITUDE_LOW;
   georef_length = strlen(georef);
-  if ((georef_length < GEOREF_MINIMUM) || (georef_length > GEOREF_MAXIMUM) 
+  if ((georef_length < GEOREF_MINIMUM) || (georef_length > GEOREF_MAXIMUM)
       || ((georef_length % 2) != 0))
   {
     error_code |= GEOREF_STR_ERROR;
@@ -267,7 +268,7 @@ long ossimGeoref::Convert_GEOREF_To_Geodetic (char *georef,
     minutes_length = (georef_length - start) / 2;
     if (!error_code)
     {
-      error_code |= Extract_Minutes(georef, start, minutes_length, 
+      error_code |= Extract_Minutes(georef, start, minutes_length,
                                     GEOREF_STR_LON_MIN_ERROR, &long_minutes);
       if (!error_code)
       {
@@ -289,7 +290,7 @@ long ossimGeoref::Convert_Geodetic_To_GEOREF (double latitude,
                                               long precision,
                                               char *georef)
 { /* BEGIN Convert_Geodetic_To_GEOREF */
-/*   
+/*
  *  This function converts Geodetic (latitude and longitude in radians)
  *  coordinates to a GEOREF coordinate string.  Precision specifies the
  *  number of digits in the GEOREF string for latitude and longitude:
@@ -322,10 +323,10 @@ long ossimGeoref::Convert_Geodetic_To_GEOREF (double latitude,
 
   latitude = latitude * RADIAN_TO_DEGREE;
   longitude = longitude * RADIAN_TO_DEGREE;
-  if ((latitude < (double)LATITUDE_LOW) 
+  if ((latitude < (double)LATITUDE_LOW)
       || (latitude > (double)LATITUDE_HIGH))
     error_code |= GEOREF_LAT_ERROR;
-  if ((longitude < (double)LONGITUDE_LOW) 
+  if ((longitude < (double)LONGITUDE_LOW)
       || (longitude > (double)LONGITUDE_HIGH))
     error_code |= GEOREF_LON_ERROR;
   if ((precision < 0) || (precision > MAX_PRECISION))
diff --git a/Utilities/otbossim/src/ossim/base/ossimRegExp.cpp b/Utilities/otbossim/src/ossim/base/ossimRegExp.cpp
index 1a557f9e3a..32defd4c10 100644
--- a/Utilities/otbossim/src/ossim/base/ossimRegExp.cpp
+++ b/Utilities/otbossim/src/ossim/base/ossimRegExp.cpp
@@ -1,4 +1,4 @@
- 
+
 //
 // Copyright (C) 1991 Texas Instruments Incorporated.
 //
@@ -116,12 +116,13 @@
 //
 
 #include <cstring>
+#include <cstdio>
 #include <ossim/base/ossimRegExp.h>
 
 // ossimRegExp -- Copies the given regular expression.
 
 ossimRegExp::ossimRegExp (const ossimRegExp& rxp) {
-  int ind; 
+  int ind;
   this->progsize = rxp.progsize;		// Copy regular expression size
   this->program = new char[this->progsize];	// Allocate storage
   for(ind=this->progsize; ind-- != 0;)		// Copy regular expresion
@@ -153,10 +154,10 @@ bool ossimRegExp::operator== (const ossimRegExp& rxp) const {
     if (ind != rxp.progsize)			// If different size regexp
       return false;				// Return failure
     while(ind-- != 0)				// Else while still characters
-      if(this->program[ind] != rxp.program[ind]) // If regexp are different    
-	return false;				 // Return failure             
+      if(this->program[ind] != rxp.program[ind]) // If regexp are different
+	return false;				 // Return failure
   }
-  return true;					// Else same, return success  
+  return true;					// Else same, return success
 }
 
 
@@ -168,18 +169,18 @@ bool ossimRegExp::deep_equal (const ossimRegExp& rxp) const {
   if (ind != rxp.progsize)			// If different size regexp
     return false;				// Return failure
   while(ind-- != 0)		 		// Else while still characters
-    if(this->program[ind] != rxp.program[ind])	// If regexp are different    
-      return false;				// Return failure             
+    if(this->program[ind] != rxp.program[ind])	// If regexp are different
+      return false;				// Return failure
   return (this->startp[0] == rxp.startp[0] && 	// Else if same start/end ptrs,
 	  this->endp[0] == rxp.endp[0]);	// Return true
-}   
+}
 
 // The remaining code in this file is derived from the  regular expression code
 // whose  copyright statement appears  below.  It has been  changed to work
 // with the class concepts of C++ and COOL.
 
 /*
- * compile and find 
+ * compile and find
  *
  *	Copyright (c) 1986 by University of Toronto.
  *	Written by Henry Spencer.  Not derived from licensed software.
@@ -404,23 +405,23 @@ void ossimRegExp::compile (const char* exp) {
       }
     this->startp[0] = this->endp[0] = this->searchstring = NULL;
 
-    // Small enough for pointer-storage convention? 
-    if (regsize >= 32767L) {	// Probably could be 65535L. 
+    // Small enough for pointer-storage convention?
+    if (regsize >= 32767L) {	// Probably could be 65535L.
       //RAISE Error, SYM(ossimRegExp), SYM(Expr_Too_Big),
       printf ("ossimRegExp::compile(): Expression too big.\n");
       return;
     }
 
-    // Allocate space. 
+    // Allocate space.
 //#ifndef WIN32
-    if (this->program != NULL) delete [] this->program;  
+    if (this->program != NULL) delete [] this->program;
 //#endif
     this->program = new char[regsize];
     this->progsize = (int) regsize;
 
     if (this->program == NULL) {
       //RAISE Error, SYM(ossimRegExp), SYM(Out_Of_Memory),
-      printf ("ossimRegExp::compile(): Out of memory.\n"); 
+      printf ("ossimRegExp::compile(): Out of memory.\n");
       return;
     }
 
@@ -452,7 +453,7 @@ void ossimRegExp::compile (const char* exp) {
 	 // ties in favor of later strings, since the regstart check works
 	 // with the beginning of the r.e. and avoiding duplication
 	 // strengthens checking.  Not a strong reason, but sufficient in the
-	 // absence of others. 
+	 // absence of others.
 	 //
 	if (flags & SPSTART) {
 	    longest = NULL;
@@ -889,9 +890,9 @@ void ossimRegExp::regoptail (char* p, const char* val) {
 
 
 ////////////////////////////////////////////////////////////////////////
-// 
+//
 //  find and friends
-// 
+//
 ////////////////////////////////////////////////////////////////////////
 
 
@@ -934,7 +935,7 @@ bool ossimRegExp::find (const char* string) {
         printf ("ossimRegExp::find(): Compiled regular expression corrupted.\n");
         return 0;
     }
-    
+
     // If there is a "must appear" string, look for it.
     if (this->regmust != NULL) {
 	s = string;
@@ -946,14 +947,14 @@ bool ossimRegExp::find (const char* string) {
 	if (s == NULL)		// Not present.
 	    return (0);
     }
-     
+
     // Mark beginning of line for ^ .
     regbol = string;
 
     // Simplest case:  anchored match need be tried only once.
     if (this->reganch)
 	return (regtry(string, this->startp, this->endp, this->program));
-    
+
     // Messy cases:  unanchored match.
     s = string;
     if (this->regstart != '\0')
@@ -962,7 +963,7 @@ bool ossimRegExp::find (const char* string) {
 	    if (regtry(s, this->startp, this->endp, this->program))
 		return (1);
 	    s++;
-	  
+
 	}
     else
 	// We don't -- general case.
@@ -970,7 +971,7 @@ bool ossimRegExp::find (const char* string) {
 	    if (regtry(s, this->startp, this->endp, this->program))
 		return (1);
 	} while (*s++ != '\0');
-    
+
     // Failure.
     return (0);
 }
@@ -1088,7 +1089,7 @@ int ossimRegExp::regmatch (const char* prog) {
 
 			//
 			// Don't set startp if some later invocation of the
-			// same parentheses already has. 
+			// same parentheses already has.
 			//
 			if (regstartp[no] == NULL)
 			    regstartp[no] = save;
@@ -1117,7 +1118,7 @@ int ossimRegExp::regmatch (const char* prog) {
 
 			//
 			// Don't set endp if some later invocation of the
-			// same parentheses already has. 
+			// same parentheses already has.
 			//
 			if (regendp[no] == NULL)
 			    regendp[no] = save;
@@ -1128,7 +1129,7 @@ int ossimRegExp::regmatch (const char* prog) {
 		}
 //		break;
 	    case BRANCH:{
-	      
+
 	      register const char* save;
 
 		    if (OP(next) != BRANCH)	// No choice.
@@ -1155,7 +1156,7 @@ int ossimRegExp::regmatch (const char* prog) {
 
 		    //
 		    // Lookahead to avoid useless match attempts when we know
-		    // what character comes next. 
+		    // what character comes next.
 		    //
 		    nextch = '\0';
 		    if (OP(next) == EXACTLY)
@@ -1186,10 +1187,10 @@ int ossimRegExp::regmatch (const char* prog) {
 	scan = next;
     }
 
-    // 
+    //
     //  We get here only if there's trouble -- normally "case END" is the
-    //  terminating point. 
-    // 
+    //  terminating point.
+    //
     //RAISE Error, SYM(ossimRegExp), SYM(Internal_Error),
     printf ("ossimRegExp::find(): Internal error -- corrupted pointers.\n");
     return (0);
diff --git a/Utilities/otbossim/src/ossim/support_data/ossimDemUtil.cpp b/Utilities/otbossim/src/ossim/support_data/ossimDemUtil.cpp
index 1da272343b..f67111e2c6 100644
--- a/Utilities/otbossim/src/ossim/support_data/ossimDemUtil.cpp
+++ b/Utilities/otbossim/src/ossim/support_data/ossimDemUtil.cpp
@@ -1,5 +1,5 @@
 //*******************************************************************
-// Copyright (C) 2000 ImageLinks Inc. 
+// Copyright (C) 2000 ImageLinks Inc.
 //
 // License:  LGPL
 //
@@ -15,6 +15,7 @@
 
 #include <stdlib.h>
 #include <iostream>
+#include <fstream>
 
 #include <ossim/support_data/ossimDemUtil.h>
 
@@ -44,7 +45,7 @@ ossimDemUtil::getRecord(istream& s, char* buf, long reclength)
 
    long curpos = 0;
    buf[curpos] = s.get();
-   while ((buf[curpos] != EOF) && 
+   while ((buf[curpos] != EOF) &&
           (buf[curpos] != '\n') &&
           (curpos < reclength-1))
    {
-- 
GitLab