[GRASS-SVN] r73379 - in grass/branches/releasebranch_7_6: lib/raster raster/r.buildvrt

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 21 08:43:45 PDT 2018


Author: mmetz
Date: 2018-09-21 08:43:45 -0700 (Fri, 21 Sep 2018)
New Revision: 73379

Modified:
   grass/branches/releasebranch_7_6/lib/raster/vrt.c
   grass/branches/releasebranch_7_6/raster/r.buildvrt/main.c
Log:
virtual raster: avoid recursion to self (backport trunk r73378)

Modified: grass/branches/releasebranch_7_6/lib/raster/vrt.c
===================================================================
--- grass/branches/releasebranch_7_6/lib/raster/vrt.c	2018-09-21 15:43:19 UTC (rev 73378)
+++ grass/branches/releasebranch_7_6/lib/raster/vrt.c	2018-09-21 15:43:45 UTC (rev 73379)
@@ -1,7 +1,7 @@
 /*!
-  \file lib/raster/gdal.c
+  \file lib/raster/vrt.c
   
-  \brief Raster Library - Utilization of GDAL library.
+  \brief Raster Library - virtual GRASS raster maps.
   
   (C) 2010 by the GRASS Development Team
   
@@ -82,6 +82,9 @@
 	if ((mapset = G_find_raster(name, "")) == NULL)
 	    G_fatal_error(_("Tile raster map <%s> not found"), name);
 
+	if (strcmp(name, vname) == 0)
+	    G_fatal_error(_("A virtual raster can not contain itself"));
+
 	if (tilecount >= talloc) {
 	    talloc += 100;
 	    ti = G_realloc(ti, talloc * sizeof(struct tileinfo));

Modified: grass/branches/releasebranch_7_6/raster/r.buildvrt/main.c
===================================================================
--- grass/branches/releasebranch_7_6/raster/r.buildvrt/main.c	2018-09-21 15:43:19 UTC (rev 73378)
+++ grass/branches/releasebranch_7_6/raster/r.buildvrt/main.c	2018-09-21 15:43:45 UTC (rev 73379)
@@ -146,6 +146,9 @@
 	    if ((mapset = G_find_raster(name, "")) == NULL)
 		G_fatal_error(_("Input raster map <%s> not found"), name);
 
+	    if (strcmp(name, parm.output->answer) == 0)
+		G_fatal_error(_("Input and output raster map can not be identical"));
+
 	    Rast_read_fp_range(name, mapset, &fprange);
 	    dmin = fprange.min;
 	    if (Rast_is_d_null_value(&dmin)) {
@@ -196,6 +199,9 @@
 	    if ((mapset = G_find_raster(name, "")) == NULL)
 		G_fatal_error(_("Input raster map <%s> not found"), name);
 
+	    if (strcmp(name, parm.output->answer) == 0)
+		G_fatal_error(_("Input and output raster map can not be identical"));
+
 	    Rast_read_fp_range(name, mapset, &fprange);
 	    dmin = fprange.min;
 	    if (Rast_is_d_null_value(&dmin)) {



More information about the grass-commit mailing list