[GRASS-SVN] r56232 - in grass/trunk: include/vect lib/vector/Vlib lib/vector/diglib vector/v.convert
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 13 03:16:26 PDT 2013
Author: mmetz
Date: 2013-05-13 03:16:25 -0700 (Mon, 13 May 2013)
New Revision: 56232
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/head.c
grass/trunk/vector/v.convert/read.c
Log:
fix r56095: do NOT store vector backward version info one place
Modified: grass/trunk/include/vect/dig_structs.h
===================================================================
--- grass/trunk/include/vect/dig_structs.h 2013-05-13 09:08:40 UTC (rev 56231)
+++ grass/trunk/include/vect/dig_structs.h 2013-05-13 10:16:25 UTC (rev 56232)
@@ -277,6 +277,18 @@
char dummy;
};
+/*! \brief Backward compatibility version info */
+struct Version_info {
+ /*! \brief Current version (major) */
+ int major;
+ /*! \brief Current version (minor) */
+ int 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 Vector map header data
@@ -326,6 +338,9 @@
/* Programmers should NOT touch any thing below here */
/* Library takes care of everything for you */
+ /*! \brief Version info for coor file */
+ struct Version_info coor_version;
+
/*!
\brief 2D/3D vector data
@@ -727,18 +742,6 @@
off_t offset;
};
-/*! \brief Backward compatibility version info */
-struct Version_info {
- /*! \brief Current version (major) */
- int major;
- /*! \brief Current version (minor) */
- int 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 Basic topology-related info
@@ -748,8 +751,6 @@
{
/*! \brief Backward compatibility version info */
struct {
- /*! \brief Version info for coor file */
- struct Version_info coor;
/*! \brief Version info for topology file */
struct Version_info topo;
/*! \brief Version info for spatial index file */
Modified: grass/trunk/lib/vector/Vlib/geos.c
===================================================================
--- grass/trunk/lib/vector/Vlib/geos.c 2013-05-13 09:08:40 UTC (rev 56231)
+++ grass/trunk/lib/vector/Vlib/geos.c 2013-05-13 10:16:25 UTC (rev 56232)
@@ -314,7 +314,7 @@
/* skip categories */
if (do_cats) {
- if (Map->plus.version.coor.minor == 1) { /* coor format 5.1 */
+ if (Map->head.coor_version.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->plus.version.coor.minor == 1) { /* coor format 5.1 */
+ if (Map->head.coor_version.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-13 09:08:40 UTC (rev 56231)
+++ grass/trunk/lib/vector/Vlib/open_nat.c 2013-05-13 10:16:25 UTC (rev 56232)
@@ -99,10 +99,10 @@
path = Vect__get_path(Map);
/* Set the 'coor' file version */
- 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;
+ Map->head.coor_version.major = GV_COOR_VER_MAJOR;
+ Map->head.coor_version.minor = GV_COOR_VER_MINOR;
+ Map->head.coor_version.back_major = GV_COOR_EARLIEST_MAJOR;
+ Map->head.coor_version.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-13 09:08:40 UTC (rev 56231)
+++ grass/trunk/lib/vector/Vlib/read_nat.c 2013-05-13 10:16:25 UTC (rev 56232)
@@ -286,7 +286,7 @@
c->n_cats = 0;
if (do_cats) {
- if (Map->plus.version.coor.minor == 1) { /* coor format 5.1 */
+ if (Map->head.coor_version.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->plus.version.coor.minor == 1) { /* coor format 5.1 */
+ if (Map->head.coor_version.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->plus.version.coor.minor == 1) { /* coor format 5.1 */
+ if (Map->head.coor_version.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-13 09:08:40 UTC (rev 56231)
+++ grass/trunk/lib/vector/Vlib/write_nat.c 2013-05-13 10:16:25 UTC (rev 56232)
@@ -435,7 +435,7 @@
}
if (cats->n_cats > 0) {
- if (Map->plus.version.coor.minor == 1) { /* coor format 5.1 */
+ if (Map->head.coor_version.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->plus.version.coor.minor == 1) { /* coor format 5.1 */
+ if (Map->head.coor_version.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/head.c
===================================================================
--- grass/trunk/lib/vector/diglib/head.c 2013-05-13 09:08:40 UTC (rev 56231)
+++ grass/trunk/lib/vector/diglib/head.c 2013-05-13 10:16:25 UTC (rev 56232)
@@ -30,10 +30,10 @@
dig_fseek(&(Map->dig_fp), 0L, 0);
/* bytes 1 - 5 */
- 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[0] = Map->head.coor_version.major;
+ buf[1] = Map->head.coor_version.minor;
+ buf[2] = Map->head.coor_version.back_major;
+ buf[3] = Map->head.coor_version.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->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.coor_version.major = buf[0];
+ Map->head.coor_version.minor = buf[1];
+ Map->head.coor_version.back_major = buf[2];
+ Map->head.coor_version.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->plus.version.coor.major, Map->plus.version.coor.minor,
- Map->plus.version.coor.back_major, Map->plus.version.coor.back_minor);
+ Map->head.coor_version.major, Map->head.coor_version.minor,
+ Map->head.coor_version.back_major, Map->head.coor_version.back_minor);
G_debug(2, " byte order %d", Map->head.port.byte_order);
/* check version numbers */
- if (Map->plus.version.coor.major > GV_COOR_VER_MAJOR ||
- Map->plus.version.coor.minor > GV_COOR_VER_MINOR) {
+ if (Map->head.coor_version.major > GV_COOR_VER_MAJOR ||
+ Map->head.coor_version.minor > GV_COOR_VER_MINOR) {
/* The file was created by GRASS library with higher version than this one */
- if (Map->plus.version.coor.back_major > GV_COOR_VER_MAJOR ||
- Map->plus.version.coor.back_minor > GV_COOR_VER_MINOR) {
+ if (Map->head.coor_version.back_major > GV_COOR_VER_MAJOR ||
+ Map->head.coor_version.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->plus.version.coor.major,
- Map->plus.version.coor.minor);
+ "Update your GRASS.", Map->head.coor_version.major,
+ Map->head.coor_version.minor);
return (-1);
}
G_warning
("Your GRASS version does not fully support vector format %d.%d."
- " Consider to upgrade GRASS.", Map->plus.version.coor.major,
- Map->plus.version.coor.minor);
+ " Consider to upgrade GRASS.", Map->head.coor_version.major,
+ Map->head.coor_version.minor);
}
dig_init_portable(&port, Map->head.port.byte_order);
Modified: grass/trunk/vector/v.convert/read.c
===================================================================
--- grass/trunk/vector/v.convert/read.c 2013-05-13 09:08:40 UTC (rev 56231)
+++ grass/trunk/vector/v.convert/read.c 2013-05-13 10:16:25 UTC (rev 56232)
@@ -80,12 +80,12 @@
return -1;
if (buf[0] != '%' || buf[1] != '%') { /* Version3.0 */
- In_plus->version.coor.major = 3;
+ In_head.coor_version.major = 3;
portable = 0; /* input vector is not portable format */
G_message(_("Input file is version 3."));
}
else {
- In_plus->version.coor.major = 4;
+ In_head.coor_version.major = 4;
G_message(_("Input file is version 4."));
/* determine if in portable format or not */
if (buf[6] == 1 && (~buf[6] & 0xff) == (buf[7] & 0xff)) { /* portable ? */
More information about the grass-commit
mailing list