Merge pull request #2106 from aria2/static-check-fix

Static check fix
This commit is contained in:
Tatsuhiro Tsujikawa 2023-09-18 11:29:23 +09:00 committed by GitHub
commit f05deb0cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -196,8 +196,8 @@ void DHTRoutingTableDeserializer::deserialize(const std::string& filename)
nodes.push_back(node);
}
localNode_ = localNode;
nodes_ = nodes;
localNode_ = std::move(localNode);
nodes_ = std::move(nodes);
A2_LOG_INFO("DHT routing table was loaded successfully");
}

View File

@ -289,6 +289,10 @@ void DefaultBtProgressInfoFile::load()
pieceLength = ntohl(pieceLength);
}
if (pieceLength == 0) {
throw DL_ABORT_EX("piece length must not be 0");
}
uint64_t totalLength;
READ_CHECK(fp, &totalLength, sizeof(totalLength));
if (version >= 1) {

View File

@ -77,7 +77,7 @@ void UriListParser::parseNext(std::vector<std::string>& uris, Option& op)
if (fp_->eof()) {
break;
}
else if (!fp_) {
else if (!*fp_) {
throw DL_ABORT_EX("UriListParser:I/O error.");
}
else {
@ -102,7 +102,7 @@ void UriListParser::parseNext(std::vector<std::string>& uris, Option& op)
if (fp_->eof()) {
return;
}
else if (!fp_) {
else if (!*fp_) {
throw DL_ABORT_EX("UriListParser:I/O error.");
}
}