Przeglądaj źródła

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.

minor cosmetics to code comment and man page.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@46381 15284696-431f-4ddb-bdfa-cd5b030d7da7

Hamish Bowman 14 lat temu
rodzic
commit
1eb5f3f076
5 zmienionych plików z 13 dodań i 12 usunięć
  1. 2 4
      ps/ps.map/box.c
  2. 1 3
      ps/ps.map/do_scalebar.c
  3. 3 2
      ps/ps.map/main.c
  4. 6 2
      ps/ps.map/map_setup.c
  5. 1 1
      ps/ps.map/ps.map.html

+ 2 - 4
ps/ps.map/box.c

@@ -7,8 +7,7 @@
 
 
 int box_path(double t, double b, double l, double r)
 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;
     return 0;
 }
 }
@@ -16,8 +15,7 @@ int box_path(double t, double b, double l, double r)
 int box_clip(double t, double b, double l, double r)
 int box_clip(double t, double b, double l, double r)
 {
 {
     box_path(t, b, l, r);
     box_path(t, b, l, r);
-    if (PS.fp)
-	fprintf(PS.fp, "clip newpath\n");
+    fprintf(PS.fp, "clip newpath\n");
     
     
     return 0;
     return 0;
 }
 }

+ 1 - 3
ps/ps.map/do_scalebar.c

@@ -1,6 +1,4 @@
-/* Function to draw scalebar on page 
- * **
- */
+/* Function to draw scalebar on page */
 
 
 #include <string.h>
 #include <string.h>
 #include <math.h>
 #include <math.h>

+ 3 - 2
ps/ps.map/main.c

@@ -235,7 +235,9 @@ int main(int argc, char *argv[])
 			  output_file->key, output_file->description);
 			  output_file->key, output_file->description);
 	}
 	}
     }
     }
-    
+    else
+	PS.fp = NULL;
+
     /* get current mapset */
     /* get current mapset */
     PS.cell_mapset = G_mapset();
     PS.cell_mapset = G_mapset();
 
 
@@ -255,7 +257,6 @@ int main(int argc, char *argv[])
 		PS.page_height - (PS.map_bot / 72.0), PS.map_right / 72.0,
 		PS.page_height - (PS.map_bot / 72.0), PS.map_right / 72.0,
 		PS.page_height - (PS.map_top / 72.0));
 		PS.page_height - (PS.map_top / 72.0));
 		/* +/- 0.5 ? see ps.map.c brd.* */
 		/* +/- 0.5 ? see ps.map.c brd.* */
-	unlink(output_file->answer); /* fixme: don't open it in the first place */
 	exit(EXIT_SUCCESS);
 	exit(EXIT_SUCCESS);
     }
     }
 
 

+ 6 - 2
ps/ps.map/map_setup.c

@@ -103,9 +103,13 @@ int map_setup(void)
        PS.map_bot, PS.map_left, PS.map_right);
        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 */
     /* save original graphics state */
-    if (PS.fp)
-	fprintf(PS.fp, "gsave ");
+    fprintf(PS.fp, "gsave ");
     
     
     /* compute conversion factor from meters to PostScript window coordinates */
     /* compute conversion factor from meters to PostScript window coordinates */
     /*
     /*

+ 1 - 1
ps/ps.map/ps.map.html

@@ -1229,7 +1229,7 @@ This reference point specifies the text handle - what
 part of the text should be placed on the location specified by the map
 part of the text should be placed on the location specified by the map
 coordinates.  Reference points can refer to:
 coordinates.  Reference points can refer to:
 [lower|upper|center] [left|right|center] of the text to be printed;
 [lower|upper|center] [left|right|center] of the text to be printed;
-The default is center center, i.e the text is centered on the reference point.
+The default is center center, i.e. the text is centered on the reference point.
 <P>
 <P>
 <B>rotate</B>
 <B>rotate</B>
 sets the text rotation angle, measured in degrees counter-clockwise.
 sets the text rotation angle, measured in degrees counter-clockwise.