mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-02-02 02:26:44 +01:00
Never use reference when iterating QJsonArray
This commit is contained in:
parent
c0663bc19f
commit
a155e503f4
@ -223,7 +223,7 @@ void DeezerCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id)
|
||||
|
||||
QMap<QUrl, CoverSearchResult> results;
|
||||
int i = 0;
|
||||
for (const QJsonValue &json_value : array_data) {
|
||||
for (const QJsonValue json_value : array_data) {
|
||||
|
||||
if (!json_value.isObject()) {
|
||||
Error("Invalid Json reply, data array value is not a object.", json_value);
|
||||
|
@ -273,7 +273,7 @@ void DiscogsCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id)
|
||||
array_results = value_results.toArray();
|
||||
}
|
||||
|
||||
for (const QJsonValue &value_result : array_results) {
|
||||
for (const QJsonValue value_result : array_results) {
|
||||
|
||||
if (!value_result.isObject()) {
|
||||
Error("Invalid Json reply, results value is not a object.", value_result);
|
||||
@ -380,7 +380,7 @@ void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const int se
|
||||
QJsonArray array_artists = value_artists.toArray();
|
||||
int i = 0;
|
||||
QString artist;
|
||||
for (const QJsonValue &value_artist : array_artists) {
|
||||
for (const QJsonValue value_artist : array_artists) {
|
||||
if (!value_artist.isObject()) {
|
||||
Error("Invalid Json reply, atists array value is not a object.", value_artist);
|
||||
continue;
|
||||
@ -421,7 +421,7 @@ void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const int se
|
||||
return;
|
||||
}
|
||||
|
||||
for (const QJsonValue &value_image : array_images) {
|
||||
for (const QJsonValue value_image : array_images) {
|
||||
|
||||
if (!value_image.isObject()) {
|
||||
Error("Invalid Json reply, images array value is not an object.", value_image);
|
||||
|
@ -230,7 +230,7 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, const int id, cons
|
||||
}
|
||||
QJsonArray array_type = value_type.toArray();
|
||||
|
||||
for (const QJsonValue &value : array_type) {
|
||||
for (const QJsonValue value : array_type) {
|
||||
|
||||
if (!value.isObject()) {
|
||||
Error("Invalid Json reply, value in albummatches/trackmatches array is not a object.", value);
|
||||
@ -255,7 +255,7 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, const int id, cons
|
||||
QJsonArray array_image = json_image.toArray();
|
||||
QUrl url;
|
||||
LastFmImageSize size(LastFmImageSize::Unknown);
|
||||
for (const QJsonValue &value_image : array_image) {
|
||||
for (const QJsonValue value_image : array_image) {
|
||||
if (!value_image.isObject()) {
|
||||
Error("Invalid Json reply, album image value is not an object.", value_image);
|
||||
continue;
|
||||
|
@ -167,7 +167,7 @@ void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
return;
|
||||
}
|
||||
|
||||
for (const QJsonValue &value_release : array_releases) {
|
||||
for (const QJsonValue value_release : array_releases) {
|
||||
|
||||
if (!value_release.isObject()) {
|
||||
Error("Invalid Json reply, releases array value is not an object.", value_release);
|
||||
@ -187,7 +187,7 @@ void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
QJsonArray array_artists = json_artists.toArray();
|
||||
int i = 0;
|
||||
QString artist;
|
||||
for (const QJsonValue &value_artist : array_artists) {
|
||||
for (const QJsonValue value_artist : array_artists) {
|
||||
if (!value_artist.isObject()) {
|
||||
Error("Invalid Json reply, artist is not a object.", value_artist);
|
||||
continue;
|
||||
|
@ -218,7 +218,7 @@ void QobuzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
}
|
||||
QJsonArray array_items = value_items.toArray();
|
||||
|
||||
for (const QJsonValue &value : array_items) {
|
||||
for (const QJsonValue value : array_items) {
|
||||
|
||||
if (!value.isObject()) {
|
||||
Error("Invalid Json reply, value in items is not a object.", value);
|
||||
|
@ -496,7 +496,7 @@ void SpotifyCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id,
|
||||
}
|
||||
|
||||
CoverSearchResults results;
|
||||
for (const QJsonValue &value_item : array_items) {
|
||||
for (const QJsonValue value_item : array_items) {
|
||||
|
||||
if (!value_item.isObject()) {
|
||||
continue;
|
||||
@ -516,14 +516,14 @@ void SpotifyCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id,
|
||||
QString album = obj_album["name"].toString();
|
||||
|
||||
QStringList artists;
|
||||
for (const QJsonValue &value_artist : array_artists) {
|
||||
for (const QJsonValue value_artist : array_artists) {
|
||||
if (!value_artist.isObject()) continue;
|
||||
QJsonObject obj_artist = value_artist.toObject();
|
||||
if (!obj_artist.contains("name")) continue;
|
||||
artists << obj_artist["name"].toString();
|
||||
}
|
||||
|
||||
for (const QJsonValue &value_image : array_images) {
|
||||
for (const QJsonValue value_image : array_images) {
|
||||
if (!value_image.isObject()) continue;
|
||||
QJsonObject obj_image = value_image.toObject();
|
||||
if (!obj_image.contains("url") || !obj_image.contains("width") || !obj_image.contains("height")) continue;
|
||||
|
@ -212,7 +212,7 @@ void TidalCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
|
||||
CoverSearchResults results;
|
||||
int i = 0;
|
||||
for (const QJsonValue &value_item : array_items) {
|
||||
for (const QJsonValue value_item : array_items) {
|
||||
|
||||
if (!value_item.isObject()) {
|
||||
Error("Invalid Json reply, items array item is not a object.", value_item);
|
||||
|
@ -105,7 +105,7 @@ void AuddLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i
|
||||
}
|
||||
|
||||
LyricsSearchResults results;
|
||||
for (const QJsonValue &value : json_result) {
|
||||
for (const QJsonValue value : json_result) {
|
||||
if (!value.isObject()) {
|
||||
qLog(Error) << "AudDLyrics: Invalid Json reply, result is not an object.";
|
||||
qLog(Debug) << value;
|
||||
|
@ -167,11 +167,11 @@ void AcoustidClient::RequestFinished(QNetworkReply *reply, const int request_id)
|
||||
// List of <id, nb of sources> pairs
|
||||
QList<IdSource> id_source_list;
|
||||
|
||||
for (const QJsonValue& v : json_results) {
|
||||
for (const QJsonValue v : json_results) {
|
||||
QJsonObject r = v.toObject();
|
||||
if (!r["recordings"].isUndefined()) {
|
||||
QJsonArray json_recordings = r["recordings"].toArray();
|
||||
for (const QJsonValue& recording : json_recordings) {
|
||||
for (const QJsonValue recording : json_recordings) {
|
||||
QJsonObject o = recording.toObject();
|
||||
if (!o["id"].isUndefined()) {
|
||||
id_source_list << IdSource(o["id"].toString(), o["sources"].toInt());
|
||||
|
@ -396,7 +396,7 @@ void QobuzRequest::ArtistsReplyReceived(QNetworkReply *reply, const int limit_re
|
||||
}
|
||||
|
||||
int artists_received = 0;
|
||||
for (const QJsonValue &value_item : array_items) {
|
||||
for (const QJsonValue value_item : array_items) {
|
||||
|
||||
++artists_received;
|
||||
|
||||
@ -609,7 +609,7 @@ void QobuzRequest::AlbumsReceived(QNetworkReply *reply, const QString &artist_id
|
||||
}
|
||||
|
||||
int albums_received = 0;
|
||||
for (const QJsonValue &value : array_items) {
|
||||
for (const QJsonValue value : array_items) {
|
||||
|
||||
++albums_received;
|
||||
|
||||
@ -907,7 +907,7 @@ void QobuzRequest::SongsReceived(QNetworkReply *reply, const QString &artist_id_
|
||||
//bool multidisc = false;
|
||||
SongList songs;
|
||||
int songs_received = 0;
|
||||
for (const QJsonValue &value_item : array_items) {
|
||||
for (const QJsonValue value_item : array_items) {
|
||||
|
||||
if (!value_item.isObject()) {
|
||||
Error("Invalid Json reply, track is not a object.", value_item);
|
||||
|
@ -356,7 +356,7 @@ void LastFMImport::GetRecentTracksRequestFinished(QNetworkReply *reply, const in
|
||||
|
||||
QJsonArray array_track = json_obj["track"].toArray();
|
||||
|
||||
for (const QJsonValue &value_track : array_track) {
|
||||
for (const QJsonValue value_track : array_track) {
|
||||
|
||||
++lastplayed_received_;
|
||||
|
||||
@ -516,7 +516,7 @@ void LastFMImport::GetTopTracksRequestFinished(QNetworkReply *reply, const int p
|
||||
else {
|
||||
|
||||
QJsonArray array_track = json_obj["track"].toArray();
|
||||
for (const QJsonValue &value_track : array_track) {
|
||||
for (const QJsonValue value_track : array_track) {
|
||||
|
||||
++playcount_received_;
|
||||
|
||||
|
@ -102,7 +102,7 @@ void ScrobblerCache::ReadCache() {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const QJsonValue &value : json_array) {
|
||||
for (const QJsonValue value : json_array) {
|
||||
if (!value.isObject()) {
|
||||
qLog(Error) << "Scrobbler cache JSON tracks array value is not an object.";
|
||||
qLog(Debug) << value;
|
||||
|
@ -711,7 +711,7 @@ void ScrobblingAPI20::ScrobbleRequestFinished(QNetworkReply *reply, QList<quint6
|
||||
return;
|
||||
}
|
||||
|
||||
for (const QJsonValue &value : array_scrobble) {
|
||||
for (const QJsonValue value : array_scrobble) {
|
||||
|
||||
if (!value.isObject()) {
|
||||
Error("Json scrobbles scrobble array value is not an object.", value);
|
||||
|
@ -251,7 +251,7 @@ void SubsonicRequest::AlbumsReplyReceived(QNetworkReply *reply, const int offset
|
||||
}
|
||||
|
||||
int albums_received = 0;
|
||||
for (const QJsonValue &value_album : array_albums) {
|
||||
for (const QJsonValue value_album : array_albums) {
|
||||
|
||||
++albums_received;
|
||||
|
||||
@ -440,7 +440,7 @@ void SubsonicRequest::AlbumSongsReplyReceived(QNetworkReply *reply, const QStrin
|
||||
bool multidisc = false;
|
||||
SongList songs;
|
||||
int songs_received = 0;
|
||||
for (const QJsonValue &value_song : array_songs) {
|
||||
for (const QJsonValue value_song : array_songs) {
|
||||
|
||||
if (!value_song.isObject()) {
|
||||
Error("Invalid Json reply, track is not a object.", value_song);
|
||||
|
@ -396,7 +396,7 @@ void TidalRequest::ArtistsReplyReceived(QNetworkReply *reply, const int limit_re
|
||||
}
|
||||
|
||||
int artists_received = 0;
|
||||
for (const QJsonValue &value_item : array_items) {
|
||||
for (const QJsonValue value_item : array_items) {
|
||||
|
||||
++artists_received;
|
||||
|
||||
@ -574,7 +574,7 @@ void TidalRequest::AlbumsReceived(QNetworkReply *reply, const QString &artist_id
|
||||
}
|
||||
|
||||
int albums_received = 0;
|
||||
for (const QJsonValue &value_item : array_items) {
|
||||
for (const QJsonValue value_item : array_items) {
|
||||
|
||||
++albums_received;
|
||||
|
||||
@ -845,7 +845,7 @@ void TidalRequest::SongsReceived(QNetworkReply *reply, const QString &artist_id,
|
||||
bool multidisc = false;
|
||||
SongList songs;
|
||||
int songs_received = 0;
|
||||
for (const QJsonValue &value_item : json_items) {
|
||||
for (const QJsonValue value_item : json_items) {
|
||||
|
||||
if (!value_item.isObject()) {
|
||||
Error("Invalid Json reply, track is not a object.", value_item);
|
||||
|
@ -269,7 +269,7 @@ void TidalStreamURLRequest::StreamURLReceived() {
|
||||
return;
|
||||
}
|
||||
QJsonArray json_array_urls = json_urls.toArray();
|
||||
for (const QJsonValue &value : json_array_urls) {
|
||||
for (const QJsonValue value : json_array_urls) {
|
||||
urls << QUrl(value.toString());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user