[QGIS Commit] r15238 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Feb 21 17:41:55 EST 2011


Author: jef
Date: 2011-02-21 14:41:55 -0800 (Mon, 21 Feb 2011)
New Revision: 15238

Modified:
   trunk/qgis/src/core/qgsvectorfilewriter.cpp
Log:
fix #3137

Modified: trunk/qgis/src/core/qgsvectorfilewriter.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorfilewriter.cpp	2011-02-21 22:26:35 UTC (rev 15237)
+++ trunk/qgis/src/core/qgsvectorfilewriter.cpp	2011-02-21 22:41:55 UTC (rev 15238)
@@ -90,6 +90,7 @@
       vectorFileName += ".shp";
     }
 
+#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM < 1700
     // check for unique fieldnames
     QSet<QString> fieldNames;
     QgsFieldMap::const_iterator fldIt;
@@ -105,6 +106,7 @@
       }
       fieldNames << name;
     }
+#endif
 
     deleteShapeFile( vectorFileName );
   }
@@ -329,6 +331,7 @@
     int ogrIdx = OGR_FD_GetFieldIndex( defn, mCodec->fromUnicode( attrField.name() ) );
     if ( ogrIdx < 0 )
     {
+#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM < 1700
       // if we didn't find our new column, assume it's name was truncated and
       // it was the last one added (like for shape files)
       int fieldCount = OGR_FD_GetFieldCount( defn );
@@ -343,6 +346,10 @@
           ogrIdx = fieldCount - 1;
         }
       }
+#else
+      // GDAL 1.7 not just truncates, but launders more aggressivly.
+      ogrIdx = OGR_FD_GetFieldCount( defn ) - 1;
+#endif
 
       if ( ogrIdx < 0 )
       {



More information about the QGIS-commit mailing list