[GRASS-SVN] r45181 - grass/trunk/vector/v.out.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 25 11:04:33 EST 2011


Author: martinl
Date: 2011-01-25 08:04:32 -0800 (Tue, 25 Jan 2011)
New Revision: 45181

Modified:
   grass/trunk/vector/v.out.ogr/list.c
Log:
v.out.ogr: fix OGR_list_write_drivers()


Modified: grass/trunk/vector/v.out.ogr/list.c
===================================================================
--- grass/trunk/vector/v.out.ogr/list.c	2011-01-25 15:59:37 UTC (rev 45180)
+++ grass/trunk/vector/v.out.ogr/list.c	2011-01-25 16:04:32 UTC (rev 45181)
@@ -14,20 +14,23 @@
     /* Open OGR DSN */
     OGRRegisterAll();
     G_debug(2, "driver count = %d", OGRGetDriverCount());
-    drn = -1;
+    drn = 0;
     for (i = 0; i < OGRGetDriverCount(); i++) {
 	/* only fetch read/write drivers */
-	if (OGR_Dr_TestCapability(OGRGetDriver(i), ODrCCreateDataSource)) {
-	    Ogr_driver = OGRGetDriver(i);
-	    G_debug(2, "driver %d/%d : %s", i, OGRGetDriverCount(),
-		    OGR_Dr_GetName(Ogr_driver));
-	    /* chg white space to underscore in OGR driver names */
-	    sprintf(buf, "%s", OGR_Dr_GetName(Ogr_driver));
-	    G_strchg(buf, ' ', '_');
-	    strcat(OGRdrivers, buf);
-	    if (i < OGRGetDriverCount() - 1)
-		strcat(OGRdrivers, ",");
-	}
+	if (!OGR_Dr_TestCapability(OGRGetDriver(i), ODrCCreateDataSource))
+	    continue;
+	
+	if (drn)
+	    strcat(OGRdrivers, ",");
+	
+	Ogr_driver = OGRGetDriver(i);
+	G_debug(2, "driver %d/%d : %s", i, OGRGetDriverCount(),
+		OGR_Dr_GetName(Ogr_driver));
+	/* chg white space to underscore in OGR driver names */
+	sprintf(buf, "%s", OGR_Dr_GetName(Ogr_driver));
+	G_strchg(buf, ' ', '_');
+	strcat(OGRdrivers, buf);
+	drn++;
     }
     G_debug(2, "all drivers: %s", OGRdrivers);
 



More information about the grass-commit mailing list