fixed incorrect asserts in storage (that were triggered by torrent with zero-size files). Fixed bug in resource distribution algorithm. Made an attempt to avoid an assert in msvc standard library caused by passing a non-printable character to isdigit().

This commit is contained in:
Arvid Norberg
2006-08-10 19:18:11 +00:00
parent 4f2d147e07
commit 87eb377b17
5 changed files with 68 additions and 40 deletions

View File

@@ -19,7 +19,10 @@ int test_main()
torrent_info info;
info.set_piece_size(piece_size);
info.add_file("temp_storage/test1.tmp", 17);
info.add_file("temp_storage/test2.tmp", 613);
info.add_file("temp_storage/test2.tmp", 612);
info.add_file("temp_storage/test3.tmp", 0);
info.add_file("temp_storage/test4.tmp", 0);
info.add_file("temp_storage/test5.tmp", 1);
char piece0[piece_size] =
{ 6, 6, 6, 6, 6, 6, 6, 6
@@ -41,7 +44,7 @@ int test_main()
create_directory(initial_path() / "temp_storage");
int num_pieces = (613 + 17 + piece_size - 1) / piece_size;
int num_pieces = (1 + 612 + 17 + piece_size - 1) / piece_size;
TEST_CHECK(info.num_pieces() == num_pieces);
char piece[piece_size];