Use appropriate encoding rather than UTF-8 when reading from a pipe
The qmake code to read output from dependency-generation was adding QByteArray values to a QString, thereby tacitly converting from UTF-8; this is misguided. Hopefully, the command emits its output in the same local 8-bit encoding that QString knows to convert from. Simplified needlessly verbose loops (that violated Qt coding style) in the process. Fixes: QTBUG-75904 Change-Id: I27cf81ffcb63ebc999b8e4fc57abdb9a68c4d2b3 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
0c9b449aa4
commit
14aa1f7d6f
@ -2002,14 +2002,11 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell);
|
||||
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
|
||||
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
|
||||
QString indeps;
|
||||
while(!feof(proc)) {
|
||||
int read_in = (int)fread(buff, 1, 255, proc);
|
||||
if(!read_in)
|
||||
break;
|
||||
indeps += QByteArray(buff, read_in);
|
||||
}
|
||||
QByteArray depData;
|
||||
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
|
||||
depData.append(buff, read_in);
|
||||
QT_PCLOSE(proc);
|
||||
const QString indeps = QString::fromLocal8Bit(depData);
|
||||
if(!indeps.isEmpty()) {
|
||||
QDir outDir(Option::output_dir);
|
||||
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
|
||||
@ -2090,14 +2087,11 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, out, LocalShell);
|
||||
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
|
||||
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
|
||||
QString indeps;
|
||||
while(!feof(proc)) {
|
||||
int read_in = (int)fread(buff, 1, 255, proc);
|
||||
if(!read_in)
|
||||
break;
|
||||
indeps += QByteArray(buff, read_in);
|
||||
}
|
||||
QByteArray depData;
|
||||
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
|
||||
depData.append(buff, read_in);
|
||||
QT_PCLOSE(proc);
|
||||
const QString indeps = QString::fromLocal8Bit(depData);
|
||||
if(!indeps.isEmpty()) {
|
||||
QDir outDir(Option::output_dir);
|
||||
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
|
||||
|
Loading…
Reference in New Issue
Block a user