landed the bdecode branch in master. lazy_bdecode/lazy_entry is now being replaced by bdecode/bdecode_node

This commit is contained in:
Arvid Norberg
2015-03-12 05:20:12 +00:00
parent c1dc982f4f
commit 6c1df7eb55
72 changed files with 4039 additions and 1144 deletions

View File

@@ -64,7 +64,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/magnet_uri.hpp"
#include "libtorrent/bitfield.hpp"
#include "libtorrent/peer_info.hpp"
#include "libtorrent/lazy_entry.hpp"
#include "libtorrent/bdecode.hpp"
#include "libtorrent/add_torrent_params.hpp"
#include "libtorrent/time.hpp"
#include "libtorrent/create_torrent.hpp"
@@ -697,7 +697,6 @@ void add_torrent(libtorrent::session& ses
if (seed_mode) p.flags |= add_torrent_params::flag_seed_mode;
if (disable_storage) p.storage = disabled_storage_constructor;
if (share_mode) p.flags |= add_torrent_params::flag_share_mode;
lazy_entry resume_data;
std::string filename = path_append(save_path, path_append(".resume"
, leaf_path(torrent) + ".resume"));
@@ -1324,8 +1323,8 @@ int main(int argc, char* argv[])
error_code ec;
if (load_file(".ses_state", in, ec) == 0)
{
lazy_entry e;
if (lazy_bdecode(&in[0], &in[0] + in.size(), e, ec) == 0)
bdecode_node e;
if (bdecode(&in[0], &in[0] + in.size(), e, ec) == 0)
ses.load_state(e);
}

View File

@@ -33,10 +33,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/entry.hpp"
#include "libtorrent/bencode.hpp"
#include "libtorrent/torrent_info.hpp"
#include "libtorrent/lazy_entry.hpp"
#include "libtorrent/bdecode.hpp"
#include "libtorrent/magnet_uri.hpp"
int load_file(std::string const& filename, std::vector<char>& v, libtorrent::error_code& ec, int limit = 8000000)
int load_file(std::string const& filename, std::vector<char>& v
, libtorrent::error_code& ec, int limit = 8000000)
{
ec.clear();
FILE* f = fopen(filename.c_str(), "rb");
@@ -127,11 +128,11 @@ int main(int argc, char* argv[])
fprintf(stderr, "failed to load file: %s\n", ec.message().c_str());
return 1;
}
lazy_entry e;
bdecode_node e;
int pos = -1;
printf("decoding. recursion limit: %d total item count limit: %d\n"
, depth_limit, item_limit);
ret = lazy_bdecode(&buf[0], &buf[0] + buf.size(), e, ec, &pos
ret = bdecode(&buf[0], &buf[0] + buf.size(), e, ec, &pos
, depth_limit, item_limit);
printf("\n\n----- raw info -----\n\n%s\n", print_entry(e).c_str());

View File

@@ -179,8 +179,8 @@ int main(int argc, char* argv[])
error_code ec;
if (load_file(".ses_state", in, ec) == 0)
{
lazy_entry e;
if (lazy_bdecode(&in[0], &in[0] + in.size(), e, ec) == 0)
bdecode_node e;
if (bdecode(&in[0], &in[0] + in.size(), e, ec) == 0)
ses.load_state(e);
}