[GRASS-SVN] r36587 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Apr 4 23:22:12 EDT 2009


Author: 1gray
Date: 2009-04-04 23:22:12 -0400 (Sat, 04 Apr 2009)
New Revision: 36587

Modified:
   grass/trunk/lib/gis/get_cellhd.c
   grass/trunk/lib/gis/put_cellhd.c
   grass/trunk/lib/gis/put_title.c
   grass/trunk/lib/gis/quant_io.c
   grass/trunk/lib/gis/quant_rw.c
   grass/trunk/lib/gis/range.c
Log:
Removed extra calls to sprintf () just before G_warning ().
lib/gis/get_cellhd.c (G_get_cellhd): Removed extra calls to `sprintf'
just before `G_warning'.
lib/gis/put_cellhd.c (G_put_cellhd): Likewise.
lib/gis/put_title.c (G_put_cell_title): Likewise.
lib/gis/quant_io.c (G__quant_import): Likewise.
lib/gis/quant_rw.c
(G_truncate_fp_map): Likewise.
(G_round_fp_map): Likewise.
(G_quantize_fp_map): Likewise.
(G_quantize_fp_map_range): Likewise.
(G_write_quant): Likewise.
lib/gis/range.c
(G_read_fp_range): Likewise.
(G_read_range): Likewise.


Modified: grass/trunk/lib/gis/get_cellhd.c
===================================================================
--- grass/trunk/lib/gis/get_cellhd.c	2009-04-04 20:55:21 UTC (rev 36586)
+++ grass/trunk/lib/gis/get_cellhd.c	2009-04-05 03:22:12 UTC (rev 36587)
@@ -77,7 +77,7 @@
 		sprintf(tail, _("which is missing."));
 	    else
 		sprintf(tail, _("whose header file can't be opened."));
-	    G_warning(buf);
+	    G_warning ("%s", buf);
 	    return -1;
 	}
     }

Modified: grass/trunk/lib/gis/put_cellhd.c
===================================================================
--- grass/trunk/lib/gis/put_cellhd.c	2009-04-04 20:55:21 UTC (rev 36586)
+++ grass/trunk/lib/gis/put_cellhd.c	2009-04-05 03:22:12 UTC (rev 36587)
@@ -23,8 +23,7 @@
     if (!(fd = G_fopen_new("cellhd", name))) {
 	char buf[1024];
 
-	sprintf(buf, _("Unable to create header file for [%s]"), name);
-	G_warning(buf);
+	G_warning (_("Unable to create header file for [%s]"), name);
 	return -1;
     }
 

Modified: grass/trunk/lib/gis/put_title.c
===================================================================
--- grass/trunk/lib/gis/put_title.c	2009-04-04 20:55:21 UTC (rev 36586)
+++ grass/trunk/lib/gis/put_title.c	2009-04-05 03:22:12 UTC (rev 36587)
@@ -25,10 +25,9 @@
     in = out = 0;
     in = G_fopen_old("cats", name, mapset);
     if (!in) {
-	sprintf(buf,
-		_("category information for [%s] in [%s] missing or invalid"),
-		name, mapset);
-	G_warning(buf);
+	G_warning (_("category information for [%s] in [%s]"
+		     " missing or invalid"),
+		   name, mapset);
 	return -1;
     }
 
@@ -36,8 +35,7 @@
     out = fopen(tempfile, "w");
     if (!out) {
 	fclose(in);
-	sprintf(buf, _("G_put_title - can't create a temp file"));
-	G_warning(buf);
+	G_warning (_("G_put_title - can't create a temp file"));
 	return -1;
     }
 
@@ -53,25 +51,22 @@
 
     /* must be #cats line, title line, and label for cat 0 */
     if (line < 3) {
-	sprintf(buf, _("category information for [%s] in [%s] invalid"), name,
-		mapset);
-	G_warning(buf);
+	G_warning (_("category information for [%s] in [%s] invalid"),
+		   name, mapset);
 	return -1;
     }
 
     in = fopen(tempfile, "r");
     if (!in) {
-	sprintf(buf, _("G_put_title - can't reopen temp file"));
-	G_warning(buf);
+	G_warning (_("G_put_title - can't reopen temp file"));
 	return -1;
     }
 
     out = G_fopen_new("cats", name);
     if (!out) {
 	fclose(in);
-	sprintf(buf, _("can't write category information for [%s] in [%s]"),
-		name, mapset);
-	G_warning(buf);
+	G_warning (_("can't write category information for [%s] in [%s]"),
+		   name, mapset);
 	return -1;
     }
 

Modified: grass/trunk/lib/gis/quant_io.c
===================================================================
--- grass/trunk/lib/gis/quant_io.c	2009-04-04 20:55:21 UTC (rev 36586)
+++ grass/trunk/lib/gis/quant_io.c	2009-04-05 03:22:12 UTC (rev 36587)
@@ -86,9 +86,8 @@
 	return 0;
     G_get_fp_range_min_max(&fprange, &dMin, &dMax);
     if (G_is_d_null_value(&dMin) || G_is_d_null_value(&dMax)) {
-	sprintf(buf, _("The floating data range for %s@%s is empty"), name,
-		mapset);
-	G_warning(buf);
+	G_warning (_("The floating data range for %s@%s is empty"),
+		   name, mapset);
 	return -3;
     }
 
@@ -96,9 +95,8 @@
 	return 0;
     G_get_range_min_max(&range, &min, &max);
     if (G_is_c_null_value(&min) && G_is_c_null_value(&max)) {
-	sprintf(buf, _("The integer data range for %s@%s is empty"), name,
-		mapset);
-	G_warning(buf);
+	G_warning (_("The integer data range for %s@%s is empty"),
+		   name, mapset);
 	return -3;
     }
 
@@ -121,10 +119,9 @@
     G_quant_free(quant);
 
     if (G_raster_map_type(name, mapset) == CELL_TYPE) {
-	sprintf(buf,
-		"G__quant_import: attempt to open quantization table for CELL_TYPE file [%s] in mapset {%s]",
-		name, mapset);
-	G_warning(buf);
+	G_warning (_("G__quant_import: attempt to open quantization"
+		     " table for CELL_TYPE file [%s] in mapset {%s]"),
+		   name, mapset);
 	return -2;
     }
 
@@ -164,9 +161,8 @@
 	err = "empty";
     }
 
-    sprintf(buf,
-	    _("quantization file [%s] in mapset [%s] %s"), name, mapset, err);
-    G_warning(buf);
+    G_warning (_("quantization file [%s] in mapset [%s] %s"),
+	       name, mapset, err);
 
     return 0;
 }

Modified: grass/trunk/lib/gis/quant_rw.c
===================================================================
--- grass/trunk/lib/gis/quant_rw.c	2009-04-04 20:55:21 UTC (rev 36586)
+++ grass/trunk/lib/gis/quant_rw.c	2009-04-05 03:22:12 UTC (rev 36587)
@@ -70,9 +70,9 @@
     G_quant_truncate(&quant);
     /* quantize the map */
     if (G_write_quant(name, mapset, &quant) < 0) {
-	sprintf(buf, "G_truncate_fp_map: can't write quant rules for map %s",
-		name);
-	G_warning(buf);
+	G_warning (_("G_truncate_fp_map: can't write quant rules"
+		     " for map %s"),
+		   name);
 	return -1;
     }
     return 1;
@@ -87,9 +87,9 @@
     G_quant_round(&quant);
     /* round the map */
     if (G_write_quant(name, mapset, &quant) < 0) {
-	sprintf(buf, "G_truncate_fp_map: can't write quant rules for map %s",
-		name);
-	G_warning(buf);
+	G_warning (_("G_truncate_fp_map: can't write quant rules"
+		     " for map %s"),
+		   name);
 	return -1;
     }
     return 1;
@@ -118,15 +118,14 @@
     struct FPRange fp_range;
 
     if (G_read_fp_range(name, mapset, &fp_range) < 0) {
-	sprintf(buf, "G_quantize_fp_map: can't read fp range for map %s",
-		name);
-	G_warning(buf);
+	G_warning (_("G_quantize_fp_map: can't read fp range for map %s"),
+		   name);
 	return -1;
     }
     G_get_fp_range_min_max(&fp_range, &d_min, &d_max);
     if (G_is_d_null_value(&d_min) || G_is_d_null_value(&d_max)) {
-	sprintf(buf, "G_quantize_fp_map: raster map %s is empty", name);
-	G_warning(buf);
+	G_warning (_("G_quantize_fp_map: raster map %s is empty"),
+		   name);
 	return -1;
     }
     return G_quantize_fp_map_range(name, mapset, d_min, d_max, min, max);
@@ -166,10 +165,9 @@
     G_quant_add_rule(&quant, d_min, d_max, min, max);
     /* quantize the map */
     if (G_write_quant(name, mapset, &quant) < 0) {
-	sprintf(buf,
-		"G_quantize_fp_map_range: can't write quant rules for map %s",
-		name);
-	G_warning(buf);
+	G_warning (_("G_quantize_fp_map_range: can't write quant rules"
+		     " for map %s"),
+		   name);
 	return -1;
     }
     return 1;
@@ -203,8 +201,8 @@
     char buf[300];
 
     if (G_raster_map_type(name, mapset) == CELL_TYPE) {
-	sprintf(buf, _("Cannot write quant rules: map %s is integer"), name);
-	G_warning(buf);
+	G_warning (_("Cannot write quant rules: map %s is integer"),
+		   name);
 	return -1;
     }
 
@@ -212,8 +210,7 @@
 
     /* first actually write the rules */
     if (G__quant_export(name, mapset, quant) < 0) {
-	sprintf(buf, _("Cannot write quant rules for map %s"), name);
-	G_warning(buf);
+	G_warning (_("Cannot write quant rules for map %s"), name);
 	return -1;
     }
 

Modified: grass/trunk/lib/gis/range.c
===================================================================
--- grass/trunk/lib/gis/range.c	2009-04-04 20:55:21 UTC (rev 36586)
+++ grass/trunk/lib/gis/range.c	2009-04-05 03:22:12 UTC (rev 36587)
@@ -185,8 +185,8 @@
   error:
     if (fd > 0)
 	close(fd);
-    sprintf(buf, _("can't read f_range file for [%s in %s]"), name, mapset);
-    G_warning(buf);
+    G_warning (_("can't read f_range file for [%s in %s]"),
+	       name, mapset);
     return -1;
 }
 
@@ -236,10 +236,9 @@
 	DCELL dmin, dmax;
 
 	if (G_read_quant(name, mapset, &quant) < 0) {
-	    sprintf(buf,
-		    "G_read_range(): can't read quant rules for fp map %s@%s",
-		    name, mapset);
-	    G_warning(buf);
+	    G_warning (_("G_read_range(): can't read quant rules"
+			 " for fp map %s@%s"),
+		       name, mapset);
 	    return -1;
 	}
 	if (G_quant_is_truncate(&quant) || G_quant_is_round(&quant)) {
@@ -301,8 +300,8 @@
   error:
     if (fd)
 	fclose(fd);
-    sprintf(buf, _("can't read range file for [%s in %s]"), name, mapset);
-    G_warning(buf);
+    G_warning (_("can't read range file for [%s in %s]"),
+	       name, mapset);
     return -1;
 }
 



More information about the grass-commit mailing list