Clean up if defined style

pull/128/merge
Tatsuhiro Tsujikawa 2013-09-17 23:17:08 +09:00
parent 58f35a07a5
commit fa09dc9115
7 changed files with 12 additions and 12 deletions

View File

@ -134,7 +134,7 @@ void AbstractDiskWriter::openFile(int64_t totalLength)
void AbstractDiskWriter::closeFile()
{
#if defined HAVE_MMAP || defined __MINGW32__
#if defined(HAVE_MMAP) || defined(__MINGW32__)
if(mapaddr_) {
int errNum = 0;
#ifdef __MINGW32__
@ -336,7 +336,7 @@ void AbstractDiskWriter::seek(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(mapaddr_) {
if(static_cast<int64_t>(len + offset) > maplen_) {

View File

@ -76,7 +76,7 @@ AsyncNameResolver::AsyncNameResolver
{
// TODO evaluate return value
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) {
// ares_set_servers has been added since c-ares 1.7.1
if(ares_set_servers(channel_, servers) != ARES_SUCCESS) {

View File

@ -109,7 +109,7 @@ void showMetalinkFile
} // namespace
#endif // ENABLE_METALINK
#if defined ENABLE_BITTORRENT || defined ENABLE_METALINK
#if defined(ENABLE_BITTORRENT) || defined(ENABLE_METALINK)
namespace {
void showFiles
(const std::vector<std::string>& uris, const std::shared_ptr<Option>& op)
@ -221,7 +221,7 @@ Context::Context(bool standalone,
} else {
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) {
showFiles(args, op);
return;

View File

@ -250,7 +250,7 @@ bool File::renameTo(const std::string& dest)
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] = {
{ actime.getTime(), 0 },
{ modtime.getTime(), 0 }

View File

@ -107,7 +107,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
op->setChangeOptionForReserved(true);
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
(PREF_ASYNC_DNS_SERVER,
@ -305,7 +305,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
handlers.push_back(op);
}
#endif // ENABLE_ASYNC_DNS
#if defined HAVE_MMAP || defined __MINGW32__
#if defined(HAVE_MMAP) || defined(__MINGW32__)
{
OptionHandler* op(new BooleanOptionHandler
(PREF_ENABLE_MMAP,
@ -1607,7 +1607,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
handlers.push_back(op);
}
// BitTorrent/Metalink Options
#if defined ENABLE_BITTORRENT || defined ENABLE_METALINK
#if defined(ENABLE_BITTORRENT) || defined(ENABLE_METALINK)
{
OptionHandler* op(new IntegerRangeOptionHandler
(PREF_SELECT_FILE,

View File

@ -161,7 +161,7 @@ std::shared_ptr<RequestGroup> createRequestGroup
}
} // namespace
#if defined ENABLE_BITTORRENT || ENABLE_METALINK
#if defined(ENABLE_BITTORRENT) || defined(ENABLE_METALINK)
namespace {
std::shared_ptr<MetadataInfo> createMetadataInfo
(const std::shared_ptr<GroupId>& gid, const std::string& uri)

View File

@ -74,9 +74,9 @@ void MetalinkEntryTest::testDropUnsupportedResource()
auto entry = createTestEntry();
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());
#elif defined ENABLE_SSL || defined ENABLE_BITTORRENT
#elif defined(ENABLE_SSL) || defined(ENABLE_BITTORRENT)
CPPUNIT_ASSERT_EQUAL((size_t)3, entry->resources.size());
#else
CPPUNIT_ASSERT_EQUAL((size_t)2, entry->resources.size());