Commit 3f0d28dc authored by Fabian Kosmale's avatar Fabian Kosmale

clazy: autofix: fix-fromCharPtrAllocations, fix-qlatin1string-allocations

parent af771237
...@@ -86,7 +86,7 @@ QVariant SQLiteResource::getDataAt(int rowNumber, const QString& columnName) ...@@ -86,7 +86,7 @@ QVariant SQLiteResource::getDataAt(int rowNumber, const QString& columnName)
{ {
QMutexLocker locker(&d->mutex); QMutexLocker locker(&d->mutex);
if (d->table.isEmpty() || rowNumber >= d->table.size() || d->table[rowNumber].count(columnName) == 0) { if (d->table.isEmpty() || rowNumber >= d->table.size() || d->table[rowNumber].count(columnName) == 0) {
std::string error = QString("Access to non-existent data. Trying to access %1.").arg(columnName).toStdString(); std::string error = QStringLiteral("Access to non-existent data. Trying to access %1.").arg(columnName).toStdString();
throw SQLiteException(error.c_str()); throw SQLiteException(error.c_str());
} }
......
...@@ -79,15 +79,15 @@ void PolKitSQLiteConnection::connectToDB(QString const& name, bool readonly) ...@@ -79,15 +79,15 @@ void PolKitSQLiteConnection::connectToDB(QString const& name, bool readonly)
SQLiteResource PolKitSQLiteConnection::query(const QString &q) SQLiteResource PolKitSQLiteConnection::query(const QString &q)
{ {
if ((d->access.testFlag(Akabei::Helpers::ReadWritePermission)) || ((d->access.testFlag(Akabei::Helpers::ReadPermission)) && q.startsWith("SELECT"))) { if ((d->access.testFlag(Akabei::Helpers::ReadWritePermission)) || ((d->access.testFlag(Akabei::Helpers::ReadPermission)) && q.startsWith(QLatin1String("SELECT")))) {
d->lastQueryDBus = false; d->lastQueryDBus = false;
return d->connection->query(q); return d->connection->query(q);
} }
if (Akabei::Helpers::checkAuthorizationSync("org.chakraproject.akabeicorehelper.sqlite.query")) { if (Akabei::Helpers::checkAuthorizationSync(QStringLiteral("org.chakraproject.akabeicorehelper.sqlite.query"))) {
QDBusInterface iface("org.chakraproject.akabeicorehelper", "/sqlite", "org.chakraproject.akabeicorehelper.sqlite", QDBusConnection::systemBus()); QDBusInterface iface(QStringLiteral("org.chakraproject.akabeicorehelper"), QStringLiteral("/sqlite"), QStringLiteral("org.chakraproject.akabeicorehelper.sqlite"), QDBusConnection::systemBus());
SETUP_DBUS_DATABASE SETUP_DBUS_DATABASE
QDBusMessage mes = iface.call("query", q); QDBusMessage mes = iface.call(QStringLiteral("query"), q);
d->lastQueryDBus = true; d->lastQueryDBus = true;
if (!mes.arguments().isEmpty()) { if (!mes.arguments().isEmpty()) {
const QDBusArgument arg = mes.arguments().first().value<QDBusArgument>(); const QDBusArgument arg = mes.arguments().first().value<QDBusArgument>();
...@@ -106,15 +106,15 @@ SQLiteResource PolKitSQLiteConnection::query(const QString &q) ...@@ -106,15 +106,15 @@ SQLiteResource PolKitSQLiteConnection::query(const QString &q)
void PolKitSQLiteConnection::query(const QString &q, const QVariantMap &bindings) void PolKitSQLiteConnection::query(const QString &q, const QVariantMap &bindings)
{ {
if ((d->access.testFlag(Akabei::Helpers::ReadWritePermission)) || ((d->access.testFlag(Akabei::Helpers::ReadPermission)) && q.startsWith("SELECT"))) { if ((d->access.testFlag(Akabei::Helpers::ReadWritePermission)) || ((d->access.testFlag(Akabei::Helpers::ReadPermission)) && q.startsWith(QLatin1String("SELECT")))) {
d->connection->query(q, bindings); d->connection->query(q, bindings);
d->lastQueryDBus = false; d->lastQueryDBus = false;
return; return;
} }
if (Akabei::Helpers::checkAuthorizationSync("org.chakraproject.akabeicorehelper.sqlite.query")) { if (Akabei::Helpers::checkAuthorizationSync(QStringLiteral("org.chakraproject.akabeicorehelper.sqlite.query"))) {
QDBusInterface iface("org.chakraproject.akabeicorehelper", "/sqlite", "org.chakraproject.akabeicorehelper.sqlite", QDBusConnection::systemBus()); QDBusInterface iface(QStringLiteral("org.chakraproject.akabeicorehelper"), QStringLiteral("/sqlite"), QStringLiteral("org.chakraproject.akabeicorehelper.sqlite"), QDBusConnection::systemBus());
SETUP_DBUS_DATABASE SETUP_DBUS_DATABASE
QDBusMessage mes = iface.call("query", q, bindings); QDBusMessage mes = iface.call(QStringLiteral("query"), q, bindings);
d->lastQueryDBus = true; d->lastQueryDBus = true;
} else { } else {
Akabei::ErrorQueue::instance()->appendError( Akabei::ErrorQueue::instance()->appendError(
...@@ -127,11 +127,11 @@ qint64 PolKitSQLiteConnection::getLastRowId() ...@@ -127,11 +127,11 @@ qint64 PolKitSQLiteConnection::getLastRowId()
if (!d->lastQueryDBus) if (!d->lastQueryDBus)
return d->connection->getLastRowId(); return d->connection->getLastRowId();
QDBusInterface iface("org.chakraproject.akabeicorehelper", "/sqlite", "org.chakraproject.akabeicorehelper.sqlite", QDBusConnection::systemBus()); QDBusInterface iface(QStringLiteral("org.chakraproject.akabeicorehelper"), QStringLiteral("/sqlite"), QStringLiteral("org.chakraproject.akabeicorehelper.sqlite"), QDBusConnection::systemBus());
SETUP_DBUS_DATABASE SETUP_DBUS_DATABASE
QDBusMessage mes = iface.call("lastRowId"); QDBusMessage mes = iface.call(QStringLiteral("lastRowId"));
if (!mes.arguments().isEmpty()) if (!mes.arguments().isEmpty())
return mes.arguments().first().toInt(); return mes.arguments().first().toInt();
return -1; return -1;
...@@ -147,11 +147,11 @@ void PolKitSQLiteConnection::bind(QString const& key, int value) ...@@ -147,11 +147,11 @@ void PolKitSQLiteConnection::bind(QString const& key, int value)
//We bind to both databases, as we have no information yet if we have a read or write query //We bind to both databases, as we have no information yet if we have a read or write query
QDBusInterface iface("org.chakraproject.akabeicorehelper", "/sqlite", "org.chakraproject.akabeicorehelper.sqlite", QDBusConnection::systemBus()); QDBusInterface iface(QStringLiteral("org.chakraproject.akabeicorehelper"), QStringLiteral("/sqlite"), QStringLiteral("org.chakraproject.akabeicorehelper.sqlite"), QDBusConnection::systemBus());
SETUP_DBUS_DATABASE SETUP_DBUS_DATABASE
QDBusMessage mes = iface.call("bind", key, value); QDBusMessage mes = iface.call(QStringLiteral("bind"), key, value);
} }
void PolKitSQLiteConnection::bind(QString const& key, QString const& value) void PolKitSQLiteConnection::bind(QString const& key, QString const& value)
...@@ -164,11 +164,11 @@ void PolKitSQLiteConnection::bind(QString const& key, QString const& value) ...@@ -164,11 +164,11 @@ void PolKitSQLiteConnection::bind(QString const& key, QString const& value)
//We bind to both databases, as we have no information yet if we have a read or write query //We bind to both databases, as we have no information yet if we have a read or write query
QDBusInterface iface("org.chakraproject.akabeicorehelper", "/sqlite", "org.chakraproject.akabeicorehelper.sqlite", QDBusConnection::systemBus()); QDBusInterface iface(QStringLiteral("org.chakraproject.akabeicorehelper"), QStringLiteral("/sqlite"), QStringLiteral("org.chakraproject.akabeicorehelper.sqlite"), QDBusConnection::systemBus());
SETUP_DBUS_DATABASE SETUP_DBUS_DATABASE
QDBusMessage mes = iface.call("bind", key, value); QDBusMessage mes = iface.call(QStringLiteral("bind"), key, value);
} }
void PolKitSQLiteConnection::bind(QString const& key, QByteArray const& value) void PolKitSQLiteConnection::bind(QString const& key, QByteArray const& value)
...@@ -181,9 +181,9 @@ void PolKitSQLiteConnection::bind(QString const& key, QByteArray const& value) ...@@ -181,9 +181,9 @@ void PolKitSQLiteConnection::bind(QString const& key, QByteArray const& value)
//We bind to both databases, as we have no information yet if we have a read or write query //We bind to both databases, as we have no information yet if we have a read or write query
QDBusInterface iface("org.chakraproject.akabeicorehelper", "/sqlite", "org.chakraproject.akabeicorehelper.sqlite", QDBusConnection::systemBus()); QDBusInterface iface(QStringLiteral("org.chakraproject.akabeicorehelper"), QStringLiteral("/sqlite"), QStringLiteral("org.chakraproject.akabeicorehelper.sqlite"), QDBusConnection::systemBus());
SETUP_DBUS_DATABASE SETUP_DBUS_DATABASE
QDBusMessage mes = iface.call("bind", key, value); QDBusMessage mes = iface.call(QStringLiteral("bind"), key, value);
} }
This diff is collapsed.
...@@ -124,7 +124,7 @@ void Cache::Private::init() ...@@ -124,7 +124,7 @@ void Cache::Private::init()
* Create a new list of cache entries with their full path. * Create a new list of cache entries with their full path.
*/ */
foreach (QString const& cacheFile, plainEntryList) { foreach (QString const& cacheFile, plainEntryList) {
if (!cacheFile.startsWith(".")) { if (!cacheFile.startsWith(QLatin1String("."))) {
cacheFiles.append(cachedir.absoluteFilePath(cacheFile)); cacheFiles.append(cachedir.absoluteFilePath(cacheFile));
} }
} }
...@@ -242,10 +242,10 @@ void Cache::cleanCache(MaxSizePolicy policy) ...@@ -242,10 +242,10 @@ void Cache::cleanCache(MaxSizePolicy policy)
bool Cache::Private::cleanNotInstalled() bool Cache::Private::cleanNotInstalled()
{ {
try { try {
SQLiteConnection database(databasedir.absoluteFilePath("local.db"), true); SQLiteConnection database(databasedir.absoluteFilePath(QStringLiteral("local.db")), true);
foreach (QString const& file, cacheFiles) { foreach (QString const& file, cacheFiles) {
database.bind(":Filename", file.split("/").last()); database.bind(QStringLiteral(":Filename"), file.split(QStringLiteral("/")).last());
SQLiteResource res = database.query( Queries::selectPackages("filename", "=", ":Filename") ); SQLiteResource res = database.query( Queries::selectPackages(QStringLiteral("filename"), QStringLiteral("="), QStringLiteral(":Filename")) );
if (res.getRowsCount() == 0) { if (res.getRowsCount() == 0) {
if (!Helpers::removeFile(file)) { if (!Helpers::removeFile(file)) {
error = QObject::tr("Failed to remove file!"); error = QObject::tr("Failed to remove file!");
...@@ -254,7 +254,7 @@ bool Cache::Private::cleanNotInstalled() ...@@ -254,7 +254,7 @@ bool Cache::Private::cleanNotInstalled()
} }
} }
} catch (SQLiteException &exc) { } catch (SQLiteException &exc) {
qWarning() << "Caught an error with" << cachedir.absoluteFilePath("local.db") << ":" << exc.what(); qWarning() << "Caught an error with" << cachedir.absoluteFilePath(QStringLiteral("local.db")) << ":" << exc.what();
return false; return false;
} }
return true; return true;
...@@ -297,7 +297,7 @@ bool Cache::Private::cleanAll() ...@@ -297,7 +297,7 @@ bool Cache::Private::cleanAll()
foreach (QString const& file, plainEntryList) { foreach (QString const& file, plainEntryList) {
QString packageName = getPackageName(file); QString packageName = getPackageName(file);
if (file.startsWith(".") || keepPackages.contains(packageName)) { if (file.startsWith(QLatin1String(".")) || keepPackages.contains(packageName)) {
continue; continue;
} }
...@@ -324,7 +324,7 @@ QString Cache::Private::getPackageName(const QString& filename) ...@@ -324,7 +324,7 @@ QString Cache::Private::getPackageName(const QString& filename)
} }
pkgname += token; pkgname += token;
pkgname += "-"; pkgname += QLatin1String("-");
} }
pkgname.resize(pkgname.size() - 1); pkgname.resize(pkgname.size() - 1);
...@@ -341,7 +341,7 @@ QString Cache::Private::getPackageVersion(const QString& filename) ...@@ -341,7 +341,7 @@ QString Cache::Private::getPackageVersion(const QString& filename)
} }
pkgver += token; pkgver += token;
pkgver += "-"; pkgver += QLatin1String("-");
} }
pkgver.resize(pkgver.size() - 1); pkgver.resize(pkgver.size() - 1);
......
...@@ -84,7 +84,7 @@ Config::Config() ...@@ -84,7 +84,7 @@ Config::Config()
{ {
Q_ASSERT(!s_globalConfig()->q); Q_ASSERT(!s_globalConfig()->q);
s_globalConfig()->q = this; s_globalConfig()->q = this;
setRoot("/"); setRoot(QStringLiteral("/"));
setCachePath(Akabei::DEFAULT_CACHE_DIR.toString()); setCachePath(Akabei::DEFAULT_CACHE_DIR.toString());
setDatabasePath(Akabei::DEFAULT_DATABASE_DIR.toString()); setDatabasePath(Akabei::DEFAULT_DATABASE_DIR.toString());
} }
......
This diff is collapsed.
...@@ -105,17 +105,17 @@ QString Delta::xdeltaApplyCommand(const QString& pathToDest) const ...@@ -105,17 +105,17 @@ QString Delta::xdeltaApplyCommand(const QString& pathToDest) const
} }
QString retstring; QString retstring;
if (d->pathToDelta.endsWith(".gz")) { if (d->pathToDelta.endsWith(QLatin1String(".gz"))) {
retstring = QString("xdelta3 -d -q -R -c -s %1 %2 | gzip -n > %3").arg( retstring = QStringLiteral("xdelta3 -d -q -R -c -s %1 %2 | gzip -n > %3").arg(
d->pathToOldFile, d->pathToOldFile,
d->pathToDelta, d->pathToDelta,
pathToDest); pathToDest);
} else { } else {
ArchiveHandler handle(d->pathToDelta); ArchiveHandler handle(d->pathToDelta);
QString deltaPath = Akabei::Config::instance()->rootDir().absoluteFilePath("tmp/" + d->pathToDelta.split('/').last().remove(".tar.xz")); QString deltaPath = Akabei::Config::instance()->rootDir().absoluteFilePath("tmp/" + d->pathToDelta.split('/').last().remove(QStringLiteral(".tar.xz")));
handle.extract(d->pathToDelta.split('/').last().remove(".tar.xz"), deltaPath, true); handle.extract(d->pathToDelta.split('/').last().remove(QStringLiteral(".tar.xz")), deltaPath, true);
retstring = QString("xdelta3 -d -q -s %1 %2 %3").arg( retstring = QStringLiteral("xdelta3 -d -q -s %1 %2 %3").arg(
d->pathToOldFile, d->pathToOldFile,
deltaPath, deltaPath,
pathToDest); pathToDest);
......
This diff is collapsed.
...@@ -53,7 +53,7 @@ QString Akabei::Hook::path() ...@@ -53,7 +53,7 @@ QString Akabei::Hook::path()
if (d->file) if (d->file)
return d->file->fileName(); return d->file->fileName();
d->file = new QTemporaryFile(Config::instance()->rootDir().absoluteFilePath("tmp/akabei_XXXXXX")); d->file = new QTemporaryFile(Config::instance()->rootDir().absoluteFilePath(QStringLiteral("tmp/akabei_XXXXXX")));
d->file->open(); d->file->open();
QTextStream out(d->file); QTextStream out(d->file);
out << d->content; out << d->content;
......
...@@ -99,9 +99,9 @@ public: ...@@ -99,9 +99,9 @@ public:
} else { } else {
/* Log through polkit */ /* Log through polkit */
if (Akabei::Helpers::checkAuthorizationSync("org.chakraproject.akabeicorehelper.logging.log")) { if (Akabei::Helpers::checkAuthorizationSync(QStringLiteral("org.chakraproject.akabeicorehelper.logging.log"))) {
QDBusInterface iface("org.chakraproject.akabeicorehelper", "/logging", "org.chakraproject.akabeicorehelper.logging", QDBusConnection::systemBus()); QDBusInterface iface(QStringLiteral("org.chakraproject.akabeicorehelper"), QStringLiteral("/logging"), QStringLiteral("org.chakraproject.akabeicorehelper.logging"), QDBusConnection::systemBus());
QDBusMessage mes = iface.call("log", data); QDBusMessage mes = iface.call(QStringLiteral("log"), data);
if ( !mes.errorMessage().isEmpty() ) { if ( !mes.errorMessage().isEmpty() ) {
std::cerr << "Log error: an error occurred while logging via polkit" << std::endl; std::cerr << "Log error: an error occurred while logging via polkit" << std::endl;
...@@ -115,7 +115,7 @@ public: ...@@ -115,7 +115,7 @@ public:
QString getCurrentDateTime() const QString getCurrentDateTime() const
{ {
return QDateTime::currentDateTime().toString("[dd/MM/yy hh:mm:ss] "); return QDateTime::currentDateTime().toString(QStringLiteral("[dd/MM/yy hh:mm:ss] "));
} }
QString data; QString data;
...@@ -145,9 +145,9 @@ void AkabeiLogLine::initialize(bool syslog, const QString& filename) ...@@ -145,9 +145,9 @@ void AkabeiLogLine::initialize(bool syslog, const QString& filename)
} else { } else {
if (Akabei::Helpers::checkAuthorizationSync("org.chakraproject.akabeicorehelper.logging.init")) { if (Akabei::Helpers::checkAuthorizationSync(QStringLiteral("org.chakraproject.akabeicorehelper.logging.init"))) {
QDBusInterface iface("org.chakraproject.akabeicorehelper", "/logging", "org.chakraproject.akabeicorehelper.logging", QDBusConnection::systemBus()); QDBusInterface iface(QStringLiteral("org.chakraproject.akabeicorehelper"), QStringLiteral("/logging"), QStringLiteral("org.chakraproject.akabeicorehelper.logging"), QDBusConnection::systemBus());
QDBusMessage mes = iface.call("init", filename); QDBusMessage mes = iface.call(QStringLiteral("init"), filename);
if (mes.errorMessage().isEmpty()) { if (mes.errorMessage().isEmpty()) {
systemInitialized = true; systemInitialized = true;
......
This diff is collapsed.
...@@ -17,112 +17,112 @@ namespace Queries ...@@ -17,112 +17,112 @@ namespace Queries
QString selectGroups(const QString& property, const QString& comparison, const QString& value) QString selectGroups(const QString& property, const QString& comparison, const QString& value)
{ {
return QString("SELECT * FROM groups WHERE %1 %2 \"%3\";").arg(property, comparison, value); return QStringLiteral("SELECT * FROM groups WHERE %1 %2 \"%3\";").arg(property, comparison, value);
} }
QString selectGroupsNameOrDescription(const QString& token, const QString& comparison) QString selectGroupsNameOrDescription(const QString& token, const QString& comparison)
{ {
return QString("SELECT * FROM groups WHERE name %1 \"%2\" OR description %2 \"%3\";").arg(token, comparison, token); return QStringLiteral("SELECT * FROM groups WHERE name %1 \"%2\" OR description %2 \"%3\";").arg(token, comparison, token);
} }
QString selectPackages(const QString& property, const QString& comparison, const QString& value) QString selectPackages(const QString& property, const QString& comparison, const QString& value)
{ {
return QString("SELECT * FROM packages WHERE %1 %2 \"%3\";").arg(property, comparison, value); return QStringLiteral("SELECT * FROM packages WHERE %1 %2 \"%3\";").arg(property, comparison, value);
} }
QString selectPackagesNameOrDescription(const QString& token, const QString& comparison) QString selectPackagesNameOrDescription(const QString& token, const QString& comparison)
{ {
return QString("SELECT * FROM packages WHERE name %1 \"%2\" OR description %1 \"%2\";").arg(comparison, token); return QStringLiteral("SELECT * FROM packages WHERE name %1 \"%2\" OR description %1 \"%2\";").arg(comparison, token);
} }
QString selectHooks(const QString& property, const QString& comparison, const QString& value) QString selectHooks(const QString& property, const QString& comparison, const QString& value)
{ {
return QString("SELECT * FROM hooks WHERE %1 %2 \"%3\":").arg(property, comparison, value); return QStringLiteral("SELECT * FROM hooks WHERE %1 %2 \"%3\":").arg(property, comparison, value);
} }
QString selectDeltas(const QString& property, const QString& comparison, const QString& value) QString selectDeltas(const QString& property, const QString& comparison, const QString& value)
{ {
return QString("SELECT * FROM deltas WHERE %1 %2 \"%3\";").arg(property, comparison, value); return QStringLiteral("SELECT * FROM deltas WHERE %1 %2 \"%3\";").arg(property, comparison, value);
} }
QString allPackages() QString allPackages()
{ {
return QString("SELECT * FROM packages;"); return QStringLiteral("SELECT * FROM packages;");
} }
QString allGroups() QString allGroups()
{ {
return QString("SELECT * FROM groups;"); return QStringLiteral("SELECT * FROM groups;");
} }
QString packageProperty(const QString& property, const QString& table, int packageId) QString packageProperty(const QString& property, const QString& table, int packageId)
{ {
QString id = QString::number(packageId); QString id = QString::number(packageId);
return QString("SELECT %1 FROM %2 WHERE package=\"%3\";").arg(property, table, id); return QStringLiteral("SELECT %1 FROM %2 WHERE package=\"%3\";").arg(property, table, id);
} }
QString packageHooks(int packageId) QString packageHooks(int packageId)
{ {
QString id = QString::number(packageId); QString id = QString::number(packageId);
return QString("SELECT * FROM belongshook JOIN hooks ON package=\"%1\" AND belongshook.hookname=hooks.name;").arg(id); return QStringLiteral("SELECT * FROM belongshook JOIN hooks ON package=\"%1\" AND belongshook.hookname=hooks.name;").arg(id);
} }
QString packagesFromHook(const QString& hook) QString packagesFromHook(const QString& hook)
{ {
return QString("SELECT * FROM belongshook JOIN packages ON hookname=\"%1\" AND belongshook.package=packages.id;").arg(hook); return QStringLiteral("SELECT * FROM belongshook JOIN packages ON hookname=\"%1\" AND belongshook.package=packages.id;").arg(hook);
} }
QString packagesInGroup(const QString& group, const QString& token) QString packagesInGroup(const QString& group, const QString& token)
{ {
return QString("SELECT * FROM packages JOIN belongsgroup ON packages.id=belongsgroup.package WHERE belongsgroup.groupname=\"%1\" \ return QStringLiteral("SELECT * FROM packages JOIN belongsgroup ON packages.id=belongsgroup.package WHERE belongsgroup.groupname=\"%1\" \
AND (name LIKE \"%2\" OR description LIKE \"%2\");").arg(group, token); AND (name LIKE \"%2\" OR description LIKE \"%2\");").arg(group, token);
} }
QString belongsGroup(const QString& group, const QString& package) QString belongsGroup(const QString& group, const QString& package)
{ {
return QString("SELECT * FROM belongsgroup JOIN groups ON groups.name=\"%1\" AND package=\"%2\";").arg(group, package); return QStringLiteral("SELECT * FROM belongsgroup JOIN groups ON groups.name=\"%1\" AND package=\"%2\";").arg(group, package);
} }
QString allPackagesInGroup(const QString& group) QString allPackagesInGroup(const QString& group)
{ {
return QString("SELECT * FROM packages JOIN belongsgroup ON packages.id=belongsgroup.package \ return QStringLiteral("SELECT * FROM packages JOIN belongsgroup ON packages.id=belongsgroup.package \
WHERE belongsgroup.groupname=\"%1\";").arg(group); WHERE belongsgroup.groupname=\"%1\";").arg(group);
} }
QString requiredByPackages(const QString& dependency) QString requiredByPackages(const QString& dependency)
{ {
return QString("SELECT packages.* FROM depends JOIN packages ON packages.id = depends.package \ return QStringLiteral("SELECT packages.* FROM depends JOIN packages ON packages.id = depends.package \
WHERE depends.dependency REGEXP \"%1\";").arg(dependency); WHERE depends.dependency REGEXP \"%1\";").arg(dependency);
} }
QString packageDependencies(const QString& dependency, const QString& comparison) QString packageDependencies(const QString& dependency, const QString& comparison)
{ {
return QString("SELECT * FROM packages JOIN depends ON packages.id=depends.package WHERE depends.dependency %0 \"%1\";").arg(comparison, dependency); return QStringLiteral("SELECT * FROM packages JOIN depends ON packages.id=depends.package WHERE depends.dependency %0 \"%1\";").arg(comparison, dependency);
} }
QString globalReplaces() QString globalReplaces()
{ {
return QString("SELECT * FROM replaces JOIN packages ON replaces.package = packages.id"); return QStringLiteral("SELECT * FROM replaces JOIN packages ON replaces.package = packages.id");
} }
QString begin() QString begin()
{ {
return QString("BEGIN;"); return QStringLiteral("BEGIN;");
} }
QString commit() QString commit()
{ {
return QString("COMMIT;"); return QStringLiteral("COMMIT;");
} }
QString vacuum() QString vacuum()
{ {
return QString("VACUUM;"); return QStringLiteral("VACUUM;");
} }
QString rollback() QString rollback()
{ {
return QString("ROLLBACK;"); return QStringLiteral("ROLLBACK;");
} }
} }
......
...@@ -402,7 +402,7 @@ void ValidatorWorker::processNextPhase() ...@@ -402,7 +402,7 @@ void ValidatorWorker::processNextPhase()
// Check if we are breaking dependencies somehow // Check if we are breaking dependencies somehow
foreach (const QString &target, targetRemovals) { foreach (const QString &target, targetRemovals) {
QString rT = Helpers::versionedTarget(target).first; QString rT = Helpers::versionedTarget(target).first;
QString sql = Queries::packageDependencies(rT, "LIKE"); QString sql = Queries::packageDependencies(rT, QStringLiteral("LIKE"));
QList<Package*> ret = Backend::instance()->localDatabase()->queryPackages(sql); QList<Package*> ret = Backend::instance()->localDatabase()->queryPackages(sql);
// Iterate: we might have found targets that are not the ones we're looking for (due to version handling) // Iterate: we might have found targets that are not the ones we're looking for (due to version handling)
foreach (Package *p, ret) { foreach (Package *p, ret) {
......
...@@ -20,9 +20,9 @@ int main(int argc, char *argv[]) ...@@ -20,9 +20,9 @@ int main(int argc, char *argv[])
void DatabaseBenchmark::benchmark_start() void DatabaseBenchmark::benchmark_start()
{ {
Akabei::Config::instance()->setDatabasePath("/home/lukas/Development/buildroot/databases/"); Akabei::Config::instance()->setDatabasePath(QStringLiteral("/home/lukas/Development/buildroot/databases/"));
Akabei::Config::instance()->setRoot("/home/lukas/Development/buildroot/_chroots/master-x32/"); Akabei::Config::instance()->setRoot(QStringLiteral("/home/lukas/Development/buildroot/_chroots/master-x32/"));
Akabei::Config::instance()->setCachePath("/home/lukas/Development/buildroot/_cache-x32/"); Akabei::Config::instance()->setCachePath(QStringLiteral("/home/lukas/Development/buildroot/_cache-x32/"));
//Akabei::Config::instance()->setDatabases(QStringList() << "test1" << "test2"); //Akabei::Config::instance()->setDatabases(QStringList() << "test1" << "test2");
......
...@@ -202,7 +202,7 @@ size_t ArchiveHandler::totalEntrySize() const ...@@ -202,7 +202,7 @@ size_t ArchiveHandler::totalEntrySize() const
bool ArchiveHandler::checkPackageValidity() bool ArchiveHandler::checkPackageValidity()
{ {
return (entries.find(".PKGINFO") != entries.end()); return (entries.find(QStringLiteral(".PKGINFO")) != entries.end());
} }
void ArchiveHandler::handleEntries(Akabei::EntryHandlerFunctor& handler) void ArchiveHandler::handleEntries(Akabei::EntryHandlerFunctor& handler)
...@@ -229,7 +229,7 @@ void ArchiveHandler::handleEntries(Akabei::EntryHandlerFunctor& handler) ...@@ -229,7 +229,7 @@ void ArchiveHandler::handleEntries(Akabei::EntryHandlerFunctor& handler)
QString ArchiveHandler::readTextFile(const QString& textFile) QString ArchiveHandler::readTextFile(const QString& textFile)
{ {
if (!entries.contains(textFile)) { if (!entries.contains(textFile)) {
QString message = "ERROR: no such file in archive: %1"; QString message = QStringLiteral("ERROR: no such file in archive: %1");
throw ArchiveException(message.arg(textFile).toUtf8().data()); throw ArchiveException(message.arg(textFile).toUtf8().data());
} }
...@@ -505,7 +505,7 @@ bool InstallFunctor::operator()(const ArchiveEntry& currentEntry) ...@@ -505,7 +505,7 @@ bool InstallFunctor::operator()(const ArchiveEntry& currentEntry)
{ {
QString entryName = currentEntry.getFileName(); QString entryName = currentEntry.getFileName();
if (entryName == ".INSTALL" || entryName == ".PKGINFO" || entryName == ".MTREE" || entryName == ".Changelog") if (entryName == QLatin1String(".INSTALL") || entryName == QLatin1String(".PKGINFO") || entryName == QLatin1String(".MTREE") || entryName == QLatin1String(".Changelog"))
return true; return true;
OperationUtils utils; OperationUtils utils;
...@@ -574,7 +574,7 @@ bool ReinstallUpgradeFunctor::operator()(const ArchiveEntry& currentEntry) ...@@ -574,7 +574,7 @@ bool ReinstallUpgradeFunctor::operator()(const ArchiveEntry& currentEntry)
{ {
QString entryName = currentEntry.getFileName(); QString entryName = currentEntry.getFileName();
if (entryName == ".INSTALL" || entryName == ".PKGINFO") if (entryName == QLatin1String(".INSTALL") || entryName == QLatin1String(".PKGINFO"))
return true; return true;
OperationUtils utils; OperationUtils utils;
...@@ -653,7 +653,7 @@ ExtractAllFunctor::ExtractAllFunctor(QString p, bool ow, Akabei::Operation *call ...@@ -653,7 +653,7 @@ ExtractAllFunctor::ExtractAllFunctor(QString p, bool ow, Akabei::Operation *call
, pathPrefix(p) , pathPrefix(p)
, overwrite(ow) , overwrite(ow)
{ {
if (!pathPrefix.endsWith("/")) { if (!pathPrefix.endsWith(QLatin1String("/"))) {
pathPrefix.append("/"); pathPrefix.append("/");
} }
} }
......
...@@ -32,7 +32,7 @@ public: ...@@ -32,7 +32,7 @@ public:
handler = new ArchiveHandler(file); handler = new ArchiveHandler(file);
iface = new QDBusInterface("org.chakraproject.akabeicorehelper", "/archive", "org.chakraproject.akabeicorehelper.archive", QDBusConnection::systemBus()); iface = new QDBusInterface(QStringLiteral("org.chakraproject.akabeicorehelper"), QStringLiteral("/archive"), QStringLiteral("org.chakraproject.akabeicorehelper.archive"), QDBusConnection::systemBus());
} }
~Private() { ~Private() {
delete handler; delete handler;
...@@ -79,9 +79,9 @@ bool PolKitArchiveHandler::write(const QString& filename, const QHash<QString, Q ...@@ -79,9 +79,9 @@ bool PolKitArchiveHandler::write(const QString& filename, const QHash<QString, Q
return ArchiveHandler::write(filename, files); return ArchiveHandler::write(filename, files);
} }
if (Akabei::Helpers::checkAuthorizationSync("org.chakraproject.akabeicorehelper.archive.write")) { if (Akabei::Helpers::checkAuthorizationSync(QStringLiteral("org.chakraproject.akabeicorehelper.archive.write"))) {
qDebug() << "Authorization granted"; qDebug() << "Authorization granted";
QDBusInterface iface("org.chakraproject.akabeicorehelper", "/archive", "org.chakraproject.akabeicorehelper.archive", QDBusConnection::systemBus()); QDBusInterface iface(QStringLiteral("org.chakraproject.akabeicorehelper"), QStringLiteral("/archive"), QStringLiteral("org.chakraproject.akabeicorehelper.archive"), QDBusConnection::systemBus());
iface.setProperty("filename", filename); iface.setProperty("filename", filename);
...@@ -90,7 +90,7 @@ bool PolKitArchiveHandler::write(const QString& filename, const QHash<QString, Q ...@@ -90,7 +90,7 @@ bool PolKitArchiveHandler::write(const QString& filename, const QHash<QString, Q
const auto& k = it.key(); const auto& k = it.key();
map.insert(k, files[k]); map.insert(k, files[k]);
} }
QDBusMessage mes = iface.call("write", map); QDBusMessage mes = iface.call(QStringLiteral("write"), map);