[GRASS-SVN] r45033 - grass/branches/releasebranch_6_4/vector/v.out.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 14 15:24:03 EST 2011


Author: benducke
Date: 2011-01-14 12:24:03 -0800 (Fri, 14 Jan 2011)
New Revision: 45033

Modified:
   grass/branches/releasebranch_6_4/vector/v.out.ogr/main.c
Log:
Two simple guard statements added to mk_att() to prevent it from throwing some ugly "index out of range" errors when the 's' flag is given.

Modified: grass/branches/releasebranch_6_4/vector/v.out.ogr/main.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.out.ogr/main.c	2011-01-14 20:06:10 UTC (rev 45032)
+++ grass/branches/releasebranch_6_4/vector/v.out.ogr/main.c	2011-01-14 20:24:03 UTC (rev 45033)
@@ -988,10 +988,15 @@
 							  (Column));
 
 			/* Reset */
-			OGR_F_UnsetField(Ogr_feature, ogrfieldnum);
+			if ( ( ( nocat ) && (strcmp(Fi->key, db_get_column_name(Column)) == 0) ) == 0 ) {
+				/* if this is 'cat', then execute the following only if the '-s' flag was NOT given*/
+				OGR_F_UnsetField(Ogr_feature, ogrfieldnum);
+			}
 
 			/* prevent writing NULL values */
 			if (!db_test_value_isnull(Value)) {
+				if ( ( (nocat) && (strcmp(Fi->key, db_get_column_name(Column)) == 0) ) == 0 ) {
+				/* if this is 'cat', then execute the following only if the '-s' flag was NOT given*/
 			    switch (colctype) {
 			    case DB_C_TYPE_INT:
 				OGR_F_SetFieldInteger(Ogr_feature,
@@ -1018,6 +1023,7 @@
 				break;
 			    }
 			}
+			}
 		    }
 		}
 		db_close_cursor(&cursor);



More information about the grass-commit mailing list