mirror of
https://github.com/cookiengineer/audacity
synced 2026-03-10 08:25:52 +01:00
Re-fix some warnings about mixing signed and unsigned better...
... Assuming that large unsigned magnitudes with high order bit set are not the problem, but signed negatives of small magnitude may be: 1) Always cast the unsigned to signed in comparisons, not the other way. Also: 2) Cast unsigned TERM to signed by itself, before subtracting. Don't cast the result. 3) Rewrite some comparisons by moving subtracted term to other side. See commitsd2fe7b1757f463eda36c
This commit is contained in:
@@ -133,13 +133,13 @@ void MeterUpdateQueue::Clear()
|
||||
// queue was full.
|
||||
bool MeterUpdateQueue::Put(MeterUpdateMsg &msg)
|
||||
{
|
||||
// mStart cnan be greater than mEnd because it is all mod mBufferSize
|
||||
// mStart can be greater than mEnd because it is all mod mBufferSize
|
||||
wxASSERT( (mEnd + mBufferSize - mStart) >= 0 );
|
||||
int len = (mEnd + mBufferSize - mStart) % mBufferSize;
|
||||
|
||||
// Never completely fill the queue, because then the
|
||||
// state is ambiguous (mStart==mEnd)
|
||||
if (len >= (int)(mBufferSize-1))
|
||||
if (len + 1 >= (int)(mBufferSize))
|
||||
return false;
|
||||
|
||||
//wxLogDebug(wxT("Put: %s"), msg.toString());
|
||||
|
||||
Reference in New Issue
Block a user