QProcess(Win): change int to qsizetype where appropriate

Even if it's unlikely any of those would exceed 2 billion entries.

Change-Id: Ib0d4d4e7a64fcde03b7f24bc0667d63c4a737deb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d32fb5f1fe1abf6436ae14ac219dc05b8eb04098)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2022-02-04 10:20:41 +01:00 committed by Qt Cherry-pick Bot
parent 113cf22885
commit b3e9d74162

View File

@ -409,15 +409,15 @@ static QString qt_create_commandline(const QString &program, const QStringList &
args = programName + QLatin1Char(' ');
}
for (int i=0; i<arguments.size(); ++i) {
for (qsizetype i = 0; i < arguments.size(); ++i) {
QString tmp = arguments.at(i);
// Quotes are escaped and their preceding backslashes are doubled.
int index = tmp.indexOf(QLatin1Char('"'));
qsizetype index = tmp.indexOf(QLatin1Char('"'));
while (index >= 0) {
// Escape quote
tmp.insert(index++, QLatin1Char('\\'));
// Double preceding backslashes (ignoring the one we just inserted)
for (int i = index - 2 ; i >= 0 && tmp.at(i) == QLatin1Char('\\') ; --i) {
for (qsizetype i = index - 2 ; i >= 0 && tmp.at(i) == QLatin1Char('\\') ; --i) {
tmp.insert(i, QLatin1Char('\\'));
index++;
}
@ -427,7 +427,7 @@ static QString qt_create_commandline(const QString &program, const QStringList &
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
// rather use "foo"\ than "foo\"
int i = tmp.length();
qsizetype i = tmp.length();
while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\'))
--i;
tmp.insert(i, QLatin1Char('"'));