[GRASS-SVN] r73674 - grass/trunk/vector/v.generalize

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 13 07:07:47 PST 2018


Author: mmetz
Date: 2018-11-13 07:07:47 -0800 (Tue, 13 Nov 2018)
New Revision: 73674

Modified:
   grass/trunk/vector/v.generalize/displacement.c
   grass/trunk/vector/v.generalize/matrix.c
   grass/trunk/vector/v.generalize/misc.c
   grass/trunk/vector/v.generalize/network.c
   grass/trunk/vector/v.generalize/simplification.c
Log:
v.generalize: reduce compiler warnings

Modified: grass/trunk/vector/v.generalize/displacement.c
===================================================================
--- grass/trunk/vector/v.generalize/displacement.c	2018-11-13 15:07:29 UTC (rev 73673)
+++ grass/trunk/vector/v.generalize/displacement.c	2018-11-13 15:07:47 UTC (rev 73674)
@@ -289,7 +289,7 @@
     }
     index = 0;
     for (i = 1; i <= n_lines; i++) {
-	int type = Vect_read_line(In, Points, Cats, i);
+	type = Vect_read_line(In, Points, Cats, i);
 
 	if (type != GV_LINE ||
 	    (layer > 0 && !Vect_cats_in_constraint(Cats, layer, cat_list))) {

Modified: grass/trunk/vector/v.generalize/matrix.c
===================================================================
--- grass/trunk/vector/v.generalize/matrix.c	2018-11-13 15:07:29 UTC (rev 73673)
+++ grass/trunk/vector/v.generalize/matrix.c	2018-11-13 15:07:47 UTC (rev 73674)
@@ -164,6 +164,7 @@
 
     for (i = 0; i < n; i++) {
 	int found = 0;
+	double c;
 
 	if (percents)
 	    G_percent(i, n, 1);
@@ -177,15 +178,17 @@
 	}
 	if (!found)
 	    return 0;
-	double c = (double)1.0 / a->a[i][i];
 
+	c = (double)1.0 / a->a[i][i];
+
 	matrix_row_scalar(i, c, a);
 	matrix_row_scalar(i, c, res);
 	for (j = 0; j < n; j++) {
 	    if (i == j)
 		continue;
-	    double c = -a->a[j][i];
 
+	    c = -a->a[j][i];
+
 	    if (c == 0.0)
 		continue;
 	    matrix_row_add_multiple(j, i, c, a);

Modified: grass/trunk/vector/v.generalize/misc.c
===================================================================
--- grass/trunk/vector/v.generalize/misc.c	2018-11-13 15:07:29 UTC (rev 73673)
+++ grass/trunk/vector/v.generalize/misc.c	2018-11-13 15:07:47 UTC (rev 73674)
@@ -202,7 +202,7 @@
     int ai = *(int *)a;
     int bi = *(int *)b;
 
-    return (ai - bi);
+    return (ai < bi ? -1 : (ai > bi));
 }
 
 /* check topology corruption by boundary modification

Modified: grass/trunk/vector/v.generalize/network.c
===================================================================
--- grass/trunk/vector/v.generalize/network.c	2018-11-13 15:07:29 UTC (rev 73673)
+++ grass/trunk/vector/v.generalize/network.c	2018-11-13 15:07:47 UTC (rev 73674)
@@ -184,7 +184,7 @@
 	    Vect_reset_list(prev[j]);
 
 	while (front != back) {
-	    int v, j;
+	    int v;
 
 	    v = queue[front];
 	    comp[i]++;
@@ -220,7 +220,7 @@
 	    }
 	memset(betw, 0, sizeof(double) * g.vertices);
 	while (front != back) {
-	    int v, j;
+	    int v;
 
 	    v = queue[front];
 	    front = (front + 1) % g.vertices;

Modified: grass/trunk/vector/v.generalize/simplification.c
===================================================================
--- grass/trunk/vector/v.generalize/simplification.c	2018-11-13 15:07:29 UTC (rev 73673)
+++ grass/trunk/vector/v.generalize/simplification.c	2018-11-13 15:07:47 UTC (rev 73674)
@@ -70,7 +70,6 @@
 
 	int maxindex = -1;
 	double maxdist = -1;
-	int i;
 
 	for (i = first + 1; i <= last - 1; i++) {	/* Find the furthermost point between first, last */
 	    double px, py, pz, pdist;
@@ -87,7 +86,6 @@
 	    }
 	}
 
-
 	if (maxindex == -1 || maxdist <= thresh) {	/* no points between or all point are inside the threshold */
 	    index[icount++] = last;
 	}
@@ -98,11 +96,8 @@
 	    stack[top++] = first;
 	    stack[top++] = maxindex;
 	}
-
-
     }
 
-
     Points->n_points = icount;
 
     /* finally, select only points marked in the algorithm */
@@ -114,6 +109,7 @@
 
     G_free(stack);
     G_free(index);
+
     return (Points->n_points);
 }
 



More information about the grass-commit mailing list