[GRASS-SVN] r67943 - grass/trunk/lib/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 24 14:02:53 PST 2016


Author: mmetz
Date: 2016-02-24 14:02:53 -0800 (Wed, 24 Feb 2016)
New Revision: 67943

Modified:
   grass/trunk/lib/raster/close.c
   grass/trunk/lib/raster/open.c
   grass/trunk/lib/raster/put_row.c
Log:
rasterlib: change name of compressed null file, set default compression method to LZ4

Modified: grass/trunk/lib/raster/close.c
===================================================================
--- grass/trunk/lib/raster/close.c	2016-02-24 20:45:01 UTC (rev 67942)
+++ grass/trunk/lib/raster/close.c	2016-02-24 22:02:53 UTC (rev 67943)
@@ -33,7 +33,8 @@
 #define FORMAT_FILE "f_format"
 #define QUANT_FILE  "f_quant"
 #define NULL_FILE   "null"
-#define NULL2_FILE  "null2"
+/* cmpressed null file */
+#define NULLC_FILE  "nullcmpr"
 
 static int close_old(int);
 static int close_new(int, int);
@@ -279,7 +280,7 @@
 	G_file_name_misc(path, "cell_misc", NULL_FILE, fcb->name,
 			  G_mapset());
 	remove(path);
-	G_file_name_misc(path, "cell_misc", NULL2_FILE, fcb->name,
+	G_file_name_misc(path, "cell_misc", NULLC_FILE, fcb->name,
 			  G_mapset());
 	remove(path);
 
@@ -375,11 +376,11 @@
 	G__make_mapset_element_misc("cell_misc", fcb->name);
 	G_file_name_misc(path, "cell_misc", NULL_FILE, fcb->name, G_mapset());
 	remove(path);
-	G_file_name_misc(path, "cell_misc", NULL2_FILE, fcb->name, G_mapset());
+	G_file_name_misc(path, "cell_misc", NULLC_FILE, fcb->name, G_mapset());
 	remove(path);
 
 	G_file_name_misc(path, "cell_misc",
-			 fcb->null_row_ptr ? NULL2_FILE : NULL_FILE,
+			 fcb->null_row_ptr ? NULLC_FILE : NULL_FILE,
 			 fcb->name, G_mapset());
 
 	if (fcb->null_cur_row > 0) {
@@ -502,11 +503,11 @@
     G__make_mapset_element_misc("cell_misc", fcb->name);
     G_file_name_misc(path, "cell_misc", NULL_FILE, fcb->name, G_mapset());
     remove(path);
-    G_file_name_misc(path, "cell_misc", NULL2_FILE, fcb->name, G_mapset());
+    G_file_name_misc(path, "cell_misc", NULLC_FILE, fcb->name, G_mapset());
     remove(path);
 
     G_file_name_misc(path, "cell_misc",
-		     fcb->null_row_ptr ? NULL2_FILE : NULL_FILE,
+		     fcb->null_row_ptr ? NULLC_FILE : NULL_FILE,
 		     fcb->name, G_mapset());
 
     if (rename(fcb->null_temp_name, path))

Modified: grass/trunk/lib/raster/open.c
===================================================================
--- grass/trunk/lib/raster/open.c	2016-02-24 20:45:01 UTC (rev 67942)
+++ grass/trunk/lib/raster/open.c	2016-02-24 22:02:53 UTC (rev 67943)
@@ -29,7 +29,8 @@
 #include "R.h"
 #define FORMAT_FILE "f_format"
 #define NULL_FILE   "null"
-#define NULL2_FILE  "null2"
+/* cmpressed null file */
+#define NULLC_FILE  "nullcmpr"
 
 static int new_fileinfo(void)
 {
@@ -354,7 +355,7 @@
 	/* First, check for compressed null file */
 	fcb->null_fd = G_open_old_misc("cell_misc", NULL_FILE, r_name, r_mapset);
 	if (fcb->null_fd < 0) {
-	    fcb->null_fd = G_open_old_misc("cell_misc", NULL2_FILE, r_name, r_mapset);
+	    fcb->null_fd = G_open_old_misc("cell_misc", NULLC_FILE, r_name, r_mapset);
 	    if (fcb->null_fd >= 0) {
 		fcb->null_row_ptr = G_calloc(fcb->cellhd.rows + 1, sizeof(off_t));
 		if (Rast__read_null_row_ptrs(fd, fcb->null_fd) < 0) {

Modified: grass/trunk/lib/raster/put_row.c
===================================================================
--- grass/trunk/lib/raster/put_row.c	2016-02-24 20:45:01 UTC (rev 67942)
+++ grass/trunk/lib/raster/put_row.c	2016-02-24 22:02:53 UTC (rev 67943)
@@ -505,7 +505,8 @@
 
     compressed_buf = G_alloca(size + 1);
 
-    nwrite = G_compress(flags, size, compressed_buf, size, fcb->cellhd.compressed);
+    /* compress null bits file with LZ4, see lib/gis/compress.h */
+    nwrite = G_compress(flags, size, compressed_buf, size, 3);
 
     if (nwrite > 0 && nwrite < size) {
 	if (write(fcb->null_fd, compressed_buf, nwrite) != nwrite)



More information about the grass-commit mailing list