remove unused replace_extension()

This commit is contained in:
arvidn 2019-03-19 10:47:25 +01:00 committed by Arvid Norberg
parent 57cd2882d4
commit e5de81a6cb
2 changed files with 0 additions and 20 deletions

View File

@ -141,7 +141,6 @@ namespace libtorrent {
TORRENT_EXTRA_EXPORT char const* next_path_element(char const* p);
TORRENT_EXTRA_EXPORT std::string extension(std::string const& f);
TORRENT_EXTRA_EXPORT std::string remove_extension(std::string const& f);
TORRENT_EXTRA_EXPORT void replace_extension(std::string& f, std::string const& ext);
TORRENT_EXTRA_EXPORT bool is_root_path(std::string const& f);
TORRENT_EXTRA_EXPORT bool compare_path(std::string const& lhs, std::string const& rhs);

View File

@ -531,25 +531,6 @@ namespace {
return f.substr(0, aux::numeric_cast<std::size_t>(ext - &f[0]));
}
void replace_extension(std::string& f, std::string const& ext)
{
for (int i = int(f.size()) - 1; i >= 0; --i)
{
std::size_t const idx = std::size_t(i);
if (f[idx] == '/') break;
#ifdef TORRENT_WINDOWS
if (f[idx] == '\\') break;
#endif
if (f[idx] != '.') continue;
f.resize(idx);
break;
}
f += '.';
f += ext;
}
bool is_root_path(std::string const& f)
{
if (f.empty()) return false;