Fix narrowing conversions

This commit is contained in:
Jonas Kvinge
2021-10-30 02:21:29 +02:00
parent a704412dee
commit 79ac53b2d9
111 changed files with 376 additions and 373 deletions

View File

@@ -175,7 +175,7 @@ void CddaSongLoader::LoadSongs() {
int i = 0;
for (GList *node = entries; node != nullptr; node = node->next) {
GstTocEntry *entry = static_cast<GstTocEntry*>(node->data);
quint64 duration = 0;
qint64 duration = 0;
gint64 start = 0, stop = 0;
if (gst_toc_entry_get_start_stop_times(entry, &start, &stop)) duration = stop - start;
songs[i++].set_length_nanosec(duration);

View File

@@ -61,7 +61,7 @@ class ConnectedDevice : public QObject, public virtual MusicStorage, public std:
QString unique_id() const { return unique_id_; }
CollectionModel *model() const { return model_; }
QUrl url() const { return url_; }
int song_count() const { return song_count_; }
qint64 song_count() const { return song_count_; }
void FinishCopy(bool success) override;
void FinishDelete(bool success) override;
@@ -94,7 +94,7 @@ class ConnectedDevice : public QObject, public virtual MusicStorage, public std:
CollectionBackend *backend_;
CollectionModel *model_;
int song_count_;
qint64 song_count_;
private slots:
void BackendTotalSongCountUpdated(int count);

View File

@@ -265,7 +265,7 @@ void DeviceManager::AddDeviceFromDB(DeviceInfo *info) {
}
else {
qLog(Info) << "Device added from database: " << info->friendly_name_;
beginInsertRows(ItemToIndex(root_), devices_.count(), devices_.count());
beginInsertRows(ItemToIndex(root_), static_cast<int>(devices_.count()), static_cast<int>(devices_.count()));
devices_ << info;
endInsertRows();
}
@@ -485,7 +485,7 @@ void DeviceManager::PhysicalDeviceAdded(const QString &id) {
info->friendly_name_ = lister->MakeFriendlyName(id);
info->size_ = lister->DeviceCapacity(id);
info->LoadIcon(lister->DeviceIcons(id), info->friendly_name_);
beginInsertRows(ItemToIndex(root_), devices_.count(), devices_.count());
beginInsertRows(ItemToIndex(root_), static_cast<int>(devices_.count()), static_cast<int>(devices_.count()));
devices_ << info;
endInsertRows();
}

View File

@@ -155,7 +155,7 @@ bool MtpDevice::StartCopy(QList<Song::FileType> *supported_types) {
static int ProgressCallback(uint64_t const sent, uint64_t const total, void const *const data) {
const MusicStorage::CopyJob *job = reinterpret_cast<const MusicStorage::CopyJob*>(data);
job->progress_(static_cast<float>(sent) / total);
job->progress_(static_cast<float>(sent) / static_cast<float>(total));
return 0;

View File

@@ -388,7 +388,7 @@ Udisks2Lister::PartitionData Udisks2Lister::ReadPartitionData(const QDBusObjectP
for (const QByteArray &p : filesystem.mountPoints()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) // Workaround a bytearray to string conversion issue with Qt 6
QString mountpoint = QByteArray(p.data(), strlen(p.data()));
QString mountpoint = QByteArray(p.data(), static_cast<qint64>(strlen(p.data())));
#else
QString mountpoint = p;
#endif