[GRASS-SVN] r38397 - grass/trunk/lib/vector/diglib

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 13 11:28:51 EDT 2009


Author: mmetz
Date: 2009-07-13 11:28:51 -0400 (Mon, 13 Jul 2009)
New Revision: 38397

Modified:
   grass/trunk/lib/vector/diglib/spindex_rw.c
Log:
write sidx fixed

Modified: grass/trunk/lib/vector/diglib/spindex_rw.c
===================================================================
--- grass/trunk/lib/vector/diglib/spindex_rw.c	2009-07-13 15:12:25 UTC (rev 38396)
+++ grass/trunk/lib/vector/diglib/spindex_rw.c	2009-07-13 15:28:51 UTC (rev 38397)
@@ -598,7 +598,10 @@
     } s[50];
     int top = 0;
 
-    sidx_nodesize = t->nodesize - MAXCARD * (sizeof(off_t) - off_t_size);
+    /* should be foolproof */
+    sidx_nodesize =
+	(int)(2 * sizeof(int) +
+	      MAXCARD * (off_t_size + NUMSIDES * sizeof(double)));
 
     /* stack size of t->n_levels + 1 would be enough because of depth first search */
     /* only one node per level on stack at any given time */
@@ -634,7 +637,7 @@
 	if (writeout) {
 	    /* write node to sidx file */
 	    if (G_ftell(fp->file) != nextfreepos)
-		G_fatal_error("position mismatch");
+		G_fatal_error("write sidx: wrong node position in file");
 
 	    /* write with dig__fwrite_port_* fns */
 	    dig__fwrite_port_I(&(s[top].sn->count), 1, fp);



More information about the grass-commit mailing list