[GRASS-SVN] r52845 - grass/branches/releasebranch_6_4/raster/r.report

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 22 13:46:30 PDT 2012


Author: mmetz
Date: 2012-08-22 13:46:29 -0700 (Wed, 22 Aug 2012)
New Revision: 52845

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

Modified: grass/branches/releasebranch_6_4/raster/r.report/header.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.report/header.c	2012-08-22 20:45:54 UTC (rev 52844)
+++ grass/branches/releasebranch_6_4/raster/r.report/header.c	2012-08-22 20:46:29 UTC (rev 52845)
@@ -73,10 +73,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 = "";
@@ -91,6 +91,7 @@
 	 */
 
 	label = nlayers > 1 ? "MAPS:" : "MAP:";
+	len1 = strlen(label) + 1;
 	for (i = 0; i < nlayers; i++) {
 	    char *title;
 

Modified: grass/branches/releasebranch_6_4/raster/r.report/label.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.report/label.c	2012-08-22 20:45:54 UTC (rev 52844)
+++ grass/branches/releasebranch_6_4/raster/r.report/label.c	2012-08-22 20:46:29 UTC (rev 52845)
@@ -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