* Cleaned up torrent/download.h.

* Removed raw_value as it is redundant.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1145 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2010-03-15 18:31:50 +00:00
parent 19be810642
commit c5e839287d
9 changed files with 74 additions and 50 deletions
+1 -1
View File
@@ -152,7 +152,7 @@ private:
inline bool
Download::operator == (const std::string& str) const {
return str.size() == torrent::HashString::size_data && *torrent::HashString::cast_from(str) == m_download.info_hash();
return str.size() == torrent::HashString::size_data && *torrent::HashString::cast_from(str) == m_download.info()->hash();
}
}
+2 -2
View File
@@ -304,7 +304,7 @@ DownloadFactory::receive_success() {
}
// Save the info-hash just in case the commands decide to delete it.
torrent::HashString infohash = download->download()->info_hash();
torrent::HashString infohash = download->info()->hash();
try {
std::for_each(m_commands.begin(), m_commands.end(), rak::bind1st(std::ptr_fun(&rpc::parse_command_d_multiple_std), download));
@@ -382,7 +382,7 @@ DownloadFactory::initialize_rtorrent(Download* download, torrent::Object* rtorre
}
if (rtorrent->has_key_value("total_uploaded"))
download->download()->up_rate()->set_total(rtorrent->get_key_value("total_uploaded"));
download->info()->mutable_up_rate()->set_total(rtorrent->get_key_value("total_uploaded"));
if (rtorrent->has_key_value("chunks_done"))
download->download()->set_chunks_done(std::min<uint32_t>(rtorrent->get_key_value("chunks_done"),
+2 -2
View File
@@ -94,7 +94,7 @@ DownloadList::session_save() {
DownloadList::iterator
DownloadList::find(const torrent::HashString& hash) {
return std::find_if(begin(), end(), rak::equal(hash, rak::on(std::mem_fun(&Download::download), std::mem_fun(&torrent::Download::info_hash))));
return std::find_if(begin(), end(), rak::equal(hash, rak::on(std::mem_fun(&Download::info), std::mem_fun(&torrent::DownloadInfo::hash))));
}
DownloadList::iterator
@@ -104,7 +104,7 @@ DownloadList::find_hex(const char* hash) {
for (torrent::HashString::iterator itr = key.begin(), last = key.end(); itr != last; itr++, hash += 2)
*itr = (rak::hexchar_to_value(*hash) << 4) + rak::hexchar_to_value(*(hash + 1));
return std::find_if(begin(), end(), rak::equal(key, rak::on(std::mem_fun(&Download::download), std::mem_fun(&torrent::Download::info_hash))));
return std::find_if(begin(), end(), rak::equal(key, rak::on(std::mem_fun(&Download::info), std::mem_fun(&torrent::DownloadInfo::hash))));
}
Download*
+2 -2
View File
@@ -138,7 +138,7 @@ DownloadStore::save(Download* d, int flags) {
// Move this somewhere else?
rtorrent_base->insert_key("chunks_done", d->download()->file_list()->completed_chunks());
rtorrent_base->insert_key("total_uploaded", d->download()->up_rate()->total());
rtorrent_base->insert_key("total_uploaded", d->info()->up_rate()->total());
// Don't save for completed torrents when we've cleared the uncertain_pieces.
torrent::resume_save_progress(*d->download(), *resume_base);
@@ -214,7 +214,7 @@ DownloadStore::is_correct_format(const std::string& f) {
std::string
DownloadStore::create_filename(Download* d) {
return m_path + rak::transform_hex(d->download()->info_hash().begin(), d->download()->info_hash().end()) + ".torrent";
return m_path + rak::transform_hex(d->info()->hash().begin(), d->info()->hash().end()) + ".torrent";
}
}