From 9780d378ed79eb81d2e492cfc3e973f59692a026 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 24 Jun 2008 11:54:13 +0000 Subject: [PATCH] made examples use the new more efficient torrent_info constructor --- examples/client_test.cpp | 5 +---- examples/simple_client.cpp | 6 +----- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/examples/client_test.cpp b/examples/client_test.cpp index 18cb0275e..b95fe8479 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -479,10 +479,7 @@ void add_torrent(libtorrent::session& ses { using namespace libtorrent; - std::ifstream in(torrent.c_str(), std::ios_base::binary); - in.unsetf(std::ios_base::skipws); - entry e = bdecode(std::istream_iterator(in), std::istream_iterator()); - boost::intrusive_ptr t(new torrent_info(e)); + boost::intrusive_ptr t(new torrent_info(torrent.c_str())); std::cout << t->name() << "\n"; diff --git a/examples/simple_client.cpp b/examples/simple_client.cpp index 51d1eab22..fb16570da 100644 --- a/examples/simple_client.cpp +++ b/examples/simple_client.cpp @@ -60,11 +60,7 @@ int main(int argc, char* argv[]) { session s; s.listen_on(std::make_pair(6881, 6889)); - - std::ifstream in(argv[1], std::ios_base::binary); - in.unsetf(std::ios_base::skipws); - entry e = bdecode(std::istream_iterator(in), std::istream_iterator()); - s.add_torrent(torrent_info(e), "./"); + s.add_torrent(torrent_info(argv[1]), "./"); // wait for the user to end char a;