Static check fix
@@ -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");
@@ -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) {
@@ -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)
return;