refactor: PVS-Studio warnings fixes

This commit is contained in:
MihailRis
2024-08-04 01:12:42 +03:00
parent 7bc96affbb
commit 245b39be62
22 changed files with 311 additions and 302 deletions
+7 -5
View File
@@ -96,8 +96,9 @@ void ALStream::bindSpeaker(speakerid_t speakerid) {
this->speaker = speakerid;
sp = audio::get_speaker(speakerid);
if (sp) {
auto alspeaker = dynamic_cast<ALSpeaker*>(sp); //FIXME: Potentional null pointer
alspeaker->stream = this; //-V522
auto alspeaker = dynamic_cast<ALSpeaker*>(sp);
assert(alspeaker != nullptr); // backends must not be mixed
alspeaker->stream = this;
alspeaker->duration = source->getTotalDuration();
}
}
@@ -145,12 +146,13 @@ void ALStream::update(double delta) {
}
auto p_speaker = audio::get_speaker(this->speaker);
if (p_speaker == nullptr) {
p_speaker = 0; //FIXME: Not used
this->speaker = 0;
return;
}
ALSpeaker* alspeaker = dynamic_cast<ALSpeaker*>(p_speaker); //FIXME: Potentional null pointer
ALSpeaker* alspeaker = dynamic_cast<ALSpeaker*>(p_speaker);
assert(alspeaker != nullptr);
if (alspeaker->stopped) { //-V522
p_speaker = 0; //FIXME: Not used
this->speaker = 0;
return;
}