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

Unified Diff: runtime/bin/directory_macos.cc

Issue 2480793002: clang-format runtime/bin (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « runtime/bin/directory_linux.cc ('k') | runtime/bin/directory_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_macos.cc
diff --git a/runtime/bin/directory_macos.cc b/runtime/bin/directory_macos.cc
index 5c0f5a6efe02987b8d4363d5223d1a1d2198d9d1..18c254c09415d46495ed39022f720bed464c8318 100644
--- a/runtime/bin/directory_macos.cc
+++ b/runtime/bin/directory_macos.cc
@@ -7,12 +7,12 @@
#include "bin/directory.h"
-#include <dirent.h> // NOLINT
-#include <errno.h> // NOLINT
-#include <string.h> // NOLINT
+#include <dirent.h> // NOLINT
+#include <errno.h> // NOLINT
+#include <string.h> // NOLINT
#include <sys/param.h> // NOLINT
-#include <sys/stat.h> // NOLINT
-#include <unistd.h> // NOLINT
+#include <sys/stat.h> // NOLINT
+#include <unistd.h> // NOLINT
#include "bin/dartutils.h"
#include "bin/file.h"
@@ -56,13 +56,9 @@ const char* PathBuffer::AsScopedString() const {
bool PathBuffer::Add(const char* name) {
char* data = AsString();
- int written = snprintf(data + length_,
- PATH_MAX - length_,
- "%s",
- name);
+ int written = snprintf(data + length_, PATH_MAX - length_, "%s", name);
data[PATH_MAX] = '\0';
- if ((written <= PATH_MAX - length_) &&
- (written >= 0) &&
+ if ((written <= PATH_MAX - length_) && (written >= 0) &&
(static_cast<size_t>(written) == strlen(name))) {
length_ += written;
return true;
@@ -119,8 +115,8 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
int status = 0;
dirent entry;
dirent* result;
- status = NO_RETRY_EXPECTED(readdir_r(
- reinterpret_cast<DIR*>(lister_), &entry, &result));
+ status = NO_RETRY_EXPECTED(
+ readdir_r(reinterpret_cast<DIR*>(lister_), &entry, &result));
if ((status == 0) && (result != NULL)) {
if (!listing->path_buffer().Add(entry.d_name)) {
done_ = true;
@@ -139,8 +135,8 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
if (!listing->follow_links()) {
return kListLink;
}
- // Else fall through to next case.
- // Fall through.
+ // Else fall through to next case.
+ // Fall through.
case DT_UNKNOWN: {
// On some file systems the entry type is not determined by
// readdir_r. For those and for links we use stat to determine
@@ -155,9 +151,7 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
}
if (listing->follow_links() && S_ISLNK(entry_info.st_mode)) {
// Check to see if we are in a loop created by a symbolic link.
- LinkList current_link = { entry_info.st_dev,
- entry_info.st_ino,
- link_ };
+ LinkList current_link = {entry_info.st_dev, entry_info.st_ino, link_};
LinkList* previous = link_;
while (previous != NULL) {
if ((previous->dev == current_link.dev) &&
@@ -234,14 +228,12 @@ void DirectoryListingEntry::ResetLink() {
static bool DeleteRecursively(PathBuffer* path);
-static bool DeleteFile(char* file_name,
- PathBuffer* path) {
+static bool DeleteFile(char* file_name, PathBuffer* path) {
return path->Add(file_name) && (unlink(path->AsString()) == 0);
}
-static bool DeleteDir(char* dir_name,
- PathBuffer* path) {
+static bool DeleteDir(char* dir_name, PathBuffer* path) {
if ((strcmp(dir_name, ".") == 0) || (strcmp(dir_name, "..") == 0)) {
return true;
}
@@ -344,19 +336,14 @@ Directory::ExistsResult Directory::Exists(const char* dir_name) {
return DOES_NOT_EXIST;
}
} else {
- if ((errno == EACCES) ||
- (errno == EBADF) ||
- (errno == EFAULT) ||
- (errno == ENOMEM) ||
- (errno == EOVERFLOW)) {
+ if ((errno == EACCES) || (errno == EBADF) || (errno == EFAULT) ||
+ (errno == ENOMEM) || (errno == EOVERFLOW)) {
// Search permissions denied for one of the directories in the
// path or a low level error occured. We do not know if the
// directory exists.
return UNKNOWN;
}
- ASSERT((errno == ELOOP) ||
- (errno == ENAMETOOLONG) ||
- (errno == ENOENT) ||
+ ASSERT((errno == ELOOP) || (errno == ENAMETOOLONG) || (errno == ENOENT) ||
(errno == ENOTDIR));
return DOES_NOT_EXIST;
}
« no previous file with comments | « runtime/bin/directory_linux.cc ('k') | runtime/bin/directory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698