merged fixes from RC_0_16

This commit is contained in:
Arvid Norberg 2013-05-11 22:00:54 +00:00
parent cf7a2a098e
commit bdf0e1764b
6 changed files with 23 additions and 10 deletions

View File

@ -194,10 +194,9 @@ namespace libtorrent
, boost::function<void(int)> f, error_code& ec)
{
file_pool fp;
std::string path = complete(p);
#if TORRENT_USE_UNC_PATHS
std::string path = canonicalize_path(p);
#else
std::string const& path = p;
path = canonicalize_path(path);
#endif
boost::scoped_ptr<storage_interface> st(
default_storage_constructor(const_cast<file_storage&>(t.files()), 0, path, fp

View File

@ -391,6 +391,7 @@ namespace libtorrent
, m_page_size(page_size())
, m_allocate_files(false)
{
TORRENT_ASSERT(is_complete(path));
if (mapped) m_mapped_files.reset(new file_storage(*mapped));
TORRENT_ASSERT(m_files.begin() != m_files.end());

View File

@ -79,6 +79,12 @@ EXTRA_DIST = Jamfile \
test_torrents/invalid_root_hash2.torrent \
test_torrents/root_hash.torrent \
test_torrents/invalid_file_size.torrent
eztv.xml \
kat.xml \
cb.xml \
mn.xml \
pb.xml \
upnp.xml
EXTRA_PROGRAMS = $(test_programs)

View File

@ -65,11 +65,14 @@ bool tests_failure = false;
void report_failure(char const* err, char const* file, int line)
{
#if defined TORRENT_WINDOWS && defined TORRENT_MINGW
HANDLE console = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, 0, CONSOLE_TEXTMODE_BUFFER, 0);
SetConsoleTextAttribute(console, FOREGROUND_RED);
fprintf(stderr, "\n**** %s:%d \"%s\" ****\n\n", file, line, err);
CloseHandle(console);
#if defined TORRENT_WINDOWS
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(out, FOREGROUND_RED);
char buffer[1024];
int len = snprintf(buffer, sizeof(buffer), "\n**** %s:%d \"%s\" ****\n\n", file, line, err);
DWORD written;
WriteFile(out, buffer, len, &written, NULL);
SetConsoleTextAttribute(out, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
#else
fprintf(stderr, "\033[31m %s:%d \"%s\"\033[0m\n", file, line, err);
#endif

View File

@ -79,6 +79,10 @@ void test_feed(std::string const& filename, rss_expect const& expect)
std::vector<char> buffer;
error_code ec;
load_file(filename, buffer, ec);
if (ec)
{
fprintf(stderr, "failed to load file \"%s\": %s\n", filename.c_str(), ec.message().c_str());
}
TEST_CHECK(!ec);
char* buf = &buffer[0];

View File

@ -127,8 +127,8 @@ int test_main()
{
// make sure we disambiguated the files
TEST_EQUAL(ti->num_files(), 2);
TEST_CHECK(ti->file_at(0).path == "temp/foo/bar.txt");
TEST_CHECK(ti->file_at(1).path == "temp/foo/bar.1.txt");
TEST_CHECK(ti->file_at(0).path == combine_path(combine_path("temp", "foo"), "bar.txt"));
TEST_CHECK(ti->file_at(1).path == combine_path(combine_path("temp", "foo"), "bar.1.txt"));
}
else if (std::string(test_torrents[i].file) == "pad_file.torrent")
{