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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 18 08:02:05 PDT 2017


Author: mmetz
Date: 2017-07-18 08:02:05 -0700 (Tue, 18 Jul 2017)
New Revision: 71282

Modified:
   grass/trunk/lib/raster/cats.c
   grass/trunk/lib/raster/color_rules.c
   grass/trunk/lib/raster/put_row.c
Log:
rasterlib: code cosmetics to reduce compiler warnings

Modified: grass/trunk/lib/raster/cats.c
===================================================================
--- grass/trunk/lib/raster/cats.c	2017-07-18 13:58:52 UTC (rev 71281)
+++ grass/trunk/lib/raster/cats.c	2017-07-18 15:02:05 UTC (rev 71282)
@@ -1302,7 +1302,7 @@
     for (i = 0; i < ncats; i++) {
 	descr = Rast_get_ith_d_cat(&save_cats, indexes[i], &d1, &d2);
 	G_debug(4, "  Write sorted cats, pcats = %p pcats->labels = %p",
-		pcats, pcats->labels);
+		(void *)pcats, (void *)pcats->labels);
 	Rast_set_d_cat(&d1, &d2, descr, pcats);
     }
     Rast_free_cats(&save_cats);

Modified: grass/trunk/lib/raster/color_rules.c
===================================================================
--- grass/trunk/lib/raster/color_rules.c	2017-07-18 13:58:52 UTC (rev 71281)
+++ grass/trunk/lib/raster/color_rules.c	2017-07-18 15:02:05 UTC (rev 71282)
@@ -216,7 +216,7 @@
 
     while ((*read_rule)
 	   (closure, min, max, &val, &r, &g, &b, &set, &is_null, &is_dflt)) {
-	struct rule *p;
+	struct rule *p = NULL;
 
 	if (set) {
 	    n = nrules++;
@@ -228,6 +228,9 @@
 	else if (is_null)
 	    p = &null;
 
+	if (!p)
+	    G_fatal_error(_("Unknown error reading color rule"));
+
 	p->r = r;
 	p->g = g;
 	p->b = b;
@@ -337,7 +340,7 @@
 void Rast_make_colors(struct Colors *colors, const char *name, CELL min,
 		      CELL max)
 {
-    return load_rules_name(colors, name, (DCELL) min, (DCELL) max);
+    load_rules_name(colors, name, (DCELL) min, (DCELL) max);
 }
 
 /*!
@@ -350,5 +353,5 @@
 void Rast_make_fp_colors(struct Colors *colors, const char *name, DCELL min,
 			 DCELL max)
 {
-    return load_rules_name(colors, name, min, max);
+    load_rules_name(colors, name, min, max);
 }

Modified: grass/trunk/lib/raster/put_row.c
===================================================================
--- grass/trunk/lib/raster/put_row.c	2017-07-18 13:58:52 UTC (rev 71281)
+++ grass/trunk/lib/raster/put_row.c	2017-07-18 15:02:05 UTC (rev 71282)
@@ -352,7 +352,6 @@
     convert_int(wk, null_buf, cell, n, len, zeros_r_nulls);
 
     if (compressed) {
-	unsigned char *wk = work_buf + 1;
 	int nbytes = count_bytes(wk, n, len);
 	unsigned char *compressed_buf;
 	int total;
@@ -428,6 +427,7 @@
 
     work_buf = G_malloc(n * size);
 
+    datatype = GDT_Unknown;
     switch (map_type) {
     case CELL_TYPE:
 	datatype = GDT_Int32;



More information about the grass-commit mailing list