[GRASS-SVN] r45112 - grass/branches/develbranch_6/imagery/i.rectify

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 20 14:31:41 EST 2011


Author: mmetz
Date: 2011-01-20 11:31:41 -0800 (Thu, 20 Jan 2011)
New Revision: 45112

Modified:
   grass/branches/develbranch_6/imagery/i.rectify/main.c
   grass/branches/develbranch_6/imagery/i.rectify/readcell.c
   grass/branches/develbranch_6/imagery/i.rectify/rectify.c
Log:
Temporary file must be created in input location

Modified: grass/branches/develbranch_6/imagery/i.rectify/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.rectify/main.c	2011-01-20 19:30:28 UTC (rev 45111)
+++ grass/branches/develbranch_6/imagery/i.rectify/main.c	2011-01-20 19:31:41 UTC (rev 45112)
@@ -25,8 +25,8 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include "global.h"
 #include <grass/glocale.h>
-#include "global.h"
 #include "crs.h"
 
 char *seg_mb;
@@ -76,6 +76,7 @@
     int method;
     int n, i, m, k = 0;
     int got_file = 0;
+    struct Cell_head cellhd;
 
     struct Option *grp,         /* imagery group */
      *val,                      /* transformation order */
@@ -88,8 +89,6 @@
     struct Flag *c, *a;
     struct GModule *module;
 
-    struct Cell_head cellhd;
-
     setbuf(stdout, NULL);
     setbuf(stderr, NULL);
 
@@ -153,7 +152,6 @@
     a->key = 'a';
     a->description = _("Rectify all raster maps in group");
 
-
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -178,11 +176,10 @@
 	    seg_mb = mem->answer;
     }
 
-
     if (!ifile->answers)
 	a->answer = 1;		/* force all */
 
-    /* Find out how files on command line */
+    /* Find out how many files on command line */
     if (!a->answer) {
 	for (m = 0; ifile->answers[m]; m++) {
 	    k = m;
@@ -217,6 +214,10 @@
     }
     else {
 	char xname[GNAME_MAX], xmapset[GMAPSET_MAX], *name;
+
+	for (n = 0; n < ref.nfiles; n++)
+		ref_list[n] = 0;
+
 	for (m = 0; m < k; m++) {
 	    got_file = 0;
 	    if (G__name_is_fully_qualified(ifile->answers[m], xname, xmapset))

Modified: grass/branches/develbranch_6/imagery/i.rectify/readcell.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.rectify/readcell.c	2011-01-20 19:30:28 UTC (rev 45111)
+++ grass/branches/develbranch_6/imagery/i.rectify/readcell.c	2011-01-20 19:31:41 UTC (rev 45112)
@@ -48,10 +48,8 @@
     c->refs = (int *)G_malloc(nblocks * sizeof(int));
 
     if (nblocks < nx * ny) {
-	/* Temporary file must be created in output location */
-	select_target_env();
+	/* Temporary file must be created in input location */
 	filename = G_tempfile();
-	select_current_env();
 	c->fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600);
 	if (c->fd < 0)
 	    G_fatal_error(_("Unable to open temporary file"));

Modified: grass/branches/develbranch_6/imagery/i.rectify/rectify.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.rectify/rectify.c	2011-01-20 19:30:28 UTC (rev 45111)
+++ grass/branches/develbranch_6/imagery/i.rectify/rectify.c	2011-01-20 19:31:41 UTC (rev 45112)
@@ -31,7 +31,6 @@
     G_set_window(&cellhd);
     infd = G_open_cell_old(name, mapset);
     if (infd < 0) {
-	close(infd);
 	return 0;
     }
     map_type = G_get_raster_map_type(infd);
@@ -41,12 +40,8 @@
 
     G_close_cell(infd);		/* (pmx) 17 april 2000 */
 
-    G_message(_("Rectify <%s@%s> (location <%s>)"),
-	      name, mapset, G_location());
     select_target_env();
     G_set_window(&target_window);
-    G_message(_("into  <%s@%s> (location <%s>) ..."),
-	      result, G_mapset(), G_location());
 
     nrows = target_window.rows;
     ncols = target_window.cols;



More information about the grass-commit mailing list