Skip to content

Commit

Permalink
Fix coverity issue
Browse files Browse the repository at this point in the history
:Release Notes:
Fix coverity issue

:Detailed Notes:
Fix CID:
   9574001, 9574002, 9574003, 9574004, 9574005, 9574006, 9574007
   9574008, 9574011, 9574012, 9574013, 9574014, 9574015, 9574016

:Testing Performed:
Local Test: OK

:QA Notes:

:Issues Addressed:
[WRQ-1948] [RP] Fix static analysis #1

Change-Id: If9db38e54d4c44c2200da450b7ffb28d73ae50c6
Hotaek Jung committed Nov 24, 2023
1 parent 9d7223c commit a06a140
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/bootd/core/Application.cpp
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ void Application::printInfo()

void Application::setAppId(string appId)
{
m_appId = appId;
m_appId = std::move(appId);
}

string& Application::getAppId()
@@ -89,7 +89,7 @@ void Application::setParams(JValue params) {
"Params is not null: from(%s)->to(%s)",
m_params.stringify().c_str(),
params.stringify().c_str());
m_params = params;
m_params = std::move(params);
}

JValue& Application::getParams()
10 changes: 5 additions & 5 deletions src/bootd/event/DynamicEventDB.cpp
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ bool DynamicEventDB::getEventStatus(string eventName, JValue &extra)

bool DynamicEventDB::replaceEventsInfo(JValue &events, string origin, string &result)
{
result = origin;
result = std::move(origin);

for (int i = 0; i < events.arraySize(); i++) {
string pattern = "${" + events[i].asString() + "}";
@@ -165,7 +165,7 @@ bool DynamicEventDB::existEvent(GMainLoop* mainLoop, string eventName, int secon
"EventCore waits event(%s)/timeout(%d)",
eventName.c_str(), seconds);

m_existEvent = eventName;
m_existEvent = std::move(eventName);
m_waitEventTimeoutId = g_timeout_add_seconds(seconds, DynamicEventDB::_waitEventTimeout, this);
m_isInLoop = true;
while (m_isInLoop) {
@@ -192,7 +192,7 @@ bool DynamicEventDB::waitEvent(GMainLoop* mainLoop, string eventName, int second
"EventCore waits event(%s)/timeout(%d)",
eventName.c_str(), seconds);

m_waitEvent = eventName;
m_waitEvent = std::move(eventName);
m_waitEventTimeoutId = g_timeout_add_seconds(seconds, DynamicEventDB::_waitEventTimeout, this);
m_isInLoop = true;
while (m_isInLoop) {
@@ -276,7 +276,7 @@ bool DynamicEventDB::triggerEvent(string eventName, JValue extra)
callEventListeners(eventName, TriggerEvent);

if (!m_asyncEventData.empty())
callAsyncEventListeners(eventName);
callAsyncEventListeners(std::move(eventName));

return true;
}
@@ -303,7 +303,7 @@ bool DynamicEventDB::clearEvent(string eventName)
m_waitEventTimeoutId = 0;
m_isInLoop = false;
}
callEventListeners(eventName, ClearEvent);
callEventListeners(std::move(eventName), ClearEvent);
return true;
}

2 changes: 1 addition & 1 deletion src/bootd/sequencer/DefaultBootSequencer.cpp
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ void DefaultBootSequencer::doBoot()
void DefaultBootSequencer::launchTargetApp(string appId, bool visible, bool keepAlive, int displayId)
{
Application application;
application.setAppId(appId);
application.setAppId(std::move(appId));
application.setVisible(visible);
application.setDisplayId(displayId);

4 changes: 2 additions & 2 deletions src/bootd/service/AbsService.cpp
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ bool AbsService::getServerStatus(Handle *handle, string serviceName)
}

AbsService::AbsService(string name)
: m_name(name),
: m_name(std::move(name)),
m_serverStatus()
{
}
@@ -91,7 +91,7 @@ bool AbsService::registerServerStatus(Handle *handle, ServerStatusCallback callb
// TODO: Do we need to consider service on/off status in service classes?
// If it is 'yes', we need to implement some logic for that
// For example, subscriptions should be closed if service is down.
m_callback = callback;
m_callback = std::move(callback);
m_serverStatus = handle->registerServerStatus(m_name.c_str(), m_callback);
return true;
}
2 changes: 1 addition & 1 deletion src/bootd/service/BootManager.cpp
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ bool BootManager::generateSignal(LSMessage &message)
goto Done;
}

DynamicEventDB::instance()->triggerEvent(name);
DynamicEventDB::instance()->triggerEvent(std::move(name));

if (!m_bootManagerListener->onGenerateSignal(requestPayload)) {
errorText = "onGenerateSignal fails";
2 changes: 1 addition & 1 deletion src/bootd/util/Command.cpp
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
#include "Command.h"

Command::Command(string command)
: m_comm(command),
: m_comm(std::move(command)),
m_args(),
m_pid(-1),
m_status(-1),
4 changes: 2 additions & 2 deletions src/bootd/util/JUtil.cpp
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ pbnjson::JValue JUtil::parseFile(const char *file)

void JUtil::getValueWithKeys(JValue root, JValue keys, JValue &value)
{
JValue current = root;
JValue current = std::move(root);
std::string subKey;

for (int i = 0; i < keys.arraySize(); i++) {
@@ -62,7 +62,7 @@ void JUtil::getValueWithKeys(JValue root, JValue keys, JValue &value)
}
}

value = current;
value = std::move(current);
}

bool JUtil::isNotNull(JValue &value)

0 comments on commit a06a140

Please sign in to comment.