[GRASS-SVN] r72269 - grass/trunk/raster/r.info

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 21 13:19:09 PST 2018


Author: mmetz
Date: 2018-02-21 13:19:09 -0800 (Wed, 21 Feb 2018)
New Revision: 72269

Modified:
   grass/trunk/raster/r.info/main.c
Log:
r.info: use grass_int64 and j length modifier for total cells and number of non-null cells

Modified: grass/trunk/raster/r.info/main.c
===================================================================
--- grass/trunk/raster/r.info/main.c	2018-02-21 21:14:37 UTC (rev 72268)
+++ grass/trunk/raster/r.info/main.c	2018-02-21 21:19:09 UTC (rev 72269)
@@ -197,14 +197,8 @@
 	{
 	    compose_line(out, "  Rows:         %d", cellhd.rows);
 	    compose_line(out, "  Columns:      %d", cellhd.cols);
-#ifdef HAVE_LONG_LONG_INT
-	    compose_line(out, "  Total Cells:  %llu",
-			 (unsigned long long)cellhd.rows * cellhd.cols);
-#else
-	    compose_line(out,
-			 "  Total Cells:  %lu (accuracy - see r.info manual)",
-			 (unsigned long)cellhd.rows * cellhd.cols);
-#endif
+	    compose_line(out, "  Total Cells:  %ju",
+			 (grass_int64)cellhd.rows * cellhd.cols);
 
 	    /* This is printed as a guide to what the following eastings and
 	     * northings are printed in. This data is NOT from the values
@@ -353,8 +347,8 @@
             fprintf(out, "rows=%d\n", cellhd.rows);
             fprintf(out, "cols=%d\n", cellhd.cols);
             
-            fprintf(out, "cells=%lld\n",
-                    (long long)cellhd.rows * cellhd.cols);
+            fprintf(out, "cells=%jd\n",
+                    (grass_int64)cellhd.rows * cellhd.cols);
             
 	    fprintf(out, "datatype=%s\n",
 		    (data_type == CELL_TYPE ? "CELL" :
@@ -436,11 +430,7 @@
 		mean = (double)(rstats.sum / rstats.count);
 		sd = sqrt(rstats.sumsq / rstats.count - (mean * mean));
 
-#ifdef HAVE_LONG_LONG_INT
-		fprintf(out, "n=%lld\n", (long long int)rstats.count);
-#else
-		fprintf(out, "n=%.0f\n", (double)rstats.count);
-#endif
+		fprintf(out, "n=%jd\n", rstats.count);
 
 		if (!rflag->answer) {
 		    fprintf(out, "min=%.15g\n", zmin);



More information about the grass-commit mailing list