summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2017-11-23 14:11:43 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2017-11-23 14:11:43 +0900
commit795a0474df35c56307151cca5787cb8ae2df06e5 (patch)
tree2197ade3cb882db0a82dfde676e0eff27e618930
parent20a7c43f2da248bb17f1338d00d663157dce2156 (diff)
clang-format-5.0
-rw-r--r--examples/libaria2ex.cc9
-rw-r--r--src/AbstractDiskWriter.cc49
-rw-r--r--src/ActivePeerConnectionCommand.cc6
-rw-r--r--src/AppleTLSSession.h2
-rw-r--r--src/AsyncNameResolver.h2
-rw-r--r--src/AsyncNameResolverMan.cc2
-rw-r--r--src/ChecksumCheckIntegrityEntry.cc5
-rw-r--r--src/DHTBucket.cc5
-rw-r--r--src/DHTNode.cc5
-rw-r--r--src/DHTNodeLookupEntry.h2
-rw-r--r--src/FtpConnection.cc6
-rw-r--r--src/HttpHeader.cc2
-rw-r--r--src/HttpHeader.h2
-rw-r--r--src/HttpResponseCommand.cc10
-rw-r--r--src/HttpServer.h4
-rw-r--r--src/InitiateConnectionCommandFactory.cc4
-rw-r--r--src/LibgnutlsTLSSession.cc6
-rw-r--r--src/LibsslTLSContext.cc9
-rw-r--r--src/LibuvEventPoll.cc2
-rw-r--r--src/LpdMessageDispatcher.cc2
-rw-r--r--src/MessageDigest.cc2
-rw-r--r--src/Metalink2RequestGroup.cc7
-rw-r--r--src/MetalinkParserController.cc2
-rw-r--r--src/NullWebSocketSessionMan.h2
-rw-r--r--src/OpenedFileCounter.cc5
-rw-r--r--src/OptionHandlerFactory.cc12
-rw-r--r--src/Platform.cc2
-rw-r--r--src/RpcMethodImpl.cc9
-rw-r--r--src/SSHSession.h2
-rw-r--r--src/SelectEventPoll.cc2
-rw-r--r--src/SessionSerializer.cc10
-rw-r--r--src/StreamCheckIntegrityEntry.cc5
-rw-r--r--src/TLSSession.h2
-rw-r--r--src/ValueBaseStructParserStateMachine.h2
-rw-r--r--src/WebSocketResponseCommand.cc4
-rw-r--r--src/WebSocketSessionMan.h2
-rw-r--r--src/WinTLSSession.cc6
-rw-r--r--src/console.cc2
-rw-r--r--src/util.cc403
-rw-r--r--test/ChunkedDecodingStreamFilterTest.cc7
-rw-r--r--test/HandshakeExtensionMessageTest.cc10
-rw-r--r--test/HttpRequestTest.cc5
-rw-r--r--test/IndexedListTest.cc2
-rw-r--r--test/MetalinkProcessorTest.cc2
-rw-r--r--test/PeerSessionResourceTest.cc5
-rw-r--r--test/RequestGroupManTest.cc79
-rw-r--r--test/RpcMethodTest.cc13
-rw-r--r--test/UriSplitTest.cc145
48 files changed, 597 insertions, 286 deletions
diff --git a/examples/libaria2ex.cc b/examples/libaria2ex.cc
index 9d0ddc8c..f731ada2 100644
--- a/examples/libaria2ex.cc
+++ b/examples/libaria2ex.cc
@@ -128,10 +128,11 @@ int main(int argc, char** argv)
if (dh) {
std::cerr << " [" << aria2::gidToHex(gid) << "] "
<< dh->getCompletedLength() << "/" << dh->getTotalLength()
- << "(" << (dh->getTotalLength() > 0
- ? (100 * dh->getCompletedLength() /
- dh->getTotalLength())
- : 0)
+ << "("
+ << (dh->getTotalLength() > 0
+ ? (100 * dh->getCompletedLength() /
+ dh->getTotalLength())
+ : 0)
<< "%)"
<< " D:" << dh->getDownloadSpeed() / 1024
<< "KiB/s, U:" << dh->getUploadSpeed() / 1024 << "KiB/s"
diff --git a/src/AbstractDiskWriter.cc b/src/AbstractDiskWriter.cc
index bb26d010..a1eba628 100644
--- a/src/AbstractDiskWriter.cc
+++ b/src/AbstractDiskWriter.cc
@@ -119,7 +119,7 @@ void AbstractDiskWriter::openFile(int64_t totalLength)
#else // !__MINGW32__
e.getErrNum() == ENOENT
#endif // !__MINGW32__
- ) {
+ ) {
initAndOpenFile(totalLength);
}
else {
@@ -201,9 +201,10 @@ HANDLE openFileWithFlags(const std::string& filename, int flags,
FILE_ATTRIBUTE_NORMAL, /* hTemplateFile */ 0);
if (hn == INVALID_HANDLE_VALUE) {
int errNum = GetLastError();
- throw DL_ABORT_EX3(errNum, fmt(EX_FILE_OPEN, filename.c_str(),
- fileStrerror(errNum).c_str()),
- errCode);
+ throw DL_ABORT_EX3(
+ errNum,
+ fmt(EX_FILE_OPEN, filename.c_str(), fileStrerror(errNum).c_str()),
+ errCode);
}
return hn;
}
@@ -217,9 +218,10 @@ int openFileWithFlags(const std::string& filename, int flags,
;
if (fd < 0) {
int errNum = errno;
- throw DL_ABORT_EX3(errNum, fmt(EX_FILE_OPEN, filename.c_str(),
- util::safeStrerror(errNum).c_str()),
- errCode);
+ throw DL_ABORT_EX3(
+ errNum,
+ fmt(EX_FILE_OPEN, filename.c_str(), util::safeStrerror(errNum).c_str()),
+ errCode);
}
util::make_fd_cloexec(fd);
#if defined(__APPLE__) && defined(__MACH__)
@@ -454,9 +456,10 @@ void AbstractDiskWriter::writeData(const unsigned char* data, size_t len,
error_code::NOT_ENOUGH_DISK_SPACE);
}
else {
- throw DL_ABORT_EX3(errNum, fmt(EX_FILE_WRITE, filename_.c_str(),
- fileStrerror(errNum).c_str()),
- error_code::FILE_IO_ERROR);
+ throw DL_ABORT_EX3(
+ errNum,
+ fmt(EX_FILE_WRITE, filename_.c_str(), fileStrerror(errNum).c_str()),
+ error_code::FILE_IO_ERROR);
}
}
}
@@ -467,9 +470,10 @@ ssize_t AbstractDiskWriter::readData(unsigned char* data, size_t len,
ssize_t ret;
if ((ret = readDataInternal(data, len, offset)) < 0) {
int errNum = fileError();
- throw DL_ABORT_EX3(errNum, fmt(EX_FILE_READ, filename_.c_str(),
- fileStrerror(errNum).c_str()),
- error_code::FILE_IO_ERROR);
+ throw DL_ABORT_EX3(
+ errNum,
+ fmt(EX_FILE_READ, filename_.c_str(), fileStrerror(errNum).c_str()),
+ error_code::FILE_IO_ERROR);
}
return ret;
}
@@ -526,17 +530,17 @@ void AbstractDiskWriter::allocate(int64_t offset, int64_t length, bool sparse)
}
#elif defined(__APPLE__) && defined(__MACH__)
const auto toalloc = offset + length - size();
- fstore_t fstore = {
- F_ALLOCATECONTIG | F_ALLOCATEALL, F_PEOFPOSMODE,
- 0, toalloc, 0};
+ fstore_t fstore = {F_ALLOCATECONTIG | F_ALLOCATEALL, F_PEOFPOSMODE, 0,
+ toalloc, 0};
if (fcntl(fd_, F_PREALLOCATE, &fstore) == -1) {
// Retry non-contig.
fstore.fst_flags = F_ALLOCATEALL;
if (fcntl(fd_, F_PREALLOCATE, &fstore) == -1) {
int err = errno;
throw DL_ABORT_EX3(
- err, fmt("fcntl(F_PREALLOCATE) of %" PRId64 " failed. cause: %s",
- fstore.fst_length, util::safeStrerror(err).c_str()),
+ err,
+ fmt("fcntl(F_PREALLOCATE) of %" PRId64 " failed. cause: %s",
+ fstore.fst_length, util::safeStrerror(err).c_str()),
error_code::FILE_IO_ERROR);
}
}
@@ -559,10 +563,11 @@ void AbstractDiskWriter::allocate(int64_t offset, int64_t length, bool sparse)
#elif HAVE_POSIX_FALLOCATE
int r = posix_fallocate(fd_, offset, length);
if (r != 0) {
- throw DL_ABORT_EX3(r, fmt("posix_fallocate failed. cause: %s",
- util::safeStrerror(r).c_str()),
- isDiskFullError(r) ? error_code::NOT_ENOUGH_DISK_SPACE
- : error_code::FILE_IO_ERROR);
+ throw DL_ABORT_EX3(
+ r,
+ fmt("posix_fallocate failed. cause: %s", util::safeStrerror(r).c_str()),
+ isDiskFullError(r) ? error_code::NOT_ENOUGH_DISK_SPACE
+ : error_code::FILE_IO_ERROR);
}
#else
#error "no *_fallocate function available."
diff --git a/src/ActivePeerConnectionCommand.cc b/src/ActivePeerConnectionCommand.cc
index 2cf2441a..7e566b42 100644
--- a/src/ActivePeerConnectionCommand.cc
+++ b/src/ActivePeerConnectionCommand.cc
@@ -107,9 +107,9 @@ bool ActivePeerConnectionCommand::execute()
int numConnection = 0;
if (pieceStorage_->downloadFinished()) {
if (btRuntime_->getMaxPeers() > btRuntime_->getConnections()) {
- numConnection = std::min(numNewConnection_,
- btRuntime_->getMaxPeers() -
- btRuntime_->getConnections());
+ numConnection =
+ std::min(numNewConnection_, btRuntime_->getMaxPeers() -
+ btRuntime_->getConnections());
}
}
else {
diff --git a/src/AppleTLSSession.h b/src/AppleTLSSession.h
index 5213b7b7..3fc065fc 100644
--- a/src/AppleTLSSession.h
+++ b/src/AppleTLSSession.h
@@ -128,6 +128,6 @@ private:
OSStatus sockWrite(const void* data, size_t* len);
OSStatus sockRead(void* data, size_t* len);
};
-}
+} // namespace aria2
#endif // TLS_SESSION_H
diff --git a/src/AsyncNameResolver.h b/src/AsyncNameResolver.h
index de7113c3..31a6ebe9 100644
--- a/src/AsyncNameResolver.h
+++ b/src/AsyncNameResolver.h
@@ -73,7 +73,7 @@ public:
,
ares_addr_node* servers
#endif // HAVE_ARES_ADDR_NODE
- );
+ );
~AsyncNameResolver();
diff --git a/src/AsyncNameResolverMan.cc b/src/AsyncNameResolverMan.cc
index ef5fb741..be073561 100644
--- a/src/AsyncNameResolverMan.cc
+++ b/src/AsyncNameResolverMan.cc
@@ -93,7 +93,7 @@ void AsyncNameResolverMan::startAsyncFamily(const std::string& hostname,
,
e->getAsyncDNSServers()
#endif // HAVE_ARES_ADDR_NODE
- );
+ );
asyncNameResolver_[numResolver_]->resolve(hostname);
setNameResolverCheck(numResolver_, e, command);
}
diff --git a/src/ChecksumCheckIntegrityEntry.cc b/src/ChecksumCheckIntegrityEntry.cc
index dc225b8b..e36a4558 100644
--- a/src/ChecksumCheckIntegrityEntry.cc
+++ b/src/ChecksumCheckIntegrityEntry.cc
@@ -78,8 +78,9 @@ void ChecksumCheckIntegrityEntry::onDownloadIncomplete(
std::vector<std::unique_ptr<Command>>& commands, DownloadEngine* e)
{
if (redownload_) {
- proceedFileAllocation(commands, make_unique<StreamFileAllocationEntry>(
- getRequestGroup(), popNextCommand()),
+ proceedFileAllocation(commands,
+ make_unique<StreamFileAllocationEntry>(
+ getRequestGroup(), popNextCommand()),
e);
return;
}
diff --git a/src/DHTBucket.cc b/src/DHTBucket.cc
index 52494970..6320c267 100644
--- a/src/DHTBucket.cc
+++ b/src/DHTBucket.cc
@@ -245,9 +245,8 @@ bool DHTBucket::operator==(const DHTBucket& bucket) const
bool DHTBucket::needsRefresh() const
{
- return nodes_.size() < K ||
- lastUpdated_.difference(global::wallclock()) >=
- DHT_BUCKET_REFRESH_INTERVAL;
+ return nodes_.size() < K || lastUpdated_.difference(global::wallclock()) >=
+ DHT_BUCKET_REFRESH_INTERVAL;
}
void DHTBucket::notifyUpdate() { lastUpdated_ = global::wallclock(); }
diff --git a/src/DHTNode.cc b/src/DHTNode.cc
index 85a5c426..6c88d11c 100644
--- a/src/DHTNode.cc
+++ b/src/DHTNode.cc
@@ -87,9 +87,8 @@ bool DHTNode::isBad() const { return condition_ >= BAD_CONDITION; }
bool DHTNode::isQuestionable() const
{
- return !isBad() &&
- lastContact_.difference(global::wallclock()) >=
- DHT_NODE_CONTACT_INTERVAL;
+ return !isBad() && lastContact_.difference(global::wallclock()) >=
+ DHT_NODE_CONTACT_INTERVAL;
}
void DHTNode::markGood() { condition_ = 0; }
diff --git a/src/DHTNodeLookupEntry.h b/src/DHTNodeLookupEntry.h
index 6475381b..f7a938aa 100644
--- a/src/DHTNodeLookupEntry.h
+++ b/src/DHTNodeLookupEntry.h
@@ -55,6 +55,6 @@ struct DHTNodeLookupEntry {
bool operator==(const DHTNodeLookupEntry& entry) const;
};
-} // namespace aria2;
+} // namespace aria2
#endif // D_DHT_NODE_LOOKUP_ENTRY_H
diff --git a/src/FtpConnection.cc b/src/FtpConnection.cc
index febc81aa..415b8ebd 100644
--- a/src/FtpConnection.cc
+++ b/src/FtpConnection.cc
@@ -235,9 +235,9 @@ bool FtpConnection::sendPort(const std::shared_ptr<SocketCore>& serverSocket)
bool FtpConnection::sendRest(const std::shared_ptr<Segment>& segment)
{
if (socketBuffer_.sendBufferIsEmpty()) {
- std::string request = fmt("REST %" PRId64 "\r\n",
- segment ? segment->getPositionToWrite()
- : static_cast<int64_t>(0LL));
+ std::string request =
+ fmt("REST %" PRId64 "\r\n", segment ? segment->getPositionToWrite()
+ : static_cast<int64_t>(0LL));
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, cuid_, request.c_str()));
socketBuffer_.pushStr(std::move(request));
}
diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc
index bcb6a9ec..58981dd7 100644
--- a/src/HttpHeader.cc
+++ b/src/HttpHeader.cc
@@ -202,7 +202,7 @@ bool HttpHeader::fieldContains(int hdKey, const char* value)
util::splitIter((*i).second.begin(), (*i).second.end(),
std::back_inserter(values), ',',
true // doStrip
- );
+ );
for (const auto& v : values) {
if (util::strieq(v.first, v.second, value)) {
return true;
diff --git a/src/HttpHeader.h b/src/HttpHeader.h
index d8e59aef..50715635 100644
--- a/src/HttpHeader.h
+++ b/src/HttpHeader.h
@@ -163,6 +163,6 @@ public:
int idInterestingHeader(const char* hdName);
-} // namespace
+} // namespace aria2
#endif // D_HTTP_HEADER_H
diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc
index d0e44803..6009dc2f 100644
--- a/src/HttpResponseCommand.cc
+++ b/src/HttpResponseCommand.cc
@@ -279,9 +279,8 @@ bool HttpResponseCommand::executeInternal()
// we ignore content-length when inflate is required
fe->setLength(0);
if (req->getMethod() == Request::METHOD_GET &&
- (totalLength != 0 ||
- !httpResponse->getHttpHeader()->defined(
- HttpHeader::CONTENT_LENGTH))) {
+ (totalLength != 0 || !httpResponse->getHttpHeader()->defined(
+ HttpHeader::CONTENT_LENGTH))) {
// DownloadContext::knowsTotalLength() == true only when
// server says the size of file is 0 explicitly.
getDownloadContext()->markTotalLengthIsUnknown();
@@ -422,9 +421,8 @@ bool HttpResponseCommand::handleOtherEncoding(
httpResponse.get(), getContentEncodingStreamFilter(httpResponse.get()));
// If chunked transfer-encoding is specified, we have to read end of
// chunk markers(0\r\n\r\n, for example).
- bool chunkedUsed =
- streamFilter &&
- streamFilter->getName() == ChunkedDecodingStreamFilter::NAME;
+ bool chunkedUsed = streamFilter && streamFilter->getName() ==
+ ChunkedDecodingStreamFilter::NAME;
// For zero-length file, check existing file comparing its size
if (!chunkedUsed && getDownloadContext()->knowsTotalLength() &&
diff --git a/src/HttpServer.h b/src/HttpServer.h
index a958c7e5..7b86f038 100644
--- a/src/HttpServer.h
+++ b/src/HttpServer.h
@@ -57,8 +57,8 @@ namespace util {
namespace security {
class HMAC;
class HMACResult;
-}
-}
+} // namespace security
+} // namespace util
enum RequestType { RPC_TYPE_NONE, RPC_TYPE_XML, RPC_TYPE_JSON, RPC_TYPE_JSONP };
diff --git a/src/InitiateConnectionCommandFactory.cc b/src/InitiateConnectionCommandFactory.cc
index 2f864501..f9097680 100644
--- a/src/InitiateConnectionCommandFactory.cc
+++ b/src/InitiateConnectionCommandFactory.cc
@@ -58,7 +58,7 @@ InitiateConnectionCommandFactory::createInitiateConnectionCommand(
// for SSL
|| req->getProtocol() == "https"
#endif // ENABLE_SSL
- ) {
+ ) {
if (requestGroup->getOption()->getAsBool(PREF_ENABLE_HTTP_KEEP_ALIVE)) {
req->setKeepAliveHint(true);
@@ -74,7 +74,7 @@ InitiateConnectionCommandFactory::createInitiateConnectionCommand(
#ifdef HAVE_LIBSSH2
|| req->getProtocol() == "sftp"
#endif // HAVE_LIBSSH2
- ) {
+ ) {
if (req->getFile().empty()) {
throw DL_ABORT_EX(fmt("FTP/SFTP URI %s doesn't contain file path.",
req->getUri().c_str()));
diff --git a/src/LibgnutlsTLSSession.cc b/src/LibgnutlsTLSSession.cc
index 42f7ce0c..386819a2 100644
--- a/src/LibgnutlsTLSSession.cc
+++ b/src/LibgnutlsTLSSession.cc
@@ -107,9 +107,9 @@ int GnuTLSSession::init(sock_t sockfd)
rv_ = gnutls_init(&sslSession_, flags);
#else // GNUTLS_VERSION_NUMBER >= 0x030000
- rv_ = gnutls_init(&sslSession_,
- tlsContext_->getSide() == TLS_CLIENT ? GNUTLS_CLIENT
- : GNUTLS_SERVER);
+ rv_ = gnutls_init(&sslSession_, tlsContext_->getSide() == TLS_CLIENT
+ ? GNUTLS_CLIENT
+ : GNUTLS_SERVER);
#endif // GNUTLS_VERSION_NUMBER >= 0x030000
if (rv_ != GNUTLS_E_SUCCESS) {
return TLS_ERR_ERROR;
diff --git a/src/LibsslTLSContext.cc b/src/LibsslTLSContext.cc
index 171e498c..62a5577d 100644
--- a/src/LibsslTLSContext.cc
+++ b/src/LibsslTLSContext.cc
@@ -125,15 +125,14 @@ OpenSSLTLSContext::OpenSSLTLSContext(TLSSessionSide side, TLSVersion minVer)
};
// Disable SSLv2 and enable all workarounds for buggy servers
- SSL_CTX_set_options(sslCtx_,
- SSL_OP_ALL | SSL_OP_NO_SSLv2 | ver_opts
+ SSL_CTX_set_options(sslCtx_, SSL_OP_ALL | SSL_OP_NO_SSLv2 | ver_opts
#ifdef SSL_OP_SINGLE_ECDH_USE
- | SSL_OP_SINGLE_ECDH_USE
+ | SSL_OP_SINGLE_ECDH_USE
#endif // SSL_OP_SINGLE_ECDH_USE
#ifdef SSL_OP_NO_COMPRESSION
- | SSL_OP_NO_COMPRESSION
+ | SSL_OP_NO_COMPRESSION
#endif // SSL_OP_NO_COMPRESSION
- );
+ );
SSL_CTX_set_mode(sslCtx_, SSL_MODE_AUTO_RETRY);
SSL_CTX_set_mode(sslCtx_, SSL_MODE_ENABLE_PARTIAL_WRITE);
#ifdef SSL_MODE_RELEASE_BUFFERS
diff --git a/src/LibuvEventPoll.cc b/src/LibuvEventPoll.cc
index 3065e804..3b877fff 100644
--- a/src/LibuvEventPoll.cc
+++ b/src/LibuvEventPoll.cc
@@ -66,7 +66,7 @@ template <typename T> static void close_callback(uv_handle_t* handle)
}
static void timer_callback(uv_timer_t* handle) { uv_stop(handle->loop); }
-}
+} // namespace
namespace aria2 {
diff --git a/src/LpdMessageDispatcher.cc b/src/LpdMessageDispatcher.cc
index 888bc80e..cda6cc04 100644
--- a/src/LpdMessageDispatcher.cc
+++ b/src/LpdMessageDispatcher.cc
@@ -121,4 +121,4 @@ std::string createLpdRequest(const std::string& multicastAddress,
} // namespace bittorrent
-} // namespac aria2
+} // namespace aria2
diff --git a/src/MessageDigest.cc b/src/MessageDigest.cc
index 610d306e..60f368a8 100644
--- a/src/MessageDigest.cc
+++ b/src/MessageDigest.cc
@@ -61,7 +61,7 @@ HashTypeEntry hashTypes[] = {
HashTypeEntry("sha-512", 5), HashTypeEntry("md5", 0),
HashTypeEntry("adler32", 0),
};
-} // namespace aria2
+} // namespace
MessageDigest::MessageDigest(std::unique_ptr<MessageDigestImpl> impl)
: pImpl_{std::move(impl)}
diff --git a/src/Metalink2RequestGroup.cc b/src/Metalink2RequestGroup.cc
index 26fa7575..3c564d13 100644
--- a/src/Metalink2RequestGroup.cc
+++ b/src/Metalink2RequestGroup.cc
@@ -139,9 +139,10 @@ void Metalink2RequestGroup::generate(
const std::shared_ptr<Option>& option, const std::string& baseUri)
{
std::vector<std::shared_ptr<RequestGroup>> tempgroups;
- createRequestGroup(tempgroups, metalink::parseAndQuery(binaryStream.get(),
- option.get(), baseUri),
- option);
+ createRequestGroup(
+ tempgroups,
+ metalink::parseAndQuery(binaryStream.get(), option.get(), baseUri),
+ option);
auto mi = std::make_shared<MetadataInfo>();
setMetadataInfo(std::begin(tempgroups), std::end(tempgroups), mi);
groups.insert(std::end(groups), std::begin(tempgroups), std::end(tempgroups));
diff --git a/src/MetalinkParserController.cc b/src/MetalinkParserController.cc
index 6dd2e9ad..6082ce6a 100644
--- a/src/MetalinkParserController.cc
+++ b/src/MetalinkParserController.cc
@@ -254,7 +254,7 @@ void MetalinkParserController::commitResourceTransaction()
else {
tEntry_->resources.push_back(std::move(tResource_));
}
-#else // !ENABLE_BITTORRENT
+#else // !ENABLE_BITTORRENT
tEntry_->resources.push_back(std::move(tResource_));
#endif // !ENABLE_BITTORRENT
tResource_.reset();
diff --git a/src/NullWebSocketSessionMan.h b/src/NullWebSocketSessionMan.h
index 4f760d12..ab81d116 100644
--- a/src/NullWebSocketSessionMan.h
+++ b/src/NullWebSocketSessionMan.h
@@ -62,6 +62,6 @@ public:
} // namespace rpc
-} // aria2
+} // namespace aria2
#endif // D_NULL_WEB_SOCKET_SESSION_MAN_H
diff --git a/src/OpenedFileCounter.cc b/src/OpenedFileCounter.cc
index dd213768..d97b2bbf 100644
--- a/src/OpenedFileCounter.cc
+++ b/src/OpenedFileCounter.cc
@@ -67,9 +67,8 @@ void OpenedFileCounter::ensureMaxOpenFileLimit(size_t numNewFiles)
auto& requestGroups = rgman_->getRequestGroups();
auto mark = std::begin(requestGroups);
- std::advance(
- mark,
- SimpleRandomizer::getInstance()->getRandomNumber(requestGroups.size()));
+ std::advance(mark, SimpleRandomizer::getInstance()->getRandomNumber(
+ requestGroups.size()));
auto closeFun = [&left](const std::shared_ptr<RequestGroup>& group) {
auto& ps = group->getPieceStorage();
diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc
index 44d1c3bf..4339c912 100644
--- a/src/OptionHandlerFactory.cc
+++ b/src/OptionHandlerFactory.cc
@@ -755,7 +755,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
new LocalFilePathOptionHandler(
PREF_RPC_CERTIFICATE, TEXT_RPC_CERTIFICATE, NO_DEFAULT_VALUE, false)
#endif // HAVE_APPLETLS
- );
+ );
op->addTag(TAG_RPC);
handlers.push_back(op);
}
@@ -1041,7 +1041,7 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
new LocalFilePathOptionHandler(PREF_CERTIFICATE, TEXT_CERTIFICATE,
NO_DEFAULT_VALUE, false)
#endif // HAVE_APPLETLS
- );
+ );
op->addTag(TAG_HTTP);
op->addTag(TAG_HTTPS);
handlers.push_back(op);
@@ -1480,10 +1480,10 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
handlers.push_back(op);
}
{
- OptionHandler* op(new DefaultOptionHandler(PREF_BT_EXCLUDE_TRACKER,
- TEXT_BT_EXCLUDE_TRACKER,
- NO_DESCRIPTION, "URI,... "
- "or *"));
+ OptionHandler* op(new DefaultOptionHandler(
+ PREF_BT_EXCLUDE_TRACKER, TEXT_BT_EXCLUDE_TRACKER, NO_DESCRIPTION,
+ "URI,... "
+ "or *"));
op->addTag(TAG_BITTORRENT);
op->setInitialOption(true);
op->setChangeGlobalOption(true);
diff --git a/src/Platform.cc b/src/Platform.cc
index cbeab9e9..5833bb22 100644
--- a/src/Platform.cc
+++ b/src/Platform.cc
@@ -85,7 +85,7 @@ void gnutls_log_callback(int level, const char* str)
msg.resize(msg.size() - 1);
A2_LOG_DEBUG(fmt("GnuTLS: <%d> %s", level, msg.c_str()));
}
-}
+} // namespace
#endif // HAVE_LIBGNUTLS
bool Platform::initialized_ = false;
diff --git a/src/RpcMethodImpl.cc b/src/RpcMethodImpl.cc
index 15746097..38156053 100644
--- a/src/RpcMethodImpl.cc
+++ b/src/RpcMethodImpl.cc
@@ -791,9 +791,10 @@ void gatherProgress(Dict* entryDict, const std::shared_ptr<RequestGroup>& group,
gatherProgressCommon(entryDict, group, keys);
#ifdef ENABLE_BITTORRENT
if (group->getDownloadContext()->hasAttribute(CTX_ATTR_BT)) {
- gatherProgressBitTorrent(entryDict, group, bittorrent::getTorrentAttrs(
- group->getDownloadContext()),
- e->getBtRegistry()->get(group->getGID()), keys);
+ gatherProgressBitTorrent(
+ entryDict, group,
+ bittorrent::getTorrentAttrs(group->getDownloadContext()),
+ e->getBtRegistry()->get(group->getGID()), keys);
}
#endif // ENABLE_BITTORRENT
if (e->getCheckIntegrityMan()) {
@@ -1601,7 +1602,7 @@ void changeOption(const std::shared_ptr<RequestGroup>& group,
#ifdef ENABLE_BITTORRENT
&& !dctx->hasAttribute(CTX_ATTR_BT)
#endif // ENABLE_BITTORRENT
- ) {
+ ) {
// In case of Metalink
for (auto& fileEntry : dctx->getFileEntries()) {
// PREF_OUT is not applicable to Metalink. We have always
diff --git a/src/SSHSession.h b/src/SSHSession.h
index 4034add7..2891af31 100644
--- a/src/SSHSession.h
+++ b/src/SSHSession.h
@@ -135,6 +135,6 @@ private:
LIBSSH2_SFTP_HANDLE* sftph_;
sock_t fd_;
};
-}
+} // namespace aria2
#endif // SSH_SESSION_H
diff --git a/src/SelectEventPoll.cc b/src/SelectEventPoll.cc
index 5f6f3309..38f9de4b 100644
--- a/src/SelectEventPoll.cc
+++ b/src/SelectEventPoll.cc
@@ -199,7 +199,7 @@ void SelectEventPoll::poll(const struct timeval& tv)
// winsock will report non-blocking connect() errors in efds,
// unlike posix, which will mark such sockets as writable.
retval = select(fdmax_ + 1, &rfds, &wfds, &efds, &ttv);
-#else // !__MINGW32__
+#else // !__MINGW32__
retval = select(fdmax_ + 1, &rfds, &wfds, nullptr, &ttv);
#endif // !__MINGW32__
} while (retval == -1 && errno == EINTR);
diff --git a/src/SessionSerializer.cc b/src/SessionSerializer.cc
index 8dd9008a..6dbdabea 100644
--- a/src/SessionSerializer.cc
+++ b/src/SessionSerializer.cc
@@ -223,14 +223,12 @@ bool writeDownloadResult(IOFile& fp, std::set<a2_gid_t>& metainfoCache,
// also exists in remaining URIs.
{
Unique<std::string> unique;
- if (hasRemaining &&
- !writeUri(fp, file->getRemainingUris().begin(),
- file->getRemainingUris().end(), unique)) {
+ if (hasRemaining && !writeUri(fp, file->getRemainingUris().begin(),
+ file->getRemainingUris().end(), unique)) {
return false;
}
- if (hasSpent &&
- !writeUri(fp, file->getSpentUris().begin(),
- file->getSpentUris().end(), unique)) {
+ if (hasSpent && !writeUri(fp, file->getSpentUris().begin(),
+ file->getSpentUris().end(), unique)) {
return false;
}
}
diff --git a/src/StreamCheckIntegrityEntry.cc b/src/StreamCheckIntegrityEntry.cc
index 17f26521..0701bb1f 100644
--- a/src/StreamCheckIntegrityEntry.cc
+++ b/src/StreamCheckIntegrityEntry.cc
@@ -58,8 +58,9 @@ void StreamCheckIntegrityEntry::onDownloadIncomplete(
if (getRequestGroup()->getOption()->getAsBool(PREF_HASH_CHECK_ONLY)) {
return;
}
- proceedFileAllocation(commands, make_unique<StreamFileAllocationEntry>(
- getRequestGroup(), popNextCommand()),
+ proceedFileAllocation(commands,
+ make_unique<StreamFileAllocationEntry>(
+ getRequestGroup(), popNextCommand()),
e);
}
diff --git a/src/TLSSession.h b/src/TLSSession.h
index 6e8988f2..dc540ec9 100644
--- a/src/TLSSession.h
+++ b/src/TLSSession.h
@@ -118,6 +118,6 @@ private:
TLSSession(const TLSSession&);
TLSSession& operator=(const TLSSession&);
};
-}
+} // namespace aria2
#endif // TLS_SESSION_H
diff --git a/src/ValueBaseStructParserStateMachine.h b/src/ValueBaseStructParserStateMachine.h
index c41f3c8e..a049de3a 100644
--- a/src/ValueBaseStructParserStateMachine.h
+++ b/src/ValueBaseStructParserStateMachine.h
@@ -47,7 +47,7 @@ class ValueBase;
namespace rpc {
class XmlRpcRequestParserController;
-} // namespace rpc;
+} // namespace rpc
class ValueBaseStructParserState;
diff --git a/src/WebSocketResponseCommand.cc b/src/WebSocketResponseCommand.cc
index 1fe92ee2..8dd0ce5d 100644
--- a/src/WebSocketResponseCommand.cc
+++ b/src/WebSocketResponseCommand.cc
@@ -55,8 +55,8 @@ WebSocketResponseCommand::~WebSocketResponseCommand() = default;
void WebSocketResponseCommand::afterSend(
const std::shared_ptr<HttpServer>& httpServer, DownloadEngine* e)
{
- auto wsSession = std::make_shared<WebSocketSession>(
- httpServer->getSocket(), getDownloadEngine());
+ auto wsSession = std::make_shared<WebSocketSession>(httpServer->getSocket(),
+ getDownloadEngine());
auto command = make_unique<WebSocketInteractionCommand>(
getCuid(), wsSession, e, wsSession->getSocket());
wsSession->setCommand(command.get());
diff --git a/src/WebSocketSessionMan.h b/src/WebSocketSessionMan.h
index 7014c24d..c3f3a071 100644
--- a/src/WebSocketSessionMan.h
+++ b/src/WebSocketSessionMan.h
@@ -69,6 +69,6 @@ private:
} // namespace rpc
-} // aria2
+} // namespace aria2
#endif // D_WEB_SOCKET_SESSION_MAN_H
diff --git a/src/WinTLSSession.cc b/src/WinTLSSession.cc
index eba81ce8..3ea20e41 100644
--- a/src/WinTLSSession.cc
+++ b/src/WinTLSSession.cc
@@ -612,7 +612,7 @@ restart:
// ... and start sending it
state_ = st_handshake_write;
}
- // Fall through
+ // Fall through
case st_handshake_write_last:
case st_handshake_write: {
@@ -644,7 +644,7 @@ restart:
// Have to read one or more response messages.
state_ = st_handshake_read;
}
- // Fall through
+ // Fall through
case st_handshake_read: {
read:
@@ -764,7 +764,7 @@ restart:
goto restart;
}
}
- // Fall through
+ // Fall through
case st_handshake_done:
if (obtainTLSRecordSizes() != 0) {
diff --git a/src/console.cc b/src/console.cc
index 98d05278..fe519bf5 100644
--- a/src/console.cc
+++ b/src/console.cc
@@ -48,7 +48,7 @@ namespace {
Console consoleCout;
Console consoleCerr;
Console consoleCoutBackup;
-};
+}; // namespace
void initConsole(bool suppress)
{
diff --git a/src/util.cc b/src/util.cc
index 6c1aed26..be73a6e4 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -323,7 +323,7 @@ bool isUtf8(const std::string& str)
firstChar == 0x0au || // \n
firstChar == 0x0cu || // \f
firstChar == 0x0du // \r
- ) {
+ ) {
// UTF8-1 (without ctrl chars)
}
else if (in(firstChar, 0xc2u, 0xdfu)) {
@@ -810,28 +810,375 @@ 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)
@@ -1341,7 +1688,7 @@ static BOOL WINAPI HandlerRoutine(DWORD ctrlType)
}
return FALSE;
}
-}
+} // namespace
#endif
void setGlobalSignalHandler(int sig, sigset_t* mask, signal_handler_t handler,
@@ -1444,7 +1791,7 @@ std::string getXDGDir(const std::string& environmentVariable,
if (p &&
#ifndef __MINGW32__
p[0] == '/'
-#else // __MINGW32__
+#else // __MINGW32__
p[0] && p[1] == ':'
#endif // __MINGW32__
) {
@@ -1598,9 +1945,10 @@ void mkdirs(const std::string& dirpath)
if (!dir.mkdirs()) {
int errNum = errno;
if (!dir.isDir()) {
- throw DL_ABORT_EX3(errNum, fmt(EX_MAKE_DIR, dir.getPath().c_str(),
- safeStrerror(errNum).c_str()),
- error_code::DIR_CREATE_ERROR);
+ throw DL_ABORT_EX3(
+ errNum,
+ fmt(EX_MAKE_DIR, dir.getPath().c_str(), safeStrerror(errNum).c_str()),
+ error_code::DIR_CREATE_ERROR);
}
}
}
@@ -1840,12 +2188,11 @@ std::string escapePath(const std::string& s)
unsigned char c = cc;
if (in(c, 0x00u, 0x1fu) || c == 0x7fu
#ifdef __MINGW32__
- ||
- std::find(std::begin(WIN_INVALID_PATH_CHARS),
- std::end(WIN_INVALID_PATH_CHARS),
- c) != std::end(WIN_INVALID_PATH_CHARS)
+ || std::find(std::begin(WIN_INVALID_PATH_CHARS),
+ std::end(WIN_INVALID_PATH_CHARS),
+ c) != std::end(WIN_INVALID_PATH_CHARS)
#endif // __MINGW32__
- ) {
+ ) {
d += fmt("%%%02X", c);
}
else {
diff --git a/test/ChunkedDecodingStreamFilterTest.cc b/test/ChunkedDecodingStreamFilterTest.cc
index 89665a1a..2b2a8256 100644
--- a/test/ChunkedDecodingStreamFilterTest.cc
+++ b/test/ChunkedDecodingStreamFilterTest.cc
@@ -209,10 +209,9 @@ void ChunkedDecodingStreamFilterTest::testTransform()
void ChunkedDecodingStreamFilterTest::testTransform_withoutTrailer()
{
CPPUNIT_ASSERT_EQUAL(
- (ssize_t)0,
- filter_->transform(writer_, segment_,
- reinterpret_cast<const unsigned char*>("0\r\n\r\n"),
- 5));
+ (ssize_t)0, filter_->transform(
+ writer_, segment_,
+ reinterpret_cast<const unsigned char*>("0\r\n\r\n"), 5));
CPPUNIT_ASSERT(filter_->finished());
}
diff --git a/test/HandshakeExtensionMessageTest.cc b/test/HandshakeExtensionMessageTest.cc
index 034bf536..6a6a46e2 100644
--- a/test/HandshakeExtensionMessageTest.cc
+++ b/test/HandshakeExtensionMessageTest.cc
@@ -113,12 +113,10 @@ void HandshakeExtensionMessageTest::testDoReceivedAction()
msg.doReceivedAction();
CPPUNIT_ASSERT_EQUAL((uint16_t)6889, peer->getPort());
- CPPUNIT_ASSERT_EQUAL(
- (uint8_t)1,
- peer->getExtensionMessageID(ExtensionMessageRegistry::UT_PEX));
- CPPUNIT_ASSERT_EQUAL(
- (uint8_t)3,
- peer->getExtensionMessageID(ExtensionMessageRegistry::UT_METADATA));
+ CPPUNIT_ASSERT_EQUAL((uint8_t)1, peer->getExtensionMessageID(
+ ExtensionMessageRegistry::UT_PEX));
+ CPPUNIT_ASSERT_EQUAL((uint8_t)3, peer->getExtensionMessageID(
+ ExtensionMessageRegistry::UT_METADATA));
CPPUNIT_ASSERT(peer->isSeeder());
auto attrs = bittorrent::getTorrentAttrs(dctx);
CPPUNIT_ASSERT_EQUAL((size_t)1_k, attrs->metadataSize);
diff --git a/test/HttpRequestTest.cc b/test/HttpRequestTest.cc
index 65cd2f20..432852b0 100644
--- a/test/HttpRequestTest.cc
+++ b/test/HttpRequestTest.cc
@@ -625,8 +625,9 @@ void HttpRequestTest::testCreateRequest_wantDigest()
"Cache-Control: no-cache\r\n"
"Connection: close\r\n"
"Want-Digest: " +
- wantDigest + "\r\n"
- "\r\n";
+ wantDigest +
+ "\r\n"
+ "\r\n";
CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
}
diff --git a/test/IndexedListTest.cc b/test/IndexedListTest.cc
index 7b8878c8..8cbd1de5 100644
--- a/test/IndexedListTest.cc
+++ b/test/IndexedListTest.cc
@@ -405,7 +405,7 @@ namespace {
struct RemoveOdd {
bool operator()(int* p) const { return *p % 2 == 1; }
};
-}
+} // namespace
void IndexedListTest::testRemoveIf()
{
int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
diff --git a/test/MetalinkProcessorTest.cc b/test/MetalinkProcessorTest.cc
index 905f6613..68ab322b 100644
--- a/test/MetalinkProcessorTest.cc
+++ b/test/MetalinkProcessorTest.cc
@@ -140,7 +140,7 @@ void MetalinkProcessorTest::testParseFileV4()
mu->url);
CPPUNIT_ASSERT_EQUAL(2, mu->priority);
CPPUNIT_ASSERT_EQUAL(std::string("torrent"), mu->mediatype);
-#else // !ENABLE_BITTORRENT
+#else // !ENABLE_BITTORRENT
CPPUNIT_ASSERT_EQUAL((size_t)0, e->metaurls.size());
#endif // !ENABLE_BITTORRENT
}
diff --git a/test/PeerSessionResourceTest.cc b/test/PeerSessionResourceTest.cc
index a764432a..1cb08263 100644
--- a/test/PeerSessionResourceTest.cc
+++ b/test/PeerSessionResourceTest.cc
@@ -140,9 +140,8 @@ void PeerSessionResourceTest::testGetExtensionMessageID()
res.addExtension(ExtensionMessageRegistry::UT_PEX, 9);
CPPUNIT_ASSERT_EQUAL(
(uint8_t)9, res.getExtensionMessageID(ExtensionMessageRegistry::UT_PEX));
- CPPUNIT_ASSERT_EQUAL(
- (uint8_t)0,
- res.getExtensionMessageID(ExtensionMessageRegistry::UT_METADATA));
+ CPPUNIT_ASSERT_EQUAL((uint8_t)0, res.getExtensionMessageID(
+ ExtensionMessageRegistry::UT_METADATA));
CPPUNIT_ASSERT_EQUAL(std::string("ut_pex"),
std::string(res.getExtensionName(9)));
diff --git a/test/RequestGroupManTest.cc b/test/RequestGroupManTest.cc
index 09a69f30..08bab619 100644
--- a/test/RequestGroupManTest.cc
+++ b/test/RequestGroupManTest.cc
@@ -149,53 +149,38 @@ void RequestGroupManTest::testChangeReservedGroupPosition()
std::make_shared<RequestGroup>(GroupId::create(), util::copy(option_))};
RequestGroupMan rm(gs, 0, option_.get());
- CPPUNIT_ASSERT_EQUAL(
- (size_t)0,
- rm.changeReservedGroupPosition(gs[0]->getGID(), 0, OFFSET_MODE_SET));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)1,
- rm.changeReservedGroupPosition(gs[0]->getGID(), 1, OFFSET_MODE_SET));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)3,
- rm.changeReservedGroupPosition(gs[0]->getGID(), 10, OFFSET_MODE_SET));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)0,
- rm.changeReservedGroupPosition(gs[0]->getGID(), -10, OFFSET_MODE_SET));
-
- CPPUNIT_ASSERT_EQUAL(
- (size_t)1,
- rm.changeReservedGroupPosition(gs[1]->getGID(), 0, OFFSET_MODE_CUR));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)2,
- rm.changeReservedGroupPosition(gs[1]->getGID(), 1, OFFSET_MODE_CUR));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)1,
- rm.changeReservedGroupPosition(gs[1]->getGID(), -1, OFFSET_MODE_CUR));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)0,
- rm.changeReservedGroupPosition(gs[1]->getGID(), -10, OFFSET_MODE_CUR));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)1,
- rm.changeReservedGroupPosition(gs[1]->getGID(), 1, OFFSET_MODE_CUR));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)3,
- rm.changeReservedGroupPosition(gs[1]->getGID(), 10, OFFSET_MODE_CUR));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)1,
- rm.changeReservedGroupPosition(gs[1]->getGID(), -2, OFFSET_MODE_CUR));
-
- CPPUNIT_ASSERT_EQUAL(
- (size_t)3,
- rm.changeReservedGroupPosition(gs[3]->getGID(), 0, OFFSET_MODE_END));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)2,
- rm.changeReservedGroupPosition(gs[3]->getGID(), -1, OFFSET_MODE_END));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)0,
- rm.changeReservedGroupPosition(gs[3]->getGID(), -10, OFFSET_MODE_END));
- CPPUNIT_ASSERT_EQUAL(
- (size_t)3,
- rm.changeReservedGroupPosition(gs[3]->getGID(), 10, OFFSET_MODE_END));
+ CPPUNIT_ASSERT_EQUAL((size_t)0, rm.changeReservedGroupPosition(
+ gs[0]->getGID(), 0, OFFSET_MODE_SET));
+ CPPUNIT_ASSERT_EQUAL((size_t)1, rm.changeReservedGroupPosition(
+ gs[0]->getGID(), 1, OFFSET_MODE_SET));
+ CPPUNIT_ASSERT_EQUAL((size_t)3, rm.changeReservedGroupPosition(
+ gs[0]->getGID(), 10, OFFSET_MODE_SET));
+ CPPUNIT_ASSERT_EQUAL((size_t)0, rm.changeReservedGroupPosition(
+ gs[0]->getGID(), -10, OFFSET_MODE_SET));
+
+ CPPUNIT_ASSERT_EQUAL((size_t)1, rm.changeReservedGroupPosition(
+ gs[1]->getGID(), 0, OFFSET_MODE_CUR));
+ CPPUNIT_ASSERT_EQUAL((size_t)2, rm.changeReservedGroupPosition(
+ gs[1]->getGID(), 1, OFFSET_MODE_CUR));
+ CPPUNIT_ASSERT_EQUAL((size_t)1, rm.changeReservedGroupPosition(
+ gs[1]->getGID(), -1, OFFSET_MODE_CUR));
+ CPPUNIT_ASSERT_EQUAL((size_t)0, rm.changeReservedGroupPosition(
+ gs[1]->getGID(), -10, OFFSET_MODE_CUR));
+ CPPUNIT_ASSERT_EQUAL((size_t)1, rm.changeReservedGroupPosition(
+ gs[1]->getGID(), 1, OFFSET_MODE_CUR));
+ CPPUNIT_ASSERT_EQUAL((size_t)3, rm.changeReservedGroupPosition(
+ gs[1]->getGID(), 10, OFFSET_MODE_CUR));
+ CPPUNIT_ASSERT_EQUAL((size_t)1, rm.changeReservedGroupPosition(
+ gs[1]->getGID(), -2, OFFSET_MODE_CUR));
+
+ CPPUNIT_ASSERT_EQUAL((size_t)3, rm.changeReservedGroupPosition(
+ gs[3]->getGID(), 0, OFFSET_MODE_END));
+ CPPUNIT_ASSERT_EQUAL((size_t)2, rm.changeReservedGroupPosition(
+ gs[3]->getGID(), -1, OFFSET_MODE_END));
+ CPPUNIT_ASSERT_EQUAL((size_t)0, rm.changeReservedGroupPosition(
+ gs[3]->getGID(), -10, OFFSET_MODE_END));
+ CPPUNIT_ASSERT_EQUAL((size_t)3, rm.changeReservedGroupPosition(
+ gs[3]->getGID(), 10, OFFSET_MODE_END));
CPPUNIT_ASSERT_EQUAL((size_t)4, rm.getReservedGroups().size());
diff --git a/test/RpcMethodTest.cc b/test/RpcMethodTest.cc
index 292709ba..dbdccf74 100644
--- a/test/RpcMethodTest.cc
+++ b/test/RpcMethodTest.cc
@@ -369,11 +369,10 @@ void RpcMethodTest::testAddTorrent()
CPPUNIT_ASSERT_EQUAL(e_->getOption()->get(PREF_DIR) +
"/aria2-0.8.2.tar.bz2",
group->getFirstFilePath());
- CPPUNIT_ASSERT_EQUAL((size_t)1,
- group->getDownloadContext()
- ->getFirstFileEntry()
- ->getRemainingUris()
- .size());
+ CPPUNIT_ASSERT_EQUAL((size_t)1, group->getDownloadContext()
+ ->getFirstFileEntry()
+ ->getRemainingUris()
+ .size());
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/aria2-0.8.2.tar.bz2"),
group->getDownloadContext()
->getFirstFileEntry()
@@ -1288,7 +1287,9 @@ void RpcMethodTest::testGetSessionInfo()
void RpcMethodTest::testPause()
{
std::vector<std::string> uris{
- "http://url1", "http://url2", "http://url3",
+ "http://url1",
+ "http://url2",
+ "http://url3",
};
option_->put(PREF_FORCE_SEQUENTIAL, A2_V_TRUE);
std::vector<std::shared_ptr<RequestGroup>> groups;
diff --git a/test/UriSplitTest.cc b/test/UriSplitTest.cc
index c0658b81..091b8d0b 100644
--- a/test/UriSplitTest.cc
+++ b/test/UriSplitTest.cc
@@ -61,9 +61,8 @@ void UriSplitTest::testUriSplit()
uri = "http://user@aria2.sf.net/path/";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
- (1 << USR_USERINFO) | (1 << USR_USER));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
+ (1 << USR_USERINFO) | (1 << USR_USER));
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
@@ -72,10 +71,9 @@ void UriSplitTest::testUriSplit()
uri = "http://user:pass@aria2.sf.net/path/";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
- (1 << USR_USERINFO) | (1 << USR_USER) |
- (1 << USR_PASSWD));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
+ (1 << USR_USERINFO) | (1 << USR_USER) |
+ (1 << USR_PASSWD));
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
@@ -89,10 +87,9 @@ void UriSplitTest::testUriSplit()
uri = "http://user@foo.com:pass@aria2.sf.net/path/";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
- (1 << USR_USERINFO) | (1 << USR_USER) |
- (1 << USR_PASSWD));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
+ (1 << USR_USERINFO) | (1 << USR_USER) |
+ (1 << USR_PASSWD));
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user@foo.com:pass"),
@@ -104,9 +101,8 @@ void UriSplitTest::testUriSplit()
uri = "https://aria2.sf.net:443/path/";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
- (1 << USR_PATH));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
+ (1 << USR_PATH));
CPPUNIT_ASSERT_EQUAL(std::string("https"), mkstr(res, USR_SCHEME, uri));
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
@@ -116,10 +112,9 @@ void UriSplitTest::testUriSplit()
uri = "https://user:pass@aria2.sf.net:443/path/";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
- (1 << USR_PATH) | (1 << USR_USERINFO) | (1 << USR_USER) |
- (1 << USR_PASSWD));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
+ (1 << USR_PATH) | (1 << USR_USERINFO) |
+ (1 << USR_USER) | (1 << USR_PASSWD));
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
@@ -131,9 +126,9 @@ void UriSplitTest::testUriSplit()
uri = "https://user@aria2.sf.net:443/path/";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
- (1 << USR_PATH) | (1 << USR_USERINFO) | (1 << USR_USER));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
+ (1 << USR_PATH) | (1 << USR_USERINFO) |
+ (1 << USR_USER));
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
@@ -157,9 +152,8 @@ void UriSplitTest::testUriSplit()
uri = "http://user@aria2";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_USERINFO) |
- (1 << USR_USER));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
+ (1 << USR_USERINFO) | (1 << USR_USER));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
@@ -167,9 +161,9 @@ void UriSplitTest::testUriSplit()
uri = "http://user:@aria2";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_USERINFO) |
- (1 << USR_USER) | (1 << USR_PASSWD));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
+ (1 << USR_USERINFO) | (1 << USR_USER) |
+ (1 << USR_PASSWD));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user:"), mkstr(res, USR_USERINFO, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
@@ -178,9 +172,8 @@ void UriSplitTest::testUriSplit()
uri = "http://aria2/?foo#bar";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
- (1 << USR_QUERY) | (1 << USR_FRAGMENT));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
+ (1 << USR_QUERY) | (1 << USR_FRAGMENT));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string("foo"), mkstr(res, USR_QUERY, uri));
@@ -207,9 +200,8 @@ void UriSplitTest::testUriSplit()
uri = "https://aria2:443?foo";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
- (1 << USR_QUERY));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
+ (1 << USR_QUERY));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("foo"), mkstr(res, USR_QUERY, uri));
CPPUNIT_ASSERT_EQUAL((uint16_t)443, res.port);
@@ -218,9 +210,8 @@ void UriSplitTest::testUriSplit()
uri = "https://aria2:443#bar";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
- (1 << USR_FRAGMENT));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
+ (1 << USR_FRAGMENT));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("bar"), mkstr(res, USR_FRAGMENT, uri));
CPPUNIT_ASSERT_EQUAL((uint16_t)443, res.port);
@@ -229,10 +220,9 @@ void UriSplitTest::testUriSplit()
uri = "https://user:pass@aria2:443?foo";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
- (1 << USR_QUERY) | (1 << USR_USERINFO) | (1 << USR_USER) |
- (1 << USR_PASSWD));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
+ (1 << USR_QUERY) | (1 << USR_USERINFO) |
+ (1 << USR_USER) | (1 << USR_PASSWD));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
@@ -243,10 +233,9 @@ void UriSplitTest::testUriSplit()
uri = "https://user:pass@aria2:443#bar";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
- (1 << USR_FRAGMENT) | (1 << USR_USERINFO) |
- (1 << USR_USER) | (1 << USR_PASSWD));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
+ (1 << USR_FRAGMENT) | (1 << USR_USERINFO) |
+ (1 << USR_USER) | (1 << USR_PASSWD));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
@@ -257,10 +246,9 @@ void UriSplitTest::testUriSplit()
uri = "http://user:pass@aria2?foo";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_QUERY) |
- (1 << USR_USERINFO) | (1 << USR_USER) |
- (1 << USR_PASSWD));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_QUERY) |
+ (1 << USR_USERINFO) | (1 << USR_USER) |
+ (1 << USR_PASSWD));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
@@ -270,10 +258,9 @@ void UriSplitTest::testUriSplit()
uri = "http://user:pass@aria2#bar";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_FRAGMENT) |
- (1 << USR_USERINFO) | (1 << USR_USER) |
- (1 << USR_PASSWD));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
+ (1 << USR_FRAGMENT) | (1 << USR_USERINFO) |
+ (1 << USR_USER) | (1 << USR_PASSWD));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
@@ -283,9 +270,8 @@ void UriSplitTest::testUriSplit()
uri = "http://aria2/?";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
- (1 << USR_QUERY));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
+ (1 << USR_QUERY));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string(""), mkstr(res, USR_QUERY, uri));
@@ -294,9 +280,8 @@ void UriSplitTest::testUriSplit()
uri = "http://aria2/#";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
- (1 << USR_FRAGMENT));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
+ (1 << USR_FRAGMENT));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string(""), mkstr(res, USR_FRAGMENT, uri));
@@ -305,9 +290,8 @@ void UriSplitTest::testUriSplit()
uri = "http://aria2/?#";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
- (1 << USR_QUERY) | (1 << USR_FRAGMENT));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
+ (1 << USR_QUERY) | (1 << USR_FRAGMENT));
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string(""), mkstr(res, USR_QUERY, uri));
@@ -333,9 +317,8 @@ void UriSplitTest::testUriSplit()
uri = "https://user@[::1]";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_USERINFO) |
- (1 << USR_USER));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
+ (1 << USR_USERINFO) | (1 << USR_USER));
CPPUNIT_ASSERT_EQUAL(std::string("::1"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
@@ -345,9 +328,9 @@ void UriSplitTest::testUriSplit()
uri = "https://user:pass@[::1]";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_USERINFO) |
- (1 << USR_USER) | (1 << USR_PASSWD));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
+ (1 << USR_USERINFO) | (1 << USR_USER) |
+ (1 << USR_PASSWD));
CPPUNIT_ASSERT_EQUAL(std::string("::1"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
@@ -357,18 +340,16 @@ void UriSplitTest::testUriSplit()
uri = "http://aria2/f";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
- (1 << USR_BASENAME));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
+ (1 << USR_BASENAME));
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string("f"), mkstr(res, USR_BASENAME, uri));
uri = "http://[::1]/f";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
- (1 << USR_BASENAME));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
+ (1 << USR_BASENAME));
CPPUNIT_ASSERT_EQUAL(std::string("::1"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string("f"), mkstr(res, USR_BASENAME, uri));
@@ -376,9 +357,8 @@ void UriSplitTest::testUriSplit()
uri = "http://[::1]:8080/f";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
- (1 << USR_PATH) | (1 << USR_BASENAME));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
+ (1 << USR_PATH) | (1 << USR_BASENAME));
CPPUNIT_ASSERT_EQUAL((uint16_t)8080, res.port);
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string("f"), mkstr(res, USR_BASENAME, uri));
@@ -386,10 +366,10 @@ void UriSplitTest::testUriSplit()
uri = "https://user:pass@host/f";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_USERINFO) |
- (1 << USR_USER) | (1 << USR_PASSWD) | (1 << USR_PATH) |
- (1 << USR_BASENAME));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
+ (1 << USR_USERINFO) | (1 << USR_USER) |
+ (1 << USR_PASSWD) | (1 << USR_PATH) |
+ (1 << USR_BASENAME));
CPPUNIT_ASSERT_EQUAL(std::string("host"), mkstr(res, USR_HOST, uri));
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
@@ -398,9 +378,8 @@ void UriSplitTest::testUriSplit()
uri = "http://aria2/index.html?foo";
memset(&res, 0, sizeof(res));
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
- CHECK_FIELD_SET(res,
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
- (1 << USR_QUERY) | (1 << USR_BASENAME));
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
+ (1 << USR_QUERY) | (1 << USR_BASENAME));
CPPUNIT_ASSERT_EQUAL(std::string("/index.html"), mkstr(res, USR_PATH, uri));
CPPUNIT_ASSERT_EQUAL(std::string("index.html"),
mkstr(res, USR_BASENAME, uri));