From aa4ea8889c827df4b178b6ae6259b82e86bfbc5f Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 15 Oct 2016 19:02:54 +0900 Subject: clang-format-3.9 --- src/AbstractCommand.cc | 3 ++- src/Adler32MessageDigestImpl.h | 6 +---- src/AppleMessageDigestImpl.cc | 22 ++++++++-------- src/AppleTLSSession.cc | 6 +++-- src/AuthConfigFactory.cc | 4 +-- src/AuthConfigFactory.h | 3 ++- src/ConsoleStatCalc.cc | 4 +-- src/DHTGetPeersCommand.cc | 7 ++--- src/DHTMessageDispatcher.h | 16 +++++------- src/DHTMessageDispatcherImpl.h | 17 +++++++------ src/DNSCache.h | 3 ++- src/DefaultBtAnnounce.cc | 38 +++++++++++++++------------- src/DefaultBtMessageReceiver.cc | 5 ++-- src/DownloadEngine.cc | 4 +-- src/EpollEventPoll.h | 3 ++- src/FileAllocationCommand.cc | 11 ++++---- src/HttpHeader.cc | 33 ++++++++++++++++++------ src/IndexedList.h | 13 ++++++---- src/InitiateConnectionCommandFactory.cc | 3 +-- src/KqueueEventPoll.h | 3 ++- src/LibuvEventPoll.h | 3 ++- src/OptionHandlerFactory.cc | 12 ++++----- src/PollEventPoll.h | 3 ++- src/PortEventPoll.h | 3 ++- src/RequestGroupMan.cc | 3 ++- src/RpcMethodFactory.cc | 44 ++++++++++++++++++++++++-------- src/SelectEventPoll.h | 3 ++- src/ServerStatMan.h | 3 ++- src/SimpleRandomizer.cc | 3 +-- src/SpeedCalc.cc | 9 ++++--- src/TimerA2.h | 3 +-- src/ValueBase.h | 3 +-- src/a2netcompat.h | 4 +-- src/alloca.c | 4 +-- src/array_fun.h | 2 +- src/bignum.h | 2 +- src/cookie_helper.cc | 3 +-- src/crypto_hash.cc | 16 +++--------- src/uri_split.c | 13 +++++----- src/util.cc | 45 +++++++++++++++------------------ src/version_usage.cc | 26 +++++++++++-------- 41 files changed, 229 insertions(+), 182 deletions(-) (limited to 'src') diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index afe11fe9..bf307b75 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -329,7 +329,8 @@ bool AbstractCommand::execute() req_->getConnectedPort()); } if (e_->findCachedIPAddress(req_->getConnectedHostname(), - req_->getConnectedPort()).empty()) { + req_->getConnectedPort()) + .empty()) { A2_LOG_DEBUG(fmt("CUID#%" PRId64 " - All IP addresses were marked bad." " Removing Entry.", getCuid())); diff --git a/src/Adler32MessageDigestImpl.h b/src/Adler32MessageDigestImpl.h index 048edbaf..29b81bc8 100644 --- a/src/Adler32MessageDigestImpl.h +++ b/src/Adler32MessageDigestImpl.h @@ -41,11 +41,7 @@ namespace aria2 { #ifdef HAVE_ZLIB -#define ADLER32_MESSAGE_DIGEST \ - { \ - "adler32", make_hi() \ - } \ - , +#define ADLER32_MESSAGE_DIGEST {"adler32", make_hi()}, class Adler32MessageDigestImpl : public MessageDigestImpl { public: diff --git a/src/AppleMessageDigestImpl.cc b/src/AppleMessageDigestImpl.cc index 34660cc5..d21707ea 100644 --- a/src/AppleMessageDigestImpl.cc +++ b/src/AppleMessageDigestImpl.cc @@ -71,21 +71,23 @@ private: }; typedef MessageDigestBase MessageDigestMD5; + CC_MD5_Update, CC_MD5_Final> + MessageDigestMD5; typedef MessageDigestBase MessageDigestSHA1; + CC_SHA1_Update, CC_SHA1_Final> + MessageDigestSHA1; typedef MessageDigestBase MessageDigestSHA224; + CC_SHA224_Init, CC_SHA224_Update, CC_SHA224_Final> + MessageDigestSHA224; typedef MessageDigestBase MessageDigestSHA256; + CC_SHA256_Init, CC_SHA256_Update, CC_SHA256_Final> + MessageDigestSHA256; typedef MessageDigestBase MessageDigestSHA384; + CC_SHA384_Init, CC_SHA384_Update, CC_SHA384_Final> + MessageDigestSHA384; typedef MessageDigestBase MessageDigestSHA512; + CC_SHA512_Init, CC_SHA512_Update, CC_SHA512_Final> + MessageDigestSHA512; } // namespace diff --git a/src/AppleTLSSession.cc b/src/AppleTLSSession.cc index 2361a0be..bdafa1b3 100644 --- a/src/AppleTLSSession.cc +++ b/src/AppleTLSSession.cc @@ -107,7 +107,8 @@ static struct { } kSuites[] = { // From CipherSuite.h (10.11) SUITE(SSL_NULL_WITH_NULL_NULL, 0x0000), - SUITE(SSL_RSA_WITH_NULL_MD5, 0x0001), SUITE(SSL_RSA_WITH_NULL_SHA, 0x0002), + SUITE(SSL_RSA_WITH_NULL_MD5, 0x0001), + SUITE(SSL_RSA_WITH_NULL_SHA, 0x0002), SUITE(SSL_RSA_EXPORT_WITH_RC4_40_MD5, 0x0003), SUITE(SSL_RSA_WITH_RC4_128_MD5, 0x0004), SUITE(SSL_RSA_WITH_RC4_128_SHA, 0x0005), @@ -173,7 +174,8 @@ static struct { SUITE(TLS_ECDH_anon_WITH_AES_128_CBC_SHA, 0xC018), SUITE(TLS_ECDH_anon_WITH_AES_256_CBC_SHA, 0xC019), SUITE(TLS_NULL_WITH_NULL_NULL, 0x0000), - SUITE(TLS_RSA_WITH_NULL_MD5, 0x0001), SUITE(TLS_RSA_WITH_NULL_SHA, 0x0002), + SUITE(TLS_RSA_WITH_NULL_MD5, 0x0001), + SUITE(TLS_RSA_WITH_NULL_SHA, 0x0002), SUITE(TLS_RSA_WITH_RC4_128_MD5, 0x0004), SUITE(TLS_RSA_WITH_RC4_128_SHA, 0x0005), SUITE(TLS_RSA_WITH_3DES_EDE_CBC_SHA, 0x000A), diff --git a/src/AuthConfigFactory.cc b/src/AuthConfigFactory.cc index b6c9b6f4..6c542e74 100644 --- a/src/AuthConfigFactory.cc +++ b/src/AuthConfigFactory.cc @@ -84,8 +84,8 @@ AuthConfigFactory::createAuthConfig(const std::shared_ptr& request, request->getPassword()); } else { - return createHttpAuthResolver(op) - ->resolveAuthConfig(request->getHost()); + return createHttpAuthResolver(op)->resolveAuthConfig( + request->getHost()); } } } diff --git a/src/AuthConfigFactory.h b/src/AuthConfigFactory.h index c9ae60ec..1c8fe923 100644 --- a/src/AuthConfigFactory.h +++ b/src/AuthConfigFactory.h @@ -76,7 +76,8 @@ public: class AuthConfigFactory { public: typedef std::set, - DerefLess>> BasicCredSet; + DerefLess>> + BasicCredSet; private: std::unique_ptr netrc_; diff --git a/src/ConsoleStatCalc.cc b/src/ConsoleStatCalc.cc index 3186a8e0..14d35d87 100644 --- a/src/ConsoleStatCalc.cc +++ b/src/ConsoleStatCalc.cc @@ -259,8 +259,8 @@ void printProgressSummary(const RequestGroupList& groups, size_t cols, o << " as of " << buf; } } - o << " *** \n" << std::setfill(SEP_CHAR) << std::setw(cols) << SEP_CHAR - << "\n"; + o << " *** \n" + << std::setfill(SEP_CHAR) << std::setw(cols) << SEP_CHAR << "\n"; global::cout()->write(o.str().c_str()); std::for_each(groups.begin(), groups.end(), PrintSummary(cols, e, sizeFormatter)); diff --git a/src/DHTGetPeersCommand.cc b/src/DHTGetPeersCommand.cc index fbb6e8ee..9c6564d0 100644 --- a/src/DHTGetPeersCommand.cc +++ b/src/DHTGetPeersCommand.cc @@ -97,9 +97,10 @@ bool DHTGetPeersCommand::execute() elapsed >= GET_PEER_INTERVAL_LOW)) || (btRuntime_->getConnections() == 0 && elapsed >= GET_PEER_INTERVAL_ZERO))))) { - A2_LOG_DEBUG(fmt("Issuing PeerLookup for infoHash=%s", - bittorrent::getInfoHashString( - requestGroup_->getDownloadContext()).c_str())); + A2_LOG_DEBUG( + fmt("Issuing PeerLookup for infoHash=%s", + bittorrent::getInfoHashString(requestGroup_->getDownloadContext()) + .c_str())); task_ = taskFactory_->createPeerLookupTask( requestGroup_->getDownloadContext(), e_->getBtRegistry()->getTcpPort(), peerStorage_); diff --git a/src/DHTMessageDispatcher.h b/src/DHTMessageDispatcher.h index 9acd6fb8..72617876 100644 --- a/src/DHTMessageDispatcher.h +++ b/src/DHTMessageDispatcher.h @@ -50,16 +50,14 @@ class DHTMessageDispatcher { public: virtual ~DHTMessageDispatcher() = default; - virtual void - addMessageToQueue(std::unique_ptr message, - std::chrono::seconds timeout, - std::unique_ptr - callback = std::unique_ptr{}) = 0; + virtual void addMessageToQueue(std::unique_ptr message, + std::chrono::seconds timeout, + std::unique_ptr callback = + std::unique_ptr{}) = 0; - virtual void - addMessageToQueue(std::unique_ptr message, - std::unique_ptr - callback = std::unique_ptr{}) = 0; + virtual void addMessageToQueue(std::unique_ptr message, + std::unique_ptr callback = + std::unique_ptr{}) = 0; virtual void sendMessages() = 0; diff --git a/src/DHTMessageDispatcherImpl.h b/src/DHTMessageDispatcherImpl.h index 992899e3..c65076c0 100644 --- a/src/DHTMessageDispatcherImpl.h +++ b/src/DHTMessageDispatcherImpl.h @@ -56,15 +56,16 @@ private: public: DHTMessageDispatcherImpl(const std::shared_ptr& tracker); - virtual void addMessageToQueue( - std::unique_ptr message, std::chrono::seconds timeout, - std::unique_ptr - callback = std::unique_ptr{}) CXX11_OVERRIDE; + virtual void + addMessageToQueue(std::unique_ptr message, + std::chrono::seconds timeout, + std::unique_ptr callback = + std::unique_ptr{}) CXX11_OVERRIDE; - virtual void addMessageToQueue( - std::unique_ptr message, - std::unique_ptr - callback = std::unique_ptr{}) CXX11_OVERRIDE; + virtual void + addMessageToQueue(std::unique_ptr message, + std::unique_ptr callback = + std::unique_ptr{}) CXX11_OVERRIDE; virtual void sendMessages() CXX11_OVERRIDE; diff --git a/src/DNSCache.h b/src/DNSCache.h index 18eb393b..501b6fd1 100644 --- a/src/DNSCache.h +++ b/src/DNSCache.h @@ -98,7 +98,8 @@ private: }; typedef std::set, - DerefLess>> CacheEntrySet; + DerefLess>> + CacheEntrySet; CacheEntrySet entries_; public: diff --git a/src/DefaultBtAnnounce.cc b/src/DefaultBtAnnounce.cc index c60bc56a..98d4ac0d 100644 --- a/src/DefaultBtAnnounce.cc +++ b/src/DefaultBtAnnounce.cc @@ -161,24 +161,26 @@ std::string DefaultBtAnnounce::getAnnounceUrl() const size_t keyLen = 8; std::string uri = announceList_.getAnnounce(); uri += uriHasQuery(uri) ? "&" : "?"; - uri += fmt("info_hash=%s&" - "peer_id=%s&" - "uploaded=%" PRId64 "&" - "downloaded=%" PRId64 "&" - "left=%" PRId64 "&" - "compact=1&" - "key=%s&" - "numwant=%d&" - "no_peer_id=1", - util::percentEncode(bittorrent::getInfoHash(downloadContext_), - INFO_HASH_LENGTH).c_str(), - util::percentEncode(bittorrent::getStaticPeerId(), PEER_ID_LENGTH) - .c_str(), - stat.getSessionUploadLength(), stat.getSessionDownloadLength(), - left, util::percentEncode(bittorrent::getStaticPeerId() + - PEER_ID_LENGTH - keyLen, - keyLen).c_str(), - numWant); + uri += + fmt("info_hash=%s&" + "peer_id=%s&" + "uploaded=%" PRId64 "&" + "downloaded=%" PRId64 "&" + "left=%" PRId64 "&" + "compact=1&" + "key=%s&" + "numwant=%d&" + "no_peer_id=1", + util::percentEncode(bittorrent::getInfoHash(downloadContext_), + INFO_HASH_LENGTH) + .c_str(), + util::percentEncode(bittorrent::getStaticPeerId(), PEER_ID_LENGTH) + .c_str(), + stat.getSessionUploadLength(), stat.getSessionDownloadLength(), left, + util::percentEncode( + bittorrent::getStaticPeerId() + PEER_ID_LENGTH - keyLen, keyLen) + .c_str(), + numWant); if (tcpPort_) { uri += fmt("&port=%u", tcpPort_); } diff --git a/src/DefaultBtMessageReceiver.cc b/src/DefaultBtMessageReceiver.cc index 454f0685..e201bce7 100644 --- a/src/DefaultBtMessageReceiver.cc +++ b/src/DefaultBtMessageReceiver.cc @@ -88,8 +88,9 @@ DefaultBtMessageReceiver::receiveHandshake(bool quickReply) } else { throw DL_ABORT_EX( - fmt("Bad Info Hash %s", util::toHex(peerConnection_->getBuffer() + 28, - INFO_HASH_LENGTH).c_str())); + fmt("Bad Info Hash %s", + util::toHex(peerConnection_->getBuffer() + 28, INFO_HASH_LENGTH) + .c_str())); } if (peerConnection_->getBufferLength() == BtHandshakeMessage::MESSAGE_LENGTH && diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc index 8ebd34a4..111009bd 100644 --- a/src/DownloadEngine.cc +++ b/src/DownloadEngine.cc @@ -431,8 +431,8 @@ std::multimap::iterator DownloadEngine::findSocketPoolEntry(const std::string& key) { std::pair::iterator, - std::multimap::iterator> range = - socketPool_.equal_range(key); + std::multimap::iterator> + range = socketPool_.equal_range(key); for (auto i = range.first, eoi = range.second; i != eoi; ++i) { const SocketPoolEntry& e = (*i).second; // We assume that if socket is readable it means peer shutdowns diff --git a/src/EpollEventPoll.h b/src/EpollEventPoll.h index da670354..d14afe82 100644 --- a/src/EpollEventPoll.h +++ b/src/EpollEventPoll.h @@ -76,7 +76,8 @@ private: KSocketEntrySet socketEntries_; #ifdef ENABLE_ASYNC_DNS typedef std::map, - KAsyncNameResolverEntry> KAsyncNameResolverEntrySet; + KAsyncNameResolverEntry> + KAsyncNameResolverEntrySet; KAsyncNameResolverEntrySet nameResolverEntries_; #endif // ENABLE_ASYNC_DNS diff --git a/src/FileAllocationCommand.cc b/src/FileAllocationCommand.cc index 36ba57d1..1ac63e7b 100644 --- a/src/FileAllocationCommand.cc +++ b/src/FileAllocationCommand.cc @@ -72,11 +72,12 @@ bool FileAllocationCommand::executeInternal() } fileAllocationEntry_->allocateChunk(); if (fileAllocationEntry_->finished()) { - A2_LOG_DEBUG(fmt(MSG_ALLOCATION_COMPLETED, - static_cast( - std::chrono::duration_cast( - timer_.difference(global::wallclock())).count()), - getRequestGroup()->getTotalLength())); + A2_LOG_DEBUG(fmt( + MSG_ALLOCATION_COMPLETED, + static_cast(std::chrono::duration_cast( + timer_.difference(global::wallclock())) + .count()), + getRequestGroup()->getTotalLength())); std::vector> commands; fileAllocationEntry_->prepareForNextAction(commands, getDownloadEngine()); getDownloadEngine()->addCommand(std::move(commands)); diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 2b554bf2..cc75e4d5 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -195,8 +195,8 @@ void HttpHeader::setReasonPhrase(const std::string& reasonPhrase) bool HttpHeader::fieldContains(int hdKey, const char* value) { std::pair::const_iterator, - std::multimap::const_iterator> range = - equalRange(hdKey); + std::multimap::const_iterator> + range = equalRange(hdKey); for (auto i = range.first; i != range.second; ++i) { std::vector values; util::splitIter((*i).second.begin(), (*i).second.end(), @@ -221,12 +221,29 @@ bool HttpHeader::isKeepAlive() const namespace { const char* INTERESTING_HEADER_NAMES[] = { - "accept-encoding", "access-control-request-headers", - "access-control-request-method", "authorization", "connection", - "content-disposition", "content-encoding", "content-length", - "content-range", "content-type", "digest", "infohash", "last-modified", - "link", "location", "origin", "port", "retry-after", "sec-websocket-key", - "sec-websocket-version", "set-cookie", "transfer-encoding", "upgrade", + "accept-encoding", + "access-control-request-headers", + "access-control-request-method", + "authorization", + "connection", + "content-disposition", + "content-encoding", + "content-length", + "content-range", + "content-type", + "digest", + "infohash", + "last-modified", + "link", + "location", + "origin", + "port", + "retry-after", + "sec-websocket-key", + "sec-websocket-version", + "set-cookie", + "transfer-encoding", + "upgrade", }; } // namespace diff --git a/src/IndexedList.h b/src/IndexedList.h index 2fb64f96..79653d48 100644 --- a/src/IndexedList.h +++ b/src/IndexedList.h @@ -50,10 +50,12 @@ template struct IndexedListIterator { typedef IndexedListIterator iterator; + typename SeqType::iterator> + iterator; typedef IndexedListIterator const_iterator; + typename SeqType::const_iterator> + const_iterator; typedef typename SeqIteratorType::iterator_category iterator_category; typedef ValueType value_type; @@ -314,11 +316,12 @@ public: typedef std::deque> SeqType; typedef IndexedListIterator iterator; + ValuePtrType*, typename SeqType::iterator> + iterator; typedef IndexedListIterator const_iterator; + typename SeqType::const_iterator> + const_iterator; ValuePtrType& operator[](size_t n) { return seq_[n].second; } diff --git a/src/InitiateConnectionCommandFactory.cc b/src/InitiateConnectionCommandFactory.cc index ecaafa5b..2f864501 100644 --- a/src/InitiateConnectionCommandFactory.cc +++ b/src/InitiateConnectionCommandFactory.cc @@ -56,8 +56,7 @@ InitiateConnectionCommandFactory::createInitiateConnectionCommand( if (req->getProtocol() == "http" #ifdef ENABLE_SSL // for SSL - || - req->getProtocol() == "https" + || req->getProtocol() == "https" #endif // ENABLE_SSL ) { diff --git a/src/KqueueEventPoll.h b/src/KqueueEventPoll.h index 4e22b2d8..d1ef45ab 100644 --- a/src/KqueueEventPoll.h +++ b/src/KqueueEventPoll.h @@ -81,7 +81,8 @@ private: KSocketEntrySet socketEntries_; #ifdef ENABLE_ASYNC_DNS typedef std::map, - KAsyncNameResolverEntry> KAsyncNameResolverEntrySet; + KAsyncNameResolverEntry> + KAsyncNameResolverEntrySet; KAsyncNameResolverEntrySet nameResolverEntries_; #endif // ENABLE_ASYNC_DNS diff --git a/src/LibuvEventPoll.h b/src/LibuvEventPoll.h index 5c56a108..23cccec3 100644 --- a/src/LibuvEventPoll.h +++ b/src/LibuvEventPoll.h @@ -115,7 +115,8 @@ private: #ifdef ENABLE_ASYNC_DNS typedef std::map, - KAsyncNameResolverEntry> KAsyncNameResolverEntrySet; + KAsyncNameResolverEntry> + KAsyncNameResolverEntrySet; #endif // ENABLE_ASYNC_DNS uv_loop_t* loop_; diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index 77fd61e3..99b6ca35 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -299,21 +299,21 @@ std::vector OptionHandlerFactory::createOptionHandlers() #endif // defined(HAVE_EPOLL) { #ifdef HAVE_EPOLL - V_EPOLL, + V_EPOLL, #endif // HAVE_EPOLL #ifdef HAVE_KQUEUE - V_KQUEUE, + V_KQUEUE, #endif // HAVE_KQUEUE #ifdef HAVE_PORT_ASSOCIATE - V_PORT, + V_PORT, #endif // HAVE_PORT_ASSOCIATE #ifdef HAVE_LIBUV - V_LIBUV, + V_LIBUV, #endif // HAVE_LIBUV #ifdef HAVE_POLL - V_POLL, + V_POLL, #endif // HAVE_POLL - V_SELECT})); + V_SELECT})); op->addTag(TAG_ADVANCED); handlers.push_back(op); } diff --git a/src/PollEventPoll.h b/src/PollEventPoll.h index 9094aeca..2ae74fce 100644 --- a/src/PollEventPoll.h +++ b/src/PollEventPoll.h @@ -76,7 +76,8 @@ private: KSocketEntrySet socketEntries_; #ifdef ENABLE_ASYNC_DNS typedef std::map, - KAsyncNameResolverEntry> KAsyncNameResolverEntrySet; + KAsyncNameResolverEntry> + KAsyncNameResolverEntrySet; KAsyncNameResolverEntrySet nameResolverEntries_; #endif // ENABLE_ASYNC_DNS diff --git a/src/PortEventPoll.h b/src/PortEventPoll.h index 6978c7b1..dabf6874 100644 --- a/src/PortEventPoll.h +++ b/src/PortEventPoll.h @@ -77,7 +77,8 @@ private: private: typedef std::set, - DerefLess>> KSocketEntrySet; + DerefLess>> + KSocketEntrySet; KSocketEntrySet socketEntries_; #ifdef ENABLE_ASYNC_DNS typedef std::set, diff --git a/src/RequestGroupMan.cc b/src/RequestGroupMan.cc index 169a6041..916fb14e 100644 --- a/src/RequestGroupMan.cc +++ b/src/RequestGroupMan.cc @@ -777,7 +777,8 @@ void formatDownloadResultCommon( if (downloadResult->sessionTime.count() > 0) { o << std::setw(8) << util::abbrevSize(downloadResult->sessionDownloadLength * 1000 / - downloadResult->sessionTime.count()) << "B/s"; + downloadResult->sessionTime.count()) + << "B/s"; } else { o << std::setw(11); diff --git a/src/RpcMethodFactory.cc b/src/RpcMethodFactory.cc index 0e276f8a..bafbffd8 100644 --- a/src/RpcMethodFactory.cc +++ b/src/RpcMethodFactory.cc @@ -53,21 +53,43 @@ namespace { std::vector rpcMethodNames = { "aria2.addUri", #ifdef ENABLE_BITTORRENT - "aria2.addTorrent", "aria2.getPeers", + "aria2.addTorrent", + "aria2.getPeers", #endif // ENABLE_BITTORRENT #ifdef ENABLE_METALINK "aria2.addMetalink", #endif // ENABLE_METALINK - "aria2.remove", "aria2.pause", "aria2.forcePause", "aria2.pauseAll", - "aria2.forcePauseAll", "aria2.unpause", "aria2.unpauseAll", - "aria2.forceRemove", "aria2.changePosition", "aria2.tellStatus", - "aria2.getUris", "aria2.getFiles", "aria2.getServers", "aria2.tellActive", - "aria2.tellWaiting", "aria2.tellStopped", "aria2.getOption", - "aria2.changeUri", "aria2.changeOption", "aria2.getGlobalOption", - "aria2.changeGlobalOption", "aria2.purgeDownloadResult", - "aria2.removeDownloadResult", "aria2.getVersion", "aria2.getSessionInfo", - "aria2.shutdown", "aria2.forceShutdown", "aria2.getGlobalStat", - "aria2.saveSession", "system.multicall", "system.listMethods", + "aria2.remove", + "aria2.pause", + "aria2.forcePause", + "aria2.pauseAll", + "aria2.forcePauseAll", + "aria2.unpause", + "aria2.unpauseAll", + "aria2.forceRemove", + "aria2.changePosition", + "aria2.tellStatus", + "aria2.getUris", + "aria2.getFiles", + "aria2.getServers", + "aria2.tellActive", + "aria2.tellWaiting", + "aria2.tellStopped", + "aria2.getOption", + "aria2.changeUri", + "aria2.changeOption", + "aria2.getGlobalOption", + "aria2.changeGlobalOption", + "aria2.purgeDownloadResult", + "aria2.removeDownloadResult", + "aria2.getVersion", + "aria2.getSessionInfo", + "aria2.shutdown", + "aria2.forceShutdown", + "aria2.getGlobalStat", + "aria2.saveSession", + "system.multicall", + "system.listMethods", "system.listNotifications", }; } // namespace diff --git a/src/SelectEventPoll.h b/src/SelectEventPoll.h index 8b871557..311d4134 100644 --- a/src/SelectEventPoll.h +++ b/src/SelectEventPoll.h @@ -156,7 +156,8 @@ private: SocketEntrySet socketEntries_; #ifdef ENABLE_ASYNC_DNS typedef std::map, - AsyncNameResolverEntry> AsyncNameResolverEntrySet; + AsyncNameResolverEntry> + AsyncNameResolverEntrySet; AsyncNameResolverEntrySet nameResolverEntries_; #endif // ENABLE_ASYNC_DNS diff --git a/src/ServerStatMan.h b/src/ServerStatMan.h index 8ebb71b6..615723d6 100644 --- a/src/ServerStatMan.h +++ b/src/ServerStatMan.h @@ -66,7 +66,8 @@ public: private: typedef std::set, - DerefLess>> ServerStatSet; + DerefLess>> + ServerStatSet; ServerStatSet serverStats_; }; diff --git a/src/SimpleRandomizer.cc b/src/SimpleRandomizer.cc index c68fbfc8..ca859f5a 100644 --- a/src/SimpleRandomizer.cc +++ b/src/SimpleRandomizer.cc @@ -107,8 +107,7 @@ void SimpleRandomizer::getRandomBytes(unsigned char* buf, size_t len) * check out. If the call failed, we'll not take this branch at all * and disable support below. */ - || - errno != ENOSYS + || errno != ENOSYS #endif ) { if (rv < -1) { diff --git a/src/SpeedCalc.cc b/src/SpeedCalc.cc index 2c49c9ef..c45c7197 100644 --- a/src/SpeedCalc.cc +++ b/src/SpeedCalc.cc @@ -75,7 +75,8 @@ int SpeedCalc::calculateSpeed() return 0; } auto elapsed = std::chrono::duration_cast( - timeSlots_[0].first.difference(now)).count(); + timeSlots_[0].first.difference(now)) + .count(); if (elapsed <= 0) { elapsed = 1; } @@ -102,7 +103,8 @@ int SpeedCalc::calculateNewestSpeed(int seconds) } auto elapsed = std::chrono::duration_cast( - (*--it).first.difference(now)).count(); + (*--it).first.difference(now)) + .count(); if (elapsed <= 0) { elapsed = 1; } @@ -128,7 +130,8 @@ void SpeedCalc::update(size_t bytes) int SpeedCalc::calculateAvgSpeed() const { auto milliElapsed = std::chrono::duration_cast( - start_.difference(global::wallclock())).count(); + start_.difference(global::wallclock())) + .count(); // if milliElapsed is too small, the average speed is rubbish, better // return 0 if (milliElapsed > 4) { diff --git a/src/TimerA2.h b/src/TimerA2.h index baf5ef22..bf678f38 100644 --- a/src/TimerA2.h +++ b/src/TimerA2.h @@ -55,8 +55,7 @@ public: Timer(Timer&& time) = default; template - constexpr explicit Timer(const duration& t) - : tp_(t) + constexpr explicit Timer(const duration& t) : tp_(t) { } diff --git a/src/ValueBase.h b/src/ValueBase.h index 7bd4b24b..275477f5 100644 --- a/src/ValueBase.h +++ b/src/ValueBase.h @@ -87,8 +87,7 @@ public: String(const unsigned char* data, size_t length); template - String(InputIterator first, InputIterator last) - : str_(first, last) + String(InputIterator first, InputIterator last) : str_(first, last) { } diff --git a/src/a2netcompat.h b/src/a2netcompat.h index 28024b13..4c09da79 100644 --- a/src/a2netcompat.h +++ b/src/a2netcompat.h @@ -44,14 +44,14 @@ #endif // __MINGW32__ #ifdef __MINGW32__ -#define a2_sockopt_t char * +#define a2_sockopt_t char* #ifndef HAVE_GETADDRINFO #define HAVE_GETADDRINFO #endif // !HAVE_GETADDRINFO #undef HAVE_GAI_STRERROR #undef gai_strerror #else -#define a2_sockopt_t void * +#define a2_sockopt_t void* #endif // __MINGW32__ #ifdef HAVE_NETDB_H diff --git a/src/alloca.c b/src/alloca.c index d1ed9ee5..aa30eb66 100644 --- a/src/alloca.c +++ b/src/alloca.c @@ -61,7 +61,7 @@ you lose-- must know STACK_DIRECTION at compile - time #if defined(CRAY) && defined(CRAY_STACKSEG_END) long i00afunc(); -#define ADDRESS_FUNCTION(arg) (char*) i00afunc(&(arg)) +#define ADDRESS_FUNCTION(arg) (char*)i00afunc(&(arg)) #else #define ADDRESS_FUNCTION(arg) &(arg) #endif @@ -344,7 +344,7 @@ static long i00afunc(long* address) { struct stk_stat status; struct stk_trailer* trailer; - long* block, size; + long *block, size; long result = 0; /* We want to iterate through all of the segments. The first diff --git a/src/array_fun.h b/src/array_fun.h index 100ceb00..2cce48e8 100644 --- a/src/array_fun.h +++ b/src/array_fun.h @@ -42,7 +42,7 @@ namespace aria2 { -template constexpr size_t arraySize(T(&)[N]) +template constexpr size_t arraySize(T (&)[N]) { return N; } diff --git a/src/bignum.h b/src/bignum.h index da02ccfd..33e631ad 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -196,7 +196,7 @@ public: } ulong& operator*=(const ulong& rhs) { - *this = *this* rhs; + *this = *this * rhs; return *this; } diff --git a/src/cookie_helper.cc b/src/cookie_helper.cc index 74a9e86e..0e546109 100644 --- a/src/cookie_helper.cc +++ b/src/cookie_helper.cc @@ -135,8 +135,7 @@ bool parseDate(time_t& time, std::string::const_iterator first, minute = getInteger(hEnd + 1, mEnd); second = getInteger(mEnd + 1, sEnd); continue; - NOT_TIME: - ; + NOT_TIME:; } if (!foundDayOfMonth) { std::string::const_iterator j = getNextDigit((*i).begin(), (*i).end()); diff --git a/src/crypto_hash.cc b/src/crypto_hash.cc index 8448269e..f6fb6d99 100644 --- a/src/crypto_hash.cc +++ b/src/crypto_hash.cc @@ -1032,18 +1032,10 @@ static const std::set names{ // For fast name |lookup| static const std::unordered_map mapped{ - {"md5", algoMD5}, - {"sha", algoSHA1}, - {"sha1", algoSHA1}, - {"sha-1", algoSHA1}, - {"sha224", algoSHA224}, - {"sha-224", algoSHA224}, - {"sha256", algoSHA256}, - {"sha-256", algoSHA256}, - {"sha384", algoSHA384}, - {"sha-384", algoSHA384}, - {"sha512", algoSHA512}, - {"sha-512", algoSHA512}, + {"md5", algoMD5}, {"sha", algoSHA1}, {"sha1", algoSHA1}, + {"sha-1", algoSHA1}, {"sha224", algoSHA224}, {"sha-224", algoSHA224}, + {"sha256", algoSHA256}, {"sha-256", algoSHA256}, {"sha384", algoSHA384}, + {"sha-384", algoSHA384}, {"sha512", algoSHA512}, {"sha-512", algoSHA512}, }; static const auto mapped_end = mapped.end(); } // namespace diff --git a/src/uri_split.c b/src/uri_split.c index d35dc245..6e95acf8 100644 --- a/src/uri_split.c +++ b/src/uri_split.c @@ -74,13 +74,12 @@ static int is_digit(char c) { return '0' <= c && c <= '9'; } int uri_split(uri_split_result* res, const char* uri) { int state = URI_BEFORE_SCHEME; - const char* scheme_first = NULL, * scheme_last = NULL, * host_first = NULL, - * host_last = NULL, * path_first = NULL, * path_last = NULL, - * query_first = NULL, * query_last = NULL, - * fragment_first = NULL, * fragment_last = NULL, - * user_first = NULL, * user_last = NULL, * passwd_first = NULL, - * passwd_last = NULL, * last_atmark = NULL, * last_slash = NULL, - * p = uri; + const char *scheme_first = NULL, *scheme_last = NULL, *host_first = NULL, + *host_last = NULL, *path_first = NULL, *path_last = NULL, + *query_first = NULL, *query_last = NULL, *fragment_first = NULL, + *fragment_last = NULL, *user_first = NULL, *user_last = NULL, + *passwd_first = NULL, *passwd_last = NULL, *last_atmark = NULL, + *last_slash = NULL, *p = uri; int32_t port = -1; uint8_t flags = 0; diff --git a/src/util.cc b/src/util.cc index 3c9c19b1..8229f98b 100644 --- a/src/util.cc +++ b/src/util.cc @@ -547,7 +547,7 @@ bool parseLong(T& res, F f, const std::string& s, int base) return false; } if (*endptr != '\0') { - for (const char* i = endptr, * eoi = s.c_str() + s.size(); i < eoi; ++i) { + for (const char *i = endptr, *eoi = s.c_str() + s.size(); i < eoi; ++i) { if (!isspace(*i)) { return false; } @@ -750,7 +750,7 @@ void parsePrioritizePieceRange( std::string iso8859p1ToUtf8(const char* src, size_t len) { std::string dest; - for (const char* p = src, * last = src + len; p != last; ++p) { + for (const char *p = src, *last = src + len; p != last; ++p) { unsigned char c = *p; if (0xa0u <= c) { if (c <= 0xbfu) { @@ -810,31 +810,28 @@ static const uint8_t utf8d[] = { * The first part of the table maps bytes to character classes that * to reduce the size of the transition table and create bitmasks. */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 11, 6, 6, 6, 5, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 11, 6, 6, 6, 5, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, /* * The second part is a transition table that maps a combination * of a state of the automaton and a character class to a state. */ - 0, 12, 24, 36, 60, 96, 84, 12, 12, 12, 48, 72, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 0, 12, 12, 12, 12, 12, 0, 12, 0, 12, 12, 12, 24, - 12, 12, 12, 12, 12, 24, 12, 24, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 12, - 12, 12, 12, 12, 24, 12, 12, 12, 12, 12, 12, 12, 24, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 36, 12, 36, 12, 12, 12, 36, 12, 12, 12, 12, 12, 36, 12, 36, 12, - 12, 12, 36, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 0, 12, 24, 36, 60, 96, 84, 12, 12, 12, 48, 72, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 0, 12, 12, 12, 12, 12, 0, 12, 0, 12, 12, 12, 24, 12, + 12, 12, 12, 12, 24, 12, 24, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 12, 12, + 12, 12, 12, 24, 12, 12, 12, 12, 12, 12, 12, 24, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 36, 12, 36, 12, 12, 12, 36, 12, 12, 12, 12, 12, 36, 12, 36, 12, 12, + 12, 36, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, }; static uint32_t utf8dfa(uint32_t* state, uint32_t* codep, uint32_t byte) @@ -884,8 +881,8 @@ ssize_t parse_content_disposition(char* dest, size_t destlen, const char** charsetp, size_t* charsetlenp, const char* in, size_t len) { - const char* p = in, * eop = in + len, * mark_first = nullptr, - * mark_last = nullptr; + const char *p = in, *eop = in + len, *mark_first = nullptr, + *mark_last = nullptr; int state = CD_BEFORE_DISPOSITION_TYPE; int in_file_parm = 0; int flags = 0; diff --git a/src/version_usage.cc b/src/version_usage.cc index e4b779da..e30e41d9 100644 --- a/src/version_usage.cc +++ b/src/version_usage.cc @@ -67,14 +67,17 @@ void showVersion() "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n") << "\n" - << _("** Configuration **") << "\n" << _("Enabled Features") << ": " - << featureSummary() << "\n" << _("Hash Algorithms") << ": " - << MessageDigest::getSupportedHashTypeString() << "\n" << _("Libraries") - << ": " << usedLibs() << "\n" << _("Compiler") << ": " - << usedCompilerAndPlatform() << "\n" << _("System") << ": " - << getOperatingSystemInfo() << "\n" - << "\n" << fmt(_("Report bugs to %s"), PACKAGE_BUGREPORT) << "\n" + "GNU General Public License for more details.\n") + << "\n" + << _("** Configuration **") << "\n" + << _("Enabled Features") << ": " << featureSummary() << "\n" + << _("Hash Algorithms") << ": " + << MessageDigest::getSupportedHashTypeString() << "\n" + << _("Libraries") << ": " << usedLibs() << "\n" + << _("Compiler") << ": " << usedCompilerAndPlatform() << "\n" + << _("System") << ": " << getOperatingSystemInfo() << "\n" + << "\n" + << fmt(_("Report bugs to %s"), PACKAGE_BUGREPORT) << "\n" << _("Visit") << " " << PACKAGE_URL << std::endl; } @@ -105,8 +108,9 @@ void showUsage(const std::string& keyword, out->printf("\n"); out->printf(_("Options:")); out->printf("\n"); - for (std::vector::const_iterator i = handlers.begin(), - eoi = handlers.end(); + for (std::vector::const_iterator + i = handlers.begin(), + eoi = handlers.end(); i != eoi; ++i) { write(out, *(*i)); out->printf("\n"); @@ -121,7 +125,7 @@ void showUsage(const std::string& keyword, out->printf("\n"); out->printf(_("Options:")); out->printf("\n"); - for (std::vector::const_iterator + for (std::vector::const_iterator i = handlers.begin(), eoi = handlers.end(); i != eoi; ++i) { -- cgit