Tidy up some local variables in QSettingsPrivate::iniEscapedString()

A loop variable could just as well be declared in the loop.
The startPos variable sits more naturally just before its first use
than where the removal of the loop variable's declaration left it
isolated.

Change-Id: I4754b9dfe4b142e5a183a0d9555c9d3237bc6bbd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Edward Welbourne 2022-04-07 17:07:34 +02:00
parent 6c5dac1685
commit 3962a194d9

View File

@ -636,14 +636,13 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result)
&& !str.startsWith("@Variant("_L1)
&& !str.startsWith("@DateTime("_L1);
qsizetype i;
qsizetype startPos = result.size();
QStringEncoder toUtf8(QStringEncoder::Utf8);
qsizetype startPos = result.size();
result.reserve(startPos + str.size() * 3 / 2);
const QChar *unicode = str.unicode();
for (i = 0; i < str.size(); ++i) {
for (qsizetype i = 0; i < str.size(); ++i) {
uint ch = unicode[i].unicode();
if (ch == ';' || ch == ',' || ch == '=')
needsQuotes = true;