Skip to content

Commit b642e80

Browse files
author
jef
committedFeb 21, 2011
fix #3137
git-svn-id: http://svn.osgeo.org/qgis/trunk@15238 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 47fa1ce commit b642e80

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎src/core/qgsvectorfilewriter.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
9090
vectorFileName += ".shp";
9191
}
9292

93+
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM < 1700
9394
// check for unique fieldnames
9495
QSet<QString> fieldNames;
9596
QgsFieldMap::const_iterator fldIt;
@@ -105,6 +106,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
105106
}
106107
fieldNames << name;
107108
}
109+
#endif
108110

109111
deleteShapeFile( vectorFileName );
110112
}
@@ -329,6 +331,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
329331
int ogrIdx = OGR_FD_GetFieldIndex( defn, mCodec->fromUnicode( attrField.name() ) );
330332
if ( ogrIdx < 0 )
331333
{
334+
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM < 1700
332335
// if we didn't find our new column, assume it's name was truncated and
333336
// it was the last one added (like for shape files)
334337
int fieldCount = OGR_FD_GetFieldCount( defn );
@@ -343,6 +346,10 @@ QgsVectorFileWriter::QgsVectorFileWriter(
343346
ogrIdx = fieldCount - 1;
344347
}
345348
}
349+
#else
350+
// GDAL 1.7 not just truncates, but launders more aggressivly.
351+
ogrIdx = OGR_FD_GetFieldCount( defn ) - 1;
352+
#endif
346353

347354
if ( ogrIdx < 0 )
348355
{

0 commit comments

Comments
 (0)
Please sign in to comment.