[GRASS5] i.rectify and large files

Glynn Clements glynn at gclements.plus.com
Fri Apr 7 17:39:12 EDT 2006


Wolf Bergenheim wrote:

> All I had to do was add
> #define _FILE_OFFSET_BITS 64
> to the beginning of the file. Now it seems to work. This is probably not 
> the best way to do it, so if someone can tell me the correct way to do 
> this, I will fix it, and then commit changes to the CVS (time I 
> contributed something back again).

Try the attached patch.

-- 
Glynn Clements <glynn at gclements.plus.com>

-------------- next part --------------
Index: imagery/i.rectify/write.c
===================================================================
RCS file: /grassrepository/grass6/imagery/i.rectify/write.c,v
retrieving revision 2.0
diff -u -r2.0 write.c
--- imagery/i.rectify/write.c	9 Nov 2004 13:02:29 -0000	2.0
+++ imagery/i.rectify/write.c	7 Apr 2006 21:37:56 -0000
@@ -2,6 +2,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <grass/config.h>
 #include "global.h"
 
 /********************************************
@@ -13,7 +14,6 @@
 int write_matrix (int row, int col)
 {
     int n;
-    long offset;
 
     select_target_env();
     if(!temp_fd) 
@@ -23,7 +23,7 @@
     }
     for (n=0; n < matrix_rows; n++)
     {
-        offset = (row++ * target_window.cols + col) * G_raster_size(map_type);
+        off_t offset = ((off_t) row++ * target_window.cols + col) * G_raster_size(map_type);
         lseek(temp_fd,offset,0);
 
         if(write(temp_fd,cell_buf[n],G_raster_size(map_type)*matrix_cols) 


More information about the grass-dev mailing list