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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 28 12:54:59 EST 2010


Author: mmetz
Date: 2010-11-28 09:54:59 -0800 (Sun, 28 Nov 2010)
New Revision: 44465

Modified:
   grass/trunk/vector/v.out.ogr/args.c
   grass/trunk/vector/v.out.ogr/attrb.c
   grass/trunk/vector/v.out.ogr/create.c
   grass/trunk/vector/v.out.ogr/list.c
Log:
format all code

Modified: grass/trunk/vector/v.out.ogr/args.c
===================================================================
--- grass/trunk/vector/v.out.ogr/args.c	2010-11-28 17:54:31 UTC (rev 44464)
+++ grass/trunk/vector/v.out.ogr/args.c	2010-11-28 17:54:59 UTC (rev 44465)
@@ -3,14 +3,15 @@
 #include "local_proto.h"
 
 void parse_args(int argc, char **argv,
-		struct Options* options, struct Flags *flags)
+		struct Options *options, struct Flags *flags)
 {
     options->input = G_define_standard_option(G_OPT_V_INPUT);
 
     options->type = G_define_standard_option(G_OPT_V3_TYPE);
-    options->type->options = "point,line,boundary,centroid,area,face,kernel,auto";
+    options->type->options =
+	"point,line,boundary,centroid,area,face,kernel,auto";
     options->type->answer = "auto";
-    
+
     options->type->label = _("Feature type(s)");
     options->type->description =
 	_("Combination of types is not supported "
@@ -34,7 +35,8 @@
     options->layer->required = NO;
     options->layer->label =
 	_("OGR layer name. If not specified, input name is used.");
-    options->layer->description = _("For example: ESRI Shapefile: shapefile name");
+    options->layer->description =
+	_("For example: ESRI Shapefile: shapefile name");
     options->layer->guisection = _("Creation");
 
     options->format = G_define_option();
@@ -73,17 +75,19 @@
 
     flags->nocat = G_define_flag();
     flags->nocat->key = 's';
-    flags->nocat->description = _("Skip export of GRASS category ID ('cat') attribute");
+    flags->nocat->description =
+	_("Skip export of GRASS category ID ('cat') attribute");
 
     flags->cat = G_define_flag();
     flags->cat->key = 'c';
-    flags->cat->description = _("Also export features without category (not labeled). "
-			      "Otherwise only features with category are exported.");
+    flags->cat->description =
+	_("Also export features without category (not labeled). "
+	  "Otherwise only features with category are exported.");
 
     flags->esristyle = G_define_flag();
     flags->esristyle->key = 'e';
     flags->esristyle->description = _("Use ESRI-style .prj file format "
-			       "(applies to Shapefile output only)");
+				      "(applies to Shapefile output only)");
 
     flags->poly = G_define_flag();
     flags->poly->key = 'p';
@@ -91,8 +95,9 @@
 
     flags->new = G_define_flag();
     flags->new->key = 'n';
-    flags->new->description = _("Create a new empty OGR layer in defined OGR datasource and exit. Nothing is read from input.");
-    
+    flags->new->description =
+	_("Create a new empty OGR layer in defined OGR datasource and exit. Nothing is read from input.");
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 }

Modified: grass/trunk/vector/v.out.ogr/attrb.c
===================================================================
--- grass/trunk/vector/v.out.ogr/attrb.c	2010-11-28 17:54:31 UTC (rev 44464)
+++ grass/trunk/vector/v.out.ogr/attrb.c	2010-11-28 17:54:59 UTC (rev 44465)
@@ -3,7 +3,8 @@
 #include "local_proto.h"
 
 int mk_att(int cat, struct field_info *Fi, dbDriver *Driver, int ncol,
-	   int doatt, int nocat, OGRFeatureH Ogr_feature, int *noatt, int *fout)
+	   int doatt, int nocat, OGRFeatureH Ogr_feature, int *noatt,
+	   int *fout)
 {
     int j, ogrfieldnum;
     char buf[2000];
@@ -22,8 +23,8 @@
     if (!doatt) {
 	ogrfieldnum = OGR_F_GetFieldIndex(Ogr_feature, "cat");
 	OGR_F_UnsetField(Ogr_feature, ogrfieldnum);
-    /* doatt reset moved into have cat loop as the table needs to be
-	open to know the OGR field ID. Hopefully this has no ill consequences */
+	/* doatt reset moved into have cat loop as the table needs to be
+	   open to know the OGR field ID. Hopefully this has no ill consequences */
     }
 
     /* Read & set attributes */
@@ -45,13 +46,15 @@
 		    /* G_warning ("No database record for cat = %d", cat); */
 		    /* Set at least key column to category */
 		    if (!nocat) {
-                ogrfieldnum = OGR_F_GetFieldIndex(Ogr_feature, Fi->key);
-                OGR_F_SetFieldInteger(Ogr_feature, ogrfieldnum, cat);
-                (*noatt)++;
-		    } else {
-                G_fatal_error (_("No database record for cat = %d and export of 'cat' disabled"),
-                                cat);
+			ogrfieldnum =
+			    OGR_F_GetFieldIndex(Ogr_feature, Fi->key);
+			OGR_F_SetFieldInteger(Ogr_feature, ogrfieldnum, cat);
+			(*noatt)++;
 		    }
+		    else {
+			G_fatal_error(_("No database record for cat = %d and export of 'cat' disabled"),
+				      cat);
+		    }
 		}
 		else {
 		    Table = db_get_cursor_table(&cursor);
@@ -67,10 +70,11 @@
 			G_debug(2, "  colctype = %d", colctype);
 
 			ogrfieldnum = OGR_F_GetFieldIndex(Ogr_feature,
-							  db_get_column_name(Column));
-			G_debug(2, "  column = %s -> fieldnum = %d", 
+							  db_get_column_name
+							  (Column));
+			G_debug(2, "  column = %s -> fieldnum = %d",
 				db_get_column_name(Column), ogrfieldnum);
-			
+
 			/* Reset */
 			OGR_F_UnsetField(Ogr_feature, ogrfieldnum);
 
@@ -78,30 +82,34 @@
 			if (!db_test_value_isnull(Value)) {
 			    switch (colctype) {
 			    case DB_C_TYPE_INT:
-				OGR_F_SetFieldInteger(Ogr_feature, ogrfieldnum,
-						      db_get_value_int(Value));
+				OGR_F_SetFieldInteger(Ogr_feature,
+						      ogrfieldnum,
+						      db_get_value_int
+						      (Value));
 				break;
 			    case DB_C_TYPE_DOUBLE:
 				OGR_F_SetFieldDouble(Ogr_feature, ogrfieldnum,
-						     db_get_value_double(Value));
+						     db_get_value_double
+						     (Value));
 				break;
 			    case DB_C_TYPE_STRING:
 				OGR_F_SetFieldString(Ogr_feature, ogrfieldnum,
-						     db_get_value_string(Value));
+						     db_get_value_string
+						     (Value));
 				break;
 			    case DB_C_TYPE_DATETIME:
 				db_convert_column_value_to_string(Column,
 								  &dbstring);
 				OGR_F_SetFieldString(Ogr_feature, ogrfieldnum,
-						     db_get_string(&dbstring));
+						     db_get_string
+						     (&dbstring));
 				break;
 			    }
 			}
 		    }
 		}
-		db_close_cursor (&cursor);
+		db_close_cursor(&cursor);
 	    }
-
 	}
 	else {			/* Use cat only */
 	    ogrfieldnum = OGR_F_GetFieldIndex(Ogr_feature, "cat");

Modified: grass/trunk/vector/v.out.ogr/create.c
===================================================================
--- grass/trunk/vector/v.out.ogr/create.c	2010-11-28 17:54:31 UTC (rev 44464)
+++ grass/trunk/vector/v.out.ogr/create.c	2010-11-28 17:54:59 UTC (rev 44465)
@@ -3,34 +3,36 @@
 #include "local_proto.h"
 
 void create_ogr_layer(const char *dsn, const char *format, const char *layer,
-		      unsigned int wkbtype, const char **papszDSCO, const char **papszLCO)
+		      unsigned int wkbtype, char **papszDSCO,
+		      char **papszLCO)
 {
     char *pszDriverName;
     OGRSFDriverH hDriver;
     OGRDataSourceH hDS;
     OGRLayerH hLayer;
-    
+
     pszDriverName = G_store(format);
-    G_strchg(pszDriverName, '_', ' '); /* '_' -> ' ' */
+    G_strchg(pszDriverName, '_', ' ');	/* '_' -> ' ' */
 
     /* start driver */
     hDriver = OGRGetDriverByName(pszDriverName);
-    if(hDriver == NULL) {
-        G_fatal_error(_("OGR driver <%s> not available"), pszDriverName);
+    if (hDriver == NULL) {
+	G_fatal_error(_("OGR driver <%s> not available"), pszDriverName);
     }
 
     /* create datasource */
     hDS = OGR_Dr_CreateDataSource(hDriver, dsn, papszDSCO);
-    if(hDS == NULL) {
-        G_fatal_error(_("Creation of output OGR datasource <%s> failed"), dsn);
+    if (hDS == NULL) {
+	G_fatal_error(_("Creation of output OGR datasource <%s> failed"),
+		      dsn);
     }
-    
+
     G_free(pszDriverName);
 
     /* create layer */
     /* todo: SRS */
     hLayer = OGR_DS_CreateLayer(hDS, layer, NULL, wkbtype, papszLCO);
-    if(hLayer == NULL) {
-        G_fatal_error(_("Creation of OGR layer <%s> failed"), layer);
+    if (hLayer == NULL) {
+	G_fatal_error(_("Creation of OGR layer <%s> failed"), layer);
     }
 }

Modified: grass/trunk/vector/v.out.ogr/list.c
===================================================================
--- grass/trunk/vector/v.out.ogr/list.c	2010-11-28 17:54:31 UTC (rev 44464)
+++ grass/trunk/vector/v.out.ogr/list.c	2010-11-28 17:54:59 UTC (rev 44465)
@@ -10,7 +10,7 @@
     char OGRdrivers[2000];
 
     OGRdrivers[0] = '\0';
-    
+
     /* Open OGR DSN */
     OGRRegisterAll();
     G_debug(2, "driver count = %d", OGRGetDriverCount());



More information about the grass-commit mailing list