merge bdecode patch from RC_1_0. an empty string now produces an error rather than an empty bdecoded struct

This commit is contained in:
arvidn
2015-07-30 21:29:22 -04:00
parent 3dda8f97d6
commit 52b4aed466
5 changed files with 12 additions and 5 deletions

View File

@@ -568,7 +568,8 @@ TORRENT_TEST(empty_string)
bdecode_node e;
error_code ec;
int ret = bdecode(b, b + sizeof(b)-1, e, ec, NULL);
TEST_EQUAL(ret, 0);
TEST_EQUAL(ret, -1);
TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
printf("%s\n", print_entry(e).c_str());
}

View File

@@ -439,7 +439,9 @@ TORRENT_TEST(bencoding)
lazy_entry e;
error_code ec;
int ret = lazy_bdecode(b, b + sizeof(b)-1, e, ec, NULL);
TEST_EQUAL(ret, 0);
TEST_EQUAL(ret, -1);
TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof
, get_bdecode_category()));
printf("%s\n", print_entry(e).c_str());
}