[GRASS-SVN] r52817 - grass/trunk/raster/r.report

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 21 07:31:40 PDT 2012


Author: mmetz
Date: 2012-08-21 07:31:40 -0700 (Tue, 21 Aug 2012)
New Revision: 52817

Modified:
   grass/trunk/raster/r.report/header.c
   grass/trunk/raster/r.report/label.c
Log:
r.report: fix for #970

Modified: grass/trunk/raster/r.report/header.c
===================================================================
--- grass/trunk/raster/r.report/header.c	2012-08-21 14:15:03 UTC (rev 52816)
+++ grass/trunk/raster/r.report/header.c	2012-08-21 14:31:40 UTC (rev 52817)
@@ -72,10 +72,10 @@
 	divider("|");
 
 	label = nlayers > 1 ? "MAPS:" : "MAP:";
-	len1 = strlen(label) + 1;
 
 	mask = maskinfo();
 	label = "MASK:";
+	len1 = strlen(label) + 1;
 	while (mask) {
 	    fprintf(stdout, "|%-*s", len1, label);
 	    label = "";

Modified: grass/trunk/raster/r.report/label.c
===================================================================
--- grass/trunk/raster/r.report/label.c	2012-08-21 14:15:03 UTC (rev 52816)
+++ grass/trunk/raster/r.report/label.c	2012-08-21 14:31:40 UTC (rev 52817)
@@ -1,5 +1,7 @@
 #include <string.h>
 #include <stdio.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
 
 char *print_label(char *s, int len, int pflag, int spacing, int dot)
 {
@@ -7,6 +9,11 @@
     int n;
     int i;
 
+    if (len <= 0) {
+	G_warning(_("Page width is too small"));
+	return NULL;
+    }
+
     /* strip away leading spaces */
     while (*s == ' ')
 	s++;



More information about the grass-commit mailing list