From 8226f869250a67e33e1f3b5ddba73975c85b6794 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 30 Jun 2011 19:04:24 +0200 Subject: fix argument quoting on windows quotes prefixed with multiple backslashes would not be escaped correctly. --- src/corelib/io/qprocess_win.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 1761c0e..dba3de4 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -256,10 +257,8 @@ static QString qt_create_commandline(const QString &program, const QStringList & for (int i=0; i Date: Thu, 30 Jun 2011 19:05:57 +0200 Subject: make argument quoting code on windows less arcane --- src/corelib/io/qprocess_win.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index dba3de4..510f723 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -263,16 +263,13 @@ 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\" - QString endQuote(QLatin1Char('\"')); int i = tmp.length(); - while (i>0 && tmp.at(i-1) == QLatin1Char('\\')) { + while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\')) --i; - endQuote += QLatin1Char('\\'); - } - args += QLatin1String(" \"") + tmp.left(i) + endQuote; - } else { - args += QLatin1Char(' ') + tmp; + tmp.insert(i, QLatin1Char('"')); + tmp.prepend(QLatin1Char('"')); } + args += QLatin1Char(' ') + tmp; } return args; } -- cgit v0.12