diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-03-03 15:48:18 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-03-03 15:48:53 +0100 |
commit | 75d012e8c7d0b2dfec0fe34807eabb4f661f4fb7 (patch) | |
tree | 068cbf16562b5cfbb1887ffb55385a5f12b76059 /src/timedata.h | |
parent | ba80a684cfef95233330de58af92ec4baec875fd (diff) | |
parent | ad1ae7ae2e90a29fcfaaddee2d5acd025de72cbe (diff) |
Merge #8808: Do not shadow variables (gcc set)
ad1ae7a Check and enable -Wshadow by default. (Pavel Janík)
9de90bb Do not shadow variables (gcc set) (Pavel Janík)
Tree-SHA512: 9517feb423dc8ddd63896016b25324673bfbe0bffa97f22996f59d7a3fcbdc2ebf2e43ac02bc067546f54e293e9b2f2514be145f867321e9031f895c063d9fb8
Diffstat (limited to 'src/timedata.h')
-rw-r--r-- | src/timedata.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/timedata.h b/src/timedata.h index 4a2eab3487..bc5451b19b 100644 --- a/src/timedata.h +++ b/src/timedata.h @@ -27,9 +27,9 @@ private: unsigned int nSize; public: - CMedianFilter(unsigned int size, T initial_value) : nSize(size) + CMedianFilter(unsigned int _size, T initial_value) : nSize(_size) { - vValues.reserve(size); + vValues.reserve(_size); vValues.push_back(initial_value); vSorted = vValues; } @@ -48,14 +48,14 @@ public: T median() const { - int size = vSorted.size(); - assert(size > 0); - if (size & 1) // Odd number of elements + int vSortedSize = vSorted.size(); + assert(vSortedSize > 0); + if (vSortedSize & 1) // Odd number of elements { - return vSorted[size / 2]; + return vSorted[vSortedSize / 2]; } else // Even number of elements { - return (vSorted[size / 2 - 1] + vSorted[size / 2]) / 2; + return (vSorted[vSortedSize / 2 - 1] + vSorted[vSortedSize / 2]) / 2; } } |