Browse Source

adjust to https://trac.osgeo.org/grass/changeset/42876

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@42897 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 15 years ago
parent
commit
ad69c38bbf
3 changed files with 8 additions and 4 deletions
  1. 3 1
      imagery/i.rectify/main.c
  2. 2 2
      imagery/i.rectify/rectify.c
  3. 3 1
      imagery/i.rectify/write.c

+ 3 - 1
imagery/i.rectify/main.c

@@ -187,7 +187,9 @@ int main(int argc, char *argv[])
 
     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 */

+ 2 - 2
imagery/i.rectify/rectify.c

@@ -41,8 +41,8 @@ int rectify(char *name, char *mapset, char *result, int order)
     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;
 

+ 3 - 1
imagery/i.rectify/write.c

@@ -43,7 +43,8 @@ int write_map(char *name)
 
     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 @@ int write_map(char *name)
     close(temp_fd);
     unlink(temp_name);
     Rast_close(fd);
+    G_free(rast);
 
     return 0;
 }