diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2019-05-28 11:53:05 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-05-28 14:46:18 +0200 |
commit | a3b931e7c4a5702da5fd99df0746f9ff511b7fdc (patch) | |
tree | 2d9d38bafb319c29000120b1fd254bf965327468 /src/network | |
parent | 3af85b92d7ae19cc229ebccb3291799c4d9b23cf (diff) |
Construct from an array instead of assigning just past a string's end
Assigning past the end used to be supported, but isn't a good way to
do the job. Exposed by a qtxmlpatterns test that exercised this code,
which gets a warning thanks to Giuseppe's recent changes to QCharRef.
Task-number: QTBUG-76070
Change-Id: Ic254c7ffce60e3b2aafce76ab03ea5db8c68fafc
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qftp.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index b6b721030b..cc230a5411 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -955,11 +955,9 @@ void QFtpPI::readyRead() } } } - QString endOfMultiLine; - endOfMultiLine[0] = '0' + replyCode[0]; - endOfMultiLine[1] = '0' + replyCode[1]; - endOfMultiLine[2] = '0' + replyCode[2]; - endOfMultiLine[3] = QLatin1Char(' '); + const char count[4] = { char('0' + replyCode[0]), char('0' + replyCode[1]), + char('0' + replyCode[2]), char(' ') }; + QString endOfMultiLine(QLatin1String(count, 4)); QString lineCont(endOfMultiLine); lineCont[3] = QLatin1Char('-'); QStringRef lineLeft4 = line.leftRef(4); |