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

@@ -338,7 +338,7 @@ void InternetCollectionView::contextMenuEvent(QContextMenuEvent *e) {
context_menu_index_ = qobject_cast<QSortFilterProxyModel*>(model())->mapToSource(context_menu_index_);
QModelIndexList selected_indexes = qobject_cast<QSortFilterProxyModel*>(model())->mapSelectionToSource(selectionModel()->selection()).indexes();
int songs_selected = selected_indexes.count();;
qint64 songs_selected = selected_indexes.count();
// In all modes
load_->setEnabled(songs_selected > 0);

View File

@@ -445,7 +445,7 @@ QStringList InternetSearchView::TokenizeQuery(const QString &query) {
(*it).remove(')');
(*it).remove('"');
const int colon = (*it).indexOf(":");
const qint64 colon = (*it).indexOf(":");
if (colon != -1) {
(*it).remove(0, colon + 1);
}

View File

@@ -95,7 +95,7 @@ bool LocalRedirectServer::GenerateCertificate() {
return false;
}
QSslKey ssl_key(QByteArray(buffer, buffer_size), QSsl::Rsa);
QSslKey ssl_key(QByteArray(buffer, static_cast<qint64>(buffer_size)), QSsl::Rsa);
if (ssl_key.isNull()) {
error_ = QString("Failed to generate random private key.");
gnutls_x509_privkey_deinit(key);
@@ -146,8 +146,8 @@ bool LocalRedirectServer::GenerateCertificate() {
return false;
}
quint64 time = QDateTime::currentDateTime().toSecsSinceEpoch();
gnutls_x509_crt_set_activation_time(crt, time);
if (int result = gnutls_x509_crt_set_expiration_time(crt, time + 31536000L) != GNUTLS_E_SUCCESS) {
gnutls_x509_crt_set_activation_time(crt, static_cast<time_t>(time));
if (int result = gnutls_x509_crt_set_expiration_time(crt, static_cast<time_t>(time + 31536000L)) != GNUTLS_E_SUCCESS) {
error_ = QString("Failed to set the activation time of the certificate: %1").arg(gnutls_strerror(result));
gnutls_x509_privkey_deinit(key);
gnutls_x509_crt_deinit(crt);
@@ -220,7 +220,7 @@ bool LocalRedirectServer::GenerateCertificate() {
gnutls_x509_privkey_deinit(key);
gnutls_privkey_deinit(pkey);
QSslCertificate ssl_certificate(QByteArray(buffer, buffer_size));
QSslCertificate ssl_certificate(QByteArray(buffer, static_cast<qint64>(buffer_size)));
if (ssl_certificate.isNull()) {
error_ = "Failed to generate random client certificate.";
gnutls_global_deinit();
@@ -346,7 +346,7 @@ void LocalRedirectServer::WriteTemplate() const {
page_file.close();
QRegularExpression tr_regexp("tr\\(\"([^\"]+)\"\\)");
int offset = 0;
qint64 offset = 0;
forever {
QRegularExpressionMatch re_match = tr_regexp.match(page_data, offset);
if (!re_match.hasMatch()) break;