mirror of
https://github.com/arvidn/libtorrent.git
synced 2026-05-10 09:50:39 -04:00
remove since-long deprecated wstring overloads
This commit is contained in:
committed by
Arvid Norberg
parent
e7d3e3b012
commit
d6b9d03a93
@@ -102,12 +102,6 @@ namespace
|
||||
|
||||
FileIter end_files(file_storage const& self)
|
||||
{ return FileIter(self, self.end_file()); }
|
||||
|
||||
void add_file_wstring(file_storage& fs, std::wstring const& file, std::int64_t size
|
||||
, file_flags_t const flags, std::time_t md, std::string link)
|
||||
{
|
||||
fs.add_file(file, size, flags, md, link);
|
||||
}
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
|
||||
void add_files_callback(file_storage& fs, std::string const& file
|
||||
@@ -135,10 +129,6 @@ void bind_create_torrent()
|
||||
{
|
||||
void (file_storage::*set_name0)(std::string const&) = &file_storage::set_name;
|
||||
void (file_storage::*rename_file0)(file_index_t, std::string const&) = &file_storage::rename_file;
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
void (file_storage::*set_name1)(std::wstring const&) = &file_storage::set_name;
|
||||
void (file_storage::*rename_file1)(file_index_t, std::wstring const&) = &file_storage::rename_file;
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
void (*set_piece_hashes0)(create_torrent&, std::string const&) = &set_piece_hashes;
|
||||
@@ -168,7 +158,6 @@ void bind_create_torrent()
|
||||
.def("add_file", add_file_deprecated, arg("entry"))
|
||||
.def("__iter__", boost::python::range(&begin_files, &end_files))
|
||||
.def("__len__", &file_storage::num_files)
|
||||
.def("add_file", add_file_wstring, (arg("path"), arg("size"), arg("flags") = 0, arg("mtime") = 0, arg("linkpath") = ""))
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
.def("hash", file_storage_hash)
|
||||
.def("symlink", file_storage_symlink)
|
||||
@@ -186,10 +175,6 @@ void bind_create_torrent()
|
||||
.def("piece_size", &file_storage::piece_size)
|
||||
.def("set_name", set_name0)
|
||||
.def("rename_file", rename_file0)
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
.def("set_name", set_name1)
|
||||
.def("rename_file", rename_file1)
|
||||
#endif
|
||||
.def("name", &file_storage::name, return_value_policy<copy_const_reference>())
|
||||
;
|
||||
|
||||
|
||||
@@ -457,11 +457,6 @@ void bind_torrent_handle()
|
||||
void (torrent_handle::*move_storage0)(std::string const&, lt::move_flags_t) const = &torrent_handle::move_storage;
|
||||
void (torrent_handle::*rename_file0)(file_index_t, std::string const&) const = &torrent_handle::rename_file;
|
||||
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
void (torrent_handle::*move_storage1)(std::wstring const&, int) const = &torrent_handle::move_storage;
|
||||
void (torrent_handle::*rename_file1)(file_index_t, std::wstring const&) const = &torrent_handle::rename_file;
|
||||
#endif
|
||||
|
||||
std::vector<open_file_state> (torrent_handle::*file_status0)() const = &torrent_handle::file_status;
|
||||
|
||||
#define _ allow_threads
|
||||
@@ -584,8 +579,6 @@ void bind_torrent_handle()
|
||||
.def("set_ratio", _(&torrent_handle::set_ratio))
|
||||
.def("save_path", _(&torrent_handle::save_path))
|
||||
.def("set_tracker_login", &torrent_handle::set_tracker_login)
|
||||
.def("move_storage", _(move_storage1), (arg("path"), arg("flags") = always_replace_files))
|
||||
.def("rename_file", _(rename_file1))
|
||||
#endif
|
||||
;
|
||||
|
||||
|
||||
@@ -274,9 +274,6 @@ void bind_torrent_info()
|
||||
return_value_policy<copy_const_reference> copy;
|
||||
|
||||
void (torrent_info::*rename_file0)(file_index_t, std::string const&) = &torrent_info::rename_file;
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
void (torrent_info::*rename_file1)(file_index_t, std::wstring const&) = &torrent_info::rename_file;
|
||||
#endif
|
||||
|
||||
class_<file_slice>("file_slice")
|
||||
.add_property("file_index", make_getter((&file_slice::file_index), by_value()))
|
||||
@@ -326,7 +323,6 @@ void bind_torrent_info()
|
||||
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
.def("__init__", make_constructor(&sha1_constructor0))
|
||||
.def(init<std::wstring>((arg("file"))))
|
||||
#endif
|
||||
|
||||
.def("add_tracker", (add_tracker1)&torrent_info::add_tracker, arg("url"), arg("tier") = 0, arg("source") = announce_entry::source_client)
|
||||
@@ -361,7 +357,6 @@ void bind_torrent_info()
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
.def("file_at", &torrent_info::file_at)
|
||||
.def("file_at_offset", &torrent_info::file_at_offset)
|
||||
.def("rename_file", rename_file1)
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
|
||||
.def("is_valid", &torrent_info::is_valid)
|
||||
|
||||
@@ -488,54 +488,6 @@ namespace aux {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
|
||||
// all wstring APIs are deprecated since 0.16.11
|
||||
// instead, use the wchar -> utf8 conversion functions
|
||||
// and pass in utf8 strings
|
||||
TORRENT_DEPRECATED_EXPORT
|
||||
void add_files(file_storage& fs, std::wstring const& wfile
|
||||
, std::function<bool(std::string)> p, create_flags_t flags = {});
|
||||
|
||||
TORRENT_DEPRECATED_EXPORT
|
||||
void add_files(file_storage& fs, std::wstring const& wfile
|
||||
, create_flags_t flags = {});
|
||||
|
||||
TORRENT_DEPRECATED_EXPORT
|
||||
void set_piece_hashes(create_torrent& t, std::wstring const& p
|
||||
, std::function<void(int)> f, error_code& ec);
|
||||
|
||||
TORRENT_EXPORT void set_piece_hashes_deprecated(create_torrent& t
|
||||
, std::wstring const& p
|
||||
, std::function<void(int)> f, error_code& ec);
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
TORRENT_DEPRECATED
|
||||
inline void set_piece_hashes(create_torrent& t, std::wstring const& p
|
||||
, std::function<void(int)> f)
|
||||
{
|
||||
error_code ec;
|
||||
set_piece_hashes_deprecated(t, p, f, ec);
|
||||
if (ec) throw system_error(ec);
|
||||
}
|
||||
|
||||
TORRENT_DEPRECATED
|
||||
inline void set_piece_hashes(create_torrent& t, std::wstring const& p)
|
||||
{
|
||||
error_code ec;
|
||||
set_piece_hashes_deprecated(t, p, aux::nop, ec);
|
||||
if (ec) throw system_error(ec);
|
||||
}
|
||||
#endif
|
||||
|
||||
TORRENT_DEPRECATED
|
||||
inline void set_piece_hashes(create_torrent& t
|
||||
, std::wstring const& p, error_code& ec)
|
||||
{
|
||||
set_piece_hashes_deprecated(t, p, aux::nop, ec);
|
||||
}
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
|
||||
namespace aux {
|
||||
TORRENT_EXTRA_EXPORT file_flags_t get_file_attributes(std::string const& p);
|
||||
TORRENT_EXTRA_EXPORT std::string get_symlink_path(std::string const& p);
|
||||
|
||||
@@ -333,20 +333,6 @@ namespace aux {
|
||||
TORRENT_DEPRECATED
|
||||
void add_file(file_entry const& fe, char const* filehash = nullptr);
|
||||
|
||||
// all wstring APIs are deprecated since 0.16.11
|
||||
// instead, use the wchar -> utf8 conversion functions
|
||||
// and pass in utf8 strings
|
||||
TORRENT_DEPRECATED
|
||||
void add_file(std::wstring const& file, std::int64_t size
|
||||
, file_flags_t flags = {}
|
||||
, std::time_t mtime = 0, string_view symlink_path = "");
|
||||
TORRENT_DEPRECATED
|
||||
void rename_file(file_index_t index, std::wstring const& new_filename);
|
||||
TORRENT_DEPRECATED
|
||||
void set_name(std::wstring const& n);
|
||||
|
||||
void rename_file_deprecated(file_index_t index, std::wstring const& new_filename);
|
||||
|
||||
// all functions depending on aux::file_entry
|
||||
// were deprecated in 1.0. Use the variants that take an
|
||||
// index instead
|
||||
|
||||
@@ -1211,14 +1211,6 @@ namespace aux {
|
||||
void rename_file(file_index_t index, std::string const& new_name) const;
|
||||
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
// all wstring APIs are deprecated since 0.16.11
|
||||
// instead, use the wchar -> utf8 conversion functions
|
||||
// and pass in utf8 strings
|
||||
TORRENT_DEPRECATED
|
||||
void move_storage(std::wstring const& save_path, int flags = 0) const;
|
||||
TORRENT_DEPRECATED
|
||||
void rename_file(file_index_t index, std::wstring const& new_name) const;
|
||||
|
||||
// Enables or disabled super seeding/initial seeding for this torrent.
|
||||
// The torrent needs to be a seed for this to take effect.
|
||||
TORRENT_DEPRECATED
|
||||
|
||||
@@ -218,12 +218,6 @@ TORRENT_VERSION_NAMESPACE_3
|
||||
TORRENT_DEPRECATED
|
||||
torrent_info(char const* buffer, int size, error_code& ec, int)
|
||||
: torrent_info(span<char const>{buffer, size}, ec, from_span) {}
|
||||
// all wstring APIs are deprecated since 0.16.11 instead, use the wchar
|
||||
// -> utf8 conversion functions and pass in utf8 strings
|
||||
TORRENT_DEPRECATED
|
||||
torrent_info(std::wstring const& filename, error_code& ec);
|
||||
TORRENT_DEPRECATED
|
||||
explicit torrent_info(std::wstring const& filename);
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
|
||||
// frees all storage associated with this torrent_info object
|
||||
@@ -265,13 +259,6 @@ TORRENT_VERSION_NAMESPACE_3
|
||||
// torrent. In this case the file is not moved when move_storage() is
|
||||
// invoked.
|
||||
void rename_file(file_index_t index, std::string const& new_filename);
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
// all wstring APIs are deprecated since 0.16.11
|
||||
// instead, use the wchar -> utf8 conversion functions
|
||||
// and pass in utf8 strings
|
||||
TORRENT_DEPRECATED
|
||||
void rename_file(file_index_t index, std::wstring const& new_filename);
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
|
||||
// .. warning::
|
||||
// Using `remap_files()` is discouraged as it's incompatible with v2
|
||||
|
||||
@@ -257,39 +257,6 @@ namespace aux {
|
||||
|
||||
} // anonymous aux
|
||||
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
|
||||
void add_files(file_storage& fs, std::wstring const& wfile
|
||||
, std::function<bool(std::string)> p, create_flags_t const flags)
|
||||
{
|
||||
std::string utf8 = wchar_utf8(wfile);
|
||||
add_files_impl(fs, parent_path(complete(utf8))
|
||||
, filename(utf8), p, flags);
|
||||
}
|
||||
|
||||
void add_files(file_storage& fs
|
||||
, std::wstring const& wfile, create_flags_t const flags)
|
||||
{
|
||||
std::string utf8 = wchar_utf8(wfile);
|
||||
add_files_impl(fs, parent_path(complete(utf8))
|
||||
, filename(utf8), default_pred, flags);
|
||||
}
|
||||
|
||||
void set_piece_hashes(create_torrent& t, std::wstring const& p
|
||||
, std::function<void(int)> f, error_code& ec)
|
||||
{
|
||||
std::string utf8 = wchar_utf8(p);
|
||||
set_piece_hashes(t, utf8, f, ec);
|
||||
}
|
||||
|
||||
void set_piece_hashes_deprecated(create_torrent& t, std::wstring const& p
|
||||
, std::function<void(int)> f, error_code& ec)
|
||||
{
|
||||
std::string utf8 = wchar_utf8(p);
|
||||
set_piece_hashes(t, utf8, f, ec);
|
||||
}
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
|
||||
void add_files(file_storage& fs, std::string const& file
|
||||
, std::function<bool(std::string)> p, create_flags_t const flags)
|
||||
{
|
||||
|
||||
@@ -387,28 +387,6 @@ namespace aux {
|
||||
add_file_borrow({}, fe.path, fe.size, flags, filehash, fe.mtime
|
||||
, fe.symlink_path);
|
||||
}
|
||||
|
||||
void file_storage::set_name(std::wstring const& n)
|
||||
{
|
||||
m_name = wchar_utf8(n);
|
||||
}
|
||||
|
||||
void file_storage::rename_file_deprecated(file_index_t index, std::wstring const& new_filename)
|
||||
{
|
||||
TORRENT_ASSERT_PRECOND(index >= file_index_t(0) && index < end_file());
|
||||
update_path_index(m_files[index], wchar_utf8(new_filename));
|
||||
}
|
||||
|
||||
void file_storage::add_file(std::wstring const& file, std::int64_t file_size
|
||||
, file_flags_t const file_flags, std::time_t mtime, string_view symlink_path)
|
||||
{
|
||||
add_file(wchar_utf8(file), file_size, file_flags, mtime, symlink_path);
|
||||
}
|
||||
|
||||
void file_storage::rename_file(file_index_t index, std::wstring const& new_filename)
|
||||
{
|
||||
rename_file_deprecated(index, new_filename);
|
||||
}
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
|
||||
void file_storage::rename_file(file_index_t const index
|
||||
|
||||
@@ -272,17 +272,6 @@ namespace libtorrent {
|
||||
{
|
||||
async_call(&torrent::move_storage, save_path, static_cast<move_flags_t>(flags));
|
||||
}
|
||||
|
||||
void torrent_handle::move_storage(
|
||||
std::wstring const& save_path, int flags) const
|
||||
{
|
||||
async_call(&torrent::move_storage, wchar_utf8(save_path), static_cast<move_flags_t>(flags));
|
||||
}
|
||||
|
||||
void torrent_handle::rename_file(file_index_t index, std::wstring const& new_name) const
|
||||
{
|
||||
async_call(&torrent::rename_file, index, wchar_utf8(new_name));
|
||||
}
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
|
||||
void torrent_handle::rename_file(file_index_t index, std::string const& new_name) const
|
||||
|
||||
@@ -995,31 +995,6 @@ namespace {
|
||||
|
||||
INVARIANT_CHECK;
|
||||
}
|
||||
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
torrent_info::torrent_info(std::wstring const& filename)
|
||||
{
|
||||
std::vector<char> buf;
|
||||
error_code ec;
|
||||
int ret = load_file(wchar_utf8(filename), buf, ec);
|
||||
if (ret < 0) aux::throw_ex<system_error>(ec);
|
||||
|
||||
bdecode_node e = bdecode(buf, ec);
|
||||
if (ec) aux::throw_ex<system_error>(ec);
|
||||
|
||||
if (!parse_torrent_file(e, ec, load_torrent_limits{}.max_pieces))
|
||||
aux::throw_ex<system_error>(ec);
|
||||
|
||||
INVARIANT_CHECK;
|
||||
}
|
||||
|
||||
void torrent_info::rename_file(file_index_t index, std::wstring const& new_filename)
|
||||
{
|
||||
TORRENT_ASSERT(is_loaded());
|
||||
copy_on_write();
|
||||
m_files.rename_file_deprecated(index, new_filename);
|
||||
}
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
#endif
|
||||
|
||||
file_storage const& torrent_info::orig_files() const
|
||||
@@ -1066,22 +1041,6 @@ namespace {
|
||||
INVARIANT_CHECK;
|
||||
}
|
||||
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
torrent_info::torrent_info(std::wstring const& filename
|
||||
, error_code& ec)
|
||||
{
|
||||
std::vector<char> buf;
|
||||
int ret = load_file(wchar_utf8(filename), buf, ec);
|
||||
if (ret < 0) return;
|
||||
|
||||
bdecode_node e = bdecode(buf, ec);
|
||||
if (ec) return;
|
||||
parse_torrent_file(e, ec, load_torrent_limits{}.max_pieces);
|
||||
|
||||
INVARIANT_CHECK;
|
||||
}
|
||||
#endif // TORRENT_ABI_VERSION
|
||||
|
||||
// constructor used for creating new torrents
|
||||
// will not contain any hashes, comments, creation date
|
||||
// just the necessary to use it with piece manager
|
||||
|
||||
Reference in New Issue
Block a user