@@ -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 =
@@ -1001,11 +1003,7 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )
1001
1003
1002
1004
QgsAttributes attrs = f.attributes ();
1003
1005
1004
- char *oldlocale = setlocale ( LC_NUMERIC, NULL );
1005
- if ( oldlocale )
1006
- oldlocale = strdup ( oldlocale );
1007
-
1008
- setlocale ( LC_NUMERIC, " C" );
1006
+ QgsLocaleNumC l;
1009
1007
1010
1008
// add possible attribute information
1011
1009
for ( int targetAttributeId = 0 ; targetAttributeId < attrs.count (); ++targetAttributeId )
@@ -1084,10 +1082,6 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )
1084
1082
}
1085
1083
OGR_F_Destroy ( feature );
1086
1084
1087
- setlocale ( LC_NUMERIC, oldlocale );
1088
- if ( oldlocale )
1089
- free ( oldlocale );
1090
-
1091
1085
return returnValue;
1092
1086
}
1093
1087
@@ -1222,10 +1216,7 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap &attr_
1222
1216
continue ;
1223
1217
}
1224
1218
1225
- char *oldlocale = setlocale ( LC_NUMERIC, NULL );
1226
- if ( oldlocale )
1227
- oldlocale = strdup ( oldlocale );
1228
- setlocale ( LC_NUMERIC, " C" );
1219
+ QgsLocaleNumC l;
1229
1220
1230
1221
for ( QgsAttributeMap::const_iterator it2 = attr.begin (); it2 != attr.end (); ++it2 )
1231
1222
{
@@ -1287,10 +1278,6 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap &attr_
1287
1278
{
1288
1279
pushError ( tr ( " OGR error setting feature %1: %2" ).arg ( fid ).arg ( CPLGetLastErrorMsg () ) );
1289
1280
}
1290
-
1291
- setlocale ( LC_NUMERIC, oldlocale );
1292
- if ( oldlocale )
1293
- free ( oldlocale );
1294
1281
}
1295
1282
1296
1283
if ( OGR_L_SyncToDisk ( ogrLayer ) != OGRERR_NONE )
0 commit comments