Skip to content

Commit

Permalink
r.terraflow: Fix -Wunused-private-field compiler warning (#2161)
Browse files Browse the repository at this point in the history
Fixes -Wunused-private-field compiler warning (GCC or Clang) generated with -Wall in r.terraflow C++ code.
  • Loading branch information
nilason committed Apr 13, 2022
1 parent 863f067 commit a911eb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
9 changes: 2 additions & 7 deletions raster/r.terraflow/fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ computeFlowDirections(AMI_STREAM<elevation_type>*& elstr,

Rtimer rt, rtTotal;
AMI_STREAM<elevation_type> *elstr_reclass=NULL;
AMI_STREAM<ElevationWindow > *winstr=NULL;
AMI_STREAM<plateauStats> *statstr=NULL;
AMI_STREAM<plateauType> *platstr=NULL;
AMI_STREAM<waterType> *waterstr=NULL;
Expand Down Expand Up @@ -194,13 +193,10 @@ computeFlowDirections(AMI_STREAM<elevation_type>*& elstr,

rt_start(rt);
dirstr = new AMI_STREAM<direction_type>;
winstr = new AMI_STREAM<ElevationWindow>();
statstr = new AMI_STREAM<plateauStats>;

platstr = findPlateaus(elstr, nrows, ncols, nodataType::ELEVATION_NODATA,
winstr, dirstr, statstr);

delete winstr; /* not used; not made */
dirstr, statstr);
rt_stop(rt);

if (stats) {
Expand Down Expand Up @@ -331,11 +327,10 @@ computeFlowDirections(AMI_STREAM<elevation_type>*& elstr,
}

rt_start(rt);
winstr = NULL;
dirstr = new AMI_STREAM<direction_type>();
statstr = new AMI_STREAM<plateauStats>();
platstr = findPlateaus(filledstr, nrows, ncols, nodataType::ELEVATION_NODATA,
winstr, dirstr, statstr);
dirstr, statstr);
rt_stop(rt);
if (stats) {
stats->recordTime("findingPlateaus2", rt);
Expand Down
19 changes: 7 additions & 12 deletions raster/r.terraflow/plateau.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class detectPlateaus {
private:
AMI_STREAM<direction_type> *dirStream;
AMI_STREAM<plateauType> *platStream;
AMI_STREAM<ElevationWindow > *winStream;
queue<direction_type> *dirQueue;
queue<plateauType> *platQueue;
ccforest<cclabel_type> colTree;
Expand All @@ -54,9 +53,8 @@ class detectPlateaus {
const elevation_type nodata_value;
public:
detectPlateaus(const dimension_type gnrows,const dimension_type gncols,
const elevation_type gnodata_value,
AMI_STREAM<direction_type>* dirstr,
AMI_STREAM<ElevationWindow > *winstr);
const elevation_type gnodata_value,
AMI_STREAM<direction_type>* dirstr);
~detectPlateaus();
void processWindow(dimension_type row, dimension_type col,
elevation_type *a,
Expand All @@ -74,11 +72,10 @@ class detectPlateaus {


detectPlateaus::detectPlateaus(const dimension_type gnrows,
const dimension_type gncols,
const elevation_type gnodata_value,
AMI_STREAM<direction_type>* gdirstr,
AMI_STREAM<ElevationWindow > *gwinstr):
dirStream(gdirstr), winStream(gwinstr),
const dimension_type gncols,
const elevation_type gnodata_value,
AMI_STREAM<direction_type>* gdirstr):
dirStream(gdirstr),
nrows(gnrows), ncols(gncols), nodata_value(gnodata_value) {
platStream = new AMI_STREAM<plateauType>();
}
Expand Down Expand Up @@ -413,7 +410,6 @@ AMI_STREAM<plateauType> *
findPlateaus(AMI_STREAM<elevation_type> *elstr,
const dimension_type nrows, const dimension_type ncols,
const elevation_type nodata_value,
AMI_STREAM<ElevationWindow > *winstr,
AMI_STREAM<direction_type> *dirStr,
AMI_STREAM<plateauStats> *statStr) {
Rtimer rt;
Expand All @@ -426,7 +422,7 @@ findPlateaus(AMI_STREAM<elevation_type> *elstr,
stats->comment("----------", opt->verbose);
stats->comment("finding flat areas (plateaus and depressions)");
}
detectPlateaus md(nrows, ncols,nodata_value, dirStr, winstr);
detectPlateaus md(nrows, ncols, nodata_value, dirStr);
md.generatePlateaus(*elstr);
rt_stop(rt);
if (stats) {
Expand Down Expand Up @@ -477,4 +473,3 @@ findPlateaus(AMI_STREAM<elevation_type> *elstr,
}

/* ********************************************************************** */

1 change: 0 additions & 1 deletion raster/r.terraflow/plateau.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ AMI_STREAM<plateauType> *
findPlateaus(AMI_STREAM<elevation_type> *elstr,
const dimension_type nrows, const dimension_type ncols,
const elevation_type nodata_value,
AMI_STREAM<ElevationWindow > *winstr,
AMI_STREAM<direction_type> *dirStr,
AMI_STREAM<plateauStats> *statStr);

Expand Down

0 comments on commit a911eb2

Please sign in to comment.