瀏覽代碼

rasterlib: code cosmetics to reduce compiler warnings

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@71282 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 7 年之前
父節點
當前提交
2c9f86aef2
共有 3 個文件被更改,包括 8 次插入5 次删除
  1. 1 1
      lib/raster/cats.c
  2. 6 3
      lib/raster/color_rules.c
  3. 1 1
      lib/raster/put_row.c

+ 1 - 1
lib/raster/cats.c

@@ -1302,7 +1302,7 @@ int Rast_sort_cats(struct Categories *pcats)
     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);

+ 6 - 3
lib/raster/color_rules.c

@@ -216,7 +216,7 @@ int Rast_read_color_rules(struct Colors *colors, DCELL min, DCELL max,
 
     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 @@ int Rast_read_color_rules(struct Colors *colors, DCELL min, DCELL max,
 	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 @@ static void load_rules_name(struct Colors *colors, const char *name,
 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_colors(struct Colors *colors, const char *name, CELL min,
 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);
 }

+ 1 - 1
lib/raster/put_row.c

@@ -352,7 +352,6 @@ static void put_data(int fd, char *null_buf, const CELL * cell,
     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 @@ static void put_data_gdal(int fd, const void *rast, int row, int n,
 
     work_buf = G_malloc(n * size);
 
+    datatype = GDT_Unknown;
     switch (map_type) {
     case CELL_TYPE:
 	datatype = GDT_Int32;