[GRASS-SVN] r46380 - grass/branches/develbranch_6/ps/ps.map

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 23 06:09:40 EDT 2011


Author: hamish
Date: 2011-05-23 03:09:40 -0700 (Mon, 23 May 2011)
New Revision: 46380

Modified:
   grass/branches/develbranch_6/ps/ps.map/box.c
   grass/branches/develbranch_6/ps/ps.map/main.c
   grass/branches/develbranch_6/ps/ps.map/map_setup.c
Log:
merge -b flag fixes from relbr4:
 - explicitly zero the output file pointer (if only for clarity's sake);
 - don't try to remove an output file we never created;
 - jump out of map_setup() before trying to write anything


Modified: grass/branches/develbranch_6/ps/ps.map/box.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/box.c	2011-05-23 09:20:55 UTC (rev 46379)
+++ grass/branches/develbranch_6/ps/ps.map/box.c	2011-05-23 10:09:40 UTC (rev 46380)
@@ -7,8 +7,7 @@
 
 int box_path(double t, double b, double l, double r)
 {
-    if (PS.fp)
-	fprintf(PS.fp, "%.1f %.1f %.1f %.1f B ", l, b, r, t);
+    fprintf(PS.fp, "%.1f %.1f %.1f %.1f B ", l, b, r, t);
 
     return 0;
 }
@@ -16,8 +15,7 @@
 int box_clip(double t, double b, double l, double r)
 {
     box_path(t, b, l, r);
-    if (PS.fp)
-	fprintf(PS.fp, "clip newpath\n");
+    fprintf(PS.fp, "clip newpath\n");
     
     return 0;
 }

Modified: grass/branches/develbranch_6/ps/ps.map/main.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/main.c	2011-05-23 09:20:55 UTC (rev 46379)
+++ grass/branches/develbranch_6/ps/ps.map/main.c	2011-05-23 10:09:40 UTC (rev 46380)
@@ -235,7 +235,9 @@
 			  output_file->key, output_file->description);
 	}
     }
-    
+    else
+	PS.fp = NULL;
+
     /* get current mapset */
     PS.cell_mapset = G_mapset();
 
@@ -256,7 +258,6 @@
 		PS.page_height - (PS.map_bot / 72.0), PS.map_right / 72.0,
 		PS.page_height - (PS.map_top / 72.0));
 		/* +/- 0.5 ? see ps.map.c brd.* */
-	unlink(output_file->answer); /* fixme: don't open it in the first place */
 	exit(EXIT_SUCCESS);
     }
 

Modified: grass/branches/develbranch_6/ps/ps.map/map_setup.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/map_setup.c	2011-05-23 09:20:55 UTC (rev 46379)
+++ grass/branches/develbranch_6/ps/ps.map/map_setup.c	2011-05-23 10:09:40 UTC (rev 46380)
@@ -103,9 +103,13 @@
        PS.map_bot, PS.map_left, PS.map_right);
      */
 
+    /* no need to go on if we're just here for a look-see. (-b flag) */
+    if (!PS.fp)
+	return 0;
+
+
     /* save original graphics state */
-    if (PS.fp)
-	fprintf(PS.fp, "gsave ");
+    fprintf(PS.fp, "gsave ");
     
     /* compute conversion factor from meters to PostScript window coordinates */
     /*



More information about the grass-commit mailing list