Fixed some code scanning alerts

This commit is contained in:
emeric
2022-12-14 20:49:59 +01:00
parent 998def846d
commit 1def36b8f0
13 changed files with 27 additions and 23 deletions
@@ -467,7 +467,7 @@ CREATE TABLE "starred_track" (
return itScrobbler->second;
auto query {session.getDboSession().query<Scrobbler>("SELECT scrobbler FROM user WHERE id = ?").bind(userId)};
auto [itInserted, inserted] {userScrobblers.emplace(userId, query.resultValue())};
[[maybe_unused]] auto [itInserted, inserted] {userScrobblers.emplace(userId, query.resultValue())};
assert(inserted);
return itInserted->second;
}};
@@ -53,8 +53,8 @@ TEST_F(DatabaseFixture, MultiTracksSingleArtistSingleRelease)
ASSERT_EQ(releases.results.size(), 1);
EXPECT_EQ(releases.results.front(), release.getId());
const auto tracks {Track::find(session, Track::FindParameters {}.setRelease(release.getId()))};
EXPECT_EQ(tracks.results.size(), nbTracks);
const auto releaseTracks {Track::find(session, Track::FindParameters {}.setRelease(release.getId()))};
EXPECT_EQ(releaseTracks.results.size(), nbTracks);
}
}
+5 -3
View File
@@ -39,9 +39,11 @@ TEST_F(DatabaseFixture, Release)
EXPECT_EQ(Release::getCount(session), 1);
EXPECT_TRUE(Release::exists(session, release.getId()));
auto releases {Release::findOrphans(session, Range {})};
ASSERT_EQ(releases.results.size(), 1);
EXPECT_EQ(releases.results.front(), release.getId());
{
auto releases {Release::findOrphans(session, Range {})};
ASSERT_EQ(releases.results.size(), 1);
EXPECT_EQ(releases.results.front(), release.getId());
}
{
auto releases {Release::find(session, Release::FindParameters {})};
@@ -410,7 +410,7 @@ FeaturesEngine::load(const SOM::Network& network, const TrackPositions& trackPos
auto itArtists {_artistMatrix.find(artistLink->getType())};
if (itArtists == std::cend(_artistMatrix))
{
auto [it, inserted] = _artistMatrix.try_emplace(artistLink->getType(), ArtistMatrix {width, height});
[[maybe_unused]] auto [it, inserted] = _artistMatrix.try_emplace(artistLink->getType(), ArtistMatrix {width, height});
assert(inserted);
itArtists = it;
}
@@ -17,6 +17,8 @@
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "services/scrobbling/Exception.hpp"
namespace Scrobbling::ListenBrainz
@@ -23,7 +23,6 @@
#include <Wt/Json/Object.h>
#include <Wt/Json/Value.h>
#include <Wt/Json/Parser.h>
//#include <Wt/Json/Serializer.h>
#include "services/scrobbling/Exception.hpp"
#include "Exception.hpp"
@@ -17,6 +17,8 @@
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <string_view>
#include "FeedbackTypes.hpp"
@@ -234,7 +234,7 @@ namespace Scrobbling::ListenBrainz
auto itContext {_userContexts.find(userId)};
if (itContext == std::cend(_userContexts))
{
auto [itNewContext, inserted] {_userContexts.emplace(userId, userId)};
[[maybe_unused]] auto [itNewContext, inserted] {_userContexts.emplace(userId, userId)};
itContext = itNewContext;
}
@@ -246,7 +246,7 @@ namespace Scrobbling::ListenBrainz
{
return std::any_of(std::cbegin(_userContexts), std::cend(_userContexts), [](const auto& contextEntry)
{
const auto& [userId, context] {contextEntry};
[[maybe_unused]] const auto& [userId, context] {contextEntry};
return context.syncing;
});
}
@@ -354,7 +354,7 @@ namespace Scrobbling::ListenBrainz
auto itContext {_userContexts.find(userId)};
if (itContext == std::cend(_userContexts))
{
auto [itNewContext, inserted] {_userContexts.emplace(userId, userId)};
[[maybe_unused]] auto [itNewContext, inserted] {_userContexts.emplace(userId, userId)};
itContext = itNewContext;
}
@@ -366,7 +366,7 @@ namespace Scrobbling::ListenBrainz
{
return std::any_of(std::cbegin(_userContexts), std::cend(_userContexts), [](const auto& contextEntry)
{
const auto& [userId, context] {contextEntry};
[[maybe_unused]] const auto& [userId, context] {contextEntry};
return context.syncing;
});
}