Преглед на файлове

v.generalize: reduce compiler warnings

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@73674 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz преди 6 години
родител
ревизия
5a0e73bff6
променени са 5 файла, в които са добавени 10 реда и са изтрити 11 реда
  1. 1 1
      vector/v.generalize/displacement.c
  2. 5 2
      vector/v.generalize/matrix.c
  3. 1 1
      vector/v.generalize/misc.c
  4. 2 2
      vector/v.generalize/network.c
  5. 1 5
      vector/v.generalize/simplification.c

+ 1 - 1
vector/v.generalize/displacement.c

@@ -289,7 +289,7 @@ int snakes_displacement(struct Map_info *In, struct Map_info *Out,
     }
     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))) {

+ 5 - 2
vector/v.generalize/matrix.c

@@ -164,6 +164,7 @@ int matrix_inverse(MATRIX *a, MATRIX *res, int percents)
 
     for (i = 0; i < n; i++) {
 	int found = 0;
+	double c;
 
 	if (percents)
 	    G_percent(i, n, 1);
@@ -177,14 +178,16 @@ int matrix_inverse(MATRIX *a, MATRIX *res, int percents)
 	}
 	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;

+ 1 - 1
vector/v.generalize/misc.c

@@ -202,7 +202,7 @@ static int cmp(const void *a, const void *b)
     int ai = *(int *)a;
     int bi = *(int *)b;
 
-    return (ai - bi);
+    return (ai < bi ? -1 : (ai > bi));
 }
 
 /* check topology corruption by boundary modification

+ 2 - 2
vector/v.generalize/network.c

@@ -184,7 +184,7 @@ int graph_generalization(struct Map_info *In, struct Map_info *Out,
 	    Vect_reset_list(prev[j]);
 
 	while (front != back) {
-	    int v, j;
+	    int v;
 
 	    v = queue[front];
 	    comp[i]++;
@@ -220,7 +220,7 @@ int graph_generalization(struct Map_info *In, struct Map_info *Out,
 	    }
 	memset(betw, 0, sizeof(double) * g.vertices);
 	while (front != back) {
-	    int v, j;
+	    int v;
 
 	    v = queue[front];
 	    front = (front + 1) % g.vertices;

+ 1 - 5
vector/v.generalize/simplification.c

@@ -70,7 +70,6 @@ int douglas_peucker(struct line_pnts *Points, double thresh, int with_z)
 
 	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 @@ int douglas_peucker(struct line_pnts *Points, double thresh, int with_z)
 	    }
 	}
 
-
 	if (maxindex == -1 || maxdist <= thresh) {	/* no points between or all point are inside the threshold */
 	    index[icount++] = last;
 	}
@@ -98,11 +96,8 @@ int douglas_peucker(struct line_pnts *Points, double thresh, int with_z)
 	    stack[top++] = first;
 	    stack[top++] = maxindex;
 	}
-
-
     }
 
-
     Points->n_points = icount;
 
     /* finally, select only points marked in the algorithm */
@@ -114,6 +109,7 @@ int douglas_peucker(struct line_pnts *Points, double thresh, int with_z)
 
     G_free(stack);
     G_free(index);
+
     return (Points->n_points);
 }