[GRASS-SVN] r50345 - in grass/trunk: display/d.vect general/g.proj include/defs lib/imagery lib/proj lib/vector/Vlib lib/vector/diglib lib/vector/vedit raster/r.in.lidar vector/v.colors vector/v.colors.out vector/v.select

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 21 07:31:27 EST 2012


Author: martinl
Date: 2012-01-21 04:31:27 -0800 (Sat, 21 Jan 2012)
New Revision: 50345

Modified:
   grass/trunk/display/d.vect/opt.c
   grass/trunk/general/g.proj/main.c
   grass/trunk/general/g.proj/output.c
   grass/trunk/include/defs/gprojects.h
   grass/trunk/lib/imagery/iclass_perimeter.c
   grass/trunk/lib/proj/convert.c
   grass/trunk/lib/vector/Vlib/array.c
   grass/trunk/lib/vector/Vlib/break_polygons.c
   grass/trunk/lib/vector/Vlib/bridges.c
   grass/trunk/lib/vector/Vlib/buffer.c
   grass/trunk/lib/vector/Vlib/build_ogr.c
   grass/trunk/lib/vector/Vlib/close_ogr.c
   grass/trunk/lib/vector/Vlib/color_read.c
   grass/trunk/lib/vector/Vlib/color_write.c
   grass/trunk/lib/vector/Vlib/e_intersect.c
   grass/trunk/lib/vector/Vlib/field.c
   grass/trunk/lib/vector/Vlib/find.c
   grass/trunk/lib/vector/Vlib/intersect.c
   grass/trunk/lib/vector/Vlib/net.c
   grass/trunk/lib/vector/Vlib/open_ogr.c
   grass/trunk/lib/vector/Vlib/poly.c
   grass/trunk/lib/vector/Vlib/read_ogr.c
   grass/trunk/lib/vector/Vlib/remove_duplicates.c
   grass/trunk/lib/vector/Vlib/rewind_ogr.c
   grass/trunk/lib/vector/Vlib/write.c
   grass/trunk/lib/vector/Vlib/write_ogr.c
   grass/trunk/lib/vector/diglib/frmt.c
   grass/trunk/lib/vector/vedit/delete.c
   grass/trunk/raster/r.in.lidar/main.c
   grass/trunk/vector/v.colors.out/main.c
   grass/trunk/vector/v.colors/main.c
   grass/trunk/vector/v.select/main.c
   grass/trunk/vector/v.select/select.c
Log:
fix compilation without gdal/ogr
remove unused variables (vlib)


Modified: grass/trunk/display/d.vect/opt.c
===================================================================
--- grass/trunk/display/d.vect/opt.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/display/d.vect/opt.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+
 #include <grass/gis.h>
 #include <grass/dbmi.h>
 #include <grass/glocale.h>

Modified: grass/trunk/general/g.proj/main.c
===================================================================
--- grass/trunk/general/g.proj/main.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/general/g.proj/main.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -272,12 +272,21 @@
     else if (create->answer)
 	modify_projinfo();
     else
+#ifdef HAVE_OGR
 	G_fatal_error(_("No output format specified, define one "
 			"of flags -%c, -%c, -%c, or -%c"),
 		      printinfo->key, shellinfo->key, printproj4->key, printwkt->key);
-    
+#else
+	G_fatal_error(_("No output format specified, define one "
+			"of flags -%c, -%c, or -%c"),
+		      printinfo->key, shellinfo->key, printproj4->key);
+#endif
 
+#ifdef HAVE_OGR
     if (create->answer && inepsg->answer) {
+#else
+    if (create->answer){ 
+#endif
 	/* preserve epsg code for user records only (not used by grass's pj routines) */
 	FILE *fp;
 	char path[GPATH_MAX];
@@ -290,7 +299,9 @@
 	else
 	    G_file_name(path, "", "PROJ_EPSG", "PERMANENT");
 	fp = fopen(path, "w");
+#ifdef HAVE_OGR
 	fprintf(fp, "epsg: %s\n", inepsg->answer);
+#endif
 	fclose(fp);
     }
 

Modified: grass/trunk/general/g.proj/output.c
===================================================================
--- grass/trunk/general/g.proj/output.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/general/g.proj/output.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -16,6 +16,7 @@
 
 #include <stdio.h>
 #include <unistd.h>
+#include <string.h>
 #include <proj_api.h>
 
 #include <grass/gis.h>

Modified: grass/trunk/include/defs/gprojects.h
===================================================================
--- grass/trunk/include/defs/gprojects.h	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/include/defs/gprojects.h	2012-01-21 12:31:27 UTC (rev 50345)
@@ -14,15 +14,15 @@
 int pj_print_proj_params(struct pj_info *, struct pj_info *);
 
 /* convert.c */
+char *GPJ_grass_to_wkt(struct Key_Value *, struct Key_Value *, int, int);
 #ifdef HAVE_OGR
-char *GPJ_grass_to_wkt(struct Key_Value *, struct Key_Value *, int, int);
 OGRSpatialReferenceH GPJ_grass_to_osr(struct Key_Value *, struct Key_Value *);
-int GPJ_wkt_to_grass(struct Cell_head *, struct Key_Value **,
-		     struct Key_Value **, const char *, int);
+const char *GPJ_set_csv_loc(const char *);
 int GPJ_osr_to_grass(struct Cell_head *, struct Key_Value **,
 		     struct Key_Value **, OGRSpatialReferenceH, int);
-const char *GPJ_set_csv_loc(const char *);
 #endif
+int GPJ_wkt_to_grass(struct Cell_head *, struct Key_Value **,
+		     struct Key_Value **, const char *, int);
 
 /* datum.c */
 int GPJ_get_datum_by_name(const char *, struct gpj_datum *);

Modified: grass/trunk/lib/imagery/iclass_perimeter.c
===================================================================
--- grass/trunk/lib/imagery/iclass_perimeter.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/imagery/iclass_perimeter.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -25,6 +25,8 @@
    \author Vaclav Petras <wenzeslaus gmail.com> (rewriting for wx.iclass)
  */
 
+#include <stdlib.h>
+
 #include <grass/vector.h>
 #include <grass/raster.h>
 #include <grass/glocale.h>

Modified: grass/trunk/lib/proj/convert.c
===================================================================
--- grass/trunk/lib/proj/convert.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/proj/convert.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -1,21 +1,20 @@
 
-/**
-   \file convert.c
+/*!
+   \file lib/proj/convert.c
 
-   \brief GProj library - Functions for manipulating co-ordinate system representations
+   \brief GProj Library - Functions for manipulating co-ordinate
+   system representations
 
+   (C) 2003-2008, 2012 by the GRASS Development Team
+ 
+   This program is free software under the GNU General Public License
+   (>=v2). Read the file COPYING that comes with GRASS for details.
+
    \author Paul Kelly, Frank Warmerdam 
+*/
 
-   (C) 2003-2008 by the GRASS Development Team
- 
-   This program is free software under the GNU General Public
-   License (>=v2). Read the file COPYING that comes with GRASS
-   for details.
-**/
-
 #include <grass/config.h>
 
-#ifdef HAVE_OGR
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -23,6 +22,8 @@
 #include <grass/gis.h>
 #include <grass/gprojects.h>
 #include <grass/glocale.h>
+
+#ifdef HAVE_OGR
 #include <cpl_csv.h>
 #include "local_proto.h"
 
@@ -30,13 +31,15 @@
 #define CSVDIR "/etc/proj/ogr_csv"
 
 static void DatumNameMassage(char **);
+#endif
 
-/**
+/*!
  * \brief Converts a GRASS co-ordinate system representation to WKT style.
  * 
- * Takes a GRASS co-ordinate system as specified by two sets of key/value
- * pairs derived from the PROJ_INFO and PROJ_UNITS files, and converts it
- * to the 'Well Known Text' format popularised by proprietary GIS
+ * Takes a GRASS co-ordinate system as specified by two sets of
+ * key/value pairs derived from the PROJ_INFO and PROJ_UNITS files,
+ * and converts it to the 'Well Known Text' format popularised by
+ * proprietary GIS
  * 
  * \param proj_info Set of GRASS PROJ_INFO key/value pairs
  * \param proj_units Set of GRASS PROJ_UNIT key/value pairs
@@ -45,14 +48,15 @@
  * \param prettify boolean Use linebreaks and indents to 'prettify' output
  *                 WKT string (Use OSRExportToPrettyWkt() function in OGR)
  *
- * \return Pointer to a string containing the co-ordinate system in WKT
- *         format
- **/
-
+ * \return Pointer to a string containing the co-ordinate system in
+ *         WKT format
+ * \return NULL on error
+ */
 char *GPJ_grass_to_wkt(struct Key_Value *proj_info,
 		       struct Key_Value *proj_units,
 		       int esri_style, int prettify)
 {
+#ifdef HAVE_OGR
     OGRSpatialReferenceH hSRS;
     char *wkt, *local_wkt;
 
@@ -72,10 +76,16 @@
     local_wkt = G_store(wkt);
     CPLFree(wkt);
     OSRDestroySpatialReference(hSRS);
+
     return local_wkt;
+#else
+    G_warning(_("GRASS is not compiled with OGR support"));
+    return NULL;
+#endif
 }
 
-/**
+#ifdef HAVE_OGR
+/*!
  * \brief Converts a GRASS co-ordinate system to an OGRSpatialReferenceH object.
  * 
  * \param proj_info Set of GRASS PROJ_INFO key/value pairs
@@ -83,8 +93,7 @@
  * 
  * \return OGRSpatialReferenceH object representing the co-ordinate system
  *         defined by proj_info and proj_units or NULL if it fails
- **/
-
+ */
 OGRSpatialReferenceH GPJ_grass_to_osr(struct Key_Value * proj_info,
 				      struct Key_Value * proj_units)
 {
@@ -243,7 +252,7 @@
     return hSRS2;
 }
 
-/**
+/*!
  * \brief Converts an OGRSpatialReferenceH object to a GRASS co-ordinate system.
  * 
  * \param cellhd      Pointer to a GRASS Cell_head structure that will have its
@@ -258,10 +267,10 @@
  *                    unspecifed
  * 
  * \return            2 if a projected or lat/long co-ordinate system has been
- *                    defined; 1 if an unreferenced XY co-ordinate system has
+ *                    defined
+ * \return            1 if an unreferenced XY co-ordinate system has
  *                    been defined
- **/
-
+ */
 int GPJ_osr_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo,
 		     struct Key_Value **projunits, OGRSpatialReferenceH hSRS,
 		     int datumtrans)
@@ -647,9 +656,9 @@
 
     return 1;
 }
+#endif
 
-
-/**
+/*!
  * \brief Converts a WKT projection description to a GRASS co-ordinate system.
  * 
  * \param cellhd      Pointer to a GRASS Cell_head structure that will have its
@@ -664,14 +673,16 @@
  *                    unspecifed
  * 
  * \return            2 if a projected or lat/long co-ordinate system has been
- *                    defined; 1 if an unreferenced XY co-ordinate system has
+ *                    defined
+ * \return            1 if an unreferenced XY co-ordinate system has
  *                    been defined
- **/
-
+ * \return            -1 on error
+ */
 int GPJ_wkt_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo,
 		     struct Key_Value **projunits, const char *wkt,
 		     int datumtrans)
 {
+#ifdef HAVE_OGR
     int retval;
 
     if (wkt == NULL)
@@ -690,9 +701,12 @@
     }
 
     return retval;
+#else
+    return -1;
+#endif
 }
 
-
+#ifdef HAVE_OGR
 /* GPJ_set_csv_loc()
  * 'finder function' for use with OGR SetCSVFilenameHook() function */
 

Modified: grass/trunk/lib/vector/Vlib/array.c
===================================================================
--- grass/trunk/lib/vector/Vlib/array.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/array.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -249,7 +249,7 @@
 Vect_set_varray_from_db(const struct Map_info *Map, int field, const char *where,
 			int type, int value, struct varray * varray)
 {
-    int i, n, c, centr, cat, *cats;
+    int i, n, c, centr, *cats;
     int ncats;
     int ni = 0;			/* number of items set */
     int ltype;			/* line type */
@@ -315,7 +315,6 @@
 	    for (c = 0; c < Cats->n_cats; c++) {
 		if (Cats->field[c] == field &&
 		    in_array(cats, ncats, Cats->cat[c])) {
-		    cat = Cats->cat[c];
 		    varray->c[i] = value;
 		    ni++;
 		    break;
@@ -348,7 +347,6 @@
 	    for (c = 0; c < Cats->n_cats; c++) {
 		if (Cats->field[c] == field &&
 		    in_array(cats, ncats, Cats->cat[c])) {
-		    cat = Cats->cat[c];
 		    varray->c[i] = value;
 		    ni++;
 		    break;

Modified: grass/trunk/lib/vector/Vlib/break_polygons.c
===================================================================
--- grass/trunk/lib/vector/Vlib/break_polygons.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/break_polygons.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -104,15 +104,14 @@
 }
 
 /* break polygons using a file-based search index */
-void
-Vect_break_polygons_file(struct Map_info *Map, int type, struct Map_info *Err)
+void Vect_break_polygons_file(struct Map_info *Map, int type, struct Map_info *Err)
 {
     struct line_pnts *BPoints, *Points;
     struct line_cats *Cats, *ErrCats;
     int i, j, k, ret, ltype, broken, last, nlines;
     int nbreaks;
     struct RTree *RTree;
-    int apoints, npoints, nallpoints, nmarks;
+    int npoints, nallpoints, nmarks;
     XPNT2 XPnt;
     struct RTree_Rect rect;
     double dx, dy, a1 = 0, a2 = 0;
@@ -143,7 +142,6 @@
     /* Go through all lines in vector, and add each point to structure of points,
      * if such point already exists check angles of segments and if differ mark for break */
 
-    apoints = 0;
     nmarks = 0;
     npoints = 1;		/* index starts from 1 ! */
     nallpoints = 0;
@@ -396,15 +394,14 @@
 
 
 /* break polygons using a memory-based search index */
-void
-Vect_break_polygons_mem(struct Map_info *Map, int type, struct Map_info *Err)
+void Vect_break_polygons_mem(struct Map_info *Map, int type, struct Map_info *Err)
 {
     struct line_pnts *BPoints, *Points;
     struct line_cats *Cats, *ErrCats;
     int i, j, k, ret, ltype, broken, last, nlines;
     int nbreaks;
     struct RB_TREE *RBTree;
-    int apoints, npoints, nallpoints, nmarks;
+    int npoints, nallpoints, nmarks;
     XPNT *XPnt_found, XPnt_search;
     double dx, dy, a1 = 0, a2 = 0;
     int closed, last_point, cross;
@@ -424,7 +421,6 @@
     /* Go through all lines in vector, and add each point to structure of points,
      * if such point already exists check angles of segments and if differ mark for break */
 
-    apoints = 0;
     nmarks = 0;
     npoints = 0;
     nallpoints = 0;

Modified: grass/trunk/lib/vector/Vlib/bridges.c
===================================================================
--- grass/trunk/lib/vector/Vlib/bridges.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/bridges.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -84,7 +84,6 @@
     int left, right, node1, node2, current_line, next_line;
     int bridges_removed = 0;	/* number of removed bridges */
     int lines_removed = 0;	/* number of lines removed */
-    char *lmsg;
     struct Plus_head *Plus;
     struct line_pnts *Points;
     struct line_cats *Cats;
@@ -93,11 +92,6 @@
 
     int dangle, other_side;
 
-    if (chtype)
-	lmsg = "changed lines";
-    else
-	lmsg = "removed lines";
-
     Plus = &(Map->plus);
 
     Points = Vect_new_line_struct();

Modified: grass/trunk/lib/vector/Vlib/buffer.c
===================================================================
--- grass/trunk/lib/vector/Vlib/buffer.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/buffer.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -52,7 +52,7 @@
 static int find_cross(struct line_pnts *Points, int s1, int s2, int s3,
 		      int s4, int *s5, int *s6)
 {
-    int i, j, np, ret;
+    int i, j, ret;
     double *x, *y;
 
     G_debug(5,
@@ -61,8 +61,7 @@
 
     x = Points->x;
     y = Points->y;
-    np = Points->n_points;
-
+    
     for (i = s1; i <= s2; i++) {
 	for (j = s3; j <= s4; j++) {
 	    if (j == i) {

Modified: grass/trunk/lib/vector/Vlib/build_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/build_ogr.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/build_ogr.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -331,6 +331,7 @@
 
     return 0;
 }
+#endif
 
 /*!
    \brief Build pseudo-topology for OGR layer
@@ -350,6 +351,7 @@
  */
 int Vect_build_ogr(struct Map_info *Map, int build)
 {
+#ifdef HAVE_OGR
     int iFeature, FID, line;
     struct Plus_head *plus;
     struct P_line *Line;
@@ -479,5 +481,8 @@
     plus->built = build;
     
     return 1;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
-#endif

Modified: grass/trunk/lib/vector/Vlib/close_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/close_ogr.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/close_ogr.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -20,6 +20,7 @@
 
 #ifdef HAVE_OGR
 #include <ogr_api.h>
+#endif
 
 /*!
   \brief Close vector map (OGR dsn & layer)
@@ -31,6 +32,7 @@
 */
 int V1_close_ogr(struct Map_info *Map)
 {
+#ifdef HAVE_OGR
     int i;
 
     struct Format_info_ogr *fInfo;
@@ -64,6 +66,10 @@
     G_free(fInfo->layer_name);
 
     return 0;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -76,6 +82,7 @@
 */
 int V2_close_ogr(struct Map_info *Map)
 {
+#ifdef HAVE_OGR
     char fname[1000], elem[1000];
     char buf[5];
     long length = 9;
@@ -133,5 +140,8 @@
     G_free(Map->fInfo.ogr.offset);
 
     return 0;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
-#endif

Modified: grass/trunk/lib/vector/Vlib/color_read.c
===================================================================
--- grass/trunk/lib/vector/Vlib/color_read.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/color_read.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -11,6 +11,8 @@
   \author Martin Landa <landa.martin gmail.com>
 */
 
+#include <string.h>
+
 #include <grass/gis.h>
 #include <grass/raster.h>
 #include <grass/vector.h>

Modified: grass/trunk/lib/vector/Vlib/color_write.c
===================================================================
--- grass/trunk/lib/vector/Vlib/color_write.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/color_write.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -11,6 +11,8 @@
   \author Martin Landa <landa.martin gmail.com>
 */
 
+#include <string.h>
+
 #include <grass/gis.h>
 #include <grass/vector.h>
 #include <grass/raster.h>

Modified: grass/trunk/lib/vector/Vlib/e_intersect.c
===================================================================
--- grass/trunk/lib/vector/Vlib/e_intersect.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/e_intersect.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -693,8 +693,6 @@
 {
     const int DLEVEL = 4;
 
-    double t;
-
     int vertical;
 
     int f11, f12, f21, f22;

Modified: grass/trunk/lib/vector/Vlib/field.c
===================================================================
--- grass/trunk/lib/vector/Vlib/field.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/field.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -580,9 +580,8 @@
     G_debug(3, "Searching for FID column in OGR DB");
     if (Map->format & (GV_FORMAT_OGR | GV_FORMAT_OGR_DIRECT)) {
 
-#ifndef HAVE_GDAL
-	G_fatal_error(_("The support for OGR vector maps wasn't"
-			" compiled in"));
+#ifndef HAVE_OGR
+	G_warning(_("GRASS is not compiled with OGR support"));
 #else
 #if GDAL_VERSION_NUM > 1320 && HAVE_OGR /* seems to be fixed after 1320 release */
 	int nLayers;

Modified: grass/trunk/lib/vector/Vlib/find.c
===================================================================
--- grass/trunk/lib/vector/Vlib/find.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/find.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -173,7 +173,6 @@
     int i, line;
     static struct line_pnts *Points;
     static int first_time = 1;
-    const struct Plus_head *Plus;
     struct bound_box box;
     struct boxlist *List;
 
@@ -185,7 +184,6 @@
 	first_time = 0;
     }
 
-    Plus = &(map->plus);
     gotone = 0;
     choice = 0;
     cur_dist = HUGE_VAL;

Modified: grass/trunk/lib/vector/Vlib/intersect.c
===================================================================
--- grass/trunk/lib/vector/Vlib/intersect.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/intersect.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -604,7 +604,7 @@
 {
     int i, j, k, l, last_seg, seg, last;
     int n_alive_cross;
-    double dist, curdist, last_dist, last_x, last_y, last_z;
+    double dist, curdist, last_x, last_y, last_z;
     double x, y, rethresh;
     struct line_pnts **XLines, *Points;
     struct RTree *MyRTree;
@@ -996,7 +996,6 @@
 	    cross[n_cross].segment[current] = Points->n_points - 2;
 
 	    last_seg = 0;
-	    last_dist = 0;
 	    last_x = Points->x[0];
 	    last_y = Points->y[0];
 	    last_z = Points->z[0];

Modified: grass/trunk/lib/vector/Vlib/net.c
===================================================================
--- grass/trunk/lib/vector/Vlib/net.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/net.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -1067,8 +1067,6 @@
     G_debug(3, "reachable = %d shortcut = %d cur_cst = %f", reachable,
 	    shortcut, cur_cst);
     if (reachable) {
-	int ret;
-
 	if (shortcut) {
 	    if (Points)
 		Vect_append_points(Points, SPoints, GV_FORWARD);
@@ -1094,9 +1092,8 @@
                 /* add starting net SP search node */
                 Vect_list_append(NodesList, fnode[fn]);
             }
-	    ret =
-		Vect_net_shortest_path(Map, fnode[fn], tnode[tn], LList,
-				       NULL);
+	    Vect_net_shortest_path(Map, fnode[fn], tnode[tn], LList,
+				   NULL);
 	    G_debug(3, "Number of lines %d", LList->n_values);
 
 	    if (Points)

Modified: grass/trunk/lib/vector/Vlib/open_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open_ogr.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/open_ogr.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -31,6 +31,7 @@
 
 static int sqltype_to_ogrtype(int);
 static dbDriver *create_table(OGRLayerH, const struct field_info *);
+#endif
 
 /*!
    \brief Open existing OGR layer (level 1 - without feature index file)
@@ -46,6 +47,7 @@
 */
 int V1_open_old_ogr(struct Map_info *Map, int update)
 {
+#ifdef HAVE_OGR
     int i, layer, nLayers;
     OGRDataSourceH Ogr_ds;
     OGRLayerH Ogr_layer;
@@ -123,6 +125,10 @@
     Map->fInfo.ogr.feature_cache_id = -1;	/* FID >= 0 */
     
     return 0;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -135,6 +141,7 @@
 */
 int V2_open_old_ogr(struct Map_info *Map)
 {
+#ifdef HAVE_OGR
     char elem[GPATH_MAX];
     char buf[5];		/* used for format version */
     long length;
@@ -207,6 +214,10 @@
     Map->fInfo.ogr.next_line = 1;
 
     return 0;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -223,18 +234,17 @@
 */
 int V1_open_new_ogr(struct Map_info *Map, const char *name, int with_z)
 {
+#ifdef HAVE_OGR
     OGRSFDriverH    Ogr_driver;
     OGRDataSourceH  Ogr_ds;
     OGRLayerH       Ogr_layer;
     OGRFeatureDefnH Ogr_featuredefn;
     
     int            i, nlayers;
-    char         **Ogr_layer_options;
      
-    Ogr_layer_options = NULL;
+    OGRRegisterAll();
     
-    OGRRegisterAll();
-	    
+    G_debug(1, "V1_open_new_ogr(): name = %s with_z = %d", name, with_z);
     Ogr_driver = OGRGetDriverByName(Map->fInfo.ogr.driver_name);
     if (!Ogr_driver) {
 	G_warning(_("Unable to get OGR driver <%s>"), Map->fInfo.ogr.driver_name);
@@ -276,6 +286,10 @@
     }
     
     return 0;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -295,6 +309,7 @@
 */
 int V2_open_new_ogr(struct Map_info *Map, int type)
 {
+#ifdef HAVE_OGR
     int ndblinks;
     OGRLayerH            Ogr_layer;
     OGRSpatialReferenceH Ogr_spatial_ref;
@@ -373,8 +388,13 @@
 	OGR_L_StartTransaction(Map->fInfo.ogr.layer);
 
     return 0;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
+#ifdef HAVE_OGR
 dbDriver *create_table(OGRLayerH hLayer, const struct field_info *Fi)
 {
     int col, ncols;
@@ -481,5 +501,4 @@
     
     return ogrtype;
 }
-
 #endif

Modified: grass/trunk/lib/vector/Vlib/poly.c
===================================================================
--- grass/trunk/lib/vector/Vlib/poly.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/poly.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -697,7 +697,6 @@
     static struct line_pnts *Points;
     struct bound_box lbox;
     const struct Plus_head *Plus;
-    struct P_line *Line;
     struct P_area *Area;
 
     G_debug(3, "Vect_point_in_area_outer_ring(): x = %f y = %f area = %d", X,
@@ -721,8 +720,6 @@
 	line = abs(Area->lines[i]);
 	G_debug(3, "  line[%d] = %d", i, line);
 
-	Line = Plus->Line[line];
-
 	/* this is slow, but the fastest of all alternatives */
 	Vect_get_line_box(Map, line, &lbox);
 

Modified: grass/trunk/lib/vector/Vlib/read_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/read_ogr.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/read_ogr.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -213,6 +213,7 @@
     }
     return -2;			/* not reached */
 }
+#endif
 
 /*!
   \brief Read next feature from OGR layer. Skip empty features (level 1)
@@ -235,7 +236,12 @@
 int V1_read_next_line_ogr(struct Map_info *Map, struct line_pnts *line_p,
 			  struct line_cats *line_c)
 {
+#ifdef HAVE_OGR
     return read_next_line_ogr(Map, line_p, line_c, FALSE);
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -254,6 +260,7 @@
 int V2_read_next_line_ogr(struct Map_info *Map, struct line_pnts *line_p,
 			  struct line_cats *line_c)
 {
+#ifdef HAVE_OGR
     int line, ret;
     struct P_line *Line;
     struct bound_box lbox, mbox;
@@ -328,8 +335,13 @@
 	
 	return ret;
     }
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
+#ifdef HAVE_OGR
 /*!
   \brief Recursively descend to feature and read the part
   
@@ -460,6 +472,7 @@
 
     return -1;
 }
+#endif
 
 /*!
   \brief Read feature from OGR layer at given offset (level 1)
@@ -479,6 +492,7 @@
 int V1_read_line_ogr(struct Map_info *Map,
 		     struct line_pnts *line_p, struct line_cats *line_c, off_t offset)
 {
+#ifdef HAVE_OGR
     long FID;
     int type;
     OGRGeometryH hGeom;
@@ -535,6 +549,10 @@
     }
 
     return type;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -554,6 +572,7 @@
 int V2_read_line_ogr(struct Map_info *Map, struct line_pnts *line_p,
 		     struct line_cats *line_c, int line)
 {
+#ifdef HAVE_OGR
     struct P_line *Line;
     G_debug(4, "V2_read_line_ogr() line = %d", line);
     
@@ -601,6 +620,8 @@
     }
     
     return V1_read_line_ogr(Map, line_p, line_c, Line->offset);
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
-
-#endif

Modified: grass/trunk/lib/vector/Vlib/remove_duplicates.c
===================================================================
--- grass/trunk/lib/vector/Vlib/remove_duplicates.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/remove_duplicates.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -31,11 +31,10 @@
 
    \return void
  */
-void
-Vect_remove_duplicates(struct Map_info *Map, int type, struct Map_info *Err)
+void Vect_remove_duplicates(struct Map_info *Map, int type, struct Map_info *Err)
 {
     struct line_pnts *APoints, *BPoints;
-    struct line_cats *ACats, *BCats, *Cats;
+    struct line_cats *ACats, *BCats;
     int i, j, c, atype, btype, bline;
     int nlines, nbcats_orig;
     struct bound_box ABox;
@@ -47,7 +46,6 @@
     BPoints = Vect_new_line_struct();
     ACats = Vect_new_cats_struct();
     BCats = Vect_new_cats_struct();
-    Cats = Vect_new_cats_struct();
     List = Vect_new_boxlist(0);
 
     nlines = Vect_get_num_lines(Map);

Modified: grass/trunk/lib/vector/Vlib/rewind_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/rewind_ogr.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/rewind_ogr.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -14,45 +14,57 @@
 */
 
 #include <grass/vector.h>
+#include <grass/glocale.h>
 
 #ifdef HAVE_OGR
 #include <ogr_api.h>
+#endif
 
 /*!
-  \brief Rewind vector data file to cause reads to start at beginning (level 1)
+  \brief Rewind vector data file to cause reads to start at
+  beginning (level 1)
 
-  \param Map vector map
+  \param Map pointer to Map_info structure
 
-  \return 0
+  \return 0 on success
+  \return -1 on error
  */
 int V1_rewind_ogr(struct Map_info *Map)
 {
     G_debug(2, "V1_rewind_ogr(): name = %s", Map->name);
-
+#ifdef HAVE_OGR
     Map->fInfo.ogr.lines_num = 0;
     Map->fInfo.ogr.lines_next = 0;
 
     OGR_L_ResetReading(Map->fInfo.ogr.layer);
 
     return 0;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
-  \brief Rewind vector data file to cause reads to start at beginning (level 2)
+  \brief Rewind vector data file to cause reads to start at
+  beginning (level 2)
 
   \param Map pointer to Map_info structure
 
-  \return 0
+  \return 0 on success
+  \return -1 on error
  */
 int V2_rewind_ogr(struct Map_info *Map)
 {
     G_debug(2, "V2_rewind_ogr(): name = %s", Map->name);
-
+#ifdef HAVE_OGR
     Map->next_line = 1;
 
     V1_rewind_ogr(Map);
 
     return 0;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
-
-#endif

Modified: grass/trunk/lib/vector/Vlib/write.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/write.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -198,7 +198,7 @@
     }
 
     offset = Map->plus.Line[line]->offset;
-    G_debug(3, "   offset=%lu", Map->plus.Line[line]->offset);
+    G_debug(3, "   offset=%llu", Map->plus.Line[line]->offset);
     ret =
 	(*Vect_rewrite_line_array[Map->format][Map->level]) (Map, line, type, offset,
 							     points, cats);

Modified: grass/trunk/lib/vector/Vlib/write_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_ogr.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/Vlib/write_ogr.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -100,6 +100,8 @@
     return;
 }
 
+#endif
+
 /*!
   \brief Writes feature on level 1 (OGR interface)
 
@@ -123,6 +125,7 @@
 			const struct line_pnts *points,
 			const struct line_cats *cats)
 {
+#ifdef HAVE_OGR
     int i, cat, ret;
 
     struct field_info *Fi;
@@ -267,6 +270,10 @@
     G_debug(3, "V1_write_line_ogr(): -> offset = %lu", (unsigned long) offset);
 
     return offset;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -283,6 +290,7 @@
 off_t V2_write_line_ogr(struct Map_info *Map, int type,
 			const struct line_pnts *points, const struct line_cats *cats)
 {
+#ifdef HAVE_OGR
     int line;
     off_t offset;
     struct Plus_head *plus;
@@ -348,7 +356,10 @@
      * Write_line_array in write.c */
     
     return line;
-
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -369,6 +380,7 @@
 			  off_t offset,
 			  const struct line_pnts *points, const struct line_cats *cats)
 {
+#ifdef HAVE_OGR
     if (type != V1_read_line_ogr(Map, NULL, NULL, offset)) {
 	G_warning(_("Unable to rewrite feature (incompatible feature types)"));
 	return -1;
@@ -378,6 +390,10 @@
     V1_delete_line_ogr(Map, offset);
 
     return V1_write_line_ogr(Map, type, points, cats);
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -396,6 +412,7 @@
 off_t V2_rewrite_line_ogr(struct Map_info *Map, int line, int type, off_t offset,
 			  const struct line_pnts *points, const struct line_cats *cats)
 {
+#ifdef HAVE_OGR
     if (type != V2_read_line_ogr(Map, NULL, NULL, line)) {
 	G_warning(_("Unable to rewrite feature (incompatible feature types)"));
 	return -1;
@@ -404,6 +421,10 @@
     V2_delete_line_ogr(Map, line);
 
     return V2_write_line_ogr(Map, type, points, cats);
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -417,6 +438,7 @@
 */
 int V1_delete_line_ogr(struct Map_info *Map, off_t offset)
 {
+#ifdef HAVE_OGR
     G_debug(3, "V1_delete_line_ogr(), offset = %lu", (unsigned long) offset);
 
     if (!Map->fInfo.ogr.layer) {
@@ -431,6 +453,10 @@
 	return -1;
     
     return 0;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
 /*!
@@ -444,6 +470,7 @@
 */
 int V2_delete_line_ogr(struct Map_info *Map, int line)
 {
+#ifdef HAVE_OGR
     int ret, i, type, first;
     struct P_line *Line;
     struct Plus_head *plus;
@@ -507,8 +534,13 @@
 	/* maybe not needed VERIFY */
     }
     return ret;
+#else
+    G_fatal_error(_("GRASS is not compiled with OGR support"));
+    return -1;
+#endif
 }
 
+#ifdef HAVE_OGR
 int write_attributes(dbDriver *driver, int cat, const struct field_info *Fi,
 		     OGRLayerH Ogr_layer, OGRFeatureH Ogr_feature)
 {

Modified: grass/trunk/lib/vector/diglib/frmt.c
===================================================================
--- grass/trunk/lib/vector/diglib/frmt.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/diglib/frmt.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -52,9 +52,11 @@
 	    ptr++;
 
 	if (strcmp(buf1, "FORMAT") == 0) {
+#ifdef HAVE_OGR
 	    if (G_strcasecmp(ptr, "ogr") == 0) {
 		frmt = GV_FORMAT_OGR;
 	    }
+#endif
 	}
     }
     if (frmt == -1) {

Modified: grass/trunk/lib/vector/vedit/delete.c
===================================================================
--- grass/trunk/lib/vector/vedit/delete.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/lib/vector/vedit/delete.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -11,6 +11,8 @@
   \author Martin Landa <landa.martin gmail.com>
 */
 
+#include <stdlib.h>
+
 #include <grass/vedit.h>
 #include <grass/dbmi.h>
 #include <grass/glocale.h>

Modified: grass/trunk/raster/r.in.lidar/main.c
===================================================================
--- grass/trunk/raster/r.in.lidar/main.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/raster/r.in.lidar/main.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -272,7 +272,7 @@
     proj_units = NULL;
     projstr = LASSRS_GetWKT_CompoundOK(LAS_srs);
 
-    if (1) {
+    if (TRUE) {
 	int err = 0;
 	char error_msg[8192];
 
@@ -281,7 +281,7 @@
 			     &proj_units, projstr, 0) < 0)
 	    G_warning(_("Unable to convert input map projection information to "
 		       "GRASS format for checking"));
-
+	
 	/* Does the projection of the current location match the dataset? */
 	/* G_get_window seems to be unreliable if the location has been changed */
 	G_get_set_window(&loc_wind);

Modified: grass/trunk/vector/v.colors/main.c
===================================================================
--- grass/trunk/vector/v.colors/main.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/vector/v.colors/main.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -16,6 +16,7 @@
  **************************************************************/
 
 #include <stdlib.h>
+#include <string.h>
 
 #include <grass/gis.h>
 #include <grass/vector.h>

Modified: grass/trunk/vector/v.colors.out/main.c
===================================================================
--- grass/trunk/vector/v.colors.out/main.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/vector/v.colors.out/main.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -16,6 +16,7 @@
  ***************************************************************************/
 
 #include <stdlib.h>
+#include <string.h>
 
 #include <grass/gis.h>
 #include <grass/raster.h>

Modified: grass/trunk/vector/v.select/main.c
===================================================================
--- grass/trunk/vector/v.select/main.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/vector/v.select/main.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -18,6 +18,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+
 #include <grass/gis.h>
 #include <grass/vector.h>
 #include <grass/glocale.h>

Modified: grass/trunk/vector/v.select/select.c
===================================================================
--- grass/trunk/vector/v.select/select.c	2012-01-21 12:29:59 UTC (rev 50344)
+++ grass/trunk/vector/v.select/select.c	2012-01-21 12:31:27 UTC (rev 50345)
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+
 #include <grass/gis.h>
 #include <grass/vector.h>
 #include <grass/glocale.h>



More information about the grass-commit mailing list