QtCore: use QStringBuilder in more places
Change-Id: I1a2016039c6cfa35505b987b6d4627bf806500ba Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>bb10
parent
690f9a7e74
commit
5962c6e37e
|
|
@ -156,16 +156,8 @@ QStringList QProcessEnvironmentPrivate::toList() const
|
|||
{
|
||||
QStringList result;
|
||||
result.reserve(hash.size());
|
||||
Hash::ConstIterator it = hash.constBegin(),
|
||||
end = hash.constEnd();
|
||||
for ( ; it != end; ++it) {
|
||||
QString data = nameToString(it.key());
|
||||
QString value = valueToString(it.value());
|
||||
data.reserve(data.length() + value.length() + 1);
|
||||
data.append(QLatin1Char('='));
|
||||
data.append(value);
|
||||
result << data;
|
||||
}
|
||||
for (Hash::const_iterator it = hash.cbegin(), end = hash.cend(); it != end; ++it)
|
||||
result << nameToString(it.key()) + QLatin1Char('=') + valueToString(it.value());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,19 +99,14 @@ Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain)
|
|||
if (containsTLDEntry(domain))
|
||||
return true;
|
||||
|
||||
if (domain.contains(QLatin1Char('.'))) {
|
||||
int count = domain.size() - domain.indexOf(QLatin1Char('.'));
|
||||
QString wildCardDomain;
|
||||
wildCardDomain.reserve(count + 1);
|
||||
wildCardDomain.append(QLatin1Char('*'));
|
||||
wildCardDomain.append(domain.right(count));
|
||||
const int dot = domain.indexOf(QLatin1Char('.'));
|
||||
if (dot >= 0) {
|
||||
int count = domain.size() - dot;
|
||||
QString wildCardDomain = QLatin1Char('*') + domain.rightRef(count);
|
||||
// 2. if table contains '*.bar.com',
|
||||
// test if table contains '!foo.bar.com'
|
||||
if (containsTLDEntry(wildCardDomain)) {
|
||||
QString exceptionDomain;
|
||||
exceptionDomain.reserve(domain.size() + 1);
|
||||
exceptionDomain.append(QLatin1Char('!'));
|
||||
exceptionDomain.append(domain);
|
||||
QString exceptionDomain = QLatin1Char('!') + domain;
|
||||
return (! containsTLDEntry(exceptionDomain));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue