clean up lazy bdecoder a bit
This commit is contained in:
parent
9535142e00
commit
4e94ae592c
|
@ -39,13 +39,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <cstring>
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/size_type.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
#include <iosfwd>
|
||||
#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
|
||||
|
|
|
@ -31,13 +31,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
|
||||
#include "libtorrent/lazy_entry.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include <cstring>
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
#include <iostream>
|
||||
#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;
|
||||
|
|
Loading…
Reference in New Issue