[GRASS-SVN] r56095 - in grass/trunk: include/vect lib/vector/Vlib lib/vector/diglib

svn_grass at osgeo.org svn_grass at osgeo.org
Fri May 3 02:28:13 PDT 2013


Author: martinl
Date: 2013-05-03 02:28:13 -0700 (Fri, 03 May 2013)
New Revision: 56095

Modified:
   grass/trunk/include/vect/dig_structs.h
   grass/trunk/lib/vector/Vlib/geos.c
   grass/trunk/lib/vector/Vlib/open_nat.c
   grass/trunk/lib/vector/Vlib/read_nat.c
   grass/trunk/lib/vector/Vlib/write_nat.c
   grass/trunk/lib/vector/diglib/cindex_rw.c
   grass/trunk/lib/vector/diglib/head.c
   grass/trunk/lib/vector/diglib/plus.c
   grass/trunk/lib/vector/diglib/plus_struct.c
   grass/trunk/lib/vector/diglib/spindex_rw.c
Log:
vlib: store backward version info one place


Modified: grass/trunk/include/vect/dig_structs.h
===================================================================
--- grass/trunk/include/vect/dig_structs.h	2013-05-03 02:20:55 UTC (rev 56094)
+++ grass/trunk/include/vect/dig_structs.h	2013-05-03 09:28:13 UTC (rev 56095)
@@ -37,11 +37,10 @@
 /*!
   \brief plus_t size
 
-  3.10 changes plus_t to int. This assumes that any reasonable
-  machine will use 4 bytes to store an int. The diglib code is not
-  guaranteed to work if plus_t is changed to a type that is larger
-  than an int.
-*/
+  3.10 changes plus_t to int. This assumes that any reasonable machine
+  will use 4 bytes to store an int. The diglib code is not guaranteed
+  to work if plus_t is changed to a type that is larger than an int.
+  */
 typedef int plus_t;
 
 /*!
@@ -327,24 +326,7 @@
     /* Programmers should NOT touch any thing below here */
     /* Library takes care of everything for you          */
 
-    /* coor elements */
     /*!
-      \brief Backward compatibility info - major version
-    */
-    int Version_Major;
-    /*!
-      \brief Backward compatibility info - minor version
-    */
-    int Version_Minor;
-    /*!
-      \brief Backward compatibility info - back major version
-    */
-    int Back_Major;
-    /*!
-      \brief Backward compatibility info - back minor version
-    */
-    int Back_Minor;
-    /*!
       \brief 2D/3D vector data
 
       - zero for 2D data
@@ -738,6 +720,18 @@
     off_t offset;
 };
 
+/*! Backward compatibility version info */
+struct Version_info {
+    /*! Current version (major) */
+    int major;
+    /*! Current version (minor) */
+    int minor;
+    /*! Earliest version that can use this data format (major) */
+    int back_major;
+    /*! Earliest version that can use this data format (minor) */
+    int back_minor;
+};
+
 /*!
   \brief Basic topology-related info
 
@@ -745,57 +739,19 @@
 */
 struct Plus_head
 {
-    /*!
-      \brief Version info (major)
-    */
-    int Version_Major;
-    /*!
-      \brief Version info (minor)
-    */
-    int Version_Minor;
-    /*!
-      \brief Earliest version that can use this data format (major)
-    */
-    int Back_Major;		 
-    /*!
-      \brief Earliest version that can use this data format (minor)
-    */
-    int Back_Minor;
-    /*!
-      \brief Version codes for spatial index (major)
-    */
-    int spidx_Version_Major;
-    /*!
-      \brief Version codes for spatial index (minor)
-    */
-    int spidx_Version_Minor;
-    /*!
-      \brief Earliest version that can use this data format (major)
-    */
-    int spidx_Back_Major;
-     /*!
-       \brief Earliest version that can use this data format (minor)
-    */
-    int spidx_Back_Minor;
+    /*! Backward compatibility version info */
+    struct {
+        /*! Version info for coor file */
+        struct Version_info coor;
+        /*! Version info for topology file */
+        struct Version_info topo;
+        /*! Version info for spatial index file */
+        struct Version_info spidx;
+        /*! Version info for category index file */
+        struct Version_info cidx;
+    } version;
 
     /*!
-      \brief Version codes for category index (major)
-    */
-    int cidx_Version_Major;
-    /*!
-      \brief Version codes for category index (minor)
-    */
-    int cidx_Version_Minor;
-    /*!
-      \brief Earliest version that can use this data format (major)
-    */
-    int cidx_Back_Major;
-    /*!
-      \brief Earliest version that can use this data format (minor)
-    */
-    int cidx_Back_Minor;
-
-    /*!
       \brief 2D/3D vector data
 
       - WITH_Z
@@ -1283,7 +1239,7 @@
     struct dblinks *dblnk;
 
     /*!
-      \brief Topology info
+      \brief Plus info (topology, version, ...)
     */
     struct Plus_head plus;
 
@@ -1329,13 +1285,6 @@
     int support_updated;
 
     /*!
-      \brief Sequential read (level 1) - see Vect_read_next_line()
-
-      Note: Line id starts with 1
-    */
-    plus_t next_line;
-
-    /*!
       \brief Map name (for 4.0)
     */
     char *name;
@@ -1355,6 +1304,13 @@
     char *gisdbase;
 
     /*!
+      \brief Feature id for sequential access 
+
+      Note: Line id starts with 1 - see Vect_read_next_line()
+    */
+    plus_t next_line;
+
+    /*!
       \brief Constraints for sequential feature access
     */
     struct {
@@ -1398,6 +1354,11 @@
       \brief Graph info (built for network analysis)
     */
     struct Graph_info dgraph;
+
+    /*!
+      \brief Header info
+    */
+    struct dig_head head;
     
     /*** format specific ***/
 
@@ -1405,10 +1366,6 @@
       \brief GV file pointer (native format only)
     */
     struct gvfile dig_fp;
-    /*!
-      \brief Coor file header info (native format only)
-    */
-    struct dig_head head;
 
     /*!
       \brief Format info for non-native formats

Modified: grass/trunk/lib/vector/Vlib/geos.c
===================================================================
--- grass/trunk/lib/vector/Vlib/geos.c	2013-05-03 02:20:55 UTC (rev 56094)
+++ grass/trunk/lib/vector/Vlib/geos.c	2013-05-03 09:28:13 UTC (rev 56095)
@@ -314,7 +314,7 @@
  
     /* skip categories */
     if (do_cats) {
-	if (Map->head.Version_Minor == 1) {	/* coor format 5.1 */
+	if (Map->plus.version.coor.minor == 1) {	/* coor format 5.1 */
 	    if (0 >= dig__fread_port_I(&n_cats, 1, &(Map->dig_fp)))
 		return NULL;
 	}
@@ -325,7 +325,7 @@
 	}
 	G_debug(3, "    n_cats = %d", n_cats);
 
-	if (Map->head.Version_Minor == 1) {	/* coor format 5.1 */
+	if (Map->plus.version.coor.minor == 1) {	/* coor format 5.1 */
 	    size = (2 * PORT_INT) * n_cats;
 	}
 	else {		                /* coor format 5.0 */

Modified: grass/trunk/lib/vector/Vlib/open_nat.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open_nat.c	2013-05-03 02:20:55 UTC (rev 56094)
+++ grass/trunk/lib/vector/Vlib/open_nat.c	2013-05-03 09:28:13 UTC (rev 56095)
@@ -99,10 +99,10 @@
     path = Vect__get_path(Map);
 
     /* Set the 'coor' file version */
-    Map->head.Version_Major = GV_COOR_VER_MAJOR;
-    Map->head.Version_Minor = GV_COOR_VER_MINOR;
-    Map->head.Back_Major    = GV_COOR_EARLIEST_MAJOR;
-    Map->head.Back_Minor    = GV_COOR_EARLIEST_MINOR;
+    Map->plus.version.coor.major = GV_COOR_VER_MAJOR;
+    Map->plus.version.coor.minor = GV_COOR_VER_MINOR;
+    Map->plus.version.coor.back_major    = GV_COOR_EARLIEST_MAJOR;
+    Map->plus.version.coor.back_minor    = GV_COOR_EARLIEST_MINOR;
 
     /* TODO: open better */
     dig_file_init(&(Map->dig_fp));

Modified: grass/trunk/lib/vector/Vlib/read_nat.c
===================================================================
--- grass/trunk/lib/vector/Vlib/read_nat.c	2013-05-03 02:20:55 UTC (rev 56094)
+++ grass/trunk/lib/vector/Vlib/read_nat.c	2013-05-03 09:28:13 UTC (rev 56095)
@@ -286,7 +286,7 @@
 	c->n_cats = 0;
 
     if (do_cats) {
-	if (Map->head.Version_Minor == 1) {	/* coor format 5.1 */
+	if (Map->plus.version.coor.minor == 1) {	/* coor format 5.1 */
 	    if (0 >= dig__fread_port_I(&n_cats, 1, &(Map->dig_fp)))
 		return (-2);
 	}
@@ -303,7 +303,7 @@
 		if (0 > dig_alloc_cats(c, (int)n_cats + 1))
 		    return -1;
 
-		if (Map->head.Version_Minor == 1) {	/* coor format 5.1 */
+		if (Map->plus.version.coor.minor == 1) {	/* coor format 5.1 */
 		    if (0 >=
 			dig__fread_port_I(c->field, n_cats, &(Map->dig_fp)))
 			return (-2);
@@ -321,7 +321,7 @@
 	    }
 	}
 	else {
-	    if (Map->head.Version_Minor == 1) {	/* coor format 5.1 */
+	    if (Map->plus.version.coor.minor == 1) {	/* coor format 5.1 */
 		size = (off_t) (2 * PORT_INT) * n_cats;
 	    }
 	    else {		/* coor format 5.0 */

Modified: grass/trunk/lib/vector/Vlib/write_nat.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_nat.c	2013-05-03 02:20:55 UTC (rev 56094)
+++ grass/trunk/lib/vector/Vlib/write_nat.c	2013-05-03 09:28:13 UTC (rev 56095)
@@ -435,7 +435,7 @@
     }
 
     if (cats->n_cats > 0) {
-	if (Map->head.Version_Minor == 1) {	/* coor format 5.1 */
+	if (Map->plus.version.coor.minor == 1) {	/* coor format 5.1 */
 	    if (0 >= dig__fwrite_port_I(&(cats->n_cats), 1, dig_fp))
 		return -1;
 	}
@@ -446,7 +446,7 @@
 	}
 
 	if (cats->n_cats > 0) {
-	    if (Map->head.Version_Minor == 1) {	/* coor format 5.1 */
+	    if (Map->plus.version.coor.minor == 1) {	/* coor format 5.1 */
 		if (0 >=
 		    dig__fwrite_port_I(cats->field, cats->n_cats, dig_fp))
 		    return -1;

Modified: grass/trunk/lib/vector/diglib/cindex_rw.c
===================================================================
--- grass/trunk/lib/vector/diglib/cindex_rw.c	2013-05-03 02:20:55 UTC (rev 56094)
+++ grass/trunk/lib/vector/diglib/cindex_rw.c	2013-05-03 09:28:13 UTC (rev 56095)
@@ -129,29 +129,29 @@
     /* bytes 1 - 5 */
     if (0 >= dig__fread_port_C((char *)buf, 5, fp))
 	return (-1);
-    plus->cidx_Version_Major = buf[0];
-    plus->cidx_Version_Minor = buf[1];
-    plus->cidx_Back_Major = buf[2];
-    plus->cidx_Back_Minor = buf[3];
+    plus->version.cidx.major = buf[0];
+    plus->version.cidx.minor = buf[1];
+    plus->version.cidx.back_major = buf[2];
+    plus->version.cidx.back_minor = buf[3];
     byte_order = buf[4];
 
     G_debug(3,
 	    "Cidx header: file version %d.%d , supported from GRASS version %d.%d",
-	    plus->cidx_Version_Major, plus->cidx_Version_Minor,
-	    plus->cidx_Back_Major, plus->cidx_Back_Minor);
+	    plus->version.cidx.major, plus->version.cidx.minor,
+	    plus->version.cidx.back_major, plus->version.cidx.back_minor);
 
     G_debug(3, "  byte order %d", byte_order);
 
     /* check version numbers */
-    if (plus->cidx_Version_Major > GV_CIDX_VER_MAJOR ||
-	plus->cidx_Version_Minor > GV_CIDX_VER_MINOR) {
+    if (plus->version.cidx.major > GV_CIDX_VER_MAJOR ||
+	plus->version.cidx.minor > GV_CIDX_VER_MINOR) {
 	/* The file was created by GRASS library with higher version than this one */
 
-	if (plus->cidx_Back_Major > GV_CIDX_VER_MAJOR ||
-	    plus->cidx_Back_Minor > GV_CIDX_VER_MINOR) {
+	if (plus->version.cidx.back_major > GV_CIDX_VER_MAJOR ||
+	    plus->version.cidx.back_minor > GV_CIDX_VER_MINOR) {
 	    /* This version of GRASS lib is lower than the oldest which can read this format */
 	    G_debug(1, "Category index format version %d.%d",
-		    plus->cidx_Version_Major, plus->cidx_Version_Minor);
+		    plus->version.cidx.major, plus->version.cidx.minor);
 	    G_fatal_error
 		(_("This version of GRASS (%d.%d) is too old to read this category index format."
 		 " Try to rebuild topology or upgrade GRASS to at least version %d."),
@@ -162,7 +162,7 @@
 	G_warning
 	    ("Your GRASS version does not fully support category index format %d.%d of the vector."
 	     " Consider to rebuild topology or upgrade GRASS.",
-	     plus->cidx_Version_Major, plus->cidx_Version_Minor);
+	     plus->version.cidx.major, plus->version.cidx.minor);
     }
 
     dig_init_portable(&(plus->cidx_port), byte_order);

Modified: grass/trunk/lib/vector/diglib/head.c
===================================================================
--- grass/trunk/lib/vector/diglib/head.c	2013-05-03 02:20:55 UTC (rev 56094)
+++ grass/trunk/lib/vector/diglib/head.c	2013-05-03 09:28:13 UTC (rev 56095)
@@ -30,10 +30,10 @@
     dig_fseek(&(Map->dig_fp), 0L, 0);
 
     /* bytes 1 - 5 */
-    buf[0] = Map->head.Version_Major;
-    buf[1] = Map->head.Version_Minor;
-    buf[2] = Map->head.Back_Major;
-    buf[3] = Map->head.Back_Minor;
+    buf[0] = Map->plus.version.coor.major;
+    buf[1] = Map->plus.version.coor.minor;
+    buf[2] = Map->plus.version.coor.back_major;
+    buf[3] = Map->plus.version.coor.back_minor;
 
     buf[4] = Map->head.port.byte_order;
     if (0 >= dig__fwrite_port_C((char *)buf, 5, &(Map->dig_fp)))
@@ -89,38 +89,38 @@
     /* bytes 1 - 5 */
     if (0 >= dig__fread_port_C((char *)buf, 5, &(Map->dig_fp)))
 	return (0);
-    Map->head.Version_Major = buf[0];
-    Map->head.Version_Minor = buf[1];
-    Map->head.Back_Major = buf[2];
-    Map->head.Back_Minor = buf[3];
+    Map->plus.version.coor.major = buf[0];
+    Map->plus.version.coor.minor = buf[1];
+    Map->plus.version.coor.back_major = buf[2];
+    Map->plus.version.coor.back_minor = buf[3];
     Map->head.port.byte_order = buf[4];
 
     G_debug(2,
 	    "Coor header: file version %d.%d , supported from GRASS version %d.%d",
-	    Map->head.Version_Major, Map->head.Version_Minor,
-	    Map->head.Back_Major, Map->head.Back_Minor);
+	    Map->plus.version.coor.major, Map->plus.version.coor.minor,
+	    Map->plus.version.coor.back_major, Map->plus.version.coor.back_minor);
 
     G_debug(2, "  byte order %d", Map->head.port.byte_order);
 
     /* check version numbers */
-    if (Map->head.Version_Major > GV_COOR_VER_MAJOR ||
-	Map->head.Version_Minor > GV_COOR_VER_MINOR) {
+    if (Map->plus.version.coor.major > GV_COOR_VER_MAJOR ||
+	Map->plus.version.coor.minor > GV_COOR_VER_MINOR) {
 	/* The file was created by GRASS library with higher version than this one */
 
-	if (Map->head.Back_Major > GV_COOR_VER_MAJOR ||
-	    Map->head.Back_Minor > GV_COOR_VER_MINOR) {
+	if (Map->plus.version.coor.back_major > GV_COOR_VER_MAJOR ||
+	    Map->plus.version.coor.back_minor > GV_COOR_VER_MINOR) {
 	    /* This version of GRASS lib is lower than the oldest which can read this format */
 	    G_fatal_error
 		("Vector 'coor' format version %d.%d is not supported by this version of GRASS. "
-		 "Update your GRASS.", Map->head.Version_Major,
-		 Map->head.Version_Minor);
+		 "Update your GRASS.", Map->plus.version.coor.major,
+		 Map->plus.version.coor.minor);
 	    return (-1);
 	}
 
 	G_warning
 	    ("Your GRASS version does not fully support vector format %d.%d."
-	     " Consider to upgrade GRASS.", Map->head.Version_Major,
-	     Map->head.Version_Minor);
+	     " Consider to upgrade GRASS.", Map->plus.version.coor.major,
+	     Map->plus.version.coor.minor);
     }
 
     dig_init_portable(&port, Map->head.port.byte_order);

Modified: grass/trunk/lib/vector/diglib/plus.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus.c	2013-05-03 02:20:55 UTC (rev 56094)
+++ grass/trunk/lib/vector/diglib/plus.c	2013-05-03 09:28:13 UTC (rev 56095)
@@ -33,65 +33,10 @@
     
     G_debug(3, "dig_init_plus()");
 
-    Plus->Version_Major = 0;
-    Plus->Version_Minor = 0;
-    Plus->Back_Major = 0;
-    Plus->Back_Minor = 0;
+    G_zero(Plus, sizeof(struct Plus_head));
 
-    Plus->off_t_size = 0;
-
-    Plus->box.N = 0;
-    Plus->box.S = 0;
-    Plus->box.E = 0;
-    Plus->box.W = 0;
-    Plus->box.T = 0;
-    Plus->box.B = 0;
-
     Plus->built = GV_BUILD_NONE;
 
-    Plus->Node = NULL;
-    Plus->Line = NULL;
-    Plus->Area = NULL;
-    Plus->Isle = NULL;
-
-    Plus->n_nodes = 0;
-    Plus->n_edges = 0;
-    Plus->n_lines = 0;
-    Plus->n_areas = 0;
-    Plus->n_isles = 0;
-    Plus->n_volumes = 0;
-    Plus->n_holes = 0;
-
-    Plus->alloc_nodes = 0;
-    Plus->alloc_edges = 0;
-    Plus->alloc_lines = 0;
-    Plus->alloc_areas = 0;
-    Plus->alloc_isles = 0;
-    Plus->alloc_volumes = 0;
-    Plus->alloc_holes = 0;
-
-    Plus->n_plines = 0;
-    Plus->n_llines = 0;
-    Plus->n_blines = 0;
-    Plus->n_clines = 0;
-    Plus->n_flines = 0;
-    Plus->n_klines = 0;
-
-    Plus->Node_offset = 0L;
-    Plus->Line_offset = 0L;
-    Plus->Area_offset = 0L;
-    Plus->Isle_offset = 0L;
-    Plus->Volume_offset = 0L;
-    Plus->Hole_offset = 0L;
-
-    Plus->Node_spidx_offset = 0L;
-    Plus->Line_spidx_offset = 0L;
-    Plus->Area_spidx_offset = 0L;
-    Plus->Isle_spidx_offset = 0L;
-    Plus->Face_spidx_offset = 0L;
-    Plus->Volume_spidx_offset = 0L;
-    Plus->Hole_spidx_offset = 0L;
-
     dig_spidx_init(Plus);
     dig_cidx_init(Plus);
 

Modified: grass/trunk/lib/vector/diglib/plus_struct.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus_struct.c	2013-05-03 02:20:55 UTC (rev 56094)
+++ grass/trunk/lib/vector/diglib/plus_struct.c	2013-05-03 09:28:13 UTC (rev 56095)
@@ -496,29 +496,29 @@
     /* bytes 1 - 5 */
     if (0 >= dig__fread_port_C((char *)buf, 5, fp))
 	return (-1);
-    ptr->Version_Major = buf[0];
-    ptr->Version_Minor = buf[1];
-    ptr->Back_Major = buf[2];
-    ptr->Back_Minor = buf[3];
+    ptr->version.topo.major = buf[0];
+    ptr->version.topo.minor = buf[1];
+    ptr->version.topo.back_major = buf[2];
+    ptr->version.topo.back_minor = buf[3];
     byte_order = buf[4];
 
     G_debug(2,
 	    "Topo header: file version %d.%d , supported from GRASS version %d.%d",
-	    ptr->Version_Major, ptr->Version_Minor, ptr->Back_Major,
-	    ptr->Back_Minor);
+	    ptr->version.topo.major, ptr->version.topo.minor, ptr->version.topo.back_major,
+	    ptr->version.topo.back_minor);
 
     G_debug(2, "  byte order %d", byte_order);
 
     /* check version numbers */
-    if (ptr->Version_Major > GV_TOPO_VER_MAJOR ||
-	ptr->Version_Minor > GV_TOPO_VER_MINOR) {
+    if (ptr->version.topo.major > GV_TOPO_VER_MAJOR ||
+	ptr->version.topo.minor > GV_TOPO_VER_MINOR) {
 	/* The file was created by GRASS library with higher version than this one */
 
-	if (ptr->Back_Major > GV_TOPO_VER_MAJOR ||
-	    ptr->Back_Minor > GV_TOPO_VER_MINOR) {
+	if (ptr->version.topo.back_major > GV_TOPO_VER_MAJOR ||
+	    ptr->version.topo.back_minor > GV_TOPO_VER_MINOR) {
 	    /* This version of GRASS lib is lower than the oldest which can read this format */
 	    G_debug(1, "Topology format version %d.%d",
-		    ptr->Version_Major, ptr->Version_Minor);
+		    ptr->version.topo.major, ptr->version.topo.minor);
 	    G_fatal_error
 		(_("This version of GRASS (%d.%d) is too old to read this topology format."
 		 " Try to rebuild topology or upgrade GRASS to at least version %d."),
@@ -528,17 +528,17 @@
 
 	G_warning(_("Your GRASS version does not fully support topology format %d.%d of the vector."
 		    " Consider to rebuild topology or upgrade GRASS."),
-		  ptr->Version_Major, ptr->Version_Minor);
+		  ptr->version.topo.major, ptr->version.topo.minor);
     }
-    if (ptr->Version_Major < GV_TOPO_VER_MAJOR ||
-	(ptr->Version_Major == GV_TOPO_VER_MAJOR &&
-	 ptr->Version_Minor < GV_TOPO_VER_MINOR)) {
+    if (ptr->version.topo.major < GV_TOPO_VER_MAJOR ||
+	(ptr->version.topo.major == GV_TOPO_VER_MAJOR &&
+	 ptr->version.topo.minor < GV_TOPO_VER_MINOR)) {
 	/* The file was created by GRASS library with lower version than this one */
 
 	/* This version of GRASS lib can not read this old format */
 	G_warning(_("Old topology format version %d.%d is not supported by this release."
 		    " Try to rebuild topology."),
-		  ptr->Version_Major, ptr->Version_Minor);
+		  ptr->version.topo.major, ptr->version.topo.minor);
 	return (-1);
     }
 

Modified: grass/trunk/lib/vector/diglib/spindex_rw.c
===================================================================
--- grass/trunk/lib/vector/diglib/spindex_rw.c	2013-05-03 02:20:55 UTC (rev 56094)
+++ grass/trunk/lib/vector/diglib/spindex_rw.c	2013-05-03 09:28:13 UTC (rev 56095)
@@ -274,30 +274,30 @@
     /* bytes 1 - 6 */
     if (0 >= dig__fread_port_C((char *)buf, 6, fp))
 	return (-1);
-    ptr->spidx_Version_Major = buf[0];
-    ptr->spidx_Version_Minor = buf[1];
-    ptr->spidx_Back_Major = buf[2];
-    ptr->spidx_Back_Minor = buf[3];
+    ptr->version.spidx.major = buf[0];
+    ptr->version.spidx.minor = buf[1];
+    ptr->version.spidx.back_major = buf[2];
+    ptr->version.spidx.back_minor = buf[3];
     byte_order = buf[4];
     ptr->spidx_port.off_t_size = buf[5];
 
     G_debug(2,
 	    "Spidx header: file version %d.%d , supported from GRASS version %d.%d",
-	    ptr->spidx_Version_Major, ptr->spidx_Version_Minor,
-	    ptr->spidx_Back_Major, ptr->spidx_Back_Minor);
+	    ptr->version.spidx.major, ptr->version.spidx.minor,
+	    ptr->version.spidx.back_major, ptr->version.spidx.back_minor);
 
     G_debug(2, "  byte order %d", byte_order);
 
     /* check version numbers */
-    if (ptr->spidx_Version_Major > GV_SIDX_VER_MAJOR ||
-	ptr->spidx_Version_Minor > GV_SIDX_VER_MINOR) {
+    if (ptr->version.spidx.major > GV_SIDX_VER_MAJOR ||
+	ptr->version.spidx.minor > GV_SIDX_VER_MINOR) {
 	/* The file was created by GRASS library with higher version than this one */
 
-	if (ptr->spidx_Back_Major > GV_SIDX_VER_MAJOR ||
-	    ptr->spidx_Back_Minor > GV_SIDX_VER_MINOR) {
+	if (ptr->version.spidx.back_major > GV_SIDX_VER_MAJOR ||
+	    ptr->version.spidx.back_minor > GV_SIDX_VER_MINOR) {
 	    /* This version of GRASS lib is lower than the oldest which can read this format */
 	    G_debug(1, "Spatial index format version %d.%d",
-		    ptr->spidx_Version_Major, ptr->spidx_Version_Minor);
+		    ptr->version.spidx.major, ptr->version.spidx.minor);
 	    G_fatal_error
 		(_("This version of GRASS (%d.%d) is too old to read this spatial index format."
 		 " Try to rebuild topology or upgrade GRASS to at least version %d."),
@@ -308,16 +308,16 @@
 	G_warning(_("Your GRASS version does not fully support "
 		    "spatial index format %d.%d of the vector."
 		    " Consider to rebuild topology or upgrade GRASS."),
-		  ptr->spidx_Version_Major, ptr->spidx_Version_Minor);
+		  ptr->version.spidx.major, ptr->version.spidx.minor);
     }
-    if (ptr->spidx_Version_Major < GV_SIDX_VER_MAJOR ||
-	(ptr->spidx_Version_Major == GV_SIDX_VER_MAJOR &&
-	ptr->spidx_Version_Minor < GV_SIDX_VER_MINOR)) {
+    if (ptr->version.spidx.major < GV_SIDX_VER_MAJOR ||
+	(ptr->version.spidx.major == GV_SIDX_VER_MAJOR &&
+	ptr->version.spidx.minor < GV_SIDX_VER_MINOR)) {
 	/* The file was created by GRASS library with lower version than this one */
 	    G_fatal_error(_("Spatial index format version %d.%d is not "
 			    "supported by this release."
 			    " Please rebuild topology."),
-			  ptr->spidx_Version_Major, ptr->spidx_Version_Minor);
+			  ptr->version.spidx.major, ptr->version.spidx.minor);
 	    return (-1);
     }
 



More information about the grass-commit mailing list