Commit b72fa1f3 authored by Lorenz Haas's avatar Lorenz Haas

Beautifier: Simplify small code fragment

Change-Id: I906d7803ccc6856b09fc25fdea7c7c3d112f4e77
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent 0264053d
......@@ -148,20 +148,16 @@ FormatTask format(FormatTask task)
return task;
}
const bool addsNewline = task.command.pipeAddsNewline();
const bool returnsCRLF = task.command.returnsCRLF();
if (addsNewline || returnsCRLF) {
task.formattedData = QString::fromUtf8(process.readAllStandardOutput());
if (addsNewline && task.formattedData.endsWith('\n')) {
task.formattedData = QString::fromUtf8(process.readAllStandardOutput());
if (task.command.pipeAddsNewline() && task.formattedData.endsWith('\n')) {
task.formattedData.chop(1);
if (task.formattedData.endsWith('\r'))
task.formattedData.chop(1);
if (task.formattedData.endsWith('\r'))
task.formattedData.chop(1);
}
if (returnsCRLF)
task.formattedData.replace("\r\n", "\n");
return task;
}
task.formattedData = QString::fromUtf8(process.readAllStandardOutput());
if (task.command.returnsCRLF())
task.formattedData.replace("\r\n", "\n");
return task;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment