merged fixes from RC_0_16
This commit is contained in:
parent
cf7a2a098e
commit
bdf0e1764b
|
@ -194,10 +194,9 @@ namespace libtorrent
|
||||||
, boost::function<void(int)> f, error_code& ec)
|
, boost::function<void(int)> f, error_code& ec)
|
||||||
{
|
{
|
||||||
file_pool fp;
|
file_pool fp;
|
||||||
|
std::string path = complete(p);
|
||||||
#if TORRENT_USE_UNC_PATHS
|
#if TORRENT_USE_UNC_PATHS
|
||||||
std::string path = canonicalize_path(p);
|
path = canonicalize_path(path);
|
||||||
#else
|
|
||||||
std::string const& path = p;
|
|
||||||
#endif
|
#endif
|
||||||
boost::scoped_ptr<storage_interface> st(
|
boost::scoped_ptr<storage_interface> st(
|
||||||
default_storage_constructor(const_cast<file_storage&>(t.files()), 0, path, fp
|
default_storage_constructor(const_cast<file_storage&>(t.files()), 0, path, fp
|
||||||
|
|
|
@ -391,6 +391,7 @@ namespace libtorrent
|
||||||
, m_page_size(page_size())
|
, m_page_size(page_size())
|
||||||
, m_allocate_files(false)
|
, m_allocate_files(false)
|
||||||
{
|
{
|
||||||
|
TORRENT_ASSERT(is_complete(path));
|
||||||
if (mapped) m_mapped_files.reset(new file_storage(*mapped));
|
if (mapped) m_mapped_files.reset(new file_storage(*mapped));
|
||||||
|
|
||||||
TORRENT_ASSERT(m_files.begin() != m_files.end());
|
TORRENT_ASSERT(m_files.begin() != m_files.end());
|
||||||
|
|
|
@ -79,6 +79,12 @@ EXTRA_DIST = Jamfile \
|
||||||
test_torrents/invalid_root_hash2.torrent \
|
test_torrents/invalid_root_hash2.torrent \
|
||||||
test_torrents/root_hash.torrent \
|
test_torrents/root_hash.torrent \
|
||||||
test_torrents/invalid_file_size.torrent
|
test_torrents/invalid_file_size.torrent
|
||||||
|
eztv.xml \
|
||||||
|
kat.xml \
|
||||||
|
cb.xml \
|
||||||
|
mn.xml \
|
||||||
|
pb.xml \
|
||||||
|
upnp.xml
|
||||||
|
|
||||||
EXTRA_PROGRAMS = $(test_programs)
|
EXTRA_PROGRAMS = $(test_programs)
|
||||||
|
|
||||||
|
|
|
@ -65,11 +65,14 @@ bool tests_failure = false;
|
||||||
|
|
||||||
void report_failure(char const* err, char const* file, int line)
|
void report_failure(char const* err, char const* file, int line)
|
||||||
{
|
{
|
||||||
#if defined TORRENT_WINDOWS && defined TORRENT_MINGW
|
#if defined TORRENT_WINDOWS
|
||||||
HANDLE console = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, 0, CONSOLE_TEXTMODE_BUFFER, 0);
|
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
SetConsoleTextAttribute(console, FOREGROUND_RED);
|
SetConsoleTextAttribute(out, FOREGROUND_RED);
|
||||||
fprintf(stderr, "\n**** %s:%d \"%s\" ****\n\n", file, line, err);
|
char buffer[1024];
|
||||||
CloseHandle(console);
|
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
|
#else
|
||||||
fprintf(stderr, "\033[31m %s:%d \"%s\"\033[0m\n", file, line, err);
|
fprintf(stderr, "\033[31m %s:%d \"%s\"\033[0m\n", file, line, err);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -79,6 +79,10 @@ void test_feed(std::string const& filename, rss_expect const& expect)
|
||||||
std::vector<char> buffer;
|
std::vector<char> buffer;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
load_file(filename, buffer, 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);
|
TEST_CHECK(!ec);
|
||||||
|
|
||||||
char* buf = &buffer[0];
|
char* buf = &buffer[0];
|
||||||
|
|
|
@ -127,8 +127,8 @@ int test_main()
|
||||||
{
|
{
|
||||||
// make sure we disambiguated the files
|
// make sure we disambiguated the files
|
||||||
TEST_EQUAL(ti->num_files(), 2);
|
TEST_EQUAL(ti->num_files(), 2);
|
||||||
TEST_CHECK(ti->file_at(0).path == "temp/foo/bar.txt");
|
TEST_CHECK(ti->file_at(0).path == combine_path(combine_path("temp", "foo"), "bar.txt"));
|
||||||
TEST_CHECK(ti->file_at(1).path == "temp/foo/bar.1.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")
|
else if (std::string(test_torrents[i].file) == "pad_file.torrent")
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue