Skip to content

Commit

Permalink
Reformat C++ code (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
hlopko committed May 27, 2021
1 parent 7bf61a8 commit f079995
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion util/process_wrapper/process_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ int PW_MAIN(int argc, const CharType* argv[], const CharType* envp[]) {
}

// Have the last values added take precedence over the first.
// This is simpler than needing to track duplicates and explicitly override them.
// This is simpler than needing to track duplicates and explicitly override
// them.
std::reverse(environment_block.begin(), environment_block.end());

int exit_code = System::Exec(exec_path, arguments, environment_block,
Expand Down
2 changes: 1 addition & 1 deletion util/process_wrapper/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class System {
// It is meant to be called once during the lifetime of the parent process
static int Exec(const StrType& executable, const Arguments& arguments,
const EnvironmentBlock& environment_block,
const StrType& stdout_file,const StrType& stderr_file);
const StrType& stdout_file, const StrType& stderr_file);
};

} // namespace process_wrapper
Expand Down
6 changes: 3 additions & 3 deletions util/process_wrapper/system_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace process_wrapper {
namespace {

class OutputPipe {
public:
public:
static constexpr size_t kReadEndDesc = 0;
static constexpr size_t kWriteEndDesc = 1;

Expand Down Expand Up @@ -96,7 +96,7 @@ class OutputPipe {
return true;
}

private:
private:
void Close(size_t idx) {
if (output_pipe_desc_[idx] > 0) {
close(output_pipe_desc_[idx]);
Expand All @@ -106,7 +106,7 @@ class OutputPipe {
int output_pipe_desc_[2] = {-1};
};

} // namespace
} // namespace

System::StrType System::GetWorkingDirectory() {
const size_t kMaxBufferLength = 4096;
Expand Down
10 changes: 5 additions & 5 deletions util/process_wrapper/system_windows.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ std::string GetLastErrorAsStr() {
}

class OutputPipe {
public:
public:
static constexpr size_t kReadEndHandle = 0;
static constexpr size_t kWriteEndHandle = 1;

Expand Down Expand Up @@ -181,7 +181,7 @@ class OutputPipe {
return true;
}

private:
private:
void Close(size_t idx) {
if (output_pipe_handles_[idx] != nullptr) {
::CloseHandle(output_pipe_handles_[idx]);
Expand All @@ -191,7 +191,7 @@ class OutputPipe {
HANDLE output_pipe_handles_[2] = {nullptr};
};

} // namespace
} // namespace

System::StrType System::GetWorkingDirectory() {
constexpr DWORD kMaxBufferLength = 4096;
Expand Down Expand Up @@ -243,7 +243,7 @@ int System::Exec(const System::StrType& executable,
/*dwCreationFlags*/ 0
#if defined(UNICODE)
| CREATE_UNICODE_ENVIRONMENT
#endif // defined(UNICODE)
#endif // defined(UNICODE)
,
/*lpEnvironment*/ environment_block_win.empty()
? nullptr
Expand Down Expand Up @@ -277,4 +277,4 @@ int System::Exec(const System::StrType& executable,
return exit_status;
}

} // namespace process_wrapper
} // namespace process_wrapper
5 changes: 3 additions & 2 deletions util/process_wrapper/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ bool ReadFileToArray(const System::StrType& file_path,
}

// a \ at the end of a line allows us to escape the new line break,
// \\ yields a single \, so \\\ translates to a single \ and a new line escape
// \\ yields a single \, so \\\ translates to a single \ and a new line
// escape
int end_backslash_count = 0;
for (std::string::reverse_iterator rit = read_line.rbegin();
rit != read_line.rend() && *rit == '\\'; ++rit) {
Expand Down Expand Up @@ -98,6 +99,6 @@ bool ReadFileToArray(const System::StrType& file_path,
}
}
return true;
}
}

} // namespace process_wrapper

0 comments on commit f079995

Please sign in to comment.