summaryrefslogtreecommitdiffstats
path: root/Source/cmProcessTools.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 14:34:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-16 20:05:19 (GMT)
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/cmProcessTools.cxx
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadCMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Source/cmProcessTools.cxx')
-rw-r--r--Source/cmProcessTools.cxx56
1 files changed, 24 insertions, 32 deletions
diff --git a/Source/cmProcessTools.cxx b/Source/cmProcessTools.cxx
index 41f6e26..446752e 100644
--- a/Source/cmProcessTools.cxx
+++ b/Source/cmProcessTools.cxx
@@ -13,74 +13,66 @@
#include <cmsys/Process.h>
-void cmProcessTools::RunProcess(struct cmsysProcess_s* cp,
- OutputParser* out, OutputParser* err)
+void cmProcessTools::RunProcess(struct cmsysProcess_s* cp, OutputParser* out,
+ OutputParser* err)
{
cmsysProcess_Execute(cp);
char* data = 0;
int length = 0;
int p;
- while((out||err) && (p=cmsysProcess_WaitForData(cp, &data, &length, 0), p))
- {
- if(out && p == cmsysProcess_Pipe_STDOUT)
- {
- if(!out->Process(data, length))
- {
+ while ((out || err) &&
+ (p = cmsysProcess_WaitForData(cp, &data, &length, 0), p)) {
+ if (out && p == cmsysProcess_Pipe_STDOUT) {
+ if (!out->Process(data, length)) {
out = 0;
- }
}
- else if(err && p == cmsysProcess_Pipe_STDERR)
- {
- if(!err->Process(data, length))
- {
+ } else if (err && p == cmsysProcess_Pipe_STDERR) {
+ if (!err->Process(data, length)) {
err = 0;
- }
}
}
+ }
cmsysProcess_WaitForExit(cp, 0);
}
-
-cmProcessTools::LineParser::LineParser(char sep, bool ignoreCR):
- Log(0), Prefix(0), Separator(sep), LineEnd('\0'), IgnoreCR(ignoreCR)
+cmProcessTools::LineParser::LineParser(char sep, bool ignoreCR)
+ : Log(0)
+ , Prefix(0)
+ , Separator(sep)
+ , LineEnd('\0')
+ , IgnoreCR(ignoreCR)
{
}
void cmProcessTools::LineParser::SetLog(std::ostream* log, const char* prefix)
{
this->Log = log;
- this->Prefix = prefix? prefix : "";
+ this->Prefix = prefix ? prefix : "";
}
bool cmProcessTools::LineParser::ProcessChunk(const char* first, int length)
{
const char* last = first + length;
- for(const char* c = first; c != last; ++c)
- {
- if(*c == this->Separator || *c == '\0')
- {
+ for (const char* c = first; c != last; ++c) {
+ if (*c == this->Separator || *c == '\0') {
this->LineEnd = *c;
// Log this line.
- if(this->Log && this->Prefix)
- {
+ if (this->Log && this->Prefix) {
*this->Log << this->Prefix << this->Line << "\n";
- }
+ }
// Hand this line to the subclass implementation.
- if(!this->ProcessLine())
- {
+ if (!this->ProcessLine()) {
this->Line = "";
return false;
- }
+ }
this->Line = "";
- }
- else if(*c != '\r' || !this->IgnoreCR)
- {
+ } else if (*c != '\r' || !this->IgnoreCR) {
// Append this character to the line under construction.
this->Line.append(1, *c);
- }
}
+ }
return true;
}