@@ -19,6 +19,7 @@ email : sherman at mrcc.com
19
19
#include " qgsogrfeatureiterator.h"
20
20
#include " qgslogger.h"
21
21
#include " qgsmessagelog.h"
22
+ #include " qgslocalec.h"
22
23
23
24
#define CPL_SUPRESS_CPLUSPLUS
24
25
#include < gdal.h> // to collect version information
@@ -45,6 +46,7 @@ email : sherman at mrcc.com
45
46
#include " qgsgeometry.h"
46
47
#include " qgscoordinatereferencesystem.h"
47
48
#include " qgsvectorlayerimport.h"
49
+ #include " qgslocalec.h"
48
50
49
51
static const QString TEXT_PROVIDER_KEY = " ogr" ;
50
52
static const QString TEXT_PROVIDER_DESCRIPTION =
@@ -1003,11 +1005,7 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )
1003
1005
1004
1006
const QgsAttributes& attrs = f.attributes ();
1005
1007
1006
- char *oldlocale = setlocale ( LC_NUMERIC, NULL );
1007
- if ( oldlocale )
1008
- oldlocale = strdup ( oldlocale );
1009
-
1010
- setlocale ( LC_NUMERIC, " C" );
1008
+ QgsLocaleNumC l;
1011
1009
1012
1010
// add possible attribute information
1013
1011
for ( int targetAttributeId = 0 ; targetAttributeId < attrs.count (); ++targetAttributeId )
@@ -1086,10 +1084,6 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )
1086
1084
}
1087
1085
OGR_F_Destroy ( feature );
1088
1086
1089
- setlocale ( LC_NUMERIC, oldlocale );
1090
- if ( oldlocale )
1091
- free ( oldlocale );
1092
-
1093
1087
return returnValue;
1094
1088
}
1095
1089
@@ -1224,10 +1218,7 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap &attr_
1224
1218
continue ;
1225
1219
}
1226
1220
1227
- char *oldlocale = setlocale ( LC_NUMERIC, NULL );
1228
- if ( oldlocale )
1229
- oldlocale = strdup ( oldlocale );
1230
- setlocale ( LC_NUMERIC, " C" );
1221
+ QgsLocaleNumC l;
1231
1222
1232
1223
for ( QgsAttributeMap::const_iterator it2 = attr.begin (); it2 != attr.end (); ++it2 )
1233
1224
{
@@ -1289,10 +1280,6 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap &attr_
1289
1280
{
1290
1281
pushError ( tr ( " OGR error setting feature %1: %2" ).arg ( fid ).arg ( CPLGetLastErrorMsg () ) );
1291
1282
}
1292
-
1293
- setlocale ( LC_NUMERIC, oldlocale );
1294
- if ( oldlocale )
1295
- free ( oldlocale );
1296
1283
}
1297
1284
1298
1285
if ( OGR_L_SyncToDisk ( ogrLayer ) != OGRERR_NONE )
0 commit comments