summaryrefslogtreecommitdiffstats
path: root/src/network/access/qftp.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-03-30 14:23:12 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-03-31 07:47:29 +0000
commit3cbe25c9a657b3fbefd194df5dd34a7cbabb9331 (patch)
tree6ff49a41111bf7060a1a928923e782aea72352b2 /src/network/access/qftp.cpp
parent5323ffed64215ede3c112f0efcb88e0be18f0982 (diff)
QtNetwork: use QStringRef to optimize memory allocation
Replace substring functions that return QString with corresponding functions that return QStringRef where it's possible. Create QString from QStringRef only where necessary. Change-Id: I697f776c60003629990cfd197534ffed63bafe2f Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/network/access/qftp.cpp')
-rw-r--r--src/network/access/qftp.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index 0c1e04efee..ac6a5f46b1 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -587,10 +587,10 @@ static void _q_parseDosDir(const QStringList &tokens, const QString &userName, Q
int permissions = QUrlInfo::ReadOwner | QUrlInfo::WriteOwner
| QUrlInfo::ReadGroup | QUrlInfo::WriteGroup
| QUrlInfo::ReadOther | QUrlInfo::WriteOther;
- QString ext;
+ QStringRef ext;
int extIndex = name.lastIndexOf(QLatin1Char('.'));
if (extIndex != -1)
- ext = name.mid(extIndex + 1);
+ ext = name.midRef(extIndex + 1);
if (ext == QLatin1String("exe") || ext == QLatin1String("bat") || ext == QLatin1String("com"))
permissions |= QUrlInfo::ExeOwner | QUrlInfo::ExeGroup | QUrlInfo::ExeOther;
info->setPermissions(permissions);
@@ -961,19 +961,19 @@ void QFtpPI::readyRead()
endOfMultiLine[3] = QLatin1Char(' ');
QString lineCont(endOfMultiLine);
lineCont[3] = QLatin1Char('-');
- QString lineLeft4 = line.left(4);
+ QStringRef lineLeft4 = line.leftRef(4);
while (lineLeft4 != endOfMultiLine) {
if (lineLeft4 == lineCont)
- replyText += line.mid(4); // strip 'xyz-'
+ replyText += line.midRef(4); // strip 'xyz-'
else
replyText += line;
if (!commandSocket.canReadLine())
return;
line = QString::fromLatin1(commandSocket.readLine());
- lineLeft4 = line.left(4);
+ lineLeft4 = line.leftRef(4);
}
- replyText += line.mid(4); // strip reply code 'xyz '
+ replyText += line.midRef(4); // strip reply code 'xyz '
if (replyText.endsWith(QLatin1String("\r\n")))
replyText.chop(2);
@@ -1089,7 +1089,7 @@ bool QFtpPI::processReply()
} else {
++portPos;
QChar delimiter = replyText.at(portPos);
- QStringList epsvParameters = replyText.mid(portPos).split(delimiter);
+ const auto epsvParameters = replyText.midRef(portPos).split(delimiter);
waitForDtpToConnect = true;
dtp.connectToHost(commandSocket.peerAddress().toString(),