summaryrefslogtreecommitdiff
path: root/src/plugins/beautifier
diff options
context:
space:
mode:
authorLorenz Haas <lorenz.haas@histomatics.de>2017-02-23 22:52:38 +0100
committerLorenz Haas <lorenz.haas@histomatics.de>2017-02-25 11:12:58 +0000
commitb72fa1f3594ff33a87b26b62ea8d425646bf0907 (patch)
treeed92dd387e9470bd7a68793bdd5cb0dbc86a0f62 /src/plugins/beautifier
parent0264053d9bb7bbffb8ff362157ceab1acf244c13 (diff)
downloadqt-creator-b72fa1f3594ff33a87b26b62ea8d425646bf0907.tar.gz
Beautifier: Simplify small code fragment
Change-Id: I906d7803ccc6856b09fc25fdea7c7c3d112f4e77 Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/beautifier')
-rw-r--r--src/plugins/beautifier/beautifierplugin.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/plugins/beautifier/beautifierplugin.cpp b/src/plugins/beautifier/beautifierplugin.cpp
index 213b429049..ad052020f5 100644
--- a/src/plugins/beautifier/beautifierplugin.cpp
+++ b/src/plugins/beautifier/beautifierplugin.cpp
@@ -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;
}
}