diff --git a/runtime/bin/file.h b/runtime/bin/file.h index 7b6ea8c0965..50ad3b4efc1 100644 --- a/runtime/bin/file.h +++ b/runtime/bin/file.h @@ -109,8 +109,6 @@ class File { // Returns whether the file has been closed. bool IsClosed(); - const char* name() const { return name_; } - // Open the file with the given name. The file is always opened for // reading. If mode contains kWrite the file is opened for both // reading and writing. If mode contains kWrite and the file does @@ -139,12 +137,11 @@ class File { static Dart_Port GetServicePort(); private: - File(const char* name, FileHandle* handle) : name_(name), handle_(handle) { } + explicit File(FileHandle* handle) : handle_(handle) { } void Close(); static const int kClosedFd = -1; - const char* name_; // FileHandle is an OS specific class which stores data about the file. FileHandle* handle_; // OS specific handle for the file. diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc index a6f04d48fa3..77665e6f8c0 100644 --- a/runtime/bin/file_android.cc +++ b/runtime/bin/file_android.cc @@ -125,13 +125,13 @@ File* File::Open(const char* name, FileOpenMode mode) { return NULL; } } - return new File(name, new FileHandle(fd)); + return new File(new FileHandle(fd)); } File* File::OpenStdio(int fd) { if (fd < 0 || 2 < fd) return NULL; - return new File(NULL, new FileHandle(fd)); + return new File(new FileHandle(fd)); } diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc index a6f04d48fa3..77665e6f8c0 100644 --- a/runtime/bin/file_linux.cc +++ b/runtime/bin/file_linux.cc @@ -125,13 +125,13 @@ File* File::Open(const char* name, FileOpenMode mode) { return NULL; } } - return new File(name, new FileHandle(fd)); + return new File(new FileHandle(fd)); } File* File::OpenStdio(int fd) { if (fd < 0 || 2 < fd) return NULL; - return new File(NULL, new FileHandle(fd)); + return new File(new FileHandle(fd)); } diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc index 835b441184f..09138cff162 100644 --- a/runtime/bin/file_macos.cc +++ b/runtime/bin/file_macos.cc @@ -126,13 +126,13 @@ File* File::Open(const char* name, FileOpenMode mode) { return NULL; } } - return new File(name, new FileHandle(fd)); + return new File(new FileHandle(fd)); } File* File::OpenStdio(int fd) { if (fd < 0 || 2 < fd) return NULL; - return new File(NULL, new FileHandle(fd)); + return new File(new FileHandle(fd)); } diff --git a/runtime/bin/file_test.cc b/runtime/bin/file_test.cc index da97b246a75..5765cf22d5d 100644 --- a/runtime/bin/file_test.cc +++ b/runtime/bin/file_test.cc @@ -24,7 +24,6 @@ UNIT_TEST_CASE(Read) { const char* kFilename = GetFileName("runtime/bin/file_test.cc"); File* file = File::Open(kFilename, File::kRead); EXPECT(file != NULL); - EXPECT_STREQ(kFilename, file->name()); char buffer[16]; buffer[0] = '\0'; EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true. diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc index 9076d7a2c41..d32d1074c90 100644 --- a/runtime/bin/file_win.cc +++ b/runtime/bin/file_win.cc @@ -114,7 +114,7 @@ File* File::Open(const char* name, FileOpenMode mode) { return NULL; } } - return new File(name, new FileHandle(fd)); + return new File(new FileHandle(fd)); }