merge deprecation of wstring overloads from RC_0_16

This commit is contained in:
Arvid Norberg 2013-08-02 05:03:22 +00:00
parent 0a0af03d9d
commit e7db8d37a2
12 changed files with 89 additions and 24 deletions

View File

@ -23,6 +23,7 @@
* fix uTP edge case where udp socket buffer fills up
* fix nagle implementation in uTP
* deprecate std::wstring overloads. long live utf-8
* improve time-critical pieces feature (streaming)
* introduce bandwidth exhaustion attack-mitigation in allowed-fast pieces
* python binding fix issue where torrent_info objects where destructing when their torrents were deleted

View File

@ -466,8 +466,10 @@ namespace libtorrent
char const* country_for_ip(address const& a);
#if TORRENT_USE_WSTRING
#ifndef TORRENT_NO_DEPRECATE
void load_asnum_dbw(std::wstring file);
void load_country_dbw(std::wstring file);
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
#endif // TORRENT_DISABLE_GEO_IP

View File

@ -236,8 +236,14 @@ namespace libtorrent
#if TORRENT_USE_WSTRING
// wstring versions
// all wstring APIs are deprecated since 0.16.11
// instead, use the wchar -> utf8 conversion functions
// and pass in utf8 strings
#ifndef TORRENT_NO_DEPRECATE
template <class Pred>
void add_files(file_storage& fs, std::wstring const& wfile, Pred p, boost::uint32_t flags = 0)
TORRENT_DEPRECATED_PREFIX
void TORRENT_DEPRECATED add_files(file_storage& fs, std::wstring const& wfile, Pred p, boost::uint32_t flags = 0)
{
std::string utf8;
wchar_utf8(wfile, utf8);
@ -245,7 +251,8 @@ namespace libtorrent
, filename(utf8), p, flags);
}
inline void add_files(file_storage& fs, std::wstring const& wfile, boost::uint32_t flags = 0)
TORRENT_DEPRECATED_PREFIX
inline void TORRENT_DEPRECATED add_files(file_storage& fs, std::wstring const& wfile, boost::uint32_t flags = 0)
{
std::string utf8;
wchar_utf8(wfile, utf8);
@ -258,14 +265,16 @@ namespace libtorrent
#ifndef BOOST_NO_EXCEPTIONS
template <class Fun>
void set_piece_hashes(create_torrent& t, std::wstring const& p, Fun f)
TORRENT_DEPRECATED_PREFIX
void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t, std::wstring const& p, Fun f)
{
error_code ec;
set_piece_hashes(t, p, f, ec);
if (ec) throw libtorrent_exception(ec);
}
inline void set_piece_hashes(create_torrent& t, std::wstring const& p)
TORRENT_DEPRECATED_PREFIX
inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t, std::wstring const& p)
{
error_code ec;
set_piece_hashes(t, p, detail::nop, ec);
@ -273,12 +282,13 @@ namespace libtorrent
}
#endif
inline void set_piece_hashes(create_torrent& t, std::wstring const& p, error_code& ec)
TORRENT_DEPRECATED_PREFIX
inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t, std::wstring const& p, error_code& ec)
{
set_piece_hashes(t, p, detail::nop, ec);
}
#endif // TORRENT_USE_WPATH
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
}

View File

@ -234,11 +234,19 @@ namespace libtorrent
void rename_file(int index, std::string const& new_filename);
#if TORRENT_USE_WSTRING
// all wstring APIs are deprecated since 0.16.11
// instead, use the wchar -> utf8 conversion functions
// and pass in utf8 strings
#ifndef TORRENT_NO_DEPRECATE
TORRENT_DEPRECATED_PREFIX
void add_file(std::wstring const& p, size_type size, int flags = 0
, std::time_t mtime = 0, std::string const& s_p = "");
void rename_file(int index, std::wstring const& new_filename);
void set_name(std::wstring const& n);
#endif
, std::time_t mtime = 0, std::string const& s_p = "") TORRENT_DEPRECATED;
TORRENT_DEPRECATED_PREFIX
void rename_file(int index, std::wstring const& new_filename) TORRENT_DEPRECATED;
TORRENT_DEPRECATED_PREFIX
void set_name(std::wstring const& n) TORRENT_DEPRECATED;
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
std::vector<file_slice> map_block(int piece, size_type offset
, int size) const;

View File

@ -507,10 +507,17 @@ namespace libtorrent
void load_country_db(char const* file);
int as_for_ip(address const& addr);
#if TORRENT_USE_WSTRING
void load_country_db(wchar_t const* file);
void load_asnum_db(wchar_t const* file);
#endif
#endif
// all wstring APIs are deprecated since 0.16.11
// instead, use the wchar -> utf8 conversion functions
// and pass in utf8 strings
#ifndef TORRENT_NO_DEPRECATE
TORRENT_DEPRECATED_PREFIX
void load_country_db(wchar_t const* file) TORRENT_DEPRECATED;
TORRENT_DEPRECATED_PREFIX
void load_asnum_db(wchar_t const* file) TORRENT_DEPRECATED;
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
#endif // TORRENT_DISABLE_GEO_IP
#ifndef TORRENT_NO_DEPRECATE
// deprecated in 0.15

View File

@ -405,9 +405,16 @@ namespace libtorrent
void rename_file(int index, std::string const& new_name) const;
#if TORRENT_USE_WSTRING
void move_storage(std::wstring const& save_path, int flags = 0) const;
void rename_file(int index, std::wstring const& new_name) const;
#endif
#ifndef TORRENT_NO_DEPRECATE
// all wstring APIs are deprecated since 0.16.11
// instead, use the wchar -> utf8 conversion functions
// and pass in utf8 strings
TORRENT_DEPRECATED_PREFIX
void move_storage(std::wstring const& save_path, int flags = 0) const TORRENT_DEPRECATED;
TORRENT_DEPRECATED_PREFIX
void rename_file(int index, std::wstring const& new_name) const TORRENT_DEPRECATED;
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
void super_seeding(bool on) const;

View File

@ -304,7 +304,13 @@ namespace libtorrent
torrent_info(char const* buffer, int size, int flags = 0);
torrent_info(std::string const& filename, int flags = 0);
#if TORRENT_USE_WSTRING
torrent_info(std::wstring const& filename, int flags = 0);
// all wstring APIs are deprecated since 0.16.11
// instead, use the wchar -> utf8 conversion functions
// and pass in utf8 strings
#ifndef TORRENT_NO_DEPRECATE
TORRENT_DEPRECATED_PREFIX
torrent_info(std::wstring const& filename, int flags = 0) TORRENT_DEPRECATED;
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
#endif
torrent_info(torrent_info const& t, int flags = 0);
@ -313,7 +319,13 @@ namespace libtorrent
torrent_info(char const* buffer, int size, error_code& ec, int flags = 0);
torrent_info(std::string const& filename, error_code& ec, int flags = 0);
#if TORRENT_USE_WSTRING
torrent_info(std::wstring const& filename, error_code& ec, int flags = 0);
// all wstring APIs are deprecated since 0.16.11
// instead, use the wchar -> utf8 conversion functions
// and pass in utf8 strings
#ifndef TORRENT_NO_DEPRECATE
TORRENT_DEPRECATED_PREFIX
torrent_info(std::wstring const& filename, error_code& ec, int flags = 0) TORRENT_DEPRECATED;
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
~torrent_info();
@ -352,11 +364,17 @@ namespace libtorrent
m_files.rename_file(index, new_filename);
}
#if TORRENT_USE_WSTRING
void rename_file(int index, std::wstring const& new_filename)
// all wstring APIs are deprecated since 0.16.11
// instead, use the wchar -> utf8 conversion functions
// and pass in utf8 strings
#ifndef TORRENT_NO_DEPRECATE
TORRENT_DEPRECATED_PREFIX
void rename_file(int index, std::wstring const& new_filename) TORRENT_DEPRECATED
{
copy_on_write();
m_files.rename_file(index, new_filename);
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
// Remaps the file storage to a new file layout. This can be used to, for instance,

View File

@ -166,6 +166,7 @@ namespace libtorrent
}
#if TORRENT_USE_WSTRING
#ifndef TORRENT_NO_DEPRECATE
void file_storage::set_name(std::wstring const& n)
{
std::string utf8;
@ -189,6 +190,7 @@ namespace libtorrent
wchar_utf8(file, utf8);
add_file(utf8, size, flags, mtime, symlink_path);
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
void file_storage::rename_file(int index, std::string const& new_filename)

View File

@ -523,6 +523,7 @@ namespace libtorrent
}
#if TORRENT_USE_WSTRING
#ifndef TORRENT_NO_DEPRECATE
void session::load_asnum_db(wchar_t const* file)
{
TORRENT_ASYNC_CALL1(load_asnum_dbw, std::wstring(file));
@ -532,6 +533,7 @@ namespace libtorrent
{
TORRENT_ASYNC_CALL1(load_country_dbw, std::wstring(file));
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
#endif // TORRENT_DISABLE_GEO_IP

View File

@ -1636,6 +1636,7 @@ namespace aux {
}
#if TORRENT_USE_WSTRING
#ifndef TORRENT_NO_DEPRECATE
void session_impl::load_asnum_dbw(std::wstring file)
{
TORRENT_ASSERT(is_network_thread());
@ -1657,6 +1658,7 @@ namespace aux {
m_country_db = GeoIP_open(utf8.c_str(), GEOIP_STANDARD);
// return m_country_db;
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
void session_impl::load_country_db(std::string file)

View File

@ -345,6 +345,7 @@ namespace libtorrent
}
#if TORRENT_USE_WSTRING
#ifndef TORRENT_NO_DEPRECATE
void torrent_handle::move_storage(
std::wstring const& save_path, int flags) const
{
@ -361,6 +362,7 @@ namespace libtorrent
wchar_utf8(new_name, utf8);
TORRENT_ASYNC_CALL2(rename_file, index, utf8);
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
void torrent_handle::rename_file(int index, std::string const& new_name) const

View File

@ -720,6 +720,7 @@ namespace libtorrent
}
#if TORRENT_USE_WSTRING
#ifndef TORRENT_NO_DEPRECATE
torrent_info::torrent_info(std::wstring const& filename, int flags)
: m_merkle_first_leaf(0)
, m_piece_hashes(0)
@ -745,7 +746,8 @@ namespace libtorrent
INVARIANT_CHECK;
}
#endif
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
#endif
torrent_info::torrent_info(lazy_entry const& torrent_file, error_code& ec, int flags)
@ -801,6 +803,7 @@ namespace libtorrent
}
#if TORRENT_USE_WSTRING
#ifndef TORRENT_NO_DEPRECATE
torrent_info::torrent_info(std::wstring const& filename, error_code& ec, int flags)
: m_merkle_first_leaf(0)
, m_piece_hashes(0)
@ -823,7 +826,8 @@ namespace libtorrent
INVARIANT_CHECK;
}
#endif
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_USE_WSTRING
// constructor used for creating new torrents
// will not contain any hashes, comments, creation date