Kaynağa Gözat

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.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@36587 15284696-431f-4ddb-bdfa-cd5b030d7da7

Ivan Shmakov 16 yıl önce
ebeveyn
işleme
a9a98c39b9
6 değiştirilmiş dosya ile 43 ekleme ve 57 silme
  1. 1 1
      lib/gis/get_cellhd.c
  2. 1 2
      lib/gis/put_cellhd.c
  3. 9 14
      lib/gis/put_title.c
  4. 9 13
      lib/gis/quant_io.c
  5. 16 19
      lib/gis/quant_rw.c
  6. 7 8
      lib/gis/range.c

+ 1 - 1
lib/gis/get_cellhd.c

@@ -77,7 +77,7 @@ int G_get_cellhd(const char *name, const char *mapset,
 		sprintf(tail, _("which is missing."));
 	    else
 		sprintf(tail, _("whose header file can't be opened."));
-	    G_warning(buf);
+	    G_warning ("%s", buf);
 	    return -1;
 	}
     }

+ 1 - 2
lib/gis/put_cellhd.c

@@ -23,8 +23,7 @@ int G_put_cellhd(const char *name, struct Cell_head *cellhd)
     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;
     }
 

+ 9 - 14
lib/gis/put_title.c

@@ -25,10 +25,9 @@ int G_put_cell_title(const char *name, const char *title)
     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 @@ int G_put_cell_title(const char *name, const char *title)
     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 @@ int G_put_cell_title(const char *name, const char *title)
 
     /* 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;
     }
 

+ 9 - 13
lib/gis/quant_io.c

@@ -86,9 +86,8 @@ quant_load_range(struct Quant *quant, const char *name, const char *mapset)
 	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 @@ quant_load_range(struct Quant *quant, const char *name, const char *mapset)
 	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 @@ int G__quant_import(const char *name, const char *mapset, struct Quant *quant)
     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 @@ int G__quant_import(const char *name, const char *mapset, struct Quant *quant)
 	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;
 }

+ 16 - 19
lib/gis/quant_rw.c

@@ -70,9 +70,9 @@ int G_truncate_fp_map(const char *name, const char *mapset)
     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 @@ int G_round_fp_map(const char *name, const char *mapset)
     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 @@ int G_quantize_fp_map(const char *name, const char *mapset,
     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 @@ int G_quantize_fp_map_range(const char *name, const char *mapset,
     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 @@ int G_write_quant(const char *name, const char *mapset,
     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 @@ int G_write_quant(const char *name, const char *mapset,
 
     /* 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;
     }
 

+ 7 - 8
lib/gis/range.c

@@ -185,8 +185,8 @@ int G_read_fp_range(const char *name, const char *mapset,
   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 @@ int G_read_range(const char *name, const char *mapset, struct Range *range)
 	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 @@ int G_read_range(const char *name, const char *mapset, struct Range *range)
   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;
 }