summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-07-04 21:33:36 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-07-04 21:33:36 +0900
commit107de5899779d4c2eecc86aaf74dc4cec8286293 (patch)
tree10be23f5707a8e125ac73048ebc1e97f5569017c /src
parent6ba1725e0f731860f75e67d15e305f35dd0c3d67 (diff)
Return nullptr directly where std::unique_ptr is expected
The constructor of std::unique_ptr which takes nullptr is not explicit so we can return nullptr directly.
Diffstat (limited to 'src')
-rw-r--r--src/AuthConfig.cc2
-rw-r--r--src/AuthConfigFactory.cc4
-rw-r--r--src/HttpConnection.cc2
-rw-r--r--src/HttpResponse.cc4
-rw-r--r--src/LpdMessageReceiver.cc4
-rw-r--r--src/NsCookieParser.cc6
-rw-r--r--src/SimpleBtMessage.cc2
-rw-r--r--src/cookie_helper.cc18
8 files changed, 21 insertions, 21 deletions
diff --git a/src/AuthConfig.cc b/src/AuthConfig.cc
index 379eb6f8..a2f22ce1 100644
--- a/src/AuthConfig.cc
+++ b/src/AuthConfig.cc
@@ -61,7 +61,7 @@ std::unique_ptr<AuthConfig> AuthConfig::create
(std::string user, std::string password)
{
if(user.empty()) {
- return std::unique_ptr<AuthConfig>();
+ return nullptr;
} else {
return make_unique<AuthConfig>(std::move(user), std::move(password));
}
diff --git a/src/AuthConfigFactory.cc b/src/AuthConfigFactory.cc
index 784e9ba4..d0b747d2 100644
--- a/src/AuthConfigFactory.cc
+++ b/src/AuthConfigFactory.cc
@@ -74,7 +74,7 @@ AuthConfigFactory::createAuthConfig
auto i = findBasicCred(request->getHost(), request->getPort(),
request->getDir());
if(i == std::end(basicCreds_)) {
- return std::unique_ptr<AuthConfig>();
+ return nullptr;
} else {
return AuthConfig::create((*i)->user_, (*i)->password_);
}
@@ -114,7 +114,7 @@ AuthConfigFactory::createAuthConfig
createFtpAuthResolver(op)->resolveAuthConfig(request->getHost());
}
} else {
- return std::unique_ptr<AuthConfig>();
+ return nullptr;
}
}
diff --git a/src/HttpConnection.cc b/src/HttpConnection.cc
index 42ca5d7f..596779d9 100644
--- a/src/HttpConnection.cc
+++ b/src/HttpConnection.cc
@@ -159,7 +159,7 @@ std::unique_ptr<HttpResponse> HttpConnection::receiveResponse()
return httpResponse;
} else {
socketRecvBuffer_->shiftBuffer(proc->getLastBytesProcessed());
- return std::unique_ptr<HttpResponse>{};
+ return nullptr;
}
}
diff --git a/src/HttpResponse.cc b/src/HttpResponse.cc
index 7bbe26ef..48eb279b 100644
--- a/src/HttpResponse.cc
+++ b/src/HttpResponse.cc
@@ -199,7 +199,7 @@ HttpResponse::getTransferEncodingStreamFilter() const
return make_unique<ChunkedDecodingStreamFilter>();
}
}
- return std::unique_ptr<StreamFilter>{};
+ return nullptr;
}
bool HttpResponse::isContentEncodingSpecified() const
@@ -221,7 +221,7 @@ HttpResponse::getContentEncodingStreamFilter() const
return make_unique<GZipDecodingStreamFilter>();
}
#endif // HAVE_ZLIB
- return std::unique_ptr<StreamFilter>{};
+ return nullptr;
}
int64_t HttpResponse::getContentLength() const
diff --git a/src/LpdMessageReceiver.cc b/src/LpdMessageReceiver.cc
index c785f0cd..964ff5ed 100644
--- a/src/LpdMessageReceiver.cc
+++ b/src/LpdMessageReceiver.cc
@@ -86,11 +86,11 @@ std::unique_ptr<LpdMessage> LpdMessageReceiver::receiveMessage()
try {
length = socket_->readDataFrom(buf, sizeof(buf), peerAddr);
if(length == 0) {
- return std::unique_ptr<LpdMessage>{};
+ return nullptr;
}
} catch(RecoverableException& e) {
A2_LOG_INFO_EX("Failed to receive LPD message.", e);
- return std::unique_ptr<LpdMessage>{};
+ return nullptr;
}
HttpHeaderProcessor proc(HttpHeaderProcessor::SERVER_PARSER);
try {
diff --git a/src/NsCookieParser.cc b/src/NsCookieParser.cc
index e107a295..f042512b 100644
--- a/src/NsCookieParser.cc
+++ b/src/NsCookieParser.cc
@@ -61,17 +61,17 @@ std::unique_ptr<Cookie> parseNsCookie
util::splitIter(cookieStr.begin(), cookieStr.end(), std::back_inserter(vs),
'\t', true);
if(vs.size() < 6) {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
vs[0].first = util::lstripIter(vs[0].first, vs[0].second, '.');
if(vs[5].first == vs[5].second || vs[0].first == vs[0].second ||
!cookie::goodPath(vs[2].first, vs[2].second)) {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
int64_t expiryTime;
if(!util::parseLLIntNoThrow(expiryTime,
std::string(vs[4].first, vs[4].second))) {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
if(std::numeric_limits<time_t>::max() < expiryTime) {
expiryTime = std::numeric_limits<time_t>::max();
diff --git a/src/SimpleBtMessage.cc b/src/SimpleBtMessage.cc
index d59fc58e..4cddd824 100644
--- a/src/SimpleBtMessage.cc
+++ b/src/SimpleBtMessage.cc
@@ -65,7 +65,7 @@ void SimpleBtMessage::send() {
std::unique_ptr<ProgressUpdate> SimpleBtMessage::getProgressUpdate()
{
- return std::unique_ptr<ProgressUpdate>{};
+ return nullptr;
}
} // namespace aria2
diff --git a/src/cookie_helper.cc b/src/cookie_helper.cc
index 58a4c69c..388e223c 100644
--- a/src/cookie_helper.cc
+++ b/src/cookie_helper.cc
@@ -230,13 +230,13 @@ std::unique_ptr<Cookie> parse
std::string::const_iterator eq = cookieStr.begin();
for(; eq != nvEnd && *eq != '='; ++eq);
if(eq == nvEnd) {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
std::pair<std::string::const_iterator,
std::string::const_iterator> p =
util::stripIter(cookieStr.begin(), eq);
if(p.first == p.second) {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
Scip cookieName(p.first, p.second);
p = util::stripIter(eq+1, nvEnd);
@@ -275,18 +275,18 @@ std::unique_ptr<Cookie> parse
if(parseDate(expiryTime, attrp.first, attrp.second)) {
foundExpires = true;
} else {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
} else if(util::strieq(p.first, p.second, "max-age")) {
if(attrp.first == attrp.second ||
(!in(static_cast<unsigned char>(*attrp.first), 0x30u, 0x39u) &&
*attrp.first != '-')) {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
for(std::string::const_iterator s = attrp.first+1,
eos = attrp.second; s != eos; ++s) {
if(!in(static_cast<unsigned char>(*s), 0x30u, 0x39u)) {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
}
int64_t delta;
@@ -305,17 +305,17 @@ std::unique_ptr<Cookie> parse
}
}
} else {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
} else if(util::strieq(p.first, p.second, "domain")) {
if(attrp.first == attrp.second) {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
std::string::const_iterator noDot = attrp.first;
std::string::const_iterator end = attrp.second;
for(; noDot != end && *noDot == '.'; ++noDot);
if(noDot == end) {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
cookieDomain.assign(noDot, end);
} else if(util::strieq(p.first, p.second, "path")) {
@@ -348,7 +348,7 @@ std::unique_ptr<Cookie> parse
} else if(domainMatch(canonicalizedHost, cookieDomain)) {
hostOnly = util::isNumericHost(canonicalizedHost);
} else {
- return std::unique_ptr<Cookie>{};
+ return nullptr;
}
if(cookiePath.empty()) {