Fix narrowing conversions
This commit is contained in:
@@ -197,7 +197,7 @@ void SCollection::SyncPlaycountAndRatingToFiles() {
|
||||
app_->task_manager()->SetTaskBlocksCollectionScans(task_id);
|
||||
|
||||
const SongList songs = backend_->GetAllSongs();
|
||||
const int nb_songs = songs.size();
|
||||
const qint64 nb_songs = songs.size();
|
||||
int i = 0;
|
||||
for (const Song &song : songs) {
|
||||
TagReaderClient::Instance()->UpdateSongPlaycountBlocking(song);
|
||||
|
||||
@@ -177,7 +177,7 @@ void CollectionBackend::ChangeDirPath(const int id, const QString &old_path, con
|
||||
const QByteArray old_url = QUrl::fromLocalFile(old_path).toEncoded();
|
||||
const QByteArray new_url = QUrl::fromLocalFile(new_path).toEncoded();
|
||||
|
||||
const int path_len = old_url.length();
|
||||
const qint64 path_len = old_url.length();
|
||||
|
||||
// Do the subdirs table
|
||||
{
|
||||
@@ -709,7 +709,8 @@ void CollectionBackend::UpdateSongsBySongID(const SongMap &new_songs) {
|
||||
}
|
||||
|
||||
// Add or update songs.
|
||||
for (const Song &new_song : new_songs) {
|
||||
QList new_songs_list = new_songs.values();
|
||||
for (const Song &new_song : new_songs_list) {
|
||||
if (old_songs.contains(new_song.song_id())) {
|
||||
|
||||
Song old_song = old_songs[new_song.song_id()];
|
||||
@@ -779,7 +780,8 @@ void CollectionBackend::UpdateSongsBySongID(const SongMap &new_songs) {
|
||||
}
|
||||
|
||||
// Delete songs
|
||||
for (const Song &old_song : old_songs) {
|
||||
QList old_songs_list = old_songs.values();
|
||||
for (const Song &old_song : old_songs_list) {
|
||||
if (!new_songs.contains(old_song.song_id())) {
|
||||
{
|
||||
SqlQuery q(db);
|
||||
@@ -1109,7 +1111,7 @@ SongList CollectionBackend::GetSongsByForeignId(const QStringList &ids, const QS
|
||||
QVector<Song> ret(ids.count());
|
||||
while (q.next()) {
|
||||
const QString foreign_id = q.value(static_cast<int>(Song::kColumns.count()) + 1).toString();
|
||||
const int index = ids.indexOf(foreign_id);
|
||||
const qint64 index = ids.indexOf(foreign_id);
|
||||
if (index == -1) continue;
|
||||
|
||||
ret[index].InitFromQuery(q, true);
|
||||
|
||||
@@ -295,7 +295,7 @@ CollectionItem *CollectionModel::CreateCompilationArtistNode(const bool signal,
|
||||
|
||||
Q_ASSERT(parent->compilation_artist_node_ == nullptr);
|
||||
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||
|
||||
parent->compilation_artist_node_ = new CollectionItem(CollectionItem::Type_Container, parent);
|
||||
parent->compilation_artist_node_->compilation_artist_node_ = nullptr;
|
||||
@@ -1179,7 +1179,7 @@ CollectionItem *CollectionModel::InitItem(const GroupBy type, const bool signal,
|
||||
|
||||
CollectionItem::Type item_type = type == GroupBy_None ? CollectionItem::Type_Song : CollectionItem::Type_Container;
|
||||
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||
|
||||
// Initialize the item depending on what type it's meant to be
|
||||
CollectionItem *item = new CollectionItem(item_type, parent);
|
||||
@@ -1600,7 +1600,7 @@ void CollectionModel::FinishItem(const GroupBy type, const bool signal, const bo
|
||||
|
||||
if (!divider_key.isEmpty() && !divider_nodes_.contains(divider_key)) {
|
||||
if (signal) {
|
||||
beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
||||
beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||
}
|
||||
|
||||
CollectionItem *divider = new CollectionItem(CollectionItem::Type_Divider, root_);
|
||||
@@ -1679,7 +1679,7 @@ QString CollectionModel::SortTextForArtist(QString artist) {
|
||||
|
||||
for (const auto &i : Song::kArticles) {
|
||||
if (artist.startsWith(i)) {
|
||||
int ilen = i.length();
|
||||
qint64 ilen = i.length();
|
||||
artist = artist.right(artist.length() - ilen) + ", " + i.left(ilen - 1);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -520,10 +520,10 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
||||
}
|
||||
|
||||
// CUE sheet's path from collection (if any).
|
||||
qint64 matching_song_cue_mtime = GetMtimeForCue(matching_song.cue_path());
|
||||
qint64 matching_song_cue_mtime = static_cast<qint64>(GetMtimeForCue(matching_song.cue_path()));
|
||||
|
||||
// CUE sheet's path from this file (if any).
|
||||
qint64 new_cue_mtime = GetMtimeForCue(new_cue);
|
||||
qint64 new_cue_mtime = static_cast<qint64>(GetMtimeForCue(new_cue));
|
||||
|
||||
bool cue_added = new_cue_mtime != 0 && !matching_song.has_cue();
|
||||
bool cue_deleted = matching_song_cue_mtime == 0 && matching_song.has_cue();
|
||||
@@ -619,7 +619,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
||||
}
|
||||
|
||||
// CUE sheet's path from this file (if any).
|
||||
const qint64 new_cue_mtime = GetMtimeForCue(new_cue);
|
||||
const qint64 new_cue_mtime = static_cast<qint64>(GetMtimeForCue(new_cue));
|
||||
|
||||
const bool cue_deleted = new_cue_mtime == 0 && matching_songs_has_cue;
|
||||
const bool cue_added = new_cue_mtime != 0 && !matching_songs_has_cue;
|
||||
|
||||
Reference in New Issue
Block a user