mirror of https://github.com/aria2/aria2
Clean up if defined style
parent
58f35a07a5
commit
fa09dc9115
|
@ -134,7 +134,7 @@ void AbstractDiskWriter::openFile(int64_t totalLength)
|
||||||
|
|
||||||
void AbstractDiskWriter::closeFile()
|
void AbstractDiskWriter::closeFile()
|
||||||
{
|
{
|
||||||
#if defined HAVE_MMAP || defined __MINGW32__
|
#if defined(HAVE_MMAP) || defined(__MINGW32__)
|
||||||
if(mapaddr_) {
|
if(mapaddr_) {
|
||||||
int errNum = 0;
|
int errNum = 0;
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
|
@ -336,7 +336,7 @@ void AbstractDiskWriter::seek(int64_t offset)
|
||||||
|
|
||||||
void AbstractDiskWriter::ensureMmapWrite(size_t len, int64_t offset)
|
void AbstractDiskWriter::ensureMmapWrite(size_t len, int64_t offset)
|
||||||
{
|
{
|
||||||
#if defined HAVE_MMAP || defined __MINGW32__
|
#if defined(HAVE_MMAP) || defined(__MINGW32__)
|
||||||
if(enableMmap_) {
|
if(enableMmap_) {
|
||||||
if(mapaddr_) {
|
if(mapaddr_) {
|
||||||
if(static_cast<int64_t>(len + offset) > maplen_) {
|
if(static_cast<int64_t>(len + offset) > maplen_) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ AsyncNameResolver::AsyncNameResolver
|
||||||
{
|
{
|
||||||
// TODO evaluate return value
|
// TODO evaluate return value
|
||||||
ares_init(&channel_);
|
ares_init(&channel_);
|
||||||
#if defined HAVE_ARES_SET_SERVERS && HAVE_ARES_ADDR_NODE
|
#if defined(HAVE_ARES_SET_SERVERS) && defined(HAVE_ARES_ADDR_NODE)
|
||||||
if(servers) {
|
if(servers) {
|
||||||
// ares_set_servers has been added since c-ares 1.7.1
|
// ares_set_servers has been added since c-ares 1.7.1
|
||||||
if(ares_set_servers(channel_, servers) != ARES_SUCCESS) {
|
if(ares_set_servers(channel_, servers) != ARES_SUCCESS) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ void showMetalinkFile
|
||||||
} // namespace
|
} // namespace
|
||||||
#endif // ENABLE_METALINK
|
#endif // ENABLE_METALINK
|
||||||
|
|
||||||
#if defined ENABLE_BITTORRENT || defined ENABLE_METALINK
|
#if defined(ENABLE_BITTORRENT) || defined(ENABLE_METALINK)
|
||||||
namespace {
|
namespace {
|
||||||
void showFiles
|
void showFiles
|
||||||
(const std::vector<std::string>& uris, const std::shared_ptr<Option>& op)
|
(const std::vector<std::string>& uris, const std::shared_ptr<Option>& op)
|
||||||
|
@ -221,7 +221,7 @@ Context::Context(bool standalone,
|
||||||
} else {
|
} else {
|
||||||
createRequestGroupForUriList(requestGroups, op);
|
createRequestGroupForUriList(requestGroups, op);
|
||||||
}
|
}
|
||||||
#if defined ENABLE_BITTORRENT || defined ENABLE_METALINK
|
#if defined(ENABLE_BITTORRENT) || defined(ENABLE_METALINK)
|
||||||
} else if(op->get(PREF_SHOW_FILES) == A2_V_TRUE) {
|
} else if(op->get(PREF_SHOW_FILES) == A2_V_TRUE) {
|
||||||
showFiles(args, op);
|
showFiles(args, op);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -250,7 +250,7 @@ bool File::renameTo(const std::string& dest)
|
||||||
|
|
||||||
bool File::utime(const Time& actime, const Time& modtime) const
|
bool File::utime(const Time& actime, const Time& modtime) const
|
||||||
{
|
{
|
||||||
#if defined HAVE_UTIMES && !(defined __MINGW32__)
|
#if defined(HAVE_UTIMES) && !defined(__MINGW32__)
|
||||||
struct timeval times[2] = {
|
struct timeval times[2] = {
|
||||||
{ actime.getTime(), 0 },
|
{ actime.getTime(), 0 },
|
||||||
{ modtime.getTime(), 0 }
|
{ modtime.getTime(), 0 }
|
||||||
|
|
|
@ -107,7 +107,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
|
||||||
op->setChangeOptionForReserved(true);
|
op->setChangeOptionForReserved(true);
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
#if defined HAVE_ARES_SET_SERVERS && HAVE_ARES_ADDR_NODE
|
#if defined(HAVE_ARES_SET_SERVERS) && defined(HAVE_ARES_ADDR_NODE)
|
||||||
{
|
{
|
||||||
OptionHandler* op(new DefaultOptionHandler
|
OptionHandler* op(new DefaultOptionHandler
|
||||||
(PREF_ASYNC_DNS_SERVER,
|
(PREF_ASYNC_DNS_SERVER,
|
||||||
|
@ -305,7 +305,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_ASYNC_DNS
|
#endif // ENABLE_ASYNC_DNS
|
||||||
#if defined HAVE_MMAP || defined __MINGW32__
|
#if defined(HAVE_MMAP) || defined(__MINGW32__)
|
||||||
{
|
{
|
||||||
OptionHandler* op(new BooleanOptionHandler
|
OptionHandler* op(new BooleanOptionHandler
|
||||||
(PREF_ENABLE_MMAP,
|
(PREF_ENABLE_MMAP,
|
||||||
|
@ -1607,7 +1607,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
// BitTorrent/Metalink Options
|
// BitTorrent/Metalink Options
|
||||||
#if defined ENABLE_BITTORRENT || defined ENABLE_METALINK
|
#if defined(ENABLE_BITTORRENT) || defined(ENABLE_METALINK)
|
||||||
{
|
{
|
||||||
OptionHandler* op(new IntegerRangeOptionHandler
|
OptionHandler* op(new IntegerRangeOptionHandler
|
||||||
(PREF_SELECT_FILE,
|
(PREF_SELECT_FILE,
|
||||||
|
|
|
@ -161,7 +161,7 @@ std::shared_ptr<RequestGroup> createRequestGroup
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#if defined ENABLE_BITTORRENT || ENABLE_METALINK
|
#if defined(ENABLE_BITTORRENT) || defined(ENABLE_METALINK)
|
||||||
namespace {
|
namespace {
|
||||||
std::shared_ptr<MetadataInfo> createMetadataInfo
|
std::shared_ptr<MetadataInfo> createMetadataInfo
|
||||||
(const std::shared_ptr<GroupId>& gid, const std::string& uri)
|
(const std::shared_ptr<GroupId>& gid, const std::string& uri)
|
||||||
|
|
|
@ -74,9 +74,9 @@ void MetalinkEntryTest::testDropUnsupportedResource()
|
||||||
auto entry = createTestEntry();
|
auto entry = createTestEntry();
|
||||||
|
|
||||||
entry->dropUnsupportedResource();
|
entry->dropUnsupportedResource();
|
||||||
#if defined ENABLE_SSL && defined ENABLE_BITTORRENT
|
#if defined(ENABLE_SSL) && defined(ENABLE_BITTORRENT)
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)4, entry->resources.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)4, entry->resources.size());
|
||||||
#elif defined ENABLE_SSL || defined ENABLE_BITTORRENT
|
#elif defined(ENABLE_SSL) || defined(ENABLE_BITTORRENT)
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)3, entry->resources.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)3, entry->resources.size());
|
||||||
#else
|
#else
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)2, entry->resources.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)2, entry->resources.size());
|
||||||
|
|
Loading…
Reference in New Issue