Handle QMAKE_SUBSTITUTES input files as Latin 1

QMake's strategy is generally "pretend everything is Latin 1", which
basically equals "do 8-bit pass-through". Change the handling of
QMAKE_SUBSTITUTES input accordingly to avoid conversion losses when
converting from and to UTF-8.

Fixes: QTBUG-72130
Change-Id: Id903bbd2afa99708c92fd09fab3db944aa819a94
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
Joerg Bornemann 2019-02-26 11:55:15 +01:00
parent f657c74263
commit 077e499304

View File

@ -532,7 +532,7 @@ MakefileGenerator::init()
QStack<int> state; QStack<int> state;
enum { IN_CONDITION, MET_CONDITION, PENDING_CONDITION }; enum { IN_CONDITION, MET_CONDITION, PENDING_CONDITION };
for (int count = 1; !in.atEnd(); ++count) { for (int count = 1; !in.atEnd(); ++count) {
QString line = QString::fromUtf8(in.readLine()); QString line = QString::fromLatin1(in.readLine());
if (line.startsWith("!!IF ")) { if (line.startsWith("!!IF ")) {
if (state.isEmpty() || state.top() == IN_CONDITION) { if (state.isEmpty() || state.top() == IN_CONDITION) {
QString test = line.mid(5, line.length()-(5+1)); QString test = line.mid(5, line.length()-(5+1));
@ -578,7 +578,7 @@ MakefileGenerator::init()
contents += project->expand(line, in.fileName(), count); contents += project->expand(line, in.fileName(), count);
} }
} }
contentBytes = contents.toUtf8(); contentBytes = contents.toLatin1();
} }
QFile out(outn); QFile out(outn);
QFileInfo outfi(out); QFileInfo outfi(out);