make dump_torrent build without deprecated functions

This commit is contained in:
Arvid Norberg
2013-09-15 12:18:27 +00:00
parent b81dbc4669
commit 00cbb91601

View File

@@ -327,25 +327,25 @@ int main(int argc, char* argv[])
, make_magnet_uri(t).c_str() , make_magnet_uri(t).c_str()
, t.name().c_str() , t.name().c_str()
, t.num_files()); , t.num_files());
int index = 0; file_storage const& st = t.files();
for (torrent_info::file_iterator i = t.begin_files(); for (int i = 0; i < st.num_files(); ++i)
i != t.end_files(); ++i, ++index)
{ {
int first = t.map_file(index, 0, 0).piece; int first = st.map_file(i, 0, 0).piece;
int last = t.map_file(index, (std::max)(size_type(i->size)-1, size_type(0)), 0).piece; int last = st.map_file(i, (std::max)(size_type(st.file_size(i))-1, size_type(0)), 0).piece;
printf(" %8"PRIx64" %11"PRId64" %c%c%c%c [ %5d, %5d ] %7u %s %s %s%s\n" int flags = st.file_flags(i);
, i->offset printf(" %8" PRIx64 " %11" PRId64 " %c%c%c%c [ %5d, %5d ] %7u %s %s %s%s\n"
, i->size , st.file_offset(i)
, (i->pad_file?'p':'-') , st.file_size(i)
, (i->executable_attribute?'x':'-') , ((flags & file_storage::flag_pad_file)?'p':'-')
, (i->hidden_attribute?'h':'-') , ((flags & file_storage::flag_executable)?'x':'-')
, (i->symlink_attribute?'l':'-') , ((flags & file_storage::flag_hidden)?'h':'-')
, ((flags & file_storage::flag_symlink)?'l':'-')
, first, last , first, last
, boost::uint32_t(t.files().mtime(*i)) , boost::uint32_t(st.mtime(i))
, t.files().hash(*i) != sha1_hash(0) ? to_hex(t.files().hash(*i).to_string()).c_str() : "" , st.hash(i) != sha1_hash(0) ? to_hex(st.hash(i).to_string()).c_str() : ""
, t.files().file_path(*i).c_str() , st.file_path(i).c_str()
, i->symlink_attribute ? "-> ": "" , (flags & file_storage::flag_symlink) ? "-> " : ""
, i->symlink_attribute && i->symlink_index != -1 ? t.files().symlink(*i).c_str() : ""); , (flags & file_storage::flag_symlink) ? st.symlink(i).c_str() : "");
} }
return 0; return 0;