clang-tidy: fix some warnings
Resolve the following:
```
sys_info_param.cpp:12:11: style: Variable 'callback' can be declared as reference to const [constVariableReference]
auto& callback = iterator->second;
^
include/ipmid/sessionhelper.hpp:49:31: performance: Ineffective call of function 'substr' because a prefix of the string is assigned to itself. Use resize() or pop_back() instead. [uselessCallsSubstr]
sessionIdString = sessionIdString.substr(0, pos);
^
include/ipmid/sessionhelper.hpp:36:14: style: The scope of the variable 'tempSessionHandle' can be reduced. [variableScope]
uint16_t tempSessionHandle = 0;
^
include/ipmid/sessionhelper.hpp:77:47: performance: Function parameter 'objectPath' should be passed by const reference. [passedByValue]
bool isSessionObjectMatched(const std::string objectPath,
^
include/ipmid/sessionhelper.hpp:50:31: performance: Ineffective call of function 'substr' because a prefix of the string is assigned to itself. Use resize() or pop_back() instead. [uselessCallsSubstr]
sessionIdString = sessionIdString.substr(0, pos);
^
transport/serialbridge/test/serial_unittest.cpp:21:13: style: The scope of the variable 'c' can be reduced. [variableScope]
uint8_t c;
^
```
Change-Id: I5a34fc50a95c33367e8b5d67dcb94c46b8def94a
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/transport/serialbridge/test/serial_unittest.cpp b/transport/serialbridge/test/serial_unittest.cpp
index 3fb0227..a7e2938 100644
--- a/transport/serialbridge/test/serial_unittest.cpp
+++ b/transport/serialbridge/test/serial_unittest.cpp
@@ -18,12 +18,11 @@
TEST(TestSpecialCharact, getUnescapedCharact)
{
- uint8_t c;
auto channel = std::make_shared<SerialChannel>(0);
for (const auto& set : testsets)
{
- c = channel->getUnescapedCharacter(set.second);
+ uint8_t c = channel->getUnescapedCharacter(set.second);
ASSERT_EQ(c, set.first);
}
}