forked from premiere/premiere-libtorrent
merged RC_1_1 into master
This commit is contained in:
commit
d8ea7fc5eb
|
@ -78,6 +78,7 @@
|
|||
* resume data no longer has timestamps of files
|
||||
* require C++11 to build libtorrent
|
||||
|
||||
* restore path sanitization behavior of ":"
|
||||
* fix listen socket issue when disabling "force_proxy" mode
|
||||
* fix full allocation failure on APFS
|
||||
|
||||
|
|
|
@ -93,11 +93,7 @@ namespace libtorrent {
|
|||
static const std::array<std::int32_t, 7> bad_cp = {{0x202a, 0x202b, 0x202c, 0x202d, 0x202e, 0x200e, 0x200f}};
|
||||
if (std::find(bad_cp.begin(), bad_cp.end(), c) != bad_cp.end()) return true;
|
||||
|
||||
#ifdef TORRENT_WINDOWS
|
||||
static const char invalid_chars[] = "/\\:";
|
||||
#else
|
||||
static const char invalid_chars[] = "/\\";
|
||||
#endif
|
||||
if (c > 127) return false;
|
||||
return std::strchr(invalid_chars, static_cast<char>(c)) != nullptr;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace {
|
|||
int old_stdout = -1;
|
||||
int old_stderr = -1;
|
||||
bool redirect_stdout = true;
|
||||
bool redirect_stderr = false;
|
||||
bool redirect_stderr = true;
|
||||
bool keep_files = false;
|
||||
|
||||
// the current tests file descriptor
|
||||
|
@ -83,15 +83,21 @@ unit_test_t* current_test = nullptr;
|
|||
void output_test_log_to_terminal()
|
||||
{
|
||||
if (current_test == nullptr
|
||||
|| (old_stdout == -1 && old_stderr == -1)
|
||||
|| (!redirect_stdout && !redirect_stderr)
|
||||
|| current_test->output == nullptr)
|
||||
return;
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
if (old_stdout != -1) dup2(old_stdout, fileno(stdout));
|
||||
if (old_stderr != -1) dup2(old_stderr, fileno(stderr));
|
||||
if (old_stdout != -1)
|
||||
{
|
||||
dup2(old_stdout, fileno(stdout));
|
||||
old_stdout = -1;
|
||||
}
|
||||
if (old_stderr != -1)
|
||||
{
|
||||
dup2(old_stderr, fileno(stderr));
|
||||
old_stderr = -1;
|
||||
}
|
||||
|
||||
fseek(current_test->output, 0, SEEK_SET);
|
||||
std::printf("\x1b[1m[%s]\x1b[0m\n\n", current_test->name);
|
||||
|
|
|
@ -390,7 +390,7 @@ TORRENT_TEST(sanitize_path)
|
|||
path.clear();
|
||||
sanitize_append_path_element(path, "dev:");
|
||||
#ifdef TORRENT_WINDOWS
|
||||
TEST_EQUAL(path, "dev");
|
||||
TEST_EQUAL(path, "dev_");
|
||||
#else
|
||||
TEST_EQUAL(path, "dev:");
|
||||
#endif
|
||||
|
@ -399,7 +399,7 @@ TORRENT_TEST(sanitize_path)
|
|||
sanitize_append_path_element(path, "c:");
|
||||
sanitize_append_path_element(path, "b");
|
||||
#ifdef TORRENT_WINDOWS
|
||||
TEST_EQUAL(path, "c" SEPARATOR "b");
|
||||
TEST_EQUAL(path, "c_" SEPARATOR "b");
|
||||
#else
|
||||
TEST_EQUAL(path, "c:" SEPARATOR "b");
|
||||
#endif
|
||||
|
@ -409,7 +409,7 @@ TORRENT_TEST(sanitize_path)
|
|||
sanitize_append_path_element(path, ".");
|
||||
sanitize_append_path_element(path, "c");
|
||||
#ifdef TORRENT_WINDOWS
|
||||
TEST_EQUAL(path, "c" SEPARATOR "c");
|
||||
TEST_EQUAL(path, "c_" SEPARATOR "c");
|
||||
#else
|
||||
TEST_EQUAL(path, "c:" SEPARATOR "c");
|
||||
#endif
|
||||
|
@ -552,6 +552,17 @@ TORRENT_TEST(sanitize_path_zeroes)
|
|||
TEST_EQUAL(path, "_");
|
||||
}
|
||||
|
||||
TORRENT_TEST(sanitize_path_colon)
|
||||
{
|
||||
std::string path;
|
||||
sanitize_append_path_element(path, "foo:bar");
|
||||
#ifdef TORRENT_WINDOWS
|
||||
TEST_EQUAL(path, "foo_bar");
|
||||
#else
|
||||
TEST_EQUAL(path, "foo:bar");
|
||||
#endif
|
||||
}
|
||||
|
||||
TORRENT_TEST(verify_encoding)
|
||||
{
|
||||
// verify_encoding
|
||||
|
@ -669,7 +680,7 @@ TORRENT_TEST(parse_torrents)
|
|||
torrent_info ti2(buf, from_span);
|
||||
std::cout << ti2.name() << std::endl;
|
||||
#ifdef TORRENT_WINDOWS
|
||||
TEST_EQUAL(ti2.name(), "ctest1test2test3");
|
||||
TEST_EQUAL(ti2.name(), "c_test1test2test3");
|
||||
#else
|
||||
TEST_EQUAL(ti2.name(), "test1test2test3");
|
||||
#endif
|
||||
|
|
|
@ -370,8 +370,6 @@ void test_udp_tracker(std::string const& iface, address tracker, tcp::endpoint c
|
|||
break;
|
||||
|
||||
std::this_thread::sleep_for(lt::milliseconds(100));
|
||||
std::printf("UDP: %d / %d\n", int(num_udp_announces())
|
||||
, int(prev_udp_announces) + 1);
|
||||
}
|
||||
|
||||
// we should have announced to the tracker by now
|
||||
|
@ -390,8 +388,6 @@ void test_udp_tracker(std::string const& iface, address tracker, tcp::endpoint c
|
|||
break;
|
||||
|
||||
std::this_thread::sleep_for(lt::milliseconds(100));
|
||||
std::printf("UDP: %d / %d\n", int(num_udp_announces())
|
||||
, int(prev_udp_announces) + 1);
|
||||
}
|
||||
|
||||
TEST_CHECK(peer_ep == expected_peer);
|
||||
|
|
Loading…
Reference in New Issue