[GRASS-SVN] r61270 - grass/branches/releasebranch_7_0/raster/r.spread

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 17 14:43:32 PDT 2014


Author: annakrat
Date: 2014-07-17 14:43:32 -0700 (Thu, 17 Jul 2014)
New Revision: 61270

Modified:
   grass/branches/releasebranch_7_0/raster/r.spread/main.c
   grass/branches/releasebranch_7_0/raster/r.spread/spread.c
Log:
r.spread: backport small fixes (r60915, r60916) based on what Coverity Scan found

Modified: grass/branches/releasebranch_7_0/raster/r.spread/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.spread/main.c	2014-07-17 21:30:52 UTC (rev 61269)
+++ grass/branches/releasebranch_7_0/raster/r.spread/main.c	2014-07-17 21:43:32 UTC (rev 61270)
@@ -232,6 +232,7 @@
     parm.init_time->key = "init_time";
     parm.init_time->type = TYPE_STRING;
     parm.init_time->key_desc = "int (>= 0)"; /* TODO: move to ->options */
+    parm.init_time->answer = "0";
     parm.init_time->label =
 	_("Initial time for current simulation (0) (min)");
     parm.init_time->description =
@@ -378,17 +379,13 @@
 	comp_dens = 0.5;
     }
     /*Check the given initial time and simulation time lag, assign the default if needed */
-    if (parm.init_time->answer) {
-	init_time = atoi(parm.init_time->answer);
-	if (init_time < 0) {
-	    G_warning("Illegal initial time <%s>", parm.init_time->answer);
-	    G_usage();
-	    exit(EXIT_FAILURE);
-	}
+    init_time = atoi(parm.init_time->answer);
+    if (init_time < 0) {
+	G_warning("Illegal initial time <%s>", parm.init_time->answer);
+	G_usage();
+	exit(EXIT_FAILURE);
     }
-    else {
-	time_lag = 0;
-    }
+
     if (parm.time_lag->answer) {
 	time_lag = atoi(parm.time_lag->answer);
 	if (time_lag < 0) {

Modified: grass/branches/releasebranch_7_0/raster/r.spread/spread.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.spread/spread.c	2014-07-17 21:30:52 UTC (rev 61269)
+++ grass/branches/releasebranch_7_0/raster/r.spread/spread.c	2014-07-17 21:43:32 UTC (rev 61270)
@@ -68,6 +68,9 @@
     struct cell_ptrHa *to_cell, *old_to_cell;
     struct costHa *pres_cell;
 
+    /* initialize using arbitrary value, this value is never used except for debug */
+    min_cost = 0;
+
     ncells = nrows * ncols;
     G_message
 	("Finding spread time - number of cells visited in percentage ...  %3d%%",



More information about the grass-commit mailing list