[GRASS-SVN] r46944 - grass/trunk/lib/cairodriver

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 4 03:39:49 EDT 2011


Author: martinl
Date: 2011-07-04 00:39:49 -0700 (Mon, 04 Jul 2011)
New Revision: 46944

Modified:
   grass/trunk/lib/cairodriver/Driver.c
   grass/trunk/lib/cairodriver/Graph.c
   grass/trunk/lib/cairodriver/cairodriver.html
   grass/trunk/lib/cairodriver/read.c
   grass/trunk/lib/cairodriver/read_ppm.c
Log:
cairodriver: fix segfault for ppm (GRASS_PNG_READ=TRUE)
	     minor fix in headers and messages


Modified: grass/trunk/lib/cairodriver/Driver.c
===================================================================
--- grass/trunk/lib/cairodriver/Driver.c	2011-07-03 21:42:19 UTC (rev 46943)
+++ grass/trunk/lib/cairodriver/Driver.c	2011-07-04 07:39:49 UTC (rev 46944)
@@ -1,9 +1,9 @@
 /*!
-  \file cairodriver/Driver.c
+  \file lib/cairodriver/Driver.c
 
   \brief GRASS cairo display driver - driver initialization
 
-  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  (C) 2007-2008, 2011 by Lars Ahlzen and the GRASS Development Team
   
   This program is free software under the GNU General Public License
   (>=v2). Read the file COPYING that comes with GRASS for details.

Modified: grass/trunk/lib/cairodriver/Graph.c
===================================================================
--- grass/trunk/lib/cairodriver/Graph.c	2011-07-03 21:42:19 UTC (rev 46943)
+++ grass/trunk/lib/cairodriver/Graph.c	2011-07-04 07:39:49 UTC (rev 46944)
@@ -1,9 +1,9 @@
 /*!
-  \file cairodriver/Graph.c
+  \file lib/cairodriver/Graph.c
 
   \brief GRASS cairo display driver - driver settings
 
-  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  (C) 2007-2008, 2011 by Lars Ahlzen and the GRASS Development Team
   
   This program is free software under the GNU General Public License
   (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -174,9 +174,9 @@
     if (do_read && access(ca.file_name, 0) != 0)
 	do_read = 0;
 
-    G_verbose_message(_("cairo: collecting to file: %s"),
+    G_verbose_message(_("cairo: collecting to file '%s'"),
 		      ca.file_name);
-    G_verbose_message(_("GRASS_WIDTH=%d, GRASS_HEIGHT=%d"),
+    G_verbose_message(_("cairo: image size %dx%d"),
 		      ca.width, ca.height);
     
     if (do_read && do_map)
@@ -382,7 +382,7 @@
 	cairo_surface_destroy(surface);
 	G_free(ca.grid);
     }
-    ca.grid = (char *)ptr + HEADER_SIZE;
+    ca.grid = (unsigned char *) ptr + HEADER_SIZE;
 
     close(fd);
 

Modified: grass/trunk/lib/cairodriver/cairodriver.html
===================================================================
--- grass/trunk/lib/cairodriver/cairodriver.html	2011-07-03 21:42:19 UTC (rev 46943)
+++ grass/trunk/lib/cairodriver/cairodriver.html	2011-07-04 07:39:49 UTC (rev 46944)
@@ -102,6 +102,7 @@
 export GRASS_WIDTH=800
 export GRASS_HEIGHT=800
 export GRASS_RENDER_IMMEDIATE=CAIRO
+export GRASS_PNG_READ=TRUE
 
 d.rast map=elevation.10m
 d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
@@ -114,6 +115,7 @@
 export GRASS_WIDTH=800
 export GRASS_HEIGHT=800
 export GRASS_RENDER_IMMEDIATE=CAIRO
+export GRASS_PNG_READ=TRUE
 
 d.rast map=elevation.10m
 d.vect map=streams width=1 color=blue fcolor=aqua type=area,line

Modified: grass/trunk/lib/cairodriver/read.c
===================================================================
--- grass/trunk/lib/cairodriver/read.c	2011-07-03 21:42:19 UTC (rev 46943)
+++ grass/trunk/lib/cairodriver/read.c	2011-07-04 07:39:49 UTC (rev 46944)
@@ -1,9 +1,9 @@
 /*!
-  \file cairodriver/read.c
+  \file lib/cairodriver/read.c
 
   \brief GRASS cairo display driver - read image (lower level functions)
 
-  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  (C) 2007-2008, 2011 by Lars Ahlzen and the GRASS Development Team
   
   This program is free software under the GNU General Public License
   (>=v2). Read the file COPYING that comes with GRASS for details.

Modified: grass/trunk/lib/cairodriver/read_ppm.c
===================================================================
--- grass/trunk/lib/cairodriver/read_ppm.c	2011-07-03 21:42:19 UTC (rev 46943)
+++ grass/trunk/lib/cairodriver/read_ppm.c	2011-07-04 07:39:49 UTC (rev 46944)
@@ -1,9 +1,9 @@
 /*!
-  \file cairodriver/read_ppm.c
+  \file lib/cairodriver/read_ppm.c
 
   \brief GRASS cairo display driver - read PPM image (lower level functions)
 
-  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  (C) 2007-2008, 2011 by Lars Ahlzen and the GRASS Development Team
   
   This program is free software under the GNU General Public License
   (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -41,16 +41,16 @@
 
     mask_name[strlen(mask_name) - 2] = 'g';
 
-    input = fopen(mask_name, "rb");
-    if (!input)
+    mask = fopen(mask_name, "rb");
+    if (!mask)
 	G_fatal_error(_("Cairo: unable to open input mask file <%s>"),
 		      mask_name);
 
-    if (fscanf(input, "P5 %d %d %d", &i_width, &i_height, &maxval) != 3)
+    if (fscanf(mask, "P5 %d %d %d", &i_width, &i_height, &maxval) != 3)
 	G_fatal_error(_("Cairo: invalid input mask file <%s>"),
 		      mask_name);
 
-    fgetc(input);
+    fgetc(mask);
 
     if (i_width != ca.width || i_height != ca.height)
 	G_fatal_error(_("Cairo: input mask file has incorrect dimensions: "



More information about the grass-commit mailing list