summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@pelagicore.com>2018-04-13 13:59:11 +0200
committerThomas Senyk <thomas.senyk@pelagicore.com>2018-04-17 16:32:05 +0000
commita1b79924bf7a2a86534c080b7ce14e37fac6a8f6 (patch)
tree7d5f4b762f6f9754b32f5742cbde80aaafbbafe3
parent530b17d3ee47a39ed5cb42d02958cdcaf5d8ee7c (diff)
downloadqtapplicationmanager-a1b79924bf7a2a86534c080b7ce14e37fac6a8f6.tar.gz
Clang code model fixes
Change-Id: I46bb240aa843c297e83278a4f1b29f95be093c83 Reviewed-by: Thomas Senyk <thomas.senyk@pelagicore.com>
-rw-r--r--src/common-lib/crashhandler.cpp8
-rw-r--r--src/common-lib/exception.h2
-rw-r--r--src/common-lib/logging.cpp6
-rw-r--r--src/common-lib/processtitle.cpp12
-rw-r--r--src/common-lib/qml-utilities.cpp4
-rw-r--r--src/common-lib/qtyaml.cpp3
-rw-r--r--src/common-lib/startuptimer.cpp22
-rw-r--r--src/common-lib/unixsignalhandler.cpp2
-rw-r--r--src/common-lib/utilities.cpp4
-rw-r--r--src/crypto-lib/libcryptofunction.h4
-rw-r--r--src/crypto-lib/signature_openssl.cpp24
-rw-r--r--src/dbus-lib/dbusdaemon.cpp2
-rw-r--r--src/installer-lib/applicationinstaller.cpp8
-rw-r--r--src/installer-lib/installationtask.cpp2
-rw-r--r--src/installer-lib/installationtask.h2
-rw-r--r--src/installer-lib/sudo.cpp19
-rw-r--r--src/installer-lib/sudo.h4
-rw-r--r--src/launcher-lib/ipcwrapperobject.cpp4
-rw-r--r--src/launcher-lib/ipcwrapperobject.h2
-rw-r--r--src/launcher-lib/qmlapplicationinterface.cpp2
-rw-r--r--src/launcher-lib/qmlapplicationinterfaceextension.cpp8
-rw-r--r--src/launcher-lib/qmlapplicationinterfaceextension.h2
-rw-r--r--src/launcher-lib/waylandqtamclientextension.cpp5
-rw-r--r--src/launcher-lib/waylandqtamclientextension_p.h4
-rw-r--r--src/launchers/qml/main.cpp4
-rw-r--r--src/main-lib/defaultconfiguration.h2
-rw-r--r--src/main-lib/main.cpp5
-rw-r--r--src/main-lib/main.h2
-rw-r--r--src/manager-lib/applicationipcinterface.cpp6
-rw-r--r--src/manager-lib/applicationipcinterface_p.h2
-rw-r--r--src/manager-lib/applicationipcmanager.cpp8
-rw-r--r--src/manager-lib/applicationmanager.cpp6
-rw-r--r--src/manager-lib/applicationmanager.h2
-rw-r--r--src/manager-lib/applicationmanager_p.h2
-rw-r--r--src/manager-lib/fakeapplicationmanagerwindow.h2
-rw-r--r--src/manager-lib/inprocesssurfaceitem.h2
-rw-r--r--src/manager-lib/nativeruntime.cpp2
-rw-r--r--src/manager-lib/nativeruntime.h2
-rw-r--r--src/manager-lib/notificationmanager.cpp16
-rw-r--r--src/manager-lib/notificationmanager.h18
-rw-r--r--src/manager-lib/plugincontainer.h2
-rw-r--r--src/manager-lib/processcontainer.h4
-rw-r--r--src/manager-lib/qmlinprocessruntime.h2
-rw-r--r--src/manager-lib/quicklauncher.h2
-rw-r--r--src/manager-lib/sysfsreader.cpp4
-rw-r--r--src/manager-lib/systemreader.cpp18
-rw-r--r--src/monitor-lib/frametimer.cpp3
-rw-r--r--src/monitor-lib/processmonitor.h2
-rw-r--r--src/monitor-lib/processmonitor_p.cpp18
-rw-r--r--src/monitor-lib/systemmonitor.cpp4
-rw-r--r--src/monitor-lib/systemmonitor.h2
-rw-r--r--src/notification-lib/notification.cpp2
-rw-r--r--src/notification-lib/notification.h2
-rw-r--r--src/package-lib/package.cpp2
-rw-r--r--src/package-lib/package_p.cpp2
-rw-r--r--src/package-lib/packagecreator.cpp12
-rw-r--r--src/package-lib/packageextractor.cpp5
-rw-r--r--src/shared-main-lib/sharedmain.cpp2
-rw-r--r--src/tools/controller/controller.cpp6
-rw-r--r--src/tools/dumpqmltypes/dumpqmltypes.cpp4
-rw-r--r--src/tools/packager/packager.cpp4
-rw-r--r--src/tools/packager/packagingjob.h1
-rw-r--r--src/window-lib/touchemulation_x11.cpp32
-rw-r--r--src/window-lib/touchemulation_x11_p.h6
-rw-r--r--src/window-lib/waylandqtamserverextension.cpp2
-rw-r--r--src/window-lib/windowmanager.h2
-rw-r--r--src/window-lib/windowmanager_p.h2
-rw-r--r--tests/sudo-cleanup.h3
68 files changed, 197 insertions, 189 deletions
diff --git a/src/common-lib/crashhandler.cpp b/src/common-lib/crashhandler.cpp
index 020f2a2f..3b0ffb97 100644
--- a/src/common-lib/crashhandler.cpp
+++ b/src/common-lib/crashhandler.cpp
@@ -83,7 +83,7 @@ static size_t demangleBufferSize;
// this will make it run before all other static constructor functions
static void initBacktrace() __attribute__((constructor(101)));
-static void crashHandler(const char *why, int stackFramesToIgnore) __attribute__((noreturn));
+static Q_NORETURN void crashHandler(const char *why, int stackFramesToIgnore);
void CrashHandler::setCrashActionConfiguration(const QVariantMap &config)
{
@@ -113,12 +113,12 @@ static void initBacktrace()
printBacktrace = true;
dumpCore = true;
- waitForGdbAttach = false;
+ waitForGdbAttach = 0;
getOutputInformation(&useAnsiColor, nullptr, nullptr);
demangleBufferSize = 512;
- demangleBuffer = (char *) malloc(demangleBufferSize);
+ demangleBuffer = static_cast<char *>(malloc(demangleBufferSize));
UnixSignalHandler::instance()->install(UnixSignalHandler::RawSignalHandler,
{ SIGFPE, SIGSEGV, SIGILL, SIGBUS, SIGPIPE, SIGABRT },
@@ -304,7 +304,7 @@ static void crashHandler(const char *why, int stackFramesToIgnore)
longjmp(jmpenv, 1);
});
if (!setjmp(jmpenv)) {
- alarm(waitForGdbAttach);
+ alarm(static_cast<unsigned int>(waitForGdbAttach));
sigset_t mask;
sigemptyset(&mask);
diff --git a/src/common-lib/exception.h b/src/common-lib/exception.h
index 4f84c970..6a9d0269 100644
--- a/src/common-lib/exception.h
+++ b/src/common-lib/exception.h
@@ -67,7 +67,7 @@ public:
Exception(const Exception &copy) Q_DECL_NOEXCEPT;
Exception(Exception &&move) Q_DECL_NOEXCEPT;
- ~Exception() Q_DECL_NOEXCEPT;
+ ~Exception() Q_DECL_NOEXCEPT override;
Error errorCode() const Q_DECL_NOEXCEPT;
QString errorString() const Q_DECL_NOEXCEPT;
diff --git a/src/common-lib/logging.cpp b/src/common-lib/logging.cpp
index 3be5db62..72ec877b 100644
--- a/src/common-lib/logging.cpp
+++ b/src/common-lib/logging.cpp
@@ -140,7 +140,7 @@ static void colorLogToStderr(QtMsgType msgType, const QMessageLogContext &contex
int linenumberLength = 0;
if (context.line > 0 && context.file && context.file[0]) {
- QByteArray ba = QByteArray::fromRawData(context.file, qstrlen(context.file));
+ QByteArray ba = QByteArray::fromRawData(context.file, int(qstrlen(context.file)));
int pos = -1;
#if defined(Q_OS_WIN)
pos = ba.lastIndexOf('\\');
@@ -184,11 +184,11 @@ static void colorLogToStderr(QtMsgType msgType, const QMessageLogContext &contex
static const char *msgTypeStr[] = { "DBG ", "WARN", "CRIT", "FATL", "INFO" };
static const ConsoleColor msgTypeColor[] = { Green, Yellow, Red, Magenta, Blue };
- int categoryLength = qstrlen(context.category);
+ int categoryLength = int(qstrlen(context.category));
QByteArray msg = message.toLocal8Bit(); // sadly this allocates, but there's no other way in Qt
// the visible character length
- int outLength = 10 + qstrlen(context.category) + msg.length(); // 10 = strlen("[XXXX | ] ")
+ int outLength = 10 + int(qstrlen(context.category)) + msg.length(); // 10 = strlen("[XXXX | ] ")
out.append('[');
color(out, BrightFlag | msgTypeColor[msgType]);
diff --git a/src/common-lib/processtitle.cpp b/src/common-lib/processtitle.cpp
index 6f465c79..2c463735 100644
--- a/src/common-lib/processtitle.cpp
+++ b/src/common-lib/processtitle.cpp
@@ -95,19 +95,19 @@ static void ProcessTitleInitialize(int argc, char *argv[], char *envp[])
// calculate the size of the available area
startOfArgv = argv[0];
- originalArgvSize = envp[0] - argv[0];
- originalArgv = (char *) malloc(originalArgvSize);
+ originalArgvSize = size_t(envp[0] - argv[0]);
+ originalArgv = static_cast<char *>(malloc(originalArgvSize));
memcpy(originalArgv, argv[0], originalArgvSize);
char *envpEnd;
- int envc = 0;
+ size_t envc = 0;
while (envp[envc])
++envc;
envpEnd = envp[envc - 1] + strlen(envp[envc - 1]) + 1;
- maxArgvSize = envpEnd - startOfArgv;
+ maxArgvSize = size_t(envpEnd - startOfArgv);
// temporary copy of the list of pointers on the stack
- QVarLengthArray<char *, 2048> oldenvp(envc);
+ QVarLengthArray<char *, 2048> oldenvp(static_cast<int>(envc));
memcpy(oldenvp.data(), envp, envc * sizeof(char *));
// this will only free the list of pointers, but not the contents!
@@ -176,7 +176,7 @@ void ProcessTitle::setTitle(const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- size_t result = qvsnprintf(title + len, sizeof(title) - len, fmt, ap);
+ size_t result = static_cast<size_t>(qvsnprintf(title + len, sizeof(title) - len, fmt, ap));
va_end(ap);
len += qMin(result, sizeof(title) - len); // clamp to buffer size in case of overflow
if ((len + 1) > maxArgvSize)
diff --git a/src/common-lib/qml-utilities.cpp b/src/common-lib/qml-utilities.cpp
index 1cd2ad25..de9ea1d0 100644
--- a/src/common-lib/qml-utilities.cpp
+++ b/src/common-lib/qml-utilities.cpp
@@ -71,7 +71,7 @@ void fixNullValuesForQml(QVariantMap &map)
void fixNullValuesForQml(QVariant &v)
{
- switch ((int) v.type()) {
+ switch (static_cast<int>(v.type())) {
case QVariant::List: {
QVariantList *list = v_cast<QVariantList>(&v.data_ptr());
fixNullValuesForQml(*list);
@@ -100,7 +100,7 @@ void retakeSingletonOwnershipFromQmlEngine(QQmlEngine *qmlEngine, QObject *singl
auto retake = [qmlEngine, singleton]() {
const auto types = QQmlMetaType::qmlSingletonTypes();
- for (const auto singletonType : types) {
+ for (const auto &singletonType : types) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 2)
if (singletonType.singletonInstanceInfo()->qobjectApi(qmlEngine) == singleton)
singletonType.singletonInstanceInfo()->qobjectApis.remove(qmlEngine);
diff --git a/src/common-lib/qtyaml.cpp b/src/common-lib/qtyaml.cpp
index db7dfe47..c467ee8f 100644
--- a/src/common-lib/qtyaml.cpp
+++ b/src/common-lib/qtyaml.cpp
@@ -264,7 +264,8 @@ QVector<QVariant> variantDocumentsFromYamlFiltered(const QByteArray &yaml, std::
yaml_parser_t p;
if (yaml_parser_initialize(&p)) {
- yaml_parser_set_input_string(&p, (const uchar *) yaml.constData(), yaml.size());
+ yaml_parser_set_input_string(&p, reinterpret_cast<const uchar *>(yaml.constData()),
+ static_cast<size_t>(yaml.size()));
yaml_document_t doc;
yaml_node_t *root;
diff --git a/src/common-lib/startuptimer.cpp b/src/common-lib/startuptimer.cpp
index e90cd807..e7f869f6 100644
--- a/src/common-lib/startuptimer.cpp
+++ b/src/common-lib/startuptimer.cpp
@@ -205,10 +205,10 @@ static SplitSeconds splitMicroSecs(quint64 micros)
ss.sec = 0;
if (micros > 1000 * 1000) {
- ss.sec = micros / (1000 * 1000);
+ ss.sec = int(micros / (1000 * 1000));
micros %= (1000 * 1000);
}
- ss.msec = micros / 1000;
+ ss.msec = int(micros / 1000);
ss.usec = micros % 1000;
return ss;
@@ -262,7 +262,7 @@ StartupTimer::StartupTimer()
auto readJiffiesFromProc = [](void *resultPtr) -> void * {
void *result = nullptr;
- QByteArray file = "/proc/self/task/" + QByteArray::number((int) syscall(SYS_gettid)) + "/stat";
+ QByteArray file = "/proc/self/task/" + QByteArray::number(static_cast<int>(syscall(SYS_gettid))) + "/stat";
int fd = QT_OPEN(file, O_RDONLY);
if (fd >= 0) {
char buffer[1024];
@@ -272,7 +272,7 @@ StartupTimer::StartupTimer()
for (int field = 0, pos = 0; pos < bytesRead; ) {
if (buffer[pos++] == ' ') {
if (++field == 21) {
- *reinterpret_cast<quint32 *>(resultPtr) = strtoul(buffer + pos, 0, 10);
+ *reinterpret_cast<quint32 *>(resultPtr) = quint32(strtoul(buffer + pos, nullptr, 10));
result = reinterpret_cast<void *>(1);
break;
}
@@ -295,9 +295,9 @@ StartupTimer::StartupTimer()
quint32 processJiffies = 0;
if (readJiffiesFromProc(&processJiffies)) {
- int clkTck = sysconf(_SC_CLK_TCK);
+ long int clkTck = sysconf(_SC_CLK_TCK);
if (clkTck > 0) {
- m_processCreation = (threadJiffies - processJiffies) * 1000*1000 / clkTck;
+ m_processCreation = quint64(threadJiffies - processJiffies) * 1000*1000 / quint64(clkTck);
m_initialized = true;
} else {
qWarning("StartupTimer: could not get _SC_CLK_TCK");
@@ -386,7 +386,7 @@ void StartupTimer::checkpoint(const char *name)
{
if (Q_LIKELY(m_initialized)) {
qint64 delta = m_timer.nsecsElapsed();
- m_checkpoints << qMakePair(delta / 1000 + m_processCreation, name);
+ m_checkpoints << qMakePair(quint64(delta / 1000) + m_processCreation, name);
}
}
@@ -402,7 +402,7 @@ void StartupTimer::checkFirstFrame()
{
if (Q_LIKELY(m_initialized)) {
QByteArray ba = "after first frame drawn";
- m_timeToFirstFrame = m_timer.nsecsElapsed()/1000 + m_processCreation;
+ m_timeToFirstFrame = quint64(m_timer.nsecsElapsed() / 1000) + m_processCreation;
m_checkpoints << qMakePair(m_timeToFirstFrame, ba);
emit timeToFirstFrameChanged(m_timeToFirstFrame);
}
@@ -411,7 +411,7 @@ void StartupTimer::checkFirstFrame()
void StartupTimer::reset()
{
if (m_initialized) {
- SplitSeconds delta = splitMicroSecs(m_timer.nsecsElapsed() / 1000 + m_processCreation);
+ SplitSeconds delta = splitMicroSecs(quint64(m_timer.nsecsElapsed() / 1000) + m_processCreation);
m_timer.restart();
m_checkpoints.clear();
m_processCreation = 0;
@@ -449,7 +449,7 @@ void StartupTimer::createReport(const QString &title)
static const int barCols = 60;
- int delta = m_checkpoints.isEmpty() ? 0 : m_checkpoints.last().first;
+ quint64 delta = m_checkpoints.isEmpty() ? 0 : m_checkpoints.last().first;
qreal usecPerCell = delta / barCols;
int maxTextLen = 0;
@@ -462,7 +462,7 @@ void StartupTimer::createReport(const QString &title)
for (int i = 0; i < m_checkpoints.size(); ++i) {
quint64 usec = m_checkpoints.at(i).first;
const QByteArray text = m_checkpoints.at(i).second;
- int cells = usec / usecPerCell;
+ int cells = int(usec / usecPerCell);
QByteArray bar(cells, ansiColorSupport ? ' ' : '#');
QByteArray spacing(maxTextLen - text.length(), ' ');
SplitSeconds ss = splitMicroSecs(usec);
diff --git a/src/common-lib/unixsignalhandler.cpp b/src/common-lib/unixsignalhandler.cpp
index c7515175..bba8ce22 100644
--- a/src/common-lib/unixsignalhandler.cpp
+++ b/src/common-lib/unixsignalhandler.cpp
@@ -60,7 +60,7 @@ static void *malloc_valgrind_ignore(size_t size)
// sigmask() is not available on Windows
UnixSignalHandler::am_sigmask_t UnixSignalHandler::am_sigmask(int sig)
{
- return (((am_sigmask_t) 1) << (((sig) - 1) % (8 * sizeof(am_sigmask_t))));
+ return ((am_sigmask_t(1)) << (((sig) - 1) % int(8 * sizeof(am_sigmask_t))));
}
UnixSignalHandler *UnixSignalHandler::s_instance = nullptr;
diff --git a/src/common-lib/utilities.cpp b/src/common-lib/utilities.cpp
index 15410eb0..c44b2e0a 100644
--- a/src/common-lib/utilities.cpp
+++ b/src/common-lib/utilities.cpp
@@ -111,7 +111,7 @@ void checkYamlFormat(const QVector<QVariant> &docs, int numberOfDocuments,
if (actualSize >= 1) {
const auto map = docs.constFirst().toMap();
actualFormatType = map.value(qSL("formatType")).toString().toUtf8();
- actualFormatVersion = map.value(qSL("formatVersion")).toInt(0);
+ actualFormatVersion = map.value(qSL("formatVersion")).toInt();
}
if (numberOfDocuments < 0) {
@@ -160,7 +160,7 @@ QMultiMap<QString, QString> mountedDirectories()
QString::fromLocal8Bit(mntPtr->mnt_fsname));
}
# else
- int pathMax = pathconf("/", _PC_PATH_MAX) * 2 + 1024; // quite big, but better be safe than sorry
+ int pathMax = static_cast<int>(pathconf("/", _PC_PATH_MAX)) * 2 + 1024; // quite big, but better be safe than sorry
QScopedArrayPointer<char> strBuf(new char[pathMax]);
struct mntent mntBuf;
diff --git a/src/crypto-lib/libcryptofunction.h b/src/crypto-lib/libcryptofunction.h
index d750fb11..0bfbdd5c 100644
--- a/src/crypto-lib/libcryptofunction.h
+++ b/src/crypto-lib/libcryptofunction.h
@@ -118,7 +118,7 @@ public:
{
if (Q_UNLIKELY(!m_functionPtr))
resolve();
- return (F) m_functionPtr;
+ return reinterpret_cast<F>(m_functionPtr);
}
template <typename ...Args>
@@ -126,7 +126,7 @@ public:
{
if (Q_UNLIKELY(!functionPointer()))
return m_defaultResult.result();
- return std::forward<F>((F) m_functionPtr)(std::forward<Args>(args)...);
+ return std::forward<F>(reinterpret_cast<F>(m_functionPtr))(std::forward<Args>(args)...);
}
};
diff --git a/src/crypto-lib/signature_openssl.cpp b/src/crypto-lib/signature_openssl.cpp
index e91702d9..9c081cfe 100644
--- a/src/crypto-lib/signature_openssl.cpp
+++ b/src/crypto-lib/signature_openssl.cpp
@@ -111,7 +111,7 @@ struct OpenSslDeleter {
static inline void cleanup(STACK_OF_X509 *stackOfX509)
{ (Cryptography::LibCryptoFunctionBase::isOpenSSL11() ? am_OPENSSL_sk_pop_free
: am_sk_pop_free)
- (stackOfX509, (void(*)(void *)) am_X509_free.functionPointer()); }
+ (stackOfX509, reinterpret_cast<void(*)(void *)>(am_X509_free.functionPointer())); }
};
template <typename T> using OpenSslPointer = QScopedPointer<T, OpenSslDeleter>;
@@ -123,7 +123,7 @@ public:
OpenSslException(const char *errorString)
: Exception(Error::Cryptography)
{
- m_errorString = Cryptography::errorString(am_ERR_get_error(), errorString);
+ m_errorString = Cryptography::errorString(static_cast<qint64>(am_ERR_get_error()), errorString);
}
};
@@ -135,7 +135,7 @@ QByteArray SignaturePrivate::create(const QByteArray &signingCertificatePkcs12,
if (hash.isEmpty())
throw OpenSslException("cannot sign an empty hash value");
- OpenSslPointer<BIO> bioPkcs12(am_BIO_new_mem_buf((void *) signingCertificatePkcs12.constData(), signingCertificatePkcs12.size()));
+ OpenSslPointer<BIO> bioPkcs12(am_BIO_new_mem_buf(signingCertificatePkcs12.constData(), signingCertificatePkcs12.size()));
if (!bioPkcs12)
throw OpenSslException("Could not create BIO buffer for PKCS#12 data");
@@ -161,7 +161,7 @@ QByteArray SignaturePrivate::create(const QByteArray &signingCertificatePkcs12,
if (!signCert)
throw OpenSslException("Could not find the certificate within the PKCS#12 data");
- OpenSslPointer<BIO> bioHash(am_BIO_new_mem_buf((void *) hash.constData(), hash.size()));
+ OpenSslPointer<BIO> bioHash(am_BIO_new_mem_buf(hash.constData(), hash.size()));
if (!bioHash)
throw OpenSslException("Could not create a BIO buffer for the hash");
@@ -182,7 +182,7 @@ QByteArray SignaturePrivate::create(const QByteArray &signingCertificatePkcs12,
char *data = nullptr;
// long size = BIO_get_mem_data(bioSignature.data(), &data);
- long size = am_BIO_ctrl(bioSignature.data(), 3 /*BIO_CTRL_INFO*/, 0, (char *) &data);
+ int size = static_cast<int>(am_BIO_ctrl(bioSignature.data(), 3 /*BIO_CTRL_INFO*/, 0, reinterpret_cast<char *>(&data)));
if (size <= 0 || !data)
throw OpenSslException("The BIO buffer for the PKCS#7 signature is invalid");
@@ -192,17 +192,17 @@ QByteArray SignaturePrivate::create(const QByteArray &signingCertificatePkcs12,
bool SignaturePrivate::verify(const QByteArray &signaturePkcs7,
const QList<QByteArray> &chainOfTrust) Q_DECL_NOEXCEPT_EXPR(false)
{
- OpenSslPointer<BIO> bioSignature(am_BIO_new_mem_buf((void *) signaturePkcs7.constData(), signaturePkcs7.size()));
+ OpenSslPointer<BIO> bioSignature(am_BIO_new_mem_buf(signaturePkcs7.constData(), signaturePkcs7.size()));
if (!bioSignature)
throw OpenSslException("Could not create BIO buffer for PKCS#7 data");
// PKCS7 *PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u);
//OpenSslPointer<PKCS7> signature((PKCS7 *) am_PEM_ASN1_read_bio((d2i_of_void *) am_d2i_PKCS7.functionPointer(), PEM_STRING_PKCS7, bioSignature.data(), nullptr, nullptr, nullptr));
- OpenSslPointer<PKCS7> signature((PKCS7 *) am_d2i_PKCS7_bio(bioSignature.data(), nullptr));
+ OpenSslPointer<PKCS7> signature(am_d2i_PKCS7_bio(bioSignature.data(), nullptr));
if (!signature)
throw OpenSslException("Could not read PKCS#7 data from BIO buffer");
- OpenSslPointer<BIO> bioHash(am_BIO_new_mem_buf((void *) hash.constData(), hash.size()));
+ OpenSslPointer<BIO> bioHash(am_BIO_new_mem_buf(hash.constData(), hash.size()));
if (!bioHash)
throw OpenSslException("Could not create BIO buffer for the hash");
@@ -211,16 +211,16 @@ bool SignaturePrivate::verify(const QByteArray &signaturePkcs7,
throw OpenSslException("Could not create a X509 certificate store");
for (const QByteArray &trustedCert : chainOfTrust) {
- OpenSslPointer<BIO> bioCert(am_BIO_new_mem_buf((void *) trustedCert.constData(), trustedCert.size()));
+ OpenSslPointer<BIO> bioCert(am_BIO_new_mem_buf(trustedCert.constData(), trustedCert.size()));
if (!bioCert)
throw OpenSslException("Could not create BIO buffer for a certificate");
// BIO_eof(b) == (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)
while (!am_BIO_ctrl(bioCert.data(), 2 /*BIO_CTRL_EOF*/, 0, nullptr)) {
//OpenSslPointer<X509> cert(PEM_read_bio_X509(bioCert.data(), 0, 0, 0));
- OpenSslPointer<X509> cert((X509 *) am_PEM_ASN1_read_bio((d2i_of_void *) (Cryptography::LibCryptoFunctionBase::isOpenSSL11() ? am_d2i_X509_AUX : am_d2i_X509).functionPointer(),
- "CERTIFICATE" /*PEM_STRING_X509*/, bioCert.data(),
- nullptr, nullptr, nullptr));
+ OpenSslPointer<X509> cert(static_cast<X509 *>(am_PEM_ASN1_read_bio(reinterpret_cast<d2i_of_void *>((Cryptography::LibCryptoFunctionBase::isOpenSSL11() ? am_d2i_X509_AUX : am_d2i_X509).functionPointer()),
+ "CERTIFICATE" /*PEM_STRING_X509*/, bioCert.data(),
+ nullptr, nullptr, nullptr)));
if (!cert)
throw OpenSslException("Could not load a certificate from the chain of trust");
if (!am_X509_STORE_add_cert(certChain.data(), cert.data()))
diff --git a/src/dbus-lib/dbusdaemon.cpp b/src/dbus-lib/dbusdaemon.cpp
index bcc92693..e1e94b6b 100644
--- a/src/dbus-lib/dbusdaemon.cpp
+++ b/src/dbus-lib/dbusdaemon.cpp
@@ -92,7 +92,7 @@ void DBusDaemonProcess::setupChildProcess()
void DBusDaemonProcess::start() Q_DECL_NOEXCEPT_EXPR(false)
{
- static const int timeout = 10000 * timeoutFactor();
+ static const int timeout = 10000 * int(timeoutFactor());
auto dbusDaemon = new DBusDaemonProcess(qApp);
dbusDaemon->QProcess::start(QIODevice::ReadOnly);
diff --git a/src/installer-lib/applicationinstaller.cpp b/src/installer-lib/applicationinstaller.cpp
index c007c2a0..26c44cc0 100644
--- a/src/installer-lib/applicationinstaller.cpp
+++ b/src/installer-lib/applicationinstaller.cpp
@@ -223,12 +223,12 @@ ApplicationInstaller *ApplicationInstaller::createInstance(const QVector<Install
if (Q_UNLIKELY(!manifestDir.exists())) {
if (error)
*error = qL1S("ApplicationInstaller::createInstance() could not access the manifest directory ") + manifestDir.absolutePath();
- return 0;
+ return nullptr;
}
if (Q_UNLIKELY(!imageMountDir.exists())) {
if (error)
*error = qL1S("ApplicationInstaller::createInstance() could not access the image-mount directory ") + imageMountDir.absolutePath();
- return 0;
+ return nullptr;
}
qmlRegisterSingletonType<ApplicationInstaller>("QtApplicationManager", 1, 0, "ApplicationInstaller",
@@ -639,7 +639,7 @@ qint64 ApplicationInstaller::installedApplicationSize(const QString &id) const
{
if (const Application *a = ApplicationManager::instance()->fromId(id)) {
if (const InstallationReport *report = a->installationReport())
- return report->diskSpaceUsed();
+ return static_cast<qint64>(report->diskSpaceUsed());
}
return -1;
}
@@ -991,8 +991,6 @@ public:
break;
case IsActivated:
return isMounted;
- default:
- return false;
}
ActivationHelper *a = new ActivationHelper(id, imageName, imageMountDir, mountPoint, mountedDevice);
diff --git a/src/installer-lib/installationtask.cpp b/src/installer-lib/installationtask.cpp
index 672fb4f0..cc877e38 100644
--- a/src/installer-lib/installationtask.cpp
+++ b/src/installer-lib/installationtask.cpp
@@ -427,7 +427,7 @@ void InstallationTask::startInstallation() Q_DECL_NOEXCEPT_EXPR(false)
throw Exception(Error::IO, "image file %1 already exists").arg(m_extractionImageFile);
if (!image.open(QFile::WriteOnly | QFile::Truncate))
throw Exception(image, "could not open image file for writing");
- if (!image.resize(neededSize)) {
+ if (!image.resize(static_cast<qint64>(neededSize))) {
image.remove();
throw Exception(image, "could not resize image file to %1 bytes").arg(neededSize);
}
diff --git a/src/installer-lib/installationtask.h b/src/installer-lib/installationtask.h
index e47b9dc0..d3eef8d1 100644
--- a/src/installer-lib/installationtask.h
+++ b/src/installer-lib/installationtask.h
@@ -63,7 +63,7 @@ class InstallationTask : public AsynchronousTask
public:
InstallationTask(const InstallationLocation &installationLocation, const QUrl &sourceUrl,
QObject *parent = nullptr);
- ~InstallationTask();
+ ~InstallationTask() override;
void acknowledge();
bool cancel() override;
diff --git a/src/installer-lib/sudo.cpp b/src/installer-lib/sudo.cpp
index 16be2e0d..6b449a4d 100644
--- a/src/installer-lib/sudo.cpp
+++ b/src/installer-lib/sudo.cpp
@@ -105,7 +105,8 @@ extern "C" int capget(cap_user_header_t header, const cap_user_data_t data);
# endif
// Convenient way to ignore EINTR on any system call
-# define EINTR_LOOP(cmd) __extension__ ({auto res = 0; do { res = cmd; } while (res == -1 && errno == EINTR); res; })
+# define EINTR_LOOP(cmd) __extension__ ({__typeof__(cmd) res = 0; do { res = cmd; } while (res == -1 && errno == EINTR); res; })
+
// Declared as weak symbol here, so we can check at runtime if we were compiled against libgcov
extern "C" void __gcov_init() __attribute__((weak));
@@ -157,7 +158,7 @@ void Sudo::forkServer(DropPrivileges dropPrivileges, QStringList *warnings)
#if defined(Q_OS_LINUX)
gid_t realGid = getgid();
- uid_t sudoUid = qEnvironmentVariableIntValue("SUDO_UID");
+ uid_t sudoUid = static_cast<uid_t>(qEnvironmentVariableIntValue("SUDO_UID"));
// run as normal user (e.g. 1000): uid == 1000 euid == 1000
// run with binary suid-root: uid == 1000 euid == 0
@@ -166,7 +167,7 @@ void Sudo::forkServer(DropPrivileges dropPrivileges, QStringList *warnings)
// treat sudo as special variant of a SUID executable
if (realUid == 0 && effectiveUid == 0 && sudoUid != 0) {
realUid = sudoUid;
- realGid = qEnvironmentVariableIntValue("SUDO_GID");
+ realGid = static_cast<gid_t>(qEnvironmentVariableIntValue("SUDO_GID"));
if (setresgid(realGid, 0, 0) || setresuid(realUid, 0, 0))
throw Exception(errno, "Could not set real user or group ID");
@@ -274,8 +275,8 @@ bool SudoInterface::sendMessage(int socket, const QByteArray &msg, MessageType t
ds << errorString << msg;
packet.prepend((type == Request) ? "RQST" : "RPLY");
- qint64 bytesWritten = EINTR_LOOP(write(socket, packet.constData(), packet.size()));
- return bytesWritten == packet.size();
+ auto bytesWritten = EINTR_LOOP(write(socket, packet.constData(), static_cast<size_t>(packet.size())));
+ return bytesWritten == packet.size();
}
@@ -283,7 +284,7 @@ QByteArray SudoInterface::receiveMessage(int socket, MessageType type, QString *
{
const int headerSize = 4;
char recvBuffer[8*1024];
- qint64 bytesReceived = EINTR_LOOP(recv(socket, recvBuffer, sizeof(recvBuffer), 0));
+ auto bytesReceived = EINTR_LOOP(recv(socket, recvBuffer, sizeof(recvBuffer), 0));
if ((bytesReceived < headerSize) || qstrncmp(recvBuffer, (type == Request ? "RQST" : "RPLY"), 4)) {
*errorString = qL1S("failed to receive command from the SudoClient process");
@@ -291,7 +292,7 @@ QByteArray SudoInterface::receiveMessage(int socket, MessageType type, QString *
return QByteArray();
}
- QByteArray packet(recvBuffer + headerSize, bytesReceived - headerSize);
+ QByteArray packet(recvBuffer + headerSize, int(bytesReceived) - headerSize);
QDataStream ds(&packet, QIODevice::ReadOnly);
QByteArray msg;
@@ -604,7 +605,7 @@ bool SudoServer::detachLoopback(const QString &loopDev)
break;
clearErrno = errno;
- usleep(timeout); // might still be busy after lazy umount
+ usleep(static_cast<useconds_t>(timeout)); // might still be busy after lazy umount
}
EINTR_LOOP(close(loopFd));
@@ -665,7 +666,7 @@ bool SudoServer::mount(const QString &device, const QString &mountPoint, bool re
bool SudoServer::unmount(const QString &mountPoint, bool force)
{
#if defined(Q_OS_LINUX)
- unsigned long options = force ? MNT_FORCE | MNT_DETACH : 0;
+ int options = force ? MNT_FORCE | MNT_DETACH : 0;
try {
if (!QDir(mountPoint).exists() && !force)
diff --git a/src/installer-lib/sudo.h b/src/installer-lib/sudo.h
index 44e7968c..729327f4 100644
--- a/src/installer-lib/sudo.h
+++ b/src/installer-lib/sudo.h
@@ -72,6 +72,8 @@ public:
class SudoInterface
{
public:
+ virtual ~SudoInterface() = default;
+
virtual QString attachLoopback(const QString &imagePath, bool readonly) = 0;
virtual bool detachLoopback(const QString &loopDev) = 0;
virtual bool mount(const QString &device, const QString &mountPoint, bool readonly, const QString &fstype) = 0;
@@ -148,7 +150,7 @@ public:
QString lastError() const { return m_errorString; }
- void run();
+ Q_NORETURN void run();
private:
SudoServer(int socketFd, int loopControlFd);
diff --git a/src/launcher-lib/ipcwrapperobject.cpp b/src/launcher-lib/ipcwrapperobject.cpp
index 8d750142..eb4b8f3f 100644
--- a/src/launcher-lib/ipcwrapperobject.cpp
+++ b/src/launcher-lib/ipcwrapperobject.cpp
@@ -291,7 +291,7 @@ int IpcWrapperObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
QMetaProperty mp = metaObject()->property(metaObject()->propertyOffset() + _id);
QVariant value = dbusmp.read(m_dbusInterface);
value = convertFromDBusVariant(value);
- QMetaType::construct(mp.type(), _a[0], value.data());
+ QMetaType::construct(int(mp.type()), _a[0], value.data());
break;
}
case QMetaObject::WriteProperty: {
@@ -306,7 +306,7 @@ int IpcWrapperObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
value = QVariant::fromValue(dbv);
}
// the boolean 'was-successful' return code is stored in _a[1]
- _a[1] = mp.write(m_dbusInterface, value) ? (void *) 1 : (void *) 0;
+ _a[1] = reinterpret_cast<void *>(mp.write(m_dbusInterface, value) ? 1 : 0);
break;
}
case QMetaObject::InvokeMetaMethod: {
diff --git a/src/launcher-lib/ipcwrapperobject.h b/src/launcher-lib/ipcwrapperobject.h
index 5906e715..b5093380 100644
--- a/src/launcher-lib/ipcwrapperobject.h
+++ b/src/launcher-lib/ipcwrapperobject.h
@@ -62,7 +62,7 @@ public:
IpcWrapperObject(const QString &service, const QString &path, const QString &interface,
const QDBusConnection &connection, QObject *parent = nullptr);
- ~IpcWrapperObject();
+ ~IpcWrapperObject() override;
bool isDBusValid() const;
QDBusError lastDBusError() const;
diff --git a/src/launcher-lib/qmlapplicationinterface.cpp b/src/launcher-lib/qmlapplicationinterface.cpp
index 3cf56701..428708c6 100644
--- a/src/launcher-lib/qmlapplicationinterface.cpp
+++ b/src/launcher-lib/qmlapplicationinterface.cpp
@@ -84,7 +84,7 @@ bool QmlApplicationInterface::initialize()
if (!iface->lastError().isValid())
return iface;
delete iface;
- QThread::msleep(timeout);
+ QThread::msleep(static_cast<unsigned long>(timeout));
}
return nullptr;
};
diff --git a/src/launcher-lib/qmlapplicationinterfaceextension.cpp b/src/launcher-lib/qmlapplicationinterfaceextension.cpp
index 0cafffcd..45fab934 100644
--- a/src/launcher-lib/qmlapplicationinterfaceextension.cpp
+++ b/src/launcher-lib/qmlapplicationinterfaceextension.cpp
@@ -128,10 +128,10 @@ void QmlApplicationInterfaceExtension::tryInit()
const QChar *c = name.unicode();
for (int i = 0; i < name.length(); ++i) {
ushort u = c[i].unicode();
- path += QLatin1Char(((u >= 'a' && u <= 'z')
- || (u >= 'A' && u <= 'Z')
- || (u >= '0' && u <= '9')
- || (u == '_')) ? u : '_');
+ path += QChar(((u >= 'a' && u <= 'z')
+ || (u >= 'A' && u <= 'Z')
+ || (u >= '0' && u <= '9')
+ || (u == '_')) ? u : '_');
}
return qSL("/ExtensionInterfaces/") + path;
};
diff --git a/src/launcher-lib/qmlapplicationinterfaceextension.h b/src/launcher-lib/qmlapplicationinterfaceextension.h
index 83d221d0..82233922 100644
--- a/src/launcher-lib/qmlapplicationinterfaceextension.h
+++ b/src/launcher-lib/qmlapplicationinterfaceextension.h
@@ -65,7 +65,7 @@ public:
static void initialize(const QDBusConnection &connection);
explicit QmlApplicationInterfaceExtension(QObject *parent = nullptr);
- ~QmlApplicationInterfaceExtension();
+ ~QmlApplicationInterfaceExtension() override;
QString name() const;
bool isReady() const;
diff --git a/src/launcher-lib/waylandqtamclientextension.cpp b/src/launcher-lib/waylandqtamclientextension.cpp
index e047d3e4..afb3311c 100644
--- a/src/launcher-lib/waylandqtamclientextension.cpp
+++ b/src/launcher-lib/waylandqtamclientextension.cpp
@@ -84,9 +84,6 @@ bool WaylandQtAMClientExtension::eventFilter(QObject *o, QEvent *e)
case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
m_windowProperties.remove(window);
break;
-
- default:
- break;
}
}
return false;
@@ -132,7 +129,7 @@ bool WaylandQtAMClientExtension::setWindowPropertyHelper(QWindow *window, const
void WaylandQtAMClientExtension::qtam_extension_window_property_changed(wl_surface *surface, const QString &name, wl_array *value)
{
- const QByteArray data = QByteArray::fromRawData(static_cast<char *>(value->data), value->size);
+ const QByteArray data = QByteArray::fromRawData(static_cast<char *>(value->data), int(value->size));
QDataStream ds(data);
QVariant variantValue;
ds >> variantValue;
diff --git a/src/launcher-lib/waylandqtamclientextension_p.h b/src/launcher-lib/waylandqtamclientextension_p.h
index 4cff387b..969930f1 100644
--- a/src/launcher-lib/waylandqtamclientextension_p.h
+++ b/src/launcher-lib/waylandqtamclientextension_p.h
@@ -71,7 +71,7 @@ class WaylandQtAMClientExtension : public QWaylandClientExtensionTemplate<Waylan
public:
WaylandQtAMClientExtension();
- ~WaylandQtAMClientExtension();
+ ~WaylandQtAMClientExtension() override;
QVariantMap windowProperties(QWindow *window) const;
void setWindowProperty(QWindow *window, const QString &name, const QVariant &value);
@@ -80,7 +80,7 @@ signals:
void windowPropertyChanged(QWindow *window, const QString &name, const QVariant &value);
protected:
- bool eventFilter(QObject *o, QEvent *e);
+ bool eventFilter(QObject *o, QEvent *e) override;
private:
bool setWindowPropertyHelper(QWindow *window, const QString &name, const QVariant &value);
diff --git a/src/launchers/qml/main.cpp b/src/launchers/qml/main.cpp
index e93b029b..430fae4b 100644
--- a/src/launchers/qml/main.cpp
+++ b/src/launchers/qml/main.cpp
@@ -189,10 +189,8 @@ int main(int argc, char *argv[])
QString directLoad = clp.value(qSL("directload"));
if (!directLoad.isEmpty()) {
QFileInfo fi(directLoad);
- if (!fi.exists() || fi.fileName() != qSL("info.yaml")) {
+ if (!fi.exists() || fi.fileName() != qSL("info.yaml"))
throw Exception("--directload needs a valid info.yaml file as parameter");
- return 2;
- }
directLoad = fi.absoluteFilePath();
} else {
a.loadConfiguration();
diff --git a/src/main-lib/defaultconfiguration.h b/src/main-lib/defaultconfiguration.h
index 9d17df9a..283c6146 100644
--- a/src/main-lib/defaultconfiguration.h
+++ b/src/main-lib/defaultconfiguration.h
@@ -55,7 +55,7 @@ public:
const QString &buildConfigFilePath,
const char *additionalDescription = nullptr,
bool onlyOnePositionalArgument = true);
- ~DefaultConfiguration();
+ ~DefaultConfiguration() override;
void parse(QStringList *deploymentWarnings = nullptr) override;
diff --git a/src/main-lib/main.cpp b/src/main-lib/main.cpp
index 169dcb41..dc45d0ee 100644
--- a/src/main-lib/main.cpp
+++ b/src/main-lib/main.cpp
@@ -62,6 +62,7 @@
#include <QQmlContext>
#include <QQmlComponent>
#include <QQmlApplicationEngine>
+#include <QTimer>
#include <QUrl>
#include <QLibrary>
#include <QFunctionPointer>
@@ -447,7 +448,7 @@ void Main::loadApplicationDatabase(const QString &databasePath, bool recreateDat
}
void Main::setupSingletons(const QList<QPair<QString, QString>> &containerSelectionConfiguration,
- qreal quickLaunchRuntimesPerContainer, int quickLaunchIdleLoad) Q_DECL_NOEXCEPT_EXPR(false)
+ int quickLaunchRuntimesPerContainer, qreal quickLaunchIdleLoad) Q_DECL_NOEXCEPT_EXPR(false)
{
QString error;
m_applicationManager = ApplicationManager::createInstance(m_applicationDatabase.take(),
@@ -865,7 +866,7 @@ void Main::registerDBusObject(QDBusAbstractAdaptor *adaptor, const QString &dbus
qCDebug(LogSystem).nospace().noquote() << " * " << serviceName << path << " [on bus: " << dbusName << "]";
- if (QByteArray::fromRawData(interfaceName, qstrlen(interfaceName)).startsWith("io.qt.")) {
+ if (QByteArray::fromRawData(interfaceName, int(qstrlen(interfaceName))).startsWith("io.qt.")) {
// Write the bus address of the interface to a file in /tmp. This is needed for the
// controller tool, which does not even have a session bus, when started via ssh.
diff --git a/src/main-lib/main.h b/src/main-lib/main.h
index fff09bee..046883d0 100644
--- a/src/main-lib/main.h
+++ b/src/main-lib/main.h
@@ -116,7 +116,7 @@ protected:
void loadApplicationDatabase(const QString &databasePath, bool recreateDatabase,
const QString &singleApp) Q_DECL_NOEXCEPT_EXPR(false);
void setupSingletons(const QList<QPair<QString, QString>> &containerSelectionConfiguration,
- qreal quickLaunchRuntimesPerContainer, int quickLaunchIdleLoad) Q_DECL_NOEXCEPT_EXPR(false);
+ int quickLaunchRuntimesPerContainer, qreal quickLaunchIdleLoad) Q_DECL_NOEXCEPT_EXPR(false);
void setupInstaller(const QString &appImageMountDir, const QStringList &caCertificatePaths,
const std::function<bool(uint *, uint *, uint *)> &userIdSeparation) Q_DECL_NOEXCEPT_EXPR(false);
diff --git a/src/manager-lib/applicationipcinterface.cpp b/src/manager-lib/applicationipcinterface.cpp
index 07cea99a..08f265a2 100644
--- a/src/manager-lib/applicationipcinterface.cpp
+++ b/src/manager-lib/applicationipcinterface.cpp
@@ -256,7 +256,7 @@ IpcProxyObject::IpcProxyObject(QObject *object, const QString &serviceName, cons
// handle our annotation mechanism to add types to method parameters
if (propName.startsWith(TYPE_ANNOTATION_PREFIX)) {
- QByteArray slotName = propName.mid(qstrlen(TYPE_ANNOTATION_PREFIX));
+ QByteArray slotName = propName.mid(int(qstrlen(TYPE_ANNOTATION_PREFIX)));
bool found = false;
for (int slotIndex : qAsConst(m_slots)) {
QMetaMethod mm = mo->method(slotIndex);
@@ -309,7 +309,7 @@ IpcProxyObject::IpcProxyObject(QObject *object, const QString &serviceName, cons
<< "but the annotated function" << slotName << "is missing";
}
} else {
- if (dbusType(mp.type())) {
+ if (dbusType(int(mp.type()))) {
m_properties << i;
} else {
qCWarning(LogQmlIpc) << "Ignoring property" << mp.name()
@@ -352,7 +352,7 @@ QByteArray IpcProxyObject::createIntrospectionXml()
readWrite += "write";
xml = xml + " <property name=\"" + mp.name()
- + "\" type=\"" + dbusType(mp.type())
+ + "\" type=\"" + dbusType(int(mp.type()))
+ "\" access=\"" + readWrite
+ "\" />\n";
}
diff --git a/src/manager-lib/applicationipcinterface_p.h b/src/manager-lib/applicationipcinterface_p.h
index f1274b88..39837d3e 100644
--- a/src/manager-lib/applicationipcinterface_p.h
+++ b/src/manager-lib/applicationipcinterface_p.h
@@ -66,7 +66,7 @@ class IpcProxyObject // clazy:exclude=missing-qobject-macro
public:
IpcProxyObject(QObject *object, const QString &serviceName, const QString &pathName,
const QString &interfaceName, const QVariantMap &filter);
- ~IpcProxyObject();
+ ~IpcProxyObject() override;
QObject *object() const;
QString serviceName() const;
diff --git a/src/manager-lib/applicationipcmanager.cpp b/src/manager-lib/applicationipcmanager.cpp
index a0e351f9..29401141 100644
--- a/src/manager-lib/applicationipcmanager.cpp
+++ b/src/manager-lib/applicationipcmanager.cpp
@@ -236,10 +236,10 @@ bool ApplicationIPCManager::registerInterface(QT_PREPEND_NAMESPACE_AM(Applicatio
const QChar *c = name.unicode();
for (int i = 0; i < name.length(); ++i) {
ushort u = c[i].unicode();
- path += QLatin1Char(((u >= 'a' && u <= 'z')
- || (u >= 'A' && u <= 'Z')
- || (u >= '0' && u <= '9')
- || (u == '_')) ? u : '_');
+ path += QChar(((u >= 'a' && u <= 'z')
+ || (u >= 'A' && u <= 'Z')
+ || (u >= '0' && u <= '9')
+ || (u == '_')) ? u : '_');
}
return qSL("/ExtensionInterfaces/") + path;
};
diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp
index 155a56c3..818e39f8 100644
--- a/src/manager-lib/applicationmanager.cpp
+++ b/src/manager-lib/applicationmanager.cpp
@@ -538,7 +538,7 @@ const Application *ApplicationManager::fromId(const QString &id) const
if (app->id() == id)
return app;
}
- return 0;
+ return nullptr;
}
const Application *ApplicationManager::fromProcessId(qint64 pid) const
@@ -559,13 +559,13 @@ const Application *ApplicationManager::fromProcessId(qint64 pid) const
const Application *ApplicationManager::fromSecurityToken(const QByteArray &securityToken) const
{
if (securityToken.size() != AbstractRuntime::SecurityTokenSize)
- return 0;
+ return nullptr;
for (const Application *app : d->apps) {
if (app->currentRuntime() && app->currentRuntime()->securityToken() == securityToken)
return app;
}
- return 0;
+ return nullptr;
}
QVector<const Application *> ApplicationManager::schemeHandlers(const QString &scheme) const
diff --git a/src/manager-lib/applicationmanager.h b/src/manager-lib/applicationmanager.h
index 597eaf14..b2053de9 100644
--- a/src/manager-lib/applicationmanager.h
+++ b/src/manager-lib/applicationmanager.h
@@ -77,7 +77,7 @@ class ApplicationManager : public QAbstractListModel
Q_PROPERTY(QJSValue containerSelectionFunction READ containerSelectionFunction WRITE setContainerSelectionFunction NOTIFY containerSelectionFunctionChanged)
public:
- ~ApplicationManager();
+ ~ApplicationManager() override;
static ApplicationManager *createInstance(ApplicationDatabase *adb, bool singleProcess, QString *error);
static ApplicationManager *instance();
static QObject *instanceForQml(QQmlEngine *qmlEngine, QJSEngine *);
diff --git a/src/manager-lib/applicationmanager_p.h b/src/manager-lib/applicationmanager_p.h
index 0e7e0b6b..072e7d26 100644
--- a/src/manager-lib/applicationmanager_p.h
+++ b/src/manager-lib/applicationmanager_p.h
@@ -44,7 +44,9 @@
#include <QStringList>
#include <QVariantMap>
#include <QJSValue>
+#include <QSet>
#include <QtAppManCommon/global.h>
+#include <QtAppManManager/applicationmanager.h>
QT_BEGIN_NAMESPACE_AM
diff --git a/src/manager-lib/fakeapplicationmanagerwindow.h b/src/manager-lib/fakeapplicationmanagerwindow.h
index f0fc9067..77d1f745 100644
--- a/src/manager-lib/fakeapplicationmanagerwindow.h
+++ b/src/manager-lib/fakeapplicationmanagerwindow.h
@@ -105,7 +105,7 @@ class FakeApplicationManagerWindow : public QQuickItem
public:
explicit FakeApplicationManagerWindow(QQuickItem *parent = nullptr);
- ~FakeApplicationManagerWindow();
+ ~FakeApplicationManagerWindow() override;
QColor color() const;
void setColor(const QColor &c);
diff --git a/src/manager-lib/inprocesssurfaceitem.h b/src/manager-lib/inprocesssurfaceitem.h
index 4e9ed30e..8c9a4a65 100644
--- a/src/manager-lib/inprocesssurfaceitem.h
+++ b/src/manager-lib/inprocesssurfaceitem.h
@@ -58,7 +58,7 @@ class InProcessSurfaceItem : public QQuickItem
Q_OBJECT
public:
InProcessSurfaceItem(FakeApplicationManagerWindow *famw);
- ~InProcessSurfaceItem();
+ ~InProcessSurfaceItem() override;
QSharedPointer<QObject> windowProperties();
diff --git a/src/manager-lib/nativeruntime.cpp b/src/manager-lib/nativeruntime.cpp
index 4c87d1d8..719105e7 100644
--- a/src/manager-lib/nativeruntime.cpp
+++ b/src/manager-lib/nativeruntime.cpp
@@ -82,7 +82,7 @@ static qint64 getDBusPeerPid(const QDBusConnection &conn)
static am_dbus_connection_get_socket_t am_dbus_connection_get_socket = nullptr;
if (!am_dbus_connection_get_socket)
- am_dbus_connection_get_socket = (am_dbus_connection_get_socket_t) dlsym(RTLD_DEFAULT, "dbus_connection_get_socket");
+ am_dbus_connection_get_socket = reinterpret_cast<am_dbus_connection_get_socket_t>(dlsym(RTLD_DEFAULT, "dbus_connection_get_socket"));
if (!am_dbus_connection_get_socket)
qFatal("ERROR: could not resolve 'dbus_connection_get_socket' from libdbus-1");
diff --git a/src/manager-lib/nativeruntime.h b/src/manager-lib/nativeruntime.h
index fe3cfb10..c35e5df6 100644
--- a/src/manager-lib/nativeruntime.h
+++ b/src/manager-lib/nativeruntime.h
@@ -83,7 +83,7 @@ class NativeRuntime : public AbstractRuntime
Q_OBJECT
public:
- ~NativeRuntime();
+ ~NativeRuntime() override;
bool isQuickLauncher() const override;
bool attachApplicationToQuickLauncher(const Application *app) override;
diff --git a/src/manager-lib/notificationmanager.cpp b/src/manager-lib/notificationmanager.cpp
index ae9d440f..21ea7d77 100644
--- a/src/manager-lib/notificationmanager.cpp
+++ b/src/manager-lib/notificationmanager.cpp
@@ -428,7 +428,7 @@ QVariantMap NotificationManager::get(int index) const
Returns an empty object if the specified \a id is invalid.
*/
-QVariantMap NotificationManager::notification(int id) const
+QVariantMap NotificationManager::notification(uint id) const
{
return get(indexOfNotification(id));
}
@@ -440,7 +440,7 @@ QVariantMap NotificationManager::notification(int id) const
Returns \c -1 if the specified \a id is invalid.
*/
-int NotificationManager::indexOfNotification(int id) const
+int NotificationManager::indexOfNotification(uint id) const
{
return d->findNotificationById(id);
}
@@ -451,7 +451,7 @@ int NotificationManager::indexOfNotification(int id) const
This function needs to be called by the System-UI when the user acknowledged the notification
identified by \a id (most likely by clicking on it).
*/
-void NotificationManager::acknowledgeNotification(int id)
+void NotificationManager::acknowledgeNotification(uint id)
{
triggerNotificationAction(id, qSL("default"));
}
@@ -468,7 +468,7 @@ void NotificationManager::acknowledgeNotification(int id)
arbitrary string. Be aware that this string is broadcast on the session D-Bus when running in
multi-process mode.
*/
-void NotificationManager::triggerNotificationAction(int id, const QString &actionId)
+void NotificationManager::triggerNotificationAction(uint id, const QString &actionId)
{
int i = d->findNotificationById(id);
@@ -499,7 +499,7 @@ void NotificationManager::triggerNotificationAction(int id, const QString &actio
The creator of the notification will be notified about this dismissal.
*/
-void NotificationManager::dismissNotification(int id)
+void NotificationManager::dismissNotification(uint id)
{
d->closeNotification(id, UserDismissed);
}
@@ -544,7 +544,7 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
qCDebug(LogNotifications) << "Notify" << app_name << replaces_id << app_icon << summary << body << actions << hints << timeout;
if (replaces_id == 0) { // new notification
- int id = ++idCounter;
+ uint id = ++idCounter;
// we need to delay the model update until the client has a valid id
QTimer::singleShot(0, this, [this, app_name, id, app_icon, summary, body, actions, hints, timeout]() {
notifyHelper(app_name, id, false, app_icon, summary, body, actions, hints, timeout);
@@ -587,7 +587,7 @@ uint NotificationManager::notifyHelper(const QString &app_name, uint id, bool re
return 0;
}
n->application = app;
- n->priority = hints.value(qSL("urgency"), QVariant(0)).toInt();
+ n->priority = hints.value(qSL("urgency"), QVariant(0)).toUInt();
n->summary = summary;
n->body = body;
n->category = hints.value(qSL("category")).toString();
@@ -658,7 +658,7 @@ void NotificationManagerPrivate::closeNotification(uint id, CloseReason reason)
auto n = notifications.takeAt(i);
q->endRemoveRows();
- emit q->NotificationClosed(id, int(reason));
+ emit q->NotificationClosed(id, uint(reason));
qCDebug(LogNotifications) << "Deleting notification with id:" << id;
delete n;
diff --git a/src/manager-lib/notificationmanager.h b/src/manager-lib/notificationmanager.h
index 3f539cdc..b88e8545 100644
--- a/src/manager-lib/notificationmanager.h
+++ b/src/manager-lib/notificationmanager.h
@@ -61,7 +61,7 @@ class NotificationManager : public QAbstractListModel
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
- ~NotificationManager();
+ ~NotificationManager() override;
static NotificationManager *createInstance();
static NotificationManager *instance();
static QObject *instanceForQml(QQmlEngine *qmlEngine, QJSEngine *);
@@ -73,12 +73,12 @@ public:
Q_INVOKABLE int count() const;
Q_INVOKABLE QVariantMap get(int index) const;
- Q_INVOKABLE QVariantMap notification(int id) const;
- Q_INVOKABLE int indexOfNotification(int id) const;
+ Q_INVOKABLE QVariantMap notification(uint id) const;
+ Q_INVOKABLE int indexOfNotification(uint id) const;
- Q_INVOKABLE void acknowledgeNotification(int id);
- Q_INVOKABLE void triggerNotificationAction(int id, const QString &actionId);
- Q_INVOKABLE void dismissNotification(int id);
+ Q_INVOKABLE void acknowledgeNotification(uint id);
+ Q_INVOKABLE void triggerNotificationAction(uint id, const QString &actionId);
+ Q_INVOKABLE void dismissNotification(uint id);
// vv libnotify DBus interface
Q_SCRIPTABLE QString GetServerInformation(QString &vendor, QString &version, QString &spec_version);
@@ -93,9 +93,9 @@ signals:
signals:
void countChanged();
- void notificationAdded(int id);
- void notificationAboutToBeRemoved(int id);
- void notificationChanged(int id, const QStringList &rolesChanged);
+ void notificationAdded(uint id);
+ void notificationAboutToBeRemoved(uint id);
+ void notificationChanged(uint id, const QStringList &rolesChanged);
private:
uint notifyHelper(const QString &app_name, uint id, bool replaces, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout);
diff --git a/src/manager-lib/plugincontainer.h b/src/manager-lib/plugincontainer.h
index 9401bac1..fe84ccf7 100644
--- a/src/manager-lib/plugincontainer.h
+++ b/src/manager-lib/plugincontainer.h
@@ -90,7 +90,7 @@ class PluginContainer : public AbstractContainer
Q_OBJECT
public:
- virtual ~PluginContainer();
+ virtual ~PluginContainer() override;
QString controlGroup() const override;
bool setControlGroup(const QString &groupName) override;
diff --git a/src/manager-lib/processcontainer.h b/src/manager-lib/processcontainer.h
index d9dfacc0..68301bd1 100644
--- a/src/manager-lib/processcontainer.h
+++ b/src/manager-lib/processcontainer.h
@@ -70,7 +70,7 @@ class HostProcess : public AbstractContainerProcess
public:
HostProcess();
- virtual ~HostProcess();
+ virtual ~HostProcess() override;
virtual qint64 processId() const override;
virtual QProcess::ProcessState state() const override;
@@ -109,7 +109,7 @@ public:
const QVector<int> &stdioRedirections,
const QMap<QString, QString> &debugWrapperEnvironment,
const QStringList &debugWrapperCommand);
- ~ProcessContainer();
+ ~ProcessContainer() override;
QString controlGroup() const override;
bool setControlGroup(const QString &groupName) override;
diff --git a/src/manager-lib/qmlinprocessruntime.h b/src/manager-lib/qmlinprocessruntime.h
index 146c105c..c07ddefc 100644
--- a/src/manager-lib/qmlinprocessruntime.h
+++ b/src/manager-lib/qmlinprocessruntime.h
@@ -68,7 +68,7 @@ class QmlInProcessRuntime : public AbstractRuntime
public:
explicit QmlInProcessRuntime(const Application *app, QmlInProcessRuntimeManager *manager);
- ~QmlInProcessRuntime();
+ ~QmlInProcessRuntime() override;
void openDocument(const QString &document, const QString &mimeType) override;
qint64 applicationProcessId() const override;
diff --git a/src/manager-lib/quicklauncher.h b/src/manager-lib/quicklauncher.h
index 35378aaa..a930b988 100644
--- a/src/manager-lib/quicklauncher.h
+++ b/src/manager-lib/quicklauncher.h
@@ -58,7 +58,7 @@ class QuickLauncher : public QObject
public:
static QuickLauncher *instance();
- ~QuickLauncher();
+ ~QuickLauncher() override;
void initialize(int runtimesPerContainer, qreal idleLoad = 0);
diff --git a/src/manager-lib/sysfsreader.cpp b/src/manager-lib/sysfsreader.cpp
index a7fdbd48..7cbf8a54 100644
--- a/src/manager-lib/sysfsreader.cpp
+++ b/src/manager-lib/sysfsreader.cpp
@@ -43,7 +43,7 @@
#include <qplatformdefs.h>
#include "sysfsreader.h"
-# define EINTR_LOOP(cmd) __extension__ ({int res = 0; do { res = cmd; } while (res == -1 && errno == EINTR); res; })
+# define EINTR_LOOP(cmd) __extension__ ({__typeof__(cmd) res = 0; do { res = cmd; } while (res == -1 && errno == EINTR); res; })
static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 0777)
{
@@ -93,7 +93,7 @@ QByteArray SysFsReader::readValue() const
int offset = 0;
int read = 0;
do {
- read = EINTR_LOOP(QT_READ(m_fd, m_buffer.data() + offset, m_buffer.size() - offset));
+ read = static_cast<int>(EINTR_LOOP(QT_READ(m_fd, m_buffer.data() + offset, m_buffer.size() - offset)));
if (read < 0)
return QByteArray();
else if (read < (m_buffer.size() - offset))
diff --git a/src/manager-lib/systemreader.cpp b/src/manager-lib/systemreader.cpp
index 76d63406..1ffcddaf 100644
--- a/src/manager-lib/systemreader.cpp
+++ b/src/manager-lib/systemreader.cpp
@@ -131,7 +131,7 @@ qreal CpuReader::readLoadValue()
qint64 val = strtoll(str.constData() + pos, &endPtr, 10); // check missing for over-/underflow
values << val;
total += val;
- pos = endPtr - str.constData() + 1;
+ pos = int(endPtr - str.constData() + 1);
}
if (values.size() >= 4) {
@@ -212,11 +212,11 @@ public:
#if defined(Q_OS_ANDROID)
qreal val = strtod(str.constData() + pos, &endPtr); // check missing for over-/underflow
#else
- static locale_t cLocale = newlocale(LC_ALL_MASK, "C", NULL);
+ static locale_t cLocale = newlocale(LC_ALL_MASK, "C", nullptr);
qreal val = strtod_l(str.constData() + pos, &endPtr, cLocale); // check missing for over-/underflow
#endif
values << val;
- pos = endPtr - str.constData() + 1;
+ pos = int(endPtr - str.constData() + 1);
}
switch (m_vendor) {
@@ -226,7 +226,7 @@ public:
break;
case Nvidia:
if (values.size() >= 2) {
- if (values.at(0) == 0) // hardcoded to first gfx card
+ if (qFuzzyIsNull(values.at(0))) // hardcoded to first gfx card
m_lastValue = values.at(1) / 100;
}
break;
@@ -358,7 +358,7 @@ quint64 MemoryReader::groupLimit()
quint64 MemoryReader::readUsedValue() const
{
- return ::strtoull(m_sysFs->readValue().constData(), 0, 10);
+ return ::strtoull(m_sysFs->readValue().constData(), nullptr, 10);
}
@@ -390,7 +390,7 @@ qreal IoReader::readLoadValue()
qint64 val = strtoll(str.constData() + pos, &endPtr, 10); // check missing for over-/underflow
values << val;
total += val;
- pos = endPtr - str.constData() + 1;
+ pos = int(endPtr - str.constData() + 1);
}
qint64 elapsed;
@@ -467,8 +467,8 @@ bool MemoryThreshold::setEnabled(bool enabled, const QString &groupPath, MemoryR
bool registerOk = true;
for (qreal percent : qAsConst(m_thresholds)) {
- qint64 mem = limit * percent / 100;
- registerOk = registerOk && (dprintf(m_controlFd, "%d %d %lld", m_eventFd, m_usageFd, mem) > 0);
+ quint64 mem = quint64(limit * percent) / 100;
+ registerOk = registerOk && (dprintf(m_controlFd, "%d %d %llu", m_eventFd, m_usageFd, mem) > 0);
}
if (registerOk) {
@@ -512,7 +512,7 @@ void MemoryThreshold::readEventFd()
int handled = 0;
quint64 counter;
- int r = QT_READ(m_eventFd, &counter, sizeof(counter));
+ ssize_t r = QT_READ(m_eventFd, &counter, sizeof(counter));
if (r == sizeof(counter)) {
handled++;
} else if (r < 0) {
diff --git a/src/monitor-lib/frametimer.cpp b/src/monitor-lib/frametimer.cpp
index 1a3c4acc..ef483736 100644
--- a/src/monitor-lib/frametimer.cpp
+++ b/src/monitor-lib/frametimer.cpp
@@ -62,7 +62,8 @@ void FrameTimer::newFrame()
void FrameTimer::reset()
{
- m_count = m_sum = m_max = m_jitter = 0;
+ m_count = m_sum = m_max = 0;
+ m_jitter = 0;
m_min = std::numeric_limits<int>::max();
}
diff --git a/src/monitor-lib/processmonitor.h b/src/monitor-lib/processmonitor.h
index 19812d33..3039e8fa 100644
--- a/src/monitor-lib/processmonitor.h
+++ b/src/monitor-lib/processmonitor.h
@@ -69,7 +69,7 @@ class ProcessMonitor : public QAbstractListModel
public:
ProcessMonitor(QObject *parent = nullptr);
- ~ProcessMonitor();
+ ~ProcessMonitor() override;
Q_INVOKABLE QVariantMap get(int index) const;
diff --git a/src/monitor-lib/processmonitor_p.cpp b/src/monitor-lib/processmonitor_p.cpp
index 0535da54..22844c92 100644
--- a/src/monitor-lib/processmonitor_p.cpp
+++ b/src/monitor-lib/processmonitor_p.cpp
@@ -173,21 +173,21 @@ qreal ReadingTask::readLoad()
++pos;
}
- char *endPtr = 0;
- quint64 utime = strtoll(str.constData() + pos, &endPtr, 10); // check missing for overflow
- pos = endPtr - str.constData() + 1;
- quint64 stime = strtoll(str.constData() + pos, nullptr, 10); // check missing for overflow
+ char *endPtr = nullptr;
+ quint64 utime = strtoull(str.constData() + pos, &endPtr, 10); // check missing for overflow
+ pos = int(endPtr - str.constData() + 1);
+ quint64 stime = strtoull(str.constData() + pos, nullptr, 10); // check missing for overflow
qreal load = elapsed != 0 ? (utime + stime - m_lastCpuUsage) * 1000.0 / sysconf(_SC_CLK_TCK) / elapsed : 0.0;
m_lastCpuUsage = utime + stime;
return load;
}
-static int parseValue(const char *pl)
+static uint parseValue(const char *pl)
{
while (*pl && (*pl < '0' || *pl > '9'))
pl++;
- return strtol(pl, 0, 10);
+ return static_cast<uint>(strtoul(pl, nullptr, 10));
}
bool ReadingTask::readMemory(const QByteArray &smapsFile, ReadingTask::Results::Memory &results)
@@ -279,9 +279,9 @@ bool ReadingTask::readMemory(const QByteArray &smapsFile, ReadingTask::Results::
}
int skipLen = blockLen;
- int vm = 0;
- int rss = 0;
- int pss = 0;
+ uint vm = 0;
+ uint rss = 0;
+ uint pss = 0;
const int sizeTag = 0x01;
const int rssTag = 0x02;
const int pssTag = 0x04;
diff --git a/src/monitor-lib/systemmonitor.cpp b/src/monitor-lib/systemmonitor.cpp
index 1fb438f4..9bb4605c 100644
--- a/src/monitor-lib/systemmonitor.cpp
+++ b/src/monitor-lib/systemmonitor.cpp
@@ -814,7 +814,7 @@ bool SystemMonitor::setMemoryWarningThresholds(qreal lowWarning, qreal criticalW
{
Q_D(SystemMonitor);
- if (lowWarning != d->memoryLowWarning || criticalWarning != d->memoryCriticalWarning) {
+ if (!qFuzzyCompare(lowWarning, d->memoryLowWarning) || !qFuzzyCompare(criticalWarning, d->memoryCriticalWarning)) {
d->memoryLowWarning = lowWarning;
d->memoryCriticalWarning = criticalWarning;
if (!d->memoryWatcher) {
@@ -864,7 +864,7 @@ void SystemMonitor::setIdleLoadThreshold(qreal loadThreshold)
{
Q_D(SystemMonitor);
- if (loadThreshold != d->idleThreshold) {
+ if (!qFuzzyCompare(loadThreshold, d->idleThreshold)) {
d->idleThreshold = loadThreshold;
emit idleLoadThresholdChanged(loadThreshold);
}
diff --git a/src/monitor-lib/systemmonitor.h b/src/monitor-lib/systemmonitor.h
index a043a469..50fdf88f 100644
--- a/src/monitor-lib/systemmonitor.h
+++ b/src/monitor-lib/systemmonitor.h
@@ -71,7 +71,7 @@ class SystemMonitor : public QAbstractListModel
Q_PROPERTY(bool idle READ isIdle NOTIFY idleChanged)
public:
- ~SystemMonitor();
+ ~SystemMonitor() override;
static SystemMonitor *createInstance();
static SystemMonitor *instance();
static QObject *instanceForQml(QQmlEngine *qmlEngine, QJSEngine *);
diff --git a/src/notification-lib/notification.cpp b/src/notification-lib/notification.cpp
index 225e726c..3ab7016b 100644
--- a/src/notification-lib/notification.cpp
+++ b/src/notification-lib/notification.cpp
@@ -476,7 +476,7 @@ void Notification::setShowProgress(bool showProgress)
void Notification::setProgress(qreal progress)
{
- if (m_progress != progress) {
+ if (!qFuzzyCompare(m_progress, progress)) {
m_progress = progress;
emit progressChanged(progress);
}
diff --git a/src/notification-lib/notification.h b/src/notification-lib/notification.h
index dc57d40f..e69a6113 100644
--- a/src/notification-lib/notification.h
+++ b/src/notification-lib/notification.h
@@ -123,7 +123,7 @@ public slots:
void setVisible(bool visible);
signals:
- void notificationIdChanged(int notificationId);
+ void notificationIdChanged(uint notificationId);
void summaryChanged(const QString &summary);
void bodyChanged(const QString &body);
void iconChanged(const QUrl &icon);
diff --git a/src/package-lib/package.cpp b/src/package-lib/package.cpp
index d0ae5553..90114f9b 100644
--- a/src/package-lib/package.cpp
+++ b/src/package-lib/package.cpp
@@ -64,7 +64,7 @@ bool Package::ensureCorrectLocale()
auto checkUtf = []() -> bool {
const wchar_t umlaut_w[2] = { 0x00e4, 0x0000 };
char umlaut_mb[2];
- int umlaut_mb_len = wcstombs(umlaut_mb, umlaut_w, sizeof(umlaut_mb));
+ size_t umlaut_mb_len = wcstombs(umlaut_mb, umlaut_w, sizeof(umlaut_mb));
return (umlaut_mb_len == 2 && umlaut_mb[0] == '\xc3' && umlaut_mb[1] == '\xa4');
};
diff --git a/src/package-lib/package_p.cpp b/src/package-lib/package_p.cpp
index 854dfad3..ac29c22e 100644
--- a/src/package-lib/package_p.cpp
+++ b/src/package-lib/package_p.cpp
@@ -76,7 +76,7 @@ void PackageUtilities::addHeaderDataToDigest(const QVariantMap &header, QCryptog
QDataStream ds(&ba, QIODevice::WriteOnly);
QVariant v = header.value(it.key());
- if (!v.convert(it.value().type()))
+ if (!v.convert(int(it.value().type())))
throw Exception(Error::Package, "metadata field %1 has invalid type for digest calculation (cannot convert %2 to %3)")
.arg(it.key()).arg(header.value(it.key()).type()).arg(it.value().type());
ds << v;
diff --git a/src/package-lib/packagecreator.cpp b/src/package-lib/packagecreator.cpp
index 29fe6c4a..7f85747b 100644
--- a/src/package-lib/packagecreator.cpp
+++ b/src/package-lib/packagecreator.cpp
@@ -210,7 +210,7 @@ bool PackageCreatorPrivate::create()
QIODevice *output = reinterpret_cast<QIODevice *>(user);
qint64 written = output->write(static_cast<const char *>(buffer), size);
output->waitForBytesWritten(-1);
- return (__LA_SSIZE_T) written;
+ return static_cast<__LA_SSIZE_T>(written);
};
if (archive_write_open(ar, m_output, dummyCallback, writeCallback, dummyCallback) != ARCHIVE_OK)
@@ -279,7 +279,7 @@ bool PackageCreatorPrivate::create()
throw Exception(Error::Archive, "[libarchive] could not create a new archive_entry object");
fixed_archive_entry_set_pathname(entry, file); // please note: this is a special function (see top of file)
- archive_entry_set_size(entry, fi.size());
+ archive_entry_set_size(entry, static_cast<la_int64_t>(fi.size()));
archive_entry_set_mode(entry, mode);
bool headerOk = (archive_write_header(ar, entry) == ARCHIVE_OK);
@@ -304,10 +304,10 @@ bool PackageCreatorPrivate::create()
throw Exception(f, "could not read from file");
fileSize += bytesRead;
- if (archive_write_data(ar, buffer, bytesRead) == -1)
+ if (archive_write_data(ar, buffer, static_cast<size_t>(bytesRead)) == -1)
throw ArchiveException(ar, "could not write to archive");
- digest.addData(buffer, bytesRead);
+ digest.addData(buffer, static_cast<int>(bytesRead));
}
if (fileSize != fi.size())
@@ -319,7 +319,7 @@ bool PackageCreatorPrivate::create()
// Just to be on the safe side, we also add the file's meta-data to the digest
PackageUtilities::addFileMetadataToDigest(file, fi, digest);
- qint64 progress = allFilesSize ? (100 * packagedSize / allFilesSize) : 0;
+ int progress = allFilesSize ? int(packagedSize * 100 / allFilesSize) : 0;
if (progress != lastProgress ) {
emit q->progress(qreal(progress) / 100);
lastProgress = progress;
@@ -398,7 +398,7 @@ bool PackageCreatorPrivate::addVirtualFile(struct archive *ar, const QString &fi
archive_entry_set_mtime(entry, time(nullptr), 0);
if (archive_write_header(ar, entry) == ARCHIVE_OK) {
- if (archive_write_data(ar, data.constData(), data.size()) == data.size())
+ if (archive_write_data(ar, data.constData(), static_cast<size_t>(data.size())) == data.size())
result = true;
}
archive_entry_free(entry);
diff --git a/src/package-lib/packageextractor.cpp b/src/package-lib/packageextractor.cpp
index e8e89583..39ba9386 100644
--- a/src/package-lib/packageextractor.cpp
+++ b/src/package-lib/packageextractor.cpp
@@ -238,8 +238,9 @@ void PackageExtractorPrivate::extract()
throw ArchiveException(ar, "could not set the HDRCHARSET option");
#endif
- auto dummyCallback = [](archive *, void *){ return ARCHIVE_OK; };
- auto readCallback = [](archive *ar, void *user, const void **buffer) { return (__LA_SSIZE_T) reinterpret_cast<PackageExtractorPrivate *>(user)->readTar(ar, buffer); };
+ auto dummyCallback = [](archive *, void *) { return ARCHIVE_OK; };
+ auto readCallback = [](archive *ar, void *user, const void **buffer)
+ { return static_cast<__LA_SSIZE_T>(static_cast<PackageExtractorPrivate *>(user)->readTar(ar, buffer)); };
if (archive_read_open(ar, this, dummyCallback, readCallback, dummyCallback) != ARCHIVE_OK)
throw ArchiveException(ar, "could not open archive");
diff --git a/src/shared-main-lib/sharedmain.cpp b/src/shared-main-lib/sharedmain.cpp
index c4ff9efc..bbbefbee 100644
--- a/src/shared-main-lib/sharedmain.cpp
+++ b/src/shared-main-lib/sharedmain.cpp
@@ -201,7 +201,7 @@ void SharedMain::setupOpenGL(const QVariantMap &openGLConfiguration)
if (profile == -1) {
qCWarning(LogGraphics) << "Requested an invalid OpenGL profile:" << profileName;
} else if (profile != QSurfaceFormat::NoProfile) {
- m_requestedOpenGLProfile = (QSurfaceFormat::OpenGLContextProfile) profile;
+ m_requestedOpenGLProfile = static_cast<QSurfaceFormat::OpenGLContextProfile>(profile);
format.setProfile(m_requestedOpenGLProfile);
qCDebug(LogGraphics) << "Requested OpenGL profile" << profileName;
}
diff --git a/src/tools/controller/controller.cpp b/src/tools/controller/controller.cpp
index b7d3c9ab..76f2c2a5 100644
--- a/src/tools/controller/controller.cpp
+++ b/src/tools/controller/controller.cpp
@@ -34,6 +34,7 @@
#include <QTemporaryFile>
#include <QFileInfo>
#include <QDBusConnection>
+#include <QDBusPendingReply>
#include <QDBusError>
#include <QTimer>
#include <QThread>
@@ -168,7 +169,7 @@ static Command command(QCommandLineParser &clp)
for (uint i = 0; i < sizeof(commandTable) / sizeof(commandTable[0]); ++i) {
if (cmd == commandTable[i].name) {
clp.clearPositionalArguments();
- clp.addPositionalArgument(cmd, commandTable[i].description, cmd);
+ clp.addPositionalArgument(qL1S(cmd), qL1S(commandTable[i].description), qL1S(cmd));
return commandTable[i].command;
}
}
@@ -232,7 +233,7 @@ int main(int argc, char *argv[])
for (uint i = 0; i < sizeof(commandTable) / sizeof(commandTable[0]); ++i) {
desc += qSL(" %1%2 %3\n")
.arg(qL1S(commandTable[i].name),
- QString(longestName - qstrlen(commandTable[i].name), qL1C(' ')),
+ QString(int(longestName - qstrlen(commandTable[i].name)), qL1C(' ')),
qL1S(commandTable[i].description));
}
@@ -258,7 +259,6 @@ int main(int argc, char *argv[])
// REMEMBER to update the completion file util/bash/appman-prompt, if you apply changes below!
try {
switch (command(clp)) {
- default:
case NoCommand:
if (clp.isSet(qSL("version")))
clp.showVersion();
diff --git a/src/tools/dumpqmltypes/dumpqmltypes.cpp b/src/tools/dumpqmltypes/dumpqmltypes.cpp
index f947a3a0..8170181a 100644
--- a/src/tools/dumpqmltypes/dumpqmltypes.cpp
+++ b/src/tools/dumpqmltypes/dumpqmltypes.cpp
@@ -157,7 +157,7 @@ static QByteArray qmlTypeForMetaObect(const QMetaObject *mo, int level, bool ind
}
str.append(indent1);
- str.append(QLatin1String("}\n"));
+ str.append("}\n");
return str;
}
@@ -196,7 +196,7 @@ int main(int argc, char **argv)
QFile outFile;
- if (clp.isSet("install")) {
+ if (clp.isSet(qSL("install"))) {
QDir qmlDir = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
if (!qmlDir.exists()) {
fprintf(stderr, "Qt's QML2 imports directory (%s) is missing.\n",
diff --git a/src/tools/packager/packager.cpp b/src/tools/packager/packager.cpp
index ec5fc58a..237f8b42 100644
--- a/src/tools/packager/packager.cpp
+++ b/src/tools/packager/packager.cpp
@@ -71,7 +71,7 @@ static Command command(QCommandLineParser &clp)
for (uint i = 0; i < sizeof(commandTable) / sizeof(commandTable[0]); ++i) {
if (cmd == commandTable[i].name) {
clp.clearPositionalArguments();
- clp.addPositionalArgument(cmd, commandTable[i].description, cmd);
+ clp.addPositionalArgument(qL1S(cmd), qL1S(commandTable[i].description), qL1S(cmd));
return commandTable[i].command;
}
}
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
for (uint i = 0; i < sizeof(commandTable) / sizeof(commandTable[0]); ++i) {
desc += qSL(" %1%2 %3\n")
.arg(qL1S(commandTable[i].name),
- QString(longestName - qstrlen(commandTable[i].name), qL1C(' ')),
+ QString(int(longestName - qstrlen(commandTable[i].name)), qL1C(' ')),
qL1S(commandTable[i].description));
}
diff --git a/src/tools/packager/packagingjob.h b/src/tools/packager/packagingjob.h
index b72b1980..1c83c191 100644
--- a/src/tools/packager/packagingjob.h
+++ b/src/tools/packager/packagingjob.h
@@ -31,6 +31,7 @@
#include <QtAppManCommon/global.h>
#include <QByteArray>
#include <QString>
+#include <QStringList>
#include <QVariantMap>
class PackagingJob
diff --git a/src/window-lib/touchemulation_x11.cpp b/src/window-lib/touchemulation_x11.cpp
index 7e655343..92a549c3 100644
--- a/src/window-lib/touchemulation_x11.cpp
+++ b/src/window-lib/touchemulation_x11.cpp
@@ -87,7 +87,7 @@ static void xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event)
// adds an extra 4 bytes and generic events cookie data is on the wire right after the standard 32 bytes.
// Move this data back to have the same layout in memory as it was on the wire
// and allow casting, overwriting the full_sequence field.
- memmove((char*) event + 32, (char*) event + 36, event->length * 4);
+ memmove(reinterpret_cast<char *>(event) + 32, reinterpret_cast<char*>(event) + 36, event->length * 4);
}
static qreal fixed1616ToReal(FP1616 val)
@@ -210,9 +210,9 @@ bool TouchEmulationX11::nativeEventFilter(const QByteArray &eventType, void *mes
};
}
-bool TouchEmulationX11::handleButtonPress(WId windowId, uint32_t detail, uint32_t /*modifiers*/, int x, int y)
+bool TouchEmulationX11::handleButtonPress(WId windowId, uint32_t detail, uint32_t /*modifiers*/, qreal x, qreal y)
{
- Qt::MouseButton button = xcbButtonToQtMouseButton(detail);
+ Qt::MouseButton button = xcbButtonToQtMouseButton(static_cast<xcb_button_t>(detail));
// Filter out the other mouse buttons
if (button != Qt::LeftButton)
@@ -220,19 +220,19 @@ bool TouchEmulationX11::handleButtonPress(WId windowId, uint32_t detail, uint32_
QWindow *targetWindow = findQWindowWithXWindowID(windowId);
- QPoint windowPos(x / targetWindow->devicePixelRatio(), y / targetWindow->devicePixelRatio());
+ QPointF windowPos(x / targetWindow->devicePixelRatio(), y / targetWindow->devicePixelRatio());
QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice, false /* autoCommit */);
- touchEvent.press(0 /* touchId */, windowPos);
+ touchEvent.press(0 /* touchId */, windowPos.toPoint(), targetWindow);
touchEvent.commit(false /* processEvents */);
m_leftButtonIsPressed = true;
return true;
}
-bool TouchEmulationX11::handleButtonRelease(WId windowId, uint32_t detail, uint32_t, int x, int y)
+bool TouchEmulationX11::handleButtonRelease(WId windowId, uint32_t detail, uint32_t, qreal x, qreal y)
{
- Qt::MouseButton button = xcbButtonToQtMouseButton(detail);
+ Qt::MouseButton button = xcbButtonToQtMouseButton(static_cast<xcb_button_t>(detail));
// Don't eat the event if it wasn't a left mouse press
if (button != Qt::LeftButton)
@@ -240,27 +240,27 @@ bool TouchEmulationX11::handleButtonRelease(WId windowId, uint32_t detail, uint3
QWindow *targetWindow = findQWindowWithXWindowID(windowId);
- QPoint windowPos(x / targetWindow->devicePixelRatio(), y / targetWindow->devicePixelRatio());
+ QPointF windowPos(x / targetWindow->devicePixelRatio(), y / targetWindow->devicePixelRatio());
QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice, false /* autoCommit */);
- touchEvent.release(0 /* touchId */, windowPos);
+ touchEvent.release(0 /* touchId */, windowPos.toPoint(), targetWindow);
touchEvent.commit(false /* processEvents */);
m_leftButtonIsPressed = false;
return true;
}
-bool TouchEmulationX11::handleMotionNotify(WId windowId, uint32_t /*modifiers*/, int x, int y)
+bool TouchEmulationX11::handleMotionNotify(WId windowId, uint32_t /*modifiers*/, qreal x, qreal y)
{
if (!m_leftButtonIsPressed)
return true;
QWindow *targetWindow = findQWindowWithXWindowID(windowId);
- QPoint windowPos(x / targetWindow->devicePixelRatio(), y / targetWindow->devicePixelRatio());
+ QPointF windowPos(x / targetWindow->devicePixelRatio(), y / targetWindow->devicePixelRatio());
QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice, false /* autoCommit */);
- touchEvent.move(0 /* touchId */, windowPos);
+ touchEvent.move(0 /* touchId */, windowPos.toPoint(), targetWindow);
touchEvent.commit(false /* processEvents */);
return true;
@@ -288,16 +288,16 @@ QWindow *TouchEmulationX11::findQWindowWithXWindowID(WId windowId)
// backup event data before a xi2PrepareXIGenericDeviceEvent() call
void TouchEmulationX11::backupEventData(void *event)
{
- memcpy((char*)&(m_xiEventBackupData[0]), (char*) event + 32, 4);
+ memcpy(reinterpret_cast<char *>(m_xiEventBackupData), reinterpret_cast<char *>(event) + 32, 4);
}
// restore event data after a xi2PrepareXIGenericDeviceEvent() call
void TouchEmulationX11::restoreEventData(void *ev)
{
- auto *event = (xcb_ge_event_t *)ev;
+ auto *event = static_cast<xcb_ge_event_t *>(ev);
- memmove((char*) event + 36, (char*) event + 32, event->length * 4);
- memcpy((char*) event + 32, (char*)&(m_xiEventBackupData[0]), 4);
+ memmove(reinterpret_cast<char *>(event) + 36, reinterpret_cast<char *>(event) + 32, event->length * 4);
+ memcpy(reinterpret_cast<char *>(event) + 32, reinterpret_cast<char *>(m_xiEventBackupData), 4);
}
QT_END_NAMESPACE_AM
diff --git a/src/window-lib/touchemulation_x11_p.h b/src/window-lib/touchemulation_x11_p.h
index 4f751fa5..5f0d99f0 100644
--- a/src/window-lib/touchemulation_x11_p.h
+++ b/src/window-lib/touchemulation_x11_p.h
@@ -63,9 +63,9 @@ public:
private:
void queryForXInput2();
- bool handleButtonPress(WId windowId, uint32_t detail, uint32_t modifiers, int x, int y);
- bool handleButtonRelease(WId windowId, uint32_t detail, uint32_t, int x, int y);
- bool handleMotionNotify(WId windowId, uint32_t modifiers, int x, int y);
+ bool handleButtonPress(WId windowId, uint32_t detail, uint32_t modifiers, qreal x, qreal y);
+ bool handleButtonRelease(WId windowId, uint32_t detail, uint32_t, qreal x, qreal y);
+ bool handleMotionNotify(WId windowId, uint32_t modifiers, qreal x, qreal y);
QWindow *findQWindowWithXWindowID(WId windowId);
void backupEventData(void *event);
diff --git a/src/window-lib/waylandqtamserverextension.cpp b/src/window-lib/waylandqtamserverextension.cpp
index c87bdcd7..497ee793 100644
--- a/src/window-lib/waylandqtamserverextension.cpp
+++ b/src/window-lib/waylandqtamserverextension.cpp
@@ -92,7 +92,7 @@ void WaylandQtAMServerExtension::qtam_extension_set_window_property(QtWaylandSer
{
Q_UNUSED(resource);
QWaylandSurface *surface = QWaylandSurface::fromResource(surface_resource);
- const QByteArray byteValue((const char *) value->data, value->size);
+ const QByteArray byteValue(static_cast<const char *>(value->data), static_cast<int>(value->size));
QDataStream ds(byteValue);
QVariant variantValue;
ds >> variantValue;
diff --git a/src/window-lib/windowmanager.h b/src/window-lib/windowmanager.h
index 5a00aa43..f96e719c 100644
--- a/src/window-lib/windowmanager.h
+++ b/src/window-lib/windowmanager.h
@@ -75,7 +75,7 @@ class WindowManager : public QAbstractListModel
Q_PROPERTY(bool slowAnimations READ slowAnimations WRITE setSlowAnimations NOTIFY slowAnimationsChanged)
public:
- ~WindowManager();
+ ~WindowManager() override;
static WindowManager *createInstance(QQmlEngine *qmlEngine, const QString &waylandSocketName = QString());
static WindowManager *instance();
static QObject *instanceForQml(QQmlEngine *qmlEngine, QJSEngine *);
diff --git a/src/window-lib/windowmanager_p.h b/src/window-lib/windowmanager_p.h
index 377032cb..52702948 100644
--- a/src/window-lib/windowmanager_p.h
+++ b/src/window-lib/windowmanager_p.h
@@ -45,6 +45,8 @@
#include <QMap>
#include <QHash>
+#include <QtAppManWindow/windowmanager.h>
+
QT_FORWARD_DECLARE_CLASS(QQmlEngine)
QT_BEGIN_NAMESPACE_AM
diff --git a/tests/sudo-cleanup.h b/tests/sudo-cleanup.h
index 0fdc523a..a850f2ea 100644
--- a/tests/sudo-cleanup.h
+++ b/tests/sudo-cleanup.h
@@ -29,6 +29,9 @@
#pragma once
#include <QTest>
+#include <QProcess>
+#include <QtAppManInstaller/sudo.h>
+#include <QtAppManCommon/utilities.h>
QT_USE_NAMESPACE_AM