Skip to content

Commit

Permalink
Address a few more low priority coverity complaints
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Flynn <tom.flynn@gmail.com>
(cherry picked from commit 04daadc)
  • Loading branch information
tomflynn authored and tbachman committed May 28, 2024
1 parent 7b627d0 commit 3aaf55c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion agent-ovs/lib/Agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ void Agent::setProperties(const boost::property_tree::ptree& properties) {
optional<std::string> policyFile =
properties.get_optional<std::string>(OPFLEX_POLICY_FILE);
if (policyFile) {
opflexPolicyFile = policyFile;
opflexPolicyFile = std::move(policyFile);
LOG(INFO) << "Startup policy file set to " << opflexPolicyFile;
}

Expand Down
2 changes: 1 addition & 1 deletion agent-ovs/lib/PolicyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2913,7 +2913,7 @@ void PolicyManager::updateRemoteRoutes(const URI& uri,
routeIter->second->setPresent(true);
if(*(routeIter->second) != *newRoute) {
//Updated remote route
routeIter->second = newRoute;
routeIter->second = std::move(newRoute);
routeIter->second->setPresent(true);
notifyRemoteRoutes.insert(route->getURI());
updatePolicyPrefixChildrenForRemoteRoute(rd.get()->getURI(),
Expand Down
6 changes: 3 additions & 3 deletions agent-ovs/lib/QosManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace opflexagent {
if (qosReqOpt) {
qosmanager.notifyUpdate.insert(uri);
qosmanager.taskQueue.dispatch(uri.toString(), [=]() {
processQosConfig(qosReqOpt.get()); });
processQosConfig(std::move(qosReqOpt).get()); });
}
} else if (classId == modelgbp::qos::BandwidthLimit::CLASS_ID){
optional<shared_ptr<modelgbp::qos::BandwidthLimit>> qosBandwidthOpt =
Expand Down Expand Up @@ -207,7 +207,7 @@ namespace opflexagent {
}
}
}
notifyListeners(interface, BOTH, qosUri);
notifyListeners(interface, BOTH, std::move(qosUri));
}
}

Expand Down Expand Up @@ -473,7 +473,7 @@ namespace opflexagent {

}
string taskId = updatedUri.toString()+ interface + dir;
qosmanager.taskQueue.dispatch(taskId, [=]() {
qosmanager.taskQueue.dispatch(std::move(taskId), [=]() {
qosmanager.notifyListeners(interface, dir, std::move(req));
});
}
Expand Down
2 changes: 1 addition & 1 deletion agent-ovs/ovs/Packets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ OfpBuf compose_dhcpv4_reply(uint8_t message_type,
if (prefix > 32) prefix = 32;

static_route_len += (prefix / 8) + (prefix % 8 != 0) + 5;
routes.emplace_back(Routev4(dst, prefix, nextHop));
routes.emplace_back(dst, prefix, nextHop);
if (routes.size() >= MAX_ROUTE) break;
}
if (static_route_len > 0) static_route_len += 2;
Expand Down
12 changes: 6 additions & 6 deletions agent-ovs/ovs/SpanRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ namespace opflexagent {
}

LOG(INFO) << "mirror src_port size " << srcPortUuids.size();
OvsdbValues tdSet("set", srcPortUuids);
OvsdbValues tdSet("set", std::move(srcPortUuids));
msg1.rowData.emplace("select_src_port", tdSet);

// dst ports
Expand All @@ -364,7 +364,7 @@ namespace opflexagent {
}
}
LOG(INFO) << "mirror dst_port size " << dstPortUuids.size();
OvsdbValues tdSet2("set", dstPortUuids);
OvsdbValues tdSet2("set", std::move(dstPortUuids));
msg1.rowData.emplace("select_dst_port", tdSet2);

// output ports
Expand All @@ -377,7 +377,7 @@ namespace opflexagent {
OvsdbValue outPort("uuid", outputPortUuid);
outputPort.emplace_back(outPort);
}
OvsdbValues tdSet3(outputPort);
OvsdbValues tdSet3(std::move(outputPort));
msg1.rowData.emplace("output_port", tdSet3);

// name
Expand All @@ -393,7 +393,7 @@ namespace opflexagent {
OvsdbTransactMessage msg2(OvsdbOperation::MUTATE, OvsdbTable::BRIDGE);
set<tuple<string, OvsdbFunction, string>> condSet;
condSet.emplace("_uuid", OvsdbFunction::EQ, brUuid);
msg2.conditions = condSet;
msg2.conditions = std::move(condSet);
values.clear();
values.emplace_back("named-uuid", mirrorUuidName);
OvsdbValues tdSet5(values);
Expand All @@ -402,7 +402,7 @@ namespace opflexagent {
if (outputPortUuid.empty()) {
values.clear();
values.emplace_back("named-uuid", portNamedUuid);
OvsdbValues tdSet6(values);
OvsdbValues tdSet6(std::move(values));
msg2.mutateRowData.emplace("ports", std::make_pair(OvsdbOperation::INSERT, tdSet6));
}

Expand All @@ -411,7 +411,7 @@ namespace opflexagent {
} else {
set<tuple<string, OvsdbFunction, string>> condSet;
condSet.emplace("_uuid", OvsdbFunction::EQ, sessionUuid);
msg1.conditions = condSet;
msg1.conditions = std::move(condSet);
requests.push_back(msg1);
}
sendAsyncTransactRequests(requests);
Expand Down
3 changes: 3 additions & 0 deletions libopflex/engine/MOSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ void MOSerializer::displayObject(std::ostream& ostream,
}
ostream << " " << std::endl;

auto origWidth = ostream.width();
if (includeProps && !dispProps.empty()) {
lineLength = 0;
string pprefix = prefix;
Expand Down Expand Up @@ -737,6 +738,8 @@ void MOSerializer::displayObject(std::ostream& ostream,
ostream.flags(fmt);
}
}
// restore stream width
ostream.width(origWidth);
}

void MOSerializer::displayMODB(std::ostream& ostream,
Expand Down

0 comments on commit 3aaf55c

Please sign in to comment.