mirror of https://github.com/aria2/aria2
clang-format
parent
df27e60385
commit
d607327ea6
|
@ -39,8 +39,7 @@
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
class BtChokingEvent {
|
class BtChokingEvent {};
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
||||||
|
|
|
@ -270,23 +270,23 @@ Context::Context(bool standalone, int argc, char** argv, const KeyVals& options)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // ENABLE_METALINK
|
#endif // ENABLE_METALINK
|
||||||
if (!op->blank(PREF_INPUT_FILE)) {
|
if (!op->blank(PREF_INPUT_FILE)) {
|
||||||
if (op->getAsBool(PREF_DEFERRED_INPUT)) {
|
if (op->getAsBool(PREF_DEFERRED_INPUT)) {
|
||||||
uriListParser = openUriListParser(op->get(PREF_INPUT_FILE));
|
uriListParser = openUriListParser(op->get(PREF_INPUT_FILE));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
createRequestGroupForUriList(requestGroups, op);
|
||||||
|
}
|
||||||
|
#if defined(ENABLE_BITTORRENT) || defined(ENABLE_METALINK)
|
||||||
|
}
|
||||||
|
else if (op->get(PREF_SHOW_FILES) == A2_V_TRUE) {
|
||||||
|
showFiles(args, op);
|
||||||
|
return;
|
||||||
|
#endif // ENABLE_METALINK || ENABLE_METALINK
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
createRequestGroupForUriList(requestGroups, op);
|
createRequestGroupForUri(requestGroups, op, args, false, false, true);
|
||||||
}
|
}
|
||||||
#if defined(ENABLE_BITTORRENT) || defined(ENABLE_METALINK)
|
|
||||||
}
|
|
||||||
else if (op->get(PREF_SHOW_FILES) == A2_V_TRUE) {
|
|
||||||
showFiles(args, op);
|
|
||||||
return;
|
|
||||||
#endif // ENABLE_METALINK || ENABLE_METALINK
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
createRequestGroupForUri(requestGroups, op, args, false, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove option values which is only valid for URIs specified in
|
// Remove option values which is only valid for URIs specified in
|
||||||
// command-line. If they are left, because op is used as a template
|
// command-line. If they are left, because op is used as a template
|
||||||
|
|
|
@ -137,9 +137,9 @@ std::unique_ptr<EventPoll> createEventPoll(Option* op)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // HAVE_POLL
|
#endif // HAVE_POLL
|
||||||
if (pollMethod == V_SELECT) {
|
if (pollMethod == V_SELECT) {
|
||||||
return make_unique<SelectEventPoll>();
|
return make_unique<SelectEventPoll>();
|
||||||
}
|
}
|
||||||
assert(0);
|
assert(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,8 +179,7 @@ public:
|
||||||
};
|
};
|
||||||
#else // !ENABLE_ASYNC_DNS
|
#else // !ENABLE_ASYNC_DNS
|
||||||
template <typename SocketEntry, typename EventPoll>
|
template <typename SocketEntry, typename EventPoll>
|
||||||
class ADNSEvent : public Event<SocketEntry> {
|
class ADNSEvent : public Event<SocketEntry> {};
|
||||||
};
|
|
||||||
#endif // !ENABLE_ASYNC_DNS
|
#endif // !ENABLE_ASYNC_DNS
|
||||||
|
|
||||||
template <typename CommandEvent, typename ADNSEvent> class SocketEntry {
|
template <typename CommandEvent, typename ADNSEvent> class SocketEntry {
|
||||||
|
@ -362,8 +361,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#else // !ENABLE_ASYNC_DNS
|
#else // !ENABLE_ASYNC_DNS
|
||||||
template <typename EventPoll> class AsyncNameResolverEntry {
|
template <typename EventPoll> class AsyncNameResolverEntry {};
|
||||||
};
|
|
||||||
#endif // !ENABLE_ASYNC_DNS
|
#endif // !ENABLE_ASYNC_DNS
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -48,8 +48,7 @@ class RequestGroup;
|
||||||
|
|
||||||
namespace rpc {
|
namespace rpc {
|
||||||
|
|
||||||
class WebSocketSession {
|
class WebSocketSession {};
|
||||||
};
|
|
||||||
|
|
||||||
class WebSocketSessionMan {
|
class WebSocketSessionMan {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -863,38 +863,39 @@ void SocketCore::readData(void* data, size_t& len)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // HAVE_LIBSSH2
|
#endif // HAVE_LIBSSH2
|
||||||
if (!secure_) {
|
if (!secure_) {
|
||||||
// Cast for Windows recv()
|
// Cast for Windows recv()
|
||||||
while ((ret = recv(sockfd_, reinterpret_cast<char*>(data), len, 0)) == -1 &&
|
while ((ret = recv(sockfd_, reinterpret_cast<char*>(data), len, 0)) ==
|
||||||
SOCKET_ERRNO == A2_EINTR)
|
-1 &&
|
||||||
;
|
SOCKET_ERRNO == A2_EINTR)
|
||||||
int errNum = SOCKET_ERRNO;
|
;
|
||||||
if (ret == -1) {
|
int errNum = SOCKET_ERRNO;
|
||||||
if (!A2_WOULDBLOCK(errNum)) {
|
if (ret == -1) {
|
||||||
throw DL_RETRY_EX(fmt(EX_SOCKET_RECV, errorMsg(errNum).c_str()));
|
if (!A2_WOULDBLOCK(errNum)) {
|
||||||
}
|
throw DL_RETRY_EX(fmt(EX_SOCKET_RECV, errorMsg(errNum).c_str()));
|
||||||
wantRead_ = true;
|
}
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#ifdef ENABLE_SSL
|
|
||||||
ret = tlsSession_->readData(data, len);
|
|
||||||
if (ret < 0) {
|
|
||||||
if (ret != TLS_ERR_WOULDBLOCK) {
|
|
||||||
throw DL_RETRY_EX(
|
|
||||||
fmt(EX_SOCKET_RECV, tlsSession_->getLastErrorString().c_str()));
|
|
||||||
}
|
|
||||||
if (tlsSession_->checkDirection() == TLS_WANT_READ) {
|
|
||||||
wantRead_ = true;
|
wantRead_ = true;
|
||||||
|
ret = 0;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
wantWrite_ = true;
|
|
||||||
}
|
|
||||||
ret = 0;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
#ifdef ENABLE_SSL
|
||||||
|
ret = tlsSession_->readData(data, len);
|
||||||
|
if (ret < 0) {
|
||||||
|
if (ret != TLS_ERR_WOULDBLOCK) {
|
||||||
|
throw DL_RETRY_EX(
|
||||||
|
fmt(EX_SOCKET_RECV, tlsSession_->getLastErrorString().c_str()));
|
||||||
|
}
|
||||||
|
if (tlsSession_->checkDirection() == TLS_WANT_READ) {
|
||||||
|
wantRead_ = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wantWrite_ = true;
|
||||||
|
}
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
#endif // ENABLE_SSL
|
#endif // ENABLE_SSL
|
||||||
}
|
}
|
||||||
|
|
||||||
len = ret;
|
len = ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,7 +303,8 @@ std::unique_ptr<Cookie> parse(const std::string& cookieStr,
|
||||||
|
|
||||||
if (n > std::numeric_limits<int64_t>::max() - delta) {
|
if (n > std::numeric_limits<int64_t>::max() - delta) {
|
||||||
maxAge = std::numeric_limits<time_t>::max();
|
maxAge = std::numeric_limits<time_t>::max();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
n += delta;
|
n += delta;
|
||||||
|
|
||||||
if (n < 0 || std::numeric_limits<time_t>::max() < n) {
|
if (n < 0 || std::numeric_limits<time_t>::max() < n) {
|
||||||
|
|
|
@ -87,7 +87,8 @@ static char* eai_errlist[] = {
|
||||||
/*
|
/*
|
||||||
* gai_strerror().
|
* gai_strerror().
|
||||||
*/
|
*/
|
||||||
const char* gai_strerror(ecode) int ecode;
|
const char* gai_strerror(ecode)
|
||||||
|
int ecode;
|
||||||
{
|
{
|
||||||
if (ecode < 0 || ecode > EAI_SYSTEM)
|
if (ecode < 0 || ecode > EAI_SYSTEM)
|
||||||
return _("Unknown error");
|
return _("Unknown error");
|
||||||
|
|
|
@ -224,7 +224,8 @@ static int itoa_length();
|
||||||
/*
|
/*
|
||||||
* gai_strerror().
|
* gai_strerror().
|
||||||
*/
|
*/
|
||||||
const char* gai_strerror(ecode) int ecode;
|
const char* gai_strerror(ecode)
|
||||||
|
int ecode;
|
||||||
{
|
{
|
||||||
if (ecode < 0 || ecode > EAI_SYSTEM)
|
if (ecode < 0 || ecode > EAI_SYSTEM)
|
||||||
return _("Unknown error");
|
return _("Unknown error");
|
||||||
|
@ -295,7 +296,8 @@ static int is_address(s) const char* s;
|
||||||
* Calcurate length of the string `s', where `s' is set by
|
* Calcurate length of the string `s', where `s' is set by
|
||||||
* sprintf(s, "%d", n).
|
* sprintf(s, "%d", n).
|
||||||
*/
|
*/
|
||||||
static int itoa_length(n) int n;
|
static int itoa_length(n)
|
||||||
|
int n;
|
||||||
{
|
{
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue