fixed bug in dump_torrent when the last file was 0-sized

This commit is contained in:
Arvid Norberg 2009-08-05 02:34:44 +00:00
parent 4cfc97f396
commit 541ffc842e
1 changed files with 3 additions and 3 deletions

View File

@ -116,8 +116,8 @@ int main(int argc, char* argv[])
for (torrent_info::file_iterator i = t.begin_files(); for (torrent_info::file_iterator i = t.begin_files();
i != t.end_files(); ++i, ++index) i != t.end_files(); ++i, ++index)
{ {
int first = t.map_file(index, 0, 1).piece; int first = t.map_file(index, 0, 0).piece;
int last = t.map_file(index, i->size - 1, 1).piece; int last = t.map_file(index, (std::max)(i->size-1, size_type(0)), 0).piece;
std::cout << " " << std::setw(11) << i->size std::cout << " " << std::setw(11) << i->size
<< " " << " "
<< (i->pad_file?'p':'-') << (i->pad_file?'p':'-')
@ -125,7 +125,7 @@ int main(int argc, char* argv[])
<< (i->hidden_attribute?'h':'-') << (i->hidden_attribute?'h':'-')
<< (i->symlink_attribute?'l':'-') << (i->symlink_attribute?'l':'-')
<< " " << " "
<< "[ " << std::setw(3) << first << ", " << std::setw(3) << last << " ]\t" << "[ " << std::setw(4) << first << ", " << std::setw(4) << last << " ]\t"
<< i->path.string() ; << i->path.string() ;
if (i->symlink_attribute) if (i->symlink_attribute)
std::cout << " -> " << i->symlink_path.string(); std::cout << " -> " << i->symlink_path.string();