mirror of
https://github.com/QuasarApp/qca.git
synced 2025-04-26 11:34:32 +00:00
Add const to a few lists
This commit is contained in:
parent
4100770e32
commit
c1a028c345
@ -173,7 +173,7 @@ public:
|
||||
|
||||
bool fromString(const QString &in)
|
||||
{
|
||||
QStringList parts = in.split(':');
|
||||
const QStringList parts = in.split(':');
|
||||
for(int n = 0; n < parts.count(); ++n)
|
||||
parts[n] = unescape(parts[n]);
|
||||
|
||||
|
@ -418,7 +418,7 @@ private:
|
||||
if(mode == 0)
|
||||
{
|
||||
// first line is the method list
|
||||
QStringList mechlist = line.split(QLatin1Char(' '));
|
||||
const QStringList mechlist = line.split(QLatin1Char(' '));
|
||||
mode = 1; // switch to sasl negotiation mode
|
||||
sasl->startClient(proto, host, mechlist);
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ void GpgAction::processResult(int code)
|
||||
{
|
||||
if(input.op == GpgOp::Check)
|
||||
{
|
||||
QStringList strList = outstr.split(QStringLiteral("\n"));
|
||||
const QStringList strList = outstr.split(QStringLiteral("\n"));
|
||||
foreach (const QString &str, strList)
|
||||
{
|
||||
if (!str.startsWith(QLatin1String("Home: ")))
|
||||
@ -909,7 +909,7 @@ void GpgAction::proc_readyReadStderr()
|
||||
|
||||
void GpgAction::proc_readyReadStatusLines()
|
||||
{
|
||||
QStringList lines = proc.readStatusLines();
|
||||
const QStringList lines = proc.readStatusLines();
|
||||
for(int n = 0; n < lines.count(); ++n)
|
||||
processStatusLine(lines[n]);
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ QByteArray GPGProc::readStderr()
|
||||
|
||||
QStringList GPGProc::readStatusLines()
|
||||
{
|
||||
QStringList out = d->statusLines;
|
||||
const QStringList out = d->statusLines;
|
||||
d->statusLines.clear();
|
||||
return out;
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ static CertificateInfo get_cert_name(X509_NAME *name)
|
||||
{
|
||||
CertificateInfo p9_info;
|
||||
try_get_name_item(name, NID_pkcs9_emailAddress, EmailLegacy, &p9_info);
|
||||
QList<QString> emails = info.values(Email);
|
||||
const QList<QString> emails = info.values(Email);
|
||||
QMapIterator<CertificateInfoType,QString> it(p9_info);
|
||||
while(it.hasNext())
|
||||
{
|
||||
@ -5976,8 +5976,8 @@ public:
|
||||
// setup the cert store
|
||||
{
|
||||
X509_STORE *store = SSL_CTX_get_cert_store(context);
|
||||
QList<Certificate> cert_list = trusted.certificates();
|
||||
QList<CRL> crl_list = trusted.crls();
|
||||
const QList<Certificate> cert_list = trusted.certificates();
|
||||
const QList<CRL> crl_list = trusted.crls();
|
||||
int n;
|
||||
for(n = 0; n < cert_list.count(); ++n)
|
||||
{
|
||||
@ -6594,7 +6594,7 @@ public:
|
||||
// intermediates/signers that may not be in the blob
|
||||
STACK_OF(X509) *other_certs = sk_X509_new_null();
|
||||
QList<Certificate> untrusted_list = cms->untrustedCerts.certificates();
|
||||
QList<CRL> untrusted_crls = cms->untrustedCerts.crls(); // we'll use the crls later
|
||||
const QList<CRL> untrusted_crls = cms->untrustedCerts.crls(); // we'll use the crls later
|
||||
for(int n = 0; n < untrusted_list.count(); ++n)
|
||||
{
|
||||
X509 *x = static_cast<MyCertContext *>(untrusted_list[n].context())->item.cert;
|
||||
@ -6653,7 +6653,7 @@ public:
|
||||
signerChain = chain;
|
||||
|
||||
X509_STORE *store = X509_STORE_new();
|
||||
QList<Certificate> cert_list = cms->trustedCerts.certificates();
|
||||
const QList<Certificate> cert_list = cms->trustedCerts.certificates();
|
||||
QList<CRL> crl_list = cms->trustedCerts.crls();
|
||||
for(int n = 0; n < cert_list.count(); ++n)
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ private:
|
||||
|
||||
QMap<QString, QString>
|
||||
friendlyNames () {
|
||||
QStringList names = makeFriendlyNames (_certs);
|
||||
const QStringList names = makeFriendlyNames (_certs);
|
||||
QMap<QString, QString> friendlyNames;
|
||||
|
||||
for (int i=0;i<names.size ();i++) {
|
||||
@ -2409,7 +2409,7 @@ pkcs11KeyStoreListContext::_deserializeCertificate (
|
||||
*p_certificate_id = nullptr;
|
||||
*p_has_private = false;
|
||||
|
||||
QStringList list = from.split (QStringLiteral("/"));
|
||||
const QStringList list = from.split (QStringLiteral("/"));
|
||||
|
||||
if (list.size () < 5) {
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, QStringLiteral("Invalid serialization"));
|
||||
|
@ -1085,7 +1085,7 @@ public:
|
||||
goto cleanup1;
|
||||
break;
|
||||
case publicTypeX509Chain:
|
||||
QStringList base64certs = config[QString::asprintf ("entry_%02d_public", i)].toString ().split (QStringLiteral("!"));
|
||||
const QStringList base64certs = config[QString::asprintf ("entry_%02d_public", i)].toString ().split (QStringLiteral("!"));
|
||||
|
||||
foreach (const QString &s, base64certs) {
|
||||
entry.chain += Certificate::fromDER (
|
||||
@ -1180,7 +1180,7 @@ private:
|
||||
|
||||
entry = SoftStoreEntry ();
|
||||
|
||||
QStringList list = serialized.split (QStringLiteral("/"));
|
||||
const QStringList list = serialized.split (QStringLiteral("/"));
|
||||
int n=0;
|
||||
|
||||
if (list.size () < 8) {
|
||||
|
@ -101,7 +101,7 @@ static CertificateInfo orderedToMap(const CertificateInfoOrdered &info)
|
||||
if(i.type().known() == EmailLegacy)
|
||||
{
|
||||
// de-dup
|
||||
QList<QString> emails = out.values(Email);
|
||||
const QList<QString> emails = out.values(Email);
|
||||
if(!emails.contains(i.value()))
|
||||
out.insert(Email, i.value());
|
||||
}
|
||||
@ -112,7 +112,7 @@ static CertificateInfo orderedToMap(const CertificateInfoOrdered &info)
|
||||
|
||||
static void moveMapValues(CertificateInfo *from, CertificateInfoOrdered *to, const CertificateInfoType &type)
|
||||
{
|
||||
QList<QString> values = from->values(type);
|
||||
const QList<QString> values = from->values(type);
|
||||
from->remove(type);
|
||||
|
||||
// multimap values are stored in reverse. we'll insert backwards in
|
||||
@ -140,7 +140,7 @@ static CertificateInfoOrdered mapToOrdered(const CertificateInfo &info)
|
||||
moveMapValues(&in, &out, XMPP);
|
||||
|
||||
// get remaining types
|
||||
QList<CertificateInfoType> typesLeft = in.keys();
|
||||
const QList<CertificateInfoType> typesLeft = in.keys();
|
||||
|
||||
// dedup
|
||||
QList<CertificateInfoType> types;
|
||||
@ -461,7 +461,7 @@ static QString uniqueSubjectValue(const CertificateInfoType &type, const QList<i
|
||||
if(n == items[i])
|
||||
continue;
|
||||
|
||||
QStringList other_vals = certs[n].subjectInfo().values(type);
|
||||
const QStringList other_vals = certs[n].subjectInfo().values(type);
|
||||
for(int k = 0; k < vals.count(); ++k)
|
||||
{
|
||||
if(other_vals.contains(vals[k]))
|
||||
@ -671,7 +671,7 @@ QStringList makeFriendlyNames(const QList<Certificate> &list)
|
||||
foreach(const QString &name, names)
|
||||
{
|
||||
// anyone else using this name?
|
||||
QList<int> items = findSameName(name, names);
|
||||
const QList<int> items = findSameName(name, names);
|
||||
if(items.count() > 1)
|
||||
{
|
||||
// don't save duplicate collisions
|
||||
@ -1201,7 +1201,7 @@ static QByteArray ipaddr_str2bin(const QString &str)
|
||||
// ipv6
|
||||
if(str.contains(QLatin1Char(':')))
|
||||
{
|
||||
QStringList parts = str.split(QLatin1Char(':'), QString::KeepEmptyParts);
|
||||
const QStringList parts = str.split(QLatin1Char(':'), QString::KeepEmptyParts);
|
||||
if(parts.count() < 3 || parts.count() > 8)
|
||||
return QByteArray();
|
||||
|
||||
@ -1273,7 +1273,7 @@ static QByteArray ipaddr_str2bin(const QString &str)
|
||||
}
|
||||
else if(str.contains(QLatin1Char('.')))
|
||||
{
|
||||
QStringList parts = str.split(QLatin1Char('.'), QString::KeepEmptyParts);
|
||||
const QStringList parts = str.split(QLatin1Char('.'), QString::KeepEmptyParts);
|
||||
if(parts.count() != 4)
|
||||
return QByteArray();
|
||||
|
||||
@ -1329,7 +1329,7 @@ static bool cert_match_domain(const QString &certname, const QString &acedomain)
|
||||
if(parts_name.count() >= 2 && parts_name[parts_name.count()-2].contains(QLatin1Char('*')))
|
||||
return false;
|
||||
|
||||
QStringList parts_compare = acedomain.split(QLatin1Char('.'), QString::KeepEmptyParts);
|
||||
const QStringList parts_compare = acedomain.split(QLatin1Char('.'), QString::KeepEmptyParts);
|
||||
if(parts_compare.isEmpty())
|
||||
return false;
|
||||
|
||||
@ -1575,7 +1575,7 @@ QByteArray Certificate::issuerKeyId() const
|
||||
|
||||
Validity Certificate::validate(const CertificateCollection &trusted, const CertificateCollection &untrusted, UsageMode u, ValidateFlags vf) const
|
||||
{
|
||||
QList<Certificate> issuers = trusted.certificates() + untrusted.certificates();
|
||||
const QList<Certificate> issuers = trusted.certificates() + untrusted.certificates();
|
||||
CertificateChain chain;
|
||||
chain += *this;
|
||||
Validity result;
|
||||
|
@ -567,12 +567,12 @@ static QVariantMap readConfig(const QString &name)
|
||||
{
|
||||
QSettings settings(QStringLiteral("Affinix"), QStringLiteral("QCA2"));
|
||||
settings.beginGroup(QStringLiteral("ProviderConfig"));
|
||||
QStringList providerNames = settings.value(QStringLiteral("providerNames")).toStringList();
|
||||
const QStringList providerNames = settings.value(QStringLiteral("providerNames")).toStringList();
|
||||
if(!providerNames.contains(name))
|
||||
return QVariantMap();
|
||||
|
||||
settings.beginGroup(name);
|
||||
QStringList keys = settings.childKeys();
|
||||
const QStringList keys = settings.childKeys();
|
||||
QVariantMap map;
|
||||
foreach(const QString &key, keys)
|
||||
map[key] = settings.value(key);
|
||||
@ -742,7 +742,7 @@ bool haveSystemStore()
|
||||
KeyStoreManager ksm;
|
||||
ksm.waitForBusyFinished();
|
||||
|
||||
QStringList list = ksm.keyStores();
|
||||
const QStringList list = ksm.keyStores();
|
||||
for(int n = 0; n < list.count(); ++n)
|
||||
{
|
||||
KeyStore ks(list[n], &ksm);
|
||||
@ -760,7 +760,7 @@ CertificateCollection systemStore()
|
||||
ksm.waitForBusyFinished();
|
||||
|
||||
CertificateCollection col;
|
||||
QStringList list = ksm.keyStores();
|
||||
const QStringList list = ksm.keyStores();
|
||||
for(int n = 0; n < list.count(); ++n)
|
||||
{
|
||||
KeyStore ks(list[n], &ksm);
|
||||
@ -769,7 +769,7 @@ CertificateCollection systemStore()
|
||||
if(ks.type() == KeyStore::System && ks.holdsTrustedCertificates())
|
||||
{
|
||||
// extract contents
|
||||
QList<KeyStoreEntry> entries = ks.entryList();
|
||||
const QList<KeyStoreEntry> entries = ks.entryList();
|
||||
for(int i = 0; i < entries.count(); ++i)
|
||||
{
|
||||
if(entries[i].type() == KeyStoreEntry::TypeCertificate)
|
||||
@ -1835,7 +1835,7 @@ void handler_remove(HandlerBase *h)
|
||||
if(at == -1)
|
||||
return;
|
||||
|
||||
QList<int> ids = g_event->handlers[at].ids;
|
||||
const QList<int> ids = g_event->handlers[at].ids;
|
||||
g_event->handlers.removeAt(at);
|
||||
|
||||
// adjust handler positions within askers
|
||||
|
@ -1134,7 +1134,7 @@ public:
|
||||
}
|
||||
|
||||
#ifdef FRIENDLY_NAMES
|
||||
QStringList names = makeFriendlyNames(certs);
|
||||
const QStringList names = makeFriendlyNames(certs);
|
||||
#endif
|
||||
for(int n = 0; n < certs.count(); ++n)
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ public Q_SLOTS:
|
||||
if(at == -1)
|
||||
return out;
|
||||
Item &i = items[at];
|
||||
QList<KeyStoreEntryContext*> list = i.owner->entryList(i.storeContextId);
|
||||
const QList<KeyStoreEntryContext*> list = i.owner->entryList(i.storeContextId);
|
||||
for(int n = 0; n < list.count(); ++n)
|
||||
{
|
||||
KeyStoreEntry entry;
|
||||
@ -431,7 +431,7 @@ private:
|
||||
|
||||
QMutexLocker locker(&m);
|
||||
|
||||
QList<int> keyStores = c->keyStores();
|
||||
const QList<int> keyStores = c->keyStores();
|
||||
|
||||
// remove any contexts that are gone
|
||||
for(int n = 0; n < items.count(); ++n)
|
||||
@ -856,7 +856,7 @@ private Q_SLOTS:
|
||||
void ks_updated()
|
||||
{
|
||||
bool found = false;
|
||||
QList<KeyStoreEntry> list = ks->entryList();
|
||||
const QList<KeyStoreEntry> list = ks->entryList();
|
||||
foreach(const KeyStoreEntry &e, list)
|
||||
{
|
||||
if(e.id() == entryId && e.isAvailable())
|
||||
@ -1461,7 +1461,7 @@ public:
|
||||
QPointer<QObject> self(this);
|
||||
|
||||
bool newbusy = KeyStoreTracker::instance()->isBusy();
|
||||
QList<KeyStoreTracker::Item> newitems = KeyStoreTracker::instance()->getItems();
|
||||
const QList<KeyStoreTracker::Item> newitems = KeyStoreTracker::instance()->getItems();
|
||||
|
||||
if(!busy && newbusy)
|
||||
{
|
||||
@ -1515,7 +1515,7 @@ public:
|
||||
// added
|
||||
for(int n = 0; n < newitems.count(); ++n)
|
||||
{
|
||||
KeyStoreTracker::Item &i = newitems[n];
|
||||
const KeyStoreTracker::Item &i = newitems[n];
|
||||
bool found = false;
|
||||
for(int k = 0; k < items.count(); ++k)
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ void ProviderManager::scan()
|
||||
continue;
|
||||
}
|
||||
|
||||
QStringList entryList = dir.entryList(QDir::Files);
|
||||
const QStringList entryList = dir.entryList(QDir::Files);
|
||||
if(entryList.isEmpty())
|
||||
{
|
||||
logDebug(QStringLiteral(" (No files in 'crypto' subdirectory)"));
|
||||
@ -612,7 +612,7 @@ Provider *ProviderManager::findFor(const QString &name, const QString &type) con
|
||||
if(name.isEmpty())
|
||||
{
|
||||
providerMutex.lock();
|
||||
QList<ProviderItem*> list = providerItemList;
|
||||
const QList<ProviderItem*> list = providerItemList;
|
||||
providerMutex.unlock();
|
||||
|
||||
// find the first one that can do it
|
||||
@ -697,7 +697,7 @@ QStringList ProviderManager::allFeatures() const
|
||||
featureList = p->features();
|
||||
|
||||
providerMutex.lock();
|
||||
QList<ProviderItem*> list = providerItemList;
|
||||
const QList<ProviderItem*> list = providerItemList;
|
||||
providerMutex.unlock();
|
||||
for(int n = 0; n < list.count(); ++n)
|
||||
{
|
||||
@ -797,7 +797,7 @@ void ProviderManager::mergeFeatures(QStringList *a, const QStringList &b)
|
||||
|
||||
int ProviderManager::get_default_priority(const QString &name) const
|
||||
{
|
||||
QStringList list = plugin_priorities(def);
|
||||
const QStringList list = plugin_priorities(def);
|
||||
foreach(const QString &s, list)
|
||||
{
|
||||
// qca_default already sanity checks the strings
|
||||
|
@ -314,7 +314,7 @@ QList<T> getList(const QString &provider)
|
||||
ProviderList pl = allProviders();
|
||||
for(int n = 0; n < pl.count(); ++n)
|
||||
{
|
||||
QList<T> other = G::getList(pl[n]);
|
||||
const QList<T> other = G::getList(pl[n]);
|
||||
for(int k = 0; k < other.count(); ++k)
|
||||
{
|
||||
// only add what we don't have in the list
|
||||
|
@ -138,7 +138,7 @@ static void output_plugin_diagnostic_text()
|
||||
QCA::clearPluginDiagnosticText();
|
||||
if(str[str.length()-1] == QLatin1Char('\n'))
|
||||
str.truncate(str.length()-1);
|
||||
QStringList lines = str.split(QLatin1Char('\n'), QString::KeepEmptyParts);
|
||||
const QStringList lines = str.split(QLatin1Char('\n'), QString::KeepEmptyParts);
|
||||
for(int n = 0; n < lines.count(); ++n)
|
||||
fprintf(stderr, "plugin: %s\n", qPrintable(lines[n]));
|
||||
}
|
||||
@ -149,7 +149,7 @@ static void output_keystore_diagnostic_text()
|
||||
QCA::KeyStoreManager::clearDiagnosticText();
|
||||
if(str[str.length()-1] == QLatin1Char('\n'))
|
||||
str.truncate(str.length()-1);
|
||||
QStringList lines = str.split(QLatin1Char('\n'), QString::KeepEmptyParts);
|
||||
const QStringList lines = str.split(QLatin1Char('\n'), QString::KeepEmptyParts);
|
||||
for(int n = 0; n < lines.count(); ++n)
|
||||
fprintf(stderr, "keystore: %s\n", qPrintable(lines[n]));
|
||||
}
|
||||
@ -159,7 +159,7 @@ static void output_message_diagnostic_text(QCA::SecureMessage *msg)
|
||||
QString str = msg->diagnosticText();
|
||||
if(str[str.length()-1] == QLatin1Char('\n'))
|
||||
str.truncate(str.length()-1);
|
||||
QStringList lines = str.split(QLatin1Char('\n'), QString::KeepEmptyParts);
|
||||
const QStringList lines = str.split(QLatin1Char('\n'), QString::KeepEmptyParts);
|
||||
for(int n = 0; n < lines.count(); ++n)
|
||||
fprintf(stderr, "message: %s\n", qPrintable(lines[n]));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user