Delete Filesystem::TempFilename.
Also delete a few unused private members of UnixFilesystem.
Bug: webrtc:6424
Change-Id: Ib52f2d877690159d197fe767fd04a0d1ade7eb1a
Reviewed-on: https://webrtc-review.googlesource.com/30301
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21148}
diff --git a/rtc_base/fileutils.h b/rtc_base/fileutils.h
index a254494..69e64ae 100644
--- a/rtc_base/fileutils.h
+++ b/rtc_base/fileutils.h
@@ -94,9 +94,6 @@
// Returns true if pathname refers to a file
virtual bool IsFile(const Pathname& pathname) = 0;
- virtual std::string TempFilename(const Pathname &dir,
- const std::string &prefix) = 0;
-
// Determines the size of the file indicated by path.
virtual bool GetFileSize(const Pathname& path, size_t* size) = 0;
};
@@ -135,11 +132,6 @@
return EnsureDefaultFilesystem()->IsFile(pathname);
}
- static std::string TempFilename(const Pathname &dir,
- const std::string &prefix) {
- return EnsureDefaultFilesystem()->TempFilename(dir, prefix);
- }
-
static bool GetFileSize(const Pathname& path, size_t* size) {
return EnsureDefaultFilesystem()->GetFileSize(path, size);
}
diff --git a/rtc_base/unixfilesystem.cc b/rtc_base/unixfilesystem.cc
index 8732d47..a48aca1 100644
--- a/rtc_base/unixfilesystem.cc
+++ b/rtc_base/unixfilesystem.cc
@@ -67,22 +67,6 @@
return ::unlink(filename.pathname().c_str()) == 0;
}
-std::string UnixFilesystem::TempFilename(const Pathname &dir,
- const std::string &prefix) {
- int len = dir.pathname().size() + prefix.size() + 2 + 6;
- char *tempname = new char[len];
-
- snprintf(tempname, len, "%s/%sXXXXXX", dir.pathname().c_str(),
- prefix.c_str());
- int fd = ::mkstemp(tempname);
- if (fd != -1)
- ::close(fd);
- std::string ret(tempname);
- delete[] tempname;
-
- return ret;
-}
-
bool UnixFilesystem::MoveFile(const Pathname &old_path,
const Pathname &new_path) {
if (!IsFile(old_path)) {
@@ -119,18 +103,6 @@
return true;
}
-char* UnixFilesystem::CopyString(const std::string& str) {
- size_t size = str.length() + 1;
-
- char* buf = new char[size];
- if (!buf) {
- return nullptr;
- }
-
- strcpyn(buf, size, str.c_str());
- return buf;
-}
-
} // namespace rtc
#if defined(__native_client__)
diff --git a/rtc_base/unixfilesystem.h b/rtc_base/unixfilesystem.h
index 27966f3..711d7b3 100644
--- a/rtc_base/unixfilesystem.h
+++ b/rtc_base/unixfilesystem.h
@@ -37,20 +37,7 @@
// Returns true of pathname represents an existing file
bool IsFile(const Pathname& pathname) override;
- std::string TempFilename(const Pathname& dir,
- const std::string& prefix) override;
-
bool GetFileSize(const Pathname& path, size_t* size) override;
-
- private:
-#if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC)
- static char* provided_app_data_folder_;
- static char* provided_app_temp_folder_;
-#else
- static char* app_temp_path_;
-#endif
-
- static char* CopyString(const std::string& str);
};
} // namespace rtc
diff --git a/rtc_base/win32filesystem.cc b/rtc_base/win32filesystem.cc
index 511f966..8ca84c3 100644
--- a/rtc_base/win32filesystem.cc
+++ b/rtc_base/win32filesystem.cc
@@ -42,16 +42,6 @@
return ::DeleteFile(ToUtf16(filename.pathname()).c_str()) != 0;
}
-std::string Win32Filesystem::TempFilename(const Pathname &dir,
- const std::string &prefix) {
- wchar_t filename[MAX_PATH];
- if (::GetTempFileName(ToUtf16(dir.pathname()).c_str(),
- ToUtf16(prefix).c_str(), 0, filename) != 0)
- return ToUtf8(filename);
- RTC_NOTREACHED();
- return "";
-}
-
bool Win32Filesystem::MoveFile(const Pathname &old_path,
const Pathname &new_path) {
if (!IsFile(old_path)) {
diff --git a/rtc_base/win32filesystem.h b/rtc_base/win32filesystem.h
index e65d127..d26741e 100644
--- a/rtc_base/win32filesystem.h
+++ b/rtc_base/win32filesystem.h
@@ -33,14 +33,6 @@
// Returns true if a file exists at path
bool IsFile(const Pathname& path) override;
- // All of the following functions set pathname and return true if successful.
- // Returned paths always include a trailing backslash.
- // If create is true, the path will be recursively created.
- // If append is non-null, it will be appended (and possibly created).
-
- std::string TempFilename(const Pathname& dir,
- const std::string& prefix) override;
-
bool GetFileSize(const Pathname& path, size_t* size) override;
};