瀏覽代碼

Enable IndentPPDirectives

Tatsuhiro Tsujikawa 7 年之前
父節點
當前提交
e0a827ff98
共有 100 個文件被更改,包括 713 次插入712 次删除
  1. 1 1
      .clang-format
  2. 4 4
      src/ARC4Encryptor.h
  3. 2 2
      src/AbstractCommand.cc
  4. 20 20
      src/AbstractDiskWriter.cc
  5. 1 1
      src/AbstractSingleDiskAdaptor.cc
  6. 1 1
      src/AdaptiveFileAllocationIterator.cc
  7. 3 2
      src/Adler32MessageDigestImpl.h
  8. 7 7
      src/AppleTLSContext.cc
  9. 1 1
      src/AppleTLSSession.cc
  10. 9 9
      src/ConsoleStatCalc.cc
  11. 8 8
      src/Context.cc
  12. 1 1
      src/CookieStorage.cc
  13. 4 4
      src/DHKeyExchange.h
  14. 1 1
      src/DHTEntryPointNameResolveCommand.cc
  15. 3 3
      src/DefaultBtProgressInfoFile.cc
  16. 3 3
      src/DefaultPieceStorage.cc
  17. 1 1
      src/DownloadCommand.cc
  18. 2 2
      src/DownloadEngine.cc
  19. 1 1
      src/DownloadEngine.h
  20. 5 5
      src/DownloadEngineFactory.cc
  21. 1 1
      src/EpollEventPoll.h
  22. 1 1
      src/Event.h
  23. 27 27
      src/FeatureConfig.cc
  24. 1 1
      src/File.cc
  25. 8 8
      src/FtpConnection.cc
  26. 2 2
      src/FtpInitiateConnectionCommand.cc
  27. 1 1
      src/FtpTunnelResponseCommand.cc
  28. 1 1
      src/HttpResponse.cc
  29. 1 1
      src/HttpResponseCommand.cc
  30. 1 1
      src/HttpServer.cc
  31. 2 2
      src/HttpServerBodyCommand.cc
  32. 1 1
      src/HttpServerCommand.cc
  33. 2 2
      src/KqueueEventPoll.cc
  34. 1 1
      src/KqueueEventPoll.h
  35. 2 2
      src/LibgnutlsTLSContext.cc
  36. 3 3
      src/LibgnutlsTLSSession.cc
  37. 3 3
      src/LibsslTLSContext.cc
  38. 4 4
      src/LibuvEventPoll.cc
  39. 1 1
      src/LibuvEventPoll.h
  40. 2 2
      src/Lock.h
  41. 1 1
      src/LogFactory.cc
  42. 2 2
      src/Metalink2RequestGroup.cc
  43. 1 1
      src/MetalinkParserController.cc
  44. 1 1
      src/MultiFileAllocationIterator.cc
  45. 7 7
      src/MultiUrlRequestInfo.cc
  46. 1 1
      src/NameResolveCommand.cc
  47. 6 6
      src/OptionHandlerFactory.cc
  48. 7 7
      src/Platform.cc
  49. 1 1
      src/PollEventPoll.h
  50. 2 2
      src/PortEventPoll.h
  51. 1 1
      src/ProtocolDetector.cc
  52. 31 31
      src/RequestGroup.cc
  53. 1 1
      src/RequestGroupMan.cc
  54. 6 6
      src/RpcMethodImpl.cc
  55. 1 1
      src/RpcResponse.cc
  56. 1 1
      src/SelectEventPoll.cc
  57. 1 1
      src/SelectEventPoll.h
  58. 1 1
      src/SessionSerializer.cc
  59. 6 6
      src/SimpleRandomizer.cc
  60. 1 1
      src/SimpleRandomizer.h
  61. 37 37
      src/SocketCore.cc
  62. 1 1
      src/Sqlite3CookieParser.cc
  63. 1 1
      src/UriListParser.cc
  64. 3 3
      src/WatchProcessCommand.cc
  65. 5 5
      src/WinTLSContext.cc
  66. 4 4
      src/WinTLSSession.cc
  67. 2 2
      src/XmlParser.h
  68. 87 87
      src/a2io.h
  69. 34 34
      src/a2netcompat.h
  70. 7 7
      src/a2time.h
  71. 63 63
      src/alloca.c
  72. 1 1
      src/aria2api.cc
  73. 2 2
      src/asctime_r.c
  74. 28 28
      src/common.h
  75. 2 2
      src/console.cc
  76. 16 16
      src/crypto_endian.h
  77. 6 6
      src/crypto_hash.cc
  78. 4 4
      src/download_handlers.cc
  79. 3 3
      src/download_helper.cc
  80. 10 10
      src/gai_strerror.c
  81. 4 4
      src/gai_strerror.h
  82. 31 31
      src/getaddrinfo.c
  83. 68 68
      src/getaddrinfo.h
  84. 3 3
      src/gettimeofday.c
  85. 2 2
      src/gettimeofday.h
  86. 2 2
      src/libgen.c
  87. 2 2
      src/libssl_compat.h
  88. 2 2
      src/localtime_r.c
  89. 1 1
      src/main.cc
  90. 4 4
      src/option_processing.cc
  91. 5 5
      src/strptime.c
  92. 1 1
      src/timegm.h
  93. 17 17
      src/util.cc
  94. 4 4
      src/util.h
  95. 3 3
      test/Aria2ApiTest.cc
  96. 11 11
      test/DefaultBtProgressInfoFileTest.cc
  97. 7 7
      test/DownloadHelperTest.cc
  98. 3 3
      test/Metalink2RequestGroupTest.cc
  99. 4 4
      test/MockPeerStorage.h
  100. 1 1
      test/RpcHelperTest.cc

+ 1 - 1
.clang-format

@@ -68,7 +68,7 @@ IncludeCategories:
     Priority:        1
     Priority:        1
 IncludeIsMainRegex: '$'
 IncludeIsMainRegex: '$'
 IndentCaseLabels: false
 IndentCaseLabels: false
-IndentPPDirectives: None
+IndentPPDirectives: AfterHash
 IndentWidth:     2
 IndentWidth:     2
 IndentWrappedFunctionNames: false
 IndentWrappedFunctionNames: false
 JavaScriptQuotes: Leave
 JavaScriptQuotes: Leave

+ 4 - 4
src/ARC4Encryptor.h

@@ -38,13 +38,13 @@
 #include "common.h"
 #include "common.h"
 
 
 #ifdef USE_INTERNAL_ARC4
 #ifdef USE_INTERNAL_ARC4
-#include "InternalARC4Encryptor.h"
+#  include "InternalARC4Encryptor.h"
 #elif HAVE_LIBNETTLE
 #elif HAVE_LIBNETTLE
-#include "LibnettleARC4Encryptor.h"
+#  include "LibnettleARC4Encryptor.h"
 #elif HAVE_LIBGCRYPT
 #elif HAVE_LIBGCRYPT
-#include "LibgcryptARC4Encryptor.h"
+#  include "LibgcryptARC4Encryptor.h"
 #elif HAVE_OPENSSL
 #elif HAVE_OPENSSL
-#include "LibsslARC4Encryptor.h"
+#  include "LibsslARC4Encryptor.h"
 #endif
 #endif
 
 
 #endif // D_ARC4_ENCRYPTOR_H
 #endif // D_ARC4_ENCRYPTOR_H

+ 2 - 2
src/AbstractCommand.cc

@@ -68,8 +68,8 @@
 #include "SocketRecvBuffer.h"
 #include "SocketRecvBuffer.h"
 #include "ChecksumCheckIntegrityEntry.h"
 #include "ChecksumCheckIntegrityEntry.h"
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolver.h"
-#include "AsyncNameResolverMan.h"
+#  include "AsyncNameResolver.h"
+#  include "AsyncNameResolverMan.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 20 - 20
src/AbstractDiskWriter.cc

@@ -36,7 +36,7 @@
 
 
 #include <unistd.h>
 #include <unistd.h>
 #ifdef HAVE_MMAP
 #ifdef HAVE_MMAP
-#include <sys/mman.h>
+#  include <sys/mman.h>
 #endif // HAVE_MMAP
 #endif // HAVE_MMAP
 #include <fcntl.h>
 #include <fcntl.h>
 
 
@@ -133,17 +133,17 @@ 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__
     if (!UnmapViewOfFile(mapaddr_)) {
     if (!UnmapViewOfFile(mapaddr_)) {
       errNum = GetLastError();
       errNum = GetLastError();
     }
     }
     CloseHandle(mapView_);
     CloseHandle(mapView_);
     mapView_ = INVALID_HANDLE_VALUE;
     mapView_ = INVALID_HANDLE_VALUE;
-#else  // !__MINGW32__
+#  else  // !__MINGW32__
     if (munmap(mapaddr_, maplen_) == -1) {
     if (munmap(mapaddr_, maplen_) == -1) {
       errNum = errno;
       errNum = errno;
     }
     }
-#endif // !__MINGW32__
+#  endif // !__MINGW32__
     if (errNum != 0) {
     if (errNum != 0) {
       int errNum = fileError();
       int errNum = fileError();
       A2_LOG_ERROR(fmt("Unmapping file %s failed: %s", filename_.c_str(),
       A2_LOG_ERROR(fmt("Unmapping file %s failed: %s", filename_.c_str(),
@@ -224,13 +224,13 @@ int openFileWithFlags(const std::string& filename, int flags,
         errCode);
         errCode);
   }
   }
   util::make_fd_cloexec(fd);
   util::make_fd_cloexec(fd);
-#if defined(__APPLE__) && defined(__MACH__)
+#  if defined(__APPLE__) && defined(__MACH__)
   // This may reduce memory consumption on Mac OS X.
   // This may reduce memory consumption on Mac OS X.
   fcntl(fd, F_NOCACHE, 1);
   fcntl(fd, F_NOCACHE, 1);
-#endif // __APPLE__ && __MACH__
+#  endif // __APPLE__ && __MACH__
   return fd;
   return fd;
 }
 }
-#endif // !__MINGW32__
+#endif   // !__MINGW32__
 } // namespace
 } // namespace
 
 
 void AbstractDiskWriter::openExistingFile(int64_t totalLength)
 void AbstractDiskWriter::openExistingFile(int64_t totalLength)
@@ -345,17 +345,17 @@ void AbstractDiskWriter::ensureMmapWrite(size_t len, int64_t offset)
     if (mapaddr_) {
     if (mapaddr_) {
       if (static_cast<int64_t>(len + offset) > maplen_) {
       if (static_cast<int64_t>(len + offset) > maplen_) {
         int errNum = 0;
         int errNum = 0;
-#ifdef __MINGW32__
+#  ifdef __MINGW32__
         if (!UnmapViewOfFile(mapaddr_)) {
         if (!UnmapViewOfFile(mapaddr_)) {
           errNum = GetLastError();
           errNum = GetLastError();
         }
         }
         CloseHandle(mapView_);
         CloseHandle(mapView_);
         mapView_ = INVALID_HANDLE_VALUE;
         mapView_ = INVALID_HANDLE_VALUE;
-#else  // !__MINGW32__
+#  else  // !__MINGW32__
         if (munmap(mapaddr_, maplen_) == -1) {
         if (munmap(mapaddr_, maplen_) == -1) {
           errNum = errno;
           errNum = errno;
         }
         }
-#endif // !__MINGW32__
+#  endif // !__MINGW32__
         if (errNum != 0) {
         if (errNum != 0) {
           A2_LOG_ERROR(fmt("Unmapping file %s failed: %s", filename_.c_str(),
           A2_LOG_ERROR(fmt("Unmapping file %s failed: %s", filename_.c_str(),
                            fileStrerror(errNum).c_str()));
                            fileStrerror(errNum).c_str()));
@@ -385,7 +385,7 @@ void AbstractDiskWriter::ensureMmapWrite(size_t len, int64_t offset)
 
 
       int errNum = 0;
       int errNum = 0;
       if (static_cast<int64_t>(len + offset) <= filesize) {
       if (static_cast<int64_t>(len + offset) <= filesize) {
-#ifdef __MINGW32__
+#  ifdef __MINGW32__
         mapView_ = CreateFileMapping(fd_, 0, PAGE_READWRITE, filesize >> 32,
         mapView_ = CreateFileMapping(fd_, 0, PAGE_READWRITE, filesize >> 32,
                                      filesize & 0xffffffffu, 0);
                                      filesize & 0xffffffffu, 0);
         if (mapView_) {
         if (mapView_) {
@@ -400,7 +400,7 @@ void AbstractDiskWriter::ensureMmapWrite(size_t len, int64_t offset)
         else {
         else {
           errNum = GetLastError();
           errNum = GetLastError();
         }
         }
-#else  // !__MINGW32__
+#  else  // !__MINGW32__
         auto pa =
         auto pa =
             mmap(nullptr, filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0);
             mmap(nullptr, filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0);
 
 
@@ -410,7 +410,7 @@ void AbstractDiskWriter::ensureMmapWrite(size_t len, int64_t offset)
         else {
         else {
           mapaddr_ = reinterpret_cast<unsigned char*>(pa);
           mapaddr_ = reinterpret_cast<unsigned char*>(pa);
         }
         }
-#endif // !__MINGW32__
+#  endif // !__MINGW32__
         if (mapaddr_) {
         if (mapaddr_) {
           A2_LOG_DEBUG(fmt("Mapping file %s succeeded, length=%" PRId64 "",
           A2_LOG_DEBUG(fmt("Mapping file %s succeeded, length=%" PRId64 "",
                            filename_.c_str(), static_cast<uint64_t>(filesize)));
                            filename_.c_str(), static_cast<uint64_t>(filesize)));
@@ -517,7 +517,7 @@ void AbstractDiskWriter::allocate(int64_t offset, int64_t length, bool sparse)
     return;
     return;
   }
   }
 #ifdef HAVE_SOME_FALLOCATE
 #ifdef HAVE_SOME_FALLOCATE
-#ifdef __MINGW32__
+#  ifdef __MINGW32__
   truncate(offset + length);
   truncate(offset + length);
   if (!SetFileValidData(fd_, offset + length)) {
   if (!SetFileValidData(fd_, offset + length)) {
     auto errNum = fileError();
     auto errNum = fileError();
@@ -528,7 +528,7 @@ void AbstractDiskWriter::allocate(int64_t offset, int64_t length, bool sparse)
         "(see --file-allocation).",
         "(see --file-allocation).",
         fileStrerror(errNum).c_str()));
         fileStrerror(errNum).c_str()));
   }
   }
-#elif defined(__APPLE__) && defined(__MACH__)
+#  elif defined(__APPLE__) && defined(__MACH__)
   const auto toalloc = offset + length - size();
   const auto toalloc = offset + length - size();
   fstore_t fstore = {F_ALLOCATECONTIG | F_ALLOCATEALL, F_PEOFPOSMODE, 0,
   fstore_t fstore = {F_ALLOCATECONTIG | F_ALLOCATEALL, F_PEOFPOSMODE, 0,
                      toalloc, 0};
                      toalloc, 0};
@@ -546,7 +546,7 @@ void AbstractDiskWriter::allocate(int64_t offset, int64_t length, bool sparse)
   }
   }
   // This forces the allocation on disk.
   // This forces the allocation on disk.
   ftruncate(fd_, offset + length);
   ftruncate(fd_, offset + length);
-#elif HAVE_FALLOCATE
+#  elif HAVE_FALLOCATE
   // For linux, we use fallocate to detect file system supports
   // For linux, we use fallocate to detect file system supports
   // fallocate or not.
   // fallocate or not.
   int r;
   int r;
@@ -560,7 +560,7 @@ void AbstractDiskWriter::allocate(int64_t offset, int64_t length, bool sparse)
         isDiskFullError(errNum) ? error_code::NOT_ENOUGH_DISK_SPACE
         isDiskFullError(errNum) ? error_code::NOT_ENOUGH_DISK_SPACE
                                 : error_code::FILE_IO_ERROR);
                                 : error_code::FILE_IO_ERROR);
   }
   }
-#elif HAVE_POSIX_FALLOCATE
+#  elif HAVE_POSIX_FALLOCATE
   int r = posix_fallocate(fd_, offset, length);
   int r = posix_fallocate(fd_, offset, length);
   if (r != 0) {
   if (r != 0) {
     throw DL_ABORT_EX3(
     throw DL_ABORT_EX3(
@@ -569,9 +569,9 @@ void AbstractDiskWriter::allocate(int64_t offset, int64_t length, bool sparse)
         isDiskFullError(r) ? error_code::NOT_ENOUGH_DISK_SPACE
         isDiskFullError(r) ? error_code::NOT_ENOUGH_DISK_SPACE
                            : error_code::FILE_IO_ERROR);
                            : error_code::FILE_IO_ERROR);
   }
   }
-#else
-#error "no *_fallocate function available."
-#endif
+#  else
+#    error "no *_fallocate function available."
+#  endif
 #endif // HAVE_SOME_FALLOCATE
 #endif // HAVE_SOME_FALLOCATE
 }
 }
 
 

+ 1 - 1
src/AbstractSingleDiskAdaptor.cc

@@ -41,7 +41,7 @@
 #include "WrDiskCacheEntry.h"
 #include "WrDiskCacheEntry.h"
 #include "LogFactory.h"
 #include "LogFactory.h"
 #ifdef HAVE_SOME_FALLOCATE
 #ifdef HAVE_SOME_FALLOCATE
-#include "FallocFileAllocationIterator.h"
+#  include "FallocFileAllocationIterator.h"
 #endif // HAVE_SOME_FALLOCATE
 #endif // HAVE_SOME_FALLOCATE
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/AdaptiveFileAllocationIterator.cc

@@ -40,7 +40,7 @@
 #include "Logger.h"
 #include "Logger.h"
 #include "a2functional.h"
 #include "a2functional.h"
 #ifdef HAVE_FALLOCATE
 #ifdef HAVE_FALLOCATE
-#include "FallocFileAllocationIterator.h"
+#  include "FallocFileAllocationIterator.h"
 #endif // HAVE_FALLOCATE
 #endif // HAVE_FALLOCATE
 
 
 namespace aria2 {
 namespace aria2 {

+ 3 - 2
src/Adler32MessageDigestImpl.h

@@ -41,7 +41,8 @@ namespace aria2 {
 
 
 #ifdef HAVE_ZLIB
 #ifdef HAVE_ZLIB
 
 
-#define ADLER32_MESSAGE_DIGEST {"adler32", make_hi<Adler32MessageDigestImpl>()},
+#  define ADLER32_MESSAGE_DIGEST                                               \
+    {"adler32", make_hi<Adler32MessageDigestImpl>()},
 
 
 class Adler32MessageDigestImpl : public MessageDigestImpl {
 class Adler32MessageDigestImpl : public MessageDigestImpl {
 public:
 public:
@@ -58,7 +59,7 @@ private:
 
 
 #else // !HAVE_ZLIB
 #else // !HAVE_ZLIB
 
 
-#define ADLER32_MESSAGE_DIGEST
+#  define ADLER32_MESSAGE_DIGEST
 
 
 #endif // !HAVE_ZLIB
 #endif // !HAVE_ZLIB
 
 

+ 7 - 7
src/AppleTLSContext.cc

@@ -39,7 +39,7 @@
 #include <sstream>
 #include <sstream>
 
 
 #ifdef __MAC_10_6
 #ifdef __MAC_10_6
-#include <Security/SecImportExport.h>
+#  include <Security/SecImportExport.h>
 #endif
 #endif
 
 
 #include "LogFactory.h"
 #include "LogFactory.h"
@@ -55,10 +55,10 @@ using namespace aria2;
 
 
 #if defined(__MAC_10_6)
 #if defined(__MAC_10_6)
 
 
-#if defined(__MAC_10_7)
+#  if defined(__MAC_10_7)
 static const void* query_keys[] = {kSecClass, kSecReturnRef, kSecMatchPolicy,
 static const void* query_keys[] = {kSecClass, kSecReturnRef, kSecMatchPolicy,
                                    kSecMatchLimit};
                                    kSecMatchLimit};
-#endif // defined(__MAC_10_7)
+#  endif // defined(__MAC_10_7)
 
 
 template <typename T> class CFRef {
 template <typename T> class CFRef {
   T ref_;
   T ref_;
@@ -278,7 +278,7 @@ bool AppleTLSContext::tryAsFingerprint(const std::string& fingerprint)
   return false;
   return false;
 
 
 #else // defined(__MAC_10_7)
 #else // defined(__MAC_10_7)
-#if defined(__MAC_10_6)
+#  if defined(__MAC_10_6)
 
 
   CFRef<SecIdentitySearchRef> search;
   CFRef<SecIdentitySearchRef> search;
   SecIdentitySearchRef raw_search;
   SecIdentitySearchRef raw_search;
@@ -304,14 +304,14 @@ bool AppleTLSContext::tryAsFingerprint(const std::string& fingerprint)
       fmt("Failed to lookup %s in your KeyChain", fingerprint.c_str()));
       fmt("Failed to lookup %s in your KeyChain", fingerprint.c_str()));
   return false;
   return false;
 
 
-#else // defined(__MAC_10_6)
+#  else // defined(__MAC_10_6)
 
 
   A2_LOG_ERROR("Your system does not support creditials via fingerprints; "
   A2_LOG_ERROR("Your system does not support creditials via fingerprints; "
                "Upgrade to OSX 10.6 or later");
                "Upgrade to OSX 10.6 or later");
   return false;
   return false;
 
 
-#endif // defined(__MAC_10_6)
-#endif // defined(__MAC_10_7)
+#  endif // defined(__MAC_10_6)
+#endif   // defined(__MAC_10_7)
 }
 }
 
 
 bool AppleTLSContext::tryAsPKCS12(const std::string& certfile)
 bool AppleTLSContext::tryAsPKCS12(const std::string& certfile)

+ 1 - 1
src/AppleTLSSession.cc

@@ -48,7 +48,7 @@
 #define paramErr -50
 #define paramErr -50
 
 
 #ifndef errSSLServerAuthCompleted
 #ifndef errSSLServerAuthCompleted
-#define errSSLServerAuthCompleted -9841
+#  define errSSLServerAuthCompleted -9841
 #endif
 #endif
 
 
 namespace {
 namespace {

+ 9 - 9
src/ConsoleStatCalc.cc

@@ -35,10 +35,10 @@
 #include "ConsoleStatCalc.h"
 #include "ConsoleStatCalc.h"
 
 
 #ifdef HAVE_TERMIOS_H
 #ifdef HAVE_TERMIOS_H
-#include <termios.h>
+#  include <termios.h>
 #endif // HAVE_TERMIOS_H
 #endif // HAVE_TERMIOS_H
 #ifdef HAVE_SYS_IOCTL_H
 #ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
+#  include <sys/ioctl.h>
 #endif // HAVE_SYS_IOCTL_H
 #endif // HAVE_SYS_IOCTL_H
 #include <unistd.h>
 #include <unistd.h>
 
 
@@ -66,9 +66,9 @@
 #include "Option.h"
 #include "Option.h"
 
 
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
-#include "PeerStorage.h"
-#include "BtRegistry.h"
+#  include "bittorrent_helper.h"
+#  include "PeerStorage.h"
+#  include "BtRegistry.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {
@@ -302,19 +302,19 @@ void ConsoleStatCalc::calculateStat(const DownloadEngine* e)
 
 
   if (isTTY_) {
   if (isTTY_) {
 #ifndef __MINGW32__
 #ifndef __MINGW32__
-#ifdef HAVE_TERMIOS_H
+#  ifdef HAVE_TERMIOS_H
     struct winsize size;
     struct winsize size;
     if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &size) == 0) {
     if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &size) == 0) {
       cols = std::max(0, (int)size.ws_col - 1);
       cols = std::max(0, (int)size.ws_col - 1);
     }
     }
-#endif // HAVE_TERMIOS_H
-#else  // __MINGW32__
+#  endif // HAVE_TERMIOS_H
+#else    // __MINGW32__
     CONSOLE_SCREEN_BUFFER_INFO info;
     CONSOLE_SCREEN_BUFFER_INFO info;
     if (::GetConsoleScreenBufferInfo(::GetStdHandle(STD_OUTPUT_HANDLE),
     if (::GetConsoleScreenBufferInfo(::GetStdHandle(STD_OUTPUT_HANDLE),
                                      &info)) {
                                      &info)) {
       cols = std::max(0, info.dwSize.X - 2);
       cols = std::max(0, info.dwSize.X - 2);
     }
     }
-#endif // !__MINGW32__
+#endif   // !__MINGW32__
     std::string line(cols, ' ');
     std::string line(cols, ' ');
     global::cout()->printf("\r%s\r", line.c_str());
     global::cout()->printf("\r%s\r", line.c_str());
   }
   }

+ 8 - 8
src/Context.cc

@@ -38,7 +38,7 @@
 #include <getopt.h>
 #include <getopt.h>
 
 
 #ifdef HAVE_SYS_RESOURCE_H
 #ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
+#  include <sys/resource.h>
 #endif // HAVE_SYS_RESOURCE_H
 #endif // HAVE_SYS_RESOURCE_H
 
 
 #include <numeric>
 #include <numeric>
@@ -72,11 +72,11 @@
 #include "UriListParser.h"
 #include "UriListParser.h"
 #include "message_digest_helper.h"
 #include "message_digest_helper.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
+#  include "bittorrent_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 #ifdef ENABLE_METALINK
 #ifdef ENABLE_METALINK
-#include "metalink_helper.h"
-#include "MetalinkEntry.h"
+#  include "metalink_helper.h"
+#  include "MetalinkEntry.h"
 #endif // ENABLE_METALINK
 #endif // ENABLE_METALINK
 
 
 extern char* optarg;
 extern char* optarg;
@@ -121,18 +121,18 @@ void showFiles(const std::vector<std::string>& uris,
     printf(MSG_SHOW_FILES, (uri).c_str());
     printf(MSG_SHOW_FILES, (uri).c_str());
     printf("\n");
     printf("\n");
     try {
     try {
-#ifdef ENABLE_BITTORRENT
+#  ifdef ENABLE_BITTORRENT
       if (dt.guessTorrentFile(uri)) {
       if (dt.guessTorrentFile(uri)) {
         showTorrentFile(uri);
         showTorrentFile(uri);
       }
       }
       else
       else
-#endif // ENABLE_BITTORRENT
-#ifdef ENABLE_METALINK
+#  endif // ENABLE_BITTORRENT
+#  ifdef ENABLE_METALINK
           if (dt.guessMetalinkFile(uri)) {
           if (dt.guessMetalinkFile(uri)) {
         showMetalinkFile(uri, op);
         showMetalinkFile(uri, op);
       }
       }
       else
       else
-#endif // ENABLE_METALINK
+#  endif // ENABLE_METALINK
       {
       {
         printf("%s\n\n", MSG_NOT_TORRENT_METALINK);
         printf("%s\n\n", MSG_NOT_TORRENT_METALINK);
       }
       }

+ 1 - 1
src/CookieStorage.cc

@@ -51,7 +51,7 @@
 #include "cookie_helper.h"
 #include "cookie_helper.h"
 #include "BufferedFile.h"
 #include "BufferedFile.h"
 #ifdef HAVE_SQLITE3
 #ifdef HAVE_SQLITE3
-#include "Sqlite3CookieParserImpl.h"
+#  include "Sqlite3CookieParserImpl.h"
 #endif // HAVE_SQLITE3
 #endif // HAVE_SQLITE3
 
 
 namespace aria2 {
 namespace aria2 {

+ 4 - 4
src/DHKeyExchange.h

@@ -37,13 +37,13 @@
 
 
 #include "common.h"
 #include "common.h"
 #ifdef USE_INTERNAL_BIGNUM
 #ifdef USE_INTERNAL_BIGNUM
-#include "InternalDHKeyExchange.h"
+#  include "InternalDHKeyExchange.h"
 #elif HAVE_LIBGMP
 #elif HAVE_LIBGMP
-#include "LibgmpDHKeyExchange.h"
+#  include "LibgmpDHKeyExchange.h"
 #elif HAVE_LIBGCRYPT
 #elif HAVE_LIBGCRYPT
-#include "LibgcryptDHKeyExchange.h"
+#  include "LibgcryptDHKeyExchange.h"
 #elif HAVE_OPENSSL
 #elif HAVE_OPENSSL
-#include "LibsslDHKeyExchange.h"
+#  include "LibsslDHKeyExchange.h"
 #endif // HAVE_OPENSSL
 #endif // HAVE_OPENSSL
 
 
 #endif // D_DH_KEY_EXCHANGE_H
 #endif // D_DH_KEY_EXCHANGE_H

+ 1 - 1
src/DHTEntryPointNameResolveCommand.cc

@@ -51,7 +51,7 @@
 #include "fmt.h"
 #include "fmt.h"
 #include "SocketCore.h"
 #include "SocketCore.h"
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolverMan.h"
+#  include "AsyncNameResolverMan.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 3 - 3
src/DefaultBtProgressInfoFile.cc

@@ -57,9 +57,9 @@
 #include "BufferedFile.h"
 #include "BufferedFile.h"
 #include "SHA1IOFile.h"
 #include "SHA1IOFile.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "PeerStorage.h"
-#include "BtRuntime.h"
-#include "bittorrent_helper.h"
+#  include "PeerStorage.h"
+#  include "BtRuntime.h"
+#  include "bittorrent_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {

+ 3 - 3
src/DefaultPieceStorage.cc

@@ -70,7 +70,7 @@
 #include "RequestGroup.h"
 #include "RequestGroup.h"
 #include "SimpleRandomizer.h"
 #include "SimpleRandomizer.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
+#  include "bittorrent_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {
@@ -485,7 +485,7 @@ void DefaultPieceStorage::completePiece(const std::shared_ptr<Piece>& piece)
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
     if (downloadContext_->hasAttribute(CTX_ATTR_BT)) {
     if (downloadContext_->hasAttribute(CTX_ATTR_BT)) {
       if (!bittorrent::getTorrentAttrs(downloadContext_)->metadata.empty()) {
       if (!bittorrent::getTorrentAttrs(downloadContext_)->metadata.empty()) {
-#ifdef __MINGW32__
+#  ifdef __MINGW32__
         // On Windows, if aria2 opens files with GENERIC_WRITE access
         // On Windows, if aria2 opens files with GENERIC_WRITE access
         // right, some programs cannot open them aria2 is seeding. To
         // right, some programs cannot open them aria2 is seeding. To
         // avoid this situation, re-open the files with read-only
         // avoid this situation, re-open the files with read-only
@@ -495,7 +495,7 @@ void DefaultPieceStorage::completePiece(const std::shared_ptr<Piece>& piece)
         diskAdaptor_->closeFile();
         diskAdaptor_->closeFile();
         diskAdaptor_->enableReadOnly();
         diskAdaptor_->enableReadOnly();
         diskAdaptor_->openFile();
         diskAdaptor_->openFile();
-#endif // __MINGW32__
+#  endif // __MINGW32__
         auto group = downloadContext_->getOwnerRequestGroup();
         auto group = downloadContext_->getOwnerRequestGroup();
 
 
         util::executeHookByOptName(group, option_,
         util::executeHookByOptName(group, option_,

+ 1 - 1
src/DownloadCommand.cc

@@ -68,7 +68,7 @@
 #include "MessageDigest.h"
 #include "MessageDigest.h"
 #include "message_digest_helper.h"
 #include "message_digest_helper.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
+#  include "bittorrent_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {

+ 2 - 2
src/DownloadEngine.cc

@@ -68,10 +68,10 @@
 #include "fmt.h"
 #include "fmt.h"
 #include "wallclock.h"
 #include "wallclock.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "BtRegistry.h"
+#  include "BtRegistry.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 #ifdef ENABLE_WEBSOCKET
 #ifdef ENABLE_WEBSOCKET
-#include "WebSocketSessionMan.h"
+#  include "WebSocketSessionMan.h"
 #endif // ENABLE_WEBSOCKET
 #endif // ENABLE_WEBSOCKET
 #include "Option.h"
 #include "Option.h"
 #include "util_security.h"
 #include "util_security.h"

+ 1 - 1
src/DownloadEngine.h

@@ -51,7 +51,7 @@
 #include "CheckIntegrityMan.h"
 #include "CheckIntegrityMan.h"
 #include "DNSCache.h"
 #include "DNSCache.h"
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolver.h"
+#  include "AsyncNameResolver.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 5 - 5
src/DownloadEngineFactory.cc

@@ -59,19 +59,19 @@
 #include "array_fun.h"
 #include "array_fun.h"
 #include "EvictSocketPoolCommand.h"
 #include "EvictSocketPoolCommand.h"
 #ifdef HAVE_LIBUV
 #ifdef HAVE_LIBUV
-#include "LibuvEventPoll.h"
+#  include "LibuvEventPoll.h"
 #endif // HAVE_LIBUV
 #endif // HAVE_LIBUV
 #ifdef HAVE_EPOLL
 #ifdef HAVE_EPOLL
-#include "EpollEventPoll.h"
+#  include "EpollEventPoll.h"
 #endif // HAVE_EPOLL
 #endif // HAVE_EPOLL
 #ifdef HAVE_PORT_ASSOCIATE
 #ifdef HAVE_PORT_ASSOCIATE
-#include "PortEventPoll.h"
+#  include "PortEventPoll.h"
 #endif // HAVE_PORT_ASSOCIATE
 #endif // HAVE_PORT_ASSOCIATE
 #ifdef HAVE_KQUEUE
 #ifdef HAVE_KQUEUE
-#include "KqueueEventPoll.h"
+#  include "KqueueEventPoll.h"
 #endif // HAVE_KQUEUE
 #endif // HAVE_KQUEUE
 #ifdef HAVE_POLL
 #ifdef HAVE_POLL
-#include "PollEventPoll.h"
+#  include "PollEventPoll.h"
 #endif // HAVE_POLL
 #endif // HAVE_POLL
 #include "SelectEventPoll.h"
 #include "SelectEventPoll.h"
 #include "DlAbortEx.h"
 #include "DlAbortEx.h"

+ 1 - 1
src/EpollEventPoll.h

@@ -44,7 +44,7 @@
 #include "Event.h"
 #include "Event.h"
 #include "a2functional.h"
 #include "a2functional.h"
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolver.h"
+#  include "AsyncNameResolver.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/Event.h

@@ -45,7 +45,7 @@
 #include "a2netcompat.h"
 #include "a2netcompat.h"
 #include "Command.h"
 #include "Command.h"
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolver.h"
+#  include "AsyncNameResolver.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 27 - 27
src/FeatureConfig.cc

@@ -38,37 +38,37 @@
 #include <cstring>
 #include <cstring>
 
 
 #ifdef HAVE_ZLIB
 #ifdef HAVE_ZLIB
-#include <zlib.h>
+#  include <zlib.h>
 #endif // HAVE_ZLIB
 #endif // HAVE_ZLIB
 #ifdef HAVE_LIBXML2
 #ifdef HAVE_LIBXML2
-#include <libxml/xmlversion.h>
+#  include <libxml/xmlversion.h>
 #endif // HAVE_LIBXML2
 #endif // HAVE_LIBXML2
 #ifdef HAVE_LIBEXPAT
 #ifdef HAVE_LIBEXPAT
-#include <expat.h>
+#  include <expat.h>
 #endif // HAVE_LIBEXPAT
 #endif // HAVE_LIBEXPAT
 #ifdef HAVE_SQLITE3
 #ifdef HAVE_SQLITE3
-#include <sqlite3.h>
+#  include <sqlite3.h>
 #endif // HAVE_SQLITE3
 #endif // HAVE_SQLITE3
 #ifdef HAVE_LIBGNUTLS
 #ifdef HAVE_LIBGNUTLS
-#include <gnutls/gnutls.h>
+#  include <gnutls/gnutls.h>
 #endif // HAVE_LIBGNUTLS
 #endif // HAVE_LIBGNUTLS
 #ifdef HAVE_OPENSSL
 #ifdef HAVE_OPENSSL
-#include <openssl/opensslv.h>
+#  include <openssl/opensslv.h>
 #endif // HAVE_OPENSSL
 #endif // HAVE_OPENSSL
 #ifdef HAVE_LIBGMP
 #ifdef HAVE_LIBGMP
-#include <gmp.h>
+#  include <gmp.h>
 #endif // HAVE_LIBGMP
 #endif // HAVE_LIBGMP
 #ifdef HAVE_LIBGCRYPT
 #ifdef HAVE_LIBGCRYPT
-#include <gcrypt.h>
+#  include <gcrypt.h>
 #endif // HAVE_LIBGCRYPT
 #endif // HAVE_LIBGCRYPT
 #ifdef HAVE_LIBCARES
 #ifdef HAVE_LIBCARES
-#include <ares.h>
+#  include <ares.h>
 #endif // HAVE_LIBCARES
 #endif // HAVE_LIBCARES
 #ifdef HAVE_SYS_UTSNAME_H
 #ifdef HAVE_SYS_UTSNAME_H
-#include <sys/utsname.h>
+#  include <sys/utsname.h>
 #endif // HAVE_SYS_UTSNAME_H
 #endif // HAVE_SYS_UTSNAME_H
 #ifdef HAVE_LIBSSH2
 #ifdef HAVE_LIBSSH2
-#include <libssh2.h>
+#  include <libssh2.h>
 #endif // HAVE_LIBSSH2
 #endif // HAVE_LIBSSH2
 #include "util.h"
 #include "util.h"
 
 
@@ -252,11 +252,11 @@ std::string usedCompilerAndPlatform()
   std::stringstream rv;
   std::stringstream rv;
 #if defined(__clang_version__)
 #if defined(__clang_version__)
 
 
-#ifdef __apple_build_version__
+#  ifdef __apple_build_version__
   rv << "Apple LLVM ";
   rv << "Apple LLVM ";
-#else  // !__apple_build_version__
+#  else  // !__apple_build_version__
   rv << "clang ";
   rv << "clang ";
-#endif // !__apple_build_version__
+#  endif // !__apple_build_version__
   rv << __clang_version__;
   rv << __clang_version__;
 
 
 #elif defined(__INTEL_COMPILER)
 #elif defined(__INTEL_COMPILER)
@@ -266,23 +266,23 @@ std::string usedCompilerAndPlatform()
 #elif defined(__MINGW64_VERSION_STR)
 #elif defined(__MINGW64_VERSION_STR)
 
 
   rv << "mingw-w64 " << __MINGW64_VERSION_STR;
   rv << "mingw-w64 " << __MINGW64_VERSION_STR;
-#ifdef __MINGW64_VERSION_STATE
+#  ifdef __MINGW64_VERSION_STATE
   rv << " (" << __MINGW64_VERSION_STATE << ")";
   rv << " (" << __MINGW64_VERSION_STATE << ")";
-#endif // __MINGW64_VERSION_STATE
+#  endif // __MINGW64_VERSION_STATE
   rv << " / gcc " << __VERSION__;
   rv << " / gcc " << __VERSION__;
 
 
 #elif defined(__GNUG__)
 #elif defined(__GNUG__)
 
 
-#ifdef __MINGW32__
+#  ifdef __MINGW32__
   rv << "mingw ";
   rv << "mingw ";
-#ifdef __MINGW32_MAJOR_VERSION
+#    ifdef __MINGW32_MAJOR_VERSION
   rv << (int)__MINGW32_MAJOR_VERSION;
   rv << (int)__MINGW32_MAJOR_VERSION;
-#endif // __MINGW32_MAJOR_VERSION
-#ifdef __MINGW32_MINOR_VERSION
+#    endif // __MINGW32_MAJOR_VERSION
+#    ifdef __MINGW32_MINOR_VERSION
   rv << "." << (int)__MINGW32_MINOR_VERSION;
   rv << "." << (int)__MINGW32_MINOR_VERSION;
-#endif // __MINGW32_MINOR_VERSION
+#    endif // __MINGW32_MINOR_VERSION
   rv << " / ";
   rv << " / ";
-#endif // __MINGW32__
+#  endif   // __MINGW32__
   rv << "gcc " << __VERSION__;
   rv << "gcc " << __VERSION__;
 
 
 #else // !defined(__GNUG__)
 #else // !defined(__GNUG__)
@@ -348,13 +348,13 @@ std::string getOperatingSystemInfo()
   if (ovi.szCSDVersion[0]) {
   if (ovi.szCSDVersion[0]) {
     rv << " (" << ovi.szCSDVersion << ")";
     rv << " (" << ovi.szCSDVersion << ")";
   }
   }
-#ifdef _WIN64
+#  ifdef _WIN64
   rv << " (x86_64)";
   rv << " (x86_64)";
-#endif // _WIN64
+#  endif // _WIN64
   rv << " (" << ovi.dwMajorVersion << "." << ovi.dwMinorVersion << ")";
   rv << " (" << ovi.dwMajorVersion << "." << ovi.dwMinorVersion << ")";
   return rv.str();
   return rv.str();
 #else //! _WIN32
 #else //! _WIN32
-#ifdef HAVE_SYS_UTSNAME_H
+#  ifdef HAVE_SYS_UTSNAME_H
   struct utsname name;
   struct utsname name;
   if (!uname(&name)) {
   if (!uname(&name)) {
     if (!strstr(name.version, name.sysname) ||
     if (!strstr(name.version, name.sysname) ||
@@ -367,9 +367,9 @@ std::string getOperatingSystemInfo()
     }
     }
     return name.version;
     return name.version;
   }
   }
-#endif // HAVE_SYS_UTSNAME_H
+#  endif // HAVE_SYS_UTSNAME_H
   return "Unknown system";
   return "Unknown system";
-#endif // !_WIN32
+#endif   // !_WIN32
 }
 }
 
 
 } // namespace aria2
 } // namespace aria2

+ 1 - 1
src/File.cc

@@ -37,7 +37,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #ifdef HAVE_UTIME_H
 #ifdef HAVE_UTIME_H
-#include <utime.h>
+#  include <utime.h>
 #endif // HAVE_UTIME_H
 #endif // HAVE_UTIME_H
 #include <unistd.h>
 #include <unistd.h>
 
 

+ 8 - 8
src/FtpConnection.cc

@@ -369,16 +369,16 @@ int FtpConnection::receiveResponse()
 }
 }
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#define LONGLONG_PRINTF "%I64d"
-#define ULONGLONG_PRINTF "%I64u"
-#define LONGLONG_SCANF "%I64d"
-#define ULONGLONG_SCANF "%I64u"
+#  define LONGLONG_PRINTF "%I64d"
+#  define ULONGLONG_PRINTF "%I64u"
+#  define LONGLONG_SCANF "%I64d"
+#  define ULONGLONG_SCANF "%I64u"
 #else
 #else
-#define LONGLONG_PRINTF "%" PRId64 ""
-#define ULONGLONG_PRINTF "%llu"
-#define LONGLONG_SCANF "%Ld"
+#  define LONGLONG_PRINTF "%" PRId64 ""
+#  define ULONGLONG_PRINTF "%llu"
+#  define LONGLONG_SCANF "%Ld"
 // Mac OSX uses "%llu" for 64bits integer.
 // Mac OSX uses "%llu" for 64bits integer.
-#define ULONGLONG_SCANF "%Lu"
+#  define ULONGLONG_SCANF "%Lu"
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 int FtpConnection::receiveSizeResponse(int64_t& size)
 int FtpConnection::receiveSizeResponse(int64_t& size)

+ 2 - 2
src/FtpInitiateConnectionCommand.cc

@@ -61,8 +61,8 @@
 #include "FtpTunnelRequestConnectChain.h"
 #include "FtpTunnelRequestConnectChain.h"
 #include "HttpRequestConnectChain.h"
 #include "HttpRequestConnectChain.h"
 #ifdef HAVE_LIBSSH2
 #ifdef HAVE_LIBSSH2
-#include "SftpNegotiationConnectChain.h"
-#include "SftpNegotiationCommand.h"
+#  include "SftpNegotiationConnectChain.h"
+#  include "SftpNegotiationCommand.h"
 #endif // HAVE_LIBSSH2
 #endif // HAVE_LIBSSH2
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/FtpTunnelResponseCommand.cc

@@ -41,7 +41,7 @@
 #include "SocketCore.h"
 #include "SocketCore.h"
 #include "SocketRecvBuffer.h"
 #include "SocketRecvBuffer.h"
 #ifdef HAVE_LIBSSH2
 #ifdef HAVE_LIBSSH2
-#include "SftpNegotiationCommand.h"
+#  include "SftpNegotiationCommand.h"
 #endif // HAVE_LIBSSH2
 #endif // HAVE_LIBSSH2
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/HttpResponse.cc

@@ -61,7 +61,7 @@
 #include "array_fun.h"
 #include "array_fun.h"
 #include "MessageDigest.h"
 #include "MessageDigest.h"
 #ifdef HAVE_ZLIB
 #ifdef HAVE_ZLIB
-#include "GZipDecodingStreamFilter.h"
+#  include "GZipDecodingStreamFilter.h"
 #endif // HAVE_ZLIB
 #endif // HAVE_ZLIB
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/HttpResponseCommand.cc

@@ -78,7 +78,7 @@
 #include "Checksum.h"
 #include "Checksum.h"
 #include "ChecksumCheckIntegrityEntry.h"
 #include "ChecksumCheckIntegrityEntry.h"
 #ifdef HAVE_ZLIB
 #ifdef HAVE_ZLIB
-#include "GZipDecodingStreamFilter.h"
+#  include "GZipDecodingStreamFilter.h"
 #endif // HAVE_ZLIB
 #endif // HAVE_ZLIB
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/HttpServer.cc

@@ -53,7 +53,7 @@
 #include "array_fun.h"
 #include "array_fun.h"
 #include "JsonDiskWriter.h"
 #include "JsonDiskWriter.h"
 #ifdef ENABLE_XML_RPC
 #ifdef ENABLE_XML_RPC
-#include "XmlRpcDiskWriter.h"
+#  include "XmlRpcDiskWriter.h"
 #endif // ENABLE_XML_RPC
 #endif // ENABLE_XML_RPC
 
 
 namespace aria2 {
 namespace aria2 {

+ 2 - 2
src/HttpServerBodyCommand.cc

@@ -61,8 +61,8 @@
 #include "JsonDiskWriter.h"
 #include "JsonDiskWriter.h"
 #include "ValueBaseJsonParser.h"
 #include "ValueBaseJsonParser.h"
 #ifdef ENABLE_XML_RPC
 #ifdef ENABLE_XML_RPC
-#include "XmlRpcRequestParserStateMachine.h"
-#include "XmlRpcDiskWriter.h"
+#  include "XmlRpcRequestParserStateMachine.h"
+#  include "XmlRpcDiskWriter.h"
 #endif // ENABLE_XML_RPC
 #endif // ENABLE_XML_RPC
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/HttpServerCommand.cc

@@ -54,7 +54,7 @@
 #include "MessageDigest.h"
 #include "MessageDigest.h"
 #include "message_digest_helper.h"
 #include "message_digest_helper.h"
 #ifdef ENABLE_WEBSOCKET
 #ifdef ENABLE_WEBSOCKET
-#include "WebSocketResponseCommand.h"
+#  include "WebSocketResponseCommand.h"
 #endif // ENABLE_WEBSOCKET
 #endif // ENABLE_WEBSOCKET
 
 
 namespace aria2 {
 namespace aria2 {

+ 2 - 2
src/KqueueEventPoll.cc

@@ -46,9 +46,9 @@
 #include "fmt.h"
 #include "fmt.h"
 
 
 #ifdef KEVENT_UDATA_INTPTR_T
 #ifdef KEVENT_UDATA_INTPTR_T
-#define PTR_TO_UDATA(X) (reinterpret_cast<intptr_t>(X))
+#  define PTR_TO_UDATA(X) (reinterpret_cast<intptr_t>(X))
 #else // !KEVENT_UDATA_INTPTR_T
 #else // !KEVENT_UDATA_INTPTR_T
-#define PTR_TO_UDATA(X) (X)
+#  define PTR_TO_UDATA(X) (X)
 #endif // !KEVENT_UDATA_INTPTR_T
 #endif // !KEVENT_UDATA_INTPTR_T
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/KqueueEventPoll.h

@@ -46,7 +46,7 @@
 #include "Event.h"
 #include "Event.h"
 #include "a2functional.h"
 #include "a2functional.h"
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolver.h"
+#  include "AsyncNameResolver.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 2 - 2
src/LibgnutlsTLSContext.cc

@@ -37,8 +37,8 @@
 #include <sstream>
 #include <sstream>
 
 
 #ifdef HAVE_LIBGNUTLS
 #ifdef HAVE_LIBGNUTLS
-#include <gnutls/x509.h>
-#include <gnutls/pkcs12.h>
+#  include <gnutls/x509.h>
+#  include <gnutls/pkcs12.h>
 #endif // HAVE_LIBGNUTLS
 #endif // HAVE_LIBGNUTLS
 
 
 #include "LogFactory.h"
 #include "LogFactory.h"

+ 3 - 3
src/LibgnutlsTLSSession.cc

@@ -91,7 +91,7 @@ GnuTLSSession::~GnuTLSSession()
 #if (GNUTLS_VERSION_NUMBER >= 0x030103 &&                                      \
 #if (GNUTLS_VERSION_NUMBER >= 0x030103 &&                                      \
      GNUTLS_VERSION_NUMBER <= 0x030112) ||                                     \
      GNUTLS_VERSION_NUMBER <= 0x030112) ||                                     \
     (GNUTLS_VERSION_NUMBER >= 0x030200 && GNUTLS_VERSION_NUMBER <= 0x030208)
     (GNUTLS_VERSION_NUMBER >= 0x030200 && GNUTLS_VERSION_NUMBER <= 0x030208)
-#define A2_DISABLE_OCSP 1
+#  define A2_DISABLE_OCSP 1
 #endif
 #endif
 
 
 int GnuTLSSession::init(sock_t sockfd)
 int GnuTLSSession::init(sock_t sockfd)
@@ -99,11 +99,11 @@ int GnuTLSSession::init(sock_t sockfd)
 #if GNUTLS_VERSION_NUMBER >= 0x030000
 #if GNUTLS_VERSION_NUMBER >= 0x030000
   unsigned int flags =
   unsigned int flags =
       tlsContext_->getSide() == TLS_CLIENT ? GNUTLS_CLIENT : GNUTLS_SERVER;
       tlsContext_->getSide() == TLS_CLIENT ? GNUTLS_CLIENT : GNUTLS_SERVER;
-#ifdef A2_DISABLE_OCSP
+#  ifdef A2_DISABLE_OCSP
   if (tlsContext_->getSide() == TLS_CLIENT) {
   if (tlsContext_->getSide() == TLS_CLIENT) {
     flags |= GNUTLS_NO_EXTENSIONS;
     flags |= GNUTLS_NO_EXTENSIONS;
   }
   }
-#endif // A2_DISABLE_OCSP
+#  endif // A2_DISABLE_OCSP
 
 
   rv_ = gnutls_init(&sslSession_, flags);
   rv_ = gnutls_init(&sslSession_, flags);
 #else  // GNUTLS_VERSION_NUMBER >= 0x030000
 #else  // GNUTLS_VERSION_NUMBER >= 0x030000

+ 3 - 3
src/LibsslTLSContext.cc

@@ -146,7 +146,7 @@ OpenSSLTLSContext::OpenSSLTLSContext(TLSSessionSide side, TLSVersion minVer)
   }
   }
 
 
 #if OPENSSL_VERSION_NUMBER >= 0x0090800fL
 #if OPENSSL_VERSION_NUMBER >= 0x0090800fL
-#ifndef OPENSSL_NO_ECDH
+#  ifndef OPENSSL_NO_ECDH
   auto ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
   auto ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
   if (ecdh == nullptr) {
   if (ecdh == nullptr) {
     A2_LOG_WARN(fmt("Failed to enable ECDHE cipher suites. Cause: %s",
     A2_LOG_WARN(fmt("Failed to enable ECDHE cipher suites. Cause: %s",
@@ -156,8 +156,8 @@ OpenSSLTLSContext::OpenSSLTLSContext(TLSSessionSide side, TLSVersion minVer)
     SSL_CTX_set_tmp_ecdh(sslCtx_, ecdh);
     SSL_CTX_set_tmp_ecdh(sslCtx_, ecdh);
     EC_KEY_free(ecdh);
     EC_KEY_free(ecdh);
   }
   }
-#endif // OPENSSL_NO_ECDH
-#endif // OPENSSL_VERSION_NUMBER >= 0x0090800fL
+#  endif // OPENSSL_NO_ECDH
+#endif   // OPENSSL_VERSION_NUMBER >= 0x0090800fL
 }
 }
 
 
 OpenSSLTLSContext::~OpenSSLTLSContext() { SSL_CTX_free(sslCtx_); }
 OpenSSLTLSContext::~OpenSSLTLSContext() { SSL_CTX_free(sslCtx_); }

+ 4 - 4
src/LibuvEventPoll.cc

@@ -35,10 +35,10 @@
 /* copyright --> */
 /* copyright --> */
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#ifdef _WIN32_WINNT
-#undef _WIN32_WINNT
-#endif // _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
+#  ifdef _WIN32_WINNT
+#    undef _WIN32_WINNT
+#  endif // _WIN32_WINNT
+#  define _WIN32_WINNT 0x0600
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #include "LibuvEventPoll.h"
 #include "LibuvEventPoll.h"

+ 1 - 1
src/LibuvEventPoll.h

@@ -46,7 +46,7 @@
 #include "a2functional.h"
 #include "a2functional.h"
 
 
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolver.h"
+#  include "AsyncNameResolver.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 2 - 2
src/Lock.h

@@ -36,9 +36,9 @@
 #define D_LOCK_H
 #define D_LOCK_H
 
 
 #if defined(_WIN32)
 #if defined(_WIN32)
-#include <windows.h>
+#  include <windows.h>
 #elif defined(ENABLE_PTHREAD)
 #elif defined(ENABLE_PTHREAD)
-#include <pthread.h>
+#  include <pthread.h>
 #endif
 #endif
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/LogFactory.cc

@@ -38,7 +38,7 @@
 #include "RecoverableException.h"
 #include "RecoverableException.h"
 
 
 #ifdef HAVE_LIBGNUTLS
 #ifdef HAVE_LIBGNUTLS
-#include <gnutls/gnutls.h>
+#  include <gnutls/gnutls.h>
 #endif // HAVE_LIBGNUTLS
 #endif // HAVE_LIBGNUTLS
 
 
 namespace aria2 {
 namespace aria2 {

+ 2 - 2
src/Metalink2RequestGroup.cc

@@ -61,8 +61,8 @@
 #include "download_handlers.h"
 #include "download_handlers.h"
 #include "RequestGroupCriteria.h"
 #include "RequestGroupCriteria.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "BtDependency.h"
-#include "download_helper.h"
+#  include "BtDependency.h"
+#  include "download_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 #include "Checksum.h"
 #include "Checksum.h"
 #include "ChunkChecksum.h"
 #include "ChunkChecksum.h"

+ 1 - 1
src/MetalinkParserController.cc

@@ -50,7 +50,7 @@
 #include "ChunkChecksum.h"
 #include "ChunkChecksum.h"
 #include "MessageDigest.h"
 #include "MessageDigest.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "magnet.h"
+#  include "magnet.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/MultiFileAllocationIterator.cc

@@ -38,7 +38,7 @@
 #include "AdaptiveFileAllocationIterator.h"
 #include "AdaptiveFileAllocationIterator.h"
 #include "TruncFileAllocationIterator.h"
 #include "TruncFileAllocationIterator.h"
 #ifdef HAVE_SOME_FALLOCATE
 #ifdef HAVE_SOME_FALLOCATE
-#include "FallocFileAllocationIterator.h"
+#  include "FallocFileAllocationIterator.h"
 #endif // HAVE_SOME_FALLOCATE
 #endif // HAVE_SOME_FALLOCATE
 #include "DiskWriter.h"
 #include "DiskWriter.h"
 #include "DefaultDiskWriterFactory.h"
 #include "DefaultDiskWriterFactory.h"

+ 7 - 7
src/MultiUrlRequestInfo.cc

@@ -66,15 +66,15 @@
 #include "Notifier.h"
 #include "Notifier.h"
 #include "console.h"
 #include "console.h"
 #ifdef ENABLE_WEBSOCKET
 #ifdef ENABLE_WEBSOCKET
-#include "WebSocketSessionMan.h"
+#  include "WebSocketSessionMan.h"
 #else // !ENABLE_WEBSOCKET
 #else // !ENABLE_WEBSOCKET
-#include "NullWebSocketSessionMan.h"
+#  include "NullWebSocketSessionMan.h"
 #endif // !ENABLE_WEBSOCKET
 #endif // !ENABLE_WEBSOCKET
 #ifdef ENABLE_SSL
 #ifdef ENABLE_SSL
-#include "TLSContext.h"
+#  include "TLSContext.h"
 #endif // ENABLE_SSL
 #endif // ENABLE_SSL
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolver.h"
+#  include "AsyncNameResolver.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {
@@ -389,10 +389,10 @@ void MultiUrlRequestInfo::setupSignalHandlers()
 #ifdef HAVE_SIGACTION
 #ifdef HAVE_SIGACTION
   sigaddset(&mask_, SIGINT);
   sigaddset(&mask_, SIGINT);
   sigaddset(&mask_, SIGTERM);
   sigaddset(&mask_, SIGTERM);
-#ifdef SIGHUP
+#  ifdef SIGHUP
   sigaddset(&mask_, SIGHUP);
   sigaddset(&mask_, SIGHUP);
-#endif // SIGHUP
-#endif // HAVE_SIGACTION
+#  endif // SIGHUP
+#endif   // HAVE_SIGACTION
 
 
 #ifdef SIGHUP
 #ifdef SIGHUP
   util::setGlobalSignalHandler(SIGHUP, &mask_, handler, 0);
   util::setGlobalSignalHandler(SIGHUP, &mask_, handler, 0);

+ 1 - 1
src/NameResolveCommand.cc

@@ -47,7 +47,7 @@
 #include "UDPTrackerClient.h"
 #include "UDPTrackerClient.h"
 #include "BtRegistry.h"
 #include "BtRegistry.h"
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolverMan.h"
+#  include "AsyncNameResolverMan.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 6 - 6
src/OptionHandlerFactory.cc

@@ -87,11 +87,11 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
   {
   {
     OptionHandler* op(new BooleanOptionHandler(PREF_ASYNC_DNS, TEXT_ASYNC_DNS,
     OptionHandler* op(new BooleanOptionHandler(PREF_ASYNC_DNS, TEXT_ASYNC_DNS,
-#if defined(__ANDROID__) || defined(ANDROID)
+#  if defined(__ANDROID__) || defined(ANDROID)
                                                A2_V_FALSE,
                                                A2_V_FALSE,
-#else  // !__ANDROID__ && !ANDROID
+#  else  // !__ANDROID__ && !ANDROID
                                                A2_V_TRUE,
                                                A2_V_TRUE,
-#endif // !__ANDROID__ && !ANDROID
+#  endif // !__ANDROID__ && !ANDROID
                                                OptionHandler::OPT_ARG));
                                                OptionHandler::OPT_ARG));
     op->addTag(TAG_ADVANCED);
     op->addTag(TAG_ADVANCED);
     op->setInitialOption(true);
     op->setInitialOption(true);
@@ -99,15 +99,15 @@ 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) && defined(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, TEXT_ASYNC_DNS_SERVER, NO_DEFAULT_VALUE));
         PREF_ASYNC_DNS_SERVER, TEXT_ASYNC_DNS_SERVER, NO_DEFAULT_VALUE));
     op->addTag(TAG_ADVANCED);
     op->addTag(TAG_ADVANCED);
     handlers.push_back(op);
     handlers.push_back(op);
   }
   }
-#endif // HAVE_ARES_SET_SERVERS && HAVE_ARES_ADDR_NODE
-#endif // ENABLE_ASYNC_DNS
+#  endif // HAVE_ARES_SET_SERVERS && HAVE_ARES_ADDR_NODE
+#endif   // ENABLE_ASYNC_DNS
   {
   {
     OptionHandler* op(new BooleanOptionHandler(
     OptionHandler* op(new BooleanOptionHandler(
         PREF_AUTO_FILE_RENAMING, TEXT_AUTO_FILE_RENAMING, A2_V_TRUE,
         PREF_AUTO_FILE_RENAMING, TEXT_AUTO_FILE_RENAMING, A2_V_TRUE,

+ 7 - 7
src/Platform.cc

@@ -42,22 +42,22 @@
 #include <iostream>
 #include <iostream>
 
 
 #ifdef HAVE_OPENSSL
 #ifdef HAVE_OPENSSL
-#include <openssl/err.h>
-#include <openssl/ssl.h>
+#  include <openssl/err.h>
+#  include <openssl/ssl.h>
 #endif // HAVE_OPENSSL
 #endif // HAVE_OPENSSL
 #ifdef HAVE_LIBGCRYPT
 #ifdef HAVE_LIBGCRYPT
-#include <gcrypt.h>
+#  include <gcrypt.h>
 #endif // HAVE_LIBGCRYPT
 #endif // HAVE_LIBGCRYPT
 #ifdef HAVE_LIBGNUTLS
 #ifdef HAVE_LIBGNUTLS
-#include <gnutls/gnutls.h>
+#  include <gnutls/gnutls.h>
 #endif // HAVE_LIBGNUTLS
 #endif // HAVE_LIBGNUTLS
 
 
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include <ares.h>
+#  include <ares.h>
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 #ifdef HAVE_LIBSSH2
 #ifdef HAVE_LIBSSH2
-#include <libssh2.h>
+#  include <libssh2.h>
 #endif // HAVE_LIBSSH2
 #endif // HAVE_LIBSSH2
 
 
 #include "a2netcompat.h"
 #include "a2netcompat.h"
@@ -68,7 +68,7 @@
 #include "OptionParser.h"
 #include "OptionParser.h"
 #include "prefs.h"
 #include "prefs.h"
 #ifdef HAVE_LIBGMP
 #ifdef HAVE_LIBGMP
-#include "a2gmp.h"
+#  include "a2gmp.h"
 #endif // HAVE_LIBGMP
 #endif // HAVE_LIBGMP
 #include "LogFactory.h"
 #include "LogFactory.h"
 #include "util.h"
 #include "util.h"

+ 1 - 1
src/PollEventPoll.h

@@ -44,7 +44,7 @@
 #include "Event.h"
 #include "Event.h"
 #include "a2functional.h"
 #include "a2functional.h"
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolver.h"
+#  include "AsyncNameResolver.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 2 - 2
src/PortEventPoll.h

@@ -38,7 +38,7 @@
 #include "EventPoll.h"
 #include "EventPoll.h"
 
 
 #ifdef HAVE_PORT_H
 #ifdef HAVE_PORT_H
-#include <port.h>
+#  include <port.h>
 #endif // HAVE_PORT_H
 #endif // HAVE_PORT_H
 
 
 #include <set>
 #include <set>
@@ -46,7 +46,7 @@
 #include "Event.h"
 #include "Event.h"
 #include "a2functional.h"
 #include "a2functional.h"
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolver.h"
+#  include "AsyncNameResolver.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/ProtocolDetector.cc

@@ -44,7 +44,7 @@
 #include "uri.h"
 #include "uri.h"
 #include "BufferedFile.h"
 #include "BufferedFile.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
+#  include "bittorrent_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {

+ 31 - 31
src/RequestGroup.cc

@@ -82,39 +82,39 @@
 #include "CheckIntegrityCommand.h"
 #include "CheckIntegrityCommand.h"
 #include "ChecksumCheckIntegrityEntry.h"
 #include "ChecksumCheckIntegrityEntry.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
-#include "BtRegistry.h"
-#include "BtCheckIntegrityEntry.h"
-#include "DefaultPeerStorage.h"
-#include "DefaultBtAnnounce.h"
-#include "BtRuntime.h"
-#include "BtSetup.h"
-#include "BtPostDownloadHandler.h"
-#include "DHTSetup.h"
-#include "DHTRegistry.h"
-#include "DHTNode.h"
-#include "DHTRoutingTable.h"
-#include "DHTTaskQueue.h"
-#include "DHTTaskFactory.h"
-#include "DHTTokenTracker.h"
-#include "DHTMessageDispatcher.h"
-#include "DHTMessageReceiver.h"
-#include "DHTMessageFactory.h"
-#include "DHTMessageCallback.h"
-#include "BtMessageFactory.h"
-#include "BtRequestFactory.h"
-#include "BtMessageDispatcher.h"
-#include "BtMessageReceiver.h"
-#include "PeerConnection.h"
-#include "ExtensionMessageFactory.h"
-#include "DHTPeerAnnounceStorage.h"
-#include "DHTEntryPointNameResolveCommand.h"
-#include "LongestSequencePieceSelector.h"
-#include "PriorityPieceSelector.h"
-#include "bittorrent_helper.h"
+#  include "bittorrent_helper.h"
+#  include "BtRegistry.h"
+#  include "BtCheckIntegrityEntry.h"
+#  include "DefaultPeerStorage.h"
+#  include "DefaultBtAnnounce.h"
+#  include "BtRuntime.h"
+#  include "BtSetup.h"
+#  include "BtPostDownloadHandler.h"
+#  include "DHTSetup.h"
+#  include "DHTRegistry.h"
+#  include "DHTNode.h"
+#  include "DHTRoutingTable.h"
+#  include "DHTTaskQueue.h"
+#  include "DHTTaskFactory.h"
+#  include "DHTTokenTracker.h"
+#  include "DHTMessageDispatcher.h"
+#  include "DHTMessageReceiver.h"
+#  include "DHTMessageFactory.h"
+#  include "DHTMessageCallback.h"
+#  include "BtMessageFactory.h"
+#  include "BtRequestFactory.h"
+#  include "BtMessageDispatcher.h"
+#  include "BtMessageReceiver.h"
+#  include "PeerConnection.h"
+#  include "ExtensionMessageFactory.h"
+#  include "DHTPeerAnnounceStorage.h"
+#  include "DHTEntryPointNameResolveCommand.h"
+#  include "LongestSequencePieceSelector.h"
+#  include "PriorityPieceSelector.h"
+#  include "bittorrent_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 #ifdef ENABLE_METALINK
 #ifdef ENABLE_METALINK
-#include "MetalinkPostDownloadHandler.h"
+#  include "MetalinkPostDownloadHandler.h"
 #endif // ENABLE_METALINK
 #endif // ENABLE_METALINK
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/RequestGroupMan.cc

@@ -86,7 +86,7 @@
 #include "wallclock.h"
 #include "wallclock.h"
 #include "RpcMethodImpl.h"
 #include "RpcMethodImpl.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
+#  include "bittorrent_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {

+ 6 - 6
src/RpcMethodImpl.cc

@@ -70,12 +70,12 @@
 #include "message_digest_helper.h"
 #include "message_digest_helper.h"
 #include "OpenedFileCounter.h"
 #include "OpenedFileCounter.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
-#include "BtRegistry.h"
-#include "PeerStorage.h"
-#include "Peer.h"
-#include "BtRuntime.h"
-#include "BtAnnounce.h"
+#  include "bittorrent_helper.h"
+#  include "BtRegistry.h"
+#  include "PeerStorage.h"
+#  include "Peer.h"
+#  include "BtRuntime.h"
+#  include "BtAnnounce.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 #include "CheckIntegrityEntry.h"
 #include "CheckIntegrityEntry.h"
 
 

+ 1 - 1
src/RpcResponse.cc

@@ -40,7 +40,7 @@
 #include "util.h"
 #include "util.h"
 #include "json.h"
 #include "json.h"
 #ifdef HAVE_ZLIB
 #ifdef HAVE_ZLIB
-#include "GZipEncoder.h"
+#  include "GZipEncoder.h"
 #endif // HAVE_ZLIB
 #endif // HAVE_ZLIB
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/SelectEventPoll.cc

@@ -35,7 +35,7 @@
 #include "SelectEventPoll.h"
 #include "SelectEventPoll.h"
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#include <cassert>
+#  include <cassert>
 #endif // __MINGW32__
 #endif // __MINGW32__
 #include <cstring>
 #include <cstring>
 #include <algorithm>
 #include <algorithm>

+ 1 - 1
src/SelectEventPoll.h

@@ -42,7 +42,7 @@
 
 
 #include "a2functional.h"
 #include "a2functional.h"
 #ifdef ENABLE_ASYNC_DNS
 #ifdef ENABLE_ASYNC_DNS
-#include "AsyncNameResolver.h"
+#  include "AsyncNameResolver.h"
 #endif // ENABLE_ASYNC_DNS
 #endif // ENABLE_ASYNC_DNS
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/SessionSerializer.cc

@@ -56,7 +56,7 @@
 #include "SHA1IOFile.h"
 #include "SHA1IOFile.h"
 
 
 #if HAVE_ZLIB
 #if HAVE_ZLIB
-#include "GZipFile.h"
+#  include "GZipFile.h"
 #endif
 #endif
 
 
 namespace aria2 {
 namespace aria2 {

+ 6 - 6
src/SimpleRandomizer.cc

@@ -46,9 +46,9 @@
 #include "fmt.h"
 #include "fmt.h"
 
 
 #ifdef HAVE_GETRANDOM_INTERFACE
 #ifdef HAVE_GETRANDOM_INTERFACE
-#include <errno.h>
-#include <linux/errno.h>
-#include "getrandom_linux.h"
+#  include <errno.h>
+#  include <linux/errno.h>
+#  include "getrandom_linux.h"
 #endif
 #endif
 
 
 namespace aria2 {
 namespace aria2 {
@@ -97,7 +97,7 @@ void SimpleRandomizer::getRandomBytes(unsigned char* buf, size_t len)
   BOOL r = CryptGenRandom(provider_, len, reinterpret_cast<BYTE*>(buf));
   BOOL r = CryptGenRandom(provider_, len, reinterpret_cast<BYTE*>(buf));
   assert(r);
   assert(r);
 #else // ! __MINGW32__
 #else // ! __MINGW32__
-#if defined(HAVE_GETRANDOM_INTERFACE)
+#  if defined(HAVE_GETRANDOM_INTERFACE)
   static bool have_random_support = true;
   static bool have_random_support = true;
   if (have_random_support) {
   if (have_random_support) {
     auto rv = getrandom_linux(buf, len);
     auto rv = getrandom_linux(buf, len);
@@ -111,7 +111,7 @@ void SimpleRandomizer::getRandomBytes(unsigned char* buf, size_t len)
                 "implement this feature (ENOSYS)");
                 "implement this feature (ENOSYS)");
   }
   }
 // Fall through to generic implementation
 // Fall through to generic implementation
-#endif // defined(HAVE_GETRANDOM_INTERFACE)
+#  endif // defined(HAVE_GETRANDOM_INTERFACE)
   auto ubuf = reinterpret_cast<result_type*>(buf);
   auto ubuf = reinterpret_cast<result_type*>(buf);
   size_t q = len / sizeof(result_type);
   size_t q = len / sizeof(result_type);
   auto dis = std::uniform_int_distribution<result_type>();
   auto dis = std::uniform_int_distribution<result_type>();
@@ -121,7 +121,7 @@ void SimpleRandomizer::getRandomBytes(unsigned char* buf, size_t len)
   const size_t r = len % sizeof(result_type);
   const size_t r = len % sizeof(result_type);
   auto last = dis(gen_);
   auto last = dis(gen_);
   memcpy(ubuf, &last, r);
   memcpy(ubuf, &last, r);
-#endif // ! __MINGW32__
+#endif   // ! __MINGW32__
 }
 }
 
 
 } // namespace aria2
 } // namespace aria2

+ 1 - 1
src/SimpleRandomizer.h

@@ -41,7 +41,7 @@
 #include <random>
 #include <random>
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#include <wincrypt.h>
+#  include <wincrypt.h>
 #endif
 #endif
 
 
 namespace aria2 {
 namespace aria2 {

+ 37 - 37
src/SocketCore.cc

@@ -35,12 +35,12 @@
 #include "SocketCore.h"
 #include "SocketCore.h"
 
 
 #ifdef HAVE_IPHLPAPI_H
 #ifdef HAVE_IPHLPAPI_H
-#include <iphlpapi.h>
+#  include <iphlpapi.h>
 #endif // HAVE_IPHLPAPI_H
 #endif // HAVE_IPHLPAPI_H
 
 
 #include <unistd.h>
 #include <unistd.h>
 #ifdef HAVE_IFADDRS_H
 #ifdef HAVE_IFADDRS_H
-#include <ifaddrs.h>
+#  include <ifaddrs.h>
 #endif // HAVE_IFADDRS_H
 #endif // HAVE_IFADDRS_H
 
 
 #include <cerrno>
 #include <cerrno>
@@ -59,44 +59,44 @@
 #include "LogFactory.h"
 #include "LogFactory.h"
 #include "A2STR.h"
 #include "A2STR.h"
 #ifdef ENABLE_SSL
 #ifdef ENABLE_SSL
-#include "TLSContext.h"
-#include "TLSSession.h"
+#  include "TLSContext.h"
+#  include "TLSSession.h"
 #endif // ENABLE_SSL
 #endif // ENABLE_SSL
 #ifdef HAVE_LIBSSH2
 #ifdef HAVE_LIBSSH2
-#include "SSHSession.h"
+#  include "SSHSession.h"
 #endif // HAVE_LIBSSH2
 #endif // HAVE_LIBSSH2
 
 
 namespace aria2 {
 namespace aria2 {
 
 
 #ifndef __MINGW32__
 #ifndef __MINGW32__
-#define SOCKET_ERRNO (errno)
+#  define SOCKET_ERRNO (errno)
 #else
 #else
-#define SOCKET_ERRNO (WSAGetLastError())
+#  define SOCKET_ERRNO (WSAGetLastError())
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#define A2_EINPROGRESS WSAEWOULDBLOCK
-#define A2_EWOULDBLOCK WSAEWOULDBLOCK
-#define A2_EINTR WSAEINTR
-#define A2_WOULDBLOCK(e) (e == WSAEWOULDBLOCK)
+#  define A2_EINPROGRESS WSAEWOULDBLOCK
+#  define A2_EWOULDBLOCK WSAEWOULDBLOCK
+#  define A2_EINTR WSAEINTR
+#  define A2_WOULDBLOCK(e) (e == WSAEWOULDBLOCK)
 #else // !__MINGW32__
 #else // !__MINGW32__
-#define A2_EINPROGRESS EINPROGRESS
-#ifndef EWOULDBLOCK
-#define EWOULDBLOCK EAGAIN
-#endif // EWOULDBLOCK
-#define A2_EWOULDBLOCK EWOULDBLOCK
-#define A2_EINTR EINTR
-#if EWOULDBLOCK == EAGAIN
-#define A2_WOULDBLOCK(e) (e == EWOULDBLOCK)
-#else // EWOULDBLOCK != EAGAIN
-#define A2_WOULDBLOCK(e) (e == EWOULDBLOCK || e == EAGAIN)
-#endif // EWOULDBLOCK != EAGAIN
-#endif // !__MINGW32__
+#  define A2_EINPROGRESS EINPROGRESS
+#  ifndef EWOULDBLOCK
+#    define EWOULDBLOCK EAGAIN
+#  endif // EWOULDBLOCK
+#  define A2_EWOULDBLOCK EWOULDBLOCK
+#  define A2_EINTR EINTR
+#  if EWOULDBLOCK == EAGAIN
+#    define A2_WOULDBLOCK(e) (e == EWOULDBLOCK)
+#  else // EWOULDBLOCK != EAGAIN
+#    define A2_WOULDBLOCK(e) (e == EWOULDBLOCK || e == EAGAIN)
+#  endif // EWOULDBLOCK != EAGAIN
+#endif   // !__MINGW32__
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#define CLOSE(X) ::closesocket(X)
+#  define CLOSE(X) ::closesocket(X)
 #else
 #else
-#define CLOSE(X) close(X)
+#  define CLOSE(X) close(X)
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 namespace {
 namespace {
@@ -655,12 +655,12 @@ void SocketCore::closeConnection()
 }
 }
 
 
 #ifndef __MINGW32__
 #ifndef __MINGW32__
-#define CHECK_FD(fd)                                                           \
-  if (fd < 0 || FD_SETSIZE <= fd) {                                            \
-    logger_->warn("Detected file descriptor >= FD_SETSIZE or < 0. "            \
-                  "Download may slow down or fail.");                          \
-    return false;                                                              \
-  }
+#  define CHECK_FD(fd)                                                         \
+    if (fd < 0 || FD_SETSIZE <= fd) {                                          \
+      logger_->warn("Detected file descriptor >= FD_SETSIZE or < 0. "          \
+                    "Download may slow down or fail.");                        \
+      return false;                                                            \
+    }
 #endif // !__MINGW32__
 #endif // !__MINGW32__
 
 
 bool SocketCore::isWritable(time_t timeout)
 bool SocketCore::isWritable(time_t timeout)
@@ -681,9 +681,9 @@ bool SocketCore::isWritable(time_t timeout)
   }
   }
   throw DL_RETRY_EX(fmt(EX_SOCKET_CHECK_WRITABLE, errorMsg(errNum).c_str()));
   throw DL_RETRY_EX(fmt(EX_SOCKET_CHECK_WRITABLE, errorMsg(errNum).c_str()));
 #else // !HAVE_POLL
 #else // !HAVE_POLL
-#ifndef __MINGW32__
+#  ifndef __MINGW32__
   CHECK_FD(sockfd_);
   CHECK_FD(sockfd_);
-#endif // !__MINGW32__
+#  endif // !__MINGW32__
   fd_set fds;
   fd_set fds;
   FD_ZERO(&fds);
   FD_ZERO(&fds);
   FD_SET(sockfd_, &fds);
   FD_SET(sockfd_, &fds);
@@ -705,7 +705,7 @@ bool SocketCore::isWritable(time_t timeout)
     return false;
     return false;
   }
   }
   throw DL_RETRY_EX(fmt(EX_SOCKET_CHECK_WRITABLE, errorMsg(errNum).c_str()));
   throw DL_RETRY_EX(fmt(EX_SOCKET_CHECK_WRITABLE, errorMsg(errNum).c_str()));
-#endif // !HAVE_POLL
+#endif   // !HAVE_POLL
 }
 }
 
 
 bool SocketCore::isReadable(time_t timeout)
 bool SocketCore::isReadable(time_t timeout)
@@ -726,9 +726,9 @@ bool SocketCore::isReadable(time_t timeout)
   }
   }
   throw DL_RETRY_EX(fmt(EX_SOCKET_CHECK_READABLE, errorMsg(errNum).c_str()));
   throw DL_RETRY_EX(fmt(EX_SOCKET_CHECK_READABLE, errorMsg(errNum).c_str()));
 #else // !HAVE_POLL
 #else // !HAVE_POLL
-#ifndef __MINGW32__
+#  ifndef __MINGW32__
   CHECK_FD(sockfd_);
   CHECK_FD(sockfd_);
-#endif // !__MINGW32__
+#  endif // !__MINGW32__
   fd_set fds;
   fd_set fds;
   FD_ZERO(&fds);
   FD_ZERO(&fds);
   FD_SET(sockfd_, &fds);
   FD_SET(sockfd_, &fds);
@@ -750,7 +750,7 @@ bool SocketCore::isReadable(time_t timeout)
     return false;
     return false;
   }
   }
   throw DL_RETRY_EX(fmt(EX_SOCKET_CHECK_READABLE, errorMsg(errNum).c_str()));
   throw DL_RETRY_EX(fmt(EX_SOCKET_CHECK_READABLE, errorMsg(errNum).c_str()));
-#endif // !HAVE_POLL
+#endif   // !HAVE_POLL
 }
 }
 
 
 ssize_t SocketCore::writeVector(a2iovec* iov, size_t iovcnt)
 ssize_t SocketCore::writeVector(a2iovec* iov, size_t iovcnt)

+ 1 - 1
src/Sqlite3CookieParser.cc

@@ -43,7 +43,7 @@
 #include "A2STR.h"
 #include "A2STR.h"
 #include "cookie_helper.h"
 #include "cookie_helper.h"
 #ifndef HAVE_SQLITE3_OPEN_V2
 #ifndef HAVE_SQLITE3_OPEN_V2
-#include "File.h"
+#  include "File.h"
 #endif // !HAVE_SQLITE3_OPEN_V2
 #endif // !HAVE_SQLITE3_OPEN_V2
 
 
 namespace aria2 {
 namespace aria2 {

+ 1 - 1
src/UriListParser.cc

@@ -46,7 +46,7 @@
 #include "OptionParser.h"
 #include "OptionParser.h"
 
 
 #if HAVE_ZLIB
 #if HAVE_ZLIB
-#include "GZipFile.h"
+#  include "GZipFile.h"
 #endif
 #endif
 
 
 namespace aria2 {
 namespace aria2 {

+ 3 - 3
src/WatchProcessCommand.cc

@@ -58,9 +58,9 @@
 #include "fmt.h"
 #include "fmt.h"
 
 
 #ifdef __APPLE__
 #ifdef __APPLE__
-#import <sys/types.h>
-#import <sys/sysctl.h>
-#define MIBSIZE 4
+#  import <sys/types.h>
+#  import <sys/sysctl.h>
+#  define MIBSIZE 4
 #endif
 #endif
 
 
 namespace aria2 {
 namespace aria2 {

+ 5 - 5
src/WinTLSContext.cc

@@ -45,20 +45,20 @@
 #include "util.h"
 #include "util.h"
 
 
 #ifndef SP_PROT_TLS1_1_CLIENT
 #ifndef SP_PROT_TLS1_1_CLIENT
-#define SP_PROT_TLS1_1_CLIENT 0x00000200
+#  define SP_PROT_TLS1_1_CLIENT 0x00000200
 #endif
 #endif
 #ifndef SP_PROT_TLS1_1_SERVER
 #ifndef SP_PROT_TLS1_1_SERVER
-#define SP_PROT_TLS1_1_SERVER 0x00000100
+#  define SP_PROT_TLS1_1_SERVER 0x00000100
 #endif
 #endif
 #ifndef SP_PROT_TLS1_2_CLIENT
 #ifndef SP_PROT_TLS1_2_CLIENT
-#define SP_PROT_TLS1_2_CLIENT 0x00000800
+#  define SP_PROT_TLS1_2_CLIENT 0x00000800
 #endif
 #endif
 #ifndef SP_PROT_TLS1_2_SERVER
 #ifndef SP_PROT_TLS1_2_SERVER
-#define SP_PROT_TLS1_2_SERVER 0x00000400
+#  define SP_PROT_TLS1_2_SERVER 0x00000400
 #endif
 #endif
 
 
 #ifndef SCH_USE_STRONG_CRYPTO
 #ifndef SCH_USE_STRONG_CRYPTO
-#define SCH_USE_STRONG_CRYPTO 0x00400000
+#  define SCH_USE_STRONG_CRYPTO 0x00400000
 #endif
 #endif
 
 
 #define WEAK_CIPHER_BITS 56
 #define WEAK_CIPHER_BITS 56

+ 4 - 4
src/WinTLSSession.cc

@@ -44,17 +44,17 @@
 #include "util.h"
 #include "util.h"
 
 
 #ifndef SECBUFFER_ALERT
 #ifndef SECBUFFER_ALERT
-#define SECBUFFER_ALERT 17
+#  define SECBUFFER_ALERT 17
 #endif
 #endif
 
 
 #ifndef SZ_ALG_MAX_SIZE
 #ifndef SZ_ALG_MAX_SIZE
-#define SZ_ALG_MAX_SIZE 64
+#  define SZ_ALG_MAX_SIZE 64
 #endif
 #endif
 #ifndef SECPKGCONTEXT_CIPHERINFO_V1
 #ifndef SECPKGCONTEXT_CIPHERINFO_V1
-#define SECPKGCONTEXT_CIPHERINFO_V1 1
+#  define SECPKGCONTEXT_CIPHERINFO_V1 1
 #endif
 #endif
 #ifndef SECPKG_ATTR_CIPHER_INFO
 #ifndef SECPKG_ATTR_CIPHER_INFO
-#define SECPKG_ATTR_CIPHER_INFO 0x64
+#  define SECPKG_ATTR_CIPHER_INFO 0x64
 #endif
 #endif
 
 
 namespace {
 namespace {

+ 2 - 2
src/XmlParser.h

@@ -61,9 +61,9 @@ struct SessionData {
 } // namespace aria2
 } // namespace aria2
 
 
 #ifdef HAVE_LIBXML2
 #ifdef HAVE_LIBXML2
-#include "Xml2XmlParser.h"
+#  include "Xml2XmlParser.h"
 #elif HAVE_LIBEXPAT
 #elif HAVE_LIBEXPAT
-#include "ExpatXmlParser.h"
+#  include "ExpatXmlParser.h"
 #endif
 #endif
 
 
 namespace aria2 {
 namespace aria2 {

+ 87 - 87
src/a2io.h

@@ -41,159 +41,159 @@
 #include <fcntl.h>
 #include <fcntl.h>
 #include <cerrno>
 #include <cerrno>
 #ifdef HAVE_POLL_H
 #ifdef HAVE_POLL_H
-#include <poll.h>
+#  include <poll.h>
 #endif // HAVE_POLL_H
 #endif // HAVE_POLL_H
 #ifdef HAVE_IO_H
 #ifdef HAVE_IO_H
-#include <io.h>
+#  include <io.h>
 #endif // HAVE_IO_H
 #endif // HAVE_IO_H
 #ifdef HAVE_WINIOCTL_H
 #ifdef HAVE_WINIOCTL_H
-#include <winioctl.h>
+#  include <winioctl.h>
 #endif // HAVE_WINIOCTL_H
 #endif // HAVE_WINIOCTL_H
 #ifdef HAVE_SHARE_H
 #ifdef HAVE_SHARE_H
-#include <share.h>
+#  include <share.h>
 #endif // HAVE_SHARE_H
 #endif // HAVE_SHARE_H
 
 
 // in some platforms following definitions are missing:
 // in some platforms following definitions are missing:
 #ifndef EINPROGRESS
 #ifndef EINPROGRESS
-#define EINPROGRESS (WSAEINPROGRESS)
+#  define EINPROGRESS (WSAEINPROGRESS)
 #endif // EINPROGRESS
 #endif // EINPROGRESS
 
 
 #ifndef O_NONBLOCK
 #ifndef O_NONBLOCK
-#define O_NONBLOCK (O_NDELAY)
+#  define O_NONBLOCK (O_NDELAY)
 #endif // O_NONBLOCK
 #endif // O_NONBLOCK
 
 
 #ifndef O_BINARY
 #ifndef O_BINARY
-#define O_BINARY (0)
+#  define O_BINARY (0)
 #endif // O_BINARY
 #endif // O_BINARY
 
 
 // st_mode flags
 // st_mode flags
 #ifndef S_IRUSR
 #ifndef S_IRUSR
-#define S_IRUSR 0000400 /* read permission, owner */
-#endif                  /* S_IRUSR       */
+#  define S_IRUSR 0000400 /* read permission, owner */
+#endif                    /* S_IRUSR       */
 #ifndef S_IWUSR
 #ifndef S_IWUSR
-#define S_IWUSR 0000200 /* write permission, owner */
-#endif                  /* S_IWUSR       */
+#  define S_IWUSR 0000200 /* write permission, owner */
+#endif                    /* S_IWUSR       */
 #ifndef S_IXUSR
 #ifndef S_IXUSR
-#define S_IXUSR 0000100 /* execute/search permission, owner */
-#endif                  /* S_IXUSR */
+#  define S_IXUSR 0000100 /* execute/search permission, owner */
+#endif                    /* S_IXUSR */
 #ifndef S_IRWXU
 #ifndef S_IRWXU
-#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
+#  define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
 #endif /* S_IRWXU       */
 #endif /* S_IRWXU       */
 #ifndef S_IRGRP
 #ifndef S_IRGRP
-#define S_IRGRP 0000040 /* read permission, group */
-#endif                  /* S_IRGRP       */
+#  define S_IRGRP 0000040 /* read permission, group */
+#endif                    /* S_IRGRP       */
 #ifndef S_IWGRP
 #ifndef S_IWGRP
-#define S_IWGRP 0000020 /* write permission, group */
-#endif                  /* S_IWGRP       */
+#  define S_IWGRP 0000020 /* write permission, group */
+#endif                    /* S_IWGRP       */
 #ifndef S_IXGRP
 #ifndef S_IXGRP
-#define S_IXGRP 0000010 /* execute/search permission, group */
-#endif                  /* S_IXGRP */
+#  define S_IXGRP 0000010 /* execute/search permission, group */
+#endif                    /* S_IXGRP */
 #ifndef S_IRWXG
 #ifndef S_IRWXG
-#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
+#  define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
 #endif /* S_IRWXG               */
 #endif /* S_IRWXG               */
 #ifndef S_IROTH
 #ifndef S_IROTH
-#define S_IROTH 0000004 /* read permission, other */
-#endif                  /* S_IROTH       */
+#  define S_IROTH 0000004 /* read permission, other */
+#endif                    /* S_IROTH       */
 #ifndef S_IWOTH
 #ifndef S_IWOTH
-#define S_IWOTH 0000002 /* write permission, other */
-#endif                  /* S_IWOTH       */
+#  define S_IWOTH 0000002 /* write permission, other */
+#endif                    /* S_IWOTH       */
 #ifndef S_IXOTH
 #ifndef S_IXOTH
-#define S_IXOTH 0000001 /* execute/search permission, other */
-#endif                  /* S_IXOTH */
+#  define S_IXOTH 0000001 /* execute/search permission, other */
+#endif                    /* S_IXOTH */
 #ifndef S_IRWXO
 #ifndef S_IRWXO
-#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
+#  define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
 #endif /* S_IRWXO               */
 #endif /* S_IRWXO               */
 
 
 // Use 'nul' instead of /dev/null in win32.
 // Use 'nul' instead of /dev/null in win32.
 #ifdef HAVE_WINSOCK2_H
 #ifdef HAVE_WINSOCK2_H
-#define DEV_NULL "nul"
+#  define DEV_NULL "nul"
 #else
 #else
-#define DEV_NULL "/dev/null"
+#  define DEV_NULL "/dev/null"
 #endif // HAVE_WINSOCK2_H
 #endif // HAVE_WINSOCK2_H
 
 
 // Use 'con' instead of '/dev/stdin' and '/dev/stdout' in win32.
 // Use 'con' instead of '/dev/stdin' and '/dev/stdout' in win32.
 #ifdef HAVE_WINSOCK2_H
 #ifdef HAVE_WINSOCK2_H
-#define DEV_STDIN "con"
-#define DEV_STDOUT "con"
+#  define DEV_STDIN "con"
+#  define DEV_STDOUT "con"
 #else
 #else
-#define DEV_STDIN "/dev/stdin"
-#define DEV_STDOUT "/dev/stdout"
+#  define DEV_STDIN "/dev/stdin"
+#  define DEV_STDOUT "/dev/stdout"
 #endif // HAVE_WINSOCK2_H
 #endif // HAVE_WINSOCK2_H
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#define a2lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
-#define a2fseek(fd, offset, origin) _fseeki64(fd, offset, origin)
-#define a2fstat(fd, buf) _fstati64(fd, buf)
-#define a2ftell(fd) _ftelli64(fd)
-#define a2wstat(path, buf) _wstati64(path, buf)
-#ifdef stat
-#undef stat
-#endif // stat
-#define a2_struct_stat struct _stati64
-#define a2stat(path, buf) _wstati64(path, buf)
-#define a2tell(handle) _telli64(handle)
-#define a2mkdir(path, openMode) _wmkdir(path)
-#define a2utimbuf _utimbuf
-#define a2utime(path, times) _wutime(path, times)
-#define a2unlink(path) _wunlink(path)
-#define a2rmdir(path) _wrmdir(path)
+#  define a2lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
+#  define a2fseek(fd, offset, origin) _fseeki64(fd, offset, origin)
+#  define a2fstat(fd, buf) _fstati64(fd, buf)
+#  define a2ftell(fd) _ftelli64(fd)
+#  define a2wstat(path, buf) _wstati64(path, buf)
+#  ifdef stat
+#    undef stat
+#  endif // stat
+#  define a2_struct_stat struct _stati64
+#  define a2stat(path, buf) _wstati64(path, buf)
+#  define a2tell(handle) _telli64(handle)
+#  define a2mkdir(path, openMode) _wmkdir(path)
+#  define a2utimbuf _utimbuf
+#  define a2utime(path, times) _wutime(path, times)
+#  define a2unlink(path) _wunlink(path)
+#  define a2rmdir(path) _wrmdir(path)
 // For Windows, we share files for reading and writing.
 // For Windows, we share files for reading and writing.
-#define a2open(path, flags, mode) _wsopen(path, flags, _SH_DENYNO, mode)
-#define a2fopen(path, mode) _wfsopen(path, mode, _SH_DENYNO)
+#  define a2open(path, flags, mode) _wsopen(path, flags, _SH_DENYNO, mode)
+#  define a2fopen(path, mode) _wfsopen(path, mode, _SH_DENYNO)
 // # define a2ftruncate(fd, length): We don't use ftruncate in Mingw build
 // # define a2ftruncate(fd, length): We don't use ftruncate in Mingw build
-#define a2_off_t off_t
+#  define a2_off_t off_t
 #elif defined(__ANDROID__) || defined(ANDROID)
 #elif defined(__ANDROID__) || defined(ANDROID)
-#define a2lseek(fd, offset, origin) lseek64(fd, offset, origin)
+#  define a2lseek(fd, offset, origin) lseek64(fd, offset, origin)
 // # define a2fseek(fp, offset, origin): No fseek64 and not used in aria2
 // # define a2fseek(fp, offset, origin): No fseek64 and not used in aria2
-#define a2fstat(fd, buf) fstat64(fd, buf)
+#  define a2fstat(fd, buf) fstat64(fd, buf)
 // # define a2ftell(fd): No ftell64 and not used in aria2
 // # define a2ftell(fd): No ftell64 and not used in aria2
-#define a2_struct_stat struct stat
-#define a2stat(path, buf) stat64(path, buf)
-#define a2mkdir(path, openMode) mkdir(path, openMode)
-#define a2utimbuf utimbuf
-#define a2utime(path, times) ::utime(path, times)
-#define a2unlink(path) unlink(path)
-#define a2rmdir(path) rmdir(path)
-#define a2open(path, flags, mode) open(path, flags, mode)
-#define a2fopen(path, mode) fopen(path, mode)
+#  define a2_struct_stat struct stat
+#  define a2stat(path, buf) stat64(path, buf)
+#  define a2mkdir(path, openMode) mkdir(path, openMode)
+#  define a2utimbuf utimbuf
+#  define a2utime(path, times) ::utime(path, times)
+#  define a2unlink(path) unlink(path)
+#  define a2rmdir(path) rmdir(path)
+#  define a2open(path, flags, mode) open(path, flags, mode)
+#  define a2fopen(path, mode) fopen(path, mode)
 // Android NDK R8e does not provide ftruncate64 prototype, so let's
 // Android NDK R8e does not provide ftruncate64 prototype, so let's
 // define it here.
 // define it here.
-#ifdef __cplusplus
+#  ifdef __cplusplus
 extern "C" {
 extern "C" {
-#endif
+#  endif
 extern int ftruncate64(int fd, off64_t length);
 extern int ftruncate64(int fd, off64_t length);
-#ifdef __cplusplus
+#  ifdef __cplusplus
 }
 }
-#endif
-#define a2ftruncate(fd, length) ftruncate64(fd, length)
+#  endif
+#  define a2ftruncate(fd, length) ftruncate64(fd, length)
 // Use off64_t directly since android does not offer transparent
 // Use off64_t directly since android does not offer transparent
 // switching between off_t and off64_t.
 // switching between off_t and off64_t.
-#define a2_off_t off64_t
+#  define a2_off_t off64_t
 #else // !__MINGW32__ && !(defined(__ANDROID__) || defined(ANDROID))
 #else // !__MINGW32__ && !(defined(__ANDROID__) || defined(ANDROID))
-#define a2lseek(fd, offset, origin) lseek(fd, offset, origin)
-#define a2fseek(fp, offset, origin) fseek(fp, offset, origin)
-#define a2fstat(fp, buf) fstat(fp, buf)
-#define a2ftell(fp) ftell(fp)
-#define a2_struct_stat struct stat
-#define a2stat(path, buf) stat(path, buf)
-#define a2mkdir(path, openMode) mkdir(path, openMode)
-#define a2utimbuf utimbuf
-#define a2utime(path, times) ::utime(path, times)
-#define a2unlink(path) unlink(path)
-#define a2rmdir(path) rmdir(path)
-#define a2open(path, flags, mode) open(path, flags, mode)
-#define a2fopen(path, mode) fopen(path, mode)
-#define a2ftruncate(fd, length) ftruncate(fd, length)
-#define a2_off_t off_t
+#  define a2lseek(fd, offset, origin) lseek(fd, offset, origin)
+#  define a2fseek(fp, offset, origin) fseek(fp, offset, origin)
+#  define a2fstat(fp, buf) fstat(fp, buf)
+#  define a2ftell(fp) ftell(fp)
+#  define a2_struct_stat struct stat
+#  define a2stat(path, buf) stat(path, buf)
+#  define a2mkdir(path, openMode) mkdir(path, openMode)
+#  define a2utimbuf utimbuf
+#  define a2utime(path, times) ::utime(path, times)
+#  define a2unlink(path) unlink(path)
+#  define a2rmdir(path) rmdir(path)
+#  define a2open(path, flags, mode) open(path, flags, mode)
+#  define a2fopen(path, mode) fopen(path, mode)
+#  define a2ftruncate(fd, length) ftruncate(fd, length)
+#  define a2_off_t off_t
 #endif
 #endif
 
 
 #define OPEN_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
 #define OPEN_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
 #define DIR_OPEN_MODE S_IRWXU | S_IRWXG | S_IRWXO
 #define DIR_OPEN_MODE S_IRWXU | S_IRWXG | S_IRWXO
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#define A2_BAD_FD INVALID_HANDLE_VALUE
+#  define A2_BAD_FD INVALID_HANDLE_VALUE
 #else // !__MINGW32__
 #else // !__MINGW32__
-#define A2_BAD_FD -1
+#  define A2_BAD_FD -1
 #endif // !__MINGW32__
 #endif // !__MINGW32__
 
 
 #endif // D_A2IO_H
 #endif // D_A2IO_H

+ 34 - 34
src/a2netcompat.h

@@ -38,78 +38,78 @@
 #include "a2io.h"
 #include "a2io.h"
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif // HAVE_WS2TCPIP_H
-#endif // __MINGW32__
+#  ifdef HAVE_WS2TCPIP_H
+#    include <ws2tcpip.h>
+#  endif // HAVE_WS2TCPIP_H
+#endif   // __MINGW32__
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#define a2_sockopt_t char*
-#ifndef HAVE_GETADDRINFO
-#define HAVE_GETADDRINFO
-#endif // !HAVE_GETADDRINFO
-#undef HAVE_GAI_STRERROR
-#undef gai_strerror
+#  define a2_sockopt_t char*
+#  ifndef HAVE_GETADDRINFO
+#    define HAVE_GETADDRINFO
+#  endif // !HAVE_GETADDRINFO
+#  undef HAVE_GAI_STRERROR
+#  undef gai_strerror
 #else
 #else
-#define a2_sockopt_t void*
+#  define a2_sockopt_t void*
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #ifdef HAVE_NETDB_H
 #ifdef HAVE_NETDB_H
-#include <netdb.h>
+#  include <netdb.h>
 #endif // HAVE_NETDB_H
 #endif // HAVE_NETDB_H
 
 
 #ifdef HAVE_SYS_SOCKET_H
 #ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
+#  include <sys/socket.h>
 #endif // HAVE_SYS_SOCKET_H
 #endif // HAVE_SYS_SOCKET_H
 
 
 #ifdef HAVE_NETINET_IN_H
 #ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
+#  include <netinet/in.h>
 #endif // HAVE_NETINET_IN_H
 #endif // HAVE_NETINET_IN_H
 
 
 #ifdef HAVE_NETINET_TCP_H
 #ifdef HAVE_NETINET_TCP_H
-#include <netinet/tcp.h>
+#  include <netinet/tcp.h>
 #endif // HAVE_NETINET_TCP_H
 #endif // HAVE_NETINET_TCP_H
 
 
 #ifdef HAVE_ARPA_INET_H
 #ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
+#  include <arpa/inet.h>
 #endif // HAVE_ARPA_INET_H
 #endif // HAVE_ARPA_INET_H
 
 
 #ifdef HAVE_NETINET_IN_H
 #ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
+#  include <netinet/in.h>
 #endif // HAVE_NETINET_IN_H
 #endif // HAVE_NETINET_IN_H
 
 
 #ifdef HAVE_SYS_UIO_H
 #ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
+#  include <sys/uio.h>
 #endif // HAVE_SYS_UIO_H
 #endif // HAVE_SYS_UIO_H
 
 
 #ifndef HAVE_GETADDRINFO
 #ifndef HAVE_GETADDRINFO
-#include "getaddrinfo.h"
-#define HAVE_GAI_STRERROR
+#  include "getaddrinfo.h"
+#  define HAVE_GAI_STRERROR
 #endif // HAVE_GETADDRINFO
 #endif // HAVE_GETADDRINFO
 
 
 #ifndef HAVE_GAI_STRERROR
 #ifndef HAVE_GAI_STRERROR
-#include "gai_strerror.h"
+#  include "gai_strerror.h"
 #endif // HAVE_GAI_STRERROR
 #endif // HAVE_GAI_STRERROR
 
 
 #include <string>
 #include <string>
 
 
 #ifdef HAVE_WINSOCK2_H
 #ifdef HAVE_WINSOCK2_H
-#define sock_t SOCKET
+#  define sock_t SOCKET
 #else
 #else
-#define sock_t int
+#  define sock_t int
 #endif
 #endif
 
 
 #ifndef AI_ADDRCONFIG
 #ifndef AI_ADDRCONFIG
-#define AI_ADDRCONFIG 0
+#  define AI_ADDRCONFIG 0
 #endif // !AI_ADDRCONFIG
 #endif // !AI_ADDRCONFIG
 
 
 #define DEFAULT_AI_FLAGS AI_ADDRCONFIG
 #define DEFAULT_AI_FLAGS AI_ADDRCONFIG
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#ifndef SHUT_WR
-#define SHUT_WR SD_SEND
-#endif // !SHUT_WR
-#endif // __MINGW32__
+#  ifndef SHUT_WR
+#    define SHUT_WR SD_SEND
+#  endif // !SHUT_WR
+#endif   // __MINGW32__
 
 
 union sockaddr_union {
 union sockaddr_union {
   sockaddr sa;
   sockaddr sa;
@@ -136,19 +136,19 @@ struct Endpoint {
 #define A2_DEFAULT_IOV_MAX 128
 #define A2_DEFAULT_IOV_MAX 128
 
 
 #if defined(IOV_MAX) && IOV_MAX < A2_DEFAULT_IOV_MAX
 #if defined(IOV_MAX) && IOV_MAX < A2_DEFAULT_IOV_MAX
-#define A2_IOV_MAX IOV_MAX
+#  define A2_IOV_MAX IOV_MAX
 #else
 #else
-#define A2_IOV_MAX A2_DEFAULT_IOV_MAX
+#  define A2_IOV_MAX A2_DEFAULT_IOV_MAX
 #endif
 #endif
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
 typedef WSABUF a2iovec;
 typedef WSABUF a2iovec;
-#define A2IOVEC_BASE buf
-#define A2IOVEC_LEN len
+#  define A2IOVEC_BASE buf
+#  define A2IOVEC_LEN len
 #else // !__MINGW32__
 #else // !__MINGW32__
 typedef struct iovec a2iovec;
 typedef struct iovec a2iovec;
-#define A2IOVEC_BASE iov_base
-#define A2IOVEC_LEN iov_len
+#  define A2IOVEC_BASE iov_base
+#  define A2IOVEC_LEN iov_len
 #endif // !__MINGW32__
 #endif // !__MINGW32__
 
 
 #endif // D_A2NETCOMPAT_H
 #endif // D_A2NETCOMPAT_H

+ 7 - 7
src/a2time.h

@@ -41,31 +41,31 @@
 #include <chrono>
 #include <chrono>
 
 
 #ifndef HAVE_LOCALTIME_R
 #ifndef HAVE_LOCALTIME_R
-#include "localtime_r.h"
+#  include "localtime_r.h"
 #endif // HAVE_LOCALTIME_R
 #endif // HAVE_LOCALTIME_R
 
 
 #ifndef HAVE_GETTIMEOFDAY
 #ifndef HAVE_GETTIMEOFDAY
-#include "gettimeofday.h"
+#  include "gettimeofday.h"
 #endif // HAVE_GETTIMEOFDAY
 #endif // HAVE_GETTIMEOFDAY
 
 
 #ifndef HAVE_STRPTIME
 #ifndef HAVE_STRPTIME
-#include "strptime.h"
+#  include "strptime.h"
 #endif // HAVE_STRPTIME
 #endif // HAVE_STRPTIME
 
 
 #ifndef HAVE_TIMEGM
 #ifndef HAVE_TIMEGM
-#include "timegm.h"
+#  include "timegm.h"
 #endif // HAVE_TIMEGM
 #endif // HAVE_TIMEGM
 
 
 #ifndef HAVE_ASCTIME_R
 #ifndef HAVE_ASCTIME_R
-#include "asctime_r.h"
+#  include "asctime_r.h"
 #endif // HAVE_ASCTIME_R
 #endif // HAVE_ASCTIME_R
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#define suseconds_t uint64_t
+#  define suseconds_t uint64_t
 #endif
 #endif
 
 
 #ifndef HAVE_A2_STRUCT_TIMESPEC
 #ifndef HAVE_A2_STRUCT_TIMESPEC
-#include "timespec.h"
+#  include "timespec.h"
 #endif // !HAVE_A2_STRUCT_TIMESPEC
 #endif // !HAVE_A2_STRUCT_TIMESPEC
 
 
 // Rounding error in millis
 // Rounding error in millis

+ 63 - 63
src/alloca.c

@@ -22,18 +22,18 @@
    your main control loop, etc. to force garbage collection.  */
    your main control loop, etc. to force garbage collection.  */
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#  include <config.h>
 #endif
 #endif
 
 
 #if HAVE_STRING_H
 #if HAVE_STRING_H
-#include <string.h>
+#  include <string.h>
 #endif
 #endif
 #if HAVE_STDLIB_H
 #if HAVE_STDLIB_H
-#include <stdlib.h>
+#  include <stdlib.h>
 #endif
 #endif
 
 
 #ifdef emacs
 #ifdef emacs
-#include "blockinput.h"
+#  include "blockinput.h"
 #endif
 #endif
 
 
 /* If compiling with GCC 2, this file's not needed.  */
 /* If compiling with GCC 2, this file's not needed.  */
@@ -41,40 +41,40 @@
 
 
 /* If someone has defined alloca as a macro,
 /* If someone has defined alloca as a macro,
    there must be some other way alloca is supposed to work.  */
    there must be some other way alloca is supposed to work.  */
-#ifndef alloca
+#  ifndef alloca
 
 
-#ifdef emacs
-#ifdef static
+#    ifdef emacs
+#      ifdef static
 /* actually, only want this if static is defined as ""
 /* actually, only want this if static is defined as ""
    -- this is for usg, in which emacs must undefine static
    -- this is for usg, in which emacs must undefine static
    in order to make unexec workable
    in order to make unexec workable
    */
    */
-#ifndef STACK_DIRECTION
+#        ifndef STACK_DIRECTION
 you lose-- must know STACK_DIRECTION at compile - time
 you lose-- must know STACK_DIRECTION at compile - time
-#endif /* STACK_DIRECTION undefined */
-#endif /* static */
-#endif /* emacs */
+#        endif /* STACK_DIRECTION undefined */
+#      endif   /* static */
+#    endif     /* emacs */
 
 
 /* If your stack is a linked list of frames, you have to
 /* If your stack is a linked list of frames, you have to
    provide an "address metric" ADDRESS_FUNCTION macro.  */
    provide an "address metric" ADDRESS_FUNCTION macro.  */
 
 
-#if defined(CRAY) && defined(CRAY_STACKSEG_END)
+#    if defined(CRAY) && defined(CRAY_STACKSEG_END)
     long
     long
     i00afunc();
     i00afunc();
-#define ADDRESS_FUNCTION(arg) (char*)i00afunc(&(arg))
-#else
-#define ADDRESS_FUNCTION(arg) &(arg)
-#endif
+#      define ADDRESS_FUNCTION(arg) (char*)i00afunc(&(arg))
+#    else
+#      define ADDRESS_FUNCTION(arg) &(arg)
+#    endif
 
 
-#if __STDC__
+#    if __STDC__
 typedef void* pointer;
 typedef void* pointer;
-#else
+#    else
 typedef char* pointer;
 typedef char* pointer;
-#endif
+#    endif
 
 
-#ifndef NULL
-#define NULL 0
-#endif
+#    ifndef NULL
+#      define NULL 0
+#    endif
 
 
 /* Different portions of Emacs need to call different versions of
 /* Different portions of Emacs need to call different versions of
    malloc.  The Emacs executable needs alloca to call xmalloc, because
    malloc.  The Emacs executable needs alloca to call xmalloc, because
@@ -86,10 +86,10 @@ typedef char* pointer;
 
 
    Callers below should use malloc.  */
    Callers below should use malloc.  */
 
 
-#ifndef emacs
-#undef malloc
-#define malloc xmalloc
-#endif
+#    ifndef emacs
+#      undef malloc
+#      define malloc xmalloc
+#    endif
 extern pointer malloc();
 extern pointer malloc();
 
 
 /* Define STACK_DIRECTION if you know the direction of stack
 /* Define STACK_DIRECTION if you know the direction of stack
@@ -100,18 +100,18 @@ extern pointer malloc();
    STACK_DIRECTION < 0 => grows toward lower addresses
    STACK_DIRECTION < 0 => grows toward lower addresses
    STACK_DIRECTION = 0 => direction of growth unknown  */
    STACK_DIRECTION = 0 => direction of growth unknown  */
 
 
-#ifndef STACK_DIRECTION
-#define STACK_DIRECTION 0 /* Direction unknown.  */
-#endif
+#    ifndef STACK_DIRECTION
+#      define STACK_DIRECTION 0 /* Direction unknown.  */
+#    endif
 
 
-#if STACK_DIRECTION != 0
+#    if STACK_DIRECTION != 0
 
 
-#define STACK_DIR STACK_DIRECTION /* Known at compile-time.  */
+#      define STACK_DIR STACK_DIRECTION /* Known at compile-time.  */
 
 
-#else /* STACK_DIRECTION == 0; need run-time code.  */
+#    else /* STACK_DIRECTION == 0; need run-time code.  */
 
 
 static int stack_dir; /* 1 or -1 once known.  */
 static int stack_dir; /* 1 or -1 once known.  */
-#define STACK_DIR stack_dir
+#      define STACK_DIR stack_dir
 
 
 static void find_stack_direction()
 static void find_stack_direction()
 {
 {
@@ -132,7 +132,7 @@ static void find_stack_direction()
   }
   }
 }
 }
 
 
-#endif /* STACK_DIRECTION == 0 */
+#    endif /* STACK_DIRECTION == 0 */
 
 
 /* An "alloca header" is used to:
 /* An "alloca header" is used to:
    (a) chain together all alloca'ed blocks;
    (a) chain together all alloca'ed blocks;
@@ -141,9 +141,9 @@ static void find_stack_direction()
    It is very important that sizeof(header) agree with malloc
    It is very important that sizeof(header) agree with malloc
    alignment chunk size.  The following default should work okay.  */
    alignment chunk size.  The following default should work okay.  */
 
 
-#ifndef ALIGN_SIZE
-#define ALIGN_SIZE sizeof(double)
-#endif
+#    ifndef ALIGN_SIZE
+#      define ALIGN_SIZE sizeof(double)
+#    endif
 
 
 typedef union hdr {
 typedef union hdr {
   char align[ALIGN_SIZE]; /* To force sizeof(header).  */
   char align[ALIGN_SIZE]; /* To force sizeof(header).  */
@@ -167,10 +167,10 @@ pointer alloca(size_t size)
   auto char probe; /* Probes stack depth: */
   auto char probe; /* Probes stack depth: */
   register char* depth = ADDRESS_FUNCTION(probe);
   register char* depth = ADDRESS_FUNCTION(probe);
 
 
-#if STACK_DIRECTION == 0
+#    if STACK_DIRECTION == 0
   if (STACK_DIR == 0) /* Unknown growth direction.  */
   if (STACK_DIR == 0) /* Unknown growth direction.  */
     find_stack_direction();
     find_stack_direction();
-#endif
+#    endif
 
 
   /* Reclaim garbage, defined as all alloca'd storage that
   /* Reclaim garbage, defined as all alloca'd storage that
      was allocated from deeper in the stack than currently.  */
      was allocated from deeper in the stack than currently.  */
@@ -178,9 +178,9 @@ pointer alloca(size_t size)
   {
   {
     register header* hp; /* Traverses linked list.  */
     register header* hp; /* Traverses linked list.  */
 
 
-#ifdef emacs
+#    ifdef emacs
     BLOCK_INPUT;
     BLOCK_INPUT;
-#endif
+#    endif
 
 
     for (hp = last_alloca_header; hp != NULL;)
     for (hp = last_alloca_header; hp != NULL;)
       if ((STACK_DIR > 0 && hp->h.deep > depth) ||
       if ((STACK_DIR > 0 && hp->h.deep > depth) ||
@@ -196,9 +196,9 @@ pointer alloca(size_t size)
 
 
     last_alloca_header = hp; /* -> last valid storage.  */
     last_alloca_header = hp; /* -> last valid storage.  */
 
 
-#ifdef emacs
+#    ifdef emacs
     UNBLOCK_INPUT;
     UNBLOCK_INPUT;
-#endif
+#    endif
   }
   }
 
 
   if (size == 0)
   if (size == 0)
@@ -224,15 +224,15 @@ pointer alloca(size_t size)
   }
   }
 }
 }
 
 
-#if defined(CRAY) && defined(CRAY_STACKSEG_END)
+#    if defined(CRAY) && defined(CRAY_STACKSEG_END)
 
 
-#ifdef DEBUG_I00AFUNC
-#include <stdio.h>
-#endif
+#      ifdef DEBUG_I00AFUNC
+#        include <stdio.h>
+#      endif
 
 
-#ifndef CRAY_STACK
-#define CRAY_STACK
-#ifndef CRAY2
+#      ifndef CRAY_STACK
+#        define CRAY_STACK
+#        ifndef CRAY2
 /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
 /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
 struct stack_control_header {
 struct stack_control_header {
   long shgrow : 32; /* Number of times stack has grown.  */
   long shgrow : 32; /* Number of times stack has grown.  */
@@ -282,7 +282,7 @@ struct stack_segment_linkage {
   long sss7;
   long sss7;
 };
 };
 
 
-#else /* CRAY2 */
+#        else /* CRAY2 */
 /* The following structure defines the vector of words
 /* The following structure defines the vector of words
    returned by the STKSTAT library routine.  */
    returned by the STKSTAT library routine.  */
 struct stk_stat {
 struct stk_stat {
@@ -333,10 +333,10 @@ struct stk_trailer {
   long unknown14;
   long unknown14;
 };
 };
 
 
-#endif /* CRAY2 */
-#endif /* not CRAY_STACK */
+#        endif /* CRAY2 */
+#      endif   /* not CRAY_STACK */
 
 
-#ifdef CRAY2
+#      ifdef CRAY2
 /* Determine a "stack measure" for an arbitrary ADDRESS.
 /* Determine a "stack measure" for an arbitrary ADDRESS.
    I doubt that "lint" will like this much.  */
    I doubt that "lint" will like this much.  */
 
 
@@ -401,7 +401,7 @@ static long i00afunc(long* address)
   return (result);
   return (result);
 }
 }
 
 
-#else /* not CRAY2 */
+#      else /* not CRAY2 */
 /* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
 /* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
    Determine the number of the cell within the stack,
    Determine the number of the cell within the stack,
    given the address of the cell.  The purpose of this
    given the address of the cell.  The purpose of this
@@ -444,9 +444,9 @@ static long i00afunc(long address)
      contain the target address.  */
      contain the target address.  */
 
 
   while (!(this_segment <= address && address <= stkl)) {
   while (!(this_segment <= address && address <= stkl)) {
-#ifdef DEBUG_I00AFUNC
+#        ifdef DEBUG_I00AFUNC
     fprintf(stderr, "%011o %011o %011o\n", this_segment, address, stkl);
     fprintf(stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#endif
+#        endif
     if (pseg == 0)
     if (pseg == 0)
       break;
       break;
     stkl = stkl - pseg;
     stkl = stkl - pseg;
@@ -464,9 +464,9 @@ static long i00afunc(long address)
      a cycle somewhere.  */
      a cycle somewhere.  */
 
 
   while (pseg != 0) {
   while (pseg != 0) {
-#ifdef DEBUG_I00AFUNC
+#        ifdef DEBUG_I00AFUNC
     fprintf(stderr, "%011o %011o\n", pseg, size);
     fprintf(stderr, "%011o %011o\n", pseg, size);
-#endif
+#        endif
     stkl = stkl - pseg;
     stkl = stkl - pseg;
     ssptr = (struct stack_segment_linkage*)stkl;
     ssptr = (struct stack_segment_linkage*)stkl;
     size = ssptr->sssize;
     size = ssptr->sssize;
@@ -476,8 +476,8 @@ static long i00afunc(long address)
   return (result);
   return (result);
 }
 }
 
 
-#endif /* not CRAY2 */
-#endif /* CRAY */
+#      endif /* not CRAY2 */
+#    endif   /* CRAY */
 
 
-#endif /* no alloca */
-#endif /* not GCC version 2 */
+#  endif /* no alloca */
+#endif   /* not GCC version 2 */

+ 1 - 1
src/aria2api.cc

@@ -63,7 +63,7 @@
 #include "Notifier.h"
 #include "Notifier.h"
 #include "ApiCallbackDownloadEventListener.h"
 #include "ApiCallbackDownloadEventListener.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
+#  include "bittorrent_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {

+ 2 - 2
src/asctime_r.c

@@ -37,8 +37,8 @@
 #include <stdlib.h>
 #include <stdlib.h>
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #include "asctime_r.h"
 #include "asctime_r.h"

+ 28 - 28
src/common.h

@@ -36,34 +36,34 @@
 #define D_COMMON_H
 #define D_COMMON_H
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#  include "config.h"
 #endif
 #endif
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#ifdef malloc
-#undef malloc
-#endif
-#ifdef realloc
-#undef realloc
-#endif
+#  ifdef malloc
+#    undef malloc
+#  endif
+#  ifdef realloc
+#    undef realloc
+#  endif
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#define WIN32_LEAN_AND_MEAN
-#ifndef WINVER
-#define WINVER 0x501
-#endif // !WINVER
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x501
-#endif // _WIN32_WINNT
-#ifdef HAVE_WINSOCK2_H
-#ifndef FD_SETSIZE
-#define FD_SETSIZE 32768
-#endif // !FD_SETSIZE
-#include <winsock2.h>
-#undef ERROR
-#endif // HAVE_WINSOCK2_H
-#include <windows.h>
+#  define WIN32_LEAN_AND_MEAN
+#  ifndef WINVER
+#    define WINVER 0x501
+#  endif // !WINVER
+#  ifndef _WIN32_WINNT
+#    define _WIN32_WINNT 0x501
+#  endif // _WIN32_WINNT
+#  ifdef HAVE_WINSOCK2_H
+#    ifndef FD_SETSIZE
+#      define FD_SETSIZE 32768
+#    endif // !FD_SETSIZE
+#    include <winsock2.h>
+#    undef ERROR
+#  endif // HAVE_WINSOCK2_H
+#  include <windows.h>
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #ifdef ENABLE_NLS
 #ifdef ENABLE_NLS
@@ -75,27 +75,27 @@
 // it is defined as non-function form, this causes compile error. User
 // it is defined as non-function form, this causes compile error. User
 // reported gcc-4.2.2 has this problem. But gcc-4.4.5 does not suffer
 // reported gcc-4.2.2 has this problem. But gcc-4.4.5 does not suffer
 // from this problem.
 // from this problem.
-#include <gettext.h>
-#define _(String) gettext(String)
+#  include <gettext.h>
+#  define _(String) gettext(String)
 #else // ENABLE_NLS
 #else // ENABLE_NLS
-#define _(String) String
+#  define _(String) String
 #endif
 #endif
 
 
 // use C99 limit macros
 // use C99 limit macros
 #define __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS
 // included here for compatibility issues with old compiler/libraries.
 // included here for compatibility issues with old compiler/libraries.
 #ifdef HAVE_STDINT_H
 #ifdef HAVE_STDINT_H
-#include <stdint.h>
+#  include <stdint.h>
 #endif // HAVE_STDINT_H
 #endif // HAVE_STDINT_H
 
 
 // For PRId64
 // For PRId64
 #define __STDC_FORMAT_MACROS
 #define __STDC_FORMAT_MACROS
 #ifdef HAVE_INTTYPES_H
 #ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
+#  include <inttypes.h>
 #endif // HAVE_INTTYPES_H
 #endif // HAVE_INTTYPES_H
 
 
 #ifdef HAVE_SYS_TYPES_H
 #ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
+#  include <sys/types.h>
 #endif
 #endif
 
 
 #endif // D_COMMON_H
 #endif // D_COMMON_H

+ 2 - 2
src/console.cc

@@ -35,9 +35,9 @@
 #include "console.h"
 #include "console.h"
 #include "NullOutputFile.h"
 #include "NullOutputFile.h"
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#include "WinConsoleFile.h"
+#  include "WinConsoleFile.h"
 #else // !__MINGW32__
 #else // !__MINGW32__
-#include "BufferedFile.h"
+#  include "BufferedFile.h"
 #endif // !__MINGW32__
 #endif // !__MINGW32__
 
 
 namespace aria2 {
 namespace aria2 {

+ 16 - 16
src/crypto_endian.h

@@ -12,11 +12,11 @@
 namespace crypto {
 namespace crypto {
 
 
 #if defined(__GNUG__)
 #if defined(__GNUG__)
-#define forceinline __attribute__((always_inline)) inline
+#  define forceinline __attribute__((always_inline)) inline
 #elif defined(_MSC_VER)
 #elif defined(_MSC_VER)
-#define forceinline __forceinline
+#  define forceinline __forceinline
 #else // ! _MSC_VER
 #else // ! _MSC_VER
-#define forceinline inline
+#  define forceinline inline
 #endif // ! _MSC_VER
 #endif // ! _MSC_VER
 
 
 /* In order for this implementation to work your system (or you yourself) must
 /* In order for this implementation to work your system (or you yourself) must
@@ -29,18 +29,18 @@ namespace crypto {
  */
  */
 #if defined(_WIN32) || defined(__INTEL_COMPILER) || defined(_MSC_VER)
 #if defined(_WIN32) || defined(__INTEL_COMPILER) || defined(_MSC_VER)
 // Itanium is dead!
 // Itanium is dead!
-#define LITTLE_ENDIAN 1234
-#define BIG_ENDIAN 4321
-#define BYTE_ORDER LITTLE_ENDIAN
+#  define LITTLE_ENDIAN 1234
+#  define BIG_ENDIAN 4321
+#  define BYTE_ORDER LITTLE_ENDIAN
 #else // !  defined(_WIN32) || defined(__INTEL_COMPILER) || defined (_MSC_VER)
 #else // !  defined(_WIN32) || defined(__INTEL_COMPILER) || defined (_MSC_VER)
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif // HAVE_SYS_PARAM_H
+#  ifdef HAVE_SYS_PARAM_H
+#    include <sys/param.h>
+#  endif // HAVE_SYS_PARAM_H
 #endif // !  defined(_WIN32) || defined(__INTEL_COMPILER) || defined (_MSC_VER)
 #endif // !  defined(_WIN32) || defined(__INTEL_COMPILER) || defined (_MSC_VER)
 
 
 #if !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN) || !defined(BYTE_ORDER) || \
 #if !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN) || !defined(BYTE_ORDER) || \
     (LITTLE_ENDIAN != BYTE_ORDER && BIG_ENDIAN != BYTE_ORDER)
     (LITTLE_ENDIAN != BYTE_ORDER && BIG_ENDIAN != BYTE_ORDER)
-#error Unsupported byte order/endianness
+#  error Unsupported byte order/endianness
 #endif
 #endif
 
 
 // Lets spend some quality time mucking around with byte swap and endian-ness.
 // Lets spend some quality time mucking around with byte swap and endian-ness.
@@ -52,7 +52,7 @@ forceinline uint32_t __crypto_bswap32(uint32_t p)
   return p;
   return p;
 }
 }
 #elif defined(__GNUG__)
 #elif defined(__GNUG__)
-#define __crypto_bswap32 __builtin_bswap32
+#  define __crypto_bswap32 __builtin_bswap32
 #else  // defined(__GNUG__)
 #else  // defined(__GNUG__)
 forceinline uint32_t __crypto_bswap32(uint32_t n)
 forceinline uint32_t __crypto_bswap32(uint32_t n)
 {
 {
@@ -69,7 +69,7 @@ forceinline uint64_t __crypto_bswap64(uint64_t p)
   return p;
   return p;
 }
 }
 #elif defined(__GNUG__)
 #elif defined(__GNUG__)
-#define __crypto_bswap64 __builtin_bswap64
+#  define __crypto_bswap64 __builtin_bswap64
 #else  // defined(__GNUG__)
 #else  // defined(__GNUG__)
 forceinline uint64_t __crypto_bswap64(uint64_t n)
 forceinline uint64_t __crypto_bswap64(uint64_t n)
 {
 {
@@ -99,11 +99,11 @@ template <> inline uint64_t __crypto_bswap(uint64_t n)
 
 
 // __crypto_le and __crypto_be depending on byte order
 // __crypto_le and __crypto_be depending on byte order
 #if LITTLE_ENDIAN == BYTE_ORDER
 #if LITTLE_ENDIAN == BYTE_ORDER
-#define __crypto_be(n) __crypto_bswap(n)
-#define __crypto_le(n) (n)
+#  define __crypto_be(n) __crypto_bswap(n)
+#  define __crypto_le(n) (n)
 #else // LITTLE_ENDIAN != WORD_ORDER
 #else // LITTLE_ENDIAN != WORD_ORDER
-#define __crypto_be(n) (n)
-#define __crypto_le(n) __crypto_bswap(n)
+#  define __crypto_be(n) (n)
+#  define __crypto_le(n) __crypto_bswap(n)
 #endif // LITTLE_ENDIAN != WORD_ORDER
 #endif // LITTLE_ENDIAN != WORD_ORDER
 
 
 } // namespace crypto
 } // namespace crypto

+ 6 - 6
src/crypto_hash.cc

@@ -12,11 +12,11 @@
 
 
 // Compiler hints
 // Compiler hints
 #if defined(__GNUG__)
 #if defined(__GNUG__)
-#define likely(x) __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
+#  define likely(x) __builtin_expect(!!(x), 1)
+#  define unlikely(x) __builtin_expect(!!(x), 0)
 #else // ! __GNUG_
 #else // ! __GNUG_
-#define likely(x) (x)
-#define unlikely(x) (x)
+#  define likely(x) (x)
+#  define unlikely(x) (x)
 #endif // ! __GNUG__
 #endif // ! __GNUG__
 
 
 // Basic operations
 // Basic operations
@@ -52,9 +52,9 @@ template <typename T> static forceinline T par(T b, T c, T d)
 }
 }
 
 
 #ifdef __GNUG__
 #ifdef __GNUG__
-#define __hash_maybe_memfence __asm__("" ::: "memory")
+#  define __hash_maybe_memfence __asm__("" ::: "memory")
 #else // __GNUG__
 #else // __GNUG__
-#define __hash_maybe_memfence
+#  define __hash_maybe_memfence
 #endif // __GNUG__
 #endif // __GNUG__
 
 
 // Template for the |::transform|s
 // Template for the |::transform|s

+ 4 - 4
src/download_handlers.cc

@@ -38,12 +38,12 @@
 #include "MemoryBufferPreDownloadHandler.h"
 #include "MemoryBufferPreDownloadHandler.h"
 #include "a2functional.h"
 #include "a2functional.h"
 #ifdef ENABLE_METALINK
 #ifdef ENABLE_METALINK
-#include "MetalinkPostDownloadHandler.h"
+#  include "MetalinkPostDownloadHandler.h"
 #endif // ENABLE_METALINK
 #endif // ENABLE_METALINK
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "BtPostDownloadHandler.h"
-#include "MemoryBencodePreDownloadHandler.h"
-#include "UTMetadataPostDownloadHandler.h"
+#  include "BtPostDownloadHandler.h"
+#  include "MemoryBencodePreDownloadHandler.h"
+#  include "UTMetadataPostDownloadHandler.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {

+ 3 - 3
src/download_helper.cc

@@ -64,9 +64,9 @@
 #include "download_handlers.h"
 #include "download_handlers.h"
 #include "SimpleRandomizer.h"
 #include "SimpleRandomizer.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
-#include "BtConstants.h"
-#include "ValueBaseBencodeParser.h"
+#  include "bittorrent_helper.h"
+#  include "BtConstants.h"
+#  include "ValueBaseBencodeParser.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {

+ 10 - 10
src/gai_strerror.c

@@ -29,20 +29,20 @@
 #include "gai_strerror.h"
 #include "gai_strerror.h"
 
 
 #ifdef ENABLE_NLS
 #ifdef ENABLE_NLS
-#include <libintl.h>
+#  include <libintl.h>
 #endif
 #endif
 
 
 #ifdef ENABLE_NLS
 #ifdef ENABLE_NLS
-#define _(string) gettext(string)
-#ifdef gettext_noop
-#define N_(string) gettext_noop(string)
+#  define _(string) gettext(string)
+#  ifdef gettext_noop
+#    define N_(string) gettext_noop(string)
+#  else
+#    define N_(string) (string)
+#  endif
 #else
 #else
-#define N_(string) (string)
-#endif
-#else
-#define gettext(string) (string)
-#define _(string) (string)
-#define N_(string) (string)
+#  define gettext(string) (string)
+#  define _(string) (string)
+#  define N_(string) (string)
 #endif
 #endif
 
 
 /*
 /*

+ 4 - 4
src/gai_strerror.h

@@ -34,15 +34,15 @@ extern "C" {
 #endif /* __cplusplus */
 #endif /* __cplusplus */
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#undef SIZE_MAX
+#  undef SIZE_MAX
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #ifndef EAI_SYSTEM
 #ifndef EAI_SYSTEM
-#define EAI_SYSTEM -11 /* System error returned in `errno'.  */
+#  define EAI_SYSTEM -11 /* System error returned in `errno'.  */
 #endif
 #endif
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#  include "config.h"
 #endif // HAVE_CONFIG_H
 #endif // HAVE_CONFIG_H
 
 
 /*
 /*
@@ -50,7 +50,7 @@ extern "C" {
  * <netdb.h> might declares all or some of them.
  * <netdb.h> might declares all or some of them.
  */
  */
 #if defined(HAVE_GAI_STRERROR)
 #if defined(HAVE_GAI_STRERROR)
-#define gai_strerror my_gai_strerror
+#  define gai_strerror my_gai_strerror
 #endif
 #endif
 
 
 /*
 /*

+ 31 - 31
src/getaddrinfo.c

@@ -76,66 +76,66 @@
  */
  */
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#  include "config.h"
 #endif
 #endif
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#include <winsock2.h>
-#undef ERROR
-#include <ws2tcpip.h>
+#  include <winsock2.h>
+#  undef ERROR
+#  include <ws2tcpip.h>
 #endif
 #endif
 
 
 #ifdef HAVE_SYS_SOCKET_H
 #ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
+#  include <sys/socket.h>
 #endif
 #endif
 #ifdef HAVE_NETINET_IN_H
 #ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
+#  include <netinet/in.h>
 #endif
 #endif
 #ifdef HAVE_ARPA_INET_H
 #ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
+#  include <arpa/inet.h>
 #endif
 #endif
 #ifdef HAVE_NETDB_H
 #ifdef HAVE_NETDB_H
-#include <netdb.h>
+#  include <netdb.h>
 #endif
 #endif
 
 
 #include <sys/types.h>
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
 #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
 #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
-#include <string.h>
-#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
-#include <memory.h>
-#endif /* not STDC_HEADERS and HAVE_MEMORY_H */
-#else  /* not STDC_HEADERS and not HAVE_STRING_H */
-#include <strings.h>
+#  include <string.h>
+#  if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
+#    include <memory.h>
+#  endif /* not STDC_HEADERS and HAVE_MEMORY_H */
+#else    /* not STDC_HEADERS and not HAVE_STRING_H */
+#  include <strings.h>
 #endif /* not STDC_HEADERS and not HAVE_STRING_H */
 #endif /* not STDC_HEADERS and not HAVE_STRING_H */
 
 
 #ifdef HAVE_STDLIB_H
 #ifdef HAVE_STDLIB_H
-#include <stdlib.h>
+#  include <stdlib.h>
 #endif
 #endif
 
 
 #ifdef ENABLE_PTHREAD
 #ifdef ENABLE_PTHREAD
-#include <pthread.h>
+#  include <pthread.h>
 #endif
 #endif
 
 
 #ifdef ENABLE_NLS
 #ifdef ENABLE_NLS
-#include <libintl.h>
+#  include <libintl.h>
 #endif
 #endif
 
 
 #ifndef HAVE_MEMCPY
 #ifndef HAVE_MEMCPY
-#define memcpy(d, s, n) bcopy((s), (d), (n))
-#ifdef __STDC__
+#  define memcpy(d, s, n) bcopy((s), (d), (n))
+#  ifdef __STDC__
 void* memchr(const void*, int, size_t);
 void* memchr(const void*, int, size_t);
 int memcmp(const void*, const void*, size_t);
 int memcmp(const void*, const void*, size_t);
 void* memmove(void*, const void*, size_t);
 void* memmove(void*, const void*, size_t);
 void* memset(void*, int, size_t);
 void* memset(void*, int, size_t);
-#else  /* not __STDC__ */
+#  else  /* not __STDC__ */
 char* memchr();
 char* memchr();
 int memcmp();
 int memcmp();
 char* memmove();
 char* memmove();
 char* memset();
 char* memset();
-#endif /* not __STDC__ */
-#endif /* not HAVE_MEMCPY */
+#  endif /* not __STDC__ */
+#endif   /* not HAVE_MEMCPY */
 
 
 #ifndef H_ERRNO_DECLARED
 #ifndef H_ERRNO_DECLARED
 extern int h_errno;
 extern int h_errno;
@@ -144,16 +144,16 @@ extern int h_errno;
 #include "getaddrinfo.h"
 #include "getaddrinfo.h"
 
 
 #ifdef ENABLE_NLS
 #ifdef ENABLE_NLS
-#define _(string) gettext(string)
-#ifdef gettext_noop
-#define N_(string) gettext_noop(string)
-#else
-#define N_(string) (string)
-#endif
+#  define _(string) gettext(string)
+#  ifdef gettext_noop
+#    define N_(string) gettext_noop(string)
+#  else
+#    define N_(string) (string)
+#  endif
 #else
 #else
-#define gettext(string) (string)
-#define _(string) (string)
-#define N_(string) (string)
+#  define gettext(string) (string)
+#  define _(string) (string)
+#  define N_(string) (string)
 #endif
 #endif
 
 
 /*
 /*

+ 68 - 68
src/getaddrinfo.h

@@ -34,27 +34,27 @@ extern "C" {
 #endif /* __cplusplus */
 #endif /* __cplusplus */
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#undef SIZE_MAX
+#  undef SIZE_MAX
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#  include "config.h"
 #endif // HAVE_CONFIG_H
 #endif // HAVE_CONFIG_H
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x501
-#endif // _WIN32_WINNT
-#include <winsock2.h>
-#undef ERROR
-#include <ws2tcpip.h>
+#  ifndef _WIN32_WINNT
+#    define _WIN32_WINNT 0x501
+#  endif // _WIN32_WINNT
+#  include <winsock2.h>
+#  undef ERROR
+#  include <ws2tcpip.h>
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #ifdef HAVE_SYS_SOCKET_H
 #ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
+#  include <sys/socket.h>
 #endif // HAVE_SYS_SOCKET_H
 #endif // HAVE_SYS_SOCKET_H
 #ifdef HAVE_NETDB_H
 #ifdef HAVE_NETDB_H
-#include <netdb.h>
+#  include <netdb.h>
 #endif // HAVE_NETDB_H
 #endif // HAVE_NETDB_H
 
 
 #include <sys/types.h>
 #include <sys/types.h>
@@ -65,88 +65,88 @@ extern "C" {
  * <netdb.h> might defines some of them.
  * <netdb.h> might defines some of them.
  */
  */
 #ifdef EAI_ADDRFAMILY
 #ifdef EAI_ADDRFAMILY
-#undef EAI_ADDRFAMILY
+#  undef EAI_ADDRFAMILY
 #endif
 #endif
 #ifdef EAI_AGAIN
 #ifdef EAI_AGAIN
-#undef EAI_AGAIN
+#  undef EAI_AGAIN
 #endif
 #endif
 #ifdef EAI_BADFLAGS
 #ifdef EAI_BADFLAGS
-#undef EAI_BADFLAGS
+#  undef EAI_BADFLAGS
 #endif
 #endif
 #ifdef EAI_FAIL
 #ifdef EAI_FAIL
-#undef EAI_FAIL
+#  undef EAI_FAIL
 #endif
 #endif
 #ifdef EAI_FAMILY
 #ifdef EAI_FAMILY
-#undef EAI_FAMILY
+#  undef EAI_FAMILY
 #endif
 #endif
 #ifdef EAI_MEMORY
 #ifdef EAI_MEMORY
-#undef EAI_MEMORY
+#  undef EAI_MEMORY
 #endif
 #endif
 #ifdef EAI_NONAME
 #ifdef EAI_NONAME
-#undef EAI_NONAME
+#  undef EAI_NONAME
 #endif
 #endif
 #ifdef EAI_OVERFLOW
 #ifdef EAI_OVERFLOW
-#undef EAI_OVERFLOW
+#  undef EAI_OVERFLOW
 #endif
 #endif
 #ifdef EAI_SERVICE
 #ifdef EAI_SERVICE
-#undef EAI_SERVICE
+#  undef EAI_SERVICE
 #endif
 #endif
 #ifdef EAI_SOCKTYPE
 #ifdef EAI_SOCKTYPE
-#undef EAI_SOCKTYPE
+#  undef EAI_SOCKTYPE
 #endif
 #endif
 #ifdef EAI_SYSTEM
 #ifdef EAI_SYSTEM
-#undef EAI_SYSTEM
+#  undef EAI_SYSTEM
 #endif
 #endif
 
 
 #ifdef AI_PASSIVE
 #ifdef AI_PASSIVE
-#undef AI_PASSIVE
+#  undef AI_PASSIVE
 #endif
 #endif
 #ifdef AI_CANONNAME
 #ifdef AI_CANONNAME
-#undef AI_CANONNAME
+#  undef AI_CANONNAME
 #endif
 #endif
 #ifdef AI_NUMERICHOST
 #ifdef AI_NUMERICHOST
-#undef AI_NUMERICHOST
+#  undef AI_NUMERICHOST
 #endif
 #endif
 #ifdef AI_NUMERICSERV
 #ifdef AI_NUMERICSERV
-#undef AI_NUMERICSERV
+#  undef AI_NUMERICSERV
 #endif
 #endif
 #ifdef AI_V4MAPPED
 #ifdef AI_V4MAPPED
-#undef AI_V4MAPPED
+#  undef AI_V4MAPPED
 #endif
 #endif
 #ifdef AI_ALL
 #ifdef AI_ALL
-#undef AI_ALL
+#  undef AI_ALL
 #endif
 #endif
 #ifdef AI_ADDRCONFIG
 #ifdef AI_ADDRCONFIG
-#undef AI_ADDRCONFIG
+#  undef AI_ADDRCONFIG
 #endif
 #endif
 #ifdef AI_DEFAULT
 #ifdef AI_DEFAULT
-#undef AI_DEFAULT
+#  undef AI_DEFAULT
 #endif
 #endif
 
 
 #ifdef NI_NOFQDN
 #ifdef NI_NOFQDN
-#undef NI_NOFQDN
+#  undef NI_NOFQDN
 #endif
 #endif
 #ifdef NI_NUMERICHOST
 #ifdef NI_NUMERICHOST
-#undef NI_NUMERICHOST
+#  undef NI_NUMERICHOST
 #endif
 #endif
 #ifdef NI_NAMEREQD
 #ifdef NI_NAMEREQD
-#undef NI_NAMEREQD
+#  undef NI_NAMEREQD
 #endif
 #endif
 #ifdef NI_NUMERICSERV
 #ifdef NI_NUMERICSERV
-#undef NI_NUMERICSERV
+#  undef NI_NUMERICSERV
 #endif
 #endif
 #ifdef NI_NUMERICSCOPE
 #ifdef NI_NUMERICSCOPE
-#undef NI_NUMERICSCOPE
+#  undef NI_NUMERICSCOPE
 #endif
 #endif
 
 
 #ifdef NI_DGRAM
 #ifdef NI_DGRAM
-#undef NI_DGRAM
+#  undef NI_DGRAM
 #endif
 #endif
 #ifdef NI_MAXHOST
 #ifdef NI_MAXHOST
-#undef NI_MAXHOST
+#  undef NI_MAXHOST
 #endif
 #endif
 #ifdef NI_MAXSERV
 #ifdef NI_MAXSERV
-#undef NI_MAXSERV
+#  undef NI_MAXSERV
 #endif
 #endif
 
 
 /*
 /*
@@ -154,11 +154,11 @@ extern "C" {
  * <netdb.h> might declares all or some of them.
  * <netdb.h> might declares all or some of them.
  */
  */
 #if defined(HAVE_GETADDRINFO) || defined(HAVE_GETNAMEINFO)
 #if defined(HAVE_GETADDRINFO) || defined(HAVE_GETNAMEINFO)
-#define addrinfo my_addrinfo
-#define gai_strerror my_gai_strerror
-#define freeaddrinfo my_freeaddrinfo
-#define getaddrinfo my_getaddrinfo
-#define getnameinfo my_getnameinfo
+#  define addrinfo my_addrinfo
+#  define gai_strerror my_gai_strerror
+#  define freeaddrinfo my_freeaddrinfo
+#  define getaddrinfo my_getaddrinfo
+#  define getnameinfo my_getnameinfo
 #endif
 #endif
 
 
 /* <from linux's netdb.h> */
 /* <from linux's netdb.h> */
@@ -172,17 +172,17 @@ extern "C" {
   0x0020 /* Use configuration of this host to choose                           \
   0x0020 /* Use configuration of this host to choose                           \
             returned address type..  */
             returned address type..  */
 #ifdef __USE_GNU
 #ifdef __USE_GNU
-#define AI_IDN                                                                 \
-  0x0040                   /* IDN encode input (assuming it is encoded         \
-                              in the current locale's character set)           \
-                              before looking it up. */
-#define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
-#define AI_IDN_ALLOW_UNASSIGNED                                                \
-  0x0100 /* Don't reject unassigned Unicode                                    \
-            code points.  */
-#define AI_IDN_USE_STD3_ASCII_RULES                                            \
-  0x0200 /* Validate strings according to                                      \
-            STD3 rules.  */
+#  define AI_IDN                                                               \
+    0x0040                   /* IDN encode input (assuming it is encoded       \
+                                in the current locale's character set)         \
+                                before looking it up. */
+#  define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
+#  define AI_IDN_ALLOW_UNASSIGNED                                              \
+    0x0100 /* Don't reject unassigned Unicode                                  \
+              code points.  */
+#  define AI_IDN_USE_STD3_ASCII_RULES                                          \
+    0x0200 /* Validate strings according to                                    \
+              STD3 rules.  */
 #endif
 #endif
 #define AI_NUMERICSERV 0x0400 /* Don't use name resolution.  */
 #define AI_NUMERICSERV 0x0400 /* Don't use name resolution.  */
 
 
@@ -200,12 +200,12 @@ extern "C" {
 #define EAI_SYSTEM -11    /* System error returned in `errno'.  */
 #define EAI_SYSTEM -11    /* System error returned in `errno'.  */
 #define EAI_OVERFLOW -12  /* Argument buffer overflow.  */
 #define EAI_OVERFLOW -12  /* Argument buffer overflow.  */
 #ifdef __USE_GNU
 #ifdef __USE_GNU
-#define EAI_INPROGRESS -100  /* Processing request in progress.  */
-#define EAI_CANCELED -101    /* Request canceled.  */
-#define EAI_NOTCANCELED -102 /* Request not canceled.  */
-#define EAI_ALLDONE -103     /* All requests done.  */
-#define EAI_INTR -104        /* Interrupted by a signal.  */
-#define EAI_IDN_ENCODE -105  /* IDN encoding failed.  */
+#  define EAI_INPROGRESS -100  /* Processing request in progress.  */
+#  define EAI_CANCELED -101    /* Request canceled.  */
+#  define EAI_NOTCANCELED -102 /* Request not canceled.  */
+#  define EAI_ALLDONE -103     /* All requests done.  */
+#  define EAI_INTR -104        /* Interrupted by a signal.  */
+#  define EAI_IDN_ENCODE -105  /* IDN encoding failed.  */
 #endif
 #endif
 
 
 #define NI_MAXHOST 1025
 #define NI_MAXHOST 1025
@@ -217,13 +217,13 @@ extern "C" {
 #define NI_NAMEREQD 8    /* Don't return numeric addresses.  */
 #define NI_NAMEREQD 8    /* Don't return numeric addresses.  */
 #define NI_DGRAM 16      /* Look up UDP service rather than TCP.  */
 #define NI_DGRAM 16      /* Look up UDP service rather than TCP.  */
 #ifdef __USE_GNU
 #ifdef __USE_GNU
-#define NI_IDN 32 /* Convert name from IDN format.  */
-#define NI_IDN_ALLOW_UNASSIGNED                                                \
-  64 /* Don't reject unassigned Unicode                                        \
-        code points.  */
-#define NI_IDN_USE_STD3_ASCII_RULES                                            \
-  128 /* Validate strings according to                                         \
-         STD3 rules.  */
+#  define NI_IDN 32 /* Convert name from IDN format.  */
+#  define NI_IDN_ALLOW_UNASSIGNED                                              \
+    64 /* Don't reject unassigned Unicode                                      \
+          code points.  */
+#  define NI_IDN_USE_STD3_ASCII_RULES                                          \
+    128 /* Validate strings according to                                       \
+           STD3 rules.  */
 #endif
 #endif
 /* </from linux's netdb.h> */
 /* </from linux's netdb.h> */
 
 
@@ -233,10 +233,10 @@ extern "C" {
  * Address families and Protocol families.
  * Address families and Protocol families.
  */
  */
 #ifndef AF_UNSPEC
 #ifndef AF_UNSPEC
-#define AF_UNSPEC AF_INET
+#  define AF_UNSPEC AF_INET
 #endif
 #endif
 #ifndef PF_UNSPEC
 #ifndef PF_UNSPEC
-#define PF_UNSPEC PF_INET
+#  define PF_UNSPEC PF_INET
 #endif
 #endif
 
 
 /* Nexenta OS(GNU/Solaris OS) defines `struct addrinfo' in netdb.h */
 /* Nexenta OS(GNU/Solaris OS) defines `struct addrinfo' in netdb.h */

+ 3 - 3
src/gettimeofday.c

@@ -27,11 +27,11 @@
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
 
 
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
 
 
 /* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
 /* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
-#define _W32_FT_OFFSET (116444736000000000ULL)
+#  define _W32_FT_OFFSET (116444736000000000ULL)
 
 
 int __cdecl gettimeofday(struct timeval* __restrict__ tp,
 int __cdecl gettimeofday(struct timeval* __restrict__ tp,
                          void* __restrict__ tzp __attribute__((unused)))
                          void* __restrict__ tzp __attribute__((unused)))

+ 2 - 2
src/gettimeofday.h

@@ -37,11 +37,11 @@
 #define _D_GETTIMEOFDAY_H 1
 #define _D_GETTIMEOFDAY_H 1
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#undef SIZE_MAX
+#  undef SIZE_MAX
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#  include "config.h"
 #endif // HAVE_CONFIG_H
 #endif // HAVE_CONFIG_H
 
 
 #include <sys/time.h>
 #include <sys/time.h>

+ 2 - 2
src/libgen.c

@@ -38,9 +38,9 @@
 #include <libgen.h>
 #include <libgen.h>
 
 
 #if defined(__CYGWIN__) || defined(__DJGPP__) || defined(__MINGW32__)
 #if defined(__CYGWIN__) || defined(__DJGPP__) || defined(__MINGW32__)
-#define IS_PATH_SEPARATOR(c) (((c) == '/') || ((c) == '\\'))
+#  define IS_PATH_SEPARATOR(c) (((c) == '/') || ((c) == '\\'))
 #else
 #else
-#define IS_PATH_SEPARATOR(c) ((c) == '/')
+#  define IS_PATH_SEPARATOR(c) ((c) == '/')
 #endif
 #endif
 
 
 /* per http://www.scit.wlv.ac.uk/cgi-bin/mansec?3C+basename */
 /* per http://www.scit.wlv.ac.uk/cgi-bin/mansec?3C+basename */

+ 2 - 2
src/libssl_compat.h

@@ -38,9 +38,9 @@
 #include <openssl/opensslv.h>
 #include <openssl/opensslv.h>
 
 
 #if defined(LIBRESSL_VERSION_NUMBER)
 #if defined(LIBRESSL_VERSION_NUMBER)
-#define LIBRESSL_IN_USE 1
+#  define LIBRESSL_IN_USE 1
 #else // !defined(LIBRESSL_VERSION_NUMBER)
 #else // !defined(LIBRESSL_VERSION_NUMBER)
-#define LIBRESSL_IN_USE 0
+#  define LIBRESSL_IN_USE 0
 #endif // !defined(LIBRESSL_VERSION_NUMBER)
 #endif // !defined(LIBRESSL_VERSION_NUMBER)
 
 
 #define OPENSSL_101_API                                                        \
 #define OPENSSL_101_API                                                        \

+ 2 - 2
src/localtime_r.c

@@ -37,8 +37,8 @@
 #include <stdlib.h>
 #include <stdlib.h>
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #include "localtime_r.h"
 #include "localtime_r.h"

+ 1 - 1
src/main.cc

@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <unistd.h>
 
 
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#include <shellapi.h>
+#  include <shellapi.h>
 #endif // __MINGW32__
 #endif // __MINGW32__
 
 
 #include <aria2/aria2.h>
 #include <aria2/aria2.h>

+ 4 - 4
src/option_processing.cc

@@ -61,7 +61,7 @@
 #include "array_fun.h"
 #include "array_fun.h"
 #include "LogFactory.h"
 #include "LogFactory.h"
 #ifndef HAVE_DAEMON
 #ifndef HAVE_DAEMON
-#include "daemon.h"
+#  include "daemon.h"
 #endif // !HAVE_DAEMON
 #endif // !HAVE_DAEMON
 
 
 namespace aria2 {
 namespace aria2 {
@@ -322,12 +322,12 @@ error_code::Value option_processing(Option& op, bool standalone,
 #if defined(__GNUC__) && defined(__APPLE__)
 #if defined(__GNUC__) && defined(__APPLE__)
 // daemon() is deprecated on OSX since... forever.
 // daemon() is deprecated on OSX since... forever.
 // Silence the warning for good, so that -Werror becomes feasible.
 // Silence the warning for good, so that -Werror becomes feasible.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif // defined(__GNUC__) && defined(__APPLE__)
 #endif // defined(__GNUC__) && defined(__APPLE__)
     const auto daemonized = daemon(0, 0);
     const auto daemonized = daemon(0, 0);
 #if defined(__GNUC__) && defined(__APPLE__)
 #if defined(__GNUC__) && defined(__APPLE__)
-#pragma GCC diagnostic pop
+#  pragma GCC diagnostic pop
 #endif // defined(__GNUC__) && defined(__APPLE__)
 #endif // defined(__GNUC__) && defined(__APPLE__)
 
 
     if (daemonized < 0) {
     if (daemonized < 0) {

+ 5 - 5
src/strptime.c

@@ -31,15 +31,15 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
 
 
 #ifndef HAVE_CONFIG_H
 #ifndef HAVE_CONFIG_H
-#include "config.h"
+#  include "config.h"
 #endif // HAVE_CONFIG_H
 #endif // HAVE_CONFIG_H
 
 
 #ifndef HAVE_LOCALTIME_R
 #ifndef HAVE_LOCALTIME_R
-#include "localtime_r.h"
+#  include "localtime_r.h"
 #endif // HAVE_LOCALTIME_R
 #endif // HAVE_LOCALTIME_R
 
 
 #ifndef HAVE_TIMEGM
 #ifndef HAVE_TIMEGM
-#include "timegm.h"
+#  include "timegm.h"
 #endif // HAVE_TIMEGM
 #endif // HAVE_TIMEGM
 
 
 #include <stddef.h>
 #include <stddef.h>
@@ -50,11 +50,11 @@
 #include <stdlib.h>
 #include <stdlib.h>
 
 
 #ifdef HAVE_ALLOCA_H
 #ifdef HAVE_ALLOCA_H
-#include <alloca.h>
+#  include <alloca.h>
 #endif // HAVE_ALLOCA_H
 #endif // HAVE_ALLOCA_H
 
 
 #ifdef HAVE_MALLOC_H
 #ifdef HAVE_MALLOC_H
-#include <malloc.h>
+#  include <malloc.h>
 #endif // HAVE_MALLOC_H
 #endif // HAVE_MALLOC_H
 
 
 #include "strptime.h"
 #include "strptime.h"

+ 1 - 1
src/timegm.h

@@ -35,7 +35,7 @@
 #define D_TIMEGM_H
 #define D_TIMEGM_H
 
 
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#  include "config.h"
 #endif // HAVE_CONFIG_H
 #endif // HAVE_CONFIG_H
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus

+ 17 - 17
src/util.cc

@@ -36,21 +36,21 @@
 
 
 #ifdef __sun
 #ifdef __sun
 // For opensolaris, just include signal.h which includes sys/signal.h
 // For opensolaris, just include signal.h which includes sys/signal.h
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif // HAVE_SIGNAL_H
-#else  // !__sun
-#ifdef HAVE_SYS_SIGNAL_H
-#include <sys/signal.h>
-#endif // HAVE_SYS_SIGNAL_H
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif // HAVE_SIGNAL_H
-#endif // !__sun
+#  ifdef HAVE_SIGNAL_H
+#    include <signal.h>
+#  endif // HAVE_SIGNAL_H
+#else    // !__sun
+#  ifdef HAVE_SYS_SIGNAL_H
+#    include <sys/signal.h>
+#  endif // HAVE_SYS_SIGNAL_H
+#  ifdef HAVE_SIGNAL_H
+#    include <signal.h>
+#  endif // HAVE_SIGNAL_H
+#endif   // !__sun
 
 
 #include <sys/types.h>
 #include <sys/types.h>
 #ifdef HAVE_PWD_H
 #ifdef HAVE_PWD_H
-#include <pwd.h>
+#  include <pwd.h>
 #endif // HAVE_PWD_H
 #endif // HAVE_PWD_H
 
 
 #include <array>
 #include <array>
@@ -91,7 +91,7 @@
 
 
 // For libc6 which doesn't define ULLONG_MAX properly because of broken limits.h
 // For libc6 which doesn't define ULLONG_MAX properly because of broken limits.h
 #ifndef ULLONG_MAX
 #ifndef ULLONG_MAX
-#define ULLONG_MAX 18446744073709551615ULL
+#  define ULLONG_MAX 18446744073709551615ULL
 #endif // ULLONG_MAX
 #endif // ULLONG_MAX
 
 
 namespace aria2 {
 namespace aria2 {
@@ -1749,12 +1749,12 @@ std::string getHomeDir()
   if (p) {
   if (p) {
     return p;
     return p;
   }
   }
-#ifdef HAVE_PWD_H
+#  ifdef HAVE_PWD_H
   auto pw = getpwuid(geteuid());
   auto pw = getpwuid(geteuid());
   if (pw && pw->pw_dir) {
   if (pw && pw->pw_dir) {
     return pw->pw_dir;
     return pw->pw_dir;
   }
   }
-#endif // HAVE_PWD_H
+#  endif // HAVE_PWD_H
   return A2STR::NIL;
   return A2STR::NIL;
 }
 }
 
 
@@ -1894,7 +1894,7 @@ void sleep(long seconds)
 #elif defined(HAVE_USLEEP)
 #elif defined(HAVE_USLEEP)
   ::usleep(seconds * 1000000);
   ::usleep(seconds * 1000000);
 #else
 #else
-#error no sleep function is available (nanosleep?)
+#  error no sleep function is available (nanosleep?)
 #endif
 #endif
 }
 }
 
 
@@ -1935,7 +1935,7 @@ void usleep(long microseconds)
   if (msec)
   if (msec)
     Sleep(msec);
     Sleep(msec);
 #else
 #else
-#error no usleep function is available (nanosleep?)
+#  error no usleep function is available (nanosleep?)
 #endif
 #endif
 }
 }
 
 

+ 4 - 4
src/util.h

@@ -65,11 +65,11 @@
 #include "prefs.h"
 #include "prefs.h"
 
 
 #ifdef ENABLE_SSL
 #ifdef ENABLE_SSL
-#include "TLSContext.h"
+#  include "TLSContext.h"
 #endif // ENABLE_SSL
 #endif // ENABLE_SSL
 
 
 #ifndef HAVE_SIGACTION
 #ifndef HAVE_SIGACTION
-#define sigset_t int
+#  define sigset_t int
 #endif // HAVE_SIGACTION
 #endif // HAVE_SIGACTION
 
 
 namespace aria2 {
 namespace aria2 {
@@ -105,8 +105,8 @@ std::string wCharToUtf8(const std::wstring& wsrc);
 // replace any backslash '\' in |src| with '/' and returns it.
 // replace any backslash '\' in |src| with '/' and returns it.
 std::string toForwardSlash(const std::string& src);
 std::string toForwardSlash(const std::string& src);
 #else // !__MINGW32__
 #else // !__MINGW32__
-#define utf8ToWChar(src) src
-#define utf8ToNative(src) src
+#  define utf8ToWChar(src) src
+#  define utf8ToNative(src) src
 #endif // !__MINGW32__
 #endif // !__MINGW32__
 
 
 namespace util {
 namespace util {

+ 3 - 3
test/Aria2ApiTest.cc

@@ -79,11 +79,11 @@ void Aria2ApiTest::testAddMetalink()
   KeyVals options;
   KeyVals options;
 #ifdef ENABLE_METALINK
 #ifdef ENABLE_METALINK
   CPPUNIT_ASSERT_EQUAL(0, addMetalink(session_, &gids, metalinkPath, options));
   CPPUNIT_ASSERT_EQUAL(0, addMetalink(session_, &gids, metalinkPath, options));
-#ifdef ENABLE_BITTORRENT
+#  ifdef ENABLE_BITTORRENT
   CPPUNIT_ASSERT_EQUAL((size_t)2, gids.size());
   CPPUNIT_ASSERT_EQUAL((size_t)2, gids.size());
-#else  // !ENABLE_BITTORRENT
+#  else  // !ENABLE_BITTORRENT
   CPPUNIT_ASSERT_EQUAL((size_t)1, gids.size());
   CPPUNIT_ASSERT_EQUAL((size_t)1, gids.size());
-#endif // !ENABLE_BITTORRENT
+#  endif // !ENABLE_BITTORRENT
 
 
   gids.clear();
   gids.clear();
   options.push_back(KeyVals::value_type("file-allocation", "foo"));
   options.push_back(KeyVals::value_type("file-allocation", "foo"));

+ 11 - 11
test/DefaultBtProgressInfoFileTest.cc

@@ -14,9 +14,9 @@
 #include "FileEntry.h"
 #include "FileEntry.h"
 #include "array_fun.h"
 #include "array_fun.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "MockPeerStorage.h"
-#include "BtRuntime.h"
-#include "bittorrent_helper.h"
+#  include "MockPeerStorage.h"
+#  include "BtRuntime.h"
+#  include "bittorrent_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {
@@ -27,10 +27,10 @@ class DefaultBtProgressInfoFileTest : public CppUnit::TestFixture {
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
   CPPUNIT_TEST(testSave);
   CPPUNIT_TEST(testSave);
   CPPUNIT_TEST(testLoad);
   CPPUNIT_TEST(testLoad);
-#ifndef WORDS_BIGENDIAN
+#  ifndef WORDS_BIGENDIAN
   CPPUNIT_TEST(testLoad_compat);
   CPPUNIT_TEST(testLoad_compat);
-#endif // !WORDS_BIGENDIAN
-#endif // ENABLE_BITTORRENT
+#  endif // !WORDS_BIGENDIAN
+#endif   // ENABLE_BITTORRENT
   CPPUNIT_TEST(testSave_nonBt);
   CPPUNIT_TEST(testSave_nonBt);
   CPPUNIT_TEST(testLoad_nonBt);
   CPPUNIT_TEST(testLoad_nonBt);
 #ifndef WORDS_BIGENDIAN
 #ifndef WORDS_BIGENDIAN
@@ -89,10 +89,10 @@ public:
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
   void testSave();
   void testSave();
   void testLoad();
   void testLoad();
-#ifndef WORDS_BIGENDIAN
+#  ifndef WORDS_BIGENDIAN
   void testLoad_compat();
   void testLoad_compat();
-#endif // !WORDS_BIGENDIAN
-#endif // ENABLE_BITTORRENT
+#  endif // !WORDS_BIGENDIAN
+#endif   // ENABLE_BITTORRENT
   void testSave_nonBt();
   void testSave_nonBt();
   void testLoad_nonBt();
   void testLoad_nonBt();
 #ifndef WORDS_BIGENDIAN
 #ifndef WORDS_BIGENDIAN
@@ -111,7 +111,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(DefaultBtProgressInfoFileTest);
 
 
 // Because load.aria2 is made for little endian systems, exclude
 // Because load.aria2 is made for little endian systems, exclude
 // testLoad_compat() for big endian systems.
 // testLoad_compat() for big endian systems.
-#ifndef WORDS_BIGENDIAN
+#  ifndef WORDS_BIGENDIAN
 void DefaultBtProgressInfoFileTest::testLoad_compat()
 void DefaultBtProgressInfoFileTest::testLoad_compat()
 {
 {
   initializeMembers(1_k, 80_k);
   initializeMembers(1_k, 80_k);
@@ -159,7 +159,7 @@ void DefaultBtProgressInfoFileTest::testLoad_compat()
   CPPUNIT_ASSERT_EQUAL((size_t)2, piece2->getIndex());
   CPPUNIT_ASSERT_EQUAL((size_t)2, piece2->getIndex());
   CPPUNIT_ASSERT_EQUAL((int64_t)512, piece2->getLength());
   CPPUNIT_ASSERT_EQUAL((int64_t)512, piece2->getLength());
 }
 }
-#endif // !WORDS_BIGENDIAN
+#  endif // !WORDS_BIGENDIAN
 
 
 void DefaultBtProgressInfoFileTest::testLoad()
 void DefaultBtProgressInfoFileTest::testLoad()
 {
 {

+ 7 - 7
test/DownloadHelperTest.cc

@@ -15,7 +15,7 @@
 #include "util.h"
 #include "util.h"
 #include "FileEntry.h"
 #include "FileEntry.h"
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
-#include "bittorrent_helper.h"
+#  include "bittorrent_helper.h"
 #endif // ENABLE_BITTORRENT
 #endif // ENABLE_BITTORRENT
 
 
 namespace aria2 {
 namespace aria2 {
@@ -215,11 +215,11 @@ void DownloadHelperTest::testCreateRequestGroupForUri_Metalink()
 
 
 // group1: http://alpha/file, ...
 // group1: http://alpha/file, ...
 // group2-7: 6 file entry in Metalink and 1 torrent file download
 // group2-7: 6 file entry in Metalink and 1 torrent file download
-#ifdef ENABLE_BITTORRENT
+#  ifdef ENABLE_BITTORRENT
     CPPUNIT_ASSERT_EQUAL((size_t)7, result.size());
     CPPUNIT_ASSERT_EQUAL((size_t)7, result.size());
-#else  // !ENABLE_BITTORRENT
+#  else  // !ENABLE_BITTORRENT
     CPPUNIT_ASSERT_EQUAL((size_t)6, result.size());
     CPPUNIT_ASSERT_EQUAL((size_t)6, result.size());
-#endif // !ENABLE_BITTORRENT
+#  endif // !ENABLE_BITTORRENT
 
 
     std::shared_ptr<RequestGroup> group = result[0];
     std::shared_ptr<RequestGroup> group = result[0];
     auto xuris = group->getDownloadContext()->getFirstFileEntry()->getUris();
     auto xuris = group->getDownloadContext()->getFirstFileEntry()->getUris();
@@ -349,11 +349,11 @@ void DownloadHelperTest::testCreateRequestGroupForMetalink()
 
 
     createRequestGroupForMetalink(result, option_);
     createRequestGroupForMetalink(result, option_);
 
 
-#ifdef ENABLE_BITTORRENT
+#  ifdef ENABLE_BITTORRENT
     CPPUNIT_ASSERT_EQUAL((size_t)6, result.size());
     CPPUNIT_ASSERT_EQUAL((size_t)6, result.size());
-#else  // !ENABLE_BITTORRENT
+#  else  // !ENABLE_BITTORRENT
     CPPUNIT_ASSERT_EQUAL((size_t)5, result.size());
     CPPUNIT_ASSERT_EQUAL((size_t)5, result.size());
-#endif // !ENABLE_BITTORRENT
+#  endif // !ENABLE_BITTORRENT
     std::shared_ptr<RequestGroup> group = result[0];
     std::shared_ptr<RequestGroup> group = result[0];
     auto uris = group->getDownloadContext()->getFirstFileEntry()->getUris();
     auto uris = group->getDownloadContext()->getFirstFileEntry()->getUris();
     std::sort(uris.begin(), uris.end());
     std::sort(uris.begin(), uris.end());

+ 3 - 3
test/Metalink2RequestGroupTest.cc

@@ -209,7 +209,7 @@ void Metalink2RequestGroupTest::testGenerate_groupByMetaurl()
 void Metalink2RequestGroupTest::testGenerate_dosDirTraversal()
 void Metalink2RequestGroupTest::testGenerate_dosDirTraversal()
 {
 {
 #ifdef __MINGW32__
 #ifdef __MINGW32__
-#ifdef ENABLE_BITTORRENT
+#  ifdef ENABLE_BITTORRENT
   std::vector<std::shared_ptr<RequestGroup>> groups;
   std::vector<std::shared_ptr<RequestGroup>> groups;
   option_->put(PREF_DIR, "/tmp");
   option_->put(PREF_DIR, "/tmp");
   Metalink2RequestGroup().generate(
   Metalink2RequestGroup().generate(
@@ -228,8 +228,8 @@ void Metalink2RequestGroupTest::testGenerate_dosDirTraversal()
   file = rg->getDownloadContext()->getFileEntries()[1];
   file = rg->getDownloadContext()->getFileEntries()[1];
   CPPUNIT_ASSERT_EQUAL(std::string("/tmp/..%5C..%5Cfile2.ext"),
   CPPUNIT_ASSERT_EQUAL(std::string("/tmp/..%5C..%5Cfile2.ext"),
                        file->getPath());
                        file->getPath());
-#endif // ENABLE_BITTORRENT
-#endif // __MINGW32__
+#  endif // ENABLE_BITTORRENT
+#endif   // __MINGW32__
 }
 }
 
 
 } // namespace aria2
 } // namespace aria2

+ 4 - 4
test/MockPeerStorage.h

@@ -1,11 +1,11 @@
 #ifndef D_MOCK_PEER_STORAGE_H
 #ifndef D_MOCK_PEER_STORAGE_H
-#define D_MOCK_PEER_STORAGE_H
+#  define D_MOCK_PEER_STORAGE_H
 
 
-#include "PeerStorage.h"
+#  include "PeerStorage.h"
 
 
-#include <algorithm>
+#  include <algorithm>
 
 
-#include "Peer.h"
+#  include "Peer.h"
 
 
 namespace aria2 {
 namespace aria2 {
 
 

+ 1 - 1
test/RpcHelperTest.cc

@@ -5,7 +5,7 @@
 #include "RpcRequest.h"
 #include "RpcRequest.h"
 #include "RecoverableException.h"
 #include "RecoverableException.h"
 #ifdef ENABLE_XML_RPC
 #ifdef ENABLE_XML_RPC
-#include "XmlRpcRequestParserStateMachine.h"
+#  include "XmlRpcRequestParserStateMachine.h"
 #endif // ENABLE_XML_RPC
 #endif // ENABLE_XML_RPC
 
 
 namespace aria2 {
 namespace aria2 {

部分文件因文件數量過多而無法顯示