Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: native_client_sdk/src/libraries/nacl_io/path.cc

Issue 303223007: [NaCl SDK] nacl_io: Run clang-format over nacl_io sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/libraries/nacl_io/path.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/path.cc b/native_client_sdk/src/libraries/nacl_io/path.cc
index 4989d515ecb922ef206537a02056dadeacc15836..0a64a15ebce411f35d83c3bcc2fe1da7bd5cd72d 100644
--- a/native_client_sdk/src/libraries/nacl_io/path.cc
+++ b/native_client_sdk/src/libraries/nacl_io/path.cc
@@ -12,7 +12,8 @@
namespace nacl_io {
-Path::Path() {}
+Path::Path() {
+}
Path::Path(const Path& path) {
paths_ = path.paths_;
@@ -22,7 +23,8 @@ Path::Path(const std::string& path) {
Set(path);
}
-Path::~Path() {}
+Path::~Path() {
+}
bool Path::IsAbsolute() const {
return !paths_.empty() && paths_[0] == "/";
@@ -45,7 +47,8 @@ Path& Path::Append(const std::string& path) {
for (size_t index = 0; index < paths.size(); index++) {
// Skip ROOT
- if (paths_.size() && index == 0 && paths[0] == "/") continue;
+ if (paths_.size() && index == 0 && paths[0] == "/")
+ continue;
paths_.push_back(paths[index]);
}
@@ -58,7 +61,8 @@ Path& Path::Prepend(const std::string& path) {
for (size_t index = 0; index < paths_.size(); index++) {
// Skip ROOT
- if (index == 0 && paths_[0] == "/") continue;
+ if (index == 0 && paths_[0] == "/")
+ continue;
paths.push_back(paths[index]);
}
paths_ = Normalize(paths);
@@ -74,12 +78,14 @@ Path& Path::Set(const std::string& path) {
Path Path::Parent() const {
Path out;
out.paths_ = paths_;
- if (out.paths_.size()) out.paths_.pop_back();
+ if (out.paths_.size())
+ out.paths_.pop_back();
return out;
}
std::string Path::Basename() const {
- if (paths_.size()) return paths_.back();
+ if (paths_.size())
+ return paths_.back();
return std::string();
}
@@ -100,14 +106,16 @@ StringArray_t Path::Normalize(const StringArray_t& paths) {
StringArray_t path_out;
for (size_t index = 0; index < paths.size(); index++) {
- const std::string &curr = paths[index];
+ const std::string& curr = paths[index];
// Check if '/' was used excessively in the path.
// For example, in cd Desktop/////
- if (curr == "/" && index != 0) continue;
+ if (curr == "/" && index != 0)
+ continue;
// Check for '.' in the path and remove it
- if (curr == ".") continue;
+ if (curr == ".")
+ continue;
// Check for '..'
if (curr == "..") {
@@ -137,7 +145,8 @@ StringArray_t Path::Normalize(const StringArray_t& paths) {
}
// If the path was valid, but now it's empty, return self
- if (path_out.size() == 0) path_out.push_back(".");
+ if (path_out.size() == 0)
+ path_out.push_back(".");
return path_out;
}
@@ -152,7 +161,8 @@ std::string Path::Range(const StringArray_t& paths, size_t start, size_t end) {
std::string out_path;
size_t index = start;
- if (end > paths.size()) end = paths.size();
+ if (end > paths.size())
+ end = paths.size();
// If this is an absolute path, paths[0] == "/". In this case, we don't want
// to add an additional / separator.
@@ -182,20 +192,21 @@ StringArray_t Path::Split(const std::string& path) {
// Copy path_split to components, removing empty path segments.
for (StringArray_t::const_iterator it = path_split.begin();
- it != path_split.end(); ++it) {
- if (!it->empty()) components.push_back(*it);
+ it != path_split.end();
+ ++it) {
+ if (!it->empty())
+ components.push_back(*it);
}
return components;
}
-Path& Path::operator =(const Path& p) {
+Path& Path::operator=(const Path& p) {
paths_ = p.paths_;
return *this;
}
-Path& Path::operator =(const std::string& p) {
+Path& Path::operator=(const std::string& p) {
return Set(p);
}
} // namespace nacl_io
-
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/path.h ('k') | native_client_sdk/src/libraries/nacl_io/pepper/all_interfaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698