[GRASS-dev] grass7 problems with MASK

Markus Metz markus.metz.giswork at googlemail.com
Wed Jan 13 10:49:02 EST 2010


Because of r40217, Rast_close() and Rast_unopen() can no longer be 
called unconditionally. That gives me errors when a MASK is present:
ERROR: Invalid descriptor: 0

The following patch to lib/raster works for me but I'm not sure if this 
is the right way

Index: init.c
===================================================================
--- init.c    (revision 40418)
+++ init.c    (working copy)
@@ -83,6 +83,7 @@
 
     /* Set masking flag unknown */
     R__.auto_mask = -1;
+    R__.mask_fd = -1;
 
     R__.nbytes = sizeof(CELL);
     R__.compression_type = getenv("GRASS_INT_ZLIB") ? 2 : 1;
Index: auto_mask.c
===================================================================
--- auto_mask.c    (revision 40418)
+++ auto_mask.c    (working copy)
@@ -61,7 +61,9 @@
     return 0;
     }
 
-    Rast_unopen(R__.mask_fd);
+    if (R__.mask_fd >= 0)
+    Rast_unopen(R__.mask_fd);
+   
     R__.mask_fd = Rast__open_old("MASK", G_mapset());
     if (R__.mask_fd < 0) {
     R__.auto_mask = 0;

Alternatively, just return if a raster map can't be unopened/closed?

Markus M


More information about the grass-dev mailing list