[GRASS-SVN] r73981 - in grass/trunk: imagery/i.segment lib/gis lib/segment raster/r.out.mat raster/r.recode raster/r.stream.extract

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 20 08:05:19 PST 2019


Author: marisn
Date: 2019-01-20 08:05:19 -0800 (Sun, 20 Jan 2019)
New Revision: 73981

Modified:
   grass/trunk/imagery/i.segment/iseg.h
   grass/trunk/imagery/i.segment/mean_shift.c
   grass/trunk/imagery/i.segment/open_files.c
   grass/trunk/imagery/i.segment/region_growing.c
   grass/trunk/lib/gis/basename.c
   grass/trunk/lib/segment/format.c
   grass/trunk/raster/r.out.mat/main.c
   grass/trunk/raster/r.recode/read_rules.c
   grass/trunk/raster/r.stream.extract/close.c
   grass/trunk/raster/r.stream.extract/do_astar.c
   grass/trunk/raster/r.stream.extract/init_search.c
   grass/trunk/raster/r.stream.extract/load.c
   grass/trunk/raster/r.stream.extract/streams.c
   grass/trunk/raster/r.stream.extract/thin.c
Log:
Fix some instances of printing of off_t and size_t


Modified: grass/trunk/imagery/i.segment/iseg.h
===================================================================
--- grass/trunk/imagery/i.segment/iseg.h	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/imagery/i.segment/iseg.h	2019-01-20 16:05:19 UTC (rev 73981)
@@ -22,10 +22,13 @@
 
 #ifdef HAVE_LONG_LONG_INT
 #define LARGEINT long long
+#define PRI_LONG "lld"
 #elif defined HAVE_LARGEFILES
 #define LARGEINT off_t
+#define PRI_LONG PRI_OFF_T
 #else
 #define LARGEINT long
+#define PRI_LONG "ld"
 #endif
 
 /* methods */

Modified: grass/trunk/imagery/i.segment/mean_shift.c
===================================================================
--- grass/trunk/imagery/i.segment/mean_shift.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/imagery/i.segment/mean_shift.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -209,7 +209,7 @@
 	G_message(_("Range bandwidth: %g"), hspec);
     }
 
-    G_debug(4, "Starting to process %ld candidate cells",
+    G_debug(4, "Starting to process %"PRI_LONG" candidate cells",
 	    globals->candidate_count);
 
     t = 0;
@@ -392,7 +392,7 @@
 	    }
 	}
 	G_percent(1, 1, 1);
-	G_message(_("Changes > threshold: %d, largest change: %g"), n_changes, sqrt(maxdiff2));
+	G_message(_("Changes > threshold: %"PRI_LONG", largest change: %g"), n_changes, sqrt(maxdiff2));
     }
     if (n_changes > 1)
 	G_message(_("Mean shift stopped at %d due to reaching max iteration limit, more changes may be possible"), t);

Modified: grass/trunk/imagery/i.segment/open_files.c
===================================================================
--- grass/trunk/imagery/i.segment/open_files.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/imagery/i.segment/open_files.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -550,7 +550,7 @@
 		segs_mb = 10;
 	}
 
-	G_verbose_message(_("Regions with at least %d cells are stored in memory"),
+	G_verbose_message(_("Regions with at least %"PRI_LONG" cells are stored in memory"),
 			  globals->min_reg_size);
     }
 

Modified: grass/trunk/imagery/i.segment/region_growing.c
===================================================================
--- grass/trunk/imagery/i.segment/region_growing.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/imagery/i.segment/region_growing.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -270,7 +270,7 @@
 	    }
 	}
 
-	G_debug(4, "Starting to process %ld candidate cells",
+	G_debug(4, "Starting to process %"PRI_LONG" candidate cells",
 		globals->candidate_count);
 
 	/*process candidate cells */
@@ -580,7 +580,7 @@
 	    }
 	}
 
-	G_debug(4, "Starting to process %ld candidate cells",
+	G_debug(4, "Starting to process %"PRI_LONG" candidate cells",
 		globals->candidate_count);
 
 	/* process candidate cells */
@@ -985,7 +985,7 @@
     G_debug(4, "update_band_vals()");
 
     if (rs->count >= globals->min_reg_size) {
-	G_fatal_error(_("Region stats should go in tree, %d >= %d"),
+	G_fatal_error(_("Region stats should go in tree, %d >= %"PRI_LONG""),
 	              rs->count, globals->min_reg_size);
     }
 

Modified: grass/trunk/lib/gis/basename.c
===================================================================
--- grass/trunk/lib/gis/basename.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/lib/gis/basename.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -88,12 +88,12 @@
     char *result;
 
     if (ndigits != 0){
-        sprintf(intfmt, "%%0%ud", ndigits);
+        sprintf(intfmt, "%%0%zu", ndigits);
     }
     sprintf(intstr, intfmt, (int)integer);
 
     if (ndecimals != 0){
-        sprintf(decfmt, "_%%0%ud", ndecimals);
+        sprintf(decfmt, "_%%0%zu", ndecimals);
         decimal = ((number - integer) * pow(10., (double)ndecimals));
         sprintf(decstr, decfmt, (int)decimal);
     }

Modified: grass/trunk/lib/segment/format.c
===================================================================
--- grass/trunk/lib/segment/format.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/lib/segment/format.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -112,7 +112,7 @@
     int spr, size;
 
     if (nrows <= 0 || ncols <= 0 || len <= 0 || srows <= 0 || scols <= 0) {
-	G_warning("Segment_format(fd,%lld,%lld,%d,%d,%d): illegal value(s)",
+	G_warning("Segment_format(fd,%"PRI_OFF_T",%"PRI_OFF_T",%d,%d,%d): illegal value(s)",
 		  nrows, ncols, srows, scols, len);
 	return -3;
     }

Modified: grass/trunk/raster/r.out.mat/main.c
===================================================================
--- grass/trunk/raster/r.out.mat/main.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/raster/r.out.mat/main.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -294,7 +294,7 @@
 	G_calloc((Rast_window_rows() + 1) * (Rast_window_cols() + 1),
 		 Rast_cell_size(map_type));
 
-    G_debug(1, "mem alloc is %d bytes\n",	/* I think _cols()+1 is unneeded? */
+    G_debug(1, "mem alloc is %zu bytes\n",	/* I think _cols()+1 is unneeded? */
 	    Rast_cell_size(map_type) * (Rast_window_rows() +
 				       1) * (Rast_window_cols() + 1));
 

Modified: grass/trunk/raster/r.recode/read_rules.c
===================================================================
--- grass/trunk/raster/r.recode/read_rules.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/raster/r.recode/read_rules.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -68,7 +68,7 @@
 	if (!G_getl2(buf, 1024, fp))
 	    return nrules;
 
-	G_debug(5, "buf = [%s], strlen(buf)=%d", buf, strlen(buf));
+	G_debug(5, "buf = [%s], strlen(buf)=%zu", buf, strlen(buf));
 
 	for (n = 0; buf[n]; n++)
 	    if (buf[n] == ',')

Modified: grass/trunk/raster/r.stream.extract/close.c
===================================================================
--- grass/trunk/raster/r.stream.extract/close.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/raster/r.stream.extract/close.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -206,7 +206,7 @@
     /* stream nodes */
     for (i = 1; i <= n_stream_nodes; i++) {
 
-	sprintf(buf, "insert into %s values ( %lld, \'%s\', %d, %d )",
+	sprintf(buf, "insert into %s values ( %"PRI_OFF_T", \'%s\', %d, %d )",
 		Fi->table, i,
 		(stream_node[i].n_trib > 0 ? "intermediate" : "start"),
 		(stream_node[i].n_trib > 0), network_id[i]);

Modified: grass/trunk/raster/r.stream.extract/do_astar.c
===================================================================
--- grass/trunk/raster/r.stream.extract/do_astar.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/raster/r.stream.extract/do_astar.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -59,12 +59,12 @@
     while (heap_size > 0) {
 	G_percent(count++, n_points, 1);
 	if (count > n_points)
-	    G_fatal_error(_("%lld surplus points"),
+	    G_fatal_error(_("%"PRI_OFF_T" surplus points"),
 	                  heap_size);
 
 	if (heap_size > n_points)
 	    G_fatal_error
-		(_("Too many points in heap %lld, should be %lld"),
+		(_("Too many points in heap %"PRI_OFF_T", should be %"PRI_OFF_T""),
 		 heap_size, n_points);
 
 	heap_p = heap_drop();

Modified: grass/trunk/raster/r.stream.extract/init_search.c
===================================================================
--- grass/trunk/raster/r.stream.extract/init_search.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/raster/r.stream.extract/init_search.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -114,9 +114,9 @@
 	G_free(depr_buf);
     }
 
-    G_debug(1, "%lld edge cells", heap_size - n_depr_cells);
+    G_debug(1, "%"PRI_OFF_T" edge cells", heap_size - n_depr_cells);
     if (n_depr_cells)
-	G_debug(1, "%lld cells in depressions", n_depr_cells);
+	G_debug(1, "%"PRI_OFF_T" cells in depressions", n_depr_cells);
 
     return 1;
 }

Modified: grass/trunk/raster/r.stream.extract/load.c
===================================================================
--- grass/trunk/raster/r.stream.extract/load.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/raster/r.stream.extract/load.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -167,7 +167,7 @@
 	G_free(acc_buf);
     }
     
-    G_debug(1, "%lld non-NULL cells", n_points);
+    G_debug(1, "%"PRI_OFF_T" non-NULL cells", n_points);
 
     return (n_points > 0);
 }

Modified: grass/trunk/raster/r.stream.extract/streams.c
===================================================================
--- grass/trunk/raster/r.stream.extract/streams.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/raster/r.stream.extract/streams.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -69,7 +69,7 @@
 
 	/* debug */
 	if (n_stream_nodes != *stream_no)
-	    G_warning(_("Stream_no %d and n_stream_nodes %lld out of sync"),
+	    G_warning(_("Stream_no %d and n_stream_nodes %"PRI_OFF_T" out of sync"),
 		      *stream_no, n_stream_nodes);
 
 	stream_node[*stream_no].n_alloc += 2;
@@ -665,7 +665,7 @@
 
 	    /* debug */
 	    if (n_stream_nodes != stream_no)
-		G_warning(_("Stream_no %d and n_stream_nodes %lld out of sync"),
+		G_warning(_("Stream_no %d and n_stream_nodes %"PRI_OFF_T" out of sync"),
 			  stream_no, n_stream_nodes);
 	}
 
@@ -697,7 +697,7 @@
     }
     G_percent(1, 1, 2);
     if (workedon)
-	G_warning(_("MFD: A * path already processed when setting drainage direction: %lld of %lld cells"),
+	G_warning(_("MFD: A * path already processed when setting drainage direction: %"PRI_OFF_T" of %"PRI_OFF_T" cells"),
 		  workedon, n_points);
 
     G_free(dist_to_nbr);
@@ -705,8 +705,8 @@
     G_free(ele_nbr);
     G_free(flag_nbr);
 
-    G_debug(1, "%lld outlets", n_outlets);
-    G_debug(1, "%lld nodes", n_stream_nodes);
+    G_debug(1, "%"PRI_OFF_T" outlets", n_outlets);
+    G_debug(1, "%"PRI_OFF_T" nodes", n_stream_nodes);
     G_debug(1, "%d streams", stream_no);
 
     return 1;

Modified: grass/trunk/raster/r.stream.extract/thin.c
===================================================================
--- grass/trunk/raster/r.stream.extract/thin.c	2019-01-19 18:38:17 UTC (rev 73980)
+++ grass/trunk/raster/r.stream.extract/thin.c	2019-01-20 16:05:19 UTC (rev 73981)
@@ -166,7 +166,7 @@
 
     G_free(nodestack);
     
-    G_verbose_message(_("%d of %lld stream segments were thinned"), n_thinned, n_stream_nodes);
+    G_verbose_message(_("%d of %"PRI_OFF_T" stream segments were thinned"), n_thinned, n_stream_nodes);
 
     return 1;
 }



More information about the grass-commit mailing list