all: Use stdplus::print over std::fprintf
Replacing `std::fprintf` with `stdplus::print`.
No logical change.
Tested: Buildable.
Signed-off-by: Michael Shen <gpgpgp@google.com>
Change-Id: I7050885c13e33244a4128aa519d163fd5b725098
diff --git a/google_accel_oob.cpp b/google_accel_oob.cpp
index 8207f6e..7e44864 100644
--- a/google_accel_oob.cpp
+++ b/google_accel_oob.cpp
@@ -17,6 +17,7 @@
#include "commands.hpp"
#include <sdbusplus/bus.hpp>
+#include <stdplus/print.hpp>
#include <cstdint>
#include <cstring>
@@ -50,17 +51,18 @@
if (data.size_bytes() < sizeof(Request))
{
- std::fprintf(stderr, "AccelOob DeviceCount command too small: %zu\n",
- data.size_bytes());
+ stdplus::print(stderr, "AccelOob DeviceCount command too small: {}\n",
+ data.size_bytes());
return ::ipmi::responseReqDataLenInvalid();
}
if (data.size_bytes() + sizeof(Reply) > MAX_IPMI_BUFFER)
{
- std::fprintf(stderr,
- "AccelOob DeviceCount command too large for reply buffer: "
- "command=%zuB, payload=%zuB, max=%dB\n",
- data.size_bytes(), sizeof(Reply), MAX_IPMI_BUFFER);
+ stdplus::print(
+ stderr,
+ "AccelOob DeviceCount command too large for reply buffer: "
+ "command={}B, payload={}B, max={}B\n",
+ data.size_bytes(), sizeof(Reply), MAX_IPMI_BUFFER);
return ::ipmi::responseReqDataLenExceeded();
}
@@ -90,17 +92,18 @@
if (data.size_bytes() < sizeof(Request))
{
- std::fprintf(stderr, "AccelOob DeviceName command too small: %zu\n",
- data.size_bytes());
+ stdplus::print(stderr, "AccelOob DeviceName command too small: {}\n",
+ data.size_bytes());
return ::ipmi::responseReqDataLenInvalid();
}
if (data.size_bytes() + sizeof(Reply) > MAX_IPMI_BUFFER)
{
- std::fprintf(stderr,
- "AccelOob DeviceName command too large for reply buffer: "
- "command=%zuB, payload=%zuB, max=%dB\n",
- data.size_bytes(), sizeof(Reply), MAX_IPMI_BUFFER);
+ stdplus::print(
+ stderr,
+ "AccelOob DeviceName command too large for reply buffer: "
+ "command={}B, payload={}B, max={}B\n",
+ data.size_bytes(), sizeof(Reply), MAX_IPMI_BUFFER);
return ::ipmi::responseReqDataLenExceeded();
}
@@ -109,10 +112,10 @@
if (name.size() > MAX_NAME_SIZE)
{
- std::fprintf(stderr,
- "AccelOob: name was too long. "
- "'%s' len must be <= %zu\n",
- name.c_str(), MAX_NAME_SIZE);
+ stdplus::print(stderr,
+ "AccelOob: name was too long. "
+ "'{}' len must be <= {}\n",
+ name, MAX_NAME_SIZE);
return ::ipmi::responseReqDataTruncated();
}
@@ -192,10 +195,10 @@
uint64_t data;
} __attribute__((packed));
- std::fprintf(stderr,
- "AccelOob Read command sizes: "
- "command=%zuB, payload=%zuB, max=%dB\n",
- data.size_bytes(), sizeof(Reply), MAX_IPMI_BUFFER);
+ stdplus::print(stderr,
+ "AccelOob Read command sizes: "
+ "command={}B, payload={}B, max={}B\n",
+ data.size_bytes(), sizeof(Reply), MAX_IPMI_BUFFER);
std::string name;
const uint8_t* payload;
@@ -204,17 +207,17 @@
sizeof(Request), &name, &payload);
if (min_size != 0)
{
- std::fprintf(stderr, "AccelOob Read command too small: %zuB < %zuB\n",
- data.size_bytes(), min_size);
+ stdplus::print(stderr, "AccelOob Read command too small: {}B < {}B\n",
+ data.size_bytes(), min_size);
return ::ipmi::responseReqDataLenInvalid();
}
if (data.size_bytes() + sizeof(Reply) > MAX_IPMI_BUFFER)
{
- std::fprintf(stderr,
- "AccelOob Read command too large for reply buffer: "
- "command=%zuB, payload=%zuB, max=%dB\n",
- data.size_bytes(), sizeof(Reply), MAX_IPMI_BUFFER);
+ stdplus::print(stderr,
+ "AccelOob Read command too large for reply buffer: "
+ "command={}B, payload={}B, max={}B\n",
+ data.size_bytes(), sizeof(Reply), MAX_IPMI_BUFFER);
return ::ipmi::responseReqDataLenExceeded();
}
@@ -256,17 +259,17 @@
sizeof(Request), &name, &payload);
if (min_size != 0)
{
- std::fprintf(stderr, "AccelOob Write command too small: %zuB < %zuB\n",
- data.size_bytes(), min_size);
+ stdplus::print(stderr, "AccelOob Write command too small: {}B < {}B\n",
+ data.size_bytes(), min_size);
return ::ipmi::responseReqDataLenInvalid();
}
if (data.size_bytes() + sizeof(Reply) > MAX_IPMI_BUFFER)
{
- std::fprintf(stderr,
- "AccelOob Write command too large for reply buffer: "
- "command=%zuB, payload=%zuB, max=%dB\n",
- data.size_bytes(), sizeof(Reply), MAX_IPMI_BUFFER);
+ stdplus::print(stderr,
+ "AccelOob Write command too large for reply buffer: "
+ "command={}B, payload={}B, max={}B\n",
+ data.size_bytes(), sizeof(Reply), MAX_IPMI_BUFFER);
return ::ipmi::responseReqDataLenExceeded();
}