Skip to content
Permalink
Browse files

Merge pull request #255 from rouault/master

Fix errors in the usage of setlocale() and CPLGetConfigOption()
  • Loading branch information
timlinux committed Sep 28, 2012
2 parents aaa5040 + 82a22f0 commit 23352ce0d66855a4a9c403a81feaa1884415e45c
Showing with 8 additions and 2 deletions.
  1. +5 −1 src/core/qgscoordinatereferencesystem.cpp
  2. +3 −1 src/providers/gdal/qgsgdalprovider.cpp
@@ -900,7 +900,10 @@ void QgsCoordinateReferenceSystem::setDescription( QString theDescription )
}
void QgsCoordinateReferenceSystem::setProj4String( QString theProj4String )
{
const char *oldlocale = setlocale( LC_NUMERIC, NULL );
char *oldlocale = setlocale( LC_NUMERIC, NULL );
/* the next setlocale() invalides the return of previous setlocale() */
if (oldlocale != NULL)
oldlocale = strdup(oldlocale);

setlocale( LC_NUMERIC, "C" );
OSRDestroySpatialReference( mCRS );
@@ -916,6 +919,7 @@ void QgsCoordinateReferenceSystem::setProj4String( QString theProj4String )
#endif

setlocale( LC_NUMERIC, oldlocale );
free(oldlocale);
}
void QgsCoordinateReferenceSystem::setGeographicFlag( bool theGeoFlag )
{
@@ -1377,7 +1377,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
}

// are we using Erdas Imagine external overviews?
const char* myConfigUseRRD = CPLGetConfigOption( "USE_RRD", "NO" );
char* myConfigUseRRD = strdup(CPLGetConfigOption( "USE_RRD", "NO" ));
if ( theFormat == PyramidsErdas )
CPLSetConfigOption( "USE_RRD", "YES" );
else
@@ -1471,6 +1471,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
//emit drawingProgress( 0, 0 );
// restore former USE_RRD config (Erdas)
CPLSetConfigOption( "USE_RRD", myConfigUseRRD );
free(myConfigUseRRD);
return "FAILED_NOT_SUPPORTED";
}
else
@@ -1487,6 +1488,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste

// restore former USE_RRD config (Erdas)
CPLSetConfigOption( "USE_RRD", myConfigUseRRD );
free(myConfigUseRRD);

QgsDebugMsg( "Pyramid overviews built" );

0 comments on commit 23352ce

Please sign in to comment.
You can’t perform that action at this time.