merged changes from RC_1_0

This commit is contained in:
Arvid Norberg 2015-01-03 22:07:10 +00:00
parent ed9b281ea4
commit 8b98261df1
1 changed files with 0 additions and 52 deletions

View File

@ -97,58 +97,6 @@ int load_file(std::string const& filename, std::vector<char>& v, libtorrent::err
return 0;
}
int line_longer_than(libtorrent::lazy_entry const& e, int limit)
{
using namespace libtorrent;
int line_len = 0;
switch (e.type())
{
case lazy_entry::list_t:
line_len += 4;
if (line_len > limit) return -1;
for (int i = 0; i < e.list_size(); ++i)
{
int ret = line_longer_than(*e.list_at(i), limit - line_len);
if (ret == -1) return -1;
line_len += ret + 2;
}
break;
case lazy_entry::dict_t:
line_len += 4;
if (line_len > limit) return -1;
for (int i = 0; i < e.dict_size(); ++i)
{
line_len += 4 + e.dict_at(i).first.size();
if (line_len > limit) return -1;
int ret = line_longer_than(*e.dict_at(i).second, limit - line_len);
if (ret == -1) return -1;
line_len += ret + 1;
}
break;
case lazy_entry::string_t:
line_len += 3 + e.string_length();
break;
case lazy_entry::int_t:
{
boost::int64_t val = e.int_value();
while (val > 0)
{
++line_len;
val /= 10;
}
line_len += 2;
}
break;
case lazy_entry::none_t:
line_len += 4;
break;
}
if (line_len > limit) return -1;
return line_len;
}
int main(int argc, char* argv[])
{
using namespace libtorrent;