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

Unified Diff: runtime/bin/file_android.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/file_fuchsia.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_android.cc
diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc
index a636c3edcaa2a16828ec5aef3c707eca6d82543d..139ac7ff6fe281d4728f528cc0a60e10059653e7 100644
--- a/runtime/bin/file_android.cc
+++ b/runtime/bin/file_android.cc
@@ -39,7 +39,6 @@ class FileHandle {
DISALLOW_COPY_AND_ASSIGN(FileHandle);
};
-
File::~File() {
if (!IsClosed()) {
Close();
@@ -47,7 +46,6 @@ File::~File() {
delete handle_;
}
-
void File::Close() {
ASSERT(handle_->fd() >= 0);
if (handle_->fd() == STDOUT_FILENO) {
@@ -68,17 +66,14 @@ void File::Close() {
handle_->set_fd(kClosedFd);
}
-
intptr_t File::GetFD() {
return handle_->fd();
}
-
bool File::IsClosed() {
return handle_->fd() == kClosedFd;
}
-
MappedMemory* File::Map(MapType type, int64_t position, int64_t length) {
ASSERT(handle_->fd() >= 0);
ASSERT(length > 0);
@@ -100,7 +95,6 @@ MappedMemory* File::Map(MapType type, int64_t position, int64_t length) {
return new MappedMemory(addr, length);
}
-
void MappedMemory::Unmap() {
int result = munmap(address_, size_);
ASSERT(result == 0);
@@ -108,19 +102,16 @@ void MappedMemory::Unmap() {
size_ = 0;
}
-
int64_t File::Read(void* buffer, int64_t num_bytes) {
ASSERT(handle_->fd() >= 0);
return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes));
}
-
int64_t File::Write(const void* buffer, int64_t num_bytes) {
ASSERT(handle_->fd() >= 0);
return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes));
}
-
bool File::VPrint(const char* format, va_list args) {
// Measure.
va_list measure_args;
@@ -141,31 +132,26 @@ bool File::VPrint(const char* format, va_list args) {
return result;
}
-
int64_t File::Position() {
ASSERT(handle_->fd() >= 0);
return NO_RETRY_EXPECTED(lseek64(handle_->fd(), 0, SEEK_CUR));
}
-
bool File::SetPosition(int64_t position) {
ASSERT(handle_->fd() >= 0);
return NO_RETRY_EXPECTED(lseek64(handle_->fd(), position, SEEK_SET)) >= 0;
}
-
bool File::Truncate(int64_t length) {
ASSERT(handle_->fd() >= 0);
return TEMP_FAILURE_RETRY(ftruncate(handle_->fd(), length) != -1);
}
-
bool File::Flush() {
ASSERT(handle_->fd() >= 0);
return NO_RETRY_EXPECTED(fsync(handle_->fd()) != -1);
}
-
bool File::Lock(File::LockType lock, int64_t start, int64_t end) {
ASSERT(handle_->fd() >= 0);
ASSERT((end == -1) || (end > start));
@@ -196,7 +182,6 @@ bool File::Lock(File::LockType lock, int64_t start, int64_t end) {
return TEMP_FAILURE_RETRY(fcntl(handle_->fd(), cmd, &fl)) != -1;
}
-
int64_t File::Length() {
ASSERT(handle_->fd() >= 0);
struct stat st;
@@ -206,13 +191,11 @@ int64_t File::Length() {
return -1;
}
-
File* File::FileOpenW(const wchar_t* system_name, FileOpenMode mode) {
UNREACHABLE();
return NULL;
}
-
File* File::Open(const char* name, FileOpenMode mode) {
// Report errors for non-regular files.
struct stat st;
@@ -249,12 +232,10 @@ File* File::Open(const char* name, FileOpenMode mode) {
return new File(new FileHandle(fd));
}
-
File* File::OpenStdio(int fd) {
return ((fd < 0) || (2 < fd)) ? NULL : new File(new FileHandle(fd));
}
-
bool File::Exists(const char* name) {
struct stat st;
if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
@@ -265,7 +246,6 @@ bool File::Exists(const char* name) {
}
}
-
bool File::Create(const char* name) {
int fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_CREAT | O_CLOEXEC, 0666));
if (fd < 0) {
@@ -289,13 +269,11 @@ bool File::Create(const char* name) {
return is_file;
}
-
bool File::CreateLink(const char* name, const char* target) {
int status = NO_RETRY_EXPECTED(symlink(target, name));
return (status == 0);
}
-
File::Type File::GetType(const char* pathname, bool follow_links) {
struct stat entry_info;
int stat_success;
@@ -319,7 +297,6 @@ File::Type File::GetType(const char* pathname, bool follow_links) {
return File::kDoesNotExist;
}
-
static bool CheckTypeAndSetErrno(const char* name,
File::Type expected,
bool follow_links) {
@@ -341,31 +318,26 @@ static bool CheckTypeAndSetErrno(const char* name,
return false;
}
-
bool File::Delete(const char* name) {
return CheckTypeAndSetErrno(name, kIsFile, true) &&
(NO_RETRY_EXPECTED(unlink(name)) == 0);
}
-
bool File::DeleteLink(const char* name) {
return CheckTypeAndSetErrno(name, kIsLink, false) &&
(NO_RETRY_EXPECTED(unlink(name)) == 0);
}
-
bool File::Rename(const char* old_path, const char* new_path) {
return CheckTypeAndSetErrno(old_path, kIsFile, true) &&
(NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0);
}
-
bool File::RenameLink(const char* old_path, const char* new_path) {
return CheckTypeAndSetErrno(old_path, kIsLink, false) &&
(NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0);
}
-
bool File::Copy(const char* old_path, const char* new_path) {
if (!CheckTypeAndSetErrno(old_path, kIsFile, true)) {
return false;
@@ -416,7 +388,6 @@ bool File::Copy(const char* old_path, const char* new_path) {
return true;
}
-
static bool StatHelper(const char* name, struct stat* st) {
if (NO_RETRY_EXPECTED(stat(name, st)) != 0) {
return false;
@@ -430,7 +401,6 @@ static bool StatHelper(const char* name, struct stat* st) {
return true;
}
-
int64_t File::LengthFromPath(const char* name) {
struct stat st;
if (!StatHelper(name, &st)) {
@@ -439,7 +409,6 @@ int64_t File::LengthFromPath(const char* name) {
return st.st_size;
}
-
void File::Stat(const char* name, int64_t* data) {
struct stat st;
if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
@@ -462,7 +431,6 @@ void File::Stat(const char* name, int64_t* data) {
}
}
-
time_t File::LastModified(const char* name) {
struct stat st;
if (!StatHelper(name, &st)) {
@@ -471,7 +439,6 @@ time_t File::LastModified(const char* name) {
return st.st_mtime;
}
-
time_t File::LastAccessed(const char* name) {
struct stat st;
if (!StatHelper(name, &st)) {
@@ -480,7 +447,6 @@ time_t File::LastAccessed(const char* name) {
return st.st_atime;
}
-
bool File::SetLastAccessed(const char* name, int64_t millis) {
// First get the current times.
struct stat st;
@@ -495,7 +461,6 @@ bool File::SetLastAccessed(const char* name, int64_t millis) {
return utime(name, &times) == 0;
}
-
bool File::SetLastModified(const char* name, int64_t millis) {
// First get the current times.
struct stat st;
@@ -510,7 +475,6 @@ bool File::SetLastModified(const char* name, int64_t millis) {
return utime(name, &times) == 0;
}
-
const char* File::LinkTarget(const char* pathname) {
struct stat link_stats;
if (lstat(pathname, &link_stats) != 0) {
@@ -531,12 +495,10 @@ const char* File::LinkTarget(const char* pathname) {
return target_name;
}
-
bool File::IsAbsolutePath(const char* pathname) {
return ((pathname != NULL) && (pathname[0] == '/'));
}
-
const char* File::GetCanonicalPath(const char* pathname) {
char* abs_path = NULL;
if (pathname != NULL) {
@@ -551,17 +513,14 @@ const char* File::GetCanonicalPath(const char* pathname) {
return abs_path;
}
-
const char* File::PathSeparator() {
return "/";
}
-
const char* File::StringEscapedPathSeparator() {
return "/";
}
-
File::StdioHandleType File::GetStdioHandleType(int fd) {
ASSERT((0 <= fd) && (fd <= 2));
struct stat buf;
@@ -584,7 +543,6 @@ File::StdioHandleType File::GetStdioHandleType(int fd) {
return kOther;
}
-
File::Identical File::AreIdentical(const char* file_1, const char* file_2) {
struct stat file_1_info;
struct stat file_2_info;
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/file_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698