Author: Paul Licameli <paul.licameli@audacityteam.org>
    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
This commit is contained in:
Leland Lucius 2019-12-15 23:13:27 -06:00
parent 19494d6277
commit 1f27ad932c
1 changed files with 6 additions and 1 deletions

View File

@ -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;