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

Const'ify

parent f8e617e8
Pipeline #42726 canceled with stage
......@@ -35,7 +35,7 @@ void KLdapTest::initTestCase()
The specified server should not be a production server in case we break anything here.
You have been warned!
*/
QString filename(QStringLiteral("testurl.txt"));
const QString filename(QStringLiteral("testurl.txt"));
QFile file(filename);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream stream(&file);
......@@ -203,7 +203,7 @@ void KLdapTest::testLdapSearch()
this, &KLdapTest::searchResult);
connect(m_search, &LdapSearch::data,
this, &KLdapTest::searchData);
bool success = m_search->search(url);
const bool success = m_search->search(url);
QCoreApplication::processEvents();
QEXPECT_FAIL("", "Will fail since no server is available for testing", Abort);
......@@ -215,7 +215,7 @@ void KLdapTest::testLdapSearch()
void KLdapTest::searchResult(KLDAP::LdapSearch *search)
{
qDebug();
int err = search->error();
const int err = search->error();
if (err) {
qDebug() << "Search returned the following error:" << search->errorString();
}
......@@ -233,8 +233,8 @@ void KLdapTest::searchData(KLDAP::LdapSearch *search, const KLDAP::LdapObject &o
void KLdapTest::testLdapDN()
{
QString strDN(QStringLiteral("uid=Test\\+Person+ou=accounts\\,outgoing,dc=kde,dc=org"));
LdapDN dn(strDN);
const QString strDN(QStringLiteral("uid=Test\\+Person+ou=accounts\\,outgoing,dc=kde,dc=org"));
const LdapDN dn(strDN);
QCOMPARE(dn.isValid(), true);
QCOMPARE(dn.rdnString(), QStringLiteral("uid=Test\\+Person+ou=accounts\\,outgoing"));
}
......
......@@ -353,7 +353,7 @@ int LdapConnection::connect()
}
qCDebug(LDAP_LOG) << "initializing SASL client";
int saslresult = sasl_client_new("ldap", d->mServer.host().toLatin1().constData(),
const int saslresult = sasl_client_new("ldap", d->mServer.host().toLatin1().constData(),
nullptr, nullptr, callbacks, 0, &d->mSASLconn);
if (saslresult != SASL_OK) {
d->mConnectionError = i18n("Cannot initialize the SASL client.");
......
......@@ -134,7 +134,7 @@ QString LdapDN::toString() const
QString LdapDN::toString(int depth) const
{
QStringList rdns = d->splitOnNonEscapedChar(d->m_dn, QLatin1Char(','));
const QStringList rdns = d->splitOnNonEscapedChar(d->m_dn, QLatin1Char(','));
if (depth >= rdns.size()) {
return QString();
}
......@@ -153,13 +153,13 @@ QString LdapDN::toString(int depth) const
QString LdapDN::rdnString() const
{
/** \TODO We should move this into the d pointer as we calculate rdns quite a lot */
QStringList rdns = d->splitOnNonEscapedChar(d->m_dn, QLatin1Char(','));
const QStringList rdns = d->splitOnNonEscapedChar(d->m_dn, QLatin1Char(','));
return rdns.at(0);
}
QString LdapDN::rdnString(int depth) const
{
QStringList rdns = d->splitOnNonEscapedChar(d->m_dn, QLatin1Char(','));
const QStringList rdns = d->splitOnNonEscapedChar(d->m_dn, QLatin1Char(','));
if (depth >= rdns.size()) {
return QString();
}
......@@ -186,7 +186,7 @@ bool LdapDN::isValid() const
int LdapDN::depth() const
{
QStringList rdns = d->splitOnNonEscapedChar(d->m_dn, QLatin1Char(','));
const QStringList rdns = d->splitOnNonEscapedChar(d->m_dn, QLatin1Char(','));
return rdns.size();
}
......
Markdown is supported
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