[GRASS-SVN] r42897 - grass/trunk/imagery/i.rectify

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 26 05:14:12 EDT 2010


Author: mmetz
Date: 2010-07-26 09:14:12 +0000 (Mon, 26 Jul 2010)
New Revision: 42897

Modified:
   grass/trunk/imagery/i.rectify/main.c
   grass/trunk/imagery/i.rectify/rectify.c
   grass/trunk/imagery/i.rectify/write.c
Log:
adjust to r42876

Modified: grass/trunk/imagery/i.rectify/main.c
===================================================================
--- grass/trunk/imagery/i.rectify/main.c	2010-07-25 21:25:09 UTC (rev 42896)
+++ grass/trunk/imagery/i.rectify/main.c	2010-07-26 09:14:12 UTC (rev 42897)
@@ -187,7 +187,9 @@
 
     if (c->answer) {
 	/* Use current Region */
-	G_get_window(&target_window);
+	select_target_env();
+	G__get_window(&target_window, "", "WIND", G_mapset());
+	select_current_env();
     }
     else {
 	/* Calculate smallest region */

Modified: grass/trunk/imagery/i.rectify/rectify.c
===================================================================
--- grass/trunk/imagery/i.rectify/rectify.c	2010-07-25 21:25:09 UTC (rev 42896)
+++ grass/trunk/imagery/i.rectify/rectify.c	2010-07-26 09:14:12 UTC (rev 42897)
@@ -41,8 +41,8 @@
     Rast_set_input_window(&cellhd);
     infd = Rast_open_old(name, mapset);
     map_type = Rast_get_map_type(infd);
-    rast = (void *)G_calloc(Rast_window_cols() + 1, Rast_cell_size(map_type));
-    Rast_set_null_value(rast, Rast_window_cols() + 1, map_type);
+    rast = (void *)G_calloc(cellhd.cols + 1, Rast_cell_size(map_type));
+    Rast_set_null_value(rast, cellhd.cols + 1, map_type);
 
     win = target_window;
 

Modified: grass/trunk/imagery/i.rectify/write.c
===================================================================
--- grass/trunk/imagery/i.rectify/write.c	2010-07-25 21:25:09 UTC (rev 42896)
+++ grass/trunk/imagery/i.rectify/write.c	2010-07-26 09:14:12 UTC (rev 42897)
@@ -43,7 +43,8 @@
 
     Rast_set_output_window(&target_window);
 
-    rast = Rast_allocate_buf(map_type);
+    /* working with split windows, can not use Rast_allocate_buf(map_type); */
+    rast = G_malloc(target_window.cols * Rast_cell_size(map_type));
     close(temp_fd);
     temp_fd = open(temp_name, 0);
     fd = Rast_open_new(name, map_type);
@@ -57,6 +58,7 @@
     close(temp_fd);
     unlink(temp_name);
     Rast_close(fd);
+    G_free(rast);
 
     return 0;
 }



More information about the grass-commit mailing list