blob_handler: Fix fprintf %li to %zu & update clang-format
While updating to Meson it seems we enabled a more strict formatting
checks which are causing presubmit builds to fail:
https://gerrit.openbmc.org/c/openbmc/openbmc/+/55463
Fix the failures with suggested solutions.
Tested: Built an internal platform with this newest change
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I39b411b6154517809a06c4788603fe11830accc1
diff --git a/.clang-format b/.clang-format
index 52ac0a1..00e2e25 100644
--- a/.clang-format
+++ b/.clang-format
@@ -41,7 +41,7 @@
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
@@ -49,6 +49,7 @@
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
+DeriveLineEnding: false
DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
@@ -76,7 +77,7 @@
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -110,6 +111,7 @@
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 4
+UseCRLF: false
UseTab: Never
...
diff --git a/src/ipmiblob/blob_handler.cpp b/src/ipmiblob/blob_handler.cpp
index 2076add..fe4b593 100644
--- a/src/ipmiblob/blob_handler.cpp
+++ b/src/ipmiblob/blob_handler.cpp
@@ -22,6 +22,7 @@
#include "ipmi_interface.hpp"
#include <array>
+#include <cinttypes>
#include <cstring>
#include <limits>
#include <memory>
@@ -261,8 +262,8 @@
if (resp.size() < minRespSize)
{
std::fprintf(stderr,
- "Invalid response length, Got %li which is less than "
- "minRespSize %li\n",
+ "Invalid response length, Got %zu which is less than "
+ "minRespSize %zu\n",
resp.size(), minRespSize);
throw BlobException("Invalid response length");
}
@@ -275,8 +276,8 @@
if (metaDataLength != len)
{
std::fprintf(stderr,
- "Metadata length did not match actual length, Got %li "
- "which does not equal expected length %i\n",
+ "Metadata length did not match actual length, Got %zu "
+ "which does not equal expected length %" PRIu8 "\n",
metaDataLength, len);
throw BlobException("Metadata length did not match actual length");
}