Never use reference when iterating QJsonArray
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user