Skip to content

Commit

Permalink
Remove unneeded variable
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Feb 4, 2016
1 parent 27f1637 commit 768f0e8
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/core/qgsvectorfilewriter.cpp
Expand Up @@ -1724,8 +1724,6 @@ bool QgsVectorFileWriter::addFeature( QgsFeature& feature, QgsFeatureRendererV2*

OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
{
QgsLocaleNumC l;

OGRFeatureH poFeature = OGR_F_Create( OGR_L_GetLayerDefn( mLayer ) );

qint64 fid = FID_TO_NUMBER( feature.id() );
Expand Down

4 comments on commit 768f0e8

@jef-n
Copy link
Member

@jef-n jef-n commented on 768f0e8 Feb 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was supposed to avoid wrong decimal delimiters (ie. comma vs. points) - is that now handled elsewhere?

@m-kuhn
Copy link
Member Author

@m-kuhn m-kuhn commented on 768f0e8 Feb 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm... who works with strange locales anyway 😇

@mbernasocchi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jef-n are we sure that this works? I wrote a test case where it does not:

# use any locale with comma decimal separator
test_locale = 'it_IT.UTF-8'
orig_path = './test_data.shp'

# this file will have numbers with comma in the dbf
dest_path = './result.shp'

# end config

import sys, locale
from qgis.core import QgsVectorFileWriter, QgsVectorLayer, QgsApplication

# init QGIS
qgs = QgsApplication(sys.argv, False)
qgs.initQgis()

l = QgsVectorLayer(orig_path, 'test layer', 'ogr')
print 'feature Count %s' % l.featureCount()

old_locale = locale.getlocale(locale.LC_NUMERIC)
locale.setlocale(locale.LC_NUMERIC, test_locale)
QgsVectorFileWriter.writeAsVectorFormat(l, dest_path, 'UTF-8', l.crs(), 'ESRI Shapefile')
locale.setlocale(locale.LC_NUMERIC, old_locale)

msg = 'open %s with a text editor and you should find numbers separated by comma'
print msg % dest_path.replace('shp', 'dbf')

locale_bug.zip

do you want me to file a bug report?

@m-kuhn
Copy link
Member Author

@m-kuhn m-kuhn commented on 768f0e8 Feb 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbernasocchi I don't remember exactly, but I guess that's on me... Can you open a pull request with this (failing) unit test?

Please sign in to comment.