From 541ffc842e763c47efa84cb37695868d22dc61bb Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 5 Aug 2009 02:34:44 +0000 Subject: [PATCH] fixed bug in dump_torrent when the last file was 0-sized --- examples/dump_torrent.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/dump_torrent.cpp b/examples/dump_torrent.cpp index c7a858ef9..370754fd9 100644 --- a/examples/dump_torrent.cpp +++ b/examples/dump_torrent.cpp @@ -116,8 +116,8 @@ int main(int argc, char* argv[]) for (torrent_info::file_iterator i = t.begin_files(); i != t.end_files(); ++i, ++index) { - int first = t.map_file(index, 0, 1).piece; - int last = t.map_file(index, i->size - 1, 1).piece; + int first = t.map_file(index, 0, 0).piece; + int last = t.map_file(index, (std::max)(i->size-1, size_type(0)), 0).piece; std::cout << " " << std::setw(11) << i->size << " " << (i->pad_file?'p':'-') @@ -125,7 +125,7 @@ int main(int argc, char* argv[]) << (i->hidden_attribute?'h':'-') << (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() ; if (i->symlink_attribute) std::cout << " -> " << i->symlink_path.string();