From 38f4765ebc5e12000ef71451681ed5ffa1027198 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Mon, 13 Jun 2016 17:16:09 -0400 Subject: [PATCH] added assert and documentation typos (#816) --- include/libtorrent/aux_/session_interface.hpp | 2 +- src/bdecode.cpp | 4 ++-- src/session_impl.cpp | 7 ++++--- src/storage.cpp | 4 ++-- src/torrent.cpp | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/libtorrent/aux_/session_interface.hpp b/include/libtorrent/aux_/session_interface.hpp index 363a64b95..fcd2c4317 100644 --- a/include/libtorrent/aux_/session_interface.hpp +++ b/include/libtorrent/aux_/session_interface.hpp @@ -125,7 +125,7 @@ namespace libtorrent { namespace aux }; #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 // of the mock object to test it. struct TORRENT_EXTRA_EXPORT session_interface diff --git a/src/bdecode.cpp b/src/bdecode.cpp index 5df475b00..e5bee9b0e 100644 --- a/src/bdecode.cpp +++ b/src/bdecode.cpp @@ -103,7 +103,7 @@ namespace libtorrent stack_frame(int t): token(t), state(0) {} // this is an index into m_tokens 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 boost::uint32_t state:1; }; @@ -801,7 +801,7 @@ namespace libtorrent && stack[sp-1].state == 1) { // 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); } diff --git a/src/session_impl.cpp b/src/session_impl.cpp index e3b5afe3c..58286ec56 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1494,7 +1494,7 @@ namespace aux { 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 (m_torrent_lru.size() > loaded_limit) @@ -1518,7 +1518,7 @@ namespace aux { 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 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 // in the LRU (and loaded) TORRENT_ASSERT(t->next == NULL && t->prev == NULL && m_torrent_lru.front() != t); + TORRENT_ASSERT(m_user_load_torrent); // now, load t into RAM std::vector buffer; @@ -6250,7 +6251,7 @@ retry: 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::iterator i = agent.begin(); while ((i = std::find(i, agent.end(), '\n')) diff --git a/src/storage.cpp b/src/storage.cpp index 6cb36fc0e..7511c4a45 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -965,7 +965,7 @@ namespace libtorrent bdecode_node slots = rd.dict_find_list("slots"); if (slots) { - if (int(slots.list_size()) == m_files.num_pieces()) + if (slots.list_size() == m_files.num_pieces()) { seed = true; 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")) { - if (int(pieces.string_length()) == m_files.num_pieces()) + if (pieces.string_length() == m_files.num_pieces()) { seed = true; char const* p = pieces.string_ptr(); diff --git a/src/torrent.cpp b/src/torrent.cpp index db23f02bc..d6ec09053 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -7117,7 +7117,7 @@ namespace libtorrent // some sanity checking. Maybe we shouldn't be in seed mode anymore bdecode_node pieces = rd.dict_find("pieces"); 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(); for (int i = 0, end(pieces.string_length()); i < end; ++i)