took a shot at making it compile on vc6.
This commit is contained in:
parent
4d33080399
commit
e257516670
|
@ -67,6 +67,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <cassert>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include "libtorrent/size_type.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
@ -109,8 +111,7 @@ namespace libtorrent
|
|||
typedef std::map<std::string, entry> dictionary_type;
|
||||
typedef std::string string_type;
|
||||
typedef std::vector<entry> list_type;
|
||||
|
||||
typedef boost::int64_t integer_type;
|
||||
typedef size_type integer_type;
|
||||
|
||||
enum data_type
|
||||
{
|
||||
|
|
|
@ -38,7 +38,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include "libtorrent/size_type.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
@ -52,8 +53,6 @@ namespace libtorrent
|
|||
{
|
||||
public:
|
||||
|
||||
typedef boost::int64_t size_type;
|
||||
|
||||
class seek_mode
|
||||
{
|
||||
friend class file;
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace libtorrent
|
|||
{
|
||||
enum connection_type { connectable, not_connectable };
|
||||
|
||||
peer(const address& ip, peer::connection_type t);
|
||||
peer(const address& ip, connection_type t);
|
||||
|
||||
int total_download() const;
|
||||
int total_upload() const;
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2003, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef TORRENT_SIZE_TYPE_HPP_INCLUDED
|
||||
#define TORRENT_SIZE_TYPE_HPP_INCLUDED
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1300
|
||||
typedef int size_type;
|
||||
#else
|
||||
typedef boost::int64_t size_type;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -38,6 +38,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assert.h>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include "libtorrent/size_type.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
@ -46,9 +48,6 @@ namespace libtorrent
|
|||
enum { history = 10 };
|
||||
public:
|
||||
|
||||
typedef boost::int64_t size_type;
|
||||
|
||||
|
||||
stat()
|
||||
: m_downloaded_payload(0)
|
||||
, m_uploaded_payload(0)
|
||||
|
|
|
@ -52,8 +52,6 @@ namespace libtorrent
|
|||
|
||||
class session;
|
||||
|
||||
typedef boost::int64_t size_type;
|
||||
|
||||
std::vector<size_type> get_filesizes(
|
||||
const torrent_info& t
|
||||
, const boost::filesystem::path& p);
|
||||
|
@ -80,8 +78,6 @@ namespace libtorrent
|
|||
|
||||
void swap(storage&);
|
||||
|
||||
typedef boost::int64_t size_type;
|
||||
|
||||
size_type read(char* buf, int slot, size_type offset, size_type size);
|
||||
void write(const char* buf, int slot, size_type offset, size_type size);
|
||||
|
||||
|
@ -93,7 +89,6 @@ namespace libtorrent
|
|||
class piece_manager : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
typedef boost::int64_t size_type;
|
||||
|
||||
piece_manager(
|
||||
const torrent_info& info
|
||||
|
|
|
@ -107,8 +107,6 @@ namespace libtorrent
|
|||
{
|
||||
public:
|
||||
|
||||
typedef boost::int64_t size_type;
|
||||
|
||||
torrent(
|
||||
detail::session_impl& ses
|
||||
, const torrent_info& torrent_file
|
||||
|
|
|
@ -64,8 +64,6 @@ namespace libtorrent
|
|||
|
||||
struct torrent_status
|
||||
{
|
||||
typedef boost::int64_t size_type;
|
||||
|
||||
torrent_status()
|
||||
: state(queued_for_checking)
|
||||
, progress(0.f)
|
||||
|
|
|
@ -82,8 +82,6 @@ namespace libtorrent
|
|||
{
|
||||
public:
|
||||
|
||||
typedef boost::int64_t size_type;
|
||||
|
||||
torrent_info(const entry& torrent_file)
|
||||
: m_creation_date(boost::gregorian::date(1970
|
||||
, boost::gregorian::Jan
|
||||
|
|
|
@ -167,22 +167,22 @@ namespace libtorrent
|
|||
m_impl->close();
|
||||
}
|
||||
|
||||
file::size_type file::write(const char* buf, file::size_type num_bytes)
|
||||
size_type file::write(const char* buf, size_type num_bytes)
|
||||
{
|
||||
return m_impl->write(buf, num_bytes);
|
||||
}
|
||||
|
||||
file::size_type file::read(char* buf, file::size_type num_bytes)
|
||||
size_type file::read(char* buf, size_type num_bytes)
|
||||
{
|
||||
return m_impl->read(buf, num_bytes);
|
||||
}
|
||||
|
||||
void file::seek(file::size_type pos, file::seek_mode m)
|
||||
void file::seek(size_type pos, file::seek_mode m)
|
||||
{
|
||||
m_impl->seek(pos, m.m_val);
|
||||
}
|
||||
|
||||
file::size_type file::tell()
|
||||
size_type file::tell()
|
||||
{
|
||||
return m_impl->tell();
|
||||
}
|
||||
|
|
|
@ -932,7 +932,7 @@ namespace libtorrent
|
|||
|
||||
// verify info_hash
|
||||
const std::string &hash = rd.dict()["info-hash"].string();
|
||||
std::string real_hash(info.info_hash().begin(), info.info_hash().end());
|
||||
std::string real_hash((char*)info.info_hash().begin(), (char*)info.info_hash().end());
|
||||
if (hash != real_hash)
|
||||
return;
|
||||
|
||||
|
@ -1013,12 +1013,23 @@ namespace libtorrent
|
|||
|
||||
std::vector<size_type> file_sizes;
|
||||
entry::list_type& l = rd.dict()["file sizes"].list();
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1300
|
||||
for (entry::list_type::iterator i = l.begin();
|
||||
i != l.end();
|
||||
++i)
|
||||
{
|
||||
file_sizes.push_back(i->integer());
|
||||
}
|
||||
#else
|
||||
// typedef entry::integer_type (entry::*mem_fun_type)() const;
|
||||
|
||||
std::transform(
|
||||
l.begin()
|
||||
, l.end()
|
||||
, std::back_inserter(file_sizes)
|
||||
, boost::bind(&entry::integer, _1));
|
||||
|
||||
#endif
|
||||
if (!match_filesizes(info, save_path, file_sizes))
|
||||
return;
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ namespace libtorrent
|
|||
m_pimpl.swap(other.m_pimpl);
|
||||
}
|
||||
|
||||
storage::size_type storage::read(
|
||||
size_type storage::read(
|
||||
char* buf
|
||||
, int slot
|
||||
, size_type offset
|
||||
|
@ -396,7 +396,6 @@ namespace libtorrent
|
|||
class piece_manager::impl
|
||||
{
|
||||
public:
|
||||
typedef boost::int64_t size_type;
|
||||
|
||||
impl(
|
||||
const torrent_info& info
|
||||
|
@ -555,22 +554,22 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
|
||||
piece_manager::size_type piece_manager::impl::read(
|
||||
size_type piece_manager::impl::read(
|
||||
char* buf
|
||||
, int piece_index
|
||||
, piece_manager::size_type offset
|
||||
, piece_manager::size_type size)
|
||||
, size_type offset
|
||||
, size_type size)
|
||||
{
|
||||
assert(m_piece_to_slot[piece_index] >= 0);
|
||||
int slot = m_piece_to_slot[piece_index];
|
||||
return m_storage.read(buf, slot, offset, size);
|
||||
}
|
||||
|
||||
piece_manager::size_type piece_manager::read(
|
||||
size_type piece_manager::read(
|
||||
char* buf
|
||||
, int piece_index
|
||||
, piece_manager::size_type offset
|
||||
, piece_manager::size_type size)
|
||||
, size_type offset
|
||||
, size_type size)
|
||||
{
|
||||
return m_pimpl->read(buf, piece_index, offset, size);
|
||||
}
|
||||
|
@ -578,8 +577,8 @@ namespace libtorrent
|
|||
void piece_manager::impl::write(
|
||||
const char* buf
|
||||
, int piece_index
|
||||
, piece_manager::size_type offset
|
||||
, piece_manager::size_type size)
|
||||
, size_type offset
|
||||
, size_type size)
|
||||
{
|
||||
int slot = slot_for_piece(piece_index);
|
||||
m_storage.write(buf, slot, offset, size);
|
||||
|
@ -588,8 +587,8 @@ namespace libtorrent
|
|||
void piece_manager::write(
|
||||
const char* buf
|
||||
, int piece_index
|
||||
, piece_manager::size_type offset
|
||||
, piece_manager::size_type size)
|
||||
, size_type offset
|
||||
, size_type size)
|
||||
{
|
||||
m_pimpl->write(buf, piece_index, offset, size);
|
||||
}
|
||||
|
|
|
@ -345,16 +345,16 @@ namespace libtorrent
|
|||
}
|
||||
*/
|
||||
|
||||
torrent::size_type torrent::bytes_left() const
|
||||
size_type torrent::bytes_left() const
|
||||
{
|
||||
return m_torrent_file.total_size() - bytes_done();
|
||||
}
|
||||
|
||||
torrent::size_type torrent::bytes_done() const
|
||||
size_type torrent::bytes_done() const
|
||||
{
|
||||
const int last_piece = m_torrent_file.num_pieces()-1;
|
||||
|
||||
torrent::size_type total_done
|
||||
size_type total_done
|
||||
= m_num_pieces * m_torrent_file.piece_length();
|
||||
|
||||
// if we have the last piece, we have to correct
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace libtorrent
|
|||
ret.dict()["file-version"] = 1;
|
||||
|
||||
const sha1_hash& info_hash = t->torrent_file().info_hash();
|
||||
ret.dict()["info-hash"] = std::string(info_hash.begin(), info_hash.end());
|
||||
ret.dict()["info-hash"] = std::string((char*)info_hash.begin(), (char*)info_hash.end());
|
||||
|
||||
ret.dict()["slots"] = entry(entry::list_t);
|
||||
entry::list_type& slots = ret.dict()["slots"].list();
|
||||
|
@ -222,7 +222,7 @@ namespace libtorrent
|
|||
unsigned char v = 0;
|
||||
for (int k = 0; k < 8; ++k)
|
||||
v |= i->finished_blocks[j*8+k]?(1 << k):0;
|
||||
bitmask.push_back(v);
|
||||
bitmask.insert(bitmask.end(), v);
|
||||
}
|
||||
piece_struct["bitmask"] = bitmask;
|
||||
|
||||
|
|
Loading…
Reference in New Issue