diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-08-07 10:57:31 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-08-12 14:46:20 +0200 |
commit | 7f4f346e51b0479a0ab0b927e586e6c626028b4b (patch) | |
tree | 8d0db57e3eb0cae44b65b76f36467acc197ccfcc /qmake | |
parent | e66f247ccf345f1d303a92e53c21bb53d96c5af2 (diff) |
Fix escaping of < and > in QMake's XML generator
Having those characters in QMAKE_EXTRA_COMPILERS broke the generated
VS project file. They must be replaced by XML entities.
Fixes: QTBUG-1935
Change-Id: Iff1edbeabec4cedef777071682412970b7769f19
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/xmloutput.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/qmake/generators/xmloutput.cpp b/qmake/generators/xmloutput.cpp index e92749a126..5d96128442 100644 --- a/qmake/generators/xmloutput.cpp +++ b/qmake/generators/xmloutput.cpp @@ -113,7 +113,8 @@ QString XmlOutput::doConversion(const QString &text) // this is a way to escape characters that shouldn't be converted for (int i=0; i<text.count(); ++i) { - if (text.at(i) == QLatin1Char('&')) { + const QChar c = text.at(i); + if (c == QLatin1Char('&')) { if ( (i + 7) < text.count() && text.at(i + 1) == QLatin1Char('#') && text.at(i + 2) == QLatin1Char('x') && @@ -122,12 +123,15 @@ QString XmlOutput::doConversion(const QString &text) } else { output += QLatin1String("&"); } + } else if (c == QLatin1Char('<')) { + output += QLatin1String("<"); + } else if (c == QLatin1Char('>')) { + output += QLatin1String(">"); } else { - QChar c = text.at(i); if (c.unicode() < 0x20) { output += QString("&#x%1;").arg(c.unicode(), 2, 16, QLatin1Char('0')); } else { - output += text.at(i); + output += c; } } } |