[GRASS-SVN] r64644 - in grass/trunk: include/defs lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 16 03:17:39 PST 2015


Author: mmetz
Date: 2015-02-16 03:17:39 -0800 (Mon, 16 Feb 2015)
New Revision: 64644

Modified:
   grass/trunk/include/defs/vector.h
   grass/trunk/lib/vector/Vlib/write_nat.c
   grass/trunk/lib/vector/Vlib/write_ogr.c
   grass/trunk/lib/vector/Vlib/write_pg.c
   grass/trunk/lib/vector/Vlib/write_sfa.c
Log:
Vlib: sync write fns, fix for #2583

Modified: grass/trunk/include/defs/vector.h
===================================================================
--- grass/trunk/include/defs/vector.h	2015-02-16 09:48:14 UTC (rev 64643)
+++ grass/trunk/include/defs/vector.h	2015-02-16 11:17:39 UTC (rev 64644)
@@ -550,11 +550,11 @@
 int V1_delete_line_nat(struct Map_info *, off_t);
 int V1_delete_line_ogr(struct Map_info *, off_t);
 int V1_delete_line_pg(struct Map_info *, off_t);
-int V2_delete_line_nat(struct Map_info *, int);
-int V2_delete_line_sfa(struct Map_info *, int);
-int V2_delete_line_pg(struct Map_info *, int);
+int V2_delete_line_nat(struct Map_info *, off_t);
+int V2_delete_line_sfa(struct Map_info *, off_t);
+int V2_delete_line_pg(struct Map_info *, off_t);
 int V1_restore_line_nat(struct Map_info *, off_t);
-int V2_restore_line_nat(struct Map_info *, int);
+int V2_restore_line_nat(struct Map_info *, off_t);
 off_t V1_write_line_nat(struct Map_info *, int, const struct line_pnts *,
                         const struct line_cats *);
 off_t V1_write_line_ogr(struct Map_info *, int, const struct line_pnts *,
@@ -573,11 +573,11 @@
                           const struct line_pnts *, const struct line_cats *);
 off_t V1_rewrite_line_pg(struct Map_info *, off_t, int,
                          const struct line_pnts *, const struct line_cats *);
-off_t V2_rewrite_line_nat(struct Map_info *, int, int,
+off_t V2_rewrite_line_nat(struct Map_info *, off_t, int,
                           const struct line_pnts *, const struct line_cats *);
-off_t V2_rewrite_line_sfa(struct Map_info *, int, int,
+off_t V2_rewrite_line_sfa(struct Map_info *, off_t, int,
                           const struct line_pnts *, const struct line_cats *);
-off_t V2_rewrite_line_pg(struct Map_info *, int, int,
+off_t V2_rewrite_line_pg(struct Map_info *, off_t, int,
                           const struct line_pnts *, const struct line_cats *);
 
     /* Build topology */

Modified: grass/trunk/lib/vector/Vlib/write_nat.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_nat.c	2015-02-16 09:48:14 UTC (rev 64643)
+++ grass/trunk/lib/vector/Vlib/write_nat.c	2015-02-16 11:17:39 UTC (rev 64644)
@@ -145,16 +145,15 @@
   compatibility with level 1 functions.
   
   \param Map pointer to Map_info structure
-  \param type feature type (GV_POINT, GV_LINE, ...)
   \param line feature id to be rewritten
-  \param old_offset feature offset
+  \param type feature type (GV_POINT, GV_LINE, ...)
   \param points feature geometry
   \param cats feature categories
   
   \return new feature id or 0 (build level < GV_BUILD_BASE)
   \return -1 on error
 */
-off_t V2_rewrite_line_nat(struct Map_info *Map, int line, int type,
+off_t V2_rewrite_line_nat(struct Map_info *Map, off_t line, int type,
 			  const struct line_pnts *points, const struct line_cats *cats)
 {
     /* TODO: this is just quick shortcut because we have already V2_delete_nat()
@@ -180,7 +179,7 @@
     }
 
     if (line < 1 || line > plus->n_lines) {
-        G_warning(_("Attempt to access feature with invalid id (%d)"), line);
+        G_warning(_("Attempt to access feature with invalid id (%d)"), (int)line);
         return -1;
     }
 
@@ -279,7 +278,7 @@
   \return 0 on success
   \return -1 on error
 */
-int V2_delete_line_nat(struct Map_info *Map, int line)
+int V2_delete_line_nat(struct Map_info *Map, off_t line)
 {
     int type;
     struct P_line *Line;
@@ -287,19 +286,19 @@
     static struct line_cats *Cats = NULL;
     static struct line_pnts *Points = NULL;
 
-    G_debug(3, "V2_delete_line_nat(): line = %d", line);
+    G_debug(3, "V2_delete_line_nat(): line = %d", (int)line);
 
     Line = NULL;
     plus = &(Map->plus);
 
     if (line < 1 || line > plus->n_lines) {
-        G_warning(_("Attempt to access feature with invalid id (%d)"), line);
+        G_warning(_("Attempt to access feature with invalid id (%d)"), (int)line);
         return -1;
     }
 
     Line = Map->plus.Line[line];
     if (Line == NULL) {
-        G_warning(_("Attempt to access dead feature %d"), line);
+        G_warning(_("Attempt to access dead feature %d"), (int)line);
         return -1;
     }
 
@@ -381,7 +380,7 @@
   \return 0 on success
   \return -1 on error
 */
-int V2_restore_line_nat(struct Map_info *Map, int line)
+int V2_restore_line_nat(struct Map_info *Map, off_t line)
 {
     int type;
     off_t offset;
@@ -392,16 +391,16 @@
     
     plus = &(Map->plus);
 
-    G_debug(3, "V2_restore_line_nat(), line = %d", line);
+    G_debug(3, "V2_restore_line_nat(), line = %d", (int)line);
 
     if (line < 1 || line > plus->n_lines) {
-        G_warning(_("Attempt to access feature with invalid id (%d)"), line);
+        G_warning(_("Attempt to access feature with invalid id (%d)"), (int)line);
         return -1;
     }
     
     Line = Map->plus.Line[line];
     if (Line != NULL) {
-        G_warning(_("Attempt to access alive feature %d"), line);
+        G_warning(_("Attempt to access alive feature %d"), (int)line);
         return -1;
     }
 

Modified: grass/trunk/lib/vector/Vlib/write_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_ogr.c	2015-02-16 09:48:14 UTC (rev 64643)
+++ grass/trunk/lib/vector/Vlib/write_ogr.c	2015-02-16 11:17:39 UTC (rev 64644)
@@ -82,7 +82,7 @@
   \param points pointer to line_pnts structure (feature geometry)
   \param cats pointer to line_cats structure (feature categories)
   
-  \return feature offset (rewriten feature)
+  \return feature offset (rewritten feature)
   \return -1 on error
 */
 off_t V1_rewrite_line_ogr(struct Map_info *Map,

Modified: grass/trunk/lib/vector/Vlib/write_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_pg.c	2015-02-16 09:48:14 UTC (rev 64643)
+++ grass/trunk/lib/vector/Vlib/write_pg.c	2015-02-16 11:17:39 UTC (rev 64644)
@@ -172,7 +172,7 @@
    \param points feature geometry
    \param cats feature categories
 
-   \return feature offset (rewriten feature)
+   \return feature offset (rewritten feature)
    \return -1 on error
  */
 off_t V1_rewrite_line_pg(struct Map_info * Map,
@@ -207,19 +207,19 @@
   \todo Store original geometry in tmp table for restore
   
   \param Map pointer to Map_info structure
+  \param line feature id
   \param type feature type  (GV_POINT, GV_LINE, ...)
-  \param line feature id
   \param points feature geometry
   \param cats feature categories
   
   \return offset where feature was rewritten
   \return -1 on error
 */
-off_t V2_rewrite_line_pg(struct Map_info *Map, int line, int type,
+off_t V2_rewrite_line_pg(struct Map_info *Map, off_t line, int type,
                          const struct line_pnts *points, const struct line_cats *cats)
 {
     G_debug(3, "V2_rewrite_line_pg(): line=%d type=%d",
-            line, type);
+            (int)line, type);
 #ifdef HAVE_POSTGRES
     const char *schema_name, *table_name, *keycolumn;
     char *stmt, *geom_data;
@@ -233,13 +233,13 @@
     pg_info = &(Map->fInfo.pg);
   
     if (line < 1 || line > Map->plus.n_lines) {
-        G_warning(_("Attempt to access feature with invalid id (%d)"), line);
+        G_warning(_("Attempt to access feature with invalid id (%d)"), (int)line);
         return -1;
     }
   
     Line = Map->plus.Line[line];
     if (Line == NULL) {
-        G_warning(_("Attempt to access dead feature %d"), line);
+        G_warning(_("Attempt to access dead feature %d"), (int)line);
         return -1;
     }
     offset = Line->offset;
@@ -282,7 +282,7 @@
     G_free(geom_data);
 
     if (Vect__execute_pg(pg_info->conn, stmt) == -1) {
-        G_warning(_("Unable to rewrite feature %d"), line);
+        G_warning(_("Unable to rewrite feature %d"), (int)line);
         Vect__execute_pg(pg_info->conn, "ROLLBACK");
         return -1;
     }
@@ -369,7 +369,7 @@
   \return 0 on success
   \return -1 on error
 */
-int V2_delete_line_pg(struct Map_info *Map, int line)
+int V2_delete_line_pg(struct Map_info *Map, off_t line)
 {
 #ifdef HAVE_POSTGRES
     int ret;
@@ -378,7 +378,7 @@
     pg_info = &(Map->fInfo.pg);
 
     if (line < 1 || line > Map->plus.n_lines) {
-        G_warning(_("Attempt to access feature with invalid id (%d)"), line);
+        G_warning(_("Attempt to access feature with invalid id (%d)"), (int)line);
         return -1;
     }
     
@@ -393,13 +393,13 @@
         struct P_line *Line;
         
         if (line < 1 || line > Map->plus.n_lines) {
-            G_warning(_("Attempt to access feature with invalid id (%d)"), line);
+            G_warning(_("Attempt to access feature with invalid id (%d)"), (int)line);
             return -1;
         }
         
         Line = Map->plus.Line[line];
         if (!Line) {
-            G_warning(_("Attempt to access dead feature %d"), line);
+            G_warning(_("Attempt to access dead feature %d"), (int)line);
             return -1;
         }
 
@@ -450,7 +450,7 @@
                 pg_info->toposchema_name, table_name, keycolumn, (int)Line->offset);
         if (Vect__execute_pg(pg_info->conn, stmt) == -1) {
             G_warning(_("Unable to delete feature (%s) %d"), keycolumn,
-                      line);
+                      (int)line);
             Vect__execute_pg(pg_info->conn, "ROLLBACK");
             return -1;
         }

Modified: grass/trunk/lib/vector/Vlib/write_sfa.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_sfa.c	2015-02-16 09:48:14 UTC (rev 64643)
+++ grass/trunk/lib/vector/Vlib/write_sfa.c	2015-02-16 11:17:39 UTC (rev 64644)
@@ -142,21 +142,20 @@
   \param Map pointer to Map_info structure
   \param line feature id to be rewritten
   \param type feature type (see V1_write_line_ogr() for supported types)
-  \param offset unused (kept for consistency)
   \param points pointer to line_pnts structure (feature geometry)
   \param cats pointer to line_cats structure feature categories
   
-  \return offset where line was rewritten
+  \return feature index in offset array (related to pseudo-topology)
   \return -1 on error
 */
-off_t V2_rewrite_line_sfa(struct Map_info *Map, int line, int type,
+off_t V2_rewrite_line_sfa(struct Map_info *Map, off_t line, int type,
 			  const struct line_pnts *points, const struct line_cats *cats)
 {
     G_debug(3, "V2_rewrite_line_sfa(): line=%d type=%d",
-	    line, type);
+	    (int)line, type);
 
     if (line < 1 || line > Map->plus.n_lines) {
-        G_warning(_("Attempt to access feature with invalid id (%d)"), line);
+        G_warning(_("Attempt to access feature with invalid id (%d)"), (int)line);
         return -1;
     }
 
@@ -189,7 +188,7 @@
   \return 0 on success
   \return -1 on error
 */
-int V2_delete_line_sfa(struct Map_info *Map, int line)
+int V2_delete_line_sfa(struct Map_info *Map, off_t line)
 {
 #if defined HAVE_OGR || defined HAVE_POSTGRES
     int ret, i, type, first;
@@ -198,14 +197,14 @@
     static struct line_cats *Cats = NULL;
     static struct line_pnts *Points = NULL;
 
-    G_debug(3, "V2_delete_line_sfa(): line = %d", line);
+    G_debug(3, "V2_delete_line_sfa(): line = %d", (int)line);
 
     type = first = 0;
     Line = NULL;
     plus = &(Map->plus);
 
     if (line < 1 || line > Map->plus.n_lines) {
-        G_warning(_("Attempt to access feature with invalid id (%d)"), line);
+        G_warning(_("Attempt to access feature with invalid id (%d)"), (int)line);
         return -1;
     }
 



More information about the grass-commit mailing list