clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: Id49ad73c860533f4658c909e86d6dc8e1423efb4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/src/fru_utils.cpp b/src/fru_utils.cpp
index 768a84d..15d4234 100644
--- a/src/fru_utils.cpp
+++ b/src/fru_utils.cpp
@@ -98,10 +98,9 @@
* On fruDataErr, we have lost synchronisation with the length bytes, so the
* iterator is no longer usable.
*/
-std::pair<DecodeState, std::string>
- decodeFRUData(std::vector<uint8_t>::const_iterator& iter,
- const std::vector<uint8_t>::const_iterator& end,
- bool isLangEng)
+std::pair<DecodeState, std::string> decodeFRUData(
+ std::vector<uint8_t>::const_iterator& iter,
+ const std::vector<uint8_t>::const_iterator& end, bool isLangEng)
{
std::string value;
unsigned int i = 0;
@@ -313,8 +312,8 @@
}
areaOffset *= fruBlockSize;
- std::vector<uint8_t>::const_iterator fruBytesIter = device.begin() +
- areaOffset;
+ std::vector<uint8_t>::const_iterator fruBytesIter =
+ device.begin() + areaOffset;
/* Verify area offset */
if (!verifyOffset(device, fruAreas::fruAreaMultirecord, *fruBytesIter))
@@ -394,8 +393,8 @@
continue;
}
offset *= fruBlockSize;
- std::vector<uint8_t>::const_iterator fruBytesIter = fruBytes.begin() +
- offset;
+ std::vector<uint8_t>::const_iterator fruBytesIter =
+ fruBytes.begin() + offset;
if (fruBytesIter + fruBlockSize >= fruBytes.end())
{
std::cerr << "Not enough data to parse \n";
@@ -460,9 +459,9 @@
isLangEng = checkLangEng(lang);
fruBytesIter += 1;
- unsigned int minutes = *fruBytesIter |
- *(fruBytesIter + 1) << 8 |
- *(fruBytesIter + 2) << 16;
+ unsigned int minutes =
+ *fruBytesIter | *(fruBytesIter + 1) << 8 |
+ *(fruBytesIter + 2) << 16;
std::tm fruTime = intelEpoch();
std::time_t timeValue = timegm(&fruTime);
timeValue += static_cast<long>(minutes) * 60;
@@ -505,8 +504,8 @@
DecodeState state = DecodeState::ok;
do
{
- auto res = decodeFRUData(fruBytesIter, fruBytesIterEndArea,
- isLangEng);
+ auto res =
+ decodeFRUData(fruBytesIter, fruBytesIterEndArea, isLangEng);
state = res.first;
std::string value = res.second;
std::string name;
@@ -527,9 +526,8 @@
{
// Strip non null characters from the end
value.erase(std::find_if(value.rbegin(), value.rend(),
- [](char ch) {
- return ch != 0;
- }).base(),
+ [](char ch) { return ch != 0; })
+ .base(),
value.end());
result[name] = std::move(value);
@@ -551,9 +549,9 @@
{
if (fieldIndex < fruAreaFieldNames->size())
{
- std::cerr << "Mandatory fields absent in FRU area "
- << getFruAreaName(area) << " after " << name
- << "\n";
+ std::cerr
+ << "Mandatory fields absent in FRU area "
+ << getFruAreaName(area) << " after " << name << "\n";
ret = resCodes::resWarn;
}
}
@@ -594,10 +592,9 @@
// Update new fru area length &
// Update checksum at new checksum location
// Return the offset of the area checksum byte
-unsigned int updateFRUAreaLenAndChecksum(std::vector<uint8_t>& fruData,
- size_t fruAreaStart,
- size_t fruAreaEndOfFieldsOffset,
- size_t fruAreaEndOffset)
+unsigned int updateFRUAreaLenAndChecksum(
+ std::vector<uint8_t>& fruData, size_t fruAreaStart,
+ size_t fruAreaEndOfFieldsOffset, size_t fruAreaEndOffset)
{
size_t traverseFRUAreaIndex = fruAreaEndOfFieldsOffset - fruAreaStart;