From 1ed1963f2937e93520230523eb0dc14f0089b73a Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 3 Dec 2014 04:32:50 +0000 Subject: [PATCH] remove size_type typedef in favor of boost::int64_t --- include/libtorrent/disk_io_thread.hpp | 2 +- include/libtorrent/entry.hpp | 4 +- include/libtorrent/escape_string.hpp | 4 +- include/libtorrent/file.hpp | 15 ++-- include/libtorrent/file_storage.hpp | 48 ++++++------- include/libtorrent/http_parser.hpp | 21 +++--- include/libtorrent/http_seed_connection.hpp | 4 +- include/libtorrent/kademlia/node.hpp | 2 +- include/libtorrent/kademlia/routing_table.hpp | 3 +- include/libtorrent/part_file.hpp | 5 +- include/libtorrent/peer_connection.hpp | 14 ++-- .../libtorrent/peer_connection_interface.hpp | 2 +- include/libtorrent/peer_info.hpp | 7 +- include/libtorrent/peer_list.hpp | 1 - include/libtorrent/rss.hpp | 3 +- include/libtorrent/session_status.hpp | 27 ++++--- include/libtorrent/size_type.hpp | 54 -------------- include/libtorrent/socket_type.hpp | 2 +- include/libtorrent/stat.hpp | 22 +++--- include/libtorrent/stat_cache.hpp | 10 +-- include/libtorrent/storage.hpp | 8 +-- include/libtorrent/torrent.hpp | 10 +-- include/libtorrent/torrent_handle.hpp | 24 +++---- include/libtorrent/torrent_info.hpp | 9 ++- include/libtorrent/tracker_manager.hpp | 11 ++- include/libtorrent/web_peer_connection.hpp | 6 +- src/allocator.cpp | 6 +- src/bt_peer_connection.cpp | 20 +++--- src/choker.cpp | 22 +++--- src/disk_io_thread.cpp | 2 +- src/escape_string.cpp | 6 +- src/file.cpp | 22 +++--- src/file_storage.cpp | 50 ++++++------- src/http_parser.cpp | 16 ++--- src/http_seed_connection.cpp | 2 +- src/kademlia/routing_table.cpp | 6 +- src/part_file.cpp | 14 ++-- src/peer_connection.cpp | 14 ++-- src/peer_list.cpp | 2 +- src/stat.cpp | 4 +- src/stat_cache.cpp | 4 +- src/storage.cpp | 20 +++--- src/torrent.cpp | 70 +++++++++---------- src/torrent_handle.cpp | 2 +- src/torrent_info.cpp | 8 +-- src/web_peer_connection.cpp | 28 ++++---- test/setup_transfer.cpp | 2 +- test/test_file.cpp | 2 +- test/test_http_parser.cpp | 7 +- test/test_peer_list.cpp | 4 +- test/test_rss.cpp | 4 +- test/test_torrent.cpp | 4 +- test/test_torrent_parse.cpp | 2 +- test/web_seed_suite.cpp | 2 +- 54 files changed, 300 insertions(+), 363 deletions(-) delete mode 100644 include/libtorrent/size_type.hpp diff --git a/include/libtorrent/disk_io_thread.hpp b/include/libtorrent/disk_io_thread.hpp index a1d7a2253..f70523abe 100644 --- a/include/libtorrent/disk_io_thread.hpp +++ b/include/libtorrent/disk_io_thread.hpp @@ -174,7 +174,7 @@ namespace libtorrent // the number of bytes queued for writing, including bytes // submitted to the OS for writing, but not yet complete - mutable size_type queued_bytes; + mutable boost::int64_t queued_bytes; // the number of 16 KiB blocks currently in the disk cache (both read and write). // This includes both read and write cache. diff --git a/include/libtorrent/entry.hpp b/include/libtorrent/entry.hpp index 1b3a17d23..8e71f56aa 100644 --- a/include/libtorrent/entry.hpp +++ b/include/libtorrent/entry.hpp @@ -63,8 +63,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include -#include "libtorrent/size_type.hpp" #include "libtorrent/config.hpp" #include "libtorrent/assert.hpp" #include "libtorrent/error_code.hpp" @@ -100,7 +100,7 @@ namespace libtorrent typedef std::map dictionary_type; typedef std::string string_type; typedef std::list list_type; - typedef size_type integer_type; + typedef boost::int64_t integer_type; // the types an entry can have enum data_type diff --git a/include/libtorrent/escape_string.hpp b/include/libtorrent/escape_string.hpp index 644fb2853..b87c2f9ed 100644 --- a/include/libtorrent/escape_string.hpp +++ b/include/libtorrent/escape_string.hpp @@ -37,12 +37,12 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include "libtorrent/config.hpp" -#include "libtorrent/size_type.hpp" #include "libtorrent/error_code.hpp" namespace libtorrent { - TORRENT_EXTRA_EXPORT boost::array::digits10> to_string(size_type n); + TORRENT_EXTRA_EXPORT boost::array::digits10> + to_string(boost::int64_t n); TORRENT_EXTRA_EXPORT std::string unescape_string(std::string const& s, error_code& ec); // replaces all disallowed URL characters by their %-encoding diff --git a/include/libtorrent/file.hpp b/include/libtorrent/file.hpp index 5e395ca11..760b11de3 100644 --- a/include/libtorrent/file.hpp +++ b/include/libtorrent/file.hpp @@ -49,7 +49,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/error_code.hpp" -#include "libtorrent/size_type.hpp" #include "libtorrent/assert.hpp" #include "libtorrent/time.hpp" #include "libtorrent/intrusive_ptr_base.hpp" @@ -96,7 +95,7 @@ namespace libtorrent struct file_status { - size_type file_size; + boost::int64_t file_size; boost::uint64_t atime; boost::uint64_t mtime; boost::uint64_t ctime; @@ -133,7 +132,7 @@ namespace libtorrent , error_code& ec); TORRENT_EXTRA_EXPORT void remove(std::string const& f, error_code& ec); TORRENT_EXTRA_EXPORT bool exists(std::string const& f); - TORRENT_EXTRA_EXPORT size_type file_size(std::string const& f); + TORRENT_EXTRA_EXPORT boost::int64_t file_size(std::string const& f); TORRENT_EXTRA_EXPORT bool is_directory(std::string const& f , error_code& ec); TORRENT_EXTRA_EXPORT void recursive_copy(std::string const& old_path @@ -309,20 +308,20 @@ typedef boost::intrusive_ptr file_handle; bool open(std::string const& p, int m, error_code& ec); bool is_open() const; void close(); - bool set_size(size_type size, error_code& ec); + bool set_size(boost::int64_t size, error_code& ec); int open_mode() const { return m_open_mode; } - size_type writev(size_type file_offset, iovec_t const* bufs, int num_bufs + boost::int64_t writev(boost::int64_t file_offset, iovec_t const* bufs, int num_bufs , error_code& ec, int flags = 0); - size_type readv(size_type file_offset, iovec_t const* bufs, int num_bufs + boost::int64_t readv(boost::int64_t file_offset, iovec_t const* bufs, int num_bufs , error_code& ec, int flags = 0); - size_type get_size(error_code& ec) const; + boost::int64_t get_size(error_code& ec) const; // return the offset of the first byte that // belongs to a data-region - size_type sparse_end(size_type start) const; + boost::int64_t sparse_end(boost::int64_t start) const; handle_type native_handle() const { return m_file_handle; } diff --git a/include/libtorrent/file_storage.hpp b/include/libtorrent/file_storage.hpp index 20738cb8a..734441dfd 100644 --- a/include/libtorrent/file_storage.hpp +++ b/include/libtorrent/file_storage.hpp @@ -36,8 +36,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include -#include "libtorrent/size_type.hpp" #include "libtorrent/assert.hpp" #include "libtorrent/peer_request.hpp" #include "libtorrent/peer_id.hpp" @@ -63,12 +63,12 @@ namespace libtorrent std::string symlink_path; // the offset of this file inside the torrent - size_type offset; + boost::int64_t offset; // the size of the file (in bytes) and ``offset`` is the byte offset // of the file within the torrent. i.e. the sum of all the sizes of the files // before it in the list. - size_type size; + boost::int64_t size; // the offset in the file where the storage should start. The normal // case is to have this set to 0, so that the storage starts saving data at the start @@ -76,7 +76,7 @@ namespace libtorrent // the ``file_base`` should be set to an offset so that the different regions do // not overlap. This is used when mapping "unselected" files into a so-called part // file. - size_type file_base; + boost::int64_t file_base; // the modification time of this file specified in posix time. std::time_t mtime; @@ -220,10 +220,10 @@ namespace libtorrent int file_index; // the offset from the start of the file, in bytes - size_type offset; + boost::int64_t offset; // the size of the window, in bytes - size_type size; + boost::int64_t size; }; // The ``file_storage`` class represents a file list and the piece @@ -284,7 +284,7 @@ namespace libtorrent // The built in functions to traverse a directory to add files will // make sure this requirement is fulfilled. void add_file(file_entry const& e, char const* filehash = 0); - void add_file(std::string const& p, size_type size, int flags = 0 + void add_file(std::string const& p, boost::int64_t size, int flags = 0 , std::time_t mtime = 0, std::string const& s_p = ""); // renames the file at ``index`` to ``new_filename``. Keep in mind @@ -303,7 +303,7 @@ namespace libtorrent // 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 + void add_file(std::wstring const& p, boost::int64_t size, int flags = 0 , 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; @@ -317,13 +317,13 @@ namespace libtorrent // returns a list of file_slice objects representing the portions of // files the specified piece index, byte offset and size range overlaps. // this is the inverse mapping of map_file(). - std::vector map_block(int piece, size_type offset + std::vector map_block(int piece, boost::int64_t offset , int size) const; // returns a peer_request representing the piece index, byte offset // and size the specified file range overlaps. This is the inverse // mapping ove map_block(). - peer_request map_file(int file, size_type offset, int size) const; + peer_request map_file(int file, boost::int64_t offset, int size) const; #ifndef TORRENT_NO_DEPRECATE // all functions depending on internal_file_entry @@ -333,7 +333,7 @@ namespace libtorrent typedef std::vector::const_reverse_iterator reverse_iterator; TORRENT_DEPRECATED_PREFIX - iterator file_at_offset(size_type offset) const TORRENT_DEPRECATED; + iterator file_at_offset(boost::int64_t offset) const TORRENT_DEPRECATED; TORRENT_DEPRECATED_PREFIX iterator begin() const TORRENT_DEPRECATED { return m_files.begin(); } TORRENT_DEPRECATED_PREFIX @@ -356,7 +356,7 @@ namespace libtorrent iterator end_deprecated() const { return m_files.end(); } reverse_iterator rbegin_deprecated() const { return m_files.rbegin(); } reverse_iterator rend_deprecated() const { return m_files.rend(); } - iterator file_at_offset_deprecated(size_type offset) const; + iterator file_at_offset_deprecated(boost::int64_t offset) const; #endif // TORRENT_NO_DEPRECATE // returns the number of files in the file_storage @@ -368,7 +368,7 @@ namespace libtorrent file_entry at(int index) const; // returns the total number of bytes all the files in this torrent spans - size_type total_size() const { return m_total_size; } + boost::int64_t total_size() const { return m_total_size; } // set and get the number of pieces in the torrent void set_num_pieces(int n) { m_num_pieces = n; } @@ -450,9 +450,9 @@ namespace libtorrent time_t mtime(int index) const; std::string file_path(int index, std::string const& save_path = "") const; std::string file_name(int index) const; - size_type file_size(int index) const; + boost::int64_t file_size(int index) const; bool pad_file_at(int index) const; - size_type file_offset(int index) const; + boost::int64_t file_offset(int index) const; // flags indicating various attributes for files in // a file_storage. @@ -490,11 +490,11 @@ namespace libtorrent // the filesystem by making them all point to the same filename, but with // different file bases, so that they don't overlap. // torrent_info::remap_files() can be used to use a new file layout. - size_type file_base(int index) const; - void set_file_base(int index, size_type off); + boost::int64_t file_base(int index) const; + void set_file_base(int index, boost::int64_t off); // returns the index of the file at the given offset in the torrent - int file_index_at_offset(size_type offset) const; + int file_index_at_offset(boost::int64_t offset) const; // low-level function. returns a pointer to the internal storage for // the filename. This string may not be null terinated! @@ -513,19 +513,19 @@ namespace libtorrent TORRENT_DEPRECATED_PREFIX int file_index(internal_file_entry const& fe) const TORRENT_DEPRECATED; TORRENT_DEPRECATED_PREFIX - size_type file_base(internal_file_entry const& fe) const TORRENT_DEPRECATED; + boost::int64_t file_base(internal_file_entry const& fe) const TORRENT_DEPRECATED; TORRENT_DEPRECATED_PREFIX - void set_file_base(internal_file_entry const& fe, size_type off) TORRENT_DEPRECATED; + void set_file_base(internal_file_entry const& fe, boost::int64_t off) TORRENT_DEPRECATED; TORRENT_DEPRECATED_PREFIX std::string file_path(internal_file_entry const& fe, std::string const& save_path = "") const TORRENT_DEPRECATED; TORRENT_DEPRECATED_PREFIX std::string file_name(internal_file_entry const& fe) const TORRENT_DEPRECATED; TORRENT_DEPRECATED_PREFIX - size_type file_size(internal_file_entry const& fe) const TORRENT_DEPRECATED; + boost::int64_t file_size(internal_file_entry const& fe) const TORRENT_DEPRECATED; TORRENT_DEPRECATED_PREFIX bool pad_file_at(internal_file_entry const& fe) const TORRENT_DEPRECATED; TORRENT_DEPRECATED_PREFIX - size_type file_offset(internal_file_entry const& fe) const TORRENT_DEPRECATED; + boost::int64_t file_offset(internal_file_entry const& fe) const TORRENT_DEPRECATED; #endif private: @@ -565,7 +565,7 @@ namespace libtorrent // if any file has a non-zero file base (i.e. multiple // files residing in the same physical file at different // offsets) - std::vector m_file_base; + std::vector m_file_base; // all unique paths files have. The internal_file_entry::path_index // points into this array. The paths don't include the root directory @@ -579,7 +579,7 @@ namespace libtorrent std::string m_name; // the sum of all filesizes - size_type m_total_size; + boost::int64_t m_total_size; // the number of files. This is used when // the torrent is unloaded diff --git a/include/libtorrent/http_parser.hpp b/include/libtorrent/http_parser.hpp index ece441d29..563989d7e 100644 --- a/include/libtorrent/http_parser.hpp +++ b/include/libtorrent/http_parser.hpp @@ -51,7 +51,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/buffer.hpp" -#include "libtorrent/size_type.hpp" namespace libtorrent { @@ -91,8 +90,8 @@ namespace libtorrent boost::tuple incoming(buffer::const_interval recv_buffer , bool& error); int body_start() const { return m_body_start_pos; } - size_type content_length() const { return m_content_length; } - std::pair content_range() const + boost::int64_t content_length() const { return m_content_length; } + std::pair content_range() const { return std::make_pair(m_range_start, m_range_end); } // returns true if this response is using chunked encoding. @@ -122,7 +121,7 @@ namespace libtorrent // size may still have been modified, but their values are // undefined bool parse_chunk_header(buffer::const_interval buf - , size_type* chunk_size, int* header_size); + , boost::int64_t* chunk_size, int* header_size); // reset the whole state and start over void reset(); @@ -130,29 +129,29 @@ namespace libtorrent bool connection_close() const { return m_connection_close; } std::multimap const& headers() const { return m_header; } - std::vector > const& chunks() const { return m_chunked_ranges; } + std::vector > const& chunks() const { return m_chunked_ranges; } private: - size_type m_recv_pos; + boost::int64_t m_recv_pos; std::string m_method; std::string m_path; std::string m_protocol; std::string m_server_message; - size_type m_content_length; - size_type m_range_start; - size_type m_range_end; + boost::int64_t m_content_length; + boost::int64_t m_range_start; + boost::int64_t m_range_end; std::multimap m_header; buffer::const_interval m_recv_buffer; // contains offsets of the first and one-past-end of // each chunked range in the response - std::vector > m_chunked_ranges; + std::vector > m_chunked_ranges; // while reading a chunk, this is the offset where the // current chunk will end (it refers to the first character // in the chunk tail header or the next chunk header) - size_type m_cur_chunk_end; + boost::int64_t m_cur_chunk_end; int m_status_code; diff --git a/include/libtorrent/http_seed_connection.hpp b/include/libtorrent/http_seed_connection.hpp index ee308a3fa..066f0459c 100644 --- a/include/libtorrent/http_seed_connection.hpp +++ b/include/libtorrent/http_seed_connection.hpp @@ -115,7 +115,7 @@ namespace libtorrent // the number of bytes left to receive of the response we're // currently parsing - size_type m_response_left; + boost::int64_t m_response_left; // this is the offset inside the current receive // buffer where the next chunk header will be. @@ -123,7 +123,7 @@ namespace libtorrent // parsed. It does not necessarily point to a valid // offset in the receive buffer, if we haven't received // it yet. This offset never includes the HTTP header - size_type m_chunk_pos; + boost::int64_t m_chunk_pos; // this is the number of bytes we've already received // from the next chunk header we're waiting for diff --git a/include/libtorrent/kademlia/node.hpp b/include/libtorrent/kademlia/node.hpp index 8221dd5f8..ecdc7cbf5 100644 --- a/include/libtorrent/kademlia/node.hpp +++ b/include/libtorrent/kademlia/node.hpp @@ -224,7 +224,7 @@ public: node_id const& nid() const { return m_id; } boost::tuple size() const { return m_table.size(); } - size_type num_global_nodes() const + boost::int64_t num_global_nodes() const { return m_table.num_global_nodes(); } int data_size() const { return int(m_map.size()); } diff --git a/include/libtorrent/kademlia/routing_table.hpp b/include/libtorrent/kademlia/routing_table.hpp index 830576274..8abc3f9f6 100644 --- a/include/libtorrent/kademlia/routing_table.hpp +++ b/include/libtorrent/kademlia/routing_table.hpp @@ -47,7 +47,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include #include #include #include @@ -159,7 +158,7 @@ public: // been pinged and confirmed up boost::tuple size() const; - size_type num_global_nodes() const; + boost::int64_t num_global_nodes() const; // the number of bits down we have full buckets // i.e. essentially the number of full buckets diff --git a/include/libtorrent/part_file.hpp b/include/libtorrent/part_file.hpp index a07697176..298d28bf2 100644 --- a/include/libtorrent/part_file.hpp +++ b/include/libtorrent/part_file.hpp @@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "libtorrent/config.hpp" #include "libtorrent/file.hpp" #include "libtorrent/error_code.hpp" @@ -56,8 +57,8 @@ namespace libtorrent void move_partfile(std::string const& path, error_code& ec); - void import_file(file& f, size_type offset, size_type size, error_code& ec); - void export_file(file& f, size_type offset, size_type size, error_code& ec); + void import_file(file& f, boost::int64_t offset, boost::int64_t size, error_code& ec); + void export_file(file& f, boost::int64_t offset, boost::int64_t size, error_code& ec); // flush the metadata void flush_metadata(error_code& ec); diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index 25eda5bd6..a8840339f 100644 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -472,7 +472,7 @@ namespace libtorrent { return m_torrent; } stat const& statistics() const { return m_statistics; } - void add_stat(size_type downloaded, size_type uploaded); + void add_stat(boost::int64_t downloaded, boost::int64_t uploaded); void sent_bytes(int bytes_payload, int bytes_protocol); void received_bytes(int bytes_payload, int bytes_protocol); void trancieve_ip_packet(int bytes, bool ipv6); @@ -718,13 +718,13 @@ namespace libtorrent time_t last_seen_complete() const { return m_last_seen_complete; } void set_last_seen_complete(int ago) { m_last_seen_complete = time(0) - ago; } - size_type uploaded_in_last_round() const + boost::int64_t uploaded_in_last_round() const { return m_statistics.total_payload_upload() - m_uploaded_at_last_round; } - size_type downloaded_in_last_round() const + boost::int64_t downloaded_in_last_round() const { return m_statistics.total_payload_download() - m_downloaded_at_last_round; } - size_type uploaded_since_unchoked() const + boost::int64_t uploaded_since_unchoked() const { return m_statistics.total_payload_upload() - m_uploaded_at_last_unchoke; } // the time we last unchoked this peer @@ -975,8 +975,8 @@ namespace libtorrent // measure the number of bytes transferred during // an unchoke cycle, to unchoke peers the more bytes // they sent us - size_type m_downloaded_at_last_round; - size_type m_uploaded_at_last_round; + boost::int64_t m_downloaded_at_last_round; + boost::int64_t m_uploaded_at_last_round; // this is the number of bytes we had uploaded the // last time this peer was unchoked. This does not @@ -984,7 +984,7 @@ namespace libtorrent // track upload across rounds, for the full duration of // the peer being unchoked. Specifically, it's used // for the round-robin unchoke algorithm. - size_type m_uploaded_at_last_unchoke; + boost::int64_t m_uploaded_at_last_unchoke; // the number of bytes that the other // end has to send us in order to respond diff --git a/include/libtorrent/peer_connection_interface.hpp b/include/libtorrent/peer_connection_interface.hpp index c77116e6b..64c79cf80 100644 --- a/include/libtorrent/peer_connection_interface.hpp +++ b/include/libtorrent/peer_connection_interface.hpp @@ -79,7 +79,7 @@ namespace libtorrent virtual torrent_peer* peer_info_struct() const = 0; virtual void set_peer_info(torrent_peer* pi) = 0; virtual bool is_outgoing() const = 0; - virtual void add_stat(size_type downloaded, size_type uploaded) = 0; + virtual void add_stat(boost::int64_t downloaded, boost::int64_t uploaded) = 0; virtual bool fast_reconnect() const = 0; virtual bool is_choked() const = 0; virtual bool failed() const = 0; diff --git a/include/libtorrent/peer_info.hpp b/include/libtorrent/peer_info.hpp index 1abe586ab..84dad29ed 100644 --- a/include/libtorrent/peer_info.hpp +++ b/include/libtorrent/peer_info.hpp @@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/socket.hpp" #include "libtorrent/deadline_timer.hpp" #include "libtorrent/peer_id.hpp" -#include "libtorrent/size_type.hpp" #include "libtorrent/config.hpp" #include "libtorrent/bitfield.hpp" #include "libtorrent/time.hpp" @@ -66,8 +65,8 @@ namespace libtorrent // the total number of bytes downloaded from and uploaded to this peer. // These numbers do not include the protocol chatter, but only the // payload data. - size_type total_download; - size_type total_upload; + boost::int64_t total_download; + boost::int64_t total_upload; // the time since we last sent a request to this peer and since any // transfer occurred with this peer @@ -429,7 +428,7 @@ namespace libtorrent // but this member says how much *extra* free upload this peer has got. // If it is a negative number it means that this was a peer from which we // have got this amount of free download. - size_type load_balancing; + boost::int64_t load_balancing; #endif }; diff --git a/include/libtorrent/peer_list.hpp b/include/libtorrent/peer_list.hpp index f93376169..6009e9b29 100644 --- a/include/libtorrent/peer_list.hpp +++ b/include/libtorrent/peer_list.hpp @@ -41,7 +41,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/piece_picker.hpp" #include "libtorrent/socket.hpp" #include "libtorrent/address.hpp" -#include "libtorrent/size_type.hpp" #include "libtorrent/invariant_check.hpp" #include "libtorrent/config.hpp" #include "libtorrent/debug.hpp" diff --git a/include/libtorrent/rss.hpp b/include/libtorrent/rss.hpp index 5a32b352b..9893d43c2 100644 --- a/include/libtorrent/rss.hpp +++ b/include/libtorrent/rss.hpp @@ -35,7 +35,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/torrent_handle.hpp" #include "libtorrent/add_torrent_params.hpp" -#include "libtorrent/size_type.hpp" #include #include @@ -64,7 +63,7 @@ namespace libtorrent // the total size of the content the torrent refers to, or -1 // if no size was specified by the feed. - size_type size; + boost::int64_t size; // the handle to the torrent, if the session is already downloading // this torrent. diff --git a/include/libtorrent/session_status.hpp b/include/libtorrent/session_status.hpp index 9783247a4..ece316ad9 100644 --- a/include/libtorrent/session_status.hpp +++ b/include/libtorrent/session_status.hpp @@ -34,7 +34,6 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_SESSION_STATUS_HPP_INCLUDED #include "libtorrent/config.hpp" -#include "libtorrent/size_type.hpp" #include namespace libtorrent @@ -147,8 +146,8 @@ namespace libtorrent // the total number of bytes downloaded and // uploaded to and from all torrents. This also includes all the protocol overhead. - size_type total_download; - size_type total_upload; + boost::int64_t total_download; + boost::int64_t total_upload; // the rate of the payload // down- and upload only. @@ -158,38 +157,38 @@ namespace libtorrent // the total transfers of payload // only. The payload does not include the bittorrent protocol overhead, but only parts of the // actual files to be downloaded. - size_type total_payload_download; - size_type total_payload_upload; + boost::int64_t total_payload_download; + boost::int64_t total_payload_upload; // the estimated TCP/IP overhead in each direction. int ip_overhead_upload_rate; int ip_overhead_download_rate; - size_type total_ip_overhead_download; - size_type total_ip_overhead_upload; + boost::int64_t total_ip_overhead_download; + boost::int64_t total_ip_overhead_upload; // the upload and download rate used by DHT traffic. Also the total number // of bytes sent and received to and from the DHT. int dht_upload_rate; int dht_download_rate; - size_type total_dht_download; - size_type total_dht_upload; + boost::int64_t total_dht_download; + boost::int64_t total_dht_upload; // the upload and download rate used by tracker traffic. Also the total number // of bytes sent and received to and from trackers. int tracker_upload_rate; int tracker_download_rate; - size_type total_tracker_download; - size_type total_tracker_upload; + boost::int64_t total_tracker_download; + boost::int64_t total_tracker_upload; // the number of bytes that has been received more than once. // This can happen if a request from a peer times out and is requested from a different // peer, and then received again from the first one. To make this lower, increase the // ``request_timeout`` and the ``piece_timeout`` in the session settings. - size_type total_redundant_bytes; + boost::int64_t total_redundant_bytes; // the number of bytes that was downloaded which later failed // the hash-check. - size_type total_failed_bytes; + boost::int64_t total_failed_bytes; // the total number of peer connections this session has. This includes // incoming connections that still hasn't sent their handshake or outgoing connections @@ -244,7 +243,7 @@ namespace libtorrent // an estimation of the total number of nodes in the DHT // network. - size_type dht_global_nodes; + boost::int64_t dht_global_nodes; // a vector of the currently running DHT lookups. std::vector active_requests; diff --git a/include/libtorrent/size_type.hpp b/include/libtorrent/size_type.hpp deleted file mode 100644 index bd179c1eb..000000000 --- a/include/libtorrent/size_type.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - -Copyright (c) 2003-2014, 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 - -#ifdef _MSC_VER -#pragma warning(push, 1) -#endif - -#include - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -namespace libtorrent -{ - // TODO: remove these and just use boost's types directly - typedef boost::int64_t size_type; - typedef boost::uint64_t unsigned_size_type; -} - - -#endif diff --git a/include/libtorrent/socket_type.hpp b/include/libtorrent/socket_type.hpp index 1e51c6ac9..96dbf5946 100644 --- a/include/libtorrent/socket_type.hpp +++ b/include/libtorrent/socket_type.hpp @@ -310,7 +310,7 @@ namespace libtorrent >::value }; - size_type m_data[(storage_size + sizeof(size_type) - 1) / sizeof(size_type)]; + boost::int64_t m_data[(storage_size + sizeof(boost::int64_t) - 1) / sizeof(boost::int64_t)]; }; // returns true if this socket is an SSL socket diff --git a/include/libtorrent/stat.hpp b/include/libtorrent/stat.hpp index 48fb9396c..9170ed1f8 100644 --- a/include/libtorrent/stat.hpp +++ b/include/libtorrent/stat.hpp @@ -37,8 +37,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include -#include "libtorrent/size_type.hpp" #include "libtorrent/invariant_check.hpp" #include "libtorrent/config.hpp" #include "libtorrent/assert.hpp" @@ -78,9 +78,9 @@ namespace libtorrent int rate() const { return m_5_sec_average; } int low_pass_rate() const { return m_5_sec_average; } - size_type total() const { return m_total_counter; } + boost::int64_t total() const { return m_total_counter; } - void offset(size_type c) + void offset(boost::int64_t c) { TORRENT_ASSERT(c >= 0); TORRENT_ASSERT(m_total_counter >= 0); @@ -203,14 +203,14 @@ namespace libtorrent + m_stat[download_ip_protocol].rate(); } - size_type total_upload() const + boost::int64_t total_upload() const { return m_stat[upload_payload].total() + m_stat[upload_protocol].total() + m_stat[upload_ip_protocol].total(); } - size_type total_download() const + boost::int64_t total_download() const { return m_stat[download_payload].total() + m_stat[download_protocol].total() @@ -222,17 +222,17 @@ namespace libtorrent int download_payload_rate() const { return m_stat[download_payload].rate(); } - size_type total_payload_upload() const + boost::int64_t total_payload_upload() const { return m_stat[upload_payload].total(); } - size_type total_payload_download() const + boost::int64_t total_payload_download() const { return m_stat[download_payload].total(); } - size_type total_protocol_upload() const + boost::int64_t total_protocol_upload() const { return m_stat[upload_protocol].total(); } - size_type total_protocol_download() const + boost::int64_t total_protocol_download() const { return m_stat[download_protocol].total(); } - size_type total_transfer(int channel) const + boost::int64_t total_transfer(int channel) const { return m_stat[channel].total(); } int transfer_rate(int channel) const { return m_stat[channel].rate(); } @@ -240,7 +240,7 @@ namespace libtorrent // this is used to offset the statistics when a // peer_connection is opened and have some previous // transfers from earlier connections. - void add_stat(size_type downloaded, size_type uploaded) + void add_stat(boost::int64_t downloaded, boost::int64_t uploaded) { m_stat[download_payload].offset(downloaded); m_stat[upload_payload].offset(uploaded); diff --git a/include/libtorrent/stat_cache.hpp b/include/libtorrent/stat_cache.hpp index 15d9239df..5a8ac0fc7 100644 --- a/include/libtorrent/stat_cache.hpp +++ b/include/libtorrent/stat_cache.hpp @@ -35,8 +35,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +#include #include "libtorrent/config.hpp" -#include "libtorrent/size_type.hpp" namespace libtorrent { @@ -56,10 +56,10 @@ namespace libtorrent // returns the size of the file or one // of the enums, noent or not_in_cache - size_type get_filesize(int i) const; + boost::int64_t get_filesize(int i) const; time_t get_filetime(int i) const; - void set_cache(int i, size_type size, time_t time); + void set_cache(int i, boost::int64_t size, time_t time); void set_noexist(int i); void set_error(int i); void set_dirty(int i); @@ -70,8 +70,8 @@ namespace libtorrent struct stat_cache_t { - stat_cache_t(size_type s, time_t t = 0): file_size(s), file_time(t) {} - size_type file_size; + stat_cache_t(boost::int64_t s, time_t t = 0): file_size(s), file_time(t) {} + boost::int64_t file_size; time_t file_time; }; std::vector m_stat_cache; diff --git a/include/libtorrent/storage.hpp b/include/libtorrent/storage.hpp index d5e72101c..fb44a8608 100644 --- a/include/libtorrent/storage.hpp +++ b/include/libtorrent/storage.hpp @@ -118,7 +118,7 @@ POSSIBILITY OF SUCH DAMAGE. // virtual bool move_storage(std::string const& save_path) { return false; } // virtual bool verify_resume_data(lazy_entry const& rd, storage_error& error) { return false; } // virtual bool write_resume_data(entry& rd) const { return false; } -// virtual size_type physical_offset(int slot, int offset) +// virtual boost::int64_t physical_offset(int slot, int offset) // { return slot * m_files.piece_length() + offset; }; // virtual sha1_hash hash_for_slot(int slot, partial_hash& ph, int piece_size) // { @@ -157,14 +157,14 @@ namespace libtorrent namespace aux { struct session_settings; } struct cached_piece_entry; - TORRENT_EXTRA_EXPORT std::vector > get_filesizes( + TORRENT_EXTRA_EXPORT std::vector > get_filesizes( file_storage const& t , std::string const& p); TORRENT_EXTRA_EXPORT bool match_filesizes( file_storage const& t , std::string const& p - , std::vector > const& sizes + , std::vector > const& sizes , bool compact_mode , std::string* error = 0); @@ -442,7 +442,7 @@ namespace libtorrent struct fileop { // file operation - size_type (file::*op)(size_type file_offset + boost::int64_t (file::*op)(boost::int64_t file_offset , file::iovec_t const* bufs, int num_bufs, error_code& ec, int flags); // file open mode (file::read_only, file::write_only etc.) // this is used to open the file, but also passed along as the diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 6f7c4cbbe..769d8a5d6 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -404,10 +404,10 @@ namespace libtorrent std::string name() const; stat statistics() const { return m_stat; } - size_type bytes_left() const; + boost::int64_t bytes_left() const; int block_bytes_wanted(piece_block const& p) const; void bytes_done(torrent_status& st, bool accurate) const; - size_type quantized_bytes_done() const; + boost::int64_t quantized_bytes_done() const; void sent_bytes(int bytes_payload, int bytes_protocol); void received_bytes(int bytes_payload, int bytes_protocol); @@ -518,7 +518,7 @@ namespace libtorrent // it, add it to the m_state_updates list in session_impl void state_updated(); - void file_progress(std::vector& fp, int flags = 0); + void file_progress(std::vector& fp, int flags = 0); #ifndef TORRENT_NO_DEPRECATED void use_interface(std::string net_interface); @@ -1156,8 +1156,8 @@ namespace libtorrent // all time totals of uploaded and downloaded payload // stored in resume data - size_type m_total_uploaded; - size_type m_total_downloaded; + boost::int64_t m_total_uploaded; + boost::int64_t m_total_downloaded; // if this pointer is 0, the torrent is in // a state where the metadata hasn't been diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index b66abbc5a..b4f888c2a 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -435,7 +435,7 @@ namespace libtorrent // fully downloaded and passed the hash check count. When specifying // piece granularity, the operation is a lot cheaper, since libtorrent // already keeps track of this internally and no calculation is required. - void file_progress(std::vector& progress, int flags = 0) const; + void file_progress(std::vector& progress, int flags = 0) const; // This function fills in the passed in vector with status about files // that are open for this torrent. Any file that is not open in this @@ -1360,19 +1360,19 @@ namespace libtorrent // torrent is paused and restarted again. When a torrent is paused, these // counters are reset to 0. If you want complete, persistent, stats, see // ``all_time_upload`` and ``all_time_download``. - size_type total_download; - size_type total_upload; + boost::int64_t total_download; + boost::int64_t total_upload; // counts the amount of bytes send and received this session, but only // the actual payload data (i.e the interesting data), these counters // ignore any protocol overhead. - size_type total_payload_download; - size_type total_payload_upload; + boost::int64_t total_payload_download; + boost::int64_t total_payload_upload; // the number of bytes that has been downloaded and that has failed the // piece hash test. In other words, this is just how much crap that has // been downloaded. - size_type total_failed_bytes; + boost::int64_t total_failed_bytes; // the number of bytes that has been downloaded even though that data // already was downloaded. The reason for this is that in some situations @@ -1383,7 +1383,7 @@ namespace libtorrent // it sends out are not replied in FIFO-order (it will re-request blocks // that are skipped by an out of order block). This is supposed to be as // low as possible. - size_type total_redundant_bytes; + boost::int64_t total_redundant_bytes; // a bitmask that represents which pieces we have (set to true) and the // pieces we don't have. It's a pointer and may be set to 0 if the @@ -1398,22 +1398,22 @@ namespace libtorrent // the total number of bytes of the file(s) that we have. All this does // not necessarily has to be downloaded during this session (that's // ``total_payload_download``). - size_type total_done; + boost::int64_t total_done; // the number of bytes we have downloaded, only counting the pieces that // we actually want to download. i.e. excluding any pieces that we have // but have priority 0 (i.e. not wanted). - size_type total_wanted_done; + boost::int64_t total_wanted_done; // The total number of bytes we want to download. This may be smaller // than the total torrent size in case any pieces are prioritized to 0, // i.e. not wanted - size_type total_wanted; + boost::int64_t total_wanted; // are accumulated upload and download payload byte counters. They are // saved in and restored from resume data to keep totals across sessions. - size_type all_time_upload; - size_type all_time_download; + boost::int64_t all_time_upload; + boost::int64_t all_time_download; // the posix-time when this torrent was added. i.e. what ``time(NULL)`` // returned at the time. diff --git a/include/libtorrent/torrent_info.hpp b/include/libtorrent/torrent_info.hpp index eccacc65a..f24e56e81 100644 --- a/include/libtorrent/torrent_info.hpp +++ b/include/libtorrent/torrent_info.hpp @@ -51,7 +51,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/entry.hpp" #include "libtorrent/lazy_entry.hpp" #include "libtorrent/peer_id.hpp" -#include "libtorrent/size_type.hpp" #include "libtorrent/time.hpp" #include "libtorrent/assert.hpp" #include "libtorrent/file_storage.hpp" @@ -478,7 +477,7 @@ namespace libtorrent // the piece index as argument and gives you the exact size of that piece. It will always // be the same as ``piece_length()`` except in the case of the last piece, which may // be smaller. - size_type total_size() const { return m_files.total_size(); } + boost::int64_t total_size() const { return m_files.total_size(); } int piece_length() const { return m_files.piece_length(); } int num_pieces() const { return m_files.num_pieces(); } @@ -507,7 +506,7 @@ namespace libtorrent reverse_file_iterator rend_files() const TORRENT_DEPRECATED { return m_files.rend_deprecated(); } TORRENT_DEPRECATED_PREFIX - file_iterator file_at_offset(size_type offset) const TORRENT_DEPRECATED + file_iterator file_at_offset(boost::int64_t offset) const TORRENT_DEPRECATED { return m_files.file_at_offset_deprecated(offset); } #endif // TORRENT_NO_DEPRECATE @@ -520,7 +519,7 @@ namespace libtorrent // This function will map a piece index, a byte offset within that piece and // a size (in bytes) into the corresponding files with offsets where that data // for that piece is supposed to be stored. See file_slice. - std::vector map_block(int piece, size_type offset, int size) const + std::vector map_block(int piece, boost::int64_t offset, int size) const { TORRENT_ASSERT(is_loaded()); return m_files.map_block(piece, offset, size); @@ -533,7 +532,7 @@ namespace libtorrent // The input range is assumed to be valid within the torrent. ``file_offset`` // + ``size`` is not allowed to be greater than the file size. ``file_index`` // must refer to a valid file, i.e. it cannot be >= ``num_files()``. - peer_request map_file(int file, size_type offset, int size) const + peer_request map_file(int file, boost::int64_t offset, int size) const { TORRENT_ASSERT(is_loaded()); return m_files.map_file(file, offset, size); diff --git a/include/libtorrent/tracker_manager.hpp b/include/libtorrent/tracker_manager.hpp index 8b45e1a08..c59d506f1 100644 --- a/include/libtorrent/tracker_manager.hpp +++ b/include/libtorrent/tracker_manager.hpp @@ -60,7 +60,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/peer_id.hpp" #include "libtorrent/peer.hpp" // peer_entry #include "libtorrent/deadline_timer.hpp" -#include "libtorrent/size_type.hpp" #include "libtorrent/union_endpoint.hpp" #include "libtorrent/udp_socket.hpp" // for udp_socket_observer #include "libtorrent/session_settings.hpp" @@ -122,11 +121,11 @@ namespace libtorrent std::string url; std::string trackerid; - size_type downloaded; - size_type uploaded; - size_type left; - size_type corrupt; - size_type redundant; + boost::int64_t downloaded; + boost::int64_t uploaded; + boost::int64_t left; + boost::int64_t corrupt; + boost::int64_t redundant; boost::uint16_t listen_port; // values from event_t diff --git a/include/libtorrent/web_peer_connection.hpp b/include/libtorrent/web_peer_connection.hpp index d59c91081..b9f062d59 100644 --- a/include/libtorrent/web_peer_connection.hpp +++ b/include/libtorrent/web_peer_connection.hpp @@ -126,10 +126,10 @@ namespace libtorrent // the number of bytes received in the current HTTP // response. used to know where in the buffer the // next response starts - size_type m_received_body; + boost::int64_t m_received_body; // position in the current range response - size_type m_range_pos; + boost::int64_t m_range_pos; // this is the offset inside the current receive // buffer where the next chunk header will be. @@ -137,7 +137,7 @@ namespace libtorrent // parsed. It does not necessarily point to a valid // offset in the receive buffer, if we haven't received // it yet. This offset never includes the HTTP header - size_type m_chunk_pos; + boost::int64_t m_chunk_pos; // the position in the current block int m_block_pos; diff --git a/src/allocator.cpp b/src/allocator.cpp index 46793812e..9f819e7f9 100644 --- a/src/allocator.cpp +++ b/src/allocator.cpp @@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/allocator.hpp" #include "libtorrent/config.hpp" #include "libtorrent/assert.hpp" // for print_backtrace +#include #if defined TORRENT_BEOS #include @@ -61,11 +62,10 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_WINDOWS #include #endif -#include "libtorrent/size_type.hpp" struct alloc_header { - libtorrent::size_type size; + boost::int64_t size; int magic; char stack[3072]; }; @@ -95,7 +95,7 @@ namespace libtorrent return s; } - char* page_aligned_allocator::malloc(size_type bytes) + char* page_aligned_allocator::malloc(page_aligned_allocator::size_type bytes) { TORRENT_ASSERT(bytes > 0); // just sanity check (this needs to be pretty high diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index 302808284..aac5feb13 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -1923,8 +1923,8 @@ namespace libtorrent TORRENT_ASSERT(m_message_handler[packet_type] != 0); #ifdef TORRENT_DEBUG - size_type cur_payload_dl = statistics().last_payload_downloaded(); - size_type cur_protocol_dl = statistics().last_protocol_downloaded(); + boost::int64_t cur_payload_dl = statistics().last_payload_downloaded(); + boost::int64_t cur_protocol_dl = statistics().last_protocol_downloaded(); #endif // call the correct handler for this packet type @@ -1932,7 +1932,7 @@ namespace libtorrent #ifdef TORRENT_DEBUG TORRENT_ASSERT(statistics().last_payload_downloaded() - cur_payload_dl >= 0); TORRENT_ASSERT(statistics().last_protocol_downloaded() - cur_protocol_dl >= 0); - size_type stats_diff = statistics().last_payload_downloaded() - cur_payload_dl + + boost::int64_t stats_diff = statistics().last_payload_downloaded() - cur_payload_dl + statistics().last_protocol_downloaded() - cur_protocol_dl; TORRENT_ASSERT(stats_diff == received); #endif @@ -2542,8 +2542,8 @@ namespace libtorrent ((sub_transferred = m_recv_buffer.advance_pos(bytes_transferred)) > 0)) { #if TORRENT_USE_ASSERTS - size_type cur_payload_dl = m_statistics.last_payload_downloaded(); - size_type cur_protocol_dl = m_statistics.last_protocol_downloaded(); + boost::int64_t cur_payload_dl = m_statistics.last_payload_downloaded(); + boost::int64_t cur_protocol_dl = m_statistics.last_protocol_downloaded(); #endif on_receive_impl(sub_transferred); bytes_transferred -= sub_transferred; @@ -2552,7 +2552,7 @@ namespace libtorrent #if TORRENT_USE_ASSERTS TORRENT_ASSERT(m_statistics.last_payload_downloaded() - cur_payload_dl >= 0); TORRENT_ASSERT(m_statistics.last_protocol_downloaded() - cur_protocol_dl >= 0); - size_type stats_diff = m_statistics.last_payload_downloaded() - cur_payload_dl + + boost::int64_t stats_diff = m_statistics.last_payload_downloaded() - cur_payload_dl + m_statistics.last_protocol_downloaded() - cur_protocol_dl; TORRENT_ASSERT(stats_diff == int(sub_transferred)); #endif @@ -3470,8 +3470,8 @@ namespace libtorrent return; } #ifdef TORRENT_DEBUG - size_type cur_payload_dl = statistics().last_payload_downloaded(); - size_type cur_protocol_dl = statistics().last_protocol_downloaded(); + boost::int64_t cur_payload_dl = statistics().last_payload_downloaded(); + boost::int64_t cur_protocol_dl = statistics().last_protocol_downloaded(); #endif if (dispatch_message(bytes_transferred)) { @@ -3481,9 +3481,9 @@ namespace libtorrent #ifdef TORRENT_DEBUG TORRENT_ASSERT(statistics().last_payload_downloaded() - cur_payload_dl >= 0); TORRENT_ASSERT(statistics().last_protocol_downloaded() - cur_protocol_dl >= 0); - size_type stats_diff = statistics().last_payload_downloaded() - cur_payload_dl + + boost::int64_t stats_diff = statistics().last_payload_downloaded() - cur_payload_dl + statistics().last_protocol_downloaded() - cur_protocol_dl; - TORRENT_ASSERT(stats_diff == size_type(bytes_transferred)); + TORRENT_ASSERT(stats_diff == boost::int64_t(bytes_transferred)); #endif TORRENT_ASSERT(!m_recv_buffer.packet_finished()); return; diff --git a/src/choker.cpp b/src/choker.cpp index e49606a82..479dcfae4 100644 --- a/src/choker.cpp +++ b/src/choker.cpp @@ -58,8 +58,8 @@ namespace libtorrent return prio1 > prio2; // compare how many bytes they've sent us - size_type c1; - size_type c2; + boost::int64_t c1; + boost::int64_t c2; c1 = lhs->downloaded_in_last_round(); c2 = rhs->downloaded_in_last_round(); @@ -121,8 +121,8 @@ namespace libtorrent return prio1 > prio2; // compare how many bytes they've sent us - size_type c1; - size_type c2; + boost::int64_t c1; + boost::int64_t c2; c1 = lhs->downloaded_in_last_round(); c2 = rhs->downloaded_in_last_round(); @@ -163,8 +163,8 @@ namespace libtorrent return prio1 > prio2; // compare how many bytes they've sent us - size_type c1; - size_type c2; + boost::int64_t c1; + boost::int64_t c2; c1 = lhs->downloaded_in_last_round(); c2 = rhs->downloaded_in_last_round(); @@ -208,8 +208,8 @@ namespace libtorrent bool upload_rate_compare(peer_connection const* lhs , peer_connection const* rhs) { - size_type c1; - size_type c2; + boost::int64_t c1; + boost::int64_t c2; c1 = lhs->uploaded_in_last_round(); c2 = rhs->uploaded_in_last_round(); @@ -224,7 +224,7 @@ namespace libtorrent bool bittyrant_unchoke_compare(peer_connection const* lhs , peer_connection const* rhs) { - size_type d1, d2, u1, u2; + boost::int64_t d1, d2, u1, u2; // first compare how many bytes they've sent us d1 = lhs->downloaded_in_last_round(); @@ -237,8 +237,8 @@ namespace libtorrent d1 *= lhs->get_priority(peer_connection::upload_channel); d2 *= rhs->get_priority(peer_connection::upload_channel); - d1 = d1 * 1000 / (std::max)(size_type(1), u1); - d2 = d2 * 1000 / (std::max)(size_type(1), u2); + d1 = d1 * 1000 / (std::max)(boost::int64_t(1), u1); + d2 = d2 * 1000 / (std::max)(boost::int64_t(1), u2); if (d1 > d2) return true; if (d1 < d2) return false; diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index a6fd329df..7da7db7d3 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -1296,7 +1296,7 @@ namespace libtorrent } // this is the offset that's aligned to block boundaries - size_type adjusted_offset = j->d.io.offset & ~(block_size-1); + boost::int64_t adjusted_offset = j->d.io.offset & ~(block_size-1); // if this is the last piece, adjust the size of the // last buffer to match up diff --git a/src/escape_string.cpp b/src/escape_string.cpp index 83ec59e9e..45b96cba0 100644 --- a/src/escape_string.cpp +++ b/src/escape_string.cpp @@ -66,12 +66,12 @@ namespace libtorrent // lexical_cast's result depends on the locale. We need // a well defined result - boost::array::digits10> to_string(size_type n) + boost::array::digits10> to_string(boost::int64_t n) { - boost::array::digits10> ret; + boost::array::digits10> ret; char *p = &ret.back(); *p = '\0'; - unsigned_size_type un = n; + boost::uint64_t un = n; if (n < 0) un = -un; // TODO: warning C4146: unary minus operator applied to unsigned type, result still unsigned do { *--p = '0' + un % 10; diff --git a/src/file.cpp b/src/file.cpp index 568f009af..5cd484a51 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -157,7 +157,7 @@ namespace // wrap the windows function in something that looks // like preadv() and pwritev() - int preadv(HANDLE fd, libtorrent::file::iovec_t const* bufs, int num_bufs, libtorrent::size_type file_offset) + int preadv(HANDLE fd, libtorrent::file::iovec_t const* bufs, int num_bufs, libtorrent::boost::int64_t file_offset) { OVERLAPPED* ol = TORRENT_ALLOCA(OVERLAPPED, num_bufs); memset(ol, 0, sizeof(OVERLAPPED) * num_bufs); @@ -219,7 +219,7 @@ done: return ret; } - int pwritev(HANDLE fd, libtorrent::file::iovec_t const* bufs, int num_bufs, libtorrent::size_type file_offset) + int pwritev(HANDLE fd, libtorrent::file::iovec_t const* bufs, int num_bufs, libtorrent::boost::int64_t file_offset) { OVERLAPPED* ol = TORRENT_ALLOCA(OVERLAPPED, num_bufs); memset(ol, 0, sizeof(OVERLAPPED) * num_bufs); @@ -856,7 +856,7 @@ namespace libtorrent } #endif - size_type file_size(std::string const& f) + boost::int64_t file_size(std::string const& f) { error_code ec; file_status s; @@ -1547,7 +1547,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { } template - size_type iov(Fun f, handle_type fd, size_type file_offset, file::iovec_t const* bufs_in + boost::int64_t iov(Fun f, handle_type fd, boost::int64_t file_offset, file::iovec_t const* bufs_in , int num_bufs_in, error_code& ec) { file::iovec_t const* bufs = bufs_in; @@ -1642,7 +1642,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { // this has to be thread safe and atomic. i.e. on posix systems it has to be // turned into a series of pread() calls - size_type file::readv(size_type file_offset, iovec_t const* bufs, int num_bufs + boost::int64_t file::readv(boost::int64_t file_offset, iovec_t const* bufs, int num_bufs , error_code& ec, int flags) { if (m_file_handle == INVALID_HANDLE_VALUE) @@ -1687,7 +1687,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { // This has to be thread safe, i.e. atomic. // that means, on posix this has to be turned into a series of // pwrite() calls - size_type file::writev(size_type file_offset, iovec_t const* bufs, int num_bufs + boost::int64_t file::writev(boost::int64_t file_offset, iovec_t const* bufs, int num_bufs , error_code& ec, int flags) { if (m_file_handle == INVALID_HANDLE_VALUE) @@ -1844,7 +1844,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { } #endif - bool file::set_size(size_type s, error_code& ec) + bool file::set_size(boost::int64_t s, error_code& ec) { TORRENT_ASSERT(is_open()); TORRENT_ASSERT(s >= 0); @@ -2028,7 +2028,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { return true; } - size_type file::get_size(error_code& ec) const + boost::int64_t file::get_size(error_code& ec) const { #ifdef TORRENT_WINDOWS LARGE_INTEGER file_size; @@ -2049,7 +2049,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { #endif } - size_type file::sparse_end(size_type start) const + boost::int64_t file::sparse_end(boost::int64_t start) const { #ifdef TORRENT_WINDOWS @@ -2065,7 +2065,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { DWORD bytes_returned = 0; FILE_ALLOCATED_RANGE_BUFFER in; error_code ec; - size_type file_size = get_size(ec); + boost::int64_t file_size = get_size(ec); if (ec) return start; in.FileOffset.QuadPart = start; @@ -2092,7 +2092,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { #elif defined SEEK_DATA // this is supported on solaris - size_type ret = lseek(native_handle(), start, SEEK_DATA); + boost::int64_t ret = lseek(native_handle(), start, SEEK_DATA); if (ret < 0) return start; return start; #else diff --git a/src/file_storage.cpp b/src/file_storage.cpp index 15cd10e22..7effc8a5e 100644 --- a/src/file_storage.cpp +++ b/src/file_storage.cpp @@ -57,9 +57,9 @@ namespace libtorrent TORRENT_ASSERT_PRECOND(index >= 0 && index < num_pieces()); if (index == num_pieces()-1) { - size_type size_except_last = num_pieces() - 1; - size_except_last *= size_type(piece_length()); - size_type size = total_size() - size_except_last; + boost::int64_t size_except_last = num_pieces() - 1; + size_except_last *= boost::int64_t(piece_length()); + boost::int64_t size = total_size() - size_except_last; TORRENT_ASSERT(size > 0); TORRENT_ASSERT(size <= piece_length()); return int(size); @@ -229,7 +229,7 @@ namespace libtorrent update_path_index(m_files[index]); } - void file_storage::add_file(std::wstring const& file, size_type size, int flags + void file_storage::add_file(std::wstring const& file, boost::int64_t size, int flags , std::time_t mtime, std::string const& symlink_path) { std::string utf8; @@ -266,7 +266,7 @@ namespace libtorrent } #ifndef TORRENT_NO_DEPRECATE - file_storage::iterator file_storage::file_at_offset_deprecated(size_type offset) const + file_storage::iterator file_storage::file_at_offset_deprecated(boost::int64_t offset) const { // find the file iterator and file offset internal_file_entry target; @@ -281,13 +281,13 @@ namespace libtorrent return file_iter; } - file_storage::iterator file_storage::file_at_offset(size_type offset) const + file_storage::iterator file_storage::file_at_offset(boost::int64_t offset) const { return file_at_offset_deprecated(offset); } #endif - int file_storage::file_index_at_offset(size_type offset) const + int file_storage::file_index_at_offset(boost::int64_t offset) const { // find the file iterator and file offset internal_file_entry target; @@ -314,7 +314,7 @@ namespace libtorrent return m_files[index].name_len; } - std::vector file_storage::map_block(int piece, size_type offset + std::vector file_storage::map_block(int piece, boost::int64_t offset , int size) const { TORRENT_ASSERT_PRECOND(num_files() > 0); @@ -324,8 +324,8 @@ namespace libtorrent // find the file iterator and file offset internal_file_entry target; - target.offset = piece * (size_type)m_piece_length + offset; - TORRENT_ASSERT_PRECOND(size_type(target.offset + size) <= m_total_size); + target.offset = piece * (boost::int64_t)m_piece_length + offset; + TORRENT_ASSERT_PRECOND(boost::int64_t(target.offset + size) <= m_total_size); TORRENT_ASSERT(!compare_file_offset(target, m_files.front())); std::vector::const_iterator file_iter = std::upper_bound( @@ -334,11 +334,11 @@ namespace libtorrent TORRENT_ASSERT(file_iter != m_files.begin()); --file_iter; - size_type file_offset = target.offset - file_iter->offset; + boost::int64_t file_offset = target.offset - file_iter->offset; for (; size > 0; file_offset -= file_iter->size, ++file_iter) { TORRENT_ASSERT(file_iter != m_files.end()); - if (file_offset < size_type(file_iter->size)) + if (file_offset < boost::int64_t(file_iter->size)) { file_slice f; f.file_index = file_iter - m_files.begin(); @@ -375,7 +375,7 @@ namespace libtorrent return ret; } - peer_request file_storage::map_file(int file_index, size_type file_offset + peer_request file_storage::map_file(int file_index, boost::int64_t file_offset , int size) const { TORRENT_ASSERT_PRECOND(file_index < num_files()); @@ -391,7 +391,7 @@ namespace libtorrent return ret; } - size_type offset = file_offset + this->file_offset(file_index); + boost::int64_t offset = file_offset + this->file_offset(file_index); if (offset >= total_size()) { @@ -410,7 +410,7 @@ namespace libtorrent return ret; } - void file_storage::add_file(std::string const& file, size_type size, int flags + void file_storage::add_file(std::string const& file, boost::int64_t size, int flags , std::time_t mtime, std::string const& symlink_path) { TORRENT_ASSERT_PRECOND(!is_complete(file)); @@ -522,14 +522,14 @@ namespace libtorrent return m_mtime[index]; } - void file_storage::set_file_base(int index, size_type off) + void file_storage::set_file_base(int index, boost::int64_t off) { TORRENT_ASSERT_PRECOND(index >= 0 && index < int(m_files.size())); if (int(m_file_base.size()) <= index) m_file_base.resize(index + 1, 0); m_file_base[index] = off; } - size_type file_storage::file_base(int index) const + boost::int64_t file_storage::file_base(int index) const { if (index >= int(m_file_base.size())) return 0; return m_file_base[index]; @@ -564,7 +564,7 @@ namespace libtorrent return fe.filename(); } - size_type file_storage::file_size(int index) const + boost::int64_t file_storage::file_size(int index) const { TORRENT_ASSERT_PRECOND(index >= 0 && index < int(m_files.size())); return m_files[index].size; @@ -576,7 +576,7 @@ namespace libtorrent return m_files[index].pad_file; } - size_type file_storage::file_offset(int index) const + boost::int64_t file_storage::file_offset(int index) const { TORRENT_ASSERT_PRECOND(index >= 0 && index < int(m_files.size())); return m_files[index].offset; @@ -619,7 +619,7 @@ namespace libtorrent return index; } - void file_storage::set_file_base(internal_file_entry const& fe, size_type off) + void file_storage::set_file_base(internal_file_entry const& fe, boost::int64_t off) { int index = &fe - &m_files[0]; TORRENT_ASSERT_PRECOND(index >= 0 && index < int(m_files.size())); @@ -627,7 +627,7 @@ namespace libtorrent m_file_base[index] = off; } - size_type file_storage::file_base(internal_file_entry const& fe) const + boost::int64_t file_storage::file_base(internal_file_entry const& fe) const { int index = &fe - &m_files[0]; if (index >= int(m_file_base.size())) return 0; @@ -646,7 +646,7 @@ namespace libtorrent return fe.filename(); } - size_type file_storage::file_size(internal_file_entry const& fe) const + boost::int64_t file_storage::file_size(internal_file_entry const& fe) const { return fe.size; } @@ -656,7 +656,7 @@ namespace libtorrent return fe.pad_file; } - size_type file_storage::file_offset(internal_file_entry const& fe) const + boost::int64_t file_storage::file_offset(internal_file_entry const& fe) const { return fe.offset; } @@ -700,7 +700,7 @@ namespace libtorrent if (alignment == -1) alignment = m_piece_length; - size_type off = 0; + boost::int64_t off = 0; int padding_file = 0; for (std::vector::iterator i = m_files.begin(); i != m_files.end(); ++i) @@ -810,7 +810,7 @@ namespace libtorrent std::vector().swap(m_file_hashes); std::vector().swap(m_symlinks); std::vector().swap(m_mtime); - std::vector().swap(m_file_base); + std::vector().swap(m_file_base); std::vector().swap(m_paths); } } diff --git a/src/http_parser.cpp b/src/http_parser.cpp index 99228e443..13224403e 100644 --- a/src/http_parser.cpp +++ b/src/http_parser.cpp @@ -311,7 +311,7 @@ restart_response: while (m_cur_chunk_end <= m_recv_pos + incoming && !m_finished && incoming > 0) { - size_type payload = m_cur_chunk_end - m_recv_pos; + boost::int64_t payload = m_cur_chunk_end - m_recv_pos; if (payload > 0) { TORRENT_ASSERT(payload < INT_MAX); @@ -320,13 +320,13 @@ restart_response: incoming -= int(payload); } buffer::const_interval buf(recv_buffer.begin + m_cur_chunk_end, recv_buffer.end); - size_type chunk_size; + boost::int64_t chunk_size; int header_size; if (parse_chunk_header(buf, &chunk_size, &header_size)) { if (chunk_size > 0) { - std::pair chunk_range(m_cur_chunk_end + header_size + std::pair chunk_range(m_cur_chunk_end + header_size , m_cur_chunk_end + header_size + chunk_size); m_chunked_ranges.push_back(chunk_range); } @@ -370,7 +370,7 @@ restart_response: } else { - size_type payload_received = m_recv_pos - m_body_start_pos + incoming; + boost::int64_t payload_received = m_recv_pos - m_body_start_pos + incoming; if (payload_received > m_content_length && m_content_length >= 0) { @@ -394,7 +394,7 @@ restart_response: } bool http_parser::parse_chunk_header(buffer::const_interval buf - , size_type* chunk_size, int* header_size) + , boost::int64_t* chunk_size, int* header_size) { char const* pos = buf.begin; @@ -481,7 +481,7 @@ restart_response: buffer::const_interval http_parser::get_body() const { TORRENT_ASSERT(m_state == read_body); - size_type last_byte = m_chunked_encoding && !m_chunked_ranges.empty() + boost::int64_t last_byte = m_chunked_encoding && !m_chunked_ranges.empty() ? (std::min)(m_chunked_ranges.back().second, m_recv_pos) : m_content_length < 0 ? m_recv_pos : (std::min)(m_body_start_pos + m_content_length, m_recv_pos); @@ -524,8 +524,8 @@ restart_response: // buffer, not start of the body, so subtract the size // of the HTTP header from them int offset = body_start(); - std::vector > const& c = chunks(); - for (std::vector >::const_iterator i = c.begin() + std::vector > const& c = chunks(); + for (std::vector >::const_iterator i = c.begin() , end(c.end()); i != end; ++i) { TORRENT_ASSERT(i->second - i->first < INT_MAX); diff --git a/src/http_seed_connection.cpp b/src/http_seed_connection.cpp index 0a1f8c423..ac58b9cc8 100644 --- a/src/http_seed_connection.cpp +++ b/src/http_seed_connection.cpp @@ -360,7 +360,7 @@ namespace libtorrent && m_chunk_pos < recv_buffer.left()) { int header_size = 0; - size_type chunk_size = 0; + boost::int64_t chunk_size = 0; buffer::const_interval chunk_start = recv_buffer; chunk_start.begin += m_chunk_pos; TORRENT_ASSERT(chunk_start.begin[0] == '\r' || is_hex(chunk_start.begin, 1)); diff --git a/src/kademlia/routing_table.cpp b/src/kademlia/routing_table.cpp index adcf8dbac..d3d9ea307 100644 --- a/src/kademlia/routing_table.cpp +++ b/src/kademlia/routing_table.cpp @@ -132,7 +132,7 @@ boost::tuple routing_table::size() const return boost::make_tuple(nodes, replacements, confirmed); } -size_type routing_table::num_global_nodes() const +boost::int64_t routing_table::num_global_nodes() const { int deepest_bucket = 0; int deepest_size = 0; @@ -147,8 +147,8 @@ size_type routing_table::num_global_nodes() const if (deepest_bucket == 0) return 1 + deepest_size; - if (deepest_size < m_bucket_size / 2) return (size_type(1) << deepest_bucket) * m_bucket_size; - else return (size_type(2) << deepest_bucket) * deepest_size; + if (deepest_size < m_bucket_size / 2) return (boost::int64_t(1) << deepest_bucket) * m_bucket_size; + else return (boost::int64_t(2) << deepest_bucket) * deepest_size; } int routing_table::depth() const diff --git a/src/part_file.cpp b/src/part_file.cpp index 062bd5771..f5df28fbe 100644 --- a/src/part_file.cpp +++ b/src/part_file.cpp @@ -192,7 +192,7 @@ namespace libtorrent l.unlock(); - size_type slot_offset = size_type(m_header_size) + size_type(slot) * m_piece_size; + boost::int64_t slot_offset = boost::int64_t(m_header_size) + boost::int64_t(slot) * m_piece_size; return m_file.writev(slot_offset + offset, bufs, num_bufs, ec); } @@ -217,7 +217,7 @@ namespace libtorrent l.unlock(); - size_type slot_offset = size_type(m_header_size) + size_type(slot) * m_piece_size; + boost::int64_t slot_offset = boost::int64_t(m_header_size) + boost::int64_t(slot) * m_piece_size; return m_file.readv(slot_offset + offset, bufs, num_bufs, ec); } @@ -287,21 +287,21 @@ namespace libtorrent m_path = path; } - void part_file::import_file(file& f, size_type offset, size_type size, error_code& ec) + void part_file::import_file(file& f, boost::int64_t offset, boost::int64_t size, error_code& ec) { // not implemented assert(false); } - void part_file::export_file(file& f, size_type offset, size_type size, error_code& ec) + void part_file::export_file(file& f, boost::int64_t offset, boost::int64_t size, error_code& ec) { int piece = offset / m_piece_size; int end = ((offset + size) + m_piece_size - 1) / m_piece_size; boost::scoped_array buf; - size_type piece_offset = offset - size_type(piece) * m_piece_size; - size_type file_offset = 0; + boost::int64_t piece_offset = offset - boost::int64_t(piece) * m_piece_size; + boost::int64_t file_offset = 0; for (; piece < end; ++piece) { boost::unordered_map::iterator i = m_piece_map.find(piece); @@ -313,7 +313,7 @@ namespace libtorrent if (!buf) buf.reset(new char[m_piece_size]); - size_type slot_offset = size_type(m_header_size) + size_type(i->second) * m_piece_size; + boost::int64_t slot_offset = boost::int64_t(m_header_size) + boost::int64_t(i->second) * m_piece_size; file::iovec_t v = { buf.get(), size_t(block_to_copy) }; int ret = m_file.readv(slot_offset + piece_offset, &v, 1, ec); if (ec) return; diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 66a410105..3811b70ef 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -1039,7 +1039,7 @@ namespace libtorrent + m_queued_time_critical * t->block_size() * 1000) / rate); } - void peer_connection::add_stat(size_type downloaded, size_type uploaded) + void peer_connection::add_stat(boost::int64_t downloaded, boost::int64_t uploaded) { TORRENT_ASSERT(is_single_thread()); m_statistics.add_stat(downloaded, uploaded); @@ -5892,8 +5892,8 @@ namespace libtorrent // TODO: The stats checks can not be honored when authenticated encryption is in use // because we may have encrypted data which we cannot authenticate yet #if 0 - size_type cur_payload_dl = m_statistics.last_payload_downloaded(); - size_type cur_protocol_dl = m_statistics.last_protocol_downloaded(); + boost::int64_t cur_payload_dl = m_statistics.last_payload_downloaded(); + boost::int64_t cur_protocol_dl = m_statistics.last_protocol_downloaded(); #endif sub_transferred = m_recv_buffer.advance_pos(bytes); on_receive(error, sub_transferred); @@ -5903,7 +5903,7 @@ namespace libtorrent #if 0 TORRENT_ASSERT(m_statistics.last_payload_downloaded() - cur_payload_dl >= 0); TORRENT_ASSERT(m_statistics.last_protocol_downloaded() - cur_protocol_dl >= 0); - size_type stats_diff = m_statistics.last_payload_downloaded() - cur_payload_dl + + boost::int64_t stats_diff = m_statistics.last_payload_downloaded() - cur_payload_dl + m_statistics.last_protocol_downloaded() - cur_protocol_dl; TORRENT_ASSERT(stats_diff == int(sub_transferred)); #endif @@ -6244,14 +6244,14 @@ namespace libtorrent m_last_sent = now; #if TORRENT_USE_ASSERTS - size_type cur_payload_ul = m_statistics.last_payload_uploaded(); - size_type cur_protocol_ul = m_statistics.last_protocol_uploaded(); + boost::int64_t cur_payload_ul = m_statistics.last_payload_uploaded(); + boost::int64_t cur_protocol_ul = m_statistics.last_protocol_uploaded(); #endif on_sent(error, bytes_transferred); #if TORRENT_USE_ASSERTS TORRENT_ASSERT(m_statistics.last_payload_uploaded() - cur_payload_ul >= 0); TORRENT_ASSERT(m_statistics.last_protocol_uploaded() - cur_protocol_ul >= 0); - size_type stats_diff = m_statistics.last_payload_uploaded() - cur_payload_ul + boost::int64_t stats_diff = m_statistics.last_payload_uploaded() - cur_payload_ul + m_statistics.last_protocol_uploaded() - cur_protocol_ul; TORRENT_ASSERT(stats_diff == int(bytes_transferred)); #endif diff --git a/src/peer_list.cpp b/src/peer_list.cpp index 7f58770f9..9c11af3e0 100644 --- a/src/peer_list.cpp +++ b/src/peer_list.cpp @@ -754,7 +754,7 @@ namespace libtorrent TORRENT_ASSERT(i); c.set_peer_info(i); TORRENT_ASSERT(i->connection == 0); - c.add_stat(size_type(i->prev_amount_download) << 10, size_type(i->prev_amount_upload) << 10); + c.add_stat(boost::int64_t(i->prev_amount_download) << 10, boost::int64_t(i->prev_amount_upload) << 10); i->prev_amount_download = 0; i->prev_amount_upload = 0; diff --git a/src/stat.cpp b/src/stat.cpp index 3e0bdcf5b..a0f871b63 100644 --- a/src/stat.cpp +++ b/src/stat.cpp @@ -39,9 +39,9 @@ namespace libtorrent { void stat_channel::second_tick(int tick_interval_ms) { - int sample = int(size_type(m_counter) * 1000 / tick_interval_ms); + int sample = int(boost::int64_t(m_counter) * 1000 / tick_interval_ms); TORRENT_ASSERT(sample >= 0); - m_5_sec_average = size_type(m_5_sec_average) * 4 / 5 + sample / 5; + m_5_sec_average = boost::int64_t(m_5_sec_average) * 4 / 5 + sample / 5; m_counter = 0; } diff --git a/src/stat_cache.cpp b/src/stat_cache.cpp index f16dbf66a..e48e9d946 100644 --- a/src/stat_cache.cpp +++ b/src/stat_cache.cpp @@ -38,7 +38,7 @@ namespace libtorrent stat_cache::stat_cache() {} stat_cache::~stat_cache() {} - void stat_cache::set_cache(int i, size_type size, time_t time) + void stat_cache::set_cache(int i, boost::int64_t size, time_t time) { TORRENT_ASSERT(i >= 0); if (i >= int(m_stat_cache.size())) @@ -70,7 +70,7 @@ namespace libtorrent m_stat_cache[i].file_size = cache_error; } - size_type stat_cache::get_filesize(int i) const + boost::int64_t stat_cache::get_filesize(int i) const { if (i >= int(m_stat_cache.size())) return not_in_cache; return m_stat_cache[i].file_size; diff --git a/src/storage.cpp b/src/storage.cpp index cb0e6f2dc..6e82cb3f5 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -433,12 +433,12 @@ namespace libtorrent for (int i = 0; i < files().num_files(); ++i) { file_status s; - size_type cache_status = m_stat_cache.get_filesize(i); + boost::int64_t cache_status = m_stat_cache.get_filesize(i); if (cache_status < 0 && cache_status != stat_cache::no_exist) { file_path = files().file_path(i, m_save_path); stat_file(file_path, &s, ec.ec); - size_type r = s.file_size; + boost::int64_t r = s.file_size; if (ec.ec || !(s.mode & file_status::regular_file)) r = -1; if (ec && ec.ec == boost::system::errc::no_such_file_or_directory) @@ -638,9 +638,9 @@ namespace libtorrent file_storage const& fs = files(); for (int i = 0; i < fs.num_files(); ++i) { - size_type file_size = 0; + boost::int64_t file_size = 0; time_t file_time = 0; - size_type cache_state = m_stat_cache.get_filesize(i); + boost::int64_t cache_state = m_stat_cache.get_filesize(i); if (cache_state != stat_cache::not_in_cache) { if (cache_state >= 0) @@ -684,7 +684,7 @@ namespace libtorrent TORRENT_ASSERT(slot >= 0); TORRENT_ASSERT(slot < files().num_pieces()); - size_type file_offset = (size_type)slot * files().piece_length(); + boost::int64_t file_offset = (boost::int64_t)slot * files().piece_length(); int file_index = 0; for (;;) @@ -701,7 +701,7 @@ namespace libtorrent file_handle handle = open_file(file_index, file::read_only, ec); if (!handle || ec) return slot; - size_type data_start = handle->sparse_end(file_offset); + boost::int64_t data_start = handle->sparse_end(file_offset); return int((data_start + files().piece_length() - 1) / files().piece_length()); } @@ -803,7 +803,7 @@ namespace libtorrent return false; } - size_type expected_size = e->list_int_value_at(0); + boost::int64_t expected_size = e->list_int_value_at(0); time_t expected_time = e->list_int_value_at(1); // if we're a seed, the expected size should match @@ -816,7 +816,7 @@ namespace libtorrent return false; } - size_type file_size = m_stat_cache.get_filesize(i); + boost::int64_t file_size = m_stat_cache.get_filesize(i); time_t file_time; if (file_size >= 0) { @@ -1069,7 +1069,7 @@ namespace libtorrent int file_index = files().file_index_at_offset(torrent_offset); TORRENT_ASSERT(torrent_offset >= files().file_offset(file_index)); TORRENT_ASSERT(torrent_offset < files().file_offset(file_index) + files().file_size(file_index)); - size_type file_offset = torrent_offset - files().file_offset(file_index); + boost::int64_t file_offset = torrent_offset - files().file_offset(file_index); int buf_pos = 0; @@ -1214,7 +1214,7 @@ namespace libtorrent } } - size_type adjusted_offset = files().file_base(file_index) + file_offset; + boost::int64_t adjusted_offset = files().file_base(file_index) + file_offset; #ifdef TORRENT_DISK_STATS int flags = ((op.mode & file::rw_mask) == file::read_only) ? op_read : op_write; diff --git a/src/torrent.cpp b/src/torrent.cpp index 4488f5726..dc9689cd2 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -2568,7 +2568,7 @@ namespace libtorrent } } - m_progress_ppm = size_type(m_num_checked_pieces) * 1000000 / torrent_file().num_pieces(); + m_progress_ppm = boost::int64_t(m_num_checked_pieces) * 1000000 / torrent_file().num_pieces(); // we're using the piece hashes here, we need the torrent to be loaded if (!need_loaded()) @@ -3506,7 +3506,7 @@ namespace libtorrent update_want_peers(); } - size_type torrent::bytes_left() const + boost::int64_t torrent::bytes_left() const { // if we don't have the metadata yet, we // cannot tell how big the torrent is. @@ -3515,7 +3515,7 @@ namespace libtorrent - quantized_bytes_done(); } - size_type torrent::quantized_bytes_done() const + boost::int64_t torrent::quantized_bytes_done() const { // INVARIANT_CHECK; @@ -3532,7 +3532,7 @@ namespace libtorrent const int last_piece = m_torrent_file->num_pieces() - 1; - size_type total_done + boost::int64_t total_done = boost::uint64_t(m_picker->num_passed()) * m_torrent_file->piece_length(); // if we have the last piece, we have to correct @@ -3587,7 +3587,7 @@ namespace libtorrent if (!valid_metadata() || m_torrent_file->num_pieces() == 0) return; - TORRENT_ASSERT(st.total_wanted >= size_type(m_torrent_file->piece_length()) + TORRENT_ASSERT(st.total_wanted >= boost::int64_t(m_torrent_file->piece_length()) * (m_torrent_file->num_pieces() - 1)); const int last_piece = m_torrent_file->num_pieces() - 1; @@ -3611,11 +3611,11 @@ namespace libtorrent } TORRENT_ASSERT(num_have() >= m_picker->num_have_filtered()); - st.total_wanted_done = size_type(num_passed() - m_picker->num_have_filtered()) + st.total_wanted_done = boost::int64_t(num_passed() - m_picker->num_have_filtered()) * piece_size; TORRENT_ASSERT(st.total_wanted_done >= 0); - st.total_done = size_type(num_passed()) * piece_size; + st.total_done = boost::int64_t(num_passed()) * piece_size; // if num_passed() == num_pieces(), we should be a seed, and taken the // branch above TORRENT_ASSERT(num_passed() <= m_torrent_file->num_pieces()); @@ -3629,7 +3629,7 @@ namespace libtorrent TORRENT_ASSERT(st.total_wanted >= 0); --num_filtered_pieces; } - st.total_wanted -= size_type(num_filtered_pieces) * piece_size; + st.total_wanted -= boost::int64_t(num_filtered_pieces) * piece_size; TORRENT_ASSERT(st.total_wanted >= 0); // if we have the last piece, we have to correct @@ -4027,16 +4027,16 @@ namespace libtorrent if (!m_file_progress.empty()) { const int piece_size = m_torrent_file->piece_length(); - size_type off = size_type(index) * piece_size; + boost::int64_t off = boost::int64_t(index) * piece_size; int file_index = m_torrent_file->files().file_index_at_offset(off); int size = m_torrent_file->piece_size(index); file_storage const& fs = m_torrent_file->files(); for (; size > 0; ++file_index) { - size_type file_offset = off - fs.file_offset(file_index); + boost::int64_t file_offset = off - fs.file_offset(file_index); TORRENT_ASSERT(file_index != fs.num_files()); TORRENT_ASSERT(file_offset <= fs.file_size(file_index)); - int add = (std::min)(fs.file_size(file_index) - file_offset, (size_type)size); + int add = (std::min)(fs.file_size(file_index) - file_offset, (boost::int64_t)size); m_file_progress[file_index] += add; TORRENT_ASSERT(m_file_progress[file_index] @@ -5362,7 +5362,7 @@ namespace libtorrent if (m_torrent_file->num_pieces() == 0) return; bool need_update = false; - size_type position = 0; + boost::int64_t position = 0; int piece_length = m_torrent_file->piece_length(); // initialize the piece priorities to 0, then only allow // setting higher priorities @@ -5372,8 +5372,8 @@ namespace libtorrent { if (i >= fs.num_files()) break; - size_type start = position; - size_type size = m_torrent_file->files().file_size(i); + boost::int64_t start = position; + boost::int64_t size = m_torrent_file->files().file_size(i); if (size == 0) continue; position += size; int file_prio; @@ -5527,7 +5527,7 @@ namespace libtorrent if (int(bitmask.size()) != m_torrent_file->num_files()) return; - size_type position = 0; + boost::int64_t position = 0; if (m_torrent_file->num_pieces()) { @@ -5537,7 +5537,7 @@ namespace libtorrent std::vector piece_filter(m_torrent_file->num_pieces(), true); for (int i = 0; i < (int)bitmask.size(); ++i) { - size_type start = position; + boost::int64_t start = position; position += m_torrent_file->files().file_size(i); // is the file selected for download? if (!bitmask[i]) @@ -6315,8 +6315,8 @@ namespace libtorrent web->peer_info.in_use = true; #endif - c->add_stat(size_type(web->peer_info.prev_amount_download) << 10 - , size_type(web->peer_info.prev_amount_upload) << 10); + c->add_stat(boost::int64_t(web->peer_info.prev_amount_download) << 10 + , boost::int64_t(web->peer_info.prev_amount_upload) << 10); web->peer_info.prev_amount_download = 0; web->peer_info.prev_amount_upload = 0; #if defined TORRENT_VERBOSE_LOGGING @@ -7318,8 +7318,8 @@ namespace libtorrent c->m_in_constructor = false; #endif - c->add_stat(size_type(peerinfo->prev_amount_download) << 10 - , size_type(peerinfo->prev_amount_upload) << 10); + c->add_stat(boost::int64_t(peerinfo->prev_amount_download) << 10 + , boost::int64_t(peerinfo->prev_amount_upload) << 10); peerinfo->prev_amount_download = 0; peerinfo->prev_amount_upload = 0; @@ -7856,12 +7856,12 @@ namespace libtorrent return lhs->on_parole(); // prefer to disconnect peers that send data at a lower rate - size_type lhs_transferred = lhs->statistics().total_payload_download(); - size_type rhs_transferred = rhs->statistics().total_payload_download(); + boost::int64_t lhs_transferred = lhs->statistics().total_payload_download(); + boost::int64_t rhs_transferred = rhs->statistics().total_payload_download(); ptime now = time_now(); - size_type lhs_time_connected = total_seconds(now - lhs->connected_time()); - size_type rhs_time_connected = total_seconds(now - rhs->connected_time()); + boost::int64_t lhs_time_connected = total_seconds(now - lhs->connected_time()); + boost::int64_t rhs_time_connected = total_seconds(now - rhs->connected_time()); lhs_transferred /= lhs_time_connected + 1; rhs_transferred /= (rhs_time_connected + 1); @@ -8479,7 +8479,7 @@ namespace libtorrent } #endif - size_type total_done = quantized_bytes_done(); + boost::int64_t total_done = quantized_bytes_done(); if (m_torrent_file->is_valid()) { if (is_seed()) @@ -8849,13 +8849,13 @@ namespace libtorrent int ret = 0; - size_type fin_time = finished_time(); - size_type download_time = int(active_time()) - fin_time; + boost::int64_t fin_time = finished_time(); + boost::int64_t download_time = int(active_time()) - fin_time; // if we haven't yet met the seed limits, set the seed_ratio_not_met // flag. That will make this seed prioritized // downloaded may be 0 if the torrent is 0-sized - size_type downloaded = (std::max)(m_total_downloaded, m_torrent_file->total_size()); + boost::int64_t downloaded = (std::max)(m_total_downloaded, m_torrent_file->total_size()); if (fin_time < s.get_int(settings_pack::seed_time_limit) && (download_time > 1 && fin_time * 100 / download_time < s.get_int(settings_pack::seed_time_ratio_limit)) @@ -10873,7 +10873,7 @@ namespace libtorrent fp.resize(m_torrent_file->num_files(), 1.f); if (is_seed()) return; - std::vector progress; + std::vector progress; file_progress(progress); for (int i = 0; i < m_torrent_file->num_files(); ++i) { @@ -10902,7 +10902,7 @@ namespace libtorrent for (int piece = 0; piece < num_pieces; ++piece, off += piece_size) { TORRENT_ASSERT(file_index < fs.num_files()); - size_type file_offset = off - fs.file_offset(file_index); + boost::int64_t file_offset = off - fs.file_offset(file_index); TORRENT_ASSERT(file_offset >= 0); while (file_offset >= fs.file_size(file_index)) { @@ -11003,14 +11003,14 @@ namespace libtorrent for (std::vector::const_iterator i = q.begin(), end(q.end()); i != end; ++i) { - size_type offset = size_type(i->index) * m_torrent_file->piece_length(); + boost::int64_t offset = boost::int64_t(i->index) * m_torrent_file->piece_length(); int file = fs.file_index_at_offset(offset); int num_blocks = m_picker->blocks_in_piece(i->index); piece_picker::block_info const* info = i->info; for (int k = 0; k < num_blocks; ++k) { TORRENT_ASSERT(file < fs.num_files()); - TORRENT_ASSERT(offset == size_type(i->index) * m_torrent_file->piece_length() + TORRENT_ASSERT(offset == boost::int64_t(i->index) * m_torrent_file->piece_length() + k * block_size()); TORRENT_ASSERT(offset < m_torrent_file->total_size()); while (offset >= fs.file_offset(file) + fs.file_size(file)) @@ -11019,7 +11019,7 @@ namespace libtorrent } TORRENT_ASSERT(file < fs.num_files()); - size_type block = block_size(); + boost::int64_t block = block_size(); if (info[k].state == piece_picker::block_info::state_none) { @@ -11055,7 +11055,7 @@ namespace libtorrent while (block > 0) { TORRENT_ASSERT(offset <= fs.file_offset(file) + fs.file_size(file)); - size_type slice = (std::min)(fs.file_offset(file) + fs.file_size(file) - offset + boost::int64_t slice = (std::min)(fs.file_offset(file) + fs.file_size(file) - offset , block); fp[file] += slice; offset += slice; @@ -11072,7 +11072,7 @@ namespace libtorrent } } offset += left_over; - TORRENT_ASSERT(offset == size_type(i->index) * m_torrent_file->piece_length() + TORRENT_ASSERT(offset == boost::int64_t(i->index) * m_torrent_file->piece_length() + (k+1) * block_size()); } else diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index 9e197f605..c290332bd 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -429,7 +429,7 @@ namespace libtorrent TORRENT_ASYNC_CALL2(set_tracker_login, name, password); } - void torrent_handle::file_progress(std::vector& progress, int flags) const + void torrent_handle::file_progress(std::vector& progress, int flags) const { TORRENT_SYNC_CALL2(file_progress, boost::ref(progress), flags); } diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index feb35b947..d59a7f154 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -369,7 +369,7 @@ namespace libtorrent if (target.size < 0) return false; - size_type ts = dict.dict_find_int_value("mtime", -1); + boost::int64_t ts = dict.dict_find_int_value("mtime", -1); if (ts > 0) *mtime = std::time_t(ts); // prefer the name.utf-8 @@ -561,7 +561,7 @@ namespace libtorrent ec.clear(); file f; if (!f.open(filename, file::read_only, ec)) return -1; - size_type s = f.get_size(ec); + boost::int64_t s = f.get_size(ec); if (ec) return -1; if (s > limit) { @@ -571,7 +571,7 @@ namespace libtorrent v.resize((unsigned int)s); if (s == 0) return 0; file::iovec_t b = {&v[0], size_t(s) }; - size_type read = f.readv(0, &b, 1, ec); + boost::int64_t read = f.readv(0, &b, 1, ec); if (read != s) return -3; if (ec) return -3; return 0; @@ -1472,7 +1472,7 @@ namespace libtorrent } // extract creation date - size_type cd = torrent_file.dict_find_int_value("creation date", -1); + boost::int64_t cd = torrent_file.dict_find_int_value("creation date", -1); if (cd >= 0) { m_creation_date = long(cd); diff --git a/src/web_peer_connection.cpp b/src/web_peer_connection.cpp index 435f6103c..2615d23f6 100644 --- a/src/web_peer_connection.cpp +++ b/src/web_peer_connection.cpp @@ -296,10 +296,10 @@ void web_peer_connection::write_request(peer_request const& r) request += " HTTP/1.1\r\n"; add_headers(request, m_settings, using_proxy); request += "\r\nRange: bytes="; - request += to_string(size_type(req.piece) * info.piece_length() + request += to_string(boost::int64_t(req.piece) * info.piece_length() + req.start).elems; request += "-"; - request += to_string(size_type(req.piece) * info.piece_length() + request += to_string(boost::int64_t(req.piece) * info.piece_length() + req.start + req.length - 1).elems; request += "\r\n\r\n"; m_first_request = false; @@ -391,8 +391,8 @@ namespace { bool range_contains(peer_request const& range, peer_request const& req, int piece_size) { - size_type range_start = size_type(range.piece) * piece_size + range.start; - size_type req_start = size_type(req.piece) * piece_size + req.start; + boost::int64_t range_start = boost::int64_t(range.piece) * piece_size + range.start; + boost::int64_t req_start = boost::int64_t(req.piece) * piece_size + req.start; return range_start <= req_start && range_start + range.length >= req_start + req.length; } @@ -724,8 +724,8 @@ void web_peer_connection::on_receive(error_code const& error break; } - size_type range_start; - size_type range_end; + boost::int64_t range_start; + boost::int64_t range_end; if (m_parser.status_code() == 206) { boost::tie(range_start, range_end) = m_parser.content_range(); @@ -774,7 +774,7 @@ void web_peer_connection::on_receive(error_code const& error && m_chunk_pos < recv_buffer.left()) { int header_size = 0; - size_type chunk_size = 0; + boost::int64_t chunk_size = 0; buffer::const_interval chunk_start = recv_buffer; chunk_start.begin += m_chunk_pos; TORRENT_ASSERT(chunk_start.begin[0] == '\r' || is_hex(chunk_start.begin, 1)); @@ -831,8 +831,8 @@ void web_peer_connection::on_receive(error_code const& error return; } - size_type left_in_response = range_end - range_start - m_range_pos; - int payload_transferred = int((std::min)(left_in_response, size_type(bytes_transferred))); + boost::int64_t left_in_response = range_end - range_start - m_range_pos; + int payload_transferred = int((std::min)(left_in_response, boost::int64_t(bytes_transferred))); torrent_info const& info = t->torrent_file(); @@ -862,11 +862,11 @@ void web_peer_connection::on_receive(error_code const& error , int(range_end - range_start)); // request start - size_type rs = size_type(in_range.piece) * info.piece_length() + in_range.start; + boost::int64_t rs = boost::int64_t(in_range.piece) * info.piece_length() + in_range.start; // request end - size_type re = rs + in_range.length; + boost::int64_t re = rs + in_range.length; // file start - size_type fs = size_type(front_request.piece) * info.piece_length() + front_request.start; + boost::int64_t fs = boost::int64_t(front_request.piece) * info.piece_length() + front_request.start; // the http response body consists of 3 parts // 1. the middle of a block or the ending of a block @@ -1059,12 +1059,12 @@ void web_peer_connection::on_receive(error_code const& error // bunch of zeroes here and pop it again int file_index = m_file_requests.front(); m_file_requests.pop_front(); - size_type file_size = info.orig_files().file_size(file_index); + boost::int64_t file_size = info.orig_files().file_size(file_index); peer_request front_request = m_requests.front(); TORRENT_ASSERT(m_block_pos < front_request.length); - int pad_size = int((std::min)(file_size, size_type(front_request.length - m_block_pos))); + int pad_size = int((std::min)(file_size, boost::int64_t(front_request.length - m_block_pos))); // insert zeroes to represent the pad file m_piece.resize(m_piece.size() + size_t(pad_size), 0); diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index cc426a248..9d0f5d8a4 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -584,7 +584,7 @@ void create_random_files(std::string const& path, const int file_sizes[], int nu file f(full_path, file::write_only, ec); if (ec) fprintf(stderr, "failed to create file \"%s\": (%d) %s\n" , full_path.c_str(), ec.value(), ec.message().c_str()); - size_type offset = 0; + boost::int64_t offset = 0; while (to_write > 0) { int s = (std::min)(to_write, 300000); diff --git a/test/test_file.cpp b/test/test_file.cpp index 4cc02af19..c68aad859 100644 --- a/test/test_file.cpp +++ b/test/test_file.cpp @@ -53,7 +53,7 @@ int touch_file(std::string const& filename, int size) if (!f.open(filename, file::write_only, ec)) return -1; if (ec) return -1; file::iovec_t b = {&v[0], v.size()}; - size_type written = f.writev(0, &b, 1, ec); + boost::int64_t written = f.writev(0, &b, 1, ec); if (written != int(v.size())) return -3; if (ec) return -3; return 0; diff --git a/test/test_http_parser.cpp b/test/test_http_parser.cpp index 32d4eab6f..eeed8544a 100644 --- a/test/test_http_parser.cpp +++ b/test/test_http_parser.cpp @@ -33,7 +33,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "test.hpp" #include "libtorrent/http_parser.hpp" #include "libtorrent/parse_url.hpp" -#include "libtorrent/size_type.hpp" #include #include @@ -232,7 +231,7 @@ int test_main() TEST_CHECK(parser.header("content-type") == "text/plain"); TEST_CHECK(atoi(parser.header("content-length").c_str()) == 20); TEST_CHECK(parser.chunked_encoding()); - typedef std::pair chunk_range; + typedef std::pair chunk_range; std::vector cmp; cmp.push_back(chunk_range(96, 100)); cmp.push_back(chunk_range(106, 122)); @@ -265,7 +264,7 @@ int test_main() received = feed_bytes(parser, web_seed_response); TEST_CHECK(received == make_tuple(5, int(strlen(web_seed_response) - 5), false)); - TEST_CHECK(parser.content_range() == (std::pair(0, 4))); + TEST_CHECK(parser.content_range() == (std::pair(0, 4))); TEST_CHECK(parser.content_length() == 5); parser.reset(); @@ -289,7 +288,7 @@ int test_main() { // test chunked encoding parser char const chunk_header1[] = "f;this is a comment\r\n"; - size_type chunk_size; + boost::int64_t chunk_size; int header_size; bool ret = parser.parse_chunk_header(buffer::const_interval(chunk_header1, chunk_header1 + 10) , &chunk_size, &header_size); diff --git a/test/test_peer_list.cpp b/test/test_peer_list.cpp index 1a57ce673..629a67bdb 100644 --- a/test/test_peer_list.cpp +++ b/test/test_peer_list.cpp @@ -91,7 +91,7 @@ struct mock_peer_connection : peer_connection_interface virtual torrent_peer* peer_info_struct() const { return m_tp; } virtual void set_peer_info(torrent_peer* pi) { m_tp = pi; } virtual bool is_outgoing() const { return m_outgoing; } - virtual void add_stat(size_type downloaded, size_type uploaded) + virtual void add_stat(boost::int64_t downloaded, boost::int64_t uploaded) { m_stat.add_stat(downloaded, uploaded); } virtual bool fast_reconnect() const { return true; } virtual bool is_choked() const { return m_choked; } @@ -404,7 +404,7 @@ int test_main() TEST_CHECK(peer); if (peer == NULL || st.erased.size() > 0) { - fprintf(stderr, "unexpected rejection of peer: %d in list. added peer %p, erased peers %d\n" + fprintf(stderr, "unexpected rejection of peer: %d in list. added peer %p, erased %d peers\n" , p.num_peers(), peer, int(st.erased.size())); } } diff --git a/test/test_rss.cpp b/test/test_rss.cpp index 4c074aaec..61692be73 100644 --- a/test/test_rss.cpp +++ b/test/test_rss.cpp @@ -67,14 +67,14 @@ void print_feed(feed_status const& f) struct rss_expect { - rss_expect(int nitems, std::string url, std::string title, size_type size) + rss_expect(int nitems, std::string url, std::string title, boost::int64_t size) : num_items(nitems), first_url(url), first_title(title), first_size(size) {} int num_items; std::string first_url; std::string first_title; - size_type first_size; + boost::int64_t first_size; }; void test_feed(std::string const& filename, rss_expect const& expect) diff --git a/test/test_torrent.cpp b/test/test_torrent.cpp index 64307bba6..916bee66b 100644 --- a/test/test_torrent.cpp +++ b/test/test_torrent.cpp @@ -48,7 +48,7 @@ POSSIBILITY OF SUCH DAMAGE. using namespace libtorrent; namespace lt = libtorrent; -void test_running_torrent(boost::shared_ptr info, size_type file_size) +void test_running_torrent(boost::shared_ptr info, boost::int64_t file_size) { settings_pack pack; pack.set_int(settings_pack::alert_mask, alert::storage_notification); @@ -168,7 +168,7 @@ int test_main() remove("test_torrent_dir2/tmp2"); remove("test_torrent_dir2/tmp3"); file_storage fs; - size_type file_size = 256 * 1024; + boost::int64_t file_size = 256 * 1024; fs.add_file("test_torrent_dir2/tmp1", file_size); fs.add_file("test_torrent_dir2/tmp2", file_size); fs.add_file("test_torrent_dir2/tmp3", file_size); diff --git a/test/test_torrent_parse.cpp b/test/test_torrent_parse.cpp index ccdb2ac60..978df2de6 100644 --- a/test/test_torrent_parse.cpp +++ b/test/test_torrent_parse.cpp @@ -464,7 +464,7 @@ int test_main() for (int i = 0; i < fs.num_files(); ++i) { int first = ti->map_file(i, 0, 0).piece; - int last = ti->map_file(i, (std::max)(fs.file_size(i)-1, size_type(0)), 0).piece; + int last = ti->map_file(i, (std::max)(fs.file_size(i)-1, boost::int64_t(0)), 0).piece; int flags = fs.file_flags(i); fprintf(stderr, " %11" PRId64 " %c%c%c%c [ %4d, %4d ] %7u %s %s %s%s\n" , fs.file_size(i) diff --git a/test/web_seed_suite.cpp b/test/web_seed_suite.cpp index a6309a3b7..7315d4930 100644 --- a/test/web_seed_suite.cpp +++ b/test/web_seed_suite.cpp @@ -149,7 +149,7 @@ void test_transfer(lt::session& ses, boost::shared_ptr torrent_fil std::vector empty; th.replace_trackers(empty); - const size_type total_size = torrent_file->total_size(); + const boost::int64_t total_size = torrent_file->total_size(); float rate_sum = 0.f; float ses_rate_sum = 0.f;