From a65ad229390742d08f2843140a7f992e3af0356f Mon Sep 17 00:00:00 2001 From: nisse Date: Tue, 13 Jun 2017 05:37:44 -0700 Subject: [PATCH] Delete unused method FilesystemInterface::GetFileTime. BUG=webrtc:6424 Review-Url: https://codereview.webrtc.org/2926713007 Cr-Commit-Position: refs/heads/master@{#18564} --- webrtc/base/fileutils.h | 11 ----------- webrtc/base/unixfilesystem.cc | 21 --------------------- webrtc/base/unixfilesystem.h | 3 --- webrtc/base/win32filesystem.cc | 22 ---------------------- webrtc/base/win32filesystem.h | 3 --- 5 files changed, 60 deletions(-) diff --git a/webrtc/base/fileutils.h b/webrtc/base/fileutils.h index 9f53ac33ac..00b4d8d263 100644 --- a/webrtc/base/fileutils.h +++ b/webrtc/base/fileutils.h @@ -74,8 +74,6 @@ class DirectoryIterator { #endif }; -enum FileTimeType { FTT_CREATED, FTT_MODIFIED, FTT_ACCESSED }; - class FilesystemInterface { public: virtual ~FilesystemInterface() {} @@ -114,10 +112,6 @@ class FilesystemInterface { // Determines the size of the file indicated by path. virtual bool GetFileSize(const Pathname& path, size_t* size) = 0; - - // Determines a timestamp associated with the file indicated by path. - virtual bool GetFileTime(const Pathname& path, FileTimeType which, - time_t* time) = 0; }; class Filesystem { @@ -176,11 +170,6 @@ class Filesystem { return EnsureDefaultFilesystem()->GetFileSize(path, size); } - static bool GetFileTime(const Pathname& path, FileTimeType which, - time_t* time) { - return EnsureDefaultFilesystem()->GetFileTime(path, which, time); - } - private: static FilesystemInterface* default_filesystem_; diff --git a/webrtc/base/unixfilesystem.cc b/webrtc/base/unixfilesystem.cc index d106bbd933..4901412486 100644 --- a/webrtc/base/unixfilesystem.cc +++ b/webrtc/base/unixfilesystem.cc @@ -218,27 +218,6 @@ bool UnixFilesystem::GetFileSize(const Pathname& pathname, size_t *size) { return true; } -bool UnixFilesystem::GetFileTime(const Pathname& path, FileTimeType which, - time_t* time) { - struct stat st; - if (::stat(path.pathname().c_str(), &st) != 0) - return false; - switch (which) { - case FTT_CREATED: - *time = st.st_ctime; - break; - case FTT_MODIFIED: - *time = st.st_mtime; - break; - case FTT_ACCESSED: - *time = st.st_atime; - break; - default: - return false; - } - return true; -} - char* UnixFilesystem::CopyString(const std::string& str) { size_t size = str.length() + 1; diff --git a/webrtc/base/unixfilesystem.h b/webrtc/base/unixfilesystem.h index 457cbcaff6..742f4c23a3 100644 --- a/webrtc/base/unixfilesystem.h +++ b/webrtc/base/unixfilesystem.h @@ -72,9 +72,6 @@ class UnixFilesystem : public FilesystemInterface { const std::string* append) override; bool GetFileSize(const Pathname& path, size_t* size) override; - bool GetFileTime(const Pathname& path, - FileTimeType which, - time_t* time) override; private: #if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC) diff --git a/webrtc/base/win32filesystem.cc b/webrtc/base/win32filesystem.cc index faca8e9c08..5445140ef2 100644 --- a/webrtc/base/win32filesystem.cc +++ b/webrtc/base/win32filesystem.cc @@ -152,26 +152,4 @@ bool Win32Filesystem::GetFileSize(const Pathname &pathname, size_t *size) { return true; } -bool Win32Filesystem::GetFileTime(const Pathname& path, FileTimeType which, - time_t* time) { - WIN32_FILE_ATTRIBUTE_DATA data = {0}; - if (::GetFileAttributesEx(ToUtf16(path.pathname()).c_str(), - GetFileExInfoStandard, &data) == 0) - return false; - switch (which) { - case FTT_CREATED: - FileTimeToUnixTime(data.ftCreationTime, time); - break; - case FTT_MODIFIED: - FileTimeToUnixTime(data.ftLastWriteTime, time); - break; - case FTT_ACCESSED: - FileTimeToUnixTime(data.ftLastAccessTime, time); - break; - default: - return false; - } - return true; -} - } // namespace rtc diff --git a/webrtc/base/win32filesystem.h b/webrtc/base/win32filesystem.h index 1a52d62fe6..566cbaff9f 100644 --- a/webrtc/base/win32filesystem.h +++ b/webrtc/base/win32filesystem.h @@ -51,9 +51,6 @@ class Win32Filesystem : public FilesystemInterface { const std::string& prefix) override; bool GetFileSize(const Pathname& path, size_t* size) override; - bool GetFileTime(const Pathname& path, - FileTimeType which, - time_t* time) override; // A folder appropriate for storing temporary files (Contents are // automatically deleted when the program exists)