aboutsummaryrefslogtreecommitdiffstats
path: root/al
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-10-03 08:02:57 -0700
committerChris Robinson <[email protected]>2021-10-03 08:02:57 -0700
commitf92cc479d82fbf85591d8918bbf469c4b329c31c (patch)
treef18d486b88aa274cd172496c133e6a82c1033dbb /al
parent53d9033ec70019353dfa255b63cbe9eb21c70888 (diff)
Silence some static analysis warnings
Diffstat (limited to 'al')
-rw-r--r--al/auxeffectslot.cpp1
-rw-r--r--al/buffer.cpp5
-rw-r--r--al/effect.cpp4
-rw-r--r--al/filter.cpp4
-rw-r--r--al/source.cpp6
5 files changed, 11 insertions, 9 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index d1ab29ee..ad7ba41e 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -277,6 +277,7 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context)
{ return entry.FreeMask != 0; });
auto lidx = static_cast<ALuint>(std::distance(context->mEffectSlotList.begin(), sublist));
auto slidx = static_cast<ALuint>(al::countr_zero(sublist->FreeMask));
+ ASSUME(slidx < 64);
ALeffectslot *slot{::new(sublist->EffectSlots + slidx) ALeffectslot{}};
aluInitEffectPanning(&slot->mSlot, context);
diff --git a/al/buffer.cpp b/al/buffer.cpp
index b1e4bdf5..088775b8 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -395,11 +395,10 @@ ALbuffer *AllocBuffer(ALCdevice *device)
{
auto sublist = std::find_if(device->BufferList.begin(), device->BufferList.end(),
[](const BufferSubList &entry) noexcept -> bool
- { return entry.FreeMask != 0; }
- );
-
+ { return entry.FreeMask != 0; });
auto lidx = static_cast<ALuint>(std::distance(device->BufferList.begin(), sublist));
auto slidx = static_cast<ALuint>(al::countr_zero(sublist->FreeMask));
+ ASSUME(slidx < 64);
ALbuffer *buffer{::new (sublist->Buffers + slidx) ALbuffer{}};
diff --git a/al/effect.cpp b/al/effect.cpp
index a15194fd..1d2b9b3c 100644
--- a/al/effect.cpp
+++ b/al/effect.cpp
@@ -182,10 +182,10 @@ ALeffect *AllocEffect(ALCdevice *device)
{
auto sublist = std::find_if(device->EffectList.begin(), device->EffectList.end(),
[](const EffectSubList &entry) noexcept -> bool
- { return entry.FreeMask != 0; }
- );
+ { return entry.FreeMask != 0; });
auto lidx = static_cast<ALuint>(std::distance(device->EffectList.begin(), sublist));
auto slidx = static_cast<ALuint>(al::countr_zero(sublist->FreeMask));
+ ASSUME(slidx < 64);
ALeffect *effect{::new (sublist->Effects + slidx) ALeffect{}};
InitEffectParams(effect, AL_EFFECT_NULL);
diff --git a/al/filter.cpp b/al/filter.cpp
index 21a8fee7..1753580e 100644
--- a/al/filter.cpp
+++ b/al/filter.cpp
@@ -355,10 +355,10 @@ ALfilter *AllocFilter(ALCdevice *device)
{
auto sublist = std::find_if(device->FilterList.begin(), device->FilterList.end(),
[](const FilterSubList &entry) noexcept -> bool
- { return entry.FreeMask != 0; }
- );
+ { return entry.FreeMask != 0; });
auto lidx = static_cast<ALuint>(std::distance(device->FilterList.begin(), sublist));
auto slidx = static_cast<ALuint>(al::countr_zero(sublist->FreeMask));
+ ASSUME(slidx < 64);
ALfilter *filter{::new(sublist->Filters + slidx) ALfilter{}};
InitFilterParams(filter, AL_FILTER_NULL);
diff --git a/al/source.cpp b/al/source.cpp
index bf499442..e28b938f 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -619,6 +619,7 @@ bool SetVoiceOffset(Voice *oldvoice, const VoicePos &vpos, ALsource *source, ALC
}
++vidx;
}
+ assert(newvoice != nullptr);
}
/* Initialize the new voice and set its starting offset.
@@ -737,10 +738,10 @@ ALsource *AllocSource(ALCcontext *context)
{
auto sublist = std::find_if(context->mSourceList.begin(), context->mSourceList.end(),
[](const SourceSubList &entry) noexcept -> bool
- { return entry.FreeMask != 0; }
- );
+ { return entry.FreeMask != 0; });
auto lidx = static_cast<ALuint>(std::distance(context->mSourceList.begin(), sublist));
auto slidx = static_cast<ALuint>(al::countr_zero(sublist->FreeMask));
+ ASSUME(slidx < 64);
ALsource *source{::new(sublist->Sources + slidx) ALsource{}};
@@ -3063,6 +3064,7 @@ START_API_FUNC
break;
}
}
+ assert(voice != nullptr);
voice->mPosition.store(0u, std::memory_order_relaxed);
voice->mPositionFrac.store(0, std::memory_order_relaxed);