Remove trailing spaces in PartNumber
Sometime PartNumber can contain trailing spaces. This is unnecessary
and can cause issues when trying to compare with this field. This
change will remove trailing whitespaces if any.
Tested:
Verified on a machine that the part number doesn't
contain any trailing white spaces with this change.
Signed-off-by: Kasun Athukorala <kasunath@google.com>
Change-Id: I271c9f527f98fbb79493cfe3715b421b44996a91
diff --git a/src/dimm.cpp b/src/dimm.cpp
index ff4a070..1177e66 100644
--- a/src/dimm.cpp
+++ b/src/dimm.cpp
@@ -18,6 +18,8 @@
#include "mdrv2.hpp"
+#include <boost/algorithm/string.hpp>
+
namespace phosphor
{
namespace smbios
@@ -226,6 +228,9 @@
{
std::string result = positionToString(positionNum, structLen, dataIn);
+ // Part number could contain spaces at the end. Eg: "abcd123 ". Since its
+ // unnecessary, we should remove them.
+ boost::algorithm::trim_right(result);
partNumber(result);
}