Skip to content

Commit

Permalink
Fix comparisons with 'logical not' on each side
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
nilason and metzm committed Feb 10, 2021
1 parent d2ac21d commit 1384f52
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/display/draw2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/imagery/list_subgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions lib/raster3d/close.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 1384f52

Please sign in to comment.