forked from premiere/premiere-libtorrent
*** empty log message ***
This commit is contained in:
parent
40a88434b1
commit
a326bc4391
3
Jamfile
3
Jamfile
|
@ -18,6 +18,7 @@ REQUIREMENTS =
|
|||
<include>$(BOOST_ROOT)
|
||||
<variant>release:<define>NDEBUG
|
||||
<define>BOOST_ALL_NO_LIB
|
||||
<define>_FILE_OFFSET_BITS=64
|
||||
<library>/boost/thread//boost_thread
|
||||
<library>/boost/filesystem//boost_filesystem/<link>static
|
||||
<library>/boost/date_time//boost_date_time/<link>static
|
||||
|
@ -104,7 +105,7 @@ lib torrent
|
|||
:
|
||||
<threading>multi
|
||||
<link>static
|
||||
# <variant>debug:<define>TORRENT_VERBOSE_LOGGING
|
||||
<variant>debug:<define>TORRENT_VERBOSE_LOGGING
|
||||
: debug release
|
||||
;
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ int main(int argc, char* argv[])
|
|||
session ses;
|
||||
|
||||
ses.listen_on(std::make_pair(6880, 6889));
|
||||
ses.set_upload_rate_limit(512 * 1024);
|
||||
// ses.set_upload_rate_limit(512 * 1024);
|
||||
ses.set_http_settings(settings);
|
||||
ses.set_severity_level(alert::debug);
|
||||
// ses.set_severity_level(alert::info);
|
||||
|
@ -292,7 +292,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
try
|
||||
{
|
||||
boost::filesystem::path save_path("");
|
||||
boost::filesystem::path save_path("./");
|
||||
|
||||
if (std::string(argv[i+1]).substr(0, 7) == "http://")
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ int main(int argc, char* argv[])
|
|||
std::ifstream in(argv[1], std::ios_base::binary);
|
||||
in.unsetf(std::ios_base::skipws);
|
||||
entry e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>());
|
||||
s.add_torrent(e, "");
|
||||
s.add_torrent(e, "./");
|
||||
|
||||
// wait for the user to end
|
||||
char a;
|
||||
|
|
|
@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <algorithm>
|
||||
#include "libtorrent/entry.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
namespace std
|
||||
|
@ -63,6 +64,27 @@ namespace
|
|||
}
|
||||
char const* m_str;
|
||||
};
|
||||
|
||||
template <class It, class Pred>
|
||||
void bubble_sort(It start, It end, Pred p)
|
||||
{
|
||||
if (start == end) return;
|
||||
--end;
|
||||
for (It i = start; i != end; ++i)
|
||||
{
|
||||
bool unsorted = false;
|
||||
for (It j = i; j != end; ++j)
|
||||
{
|
||||
It next = boost::next(j);
|
||||
if (!p(*j, *next))
|
||||
{
|
||||
swap(*j, *next);
|
||||
unsorted = true;
|
||||
}
|
||||
}
|
||||
if (!unsorted) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace libtorrent
|
||||
|
@ -246,18 +268,14 @@ namespace libtorrent
|
|||
|
||||
void entry::sort()
|
||||
{
|
||||
#if (defined(_MSC_VER) && _MSC_VER < 1300)
|
||||
assert(false);
|
||||
#else
|
||||
using boost::bind;
|
||||
if (type() == dictionary_t)
|
||||
{
|
||||
std::stable_sort(dict().begin(), dict().end()
|
||||
bubble_sort(dict().begin(), dict().end()
|
||||
, bind(std::less<std::string>()
|
||||
, bind(&entry::dictionary_type::value_type::first, _1)
|
||||
, bind(&entry::dictionary_type::value_type::first, _2)));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void entry::print(std::ostream& os, int indent) const
|
||||
|
|
|
@ -849,6 +849,7 @@ namespace libtorrent
|
|||
, boost::filesystem::path const& save_path
|
||||
, entry const& resume_data)
|
||||
{
|
||||
assert(!save_path.empty());
|
||||
torrent_info ti(metadata);
|
||||
|
||||
if (ti.begin_files() == ti.end_files())
|
||||
|
@ -898,6 +899,7 @@ namespace libtorrent
|
|||
, boost::filesystem::path const& save_path
|
||||
, entry const& resume_data)
|
||||
{
|
||||
assert(!save_path.empty());
|
||||
{
|
||||
// lock the checker_thread
|
||||
boost::mutex::scoped_lock l(m_checker_impl.m_mutex);
|
||||
|
|
|
@ -45,6 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
@ -595,8 +596,8 @@ namespace libtorrent
|
|||
, const path& save_path)
|
||||
: m_storage(info, save_path)
|
||||
, m_info(info)
|
||||
, m_save_path(complete(save_path))
|
||||
, m_allocating(false)
|
||||
, m_save_path(complete(save_path));
|
||||
{
|
||||
assert(m_save_path.is_complete());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue