From 2870d0c8d786e7615d9dc6389936e3878f85a98d Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sun, 15 Dec 2019 23:13:27 -0600 Subject: [PATCH] Reapply a3afdf80d00c68dddba6aa66829ac296891bf2d4 Author: Paul Licameli Date: Tue Nov 13 08:36:22 2018 -0500 lib-src/libnyquist: fix warning about always-false comparison... ... but this raises questions about the intention to catch negative values, which if they ever happened, were just mis-cast to unsigned at call sites --- lib-src/libnyquist/nyquist/nyqstk/src/Delay.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib-src/libnyquist/nyquist/nyqstk/src/Delay.cpp b/lib-src/libnyquist/nyquist/nyqstk/src/Delay.cpp index 34729212c..3749868a2 100644 --- a/lib-src/libnyquist/nyquist/nyqstk/src/Delay.cpp +++ b/lib-src/libnyquist/nyquist/nyqstk/src/Delay.cpp @@ -72,12 +72,15 @@ void Delay :: setMaximumDelay(unsigned long delay) { if ( delay < inputs_.size() ) return; +/* if ( delay < 0 ) { errorString_ << "Delay::setMaximumDelay: argument (" << delay << ") less than zero!\n"; handleError( StkError::WARNING ); return; } - else if (delay < delay_ ) { + else +*/ + if (delay < delay_ ) { errorString_ << "Delay::setMaximumDelay: argument (" << delay << ") less than current delay setting (" << delay_ << ")!\n"; handleError( StkError::WARNING ); return; @@ -97,6 +100,7 @@ void Delay :: setDelay(unsigned long delay) if ( outPoint_ == inputs_.size() ) outPoint_ = 0; delay_ = inputs_.size() - 1; } + /* else if ( delay < 0 ) { errorString_ << "Delay::setDelay: argument (" << delay << ") less than zero ... setting to zero!\n"; handleError( StkError::WARNING ); @@ -104,6 +108,7 @@ void Delay :: setDelay(unsigned long delay) outPoint_ = inPoint_; delay_ = 0; } + */ else { // read chases write if ( inPoint_ >= delay ) outPoint_ = inPoint_ - delay; else outPoint_ = inputs_.size() + inPoint_ - delay;