Commit c6ec628c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compiles with strict definition

parent 6ab7c4b7
......@@ -6,11 +6,21 @@ find_package(Qt5 REQUIRED COMPONENTS Core)
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
if (POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
include(KDEInstallDirs)
include(KDECompilerSettings)
include(KDECMakeSettings)
include(FeatureSummary)
include(ECMQtDeclareLoggingCategory)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_USE_QSTRINGBUILDER)
add_definitions(-DQT_NO_CAST_FROM_ASCII)
add_definitions(-DQT_NO_CAST_TO_ASCII)
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
find_package(KF5 REQUIRED COMPONENTS
CoreAddons
......@@ -37,6 +47,6 @@ target_link_libraries(ksshaskpass
install(TARGETS ksshaskpass DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS})
if (KF5DocTools_FOUND)
add_subdirectory(doc)
add_subdirectory(doc)
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -41,7 +41,7 @@ Q_LOGGING_CATEGORY(LOG_KSSHASKPASS, "ksshaskpass")
static void parsePrompt(const QString &prompt, QString& keyFile, bool& wrongPassphrase)
{
// Case 1: asking for passphrase for a certain keyfile for the first time => we should try a password from the wallet
QRegularExpression re1("^Enter passphrase for (.*?)( \\(will confirm each use\\))?: $");
QRegularExpression re1(QStringLiteral("^Enter passphrase for (.*?)( \\(will confirm each use\\))?: $"));
QRegularExpressionMatch match1 = re1.match(prompt);
if (match1.hasMatch()) {
keyFile = match1.captured(1);
......@@ -51,7 +51,7 @@ static void parsePrompt(const QString &prompt, QString& keyFile, bool& wrongPass
// Case 2: re-asking for passphrase for a certain keyfile => probably we've tried a password from the wallet, no point
// in trying it again
QRegularExpression re2("^Bad passphrase, try again for (.*?)( \\(will confirm each use\\))?: $");
QRegularExpression re2(QStringLiteral("^Bad passphrase, try again for (.*?)( \\(will confirm each use\\))?: $"));
QRegularExpressionMatch match2 = re2.match(prompt);
if (match2.hasMatch()) {
keyFile = match2.captured(1);
......@@ -60,7 +60,7 @@ static void parsePrompt(const QString &prompt, QString& keyFile, bool& wrongPass
}
// Case 3: password extraction from git, see bug 376228
QRegularExpression re3("^(Password|Username) for (.*?)[:] $");
QRegularExpression re3(QStringLiteral("^(Password|Username) for (.*?)[:] $"));
QRegularExpressionMatch match3 = re3.match(prompt);
if (match3.hasMatch()) {
keyFile = match3.captured(2);
......@@ -69,7 +69,7 @@ static void parsePrompt(const QString &prompt, QString& keyFile, bool& wrongPass
}
// Case 4: password extraction from mercurial, see bug 380085
QRegularExpression re4("^(.*?)'s password: $");
QRegularExpression re4(QStringLiteral("^(.*?)'s password: $"));
QRegularExpressionMatch match4 = re4.match(prompt);
if (match4.hasMatch()) {
keyFile = match4.captured(1);
......@@ -91,7 +91,7 @@ int main(int argc, char **argv)
KAboutData about(
QStringLiteral("ksshaskpass"),
i18n("Ksshaskpass"),
PROJECT_VERSION,
QString::fromLatin1(PROJECT_VERSION),
i18n("KDE version of ssh-askpass"),
KAboutLicense::GPL,
i18n("(c) 2006 Hans van Leeuwen\n(c) 2008-2010 Armin Berres"),
......@@ -100,8 +100,8 @@ int main(int argc, char **argv)
QStringLiteral("armin@space-based.de")
);
about.addAuthor(i18n("Armin Berres"), i18n("Current author"), QStringLiteral("armin@space-based.de"), 0);
about.addAuthor(i18n("Hans van Leeuwen"), i18n("Original author"), QStringLiteral("hanz@hanz.nl"), 0);
about.addAuthor(i18n("Armin Berres"), i18n("Current author"), QStringLiteral("armin@space-based.de"), QString());
about.addAuthor(i18n("Hans van Leeuwen"), i18n("Original author"), QStringLiteral("hanz@hanz.nl"), QString());
KAboutData::setApplicationData(about);
QCommandLineParser parser;
......@@ -138,7 +138,7 @@ int main(int argc, char **argv)
// There was a bug in previous versions of ksshaskpass that caused it to create keys with extra space
// appended to key file name. Try these keys too, and, if there's a match, ensure that it's properly
// replaced with proper one.
const QString keyFile2 = keyFile + " ";
const QString keyFile2 = keyFile + QLatin1Char(' ');
wallet->readPassword(keyFile2, retrievedPass);
if (!retrievedPass.isEmpty()) {
qCWarning(LOG_KSSHASKPASS) << "Detected legacy key for " << keyFile << ", enabling workaround";
......@@ -155,7 +155,7 @@ int main(int argc, char **argv)
if (wallet.get()) {
flag = KPasswordDialog::ShowKeepPassword;
}
QPointer<KPasswordDialog> kpd = new KPasswordDialog(0, flag);
QPointer<KPasswordDialog> kpd = new KPasswordDialog(nullptr, flag);
kpd->setPrompt(dialog);
kpd->setWindowTitle(i18n("Ksshaskpass"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment