added assert and documentation typos (#816)

This commit is contained in:
Alden Torres 2016-06-13 17:16:09 -04:00 committed by Arvid Norberg
parent d759d8f742
commit 38f4765ebc
5 changed files with 10 additions and 9 deletions

View File

@ -125,7 +125,7 @@ namespace libtorrent { namespace aux
}; };
#endif // TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS #endif // TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
// TOOD: 2 make this interface a lot smaller. It could be split up into // TODO: 2 make this interface a lot smaller. It could be split up into
// several smaller interfaces. Each subsystem could then limit the size // several smaller interfaces. Each subsystem could then limit the size
// of the mock object to test it. // of the mock object to test it.
struct TORRENT_EXTRA_EXPORT session_interface struct TORRENT_EXTRA_EXPORT session_interface

View File

@ -103,7 +103,7 @@ namespace libtorrent
stack_frame(int t): token(t), state(0) {} stack_frame(int t): token(t), state(0) {}
// this is an index into m_tokens // this is an index into m_tokens
boost::uint32_t token:31; boost::uint32_t token:31;
// this is used for doctionaries to indicate whether we're // this is used for dictionaries to indicate whether we're
// reading a key or a vale. 0 means key 1 is value // reading a key or a vale. 0 means key 1 is value
boost::uint32_t state:1; boost::uint32_t state:1;
}; };
@ -801,7 +801,7 @@ namespace libtorrent
&& stack[sp-1].state == 1) && stack[sp-1].state == 1)
{ {
// this means we're parsing a dictionary and about to parse a // this means we're parsing a dictionary and about to parse a
// value associated with a key. Instad, we got a termination // value associated with a key. Instead, we got a termination
TORRENT_FAIL_BDECODE(bdecode_errors::expected_value); TORRENT_FAIL_BDECODE(bdecode_errors::expected_value);
} }

View File

@ -1494,7 +1494,7 @@ namespace aux {
int loaded_limit = m_settings.get_int(settings_pack::active_loaded_limit); int loaded_limit = m_settings.get_int(settings_pack::active_loaded_limit);
// 0 means unlimited, never evict enything // 0 means unlimited, never evict anything
if (loaded_limit == 0) return; if (loaded_limit == 0) return;
if (m_torrent_lru.size() > loaded_limit) if (m_torrent_lru.size() > loaded_limit)
@ -1518,7 +1518,7 @@ namespace aux {
int loaded_limit = m_settings.get_int(settings_pack::active_loaded_limit); int loaded_limit = m_settings.get_int(settings_pack::active_loaded_limit);
// 0 means unlimited, never evict enything // 0 means unlimited, never evict anything
if (loaded_limit == 0) return; if (loaded_limit == 0) return;
// if the torrent we're ignoring (i.e. making room for), allow // if the torrent we're ignoring (i.e. making room for), allow
@ -1559,6 +1559,7 @@ namespace aux {
// we wouldn't be loading the torrent if it was already // we wouldn't be loading the torrent if it was already
// in the LRU (and loaded) // in the LRU (and loaded)
TORRENT_ASSERT(t->next == NULL && t->prev == NULL && m_torrent_lru.front() != t); TORRENT_ASSERT(t->next == NULL && t->prev == NULL && m_torrent_lru.front() != t);
TORRENT_ASSERT(m_user_load_torrent);
// now, load t into RAM // now, load t into RAM
std::vector<char> buffer; std::vector<char> buffer;
@ -6250,7 +6251,7 @@ retry:
void session_impl::update_user_agent() void session_impl::update_user_agent()
{ {
// replace all occurances of '\n' with ' '. // replace all occurrences of '\n' with ' '.
std::string agent = m_settings.get_str(settings_pack::user_agent); std::string agent = m_settings.get_str(settings_pack::user_agent);
std::string::iterator i = agent.begin(); std::string::iterator i = agent.begin();
while ((i = std::find(i, agent.end(), '\n')) while ((i = std::find(i, agent.end(), '\n'))

View File

@ -965,7 +965,7 @@ namespace libtorrent
bdecode_node slots = rd.dict_find_list("slots"); bdecode_node slots = rd.dict_find_list("slots");
if (slots) if (slots)
{ {
if (int(slots.list_size()) == m_files.num_pieces()) if (slots.list_size() == m_files.num_pieces())
{ {
seed = true; seed = true;
for (int i = 0; i < slots.list_size(); ++i) for (int i = 0; i < slots.list_size(); ++i)
@ -978,7 +978,7 @@ namespace libtorrent
} }
else if (bdecode_node pieces = rd.dict_find_string("pieces")) else if (bdecode_node pieces = rd.dict_find_string("pieces"))
{ {
if (int(pieces.string_length()) == m_files.num_pieces()) if (pieces.string_length() == m_files.num_pieces())
{ {
seed = true; seed = true;
char const* p = pieces.string_ptr(); char const* p = pieces.string_ptr();

View File

@ -7117,7 +7117,7 @@ namespace libtorrent
// some sanity checking. Maybe we shouldn't be in seed mode anymore // some sanity checking. Maybe we shouldn't be in seed mode anymore
bdecode_node pieces = rd.dict_find("pieces"); bdecode_node pieces = rd.dict_find("pieces");
if (pieces && pieces.type() == bdecode_node::string_t if (pieces && pieces.type() == bdecode_node::string_t
&& int(pieces.string_length()) == m_torrent_file->num_pieces()) && pieces.string_length() == m_torrent_file->num_pieces())
{ {
char const* pieces_str = pieces.string_ptr(); char const* pieces_str = pieces.string_ptr();
for (int i = 0, end(pieces.string_length()); i < end; ++i) for (int i = 0, end(pieces.string_length()); i < end; ++i)