From 4e94ae592c4458b3551f266780e523647688ab81 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 22 Oct 2013 22:41:58 +0000 Subject: [PATCH] clean up lazy bdecoder a bit --- include/libtorrent/lazy_entry.hpp | 11 +++-------- src/lazy_bdecode.cpp | 13 ++++--------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/include/libtorrent/lazy_entry.hpp b/include/libtorrent/lazy_entry.hpp index 62ec528dc..9ae20c09b 100644 --- a/include/libtorrent/lazy_entry.hpp +++ b/include/libtorrent/lazy_entry.hpp @@ -39,13 +39,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include "libtorrent/config.hpp" #include "libtorrent/assert.hpp" -#include "libtorrent/size_type.hpp" #include "libtorrent/error_code.hpp" -#if TORRENT_USE_IOSTREAM -#include -#endif - namespace libtorrent { struct lazy_entry; @@ -166,7 +161,7 @@ namespace libtorrent } // if this is an integer, return the integer value - size_type int_value() const; + boost::int64_t int_value() const; // internal void construct_string(char const* start, int length); @@ -241,7 +236,7 @@ namespace libtorrent // if this is a dictionary, look for a key ``name`` whose value // is an int. If such key exist, return a pointer to its value, // otherwise NULL. - size_type dict_find_int_value(char const* name, size_type default_val = 0) const; + boost::int64_t dict_find_int_value(char const* name, boost::int64_t default_val = 0) const; lazy_entry const* dict_find_int(char const* name) const; lazy_entry const* dict_find_dict(char const* name) const; @@ -283,7 +278,7 @@ namespace libtorrent std::string list_string_value_at(int i) const; pascal_string list_pstr_at(int i) const; - size_type list_int_value_at(int i, size_type default_val = 0) const; + boost::int64_t list_int_value_at(int i, boost::int64_t default_val = 0) const; // if this is a list, return the number of items in it. int list_size() const diff --git a/src/lazy_bdecode.cpp b/src/lazy_bdecode.cpp index c166fd186..ecc14747d 100644 --- a/src/lazy_bdecode.cpp +++ b/src/lazy_bdecode.cpp @@ -31,13 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "libtorrent/lazy_entry.hpp" -#include "libtorrent/escape_string.hpp" #include -#if TORRENT_USE_IOSTREAM -#include -#endif - namespace { const int lazy_entry_grow_factor = 150; // percent @@ -200,7 +195,7 @@ namespace libtorrent return 0; } - size_type lazy_entry::int_value() const + boost::int64_t lazy_entry::int_value() const { TORRENT_ASSERT(m_type == int_t); boost::int64_t val = 0; @@ -325,7 +320,7 @@ namespace libtorrent return e; } - size_type lazy_entry::dict_find_int_value(char const* name, size_type default_val) const + boost::int64_t lazy_entry::dict_find_int_value(char const* name, boost::int64_t default_val) const { lazy_entry const* e = dict_find(name); if (e == 0 || e->type() != lazy_entry::int_t) return default_val; @@ -399,7 +394,7 @@ namespace libtorrent return e->string_pstr(); } - size_type lazy_entry::list_int_value_at(int i, size_type default_val) const + boost::int64_t lazy_entry::list_int_value_at(int i, boost::int64_t default_val) const { lazy_entry const* e = list_at(i); if (e == 0 || e->type() != lazy_entry::int_t) return default_val; @@ -458,7 +453,7 @@ namespace libtorrent break; case lazy_entry::int_t: { - size_type val = e.int_value(); + boost::int64_t val = e.int_value(); while (val > 0) { ++line_len;