Add missing const
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
@@ -57,7 +58,7 @@ QNetworkReply *QobuzBaseRequest::CreateRequest(const QString &ressource_name, co
|
||||
std::sort(params.begin(), params.end());
|
||||
|
||||
QUrlQuery url_query;
|
||||
for (const Param ¶m : params) {
|
||||
for (const Param ¶m : std::as_const(params)) {
|
||||
url_query.addQueryItem(QString::fromLatin1(QUrl::toPercentEncoding(param.first)), QString::fromLatin1(QUrl::toPercentEncoding(param.second)));
|
||||
}
|
||||
|
||||
|
||||
@@ -132,9 +132,9 @@ void QobuzFavoriteRequest::AddFavorites(const FavoriteType type, const SongList
|
||||
|
||||
void QobuzFavoriteRequest::AddFavoritesRequest(const FavoriteType type, const QStringList &ids_list, const SongList &songs) {
|
||||
|
||||
ParamList params = ParamList() << Param(QStringLiteral("app_id"), app_id())
|
||||
<< Param(QStringLiteral("user_auth_token"), user_auth_token())
|
||||
<< Param(FavoriteMethod(type), ids_list.join(QLatin1Char(',')));
|
||||
const ParamList params = ParamList() << Param(QStringLiteral("app_id"), app_id())
|
||||
<< Param(QStringLiteral("user_auth_token"), user_auth_token())
|
||||
<< Param(FavoriteMethod(type), ids_list.join(QLatin1Char(',')));
|
||||
|
||||
QUrlQuery url_query;
|
||||
for (const Param ¶m : params) {
|
||||
@@ -227,9 +227,9 @@ void QobuzFavoriteRequest::RemoveFavorites(const FavoriteType type, const SongLi
|
||||
|
||||
void QobuzFavoriteRequest::RemoveFavoritesRequest(const FavoriteType type, const QStringList &ids_list, const SongList &songs) {
|
||||
|
||||
ParamList params = ParamList() << Param(QStringLiteral("app_id"), app_id())
|
||||
<< Param(QStringLiteral("user_auth_token"), user_auth_token())
|
||||
<< Param(FavoriteMethod(type), ids_list.join(QLatin1Char(',')));
|
||||
const ParamList params = ParamList() << Param(QStringLiteral("app_id"), app_id())
|
||||
<< Param(QStringLiteral("user_auth_token"), user_auth_token())
|
||||
<< Param(FavoriteMethod(type), ids_list.join(QLatin1Char(',')));
|
||||
|
||||
QUrlQuery url_query;
|
||||
for (const Param ¶m : params) {
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QByteArray>
|
||||
@@ -471,7 +473,7 @@ void QobuzRequest::ArtistsReplyReceived(QNetworkReply *reply, const int limit_re
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonArray array_items = value_items.toArray();
|
||||
const QJsonArray array_items = value_items.toArray();
|
||||
if (array_items.isEmpty()) { // Empty array means no results
|
||||
if (offset_requested == 0) no_results_ = true;
|
||||
ArtistsFinishCheck();
|
||||
@@ -479,7 +481,7 @@ void QobuzRequest::ArtistsReplyReceived(QNetworkReply *reply, const int limit_re
|
||||
}
|
||||
|
||||
int artists_received = 0;
|
||||
for (const QJsonValueRef value_item : array_items) {
|
||||
for (const QJsonValue &value_item : array_items) {
|
||||
|
||||
++artists_received;
|
||||
|
||||
@@ -542,7 +544,7 @@ void QobuzRequest::ArtistsFinishCheck(const int limit, const int offset, const i
|
||||
if (artists_requests_queue_.isEmpty() && artists_requests_active_ <= 0) { // Artist query is finished, get all albums for all artists.
|
||||
|
||||
// Get artist albums
|
||||
QList<ArtistAlbumsRequest> requests = artist_albums_requests_pending_.values();
|
||||
const QList<ArtistAlbumsRequest> requests = artist_albums_requests_pending_.values();
|
||||
for (const ArtistAlbumsRequest &request : requests) {
|
||||
AddArtistAlbumsRequest(request.artist);
|
||||
}
|
||||
@@ -687,7 +689,7 @@ void QobuzRequest::AlbumsReceived(QNetworkReply *reply, const Artist &artist_req
|
||||
AlbumsFinishCheck(artist_requested);
|
||||
return;
|
||||
}
|
||||
QJsonArray array_items = value_items.toArray();
|
||||
const QJsonArray array_items = value_items.toArray();
|
||||
if (array_items.isEmpty()) {
|
||||
if ((query_type_ == Type::FavouriteAlbums || query_type_ == Type::SearchAlbums) && offset_requested == 0) {
|
||||
no_results_ = true;
|
||||
@@ -697,7 +699,7 @@ void QobuzRequest::AlbumsReceived(QNetworkReply *reply, const Artist &artist_req
|
||||
}
|
||||
|
||||
int albums_received = 0;
|
||||
for (const QJsonValueRef value_item : array_items) {
|
||||
for (const QJsonValue &value_item : array_items) {
|
||||
|
||||
++albums_received;
|
||||
|
||||
@@ -982,7 +984,7 @@ void QobuzRequest::SongsReceived(QNetworkReply *reply, const Artist &artist_requ
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonArray array_items = value_items.toArray();
|
||||
const QJsonArray array_items = value_items.toArray();
|
||||
if (array_items.isEmpty()) {
|
||||
if ((query_type_ == Type::FavouriteSongs || query_type_ == Type::SearchSongs) && offset_requested == 0) {
|
||||
no_results_ = true;
|
||||
@@ -995,7 +997,7 @@ void QobuzRequest::SongsReceived(QNetworkReply *reply, const Artist &artist_requ
|
||||
bool multidisc = false;
|
||||
SongList songs;
|
||||
int songs_received = 0;
|
||||
for (const QJsonValueRef value_item : array_items) {
|
||||
for (const QJsonValue &value_item : array_items) {
|
||||
|
||||
if (!value_item.isObject()) {
|
||||
Error(QStringLiteral("Invalid Json reply, track is not a object."));
|
||||
@@ -1012,7 +1014,7 @@ void QobuzRequest::SongsReceived(QNetworkReply *reply, const Artist &artist_requ
|
||||
songs << song;
|
||||
}
|
||||
|
||||
for (Song song : songs) {
|
||||
for (Song song : std::as_const(songs)) {
|
||||
if (compilation) song.set_compilation_detected(true);
|
||||
if (!multidisc) song.set_disc(0);
|
||||
songs_.insert(song.song_id(), song);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
@@ -763,7 +764,7 @@ void QobuzService::LoginError(const QString &error, const QVariant &debug) {
|
||||
if (!error.isEmpty()) login_errors_ << error;
|
||||
|
||||
QString error_html;
|
||||
for (const QString &e : login_errors_) {
|
||||
for (const QString &e : std::as_const(login_errors_)) {
|
||||
qLog(Error) << "Qobuz:" << e;
|
||||
error_html += e + QStringLiteral("<br />");
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include <QObject>
|
||||
#include <QMimeDatabase>
|
||||
@@ -122,7 +123,7 @@ void QobuzStreamURLRequest::GetStreamURL() {
|
||||
|
||||
QString data_to_sign;
|
||||
data_to_sign += QLatin1String("trackgetFileUrl");
|
||||
for (const Param ¶m : params_to_sign) {
|
||||
for (const Param ¶m : std::as_const(params_to_sign)) {
|
||||
data_to_sign += param.first + param.second;
|
||||
}
|
||||
data_to_sign += QString::number(timestamp);
|
||||
@@ -192,7 +193,7 @@ void QobuzStreamURLRequest::StreamURLReceived() {
|
||||
|
||||
Song::FileType filetype(Song::FileType::Unknown);
|
||||
QMimeDatabase mimedb;
|
||||
QStringList suffixes = mimedb.mimeTypeForName(mimetype).suffixes();
|
||||
const QStringList suffixes = mimedb.mimeTypeForName(mimetype).suffixes();
|
||||
for (const QString &suffix : suffixes) {
|
||||
filetype = Song::FiletypeByExtension(suffix);
|
||||
if (filetype != Song::FileType::Unknown) break;
|
||||
|
||||
Reference in New Issue
Block a user