[GRASS-SVN] r38658 - grass/trunk/raster3d/r3.out.v5d

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 9 12:11:10 EDT 2009


Author: mmetz
Date: 2009-08-09 12:11:10 -0400 (Sun, 09 Aug 2009)
New Revision: 38658

Modified:
   grass/trunk/raster3d/r3.out.v5d/Makefile
   grass/trunk/raster3d/r3.out.v5d/main.c
   grass/trunk/raster3d/r3.out.v5d/v5d.c
   grass/trunk/raster3d/r3.out.v5d/v5d.h
Log:
r3.out.v5d LFS-safe, awaits testing

Modified: grass/trunk/raster3d/r3.out.v5d/Makefile
===================================================================
--- grass/trunk/raster3d/r3.out.v5d/Makefile	2009-08-09 16:03:50 UTC (rev 38657)
+++ grass/trunk/raster3d/r3.out.v5d/Makefile	2009-08-09 16:11:10 UTC (rev 38658)
@@ -5,6 +5,11 @@
 #for Linux/x86 et al. (needs fix for MacOSX)
 EXTRA_CFLAGS = -DLITTLE
 
+#compile if LFS Large File Support present:
+ifneq ($(USE_LARGEFILES),)
+	EXTRA_CFLAGS += -D_FILE_OFFSET_BITS=64
+endif
+
 LIBES = $(G3DLIB) $(GISLIB)
 DEPENDENCIES = $(G3DDEP) $(GISDEP)
 

Modified: grass/trunk/raster3d/r3.out.v5d/main.c
===================================================================
--- grass/trunk/raster3d/r3.out.v5d/main.c	2009-08-09 16:03:50 UTC (rev 38657)
+++ grass/trunk/raster3d/r3.out.v5d/main.c	2009-08-09 16:11:10 UTC (rev 38658)
@@ -256,7 +256,7 @@
     /* Create the output v5d file */
 
      /*AV*/
-	if (!v5dCreate(fileout, NumTimes, NumVars, rows, cols, Nl, VarName,
+	if (!v5dCreate(fileout, NumTimes, NumVars, rows, cols, Nl, (const char (*)[10])VarName,
 		       TimeStamp, DateStamp, CompressMode, Projection,
 		       ProjArgs, Vertical, VertArgs))
 	G_fatal_error(_("Error: couldn't create %s"), fileout);

Modified: grass/trunk/raster3d/r3.out.v5d/v5d.c
===================================================================
--- grass/trunk/raster3d/r3.out.v5d/v5d.c	2009-08-09 16:03:50 UTC (rev 38657)
+++ grass/trunk/raster3d/r3.out.v5d/v5d.c	2009-08-09 16:11:10 UTC (rev 38658)
@@ -64,12 +64,12 @@
 
 
 
+#include <grass/config.h>
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
-#include <grass/config.h>
 #include <grass/gis.h>
 #include "binio.h"
 #include "v5d.h"
@@ -337,8 +337,8 @@
     else {
 	printf("Compression:  %d bytes per gridpoint.\n", v->CompressMode);
     }
-    printf("header size=%d\n", v->FirstGridPos);
-    printf("sizeof(v5dstruct)=%d\n", sizeof(v5dstruct));
+    printf("header size=%d\n", (int)v->FirstGridPos);
+    printf("sizeof(v5dstruct)=%d\n", (int)sizeof(v5dstruct));
     printf("\n");
 
     printf("NumVars = %d\n", v->NumVars);
@@ -465,9 +465,10 @@
  *         time, var - which timestep and variable.
  * Return:  file offset in bytes
  */
-static int grid_position(const v5dstruct * v, int time, int var)
+static off_t grid_position(const v5dstruct * v, int time, int var)
 {
-    int pos, i;
+    int i;
+    off_t pos;
 
     assert(time >= 0);
     assert(var >= 0);
@@ -1309,7 +1310,7 @@
 	/* Older COMP5D format */
 	int gridtimes, gridparms;
 	int i, j, it, iv, nl;
-	int gridsize;
+	off_t gridsize;
 	float hgttop, hgtinc;
 
 	/*char *compgrid; */
@@ -2026,7 +2027,8 @@
 int v5dReadCompressedGrid(v5dstruct * v, int time, int var,
 			  float *ga, float *gb, void *compdata)
 {
-    int pos, n, k;
+    int n, k;
+    off_t pos;
 
     if (time < 0 || time >= v->NumTimes) {
 	printf("Error in v5dReadCompressedGrid: bad timestep argument (%d)\n",
@@ -2178,7 +2180,8 @@
  */
 static int write_v5d_header(v5dstruct * v)
 {
-    int var, time, filler, maxnl;
+    int var, time, maxnl;
+    off_t filler;
     int f;
     int newfile;
 
@@ -2407,7 +2410,8 @@
 			   const float *ga, const float *gb,
 			   const void *compdata)
 {
-    int pos, n, k;
+    int n, k;
+    off_t pos;
 
     /* simple error checks */
     if (v->Mode != 'w') {

Modified: grass/trunk/raster3d/r3.out.v5d/v5d.h
===================================================================
--- grass/trunk/raster3d/r3.out.v5d/v5d.h	2009-08-09 16:03:50 UTC (rev 38657)
+++ grass/trunk/raster3d/r3.out.v5d/v5d.h	2009-08-09 16:11:10 UTC (rev 38658)
@@ -26,6 +26,7 @@
 #ifndef V5D_H
 #define V5D_H
 
+#include <sys/types.h>
 
 /*
  * A numeric version number which we can test for in utility programs which
@@ -232,10 +233,10 @@
     unsigned int FileFormat;	/* COMP5D file version or 0 if .v5d */
     int FileDesc;		/* Unix file descriptor */
     char Mode;			/* 'r' = read, 'w' = write */
-    int CurPos;			/* current position of file pointer */
-    int FirstGridPos;		/* position of first grid in file */
-    int GridSize[MAXVARS];	/* size of each grid */
-    int SumGridSizes;		/* sum of GridSize[0..NumVars-1] */
+    off_t CurPos;			/* current position of file pointer */
+    off_t FirstGridPos;		/* position of first grid in file */
+    off_t GridSize[MAXVARS];	/* size of each grid */
+    off_t SumGridSizes;		/* sum of GridSize[0..NumVars-1] */
 } v5dstruct;
 
 



More information about the grass-commit mailing list