Kaynağa Gözat

Fix comparisons with 'logical not' on each side

as it is only applied to the left side of the comparison. (#1275)

Addresses -Wlogical-not-parentheses compiler warnings.

Co-authored-by: Markus Metz <markus.metz.giswork@gmail.com>
nila 4 yıl önce
ebeveyn
işleme
1384f52262
3 değiştirilmiş dosya ile 5 ekleme ve 5 silme
  1. 1 1
      lib/display/draw2.c
  2. 1 1
      lib/imagery/list_subgp.c
  3. 3 3
      lib/raster3d/close.c

+ 1 - 1
lib/display/draw2.c

@@ -126,7 +126,7 @@ static void reduce_path(struct path *dst, const struct path *src, double eps)
 
 	if (fabs(v1->x - v0->x) < eps && fabs(v1->y - v0->y) < eps &&
 	    fabs(v1->x - v2->x) < eps && fabs(v1->y - v2->y) < eps &&
-	    v0->mode != P_MOVE && v1->mode != P_MOVE && !v2->mode != P_MOVE)
+	    v0->mode != P_MOVE && v1->mode != P_MOVE && (!v2->mode) != P_MOVE)
 	    continue;
 
 	path_append(dst, v1->x, v1->y, v1->mode);

+ 1 - 1
lib/imagery/list_subgp.c

@@ -34,7 +34,7 @@ char **list_subgroups(const char *group, const char *mapset, int *subgs_num)
     sprintf(buf, "group/%s/subgroup", group);
     G_file_name(path, buf, "", mapset);
 
-    if (!G_lstat(path, &sb) == 0 || !S_ISDIR(sb.st_mode))
+    if (G_lstat(path, &sb) || !S_ISDIR(sb.st_mode))
 	return NULL;
 
     subgs = G_ls2(path, subgs_num);

+ 3 - 3
lib/raster3d/close.c

@@ -106,7 +106,7 @@ static int close_cell_new(RASTER3D_Map * map)
 	return 0;
     }
 
-    if (!close_new(map) != 0) {
+    if (!close_new(map)) {
 	G_warning(_("Unable to create 3D raster map <%s>"), map->fileName);
 	return 0;
     }
@@ -126,7 +126,7 @@ static int close_old(RASTER3D_Map * map)
 
 static int close_cell_old(RASTER3D_Map * map)
 {
-    if (!close_old(map) != 0) {
+    if (!close_old(map)) {
 	G_warning(_("Unable to close 3D raster map <%s>"), map->fileName);
 	return 0;
     }
@@ -155,7 +155,7 @@ int Rast3d_close(RASTER3D_Map * map)
 	}
     }
     else {
-	if (!close_cell_old(map) != 0) {
+	if (!close_cell_old(map)) {
 	    G_warning(_("Unable to close 3D raster map <%s>"), map->fileName);
 	    return 0;
 	}