[GRASS-SVN] r61366 - in grass/branches/releasebranch_7_0: . raster/r.reclass

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 23 04:40:44 PDT 2014


Author: neteler
Date: 2014-07-23 04:40:44 -0700 (Wed, 23 Jul 2014)
New Revision: 61366

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/raster/r.reclass/Makefile
   grass/branches/releasebranch_7_0/raster/r.reclass/reclass.c
Log:
r.reclass: Fix 'Unable to write range file' error when overwriting fp maps


Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:59505,59646,60219,60278,60610,60807,60835,60936-60937,61275,61288,61290,61292,61294,61301
   + /grass/trunk:59505,59646,60219,60278,60610,60807,60835,60936-60937,61159,61275,61288,61290,61292,61294,61301

Modified: grass/branches/releasebranch_7_0/raster/r.reclass/Makefile
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.reclass/Makefile	2014-07-23 10:41:11 UTC (rev 61365)
+++ grass/branches/releasebranch_7_0/raster/r.reclass/Makefile	2014-07-23 11:40:44 UTC (rev 61366)
@@ -2,8 +2,8 @@
 
 PGM = r.reclass
 
-LIBES = $(RASTERLIB) $(GISLIB)
-DEPENDENCIES = $(RASTERDEP) $(GISDEP)
+LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
+DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make
 

Modified: grass/branches/releasebranch_7_0/raster/r.reclass/reclass.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.reclass/reclass.c	2014-07-23 10:41:11 UTC (rev 61365)
+++ grass/branches/releasebranch_7_0/raster/r.reclass/reclass.c	2014-07-23 11:40:44 UTC (rev 61366)
@@ -2,6 +2,7 @@
 #include <string.h>
 #include <grass/gis.h>
 #include <grass/raster.h>
+#include <grass/manage.h>
 #include <grass/glocale.h>
 #include "rule.h"
 
@@ -226,6 +227,17 @@
 	_reclass(rules, cats, &new);
     }
 
+    if (G_find_file2("cell", new_name, G_mapset())) {
+	G_suppress_warnings(1);
+
+	M_read_list(FALSE, NULL);
+        if (M_do_remove(M_get_element("rast"), new_name) == 1)
+	    G_fatal_error(_("Cannot overwrite existing raster map <%s>"),
+			  new_name);
+
+	G_suppress_warnings(0);
+    }
+
     if (Rast_put_reclass(new_name, &new) < 0)
 	G_fatal_error(_("Cannot create reclass file of <%s>"), new_name);
 



More information about the grass-commit mailing list