mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 12:34:43 +00:00
lt sync 2207
This commit is contained in:
parent
354b31dbbe
commit
e477b5e037
@ -125,11 +125,12 @@ namespace libtorrent
|
|||||||
lazy_entry const* dict_find_dict(char const* name) const;
|
lazy_entry const* dict_find_dict(char const* name) const;
|
||||||
lazy_entry const* dict_find_list(char const* name) const;
|
lazy_entry const* dict_find_list(char const* name) const;
|
||||||
|
|
||||||
std::pair<char const*, lazy_entry const*> dict_at(int i) const
|
std::pair<std::string, lazy_entry const*> dict_at(int i) const
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_type == dict_t);
|
TORRENT_ASSERT(m_type == dict_t);
|
||||||
TORRENT_ASSERT(i < m_size);
|
TORRENT_ASSERT(i < m_size);
|
||||||
return std::make_pair(m_data.dict[i].first, &m_data.dict[i].second);
|
std::pair<char const*, lazy_entry> const& e = m_data.dict[i];
|
||||||
|
return std::make_pair(std::string(e.first, e.second.m_begin - e.first), &e.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dict_size() const
|
int dict_size() const
|
||||||
@ -183,7 +184,7 @@ namespace libtorrent
|
|||||||
|
|
||||||
// returns pointers into the source buffer where
|
// returns pointers into the source buffer where
|
||||||
// this entry has its bencoded data
|
// this entry has its bencoded data
|
||||||
std::pair<char const*, int> data_section();
|
std::pair<char const*, int> data_section() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ namespace libtorrent
|
|||||||
++str2;
|
++str2;
|
||||||
--len2;
|
--len2;
|
||||||
}
|
}
|
||||||
return true;
|
return *str1 == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ namespace libtorrent
|
|||||||
m_type = none_t;
|
m_type = none_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<char const*, int> lazy_entry::data_section()
|
std::pair<char const*, int> lazy_entry::data_section() const
|
||||||
{
|
{
|
||||||
typedef std::pair<char const*, int> return_t;
|
typedef std::pair<char const*, int> return_t;
|
||||||
return return_t(m_begin, m_end - m_begin);
|
return return_t(m_begin, m_end - m_begin);
|
||||||
@ -357,10 +357,11 @@ namespace libtorrent
|
|||||||
printable = false;
|
printable = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (printable) return os << e.string_value();
|
os << "'";
|
||||||
|
if (printable) return os << e.string_value() << "'";
|
||||||
for (int i = 0; i < e.string_length(); ++i)
|
for (int i = 0; i < e.string_length(); ++i)
|
||||||
os << std::hex << int((unsigned char)(str[i]));
|
os << std::hex << int((unsigned char)(str[i]));
|
||||||
return os;
|
return os << "'";
|
||||||
}
|
}
|
||||||
case lazy_entry::list_t:
|
case lazy_entry::list_t:
|
||||||
{
|
{
|
||||||
@ -368,7 +369,7 @@ namespace libtorrent
|
|||||||
bool one_liner = (e.list_size() == 0
|
bool one_liner = (e.list_size() == 0
|
||||||
|| e.list_at(0)->type() == lazy_entry::int_t
|
|| e.list_at(0)->type() == lazy_entry::int_t
|
||||||
|| (e.list_at(0)->type() == lazy_entry::string_t
|
|| (e.list_at(0)->type() == lazy_entry::string_t
|
||||||
&& e.list_at(0)->string_length() < 5))
|
&& e.list_at(0)->string_length() < 10))
|
||||||
&& e.list_size() < 5;
|
&& e.list_size() < 5;
|
||||||
if (!one_liner) os << "\n";
|
if (!one_liner) os << "\n";
|
||||||
for (int i = 0; i < e.list_size(); ++i)
|
for (int i = 0; i < e.list_size(); ++i)
|
||||||
@ -386,15 +387,15 @@ namespace libtorrent
|
|||||||
bool one_liner = (e.dict_size() == 0
|
bool one_liner = (e.dict_size() == 0
|
||||||
|| e.dict_at(0).second->type() == lazy_entry::int_t
|
|| e.dict_at(0).second->type() == lazy_entry::int_t
|
||||||
|| (e.dict_at(0).second->type() == lazy_entry::string_t
|
|| (e.dict_at(0).second->type() == lazy_entry::string_t
|
||||||
&& e.dict_at(0).second->string_length() < 4)
|
&& e.dict_at(0).second->string_length() < 10)
|
||||||
|| strlen(e.dict_at(0).first) < 10)
|
|| e.dict_at(0).first.size() < 10)
|
||||||
&& e.dict_size() < 5;
|
&& e.dict_size() < 5;
|
||||||
|
|
||||||
if (!one_liner) os << "\n";
|
if (!one_liner) os << "\n";
|
||||||
for (int i = 0; i < e.dict_size(); ++i)
|
for (int i = 0; i < e.dict_size(); ++i)
|
||||||
{
|
{
|
||||||
if (i == 0 && one_liner) os << " ";
|
if (i == 0 && one_liner) os << " ";
|
||||||
std::pair<char const*, lazy_entry const*> ent = e.dict_at(i);
|
std::pair<std::string, lazy_entry const*> ent = e.dict_at(i);
|
||||||
os << "'" << ent.first << "': " << *ent.second;
|
os << "'" << ent.first << "': " << *ent.second;
|
||||||
if (i < e.dict_size() - 1) os << (one_liner?", ":",\n");
|
if (i < e.dict_size() - 1) os << (one_liner?", ":",\n");
|
||||||
else os << (one_liner?" ":"\n");
|
else os << (one_liner?" ":"\n");
|
||||||
|
@ -546,7 +546,7 @@ void upnp::create_port_mapping(http_connection& c, rootdevice& d, int i)
|
|||||||
asio::error_code ec;
|
asio::error_code ec;
|
||||||
soap << "<NewRemoteHost></NewRemoteHost>"
|
soap << "<NewRemoteHost></NewRemoteHost>"
|
||||||
"<NewExternalPort>" << d.mapping[i].external_port << "</NewExternalPort>"
|
"<NewExternalPort>" << d.mapping[i].external_port << "</NewExternalPort>"
|
||||||
"<NewProtocol>" << (d.mapping[i].protocol ? "UDP" : "TCP") << "</NewProtocol>"
|
"<NewProtocol>" << (d.mapping[i].protocol == udp ? "UDP" : "TCP") << "</NewProtocol>"
|
||||||
"<NewInternalPort>" << d.mapping[i].local_port << "</NewInternalPort>"
|
"<NewInternalPort>" << d.mapping[i].local_port << "</NewInternalPort>"
|
||||||
"<NewInternalClient>" << c.socket().local_endpoint(ec).address() << "</NewInternalClient>"
|
"<NewInternalClient>" << c.socket().local_endpoint(ec).address() << "</NewInternalClient>"
|
||||||
"<NewEnabled>1</NewEnabled>"
|
"<NewEnabled>1</NewEnabled>"
|
||||||
@ -660,7 +660,7 @@ void upnp::delete_port_mapping(rootdevice& d, int i)
|
|||||||
|
|
||||||
soap << "<NewRemoteHost></NewRemoteHost>"
|
soap << "<NewRemoteHost></NewRemoteHost>"
|
||||||
"<NewExternalPort>" << d.mapping[i].external_port << "</NewExternalPort>"
|
"<NewExternalPort>" << d.mapping[i].external_port << "</NewExternalPort>"
|
||||||
"<NewProtocol>" << (d.mapping[i].protocol ? "UDP" : "TCP") << "</NewProtocol>";
|
"<NewProtocol>" << (d.mapping[i].protocol == udp ? "UDP" : "TCP") << "</NewProtocol>";
|
||||||
soap << "</u:" << soap_action << "></s:Body></s:Envelope>";
|
soap << "</u:" << soap_action << "></s:Body></s:Envelope>";
|
||||||
|
|
||||||
post(d, soap.str(), soap_action);
|
post(d, soap.str(), soap_action);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user