[GRASS-SVN] r50085 - grass/trunk/vector/v.to.rast

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 7 08:34:28 EST 2012


Author: mmetz
Date: 2012-01-07 05:34:28 -0800 (Sat, 07 Jan 2012)
New Revision: 50085

Modified:
   grass/trunk/vector/v.to.rast/support.c
Log:
v.to.rast: minor code cleanup

Modified: grass/trunk/vector/v.to.rast/support.c
===================================================================
--- grass/trunk/vector/v.to.rast/support.c	2012-01-07 13:26:21 UTC (rev 50084)
+++ grass/trunk/vector/v.to.rast/support.c	2012-01-07 13:34:28 UTC (rev 50085)
@@ -240,7 +240,6 @@
 		  const char *attr_column)
 {
     int i;
-    int fd;
 
     /* Map */
     struct Map_info Map;
@@ -265,14 +264,13 @@
     /* init raster categories */
     Rast_init_cats("Categories", &rast_cats);
 
-    fd = Rast_open_old(rast_name, G_mapset());
-
     switch (use) {
     case USE_ATTR:
 	{
-	    Rast_set_cats_title("Labels", &rast_cats);
 	    int is_fp = Rast_map_is_fp(rast_name, G_mapset());
 
+	    Rast_set_cats_title("Labels", &rast_cats);
+
 	    /* open vector map and database driver */
 	    Vect_open_old(&Map, vector_map, G_find_vector2(vector_map, ""));
 
@@ -414,7 +412,7 @@
 	break;
     case USE_CAT:
 	{
-	    int row, rows;
+	    int row, rows, fd;
 	    void *rowbuf;
 	    struct Cell_stats stats;
 	    CELL n;
@@ -446,6 +444,7 @@
 		Rast_set_cat(&n, &n, msg, &rast_cats, map_type);
 	    }
 
+	    Rast_close(fd);
 	    G_free(rowbuf);
 	}
 	break;
@@ -486,7 +485,6 @@
 	break;
     }
 
-    Rast_close(fd);
     Rast_write_cats(rast_name, &rast_cats);
     Rast_free_cats(&rast_cats);
 



More information about the grass-commit mailing list