Skip to content

Commit

Permalink
r.viewshed: initialize struct member before using struct (#4232)
Browse files Browse the repository at this point in the history
* r.viewshed: initialize struct member before using struct

This was reported by cppcheck tool. Technically, we are not using
the member in the struct variable in any of the subsequent
functions, but it's a good practice to initialize all the struct
members whenever possible.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>

* Use right literal while initializing angle

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>

---------

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
  • Loading branch information
ymdatta authored Sep 16, 2024
1 parent fdcd8d8 commit c840f3c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions raster/r.viewshed/viewshed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ MemoryVisibilityGrid *viewshed_in_memory(char *inputfname, GridHeader *hd,
e.elev[0] = data[0][i];
e.elev[1] = data[1][i];
e.elev[2] = data[2][i];
e.angle = -1.0;

if (!is_nodata(visgrid->grid->hd, data[1][i]) &&
!is_point_outside_max_dist(*vp, *hd, sn.row, sn.col,
Expand Down Expand Up @@ -499,6 +500,7 @@ IOVisibilityGrid *viewshed_external(char *inputfname, GridHeader *hd,
e.elev[0] = data[0][i];
e.elev[1] = data[1][i];
e.elev[2] = data[2][i];
e.angle = -1.0;
if (!is_nodata(visgrid->hd, data[1][i]) &&
!is_point_outside_max_dist(*vp, *hd, sn.row, sn.col,
viewOptions.maxDist)) {
Expand Down

0 comments on commit c840f3c

Please sign in to comment.