[GRASS-SVN] r56451 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 28 04:55:45 PDT 2013


Author: martinl
Date: 2013-05-28 04:55:45 -0700 (Tue, 28 May 2013)
New Revision: 56451

Modified:
   grass/trunk/lib/vector/Vlib/open_pg.c
Log:
vlib(pg): fix bug in scan_array
          remove unused variables


Modified: grass/trunk/lib/vector/Vlib/open_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open_pg.c	2013-05-28 11:38:21 UTC (rev 56450)
+++ grass/trunk/lib/vector/Vlib/open_pg.c	2013-05-28 11:55:45 UTC (rev 56451)
@@ -1173,7 +1173,7 @@
 */
 int Vect__load_plus_pg(struct Map_info *Map, int head_only)
 {
-    int i, side, line, id, ntuples, area;
+    int i, side, line, id, ntuples;
     char stmt[DB_SQL_MAX];
     struct edge_data line_data;
     
@@ -1181,7 +1181,6 @@
     struct Format_info_offset *offset;
     struct Plus_head *plus;
     struct P_line *Line;
-    struct P_area *Area;
     struct line_pnts *Points;
     struct ilist *List;
     
@@ -1398,7 +1397,7 @@
         G_debug(2, "SQL: %s", stmt);
         
         res = PQexec(pg_info->conn, stmt);
-        if (!res || PQresultStatus(res) != PGRES_TUPLES_OK |
+        if (!res || PQresultStatus(res) != PGRES_TUPLES_OK ||
             plus->n_areas != PQntuples(res)) {
             if (res)
                 PQclear(res);
@@ -1510,8 +1509,9 @@
     int i, len;
     
     /* remove '{}' */
-    buf = (char *)G_malloc(sizeof(sarray) - 2);
-    len = strlen(sarray) - 1;
+    len = strlen(sarray) - 1; /* skip '}' */
+    buf = (char *)G_malloc(len);
+    
     for (i = 1; i < len; i++)
         buf[i-1] = sarray[i];
     buf[len-1] = '\0';



More information about the grass-commit mailing list