From 0be49d8d1028a2eb3aafd979091cfa0311e6c3c3 Mon Sep 17 00:00:00 2001 From: nisse Date: Mon, 27 Mar 2017 04:37:14 -0700 Subject: [PATCH] Delete unused Pathname methods. BUG=webrtc:6424 Review-Url: https://codereview.webrtc.org/2745073004 Cr-Commit-Position: refs/heads/master@{#17388} --- webrtc/base/pathutils.cc | 54 ---------------------------------------- webrtc/base/pathutils.h | 18 -------------- 2 files changed, 72 deletions(-) diff --git a/webrtc/base/pathutils.cc b/webrtc/base/pathutils.cc index f79c2980a4..75dabb53e4 100644 --- a/webrtc/base/pathutils.cc +++ b/webrtc/base/pathutils.cc @@ -70,11 +70,6 @@ Pathname::Pathname(const std::string& folder, const std::string& filename) Pathname& Pathname::operator=(const Pathname&) = default; Pathname& Pathname::operator=(Pathname&&) = default; -void Pathname::SetFolderDelimiter(char delimiter) { - RTC_DCHECK(IsFolderDelimiter(delimiter)); - folder_delimiter_ = delimiter; -} - void Pathname::Normalize() { for (size_t i=0; i= 2) { - pos = folder_.find_last_of(FOLDER_DELIMS, folder_.length() - 2); - } - if (pos != std::string::npos) { - return folder_.substr(pos + 1); - } else { - return folder_; - } -} - std::string Pathname::parent_folder() const { std::string::size_type pos = std::string::npos; if (folder_.size() >= 2) { @@ -172,10 +149,6 @@ void Pathname::AppendFolder(const std::string& folder) { } } -std::string Pathname::basename() const { - return basename_; -} - bool Pathname::SetBasename(const std::string& basename) { if(basename.find_first_of(FOLDER_DELIMS) != std::string::npos) { return false; @@ -184,10 +157,6 @@ bool Pathname::SetBasename(const std::string& basename) { return true; } -std::string Pathname::extension() const { - return extension_; -} - bool Pathname::SetExtension(const std::string& extension) { if (extension.find_first_of(FOLDER_DELIMS) != std::string::npos || extension.find_first_of(EXT_DELIM, 1) != std::string::npos) { @@ -216,29 +185,6 @@ bool Pathname::SetFilename(const std::string& filename) { } } -#if defined(WEBRTC_WIN) -bool Pathname::GetDrive(char* drive, uint32_t bytes) const { - return GetDrive(drive, bytes, folder_); -} - -// static -bool Pathname::GetDrive(char* drive, - uint32_t bytes, - const std::string& pathname) { - // need at lease 4 bytes to save c: - if (bytes < 4 || pathname.size() < 3) { - return false; - } - - memcpy(drive, pathname.c_str(), 3); - drive[3] = 0; - // sanity checking - return (isalpha(drive[0]) && - drive[1] == ':' && - drive[2] == '\\'); -} -#endif - /////////////////////////////////////////////////////////////////////////////// } // namespace rtc diff --git a/webrtc/base/pathutils.h b/webrtc/base/pathutils.h index 0aebcef1fb..ff0906938b 100644 --- a/webrtc/base/pathutils.h +++ b/webrtc/base/pathutils.h @@ -52,10 +52,6 @@ public: Pathname& operator=(const Pathname&); Pathname& operator=(Pathname&&); - // Set's the default folder delimiter for this Pathname - char folder_delimiter() const { return folder_delimiter_; } - void SetFolderDelimiter(char delimiter); - // Normalize changes all folder delimiters to folder_delimiter() void Normalize(); @@ -73,34 +69,20 @@ public: void SetPathname(const std::string& pathname); void SetPathname(const std::string& folder, const std::string& filename); - // Append pathname to the current folder (if any). Any existing filename - // will be discarded. - void AppendPathname(const std::string& pathname); - std::string folder() const; - std::string folder_name() const; std::string parent_folder() const; // SetFolder and AppendFolder will append a folder delimiter, if needed. void SetFolder(const std::string& folder); void AppendFolder(const std::string& folder); - std::string basename() const; bool SetBasename(const std::string& basename); - std::string extension() const; // SetExtension will prefix a period, if needed. bool SetExtension(const std::string& extension); std::string filename() const; bool SetFilename(const std::string& filename); -#if defined(WEBRTC_WIN) - bool GetDrive(char* drive, uint32_t bytes) const; - static bool GetDrive(char* drive, - uint32_t bytes, - const std::string& pathname); -#endif - private: std::string folder_, basename_, extension_; char folder_delimiter_;