clang-tidy: Enable cppcoreguidelines-pro-type-reinterpret-cast
There are ways to avoid reinterpret_cast<>() in many circumstances.
For libpldm, often its use can be replaced with placement-new.
Enable the lint for reinterpret_cast<>() to prevent its use in future
changes. This way we can stay inside the language rather than rely on
implementation-defined behavior.
Existing uses of reinterpret_cast<>() are marked NOLINT for now, with
the intent that we clean them up over time. The insertion of the NOLINTs
was automated with sed.
Change-Id: If6654f774e438de9262fe9f9012c6b574764c326
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/.clang-tidy b/.clang-tidy
index 001c35f..3c736bb 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -139,6 +139,7 @@
clang-analyzer-valist.ValistBase,
clang-analyzer-webkit.NoUncountedMemberChecker,
clang-analyzer-webkit.RefCntblBaseVirtualDtor,
+cppcoreguidelines-pro-type-reinterpret-cast,
misc-misplaced-const,
misc-redundant-expression,
misc-static-assert,
diff --git a/tests/dsp/base.cpp b/tests/dsp/base.cpp
index c95abdf..5e71c80 100644
--- a/tests/dsp/base.cpp
+++ b/tests/dsp/base.cpp
@@ -200,6 +200,7 @@
ver32_t version{0xff, 0xff, 0xff, 0xff};
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_COMMANDS_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_commands_req(0, pldmType, version, request);
@@ -221,6 +222,7 @@
memcpy(requestMsg.data() + sizeof(pldmType) + hdrSize, &version,
sizeof(version));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = decode_get_commands_req(request, requestMsg.size() - hdrSize,
&pldmTypeOut, &versionOut);
@@ -235,6 +237,7 @@
uint8_t completionCode = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_COMMANDS_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
std::array<bitfield8_t, PLDM_MAX_CMDS_PER_TYPE / 8> commands{};
commands[0].byte = 1;
@@ -258,6 +261,7 @@
uint8_t completionCode = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_TYPES_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
std::array<bitfield8_t, PLDM_MAX_TYPES / 8> types{};
types[0].byte = 1;
@@ -285,6 +289,7 @@
uint8_t completion_code;
responseMsg[hdrSize] = PLDM_SUCCESS;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_types_resp(response, responseMsg.size() - hdrSize,
@@ -308,6 +313,7 @@
uint8_t retcompletion_code = 0;
responseMsg[hdrSize] = PLDM_SUCCESS;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_types_resp(response, responseMsg.size() - hdrSize - 1,
@@ -327,6 +333,7 @@
uint8_t completion_code;
responseMsg[hdrSize] = PLDM_SUCCESS;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_commands_resp(response, responseMsg.size() - hdrSize,
@@ -350,6 +357,7 @@
uint8_t retcompletion_code = 0;
responseMsg[hdrSize] = PLDM_SUCCESS;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc =
@@ -363,6 +371,7 @@
{
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_VERSION_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
uint8_t pldmType = 0x03;
uint32_t transferHandle = 0x0;
@@ -399,6 +408,7 @@
uint8_t flag = PLDM_START_AND_END;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_VERSION_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
ver32_t version = {0xff, 0xff, 0xff, 0xff};
@@ -434,6 +444,7 @@
memcpy(requestMsg.data() + sizeof(transferHandle) + sizeof(flag) + hdrSize,
&pldmType, sizeof(pldmType));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = decode_get_version_req(request, requestMsg.size() - hdrSize,
@@ -467,6 +478,7 @@
sizeof(transferHandle) + sizeof(flag) + hdrSize,
&version, sizeof(version));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_version_resp(response, responseMsg.size() - hdrSize,
@@ -495,6 +507,7 @@
uint8_t completionCode = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_TID_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t tid = 1;
@@ -514,6 +527,7 @@
uint8_t completion_code;
responseMsg[hdrSize] = PLDM_SUCCESS;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_tid_resp(response, responseMsg.size() - hdrSize,
@@ -555,6 +569,7 @@
std::memcpy(req.data(), &hdr, sizeof(hdr));
std::memcpy(req.data() + sizeof(hdr), &req_pkt, sizeof(req_pkt));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* pldm_request = reinterpret_cast<pldm_msg*>(req.data());
int rc = decode_multipart_receive_req(
pldm_request, req.size() - hdrSize, &pldm_type, &flag, &transfer_ctx,
@@ -599,6 +614,7 @@
std::memcpy(req.data(), &hdr, sizeof(hdr));
std::memcpy(req.data() + sizeof(hdr), &req_pkt, sizeof(req_pkt));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* pldm_request = reinterpret_cast<pldm_msg*>(req.data());
EXPECT_EQ(decode_multipart_receive_req(
pldm_request, (req.size() - hdrSize) + 1, &pldm_type, &flag,
@@ -630,6 +646,7 @@
std::memcpy(req.data(), &hdr, sizeof(hdr));
std::memcpy(req.data() + sizeof(hdr), &req_pkt, sizeof(req_pkt));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* pldm_request = reinterpret_cast<pldm_msg*>(req.data());
EXPECT_EQ(decode_multipart_receive_req(pldm_request, req.size() - hdrSize,
&pldm_type, &flag, &transfer_ctx,
@@ -661,6 +678,7 @@
std::memcpy(req.data(), &hdr, sizeof(hdr));
std::memcpy(req.data() + sizeof(hdr), &req_pkt, sizeof(req_pkt));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* pldm_request = reinterpret_cast<pldm_msg*>(req.data());
EXPECT_EQ(decode_multipart_receive_req(pldm_request, req.size() - hdrSize,
&pldm_type, &flag, &transfer_ctx,
@@ -696,6 +714,7 @@
std::memcpy(req.data(), &hdr, sizeof(hdr));
std::memcpy(req.data() + sizeof(hdr), &req_pkt, sizeof(req_pkt));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* pldm_request = reinterpret_cast<pldm_msg*>(req.data());
EXPECT_EQ(decode_multipart_receive_req(pldm_request, req.size() - hdrSize,
&pldm_type, &flag, &transfer_ctx,
@@ -731,6 +750,7 @@
std::memcpy(req.data(), &hdr, sizeof(hdr));
std::memcpy(req.data() + sizeof(hdr), &req_pkt, sizeof(req_pkt));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* pldm_request = reinterpret_cast<pldm_msg*>(req.data());
EXPECT_EQ(decode_multipart_receive_req(pldm_request, req.size() - hdrSize,
&pldm_type, &flag, &transfer_ctx,
@@ -748,6 +768,7 @@
3 /*completion code*/, &responseMsg);
EXPECT_EQ(rc, PLDM_SUCCESS);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto p = reinterpret_cast<uint8_t*>(&responseMsg);
EXPECT_THAT(std::vector<uint8_t>(p, p + sizeof(responseMsg)),
ElementsAreArray({0, 1, 2, 3}));
@@ -764,6 +785,7 @@
uint8_t instanceId = 0;
uint8_t tid = 0x01;
std::array<uint8_t, sizeof(pldm_msg_hdr) + sizeof(tid)> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_tid_req(instanceId, tid, request);
@@ -781,6 +803,7 @@
{
uint8_t tid = 0x01;
std::array<uint8_t, sizeof(pldm_msg_hdr) + sizeof(tid)> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_tid_req(0, tid, nullptr);
diff --git a/tests/dsp/bios.cpp b/tests/dsp/bios.cpp
index 3f64a2a..955bec6 100644
--- a/tests/dsp/bios.cpp
+++ b/tests/dsp/bios.cpp
@@ -33,6 +33,7 @@
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_DATE_TIME_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_get_date_time_resp(0, PLDM_SUCCESS, seconds, minutes,
@@ -103,6 +104,7 @@
hdrSize,
&yearLe, sizeof(yearLe));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_date_time_resp(
@@ -126,6 +128,7 @@
std::array<uint8_t, hdrSize + sizeof(struct pldm_only_cc_resp)>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
auto rc = encode_set_date_time_resp(instanceId, completionCode, response,
@@ -133,6 +136,7 @@
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_only_cc_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_only_cc_resp*>(response->payload);
EXPECT_EQ(completionCode, resp->completion_code);
}
@@ -145,6 +149,7 @@
std::array<uint8_t, hdrSize + sizeof(struct pldm_only_cc_resp)>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
auto rc = encode_set_date_time_resp(instanceId, completionCode, nullptr,
responseMsg.size() - hdrSize);
@@ -162,8 +167,10 @@
std::array<uint8_t, hdrSize + sizeof(struct pldm_only_cc_resp)>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
struct pldm_only_cc_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_only_cc_resp*>(response->payload);
resp->completion_code = completionCode;
@@ -183,6 +190,7 @@
std::array<uint8_t, hdrSize + sizeof(struct pldm_only_cc_resp)>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
auto rc = decode_set_date_time_resp(nullptr, responseMsg.size() - hdrSize,
&completionCode);
@@ -207,6 +215,7 @@
std::array<uint8_t, hdrSize + sizeof(struct pldm_set_date_time_req)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_date_time_req(instanceId, seconds, minutes, hours, day,
month, year, request,
@@ -215,6 +224,7 @@
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_set_date_time_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_date_time_req*>(request->payload);
EXPECT_EQ(seconds, bcd2dec8(req->seconds));
EXPECT_EQ(minutes, bcd2dec8(req->minutes));
@@ -240,6 +250,7 @@
std::array<uint8_t, hdrSize + sizeof(struct pldm_set_date_time_req)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_date_time_req(instanceId, seconds, minutes, hours, day,
@@ -269,8 +280,10 @@
uint8_t month = 0x11;
uint16_t year = 0x2019;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<struct pldm_msg*>(requestMsg.data());
struct pldm_set_date_time_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_date_time_req*>(request->payload);
req->seconds = seconds;
req->minutes = minutes;
@@ -311,6 +324,7 @@
std::array<uint8_t, hdrSize + sizeof(struct pldm_set_date_time_req)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<struct pldm_msg*>(requestMsg.data());
decode_set_date_time_req(request, requestMsg.size() - hdrSize, &seconds,
@@ -336,6 +350,7 @@
std::array<uint8_t,
sizeof(pldm_msg_hdr) + PLDM_GET_BIOS_TABLE_MIN_RESP_BYTES + 4>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t completionCode = PLDM_SUCCESS;
@@ -350,6 +365,7 @@
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_get_bios_table_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_bios_table_resp*>(response->payload);
EXPECT_EQ(completionCode, resp->completion_code);
@@ -378,6 +394,7 @@
uint8_t transferOpFlag = 0x01;
uint8_t tableType = PLDM_BIOS_ATTR_TABLE;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_bios_table_req(0, transferHandle, transferOpFlag,
tableType, request);
@@ -385,6 +402,7 @@
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_get_bios_table_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_bios_table_req*>(request->payload);
EXPECT_EQ(transferHandle, le32toh(req->transfer_handle));
EXPECT_EQ(transferOpFlag, req->transfer_op_flag);
@@ -414,8 +432,10 @@
uint8_t retTransferOpFlag = 0;
uint8_t retTableType = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_bios_table_req* request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_bios_table_req*>(req->payload);
request->transfer_handle = htole32(transferHandle);
@@ -442,8 +462,10 @@
uint8_t retTransferOpFlag = 0;
uint8_t retTableType = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_bios_table_req* request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_bios_table_req*>(req->payload);
request->transfer_handle = htole32(transferHandle);
@@ -471,8 +493,10 @@
uint8_t retTransferOpFlag = 0;
uint8_t retTableType = 0;
+// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_bios_table_req* request =
+// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_bios_table_req*>(req->payload);
request->transfer_handle = htole32(transferHandle);
@@ -498,8 +522,10 @@
sizeof(transferOpFlag) + sizeof(attributehandle)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_bios_attribute_current_value_by_handle_req* request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<
struct pldm_get_bios_attribute_current_value_by_handle_req*>(
req->payload);
@@ -531,8 +557,10 @@
sizeof(transferOpFlag) + sizeof(attribute_handle)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_bios_attribute_current_value_by_handle_req* request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<
struct pldm_get_bios_attribute_current_value_by_handle_req*>(
req->payload);
@@ -564,6 +592,7 @@
uint8_t transferOpFlag = PLDM_GET_FIRSTPART;
uint8_t attributeHandle = 10;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_bios_attribute_current_value_by_handle_req(
0, transferHandle, transferOpFlag, attributeHandle, request);
@@ -571,6 +600,7 @@
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_get_bios_attribute_current_value_by_handle_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<
struct pldm_get_bios_attribute_current_value_by_handle_req*>(
request->payload);
@@ -603,6 +633,7 @@
hdrSize +
sizeof(pldm_get_bios_attribute_current_value_by_handle_resp)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_get_bios_current_value_by_handle_resp(
@@ -612,6 +643,7 @@
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_get_bios_attribute_current_value_by_handle_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<
struct pldm_get_bios_attribute_current_value_by_handle_resp*>(
response->payload);
@@ -638,6 +670,7 @@
hdrSize +
sizeof(pldm_get_bios_attribute_current_value_by_handle_resp)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
rc = encode_get_bios_current_value_by_handle_resp(
0, PLDM_SUCCESS, nextTransferHandle, transferFlag, nullptr,
@@ -654,15 +687,18 @@
std::array<uint8_t, hdrSize + PLDM_SET_BIOS_ATTR_CURR_VAL_MIN_REQ_BYTES +
sizeof(attributeData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_bios_attribute_current_value_req(
instanceId, transferHandle, transferFlag,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&attributeData), sizeof(attributeData),
request, requestMsg.size() - hdrSize);
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_set_bios_attribute_current_value_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_attribute_current_value_req*>(
request->payload);
EXPECT_EQ(htole32(transferHandle), req->transfer_handle);
@@ -679,6 +715,7 @@
uint32_t attributeData = 44;
std::array<uint8_t, hdrSize + PLDM_SET_BIOS_ATTR_CURR_VAL_MIN_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_bios_attribute_current_value_req(
@@ -686,6 +723,7 @@
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
rc = encode_set_bios_attribute_current_value_req(
instanceId, transferHandle, transferFlag,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&attributeData), sizeof(attributeData),
request, requestMsg.size() - hdrSize);
@@ -701,8 +739,10 @@
std::array<uint8_t, hdrSize + PLDM_SET_BIOS_ATTR_CURR_VAL_MIN_REQ_BYTES +
sizeof(attributeData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<struct pldm_msg*>(requestMsg.data());
struct pldm_set_bios_attribute_current_value_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_attribute_current_value_req*>(
request->payload);
req->transfer_handle = htole32(transferHandle);
@@ -730,6 +770,7 @@
struct variable_field attribute;
std::array<uint8_t, hdrSize + PLDM_SET_BIOS_ATTR_CURR_VAL_MIN_REQ_BYTES - 1>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<struct pldm_msg*>(requestMsg.data());
auto rc = decode_set_bios_attribute_current_value_req(
@@ -750,12 +791,14 @@
std::array<uint8_t, hdrSize + PLDM_SET_BIOS_ATTR_CURR_VAL_RESP_BYTES>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
auto rc = encode_set_bios_attribute_current_value_resp(
instanceId, completionCode, nextTransferHandle, response);
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_set_bios_attribute_current_value_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_attribute_current_value_resp*>(
response->payload);
EXPECT_EQ(completionCode, resp->completion_code);
@@ -779,8 +822,10 @@
std::array<uint8_t, hdrSize + PLDM_SET_BIOS_ATTR_CURR_VAL_RESP_BYTES>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
struct pldm_set_bios_attribute_current_value_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_attribute_current_value_resp*>(
response->payload);
@@ -806,8 +851,10 @@
std::array<uint8_t, hdrSize + PLDM_SET_BIOS_ATTR_CURR_VAL_RESP_BYTES>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
struct pldm_set_bios_attribute_current_value_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_attribute_current_value_resp*>(
response->payload);
@@ -834,9 +881,11 @@
std::array<uint8_t, hdrSize + PLDM_GET_BIOS_TABLE_MIN_RESP_BYTES>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
struct pldm_get_bios_table_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_bios_table_resp*>(response->payload);
resp->completion_code = completionCode;
@@ -872,9 +921,11 @@
sizeof(attributeData)>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
struct pldm_get_bios_attribute_current_value_by_handle_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<
struct pldm_get_bios_attribute_current_value_by_handle_resp*>(
response->payload);
@@ -911,15 +962,18 @@
std::array<uint8_t,
hdrSize + PLDM_SET_BIOS_TABLE_MIN_REQ_BYTES + sizeof(tableData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_bios_table_req(
instanceId, transferHandle, transferFlag, tableType,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&tableData), sizeof(tableData), request,
requestMsg.size() - hdrSize);
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_set_bios_table_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_table_req*>(request->payload);
EXPECT_EQ(htole32(transferHandle), req->transfer_handle);
@@ -938,6 +992,7 @@
std::array<uint8_t,
hdrSize + PLDM_SET_BIOS_TABLE_MIN_REQ_BYTES + sizeof(tableData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_bios_table_req(
@@ -947,6 +1002,7 @@
rc = encode_set_bios_table_req(
instanceId, transferHandle, transferFlag, tableType,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&tableData), sizeof(tableData), request,
requestMsg.size() - hdrSize + 1);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
@@ -958,8 +1014,10 @@
uint8_t completionCode = PLDM_SUCCESS;
std::array<uint8_t, hdrSize + PLDM_SET_BIOS_TABLE_RESP_BYTES> responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
struct pldm_set_bios_table_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_table_resp*>(response->payload);
resp->completion_code = completionCode;
@@ -982,8 +1040,10 @@
uint8_t completionCode = PLDM_SUCCESS;
std::array<uint8_t, hdrSize + PLDM_SET_BIOS_TABLE_RESP_BYTES> responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
struct pldm_set_bios_table_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_table_resp*>(response->payload);
resp->completion_code = completionCode;
@@ -1009,12 +1069,14 @@
std::array<uint8_t, hdrSize + PLDM_SET_BIOS_TABLE_RESP_BYTES> responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
auto rc = encode_set_bios_table_resp(instanceId, completionCode,
nextTransferHandle, response);
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_set_bios_table_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_table_resp*>(response->payload);
EXPECT_EQ(completionCode, resp->completion_code);
EXPECT_EQ(htole32(nextTransferHandle), resp->next_transfer_handle);
@@ -1036,8 +1098,10 @@
std::array<uint8_t,
hdrSize + PLDM_SET_BIOS_TABLE_MIN_REQ_BYTES + sizeof(tableData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<struct pldm_msg*>(requestMsg.data());
struct pldm_set_bios_table_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_table_req*>(request->payload);
req->transfer_handle = htole32(transferHandle);
req->transfer_flag = transferFlag;
@@ -1070,8 +1134,10 @@
std::array<uint8_t,
hdrSize + PLDM_SET_BIOS_TABLE_MIN_REQ_BYTES + sizeof(tableData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<struct pldm_msg*>(requestMsg.data());
struct pldm_set_bios_table_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_bios_table_req*>(request->payload);
req->transfer_handle = htole32(transferHandle);
req->transfer_flag = transferFlag;
diff --git a/tests/dsp/bios_table.cpp b/tests/dsp/bios_table.cpp
index 99e17ba..19fb929 100644
--- a/tests/dsp/bios_table.cpp
+++ b/tests/dsp/bios_table.cpp
@@ -49,6 +49,7 @@
0 /* default value string handle index */
};
auto entry =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_bios_attr_table_entry*>(enumEntry.data());
auto attrHandle = pldm_bios_table_attr_entry_decode_attribute_handle(entry);
EXPECT_EQ(attrHandle, 2);
@@ -72,6 +73,7 @@
};
auto entry =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_bios_attr_table_entry*>(enumEntry.data());
uint8_t pvNumber;
ASSERT_EQ(pldm_bios_table_attr_entry_enum_decode_pv_num(entry, &pvNumber),
@@ -201,6 +203,7 @@
'a', 'b', 'c' /* default string */
};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto entry = reinterpret_cast<struct pldm_bios_attr_table_entry*>(
stringEntry.data());
auto stringType =
@@ -416,6 +419,7 @@
uint64_t upper;
uint64_t def;
uint32_t scalar;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto entry = reinterpret_cast<struct pldm_bios_attr_table_entry*>(
integerEntry.data());
pldm_bios_table_attr_entry_integer_decode(entry, &lower, &upper, &scalar,
@@ -526,6 +530,7 @@
auto entry =
pldm_bios_table_attr_find_by_handle(table.data(), table.size(), 1);
EXPECT_NE(entry, nullptr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto p = reinterpret_cast<const uint8_t*>(entry);
EXPECT_THAT(std::vector<uint8_t>(p, p + stringEntry.size()),
ElementsAreArray(stringEntry));
@@ -536,6 +541,7 @@
entry = pldm_bios_table_attr_find_by_string_handle(table.data(),
table.size(), 2);
EXPECT_NE(entry, nullptr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
p = reinterpret_cast<const uint8_t*>(entry);
EXPECT_THAT(std::vector<uint8_t>(p, p + stringEntry.size()),
ElementsAreArray(stringEntry));
@@ -554,6 +560,7 @@
0, /* current value string handle index */
1, /* current value string handle index */
};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto entry = reinterpret_cast<struct pldm_bios_attr_val_table_entry*>(
enumEntry.data());
auto attrHandle =
@@ -592,6 +599,7 @@
handles);
EXPECT_EQ(rc, PLDM_SUCCESS);
EXPECT_EQ(encodeEntry, enumEntry);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto entry = reinterpret_cast<struct pldm_bios_attr_val_table_entry*>(
enumEntry.data());
entry->attr_type = PLDM_BIOS_ENUMERATION_READ_ONLY;
@@ -620,6 +628,7 @@
1, /* current value string handle index */
};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto entry = reinterpret_cast<struct pldm_bios_attr_val_table_entry*>(
enumEntry.data());
auto number = pldm_bios_table_attr_value_entry_enum_decode_number(entry);
@@ -673,6 +682,7 @@
encodeEntry.data(), encodeEntry.size(), 0, PLDM_BIOS_STRING, 3, "abc");
EXPECT_EQ(rc, PLDM_SUCCESS);
EXPECT_EQ(encodeEntry, stringEntry);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto entry = reinterpret_cast<struct pldm_bios_attr_val_table_entry*>(
stringEntry.data());
entry->attr_type = PLDM_BIOS_STRING_READ_ONLY;
@@ -700,6 +710,7 @@
'a', 'b', 'c', /* default value string handle index */
};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto entry = reinterpret_cast<struct pldm_bios_attr_val_table_entry*>(
stringEntry.data());
auto length = pldm_bios_table_attr_value_entry_string_decode_length(entry);
@@ -745,6 +756,7 @@
encodeEntry.data(), encodeEntry.size(), 0, PLDM_BIOS_INTEGER, 10);
EXPECT_EQ(rc, PLDM_SUCCESS);
EXPECT_EQ(encodeEntry, integerEntry);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto entry = reinterpret_cast<struct pldm_bios_attr_val_table_entry*>(
integerEntry.data());
entry->attr_type = PLDM_BIOS_INTEGER_READ_ONLY;
@@ -771,6 +783,7 @@
10, 0, 0, 0, 0, 0, 0, 0, /* current value */
};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto entry = reinterpret_cast<struct pldm_bios_attr_val_table_entry*>(
integerEntry.data());
auto cv = pldm_bios_table_attr_value_entry_integer_decode_cv(entry);
@@ -805,24 +818,28 @@
PLDM_BIOS_ATTR_VAL_TABLE);
auto entry = pldm_bios_table_iter_attr_value_entry_value(iter);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto p = reinterpret_cast<const uint8_t*>(entry);
EXPECT_THAT(std::vector<uint8_t>(p, p + enumEntry.size()),
ElementsAreArray(enumEntry));
pldm_bios_table_iter_next(iter);
entry = pldm_bios_table_iter_attr_value_entry_value(iter);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
p = reinterpret_cast<const uint8_t*>(entry);
EXPECT_THAT(std::vector<uint8_t>(p, p + stringEntry.size()),
ElementsAreArray(stringEntry));
pldm_bios_table_iter_next(iter);
entry = pldm_bios_table_iter_attr_value_entry_value(iter);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
p = reinterpret_cast<const uint8_t*>(entry);
EXPECT_THAT(std::vector<uint8_t>(p, p + integerEntry.size()),
ElementsAreArray(integerEntry));
pldm_bios_table_iter_next(iter);
entry = pldm_bios_table_iter_attr_value_entry_value(iter);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
p = reinterpret_cast<const uint8_t*>(entry);
EXPECT_THAT(std::vector<uint8_t>(p, p + enumEntry.size()),
ElementsAreArray(enumEntry));
@@ -860,6 +877,7 @@
auto entry = pldm_bios_table_attr_value_find_by_handle(table.data(),
table.size(), 1);
EXPECT_NE(entry, nullptr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto p = reinterpret_cast<const uint8_t*>(entry);
EXPECT_THAT(std::vector<uint8_t>(p, p + stringEntry.size()),
ElementsAreArray(stringEntry));
@@ -869,6 +887,7 @@
EXPECT_EQ(entry, nullptr);
auto firstEntry =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_bios_attr_val_table_entry*>(table.data());
firstEntry->attr_type = PLDM_BIOS_PASSWORD;
#ifdef NDEBUG
@@ -1015,6 +1034,7 @@
7, 0, /* string length */
'A', 'l', 'l', 'o', 'w', 'e', 'd', /* string */
};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto entry = reinterpret_cast<struct pldm_bios_string_table_entry*>(
stringEntry.data());
auto handle = pldm_bios_table_string_entry_decode_handle(entry);
@@ -1128,6 +1148,7 @@
/* first entry */
auto attr_entry =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_bios_attr_table_entry*>(table.data());
auto iter = pldm_bios_table_iter_create(table.data(), table.size(),
PLDM_BIOS_ATTR_TABLE);
diff --git a/tests/dsp/firmware_update.cpp b/tests/dsp/firmware_update.cpp
index e21daf0..8f3ab3c 100644
--- a/tests/dsp/firmware_update.cpp
+++ b/tests/dsp/firmware_update.cpp
@@ -67,6 +67,7 @@
EXPECT_EQ(pkgHeader.package_version_string_length,
packageVersionStr.size());
std::string packageVersionString(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const char*>(packageVersion.ptr),
packageVersion.length);
EXPECT_EQ(packageVersionString, packageVersionStr);
@@ -220,6 +221,7 @@
EXPECT_EQ(outCompImageSetVersionStr.length, imageSetVersionStr.size());
std::string compImageSetVersionStr(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const char*>(outCompImageSetVersionStr.ptr),
outCompImageSetVersionStr.length);
EXPECT_EQ(compImageSetVersionStr, imageSetVersionStr);
@@ -310,6 +312,7 @@
EXPECT_EQ(outCompImageSetVersionStr.length, imageSetVersionStr.size());
std::string compImageSetVersionStr(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const char*>(outCompImageSetVersionStr.ptr),
outCompImageSetVersionStr.length);
EXPECT_EQ(compImageSetVersionStr, imageSetVersionStr);
@@ -517,6 +520,7 @@
EXPECT_EQ(descriptorTitleStrType, PLDM_STR_TYPE_ASCII);
EXPECT_EQ(descriptorTitleStr.length, vendorTitle.size());
std::string vendorTitleStr(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const char*>(descriptorTitleStr.ptr),
descriptorTitleStr.length);
EXPECT_EQ(vendorTitleStr, vendorTitle);
@@ -694,6 +698,7 @@
EXPECT_EQ(outCompVersionStr.length,
outCompImageInfo.comp_version_string_length);
std::string componentVersionString(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const char*>(outCompVersionStr.ptr),
outCompVersionStr.length);
EXPECT_EQ(componentVersionString, compVersionStr);
@@ -790,6 +795,7 @@
TEST(QueryDeviceIdentifiers, goodPathEncodeRequest)
{
std::array<uint8_t, sizeof(pldm_msg_hdr)> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
uint8_t instanceId = 0x01;
@@ -811,6 +817,7 @@
sizeof(struct pldm_query_device_identifiers_resp) +
descriptorDataLen>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto inResp = reinterpret_cast<struct pldm_query_device_identifiers_resp*>(
responseMsg.data() + hdrSize);
@@ -823,6 +830,7 @@
sizeof(struct pldm_query_device_identifiers_resp),
descriptorDataLen, 0xff);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t completionCode = PLDM_SUCCESS;
uint32_t deviceIdentifiersLen = 0;
@@ -848,6 +856,7 @@
TEST(GetFirmwareParameters, goodPathEncodeRequest)
{
std::array<uint8_t, sizeof(pldm_msg_hdr)> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
uint8_t instanceId = 0x01;
@@ -913,6 +922,7 @@
0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x34};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getFwParamsResponse.data());
pldm_get_firmware_parameters_resp outResp{};
variable_field outActiveCompImageSetVersion{};
@@ -935,10 +945,12 @@
EXPECT_EQ(outResp.pending_comp_image_set_ver_str_len,
pendingCompImageSetVersion.size());
std::string activeCompImageSetVersionStr(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const char*>(outActiveCompImageSetVersion.ptr),
outActiveCompImageSetVersion.length);
EXPECT_EQ(activeCompImageSetVersionStr, activeCompImageSetVersion);
std::string pendingCompImageSetVersionStr(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const char*>(outPendingCompImageSetVersion.ptr),
outPendingCompImageSetVersion.length);
EXPECT_EQ(pendingCompImageSetVersionStr, pendingCompImageSetVersion);
@@ -971,6 +983,7 @@
0x6f, 0x6e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x32};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getFwParamsResponse.data());
pldm_get_firmware_parameters_resp outResp{};
variable_field outActiveCompImageSetVersion{};
@@ -993,10 +1006,12 @@
EXPECT_EQ(outResp.pending_comp_image_set_ver_str_len,
pendingCompImageSetVersion.size());
std::string activeCompImageSetVersionStr(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const char*>(outActiveCompImageSetVersion.ptr),
outActiveCompImageSetVersion.length);
EXPECT_EQ(activeCompImageSetVersionStr, activeCompImageSetVersion);
std::string pendingCompImageSetVersionStr(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const char*>(outPendingCompImageSetVersion.ptr),
outPendingCompImageSetVersion.length);
EXPECT_EQ(pendingCompImageSetVersionStr, pendingCompImageSetVersion);
@@ -1025,6 +1040,7 @@
0x53, 0x74, 0x72, 0x69, 0x6e, 0x67};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getFwParamsResponse.data());
pldm_get_firmware_parameters_resp outResp{};
variable_field outActiveCompImageSetVersion{};
@@ -1047,6 +1063,7 @@
PLDM_STR_TYPE_UNKNOWN);
EXPECT_EQ(outResp.pending_comp_image_set_ver_str_len, 0);
std::string activeCompImageSetVersionStr(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const char*>(outActiveCompImageSetVersion.ptr),
outActiveCompImageSetVersion.length);
EXPECT_EQ(activeCompImageSetVersionStr, activeCompImageSetVersion);
@@ -1062,6 +1079,7 @@
getFwParamsResponse{0x00, 0x00, 0x00, 0x01};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getFwParamsResponse.data());
pldm_get_firmware_parameters_resp outResp{};
variable_field outActiveCompImageSetVersion{};
@@ -1086,6 +1104,7 @@
0x00, 0x00, 0x00, 0x06, 0x0e, 0x00, 0x00};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(invalidGetFwParamsResponse1.data());
pldm_get_firmware_parameters_resp outResp{};
variable_field outActiveCompImageSetVersion{};
@@ -1141,6 +1160,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00};
responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(invalidGetFwParamsResponse2.data());
rc = decode_get_firmware_parameters_resp(
responseMsg, invalidGetFwParamsResponse2.size() - hdrSize, &outResp,
@@ -1154,6 +1174,7 @@
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x0e, 0x01, 0x00};
responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(invalidGetFwParamsResponse3.data());
rc = decode_get_firmware_parameters_resp(
responseMsg, invalidGetFwParamsResponse3.size() - hdrSize, &outResp,
@@ -1167,6 +1188,7 @@
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x0e, 0x06, 0x0e};
responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(invalidGetFwParamsResponse4.data());
rc = decode_get_firmware_parameters_resp(
responseMsg, invalidGetFwParamsResponse4.size() - hdrSize, &outResp,
@@ -1179,6 +1201,7 @@
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x0e, 0x01, 0x0e};
responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(invalidGetFwParamsResponse5.data());
rc = decode_get_firmware_parameters_resp(
responseMsg, invalidGetFwParamsResponse5.size() - hdrSize, &outResp,
@@ -1210,6 +1233,7 @@
std::array<uint8_t, entryLength> entry{};
auto inEntry =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_component_parameter_entry*>(entry.data());
inEntry->comp_classification = htole16(compClassification);
@@ -1283,6 +1307,7 @@
{
constexpr uint8_t instanceId = 1;
std::array<uint8_t, sizeof(pldm_msg_hdr)> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_query_downstream_devices_req(instanceId, requestPtr);
@@ -1336,6 +1361,7 @@
pldm_msgbuf_insert_uint16(buf, max_number_of_downstream_devices_resp);
pldm_msgbuf_insert_uint32(buf, capabilities_resp.value);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_query_downstream_devices_resp resp_data;
@@ -1383,6 +1409,7 @@
pldm_msgbuf_insert_uint16(buf, max_number_of_downstream_devices_resp);
pldm_msgbuf_insert_uint32(buf, capabilities_resp.value);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_query_downstream_devices_resp resp_data;
@@ -1425,6 +1452,7 @@
// Inject error value
pldm_msgbuf_insert_uint16(buf, (uint16_t)capabilities_resp.value);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_query_downstream_devices_resp resp_data;
@@ -1444,6 +1472,7 @@
constexpr size_t payload_length =
PLDM_QUERY_DOWNSTREAM_IDENTIFIERS_REQ_BYTES;
std::array<uint8_t, hdrSize + payload_length> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_query_downstream_identifiers_req(
@@ -1468,6 +1497,7 @@
constexpr size_t payload_length =
PLDM_QUERY_DOWNSTREAM_IDENTIFIERS_REQ_BYTES;
std::array<uint8_t, hdrSize + payload_length> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_query_downstream_identifiers_req(
@@ -1524,6 +1554,7 @@
PLDM_QUERY_DOWNSTREAM_IDENTIFIERS_RESP_MIN_LEN,
downstreamDevicesLen, 0xff);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_query_downstream_identifiers_resp resp_data = {};
struct variable_field downstreamDevices = {};
@@ -1554,6 +1585,7 @@
TEST(QueryDownstreamIdentifiers, decodeRequestErrorPaths)
{
std::array<uint8_t, hdrSize + sizeof(uint8_t)> responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_query_downstream_identifiers_resp resp_data = {};
struct variable_field downstreamDevices = {};
@@ -1616,6 +1648,7 @@
PLDM_QUERY_DOWNSTREAM_IDENTIFIERS_RESP_MIN_LEN,
actualDownstreamDevicesLen, 0xff);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_query_downstream_identifiers_resp resp_data = {};
struct variable_field downstreamDevices = {};
@@ -1673,6 +1706,7 @@
// Inject error buffer size
pldm_msgbuf_insert_uint8(buf, (uint8_t)number_of_downstream_devices_resp);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_query_downstream_identifiers_resp resp_data = {};
struct variable_field downstreamDevices = {};
@@ -1693,6 +1727,7 @@
constexpr size_t payload_length =
PLDM_GET_DOWNSTREAM_FIRMWARE_PARAMS_REQ_BYTES;
std::array<uint8_t, sizeof(pldm_msg_hdr) + payload_length> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_downstream_firmware_params_req(
@@ -1717,6 +1752,7 @@
constexpr size_t payload_length =
PLDM_GET_DOWNSTREAM_FIRMWARE_PARAMS_REQ_BYTES;
std::array<uint8_t, sizeof(pldm_msg_hdr) + payload_length> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_downstream_firmware_params_req(
@@ -1739,6 +1775,7 @@
1 /* inject erro length*/;
std::array<uint8_t, sizeof(pldm_msg_hdr) + payload_length> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_downstream_firmware_params_req(
@@ -1791,12 +1828,14 @@
std::fill_n(responseMsg.data() + hdrSize +
PLDM_GET_DOWNSTREAM_FIRMWARE_PARAMS_RESP_MIN_LEN,
downstreamDeviceParamTableLen, 0xff);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto table = reinterpret_cast<pldm_component_parameter_entry*>(
responseMsg.data() + hdrSize +
PLDM_GET_DOWNSTREAM_FIRMWARE_PARAMS_RESP_MIN_LEN);
table->active_comp_ver_str_len = activeComponentVersionStringLength;
table->pending_comp_ver_str_len = pendingComponentVersionStringLength;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_get_downstream_firmware_params_resp resp_data = {};
struct variable_field downstreamDeviceParamTable = {};
@@ -1867,6 +1906,7 @@
downstreamDeviceParamTableLen - 1 /* inject error length*/,
0xff);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_get_downstream_firmware_params_resp resp_data = {};
struct variable_field downstreamDeviceParamTable = {};
@@ -2030,6 +2070,7 @@
constexpr char versionsStr[] = {'1', '2', '3', '4', '5', '6', '7', '8',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
const struct variable_field versions = {
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
.ptr = reinterpret_cast<const uint8_t*>(versionsStr),
.length = sizeof(versionsStr)};
@@ -2068,6 +2109,7 @@
constexpr char versionsStr[] = {'1', '2', '3', '4', '5', '6', '7', '8',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
const struct variable_field versions = {
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
.ptr = reinterpret_cast<const uint8_t*>(versionsStr),
.length = sizeof(versionsStr)};
@@ -2090,6 +2132,7 @@
constexpr char versionsStr[] = {'1', '2', '3', '4', '5', '6', '7', '8',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
const struct variable_field versions = {
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
.ptr = reinterpret_cast<const uint8_t*>(versionsStr),
.length = sizeof(versionsStr) - 1 // Inject error length
};
@@ -2118,12 +2161,14 @@
static_cast<uint8_t>(compImgSetVerStr.size());
variable_field compImgSetVerStrInfo{};
compImgSetVerStrInfo.ptr =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const uint8_t*>(compImgSetVerStr.data());
compImgSetVerStrInfo.length = compImgSetVerStrLen;
std::array<uint8_t, hdrSize + sizeof(struct pldm_request_update_req) +
compImgSetVerStrLen>
request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_request_update_req(
@@ -2152,12 +2197,14 @@
uint8_t compImgSetVerStrLen = static_cast<uint8_t>(compImgSetVerStr.size());
variable_field compImgSetVerStrInfo{};
compImgSetVerStrInfo.ptr =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const uint8_t*>(compImgSetVerStr.data());
compImgSetVerStrInfo.length = compImgSetVerStrLen;
std::array<uint8_t, hdrSize + sizeof(struct pldm_request_update_req) +
compImgSetVerStr.size()>
request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_request_update_req(
@@ -2175,6 +2222,7 @@
sizeof(struct pldm_request_update_req) + compImgSetVerStrLen);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
compImgSetVerStrInfo.ptr =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const uint8_t*>(compImgSetVerStr.data());
rc = encode_request_update_req(
@@ -2241,6 +2289,7 @@
requestUpdateResponse1{0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(requestUpdateResponse1.data());
uint8_t outCompletionCode = 0;
uint16_t outFdMetaDataLen = 0;
@@ -2261,6 +2310,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(outCompletionCode)>
requestUpdateResponse2{0x00, 0x00, 0x00, 0x81};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(requestUpdateResponse2.data());
rc = decode_request_update_resp(
responseMsg2, requestUpdateResponse2.size() - hdrSize,
@@ -2276,6 +2326,7 @@
requestUpdateResponse{0x00, 0x00, 0x00, 0x00, 0x00, 0x04};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(requestUpdateResponse.data());
uint8_t outCompletionCode = 0;
uint16_t outFdMetaDataLen = 0;
@@ -2320,12 +2371,14 @@
constexpr std::string_view compVerStr = "0penBmcv1.1";
constexpr uint8_t compVerStrLen = static_cast<uint8_t>(compVerStr.size());
variable_field compVerStrInfo{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
compVerStrInfo.ptr = reinterpret_cast<const uint8_t*>(compVerStr.data());
compVerStrInfo.length = compVerStrLen;
std::array<uint8_t,
hdrSize + sizeof(pldm_pass_component_table_req) + compVerStrLen>
request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_pass_component_table_req(
@@ -2352,12 +2405,14 @@
constexpr std::string_view compVerStr = "0penBmcv1.1";
constexpr uint8_t compVerStrLen = static_cast<uint8_t>(compVerStr.size());
variable_field compVerStrInfo{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
compVerStrInfo.ptr = reinterpret_cast<const uint8_t*>(compVerStr.data());
compVerStrInfo.length = compVerStrLen;
std::array<uint8_t,
hdrSize + sizeof(pldm_pass_component_table_req) + compVerStrLen>
request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_pass_component_table_req(
@@ -2374,6 +2429,7 @@
compVerStrLen, &compVerStrInfo, requestMsg,
sizeof(pldm_pass_component_table_req) + compVerStrLen);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
compVerStrInfo.ptr = reinterpret_cast<const uint8_t*>(compVerStr.data());
rc = encode_pass_component_table_req(
@@ -2425,6 +2481,7 @@
hdrSize + sizeof(pldm_pass_component_table_resp)>
passCompTableResponse1{0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(passCompTableResponse1.data());
uint8_t completionCode = 0;
@@ -2444,6 +2501,7 @@
hdrSize + sizeof(pldm_pass_component_table_resp)>
passCompTableResponse2{0x00, 0x00, 0x00, 0x00, 0x00, 0xd0};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(passCompTableResponse2.data());
rc = decode_pass_component_table_resp(
responseMsg2, sizeof(pldm_pass_component_table_resp), &completionCode,
@@ -2458,6 +2516,7 @@
hdrSize + sizeof(pldm_pass_component_table_resp)>
passCompTableResponse3{0x00, 0x00, 0x00, 0x80};
auto responseMsg3 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(passCompTableResponse3.data());
rc = decode_pass_component_table_resp(
@@ -2474,6 +2533,7 @@
hdrSize + sizeof(pldm_pass_component_table_resp) - 1>
passCompTableResponse1{0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(passCompTableResponse1.data());
uint8_t completionCode = 0;
@@ -2513,6 +2573,7 @@
hdrSize + sizeof(pldm_pass_component_table_resp)>
passCompTableResponse2{0x00, 0x00, 0x00, 0x00, 0x02, 0x00};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(passCompTableResponse2.data());
rc = decode_pass_component_table_resp(
responseMsg2, sizeof(pldm_pass_component_table_resp), &completionCode,
@@ -2523,6 +2584,7 @@
hdrSize + sizeof(pldm_pass_component_table_resp)>
passCompTableResponse3{0x00, 0x00, 0x00, 0x00, 0x00, 0x0c};
auto responseMsg3 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(passCompTableResponse3.data());
rc = decode_pass_component_table_resp(
responseMsg3, sizeof(pldm_pass_component_table_resp), &completionCode,
@@ -2533,6 +2595,7 @@
hdrSize + sizeof(pldm_pass_component_table_resp)>
passCompTableResponse4{0x00, 0x00, 0x00, 0x00, 0x00, 0xf0};
auto responseMsg4 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(passCompTableResponse4.data());
rc = decode_pass_component_table_resp(
responseMsg4, sizeof(pldm_pass_component_table_resp), &completionCode,
@@ -2551,12 +2614,14 @@
constexpr std::string_view compVerStr = "OpenBmcv2.2";
constexpr uint8_t compVerStrLen = static_cast<uint8_t>(compVerStr.size());
variable_field compVerStrInfo{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
compVerStrInfo.ptr = reinterpret_cast<const uint8_t*>(compVerStr.data());
compVerStrInfo.length = compVerStrLen;
std::array<uint8_t,
hdrSize + sizeof(pldm_update_component_req) + compVerStrLen>
request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_update_component_req(
@@ -2586,12 +2651,14 @@
constexpr std::string_view compVerStr = "OpenBmcv2.2";
constexpr uint8_t compVerStrLen = static_cast<uint8_t>(compVerStr.size());
variable_field compVerStrInfo{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
compVerStrInfo.ptr = reinterpret_cast<const uint8_t*>(compVerStr.data());
compVerStrInfo.length = compVerStrLen;
std::array<uint8_t,
hdrSize + sizeof(pldm_update_component_req) + compVerStrLen>
request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_update_component_req(
@@ -2608,6 +2675,7 @@
PLDM_STR_TYPE_ASCII, compVerStrLen, &compVerStrInfo, requestMsg,
sizeof(pldm_update_component_req) + compVerStrLen);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
compVerStrInfo.ptr = reinterpret_cast<const uint8_t*>(compVerStr.data());
rc = encode_update_component_req(
@@ -2661,6 +2729,7 @@
updateComponentResponse1{0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x64, 0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(updateComponentResponse1.data());
uint8_t completionCode = 0;
@@ -2687,6 +2756,7 @@
updateComponentResponse2{0x00, 0x00, 0x00, 0x00, 0x01, 0x09,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(updateComponentResponse2.data());
rc = decode_update_component_resp(
responseMsg2, sizeof(pldm_update_component_resp), &completionCode,
@@ -2703,6 +2773,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(pldm_update_component_resp)>
updateComponentResponse3{0x00, 0x00, 0x00, 0x80};
auto responseMsg3 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(updateComponentResponse3.data());
rc = decode_update_component_resp(
@@ -2721,6 +2792,7 @@
updateComponentResponse1{0x00, 0x00, 0x00, 0x00, 0x01, 0x09,
0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(updateComponentResponse1.data());
uint8_t completionCode = 0;
@@ -2781,6 +2853,7 @@
updateComponentResponse2{0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x01, 0x00, 0x00, 0x00, 0x64, 0x00};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(updateComponentResponse2.data());
rc = decode_update_component_resp(
responseMsg2, sizeof(pldm_update_component_resp), &completionCode,
@@ -2792,6 +2865,7 @@
updateComponentResponse3{0x00, 0x00, 0x00, 0x00, 0x00, 0x0c,
0x01, 0x00, 0x00, 0x00, 0x64, 0x00};
auto responseMsg3 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(updateComponentResponse3.data());
rc = decode_update_component_resp(
responseMsg3, sizeof(pldm_update_component_resp), &completionCode,
@@ -2803,6 +2877,7 @@
updateComponentResponse4{0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
0x01, 0x00, 0x00, 0x00, 0x64, 0x00};
auto responseMsg4 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(updateComponentResponse4.data());
rc = decode_update_component_resp(
responseMsg4, sizeof(pldm_update_component_resp), &completionCode,
@@ -2819,6 +2894,7 @@
hdrSize + sizeof(pldm_request_firmware_data_req)>
reqFWDataReq{0x00, 0x00, 0x00, 0x2c, 0x01, 0x00,
0x00, 0xff, 0x00, 0x00, 0x00};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<const pldm_msg*>(reqFWDataReq.data());
uint32_t outOffset = 0;
@@ -2838,6 +2914,7 @@
hdrSize + sizeof(pldm_request_firmware_data_req)>
reqFWDataReq{0x00, 0x00, 0x00, 0x2c, 0x01, 0x00,
0x00, 0x1f, 0x00, 0x00, 0x00};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<const pldm_msg*>(reqFWDataReq.data());
uint32_t outOffset = 0;
@@ -2886,6 +2963,7 @@
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14,
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c,
0x1d, 0x1e, 0x1f, 0x20};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responseMsg1 = reinterpret_cast<pldm_msg*>(reqFwDataResponse1.data());
auto rc = encode_request_firmware_data_resp(
instanceId, completionCode, responseMsg1,
@@ -2897,6 +2975,7 @@
outReqFwDataResponse2{0x03, 0x05, 0x15, 0x82};
std::array<uint8_t, hdrSize + sizeof(completionCode)> reqFwDataResponse2{
0x00, 0x00, 0x00, 0x00};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responseMsg2 = reinterpret_cast<pldm_msg*>(reqFwDataResponse2.data());
rc = encode_request_firmware_data_resp(
instanceId, PLDM_FWUP_DATA_OUT_OF_RANGE, responseMsg2,
@@ -2908,6 +2987,7 @@
TEST(RequestFirmwareData, errorPathEncodeResponse)
{
std::array<uint8_t, hdrSize> reqFwDataResponse{0x00, 0x00, 0x00};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responseMsg = reinterpret_cast<pldm_msg*>(reqFwDataResponse.data());
auto rc = encode_request_firmware_data_resp(0, PLDM_SUCCESS, nullptr, 0);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
@@ -2922,6 +3002,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(transferResult)>
transferCompleteReq1{0x00, 0x00, 0x00, 0x00};
auto requestMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(transferCompleteReq1.data());
uint8_t outTransferResult = 0;
@@ -2933,6 +3014,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(transferResult)>
transferCompleteReq2{0x00, 0x00, 0x00, 0x02};
auto requestMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(transferCompleteReq2.data());
rc = decode_transfer_complete_req(requestMsg2, sizeof(transferResult),
&outTransferResult);
@@ -2945,6 +3027,7 @@
constexpr std::array<uint8_t, hdrSize> transferCompleteReq{0x00, 0x00,
0x00};
auto requestMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(transferCompleteReq.data());
uint8_t outTransferResult = 0;
@@ -2967,6 +3050,7 @@
std::array<uint8_t, hdrSize + sizeof(completionCode)>
transferCompleteResponse1{0x00, 0x00, 0x00, 0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_msg*>(transferCompleteResponse1.data());
auto rc = encode_transfer_complete_resp(
instanceId, completionCode, responseMsg1, sizeof(completionCode));
@@ -2978,6 +3062,7 @@
std::array<uint8_t, hdrSize + sizeof(completionCode)>
transferCompleteResponse2{0x00, 0x00, 0x00, 0x00};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_msg*>(transferCompleteResponse2.data());
rc = encode_transfer_complete_resp(instanceId,
PLDM_FWUP_COMMAND_NOT_EXPECTED,
@@ -2990,6 +3075,7 @@
{
std::array<uint8_t, hdrSize> transferCompleteResponse{0x00, 0x00, 0x00};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_msg*>(transferCompleteResponse.data());
auto rc = encode_transfer_complete_resp(0, PLDM_SUCCESS, nullptr, 0);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
@@ -3004,6 +3090,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(verifyResult)>
verifyCompleteReq1{0x00, 0x00, 0x00, 0x00};
auto requestMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(verifyCompleteReq1.data());
uint8_t outVerifyResult = 0;
@@ -3015,6 +3102,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(verifyResult)>
verifyCompleteReq2{0x00, 0x00, 0x00, 0x03};
auto requestMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(verifyCompleteReq2.data());
rc = decode_verify_complete_req(requestMsg2, sizeof(verifyResult),
&outVerifyResult);
@@ -3026,6 +3114,7 @@
{
constexpr std::array<uint8_t, hdrSize> verifyCompleteReq{0x00, 0x00, 0x00};
auto requestMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(verifyCompleteReq.data());
uint8_t outVerifyResult = 0;
@@ -3048,6 +3137,7 @@
std::array<uint8_t, hdrSize + sizeof(completionCode)>
verifyCompleteResponse1{0x00, 0x00, 0x00, 0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_msg*>(verifyCompleteResponse1.data());
auto rc = encode_verify_complete_resp(instanceId, completionCode,
responseMsg1, sizeof(completionCode));
@@ -3059,6 +3149,7 @@
std::array<uint8_t, hdrSize + sizeof(completionCode)>
verifyCompleteResponse2{0x00, 0x00, 0x00, 0x00};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_msg*>(verifyCompleteResponse2.data());
rc = encode_verify_complete_resp(instanceId, PLDM_FWUP_COMMAND_NOT_EXPECTED,
responseMsg2, sizeof(completionCode));
@@ -3070,6 +3161,7 @@
{
std::array<uint8_t, hdrSize> verifyCompleteResponse{0x00, 0x00, 0x00};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_msg*>(verifyCompleteResponse.data());
auto rc = encode_verify_complete_resp(0, PLDM_SUCCESS, nullptr, 0);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
@@ -3087,6 +3179,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(pldm_apply_complete_req)>
applyCompleteReq1{0x00, 0x00, 0x00, 0x01, 0x30, 0x00};
auto requestMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(applyCompleteReq1.data());
uint8_t outApplyResult = 0;
bitfield16_t outCompActivationModification{};
@@ -3102,6 +3195,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(pldm_apply_complete_req)>
applyCompleteReq2{0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto requestMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(applyCompleteReq2.data());
rc = decode_apply_complete_req(requestMsg2, sizeof(pldm_apply_complete_req),
&outApplyResult,
@@ -3115,6 +3209,7 @@
{
constexpr std::array<uint8_t, hdrSize> applyCompleteReq1{0x00, 0x00, 0x00};
auto requestMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(applyCompleteReq1.data());
uint8_t outApplyResult = 0;
bitfield16_t outCompActivationModification{};
@@ -3139,6 +3234,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(pldm_apply_complete_req)>
applyCompleteReq2{0x00, 0x00, 0x00, 0x00, 0x01, 0x00};
auto requestMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(applyCompleteReq2.data());
rc = decode_apply_complete_req(requestMsg2, sizeof(pldm_apply_complete_req),
&outApplyResult,
@@ -3155,6 +3251,7 @@
std::array<uint8_t, hdrSize + sizeof(completionCode)>
applyCompleteResponse1{0x00, 0x00, 0x00, 0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_msg*>(applyCompleteResponse1.data());
auto rc = encode_apply_complete_resp(instanceId, completionCode,
responseMsg1, sizeof(completionCode));
@@ -3166,6 +3263,7 @@
std::array<uint8_t, hdrSize + sizeof(completionCode)>
applyCompleteResponse2{0x00, 0x00, 0x00, 0x00};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_msg*>(applyCompleteResponse2.data());
rc = encode_apply_complete_resp(instanceId, PLDM_FWUP_COMMAND_NOT_EXPECTED,
responseMsg2, sizeof(completionCode));
@@ -3177,6 +3275,7 @@
{
std::array<uint8_t, hdrSize> applyCompleteResponse{0x00, 0x00, 0x00};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_msg*>(applyCompleteResponse.data());
auto rc = encode_apply_complete_resp(0, PLDM_SUCCESS, nullptr, 0);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
@@ -3190,6 +3289,7 @@
constexpr uint8_t instanceId = 7;
std::array<uint8_t, hdrSize + sizeof(pldm_activate_firmware_req)> request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_activate_firmware_req(
@@ -3205,6 +3305,7 @@
TEST(ActivateFirmware, errorPathEncodeRequest)
{
std::array<uint8_t, hdrSize + sizeof(pldm_activate_firmware_req)> request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_activate_firmware_req(
@@ -3227,6 +3328,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(pldm_activate_firmware_resp)>
activateFirmwareResponse1{0x00, 0x00, 0x00, 0x00, 0x64, 0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(activateFirmwareResponse1.data());
uint8_t completionCode = 0;
@@ -3243,6 +3345,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(completionCode)>
activateFirmwareResponse2{0x00, 0x00, 0x00, 0x85};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(activateFirmwareResponse2.data());
rc = decode_activate_firmware_resp(responseMsg2, sizeof(completionCode),
@@ -3258,6 +3361,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(pldm_activate_firmware_resp)>
activateFirmwareResponse{0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(activateFirmwareResponse.data());
uint8_t completionCode = 0;
@@ -3292,6 +3396,7 @@
{
constexpr uint8_t instanceId = 8;
std::array<uint8_t, hdrSize> request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_get_status_req(instanceId, requestMsg,
@@ -3305,6 +3410,7 @@
TEST(GetStatus, errorPathEncodeRequest)
{
std::array<uint8_t, hdrSize + sizeof(uint8_t)> request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_get_status_req(0, nullptr, PLDM_GET_STATUS_REQ_BYTES);
@@ -3321,6 +3427,7 @@
getStatusResponse1{0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03,
0x09, 0x65, 0x05, 0x00, 0x00, 0x00, 0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse1.data());
uint8_t completionCode = 0;
@@ -3355,6 +3462,7 @@
getStatusResponse2{0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00,
0x70, 0x32, 0x05, 0x01, 0x00, 0x00, 0x00};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse2.data());
rc = decode_get_status_resp(
@@ -3375,6 +3483,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(completionCode)>
getStatusResponse3{0x00, 0x00, 0x00, 0x04};
auto responseMsg3 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse3.data());
rc = decode_get_status_resp(
responseMsg3, getStatusResponse3.size() - hdrSize, &completionCode,
@@ -3397,6 +3506,7 @@
constexpr std::array<uint8_t, hdrSize> getStatusResponse1{0x00, 0x00, 0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse1.data());
auto rc = decode_get_status_resp(
@@ -3463,6 +3573,7 @@
getStatusResponse2{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse2.data());
rc = decode_get_status_resp(
responseMsg2, getStatusResponse2.size() - hdrSize, &completionCode,
@@ -3474,6 +3585,7 @@
getStatusResponse3{0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg3 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse3.data());
rc = decode_get_status_resp(
responseMsg3, getStatusResponse3.size() - hdrSize, &completionCode,
@@ -3485,6 +3597,7 @@
getStatusResponse4{0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg4 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse4.data());
rc = decode_get_status_resp(
responseMsg4, getStatusResponse4.size() - hdrSize, &completionCode,
@@ -3496,6 +3609,7 @@
getStatusResponse5{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg5 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse5.data());
rc = decode_get_status_resp(
responseMsg5, getStatusResponse5.size() - hdrSize, &completionCode,
@@ -3507,6 +3621,7 @@
getStatusResponse6{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg6 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse6.data());
rc = decode_get_status_resp(
responseMsg6, getStatusResponse6.size() - hdrSize, &completionCode,
@@ -3518,6 +3633,7 @@
getStatusResponse7{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg7 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse7.data());
rc = decode_get_status_resp(
responseMsg7, getStatusResponse7.size() - hdrSize, &completionCode,
@@ -3529,6 +3645,7 @@
getStatusResponse8{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc7, 0x00, 0x00, 0x00, 0x00};
auto responseMsg8 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse8.data());
rc = decode_get_status_resp(
responseMsg8, getStatusResponse8.size() - hdrSize, &completionCode,
@@ -3542,6 +3659,7 @@
getStatusResponse9{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg9 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(getStatusResponse9.data());
rc = decode_get_status_resp(
responseMsg9, getStatusResponse9.size() - hdrSize, &completionCode,
@@ -3554,6 +3672,7 @@
{
constexpr uint8_t instanceId = 9;
std::array<uint8_t, hdrSize> request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_cancel_update_component_req(
@@ -3567,6 +3686,7 @@
TEST(CancelUpdateComponent, errorPathEncodeRequest)
{
std::array<uint8_t, hdrSize + sizeof(uint8_t)> request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_cancel_update_component_req(
@@ -3583,6 +3703,7 @@
uint8_t completionCode = 0;
constexpr std::array<uint8_t, hdrSize + sizeof(completionCode)>
cancelUpdateComponentResponse1{0x00, 0x00, 0x00, 0x00};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responseMsg1 = reinterpret_cast<const pldm_msg*>(
cancelUpdateComponentResponse1.data());
auto rc = decode_cancel_update_component_resp(
@@ -3593,6 +3714,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(completionCode)>
cancelUpdateComponentResponse2{0x00, 0x00, 0x00, 0x86};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responseMsg2 = reinterpret_cast<const pldm_msg*>(
cancelUpdateComponentResponse2.data());
rc = decode_cancel_update_component_resp(
@@ -3608,6 +3730,7 @@
constexpr std::array<uint8_t, hdrSize> cancelUpdateComponentResponse{
0x00, 0x00, 0x00};
auto responseMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(cancelUpdateComponentResponse.data());
auto rc = decode_cancel_update_component_resp(
@@ -3629,6 +3752,7 @@
{
constexpr uint8_t instanceId = 10;
std::array<uint8_t, hdrSize> request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_cancel_update_req(instanceId, requestMsg,
@@ -3642,6 +3766,7 @@
TEST(CancelUpdate, errorPathEncodeRequest)
{
std::array<uint8_t, hdrSize + sizeof(uint8_t)> request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc =
@@ -3660,6 +3785,7 @@
cancelUpdateResponse1{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(cancelUpdateResponse1.data());
uint8_t completionCode = 0;
bool8_t nonFunctioningComponentIndication = 0;
@@ -3679,6 +3805,7 @@
cancelUpdateResponse2{0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(cancelUpdateResponse2.data());
rc = decode_cancel_update_resp(
responseMsg2, cancelUpdateResponse2.size() - hdrSize, &completionCode,
@@ -3693,6 +3820,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(completionCode)>
cancelUpdateResponse3{0x00, 0x00, 0x00, 0x86};
auto responseMsg3 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(cancelUpdateResponse3.data());
rc = decode_cancel_update_resp(
responseMsg3, cancelUpdateResponse3.size() - hdrSize, &completionCode,
@@ -3706,6 +3834,7 @@
constexpr std::array<uint8_t, hdrSize> cancelUpdateResponse1{0x00, 0x00,
0x00};
auto responseMsg1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(cancelUpdateResponse1.data());
uint8_t completionCode = 0;
bool8_t nonFunctioningComponentIndication = 0;
@@ -3739,6 +3868,7 @@
constexpr std::array<uint8_t, hdrSize + sizeof(completionCode)>
cancelUpdateResponse2{0x00, 0x00, 0x00, 0x00};
auto responseMsg2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(cancelUpdateResponse2.data());
rc = decode_cancel_update_resp(
responseMsg2, cancelUpdateResponse2.size() - hdrSize, &completionCode,
@@ -3749,6 +3879,7 @@
cancelUpdateResponse3{0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
auto responseMsg3 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const pldm_msg*>(cancelUpdateResponse3.data());
rc = decode_cancel_update_resp(
responseMsg3, cancelUpdateResponse3.size() - hdrSize, &completionCode,
diff --git a/tests/dsp/fru.cpp b/tests/dsp/fru.cpp
index 11cbc5d..1f32852 100644
--- a/tests/dsp/fru.cpp
+++ b/tests/dsp/fru.cpp
@@ -13,6 +13,7 @@
TEST(GetFruRecordTableMetadata, testGoodEncodeRequest)
{
std::array<uint8_t, sizeof(pldm_msg_hdr)> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_fru_record_table_metadata_req(
0, requestPtr, PLDM_GET_FRU_RECORD_TABLE_METADATA_REQ_BYTES);
@@ -28,6 +29,7 @@
auto rc = encode_get_fru_record_table_metadata_req(0, NULL, 0);
ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
std::array<uint8_t, sizeof(pldm_msg_hdr)> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
rc = encode_get_fru_record_table_metadata_req(0, requestPtr, 1);
ASSERT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
@@ -38,8 +40,10 @@
std::vector<uint8_t> responseMsg(
sizeof(pldm_msg_hdr) + PLDM_GET_FRU_RECORD_TABLE_METADATA_RESP_BYTES);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_get_fru_record_table_metadata_resp*>(
responsePtr->payload);
@@ -117,8 +121,10 @@
{
std::vector<uint8_t> responseMsg(
sizeof(pldm_msg_hdr) + PLDM_GET_FRU_RECORD_TABLE_METADATA_RESP_BYTES);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_get_fru_record_table_metadata_resp*>(
responsePtr->payload);
@@ -196,6 +202,7 @@
std::array<uint8_t, sizeof(pldm_msg_hdr) +
PLDM_GET_FRU_RECORD_TABLE_METADATA_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
responsePtr->hdr.request = PLDM_RESPONSE;
@@ -217,6 +224,7 @@
fru_table_maximum_size, fru_table_length, total_record_set_identifiers,
total_table_records, checksum, responsePtr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_get_fru_record_table_metadata_resp*>(
responsePtr->payload);
@@ -268,6 +276,7 @@
std::array<uint8_t, sizeof(pldm_msg_hdr) +
PLDM_GET_FRU_RECORD_TABLE_METADATA_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t completion_code = PLDM_SUCCESS;
@@ -284,6 +293,7 @@
fru_table_maximum_size, fru_table_length, total_record_set_identifiers,
total_table_records, checksum, NULL);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_get_fru_record_table_metadata_resp*>(
responsePtr->payload);
@@ -305,9 +315,11 @@
std::array<uint8_t,
PLDM_GET_FRU_RECORD_TABLE_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
size_t payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
auto request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_get_fru_record_table_req*>(requestPtr->payload);
request->data_transfer_handle = htole32(data_transfer_handle);
@@ -334,6 +346,7 @@
std::array<uint8_t,
sizeof(pldm_msg_hdr) + PLDM_GET_FRU_RECORD_TABLE_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Payload message is missing
@@ -356,8 +369,10 @@
std::vector<uint8_t> responseMsg(sizeof(pldm_msg_hdr) +
PLDM_GET_FRU_RECORD_TABLE_MIN_RESP_BYTES);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_get_fru_record_table_resp*>(responsePtr->payload);
// Invoke encode get FRU record table response api
@@ -384,6 +399,7 @@
std::vector<uint8_t> responseMsg(sizeof(pldm_msg_hdr) +
PLDM_GET_FRU_RECORD_TABLE_MIN_RESP_BYTES);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_get_fru_record_table_resp(
0, PLDM_ERROR, next_data_transfer_handle, transfer_flag, responsePtr);
@@ -408,8 +424,10 @@
sizeof(pldm_msg_hdr) + PLDM_GET_FRU_RECORD_TABLE_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_get_fru_record_table_req*>(requestPtr->payload);
// Random value for data transfer handle and transfer operation flag
@@ -457,9 +475,11 @@
PLDM_GET_FRU_RECORD_TABLE_MIN_RESP_BYTES +
fru_record_table_data.size());
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
auto response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_get_fru_record_table_resp*>(responsePtr->payload);
response->completion_code = completion_code;
@@ -501,6 +521,7 @@
PLDM_GET_FRU_RECORD_TABLE_MIN_RESP_BYTES +
fru_record_table_data.size());
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
// Payload message is missing
@@ -531,6 +552,7 @@
constexpr auto payLoadLength = sizeof(pldm_get_fru_record_by_option_req);
std::array<uint8_t, sizeof(pldm_msg_hdr) + payLoadLength> request;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto reqMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_get_fru_record_by_option_req(
@@ -541,6 +563,7 @@
EXPECT_EQ(instanceId, reqMsg->hdr.instance_id);
auto payLoadMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_get_fru_record_by_option_req*>(reqMsg->payload);
EXPECT_EQ(le32toh(payLoadMsg->data_transfer_handle), dataTransferHandle);
@@ -561,6 +584,7 @@
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
std::array<uint8_t, sizeof(pldm_msg_hdr) + payLoadLength> request;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto reqMsg = reinterpret_cast<pldm_msg*>(request.data());
rc = encode_get_fru_record_by_option_req(1, 2, 3, 4, 5, 6, 0, reqMsg,
@@ -582,6 +606,7 @@
constexpr auto payLoadLength = sizeof(pldm_get_fru_record_by_option_req);
std::array<uint8_t, sizeof(pldm_msg_hdr) + payLoadLength> request;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto reqMsg = reinterpret_cast<pldm_msg*>(request.data());
auto rc = encode_get_fru_record_by_option_req(
@@ -615,6 +640,7 @@
{
constexpr auto payLoadLength = sizeof(pldm_get_fru_record_by_option_req);
std::array<uint8_t, sizeof(pldm_msg_hdr) + payLoadLength> request{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto reqMsg = reinterpret_cast<pldm_msg*>(request.data());
uint32_t retDataTransferHandle{};
@@ -651,6 +677,7 @@
sizeof(pldm_get_fru_record_by_option_resp) - 1 + fruData.size();
std::array<uint8_t, sizeof(pldm_msg_hdr) + payLoadLength> response;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto respMsg = reinterpret_cast<pldm_msg*>(response.data());
auto rc = encode_get_fru_record_by_option_resp(
@@ -658,6 +685,7 @@
fruData.data(), fruData.size(), respMsg, payLoadLength);
auto payLoadMsg =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_get_fru_record_by_option_resp*>(respMsg->payload);
EXPECT_EQ(rc, PLDM_SUCCESS);
@@ -683,6 +711,7 @@
sizeof(pldm_get_fru_record_by_option_resp) - 1 + fruData.size();
std::array<uint8_t, sizeof(pldm_msg_hdr) + payLoadLength> response;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto respMsg = reinterpret_cast<pldm_msg*>(response.data());
auto rc = encode_get_fru_record_by_option_resp(
@@ -710,6 +739,7 @@
sizeof(pldm_get_fru_record_by_option_resp) - 1 + fruData.size();
std::array<uint8_t, sizeof(pldm_msg_hdr) + payLoadLength> response;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto respMsg = reinterpret_cast<pldm_msg*>(response.data());
auto rc = encode_get_fru_record_by_option_resp(
@@ -748,6 +778,7 @@
sizeof(pldm_get_fru_record_by_option_resp) - 1 + fruData.size();
std::array<uint8_t, sizeof(pldm_msg_hdr) + payLoadLength> response;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto respMsg = reinterpret_cast<pldm_msg*>(response.data());
auto rc = encode_get_fru_record_by_option_resp(
@@ -785,6 +816,7 @@
sizeof(pldm_msg_hdr) + PLDM_SET_FRU_RECORD_TABLE_RESP_BYTES>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
auto rc = encode_set_fru_record_table_resp(
instanceId, completionCode, nextDataTransferHandle,
@@ -792,6 +824,7 @@
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_set_fru_record_table_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_fru_record_table_resp*>(
response->payload);
EXPECT_EQ(completionCode, resp->completion_code);
@@ -808,6 +841,7 @@
sizeof(pldm_msg_hdr) + PLDM_SET_FRU_RECORD_TABLE_RESP_BYTES>
responseMsg{};
struct pldm_msg* response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_msg*>(responseMsg.data());
auto rc = encode_set_fru_record_table_resp(
@@ -831,8 +865,10 @@
PLDM_SET_FRU_RECORD_TABLE_MIN_REQ_BYTES +
sizeof(tableData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<struct pldm_msg*>(requestMsg.data());
struct pldm_set_fru_record_table_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_fru_record_table_req*>(
request->payload);
req->data_transfer_handle = htole32(transferHandle);
@@ -864,8 +900,10 @@
PLDM_SET_FRU_RECORD_TABLE_MIN_REQ_BYTES +
sizeof(tableData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<struct pldm_msg*>(requestMsg.data());
struct pldm_set_fru_record_table_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_fru_record_table_req*>(
request->payload);
req->data_transfer_handle = htole32(transferHandle);
diff --git a/tests/dsp/pdr.cpp b/tests/dsp/pdr.cpp
index b8e224e..ef6e4e8 100644
--- a/tests/dsp/pdr.cpp
+++ b/tests/dsp/pdr.cpp
@@ -272,6 +272,7 @@
std::array<uint32_t, 10> in{100, 345, 3, 6, 89, 0, 11, 45, 23434, 123123};
uint32_t handle = 1;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in.data()),
sizeof(in), false, 1, &handle),
0);
@@ -306,14 +307,17 @@
std::array<uint32_t, 10> in2{1000, 3450, 30, 60, 890,
0, 110, 450, 234034, 123123};
handle = 2;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()),
sizeof(in2), false, 1, &handle),
0);
handle = 3;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()),
sizeof(in2), false, 1, &handle),
0);
handle = 4;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()),
sizeof(in2), true, 1, &handle),
0);
@@ -362,6 +366,7 @@
std::array<uint32_t, 10> in{100, 345, 3, 6, 89, 0, 11, 45, 23434, 123123};
uint32_t handle = 1;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in.data()),
sizeof(in), false, 1, &handle),
0);
@@ -380,14 +385,17 @@
std::array<uint32_t, 10> in2{1000, 3450, 30, 60, 890,
0, 110, 450, 234034, 123123};
handle = 2;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()),
sizeof(in2), false, 1, &handle),
0);
handle = 3;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()),
sizeof(in2), false, 1, &handle),
0);
handle = 4;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<uint8_t*>(in2.data()),
sizeof(in2), false, 1, &handle),
0);
@@ -420,6 +428,7 @@
auto repo = pldm_pdr_init();
std::array<uint8_t, sizeof(pldm_pdr_hdr)> data{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_pdr_hdr* hdr = reinterpret_cast<pldm_pdr_hdr*>(data.data());
hdr->type = 1;
uint32_t first = 0;
@@ -493,11 +502,13 @@
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(pldm_pdr_hdr) + sizeof(pldm_pdr_fru_record_set));
EXPECT_EQ(nextRecHdl, 0u);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_pdr_hdr* hdr = reinterpret_cast<pldm_pdr_hdr*>(outData);
EXPECT_EQ(hdr->version, 1u);
EXPECT_EQ(hdr->type, PLDM_PDR_FRU_RECORD_SET);
EXPECT_EQ(hdr->length, htole16(sizeof(pldm_pdr_fru_record_set)));
EXPECT_EQ(hdr->record_handle, htole32(1));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_pdr_fru_record_set* fru = reinterpret_cast<pldm_pdr_fru_record_set*>(
outData + sizeof(pldm_pdr_hdr));
EXPECT_EQ(fru->terminus_handle, htole16(1));
@@ -517,11 +528,13 @@
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(pldm_pdr_hdr) + sizeof(pldm_pdr_fru_record_set));
EXPECT_EQ(nextRecHdl, 0u);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
hdr = reinterpret_cast<pldm_pdr_hdr*>(outData);
EXPECT_EQ(hdr->version, 1u);
EXPECT_EQ(hdr->type, PLDM_PDR_FRU_RECORD_SET);
EXPECT_EQ(hdr->length, htole16(sizeof(pldm_pdr_fru_record_set)));
EXPECT_EQ(hdr->record_handle, htole32(2));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
fru = reinterpret_cast<pldm_pdr_fru_record_set*>(outData +
sizeof(pldm_pdr_hdr));
EXPECT_EQ(fru->terminus_handle, htole16(2));
@@ -535,11 +548,13 @@
EXPECT_NE(hdl, nullptr);
EXPECT_EQ(size, sizeof(pldm_pdr_hdr) + sizeof(pldm_pdr_fru_record_set));
EXPECT_EQ(nextRecHdl, 2u);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
hdr = reinterpret_cast<pldm_pdr_hdr*>(outData);
EXPECT_EQ(hdr->version, 1u);
EXPECT_EQ(hdr->type, PLDM_PDR_FRU_RECORD_SET);
EXPECT_EQ(hdr->length, htole16(sizeof(pldm_pdr_fru_record_set)));
EXPECT_EQ(hdr->record_handle, htole32(1));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
fru = reinterpret_cast<pldm_pdr_fru_record_set*>(outData +
sizeof(pldm_pdr_hdr));
EXPECT_EQ(fru->terminus_handle, htole16(1));
@@ -635,18 +650,21 @@
hdr.type = 1;
uint16_t firstTerminusHandle = 1;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<const uint8_t*>(&hdr),
sizeof(hdr), false, firstTerminusHandle, NULL),
0);
hdr.type = 2;
uint16_t secondTerminusHandle = 2;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<const uint8_t*>(&hdr),
sizeof(hdr), true, secondTerminusHandle, NULL),
0);
hdr.type = 3;
uint16_t thirdTerminusHandle = 3;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pldm_pdr_add(repo, reinterpret_cast<const uint8_t*>(&hdr),
sizeof(hdr), true, thirdTerminusHandle, NULL),
0);
@@ -1180,16 +1198,19 @@
l1, PLDM_ENTITY_ASSOCIAION_LOGICAL) *
sizeof(pldm_entity)));
uint8_t* start = data;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_pdr_hdr* hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 1u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
uint16_t* containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 1u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_LOGICAL);
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_entity* entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 1u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
@@ -1198,11 +1219,13 @@
EXPECT_EQ(*start,
pldm_entity_get_num_children(l1, PLDM_ENTITY_ASSOCIAION_LOGICAL));
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 3u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 1u);
start += sizeof(pldm_entity);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 3u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 2u);
@@ -1215,16 +1238,19 @@
l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL) *
sizeof(pldm_entity)));
start = data;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 2u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 1u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_PHYSICAL);
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 1u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
@@ -1233,11 +1259,13 @@
EXPECT_EQ(*start, pldm_entity_get_num_children(
l1, PLDM_ENTITY_ASSOCIAION_PHYSICAL));
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 2u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 1u);
start += sizeof(pldm_entity);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 2u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 2u);
@@ -1250,16 +1278,19 @@
l2a, PLDM_ENTITY_ASSOCIAION_LOGICAL) *
sizeof(pldm_entity)));
start = data;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 3u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 2u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_LOGICAL);
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 2u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
@@ -1268,11 +1299,13 @@
EXPECT_EQ(*start, pldm_entity_get_num_children(
l2a, PLDM_ENTITY_ASSOCIAION_LOGICAL));
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 5);
EXPECT_EQ(le16toh(entity->entity_instance_num), 2u);
EXPECT_EQ(le16toh(entity->entity_container_id), 2u);
start += sizeof(pldm_entity);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 5u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 3u);
@@ -1285,16 +1318,19 @@
l2a, PLDM_ENTITY_ASSOCIAION_PHYSICAL) *
sizeof(pldm_entity)));
start = data;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 4u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 2u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_PHYSICAL);
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 2u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
@@ -1303,11 +1339,13 @@
EXPECT_EQ(*start, pldm_entity_get_num_children(
l2a, PLDM_ENTITY_ASSOCIAION_PHYSICAL));
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 4u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
EXPECT_EQ(le16toh(entity->entity_container_id), 2u);
start += sizeof(pldm_entity);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 5u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
@@ -1320,16 +1358,19 @@
l3a, PLDM_ENTITY_ASSOCIAION_PHYSICAL) *
sizeof(pldm_entity)));
start = data;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 5u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 3u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_PHYSICAL);
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 4u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
@@ -1338,6 +1379,7 @@
EXPECT_EQ(*start, pldm_entity_get_num_children(
l3a, PLDM_ENTITY_ASSOCIAION_PHYSICAL));
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 6u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
@@ -1350,16 +1392,19 @@
l3b, PLDM_ENTITY_ASSOCIAION_LOGICAL) *
sizeof(pldm_entity)));
start = data;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
hdr = reinterpret_cast<pldm_pdr_hdr*>(start);
EXPECT_EQ(le32toh(hdr->record_handle), 6u);
EXPECT_EQ(hdr->type, PLDM_PDR_ENTITY_ASSOCIATION);
EXPECT_EQ(le16toh(hdr->length), size - sizeof(struct pldm_pdr_hdr));
start += sizeof(pldm_pdr_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
containerId = reinterpret_cast<uint16_t*>(start);
EXPECT_EQ(le16toh(*containerId), 4u);
start += sizeof(uint16_t);
EXPECT_EQ(*start, PLDM_ENTITY_ASSOCIAION_LOGICAL);
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 5u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
@@ -1368,6 +1413,7 @@
EXPECT_EQ(*start, pldm_entity_get_num_children(
l3b, PLDM_ENTITY_ASSOCIAION_LOGICAL));
start += sizeof(uint8_t);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
entity = reinterpret_cast<pldm_entity*>(start);
EXPECT_EQ(le16toh(entity->entity_type), 7u);
EXPECT_EQ(le16toh(entity->entity_instance_num), 1u);
@@ -1516,12 +1562,14 @@
std::vector<uint8_t> pdr{};
pdr.resize(sizeof(pldm_pdr_hdr) + sizeof(pldm_pdr_entity_association) +
sizeof(pldm_entity) * 4);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_pdr_hdr* hdr = reinterpret_cast<pldm_pdr_hdr*>(pdr.data());
hdr->type = PLDM_PDR_ENTITY_ASSOCIATION;
hdr->length =
htole16(sizeof(pldm_pdr_entity_association) + sizeof(pldm_entity) * 4);
pldm_pdr_entity_association* e =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_pdr_entity_association*>(pdr.data() +
sizeof(pldm_pdr_hdr));
e->container_id = htole16(1);
@@ -1869,12 +1917,14 @@
outData = nullptr;
auto hdl1 = pldm_pdr_find_record(repo, 2, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl1, nullptr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_pdr_hdr* hdr = reinterpret_cast<pldm_pdr_hdr*>(outData);
EXPECT_EQ(hdr->record_handle, 2);
outData = nullptr;
auto hdl2 = pldm_pdr_find_record(repo, 23, &outData, &size, &nextRecHdl);
EXPECT_NE(hdl2, nullptr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_pdr_hdr* hdr1 = reinterpret_cast<pldm_pdr_hdr*>(outData);
EXPECT_EQ(hdr1->record_handle, 23);
diff --git a/tests/dsp/platform.cpp b/tests/dsp/platform.cpp
index 1c89cba..a8a530c 100644
--- a/tests/dsp/platform.cpp
+++ b/tests/dsp/platform.cpp
@@ -21,6 +21,7 @@
std::array<uint8_t,
sizeof(pldm_msg_hdr) + PLDM_SET_STATE_EFFECTER_STATES_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t completionCode = 0;
@@ -35,6 +36,7 @@
std::array<uint8_t,
sizeof(pldm_msg_hdr) + PLDM_SET_STATE_EFFECTER_STATES_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
uint16_t effecterId = 0x0a;
@@ -72,6 +74,7 @@
responseMsg[hdrSize] = PLDM_SUCCESS;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_set_state_effecter_states_resp(
@@ -106,6 +109,7 @@
hdrSize,
&stateField, sizeof(stateField));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = decode_set_state_effecter_states_req(
@@ -136,6 +140,7 @@
std::array<uint8_t, PLDM_SET_STATE_EFFECTER_STATES_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_set_state_effecter_states_resp(response,
@@ -157,6 +162,7 @@
// + size of record data and transfer CRC
std::vector<uint8_t> responseMsg(hdrSize + PLDM_GET_PDR_MIN_RESP_BYTES +
recordData.size() + 1);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_get_pdr_resp(0, PLDM_SUCCESS, nextRecordHndl,
@@ -165,6 +171,7 @@
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_get_pdr_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_pdr_resp*>(response->payload);
EXPECT_EQ(completionCode, resp->completion_code);
@@ -218,8 +225,10 @@
uint16_t retRequestCnt = 0;
uint16_t retRecordChangeNum = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_pdr_req* request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_pdr_req*>(req->payload);
request->record_handle = htole32(recordHndl);
@@ -243,6 +252,7 @@
TEST(GetPDR, testBadDecodeRequest)
{
std::array<uint8_t, PLDM_GET_PDR_REQ_BYTES> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = decode_get_pdr_req(req, requestMsg.size(), NULL, NULL, NULL, NULL,
@@ -260,6 +270,7 @@
uint16_t record_chg_num = 0;
std::vector<uint8_t> requestMsg(hdrSize + PLDM_GET_PDR_REQ_BYTES);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_pdr_req(0, record_hndl, data_transfer_hndl,
@@ -267,6 +278,7 @@
request, PLDM_GET_PDR_REQ_BYTES);
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_get_pdr_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_pdr_req*>(request->payload);
EXPECT_EQ(record_hndl, le32toh(req->record_handle));
EXPECT_EQ(data_transfer_hndl, le32toh(req->data_transfer_handle));
@@ -284,6 +296,7 @@
uint16_t record_chg_num = 0;
std::vector<uint8_t> requestMsg(hdrSize + PLDM_GET_PDR_REQ_BYTES);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_pdr_req(0, record_hndl, data_transfer_hndl,
@@ -319,8 +332,10 @@
uint16_t retRespCnt = 0;
uint8_t retTransferCRC = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_get_pdr_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_pdr_resp*>(response->payload);
resp->completion_code = completionCode;
resp->next_record_handle = htole32(nextRecordHndl);
@@ -366,8 +381,10 @@
uint16_t retRespCnt = 0;
uint8_t retTransferCRC = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_get_pdr_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_pdr_resp*>(response->payload);
resp->completion_code = completionCode;
resp->next_record_handle = htole32(nextRecordHndl);
@@ -476,6 +493,7 @@
std::vector<uint8_t> responseMsg(hdrSize +
PLDM_GET_PDR_REPOSITORY_INFO_RESP_BYTES);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_get_pdr_repository_info_resp(
@@ -485,6 +503,7 @@
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_pdr_repository_info_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_pdr_repository_info_resp*>(
response->payload);
@@ -529,8 +548,10 @@
std::array<uint8_t, hdrSize + PLDM_GET_PDR_REPOSITORY_INFO_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_pdr_repository_info_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_pdr_repository_info_resp*>(
response->payload);
resp->completion_code = completionCode;
@@ -582,8 +603,10 @@
std::array<uint8_t, hdrSize + PLDM_GET_PDR_REPOSITORY_INFO_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_pdr_repository_info_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_pdr_repository_info_resp*>(
response->payload);
resp->completion_code = completionCode;
@@ -715,8 +738,10 @@
uint8_t reteffecter_data_size;
uint8_t reteffecter_value[4];
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_set_numeric_effecter_value_req* request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_numeric_effecter_value_req*>(
req->payload);
@@ -730,6 +755,7 @@
req, requestMsg.size() - hdrSize, &reteffecter_id,
&reteffecter_data_size, reteffecter_value);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
uint32_t value = *(reinterpret_cast<uint32_t*>(reteffecter_value));
EXPECT_EQ(rc, PLDM_SUCCESS);
EXPECT_EQ(reteffecter_id, effecter_id);
@@ -754,8 +780,10 @@
uint8_t reteffecter_data_size;
uint8_t reteffecter_value[4];
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_set_numeric_effecter_value_req* request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_numeric_effecter_value_req*>(
req->payload);
@@ -765,6 +793,7 @@
rc = decode_set_numeric_effecter_value_req(
req, requestMsg.size() - hdrSize - 1, &reteffecter_id,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
&reteffecter_data_size, reinterpret_cast<uint8_t*>(&reteffecter_value));
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
}
@@ -777,15 +806,18 @@
std::vector<uint8_t> requestMsg(
hdrSize + PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES + 1);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_numeric_effecter_value_req(
0, effecter_id, effecter_data_size,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&effecter_value), request,
PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES + 1);
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_set_numeric_effecter_value_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_numeric_effecter_value_req*>(
request->payload);
EXPECT_EQ(effecter_id, req->effecter_id);
@@ -799,6 +831,7 @@
{
std::vector<uint8_t> requestMsg(
hdrSize + PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_numeric_effecter_value_req(
@@ -807,6 +840,7 @@
uint16_t effecter_value;
rc = encode_set_numeric_effecter_value_req(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
0, 0, 6, reinterpret_cast<uint8_t*>(&effecter_value), request,
PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
@@ -824,6 +858,7 @@
memcpy(responseMsg.data() + hdrSize, &completion_code,
sizeof(completion_code));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_set_numeric_effecter_value_resp(
@@ -838,6 +873,7 @@
std::array<uint8_t, PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_set_numeric_effecter_value_resp(response,
@@ -851,6 +887,7 @@
std::array<uint8_t, sizeof(pldm_msg_hdr) +
PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t completionCode = 0;
@@ -875,6 +912,7 @@
sizeof(get_sensor_state_field) * 2>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t completionCode = 0;
uint8_t comp_sensorCnt = 0x2;
@@ -889,6 +927,7 @@
0, PLDM_SUCCESS, comp_sensorCnt, stateField.data(), response);
struct pldm_get_state_sensor_readings_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_state_sensor_readings_resp*>(
response->payload);
@@ -933,8 +972,10 @@
uint8_t retcomp_sensorCnt = 0;
std::array<get_sensor_state_field, 2> retstateField{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_get_state_sensor_readings_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_state_sensor_readings_resp*>(
response->payload);
@@ -967,6 +1008,7 @@
sizeof(get_sensor_state_field) * 2>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_state_sensor_readings_resp(
@@ -986,6 +1028,7 @@
std::array<get_sensor_state_field, 1> retstateField{};
struct pldm_get_state_sensor_readings_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_state_sensor_readings_resp*>(
response->payload);
@@ -1010,11 +1053,13 @@
bitfield8_t sensorRearm;
sensorRearm.byte = 0x03;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_state_sensor_readings_req(0, sensorId, sensorRearm, 0,
request);
struct pldm_get_state_sensor_readings_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_state_sensor_readings_req*>(
request->payload);
@@ -1047,9 +1092,11 @@
bitfield8_t retsensorRearm;
uint8_t retreserved;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_state_sensor_readings_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_state_sensor_readings_req*>(
request->payload);
@@ -1083,9 +1130,11 @@
bitfield8_t retsensorRearm;
uint8_t retreserved;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_state_sensor_readings_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_state_sensor_readings_req*>(
request->payload);
@@ -1105,6 +1154,7 @@
std::array<uint8_t, hdrSize + PLDM_EVENT_MESSAGE_BUFFER_SIZE_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_event_message_buffer_size_req(0, eventBufferSize, request);
@@ -1123,8 +1173,10 @@
uint8_t retCompletionCode;
uint16_t retMaxBufferSize = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_event_message_buffer_size_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_event_message_buffer_size_resp*>(
response->payload);
@@ -1151,8 +1203,10 @@
uint8_t retCompletionCode;
uint16_t retMaxBufferSize = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_event_message_buffer_size_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_event_message_buffer_size_resp*>(
response->payload);
resp->completion_code = completionCode;
@@ -1174,11 +1228,13 @@
std::array<uint8_t, hdrSize + PLDM_EVENT_MESSAGE_SUPPORTED_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_event_message_supported_req(0, formatVersion, request);
struct pldm_event_message_supported_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_event_message_supported_req*>(
request->payload);
@@ -1194,6 +1250,7 @@
std::array<uint8_t, hdrSize + PLDM_EVENT_MESSAGE_SUPPORTED_REQ_BYTES +
sizeof(eventData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_event_message_supported_req(0, formatVersion, request);
@@ -1223,8 +1280,10 @@
bitfield8_t retSynchConfigSupport;
uint8_t retEventClass[eventClassCount] = {0};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_event_message_supported_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_event_message_supported_resp*>(
response->payload);
@@ -1268,8 +1327,10 @@
bitfield8_t retSynchConfigSupport;
uint8_t retEventClass[eventClassCount] = {0};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_event_message_supported_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_event_message_supported_resp*>(
response->payload);
@@ -1307,8 +1368,10 @@
bitfield8_t retSynchConfigSupport;
uint8_t retEventClass[eventClassCount] = {0};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_event_message_supported_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_event_message_supported_resp*>(
response->payload);
resp->completion_code = completionCode;
@@ -1344,6 +1407,7 @@
std::array<uint8_t,
hdrSize + PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_poll_for_platform_event_message_req(
@@ -1386,6 +1450,7 @@
std::array<uint8_t,
hdrSize + PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_poll_for_platform_event_message_req(
@@ -1442,6 +1507,7 @@
};
const uint32_t respMsgLen = 23;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t retCompletionCode;
@@ -1486,6 +1552,7 @@
};
const uint32_t respMsgLen = 4;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t retCompletionCode;
@@ -1512,6 +1579,7 @@
eventId = 0x0000;
responseMsg[5] = 0x00;
responseMsg[6] = 0x00;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
response = reinterpret_cast<pldm_msg*>(responseMsg.data());
rc = decode_poll_for_platform_event_message_resp(
@@ -1558,6 +1626,7 @@
};
// const uint32_t respMsgLen = 23;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_poll_for_platform_event_message_resp(
@@ -1594,6 +1663,7 @@
std::vector<uint8_t> requestMsg{0x1, 0x0, 0x0, 0x1, PLDM_GET_FIRSTPART,
0x44, 0x33, 0x22, 0x11, 0x00,
0x00};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
uint8_t retFormatVersion;
@@ -1622,6 +1692,7 @@
std::vector<uint8_t> requestMsg{0x1, 0x0, 0x0, 0x1, PLDM_GET_NEXTPART,
0x44, 0x33, 0x22, 0x11, 0xff,
0xff};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
uint8_t retFormatVersion;
@@ -1650,6 +1721,7 @@
std::vector<uint8_t> requestMsg{
0x1, 0x0, 0x0, 0x1, PLDM_ACKNOWLEDGEMENT_ONLY, 0x44, 0x33,
0x22, 0x11, 0xff, 0xff};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
uint8_t retFormatVersion;
@@ -1674,6 +1746,7 @@
std::vector<uint8_t> requestMsg{0x1, 0x0, 0x0, 0x1, PLDM_GET_FIRSTPART,
0x44, 0x33, 0x22, 0x11, 0x66,
0x55};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
uint8_t retFormatVersion;
@@ -1778,6 +1851,7 @@
PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_RESP_BYTES + eventDataSize + 4;
std::array<uint8_t, hdrSize + payloadLength> responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_poll_for_platform_event_message_resp(
@@ -1839,6 +1913,7 @@
PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_MIN_RESP_BYTES;
std::array<uint8_t, hdrSize + payloadLength> responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_poll_for_platform_event_message_resp(
@@ -1878,6 +1953,7 @@
PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_MIN_RESP_BYTES;
std::array<uint8_t, hdrSize + payloadLength> responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_poll_for_platform_event_message_resp(
@@ -1925,6 +2001,7 @@
PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_RESP_BYTES +
eventDataSize + 4>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_poll_for_platform_event_message_resp(
@@ -1986,6 +2063,7 @@
PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_RESP_BYTES + eventDataSize + 4;
std::array<uint8_t, hdrSize + payloadLength> responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_poll_for_platform_event_message_resp(
@@ -2014,8 +2092,10 @@
uint8_t retEventClass = 0;
size_t retEventDataOffset = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_platform_event_message_req* request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_platform_event_message_req*>(req->payload);
uint8_t formatVersion = 0x01;
@@ -2047,6 +2127,7 @@
hdrSize + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
PLDM_PLATFORM_EVENT_MESSAGE_STATE_SENSOR_STATE_REQ_BYTES - 1>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto req = reinterpret_cast<pldm_msg*>(requestMsg.data());
uint8_t retFormatVersion;
uint8_t retTid = 0;
@@ -2071,6 +2152,7 @@
hdrSize + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
PLDM_PLATFORM_EVENT_MESSAGE_STATE_SENSOR_STATE_REQ_BYTES - 1>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t completionCode = 0;
uint8_t instanceId = 0x01;
@@ -2101,13 +2183,16 @@
sizeof(eventData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_platform_event_message_req(
0, formatVersion, Tid, eventClass,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&eventData), sizeof(eventData), request,
sizeof(eventData) + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES);
struct pldm_platform_event_message_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_platform_event_message_req*>(
request->payload);
@@ -2131,14 +2216,17 @@
std::array<uint8_t, hdrSize + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
sizeof(eventData)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_platform_event_message_req(
0, formatVersion, Tid, eventClass,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&eventData), sz_eventData, nullptr,
payloadLen);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
rc = encode_platform_event_message_req(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
0, 0, Tid, eventClass, reinterpret_cast<uint8_t*>(&eventData),
sz_eventData, request, payloadLen);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
@@ -2147,6 +2235,7 @@
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
rc = encode_platform_event_message_req(
0, formatVersion, Tid, eventClass,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&eventData), sz_eventData, request, 0);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
}
@@ -2162,8 +2251,10 @@
uint8_t retcompletionCode;
uint8_t retplatformEventStatus;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_platform_event_message_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_platform_event_message_resp*>(
response->payload);
@@ -2187,8 +2278,10 @@
uint8_t completionCode = PLDM_SUCCESS;
uint8_t platformEventStatus = 0x01;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_platform_event_message_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_platform_event_message_resp*>(
response->payload);
resp->completion_code = completionCode;
@@ -2224,6 +2317,7 @@
uint8_t retSensorEventClassType;
size_t sensorOpDataOffset = sizeof(sensorId) + sizeof(sensorEventClassType);
auto rc = decode_sensor_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventData), eventDataArr.size(),
&retSensorId, &retSensorEventClassType, &retSensorOpDataOffset);
EXPECT_EQ(rc, PLDM_SUCCESS);
@@ -2251,6 +2345,7 @@
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
rc = decode_sensor_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventDataArr.data()),
eventDataArr.size() -
PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MAX_DATA_LENGTH,
@@ -2260,18 +2355,21 @@
eventData->sensor_event_class_type = PLDM_SENSOR_OP_STATE;
rc = decode_sensor_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventDataArr.data()), eventDataArr.size(),
&retSensorId, &retSensorEventClassType, &retSensorOpDataOffset);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
eventData->sensor_event_class_type = PLDM_STATE_SENSOR_STATE;
rc = decode_sensor_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventDataArr.data()), eventDataArr.size(),
&retSensorId, &retSensorEventClassType, &retSensorOpDataOffset);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
eventData->sensor_event_class_type = PLDM_NUMERIC_SENSOR_STATE;
rc = decode_sensor_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventDataArr.data()),
eventDataArr.size() + 1, &retSensorId, &retSensorEventClassType,
&retSensorOpDataOffset);
@@ -2296,6 +2394,7 @@
struct pldm_message_poll_event poll_event = {};
auto rc = decode_pldm_message_poll_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size(),
&poll_event);
@@ -2324,10 +2423,12 @@
EXPECT_EQ(rc, -EINVAL);
rc = decode_pldm_message_poll_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size(), NULL);
EXPECT_EQ(rc, -EINVAL);
rc = decode_pldm_message_poll_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size() - 1,
&poll_event);
EXPECT_EQ(rc, -EOVERFLOW);
@@ -2336,6 +2437,7 @@
eventData[1] = 0x00;
eventData[2] = 0x00;
rc = decode_pldm_message_poll_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size(),
&poll_event);
@@ -2345,6 +2447,7 @@
eventData[1] = 0xff;
eventData[2] = 0xff;
rc = decode_pldm_message_poll_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size(),
&poll_event);
@@ -2365,6 +2468,7 @@
poll_event.data_transfer_handle = 0x11223344;
int rc = encode_pldm_message_poll_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
&poll_event, reinterpret_cast<uint8_t*>(eventData.data()),
eventData.size());
@@ -2373,9 +2477,10 @@
struct pldm_msgbuf _buf;
struct pldm_msgbuf* buf = &_buf;
- rc = pldm_msgbuf_init_cc(buf, PLDM_MSG_POLL_EVENT_LENGTH,
- reinterpret_cast<uint8_t*>(eventData.data()),
- eventData.size());
+ rc = pldm_msgbuf_init_cc(
+ buf, PLDM_MSG_POLL_EVENT_LENGTH,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
+ reinterpret_cast<uint8_t*>(eventData.data()), eventData.size());
EXPECT_EQ(rc, PLDM_SUCCESS);
uint8_t retFormatVersion;
@@ -2412,12 +2517,14 @@
poll_event.event_id = 0x0000;
rc = encode_pldm_message_poll_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
&poll_event, reinterpret_cast<uint8_t*>(eventData.data()),
eventData.size());
EXPECT_EQ(rc, -EPROTO);
poll_event.event_id = 0xffff;
rc = encode_pldm_message_poll_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
&poll_event, reinterpret_cast<uint8_t*>(eventData.data()),
eventData.size());
EXPECT_EQ(rc, -EPROTO);
@@ -2438,6 +2545,7 @@
uint8_t retPresentState;
uint8_t retPreviousState;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto rc = decode_sensor_op_data(reinterpret_cast<uint8_t*>(sensorData),
eventDataArr.size(), &retPresentState,
&retPreviousState);
@@ -2457,11 +2565,13 @@
std::array<uint8_t, PLDM_SENSOR_EVENT_SENSOR_OP_STATE_DATA_LENGTH>
sensorData{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
rc = decode_sensor_op_data(reinterpret_cast<uint8_t*>(sensorData.data()),
sensorDataLength + 1, &presentOpState,
&previousOpState);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
rc = decode_sensor_op_data(reinterpret_cast<uint8_t*>(sensorData.data()),
sensorDataLength, nullptr, &previousOpState);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
@@ -2484,6 +2594,7 @@
uint8_t retSensorOffset;
uint8_t retEventState;
uint8_t retPreviousState;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto rc = decode_state_sensor_data(reinterpret_cast<uint8_t*>(sensorData),
eventDataArr.size(), &retSensorOffset,
&retEventState, &retPreviousState);
@@ -2505,11 +2616,13 @@
std::array<uint8_t, PLDM_SENSOR_EVENT_STATE_SENSOR_STATE_DATA_LENGTH>
sensorData{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
rc = decode_state_sensor_data(reinterpret_cast<uint8_t*>(sensorData.data()),
sensorDataLength - 1, &sensorOffset,
&eventState, &previousEventState);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
rc = decode_state_sensor_data(reinterpret_cast<uint8_t*>(sensorData.data()),
sensorDataLength, &sensorOffset, nullptr,
&previousEventState);
@@ -2544,6 +2657,7 @@
uint32_t retPresentReading;
auto rc = decode_numeric_sensor_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(sensorData), sensorDataLength,
&retEventState, &retPreviousEventState, &retSensorDataSize,
&retPresentReading);
@@ -2563,6 +2677,7 @@
sensorData->sensor_data_size = sensorDataSize;
sensorDataLength = PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_16BIT_DATA_LENGTH;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
rc = decode_numeric_sensor_data(reinterpret_cast<uint8_t*>(sensorData),
sensorDataLength, &retEventState,
&retPreviousEventState, &retSensorDataSize,
@@ -2590,6 +2705,7 @@
std::array<uint8_t, PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MAX_DATA_LENGTH>
sensorData{};
rc = decode_numeric_sensor_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(sensorData.data()), sensorDataLength - 1,
&eventState, &previousEventState, &sensorDataSize, &presentReading);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
@@ -2598,12 +2714,14 @@
(struct pldm_sensor_event_numeric_sensor_state*)sensorData.data();
numericSensorData->sensor_data_size = PLDM_SENSOR_DATA_SIZE_UINT8;
rc = decode_numeric_sensor_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(sensorData.data()), sensorDataLength,
&eventState, &previousEventState, &sensorDataSize, &presentReading);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
numericSensorData->sensor_data_size = PLDM_SENSOR_DATA_SIZE_UINT16;
rc = decode_numeric_sensor_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(sensorData.data()), sensorDataLength,
&eventState, &previousEventState, &sensorDataSize, &presentReading);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
@@ -2616,11 +2734,13 @@
uint16_t effecter_id = 0xab01;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_numeric_effecter_value_req(0, effecter_id, request);
struct pldm_get_numeric_effecter_value_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_numeric_effecter_value_req*>(
request->payload);
@@ -2642,8 +2762,10 @@
std::array<uint8_t, hdrSize + PLDM_GET_NUMERIC_EFFECTER_VALUE_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_numeric_effecter_value_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_numeric_effecter_value_req*>(
request->payload);
@@ -2669,8 +2791,10 @@
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_set_numeric_effecter_value_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_numeric_effecter_value_req*>(
request->payload);
@@ -2697,15 +2821,19 @@
std::array<uint8_t,
hdrSize + PLDM_GET_NUMERIC_EFFECTER_VALUE_MIN_RESP_BYTES + 6>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_get_numeric_effecter_value_resp(
0, completionCode, effecter_dataSize, effecter_operState,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&pendingValue),
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&presentValue), response,
responseMsg.size() - hdrSize);
struct pldm_get_numeric_effecter_value_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_numeric_effecter_value_resp*>(
response->payload);
@@ -2728,6 +2856,7 @@
std::array<uint8_t,
hdrSize + PLDM_GET_NUMERIC_EFFECTER_VALUE_MIN_RESP_BYTES + 2>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t pendingValue = 0x01;
@@ -2739,7 +2868,9 @@
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
rc = encode_get_numeric_effecter_value_resp(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
0, PLDM_SUCCESS, 6, 9, reinterpret_cast<uint8_t*>(&pendingValue),
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&presentValue), response,
responseMsg.size() - hdrSize);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
@@ -2749,7 +2880,9 @@
rc = encode_get_numeric_effecter_value_resp(
0, PLDM_SUCCESS, effecter_dataSize, effecter_operState,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&pendingValue),
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&presentValue), response,
responseMsg.size() - hdrSize);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
@@ -2773,8 +2906,10 @@
uint8_t retpendingValue[2];
uint8_t retpresentValue[2];
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_get_numeric_effecter_value_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_numeric_effecter_value_resp*>(
response->payload);
@@ -2798,7 +2933,9 @@
EXPECT_EQ(completionCode, retcompletionCode);
EXPECT_EQ(effecter_dataSize, reteffecter_dataSize);
EXPECT_EQ(effecter_operState, reteffecter_operState);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(pendingValue, *(reinterpret_cast<uint16_t*>(retpendingValue)));
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
EXPECT_EQ(presentValue, *(reinterpret_cast<uint16_t*>(retpresentValue)));
}
@@ -2826,8 +2963,10 @@
uint8_t retpendingValue[2];
uint8_t retpresentValue[2];
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_get_numeric_effecter_value_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_numeric_effecter_value_resp*>(
response->payload);
@@ -2870,11 +3009,13 @@
eventDataArr{};
struct pldm_pdr_repository_chg_event_data* eventData =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_pdr_repository_chg_event_data*>(
eventDataArr.data());
eventData->event_data_format = eventDataFormat;
eventData->number_of_change_records = numberOfChangeRecords;
struct pldm_pdr_repository_change_record_data* changeRecord1 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_pdr_repository_change_record_data*>(
eventData->change_records);
changeRecord1->event_data_operation = eventDataOperation1;
@@ -2882,6 +3023,7 @@
memcpy(changeRecord1->change_entry, &changeRecordArr1[0],
changeRecordArr1.size() * sizeof(uint32_t));
struct pldm_pdr_repository_change_record_data* changeRecord2 =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_pdr_repository_change_record_data*>(
eventData->change_records +
PLDM_PDR_REPOSITORY_CHANGE_RECORD_MIN_LENGTH +
@@ -2895,6 +3037,7 @@
uint8_t retNumberOfChangeRecords{};
size_t retChangeRecordDataOffset{0};
auto rc = decode_pldm_pdr_repository_chg_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const uint8_t*>(eventData), eventDataArr.size(),
&retEventDataFormat, &retNumberOfChangeRecords,
&retChangeRecordDataOffset);
@@ -2903,6 +3046,7 @@
EXPECT_EQ(retNumberOfChangeRecords, numberOfChangeRecords);
const uint8_t* changeRecordData =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const uint8_t*>(changeRecord1);
size_t changeRecordDataSize =
eventDataArr.size() - PLDM_PDR_REPOSITORY_CHG_EVENT_MIN_LENGTH;
@@ -2911,6 +3055,7 @@
size_t retChangeEntryDataOffset;
rc = decode_pldm_pdr_repository_change_record_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const uint8_t*>(changeRecordData),
changeRecordDataSize, &retEventDataOperation, &retNumberOfChangeEntries,
&retChangeEntryDataOffset);
@@ -2925,6 +3070,7 @@
changeRecordDataSize -= sizeof(uint32_t) * retNumberOfChangeEntries -
PLDM_PDR_REPOSITORY_CHANGE_RECORD_MIN_LENGTH;
rc = decode_pldm_pdr_repository_change_record_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const uint8_t*>(changeRecordData),
changeRecordDataSize, &retEventDataOperation, &retNumberOfChangeEntries,
&retChangeEntryDataOffset);
@@ -2948,6 +3094,7 @@
std::array<uint8_t, 2> eventData{};
rc = decode_pldm_pdr_repository_chg_event_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const uint8_t*>(eventData.data()), 0, &eventDataFormat,
&numberOfChangeRecords, &changeRecordDataOffset);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
@@ -2962,6 +3109,7 @@
std::array<uint8_t, 2> changeRecord{};
rc = decode_pldm_pdr_repository_change_record_data(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const uint8_t*>(changeRecord.data()), 0,
&eventDataOperation, &numberOfChangeEntries, &changeEntryDataOffset);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
@@ -2975,11 +3123,13 @@
uint16_t sensorId = 0x1234;
bool8_t rearmEventState = 0x01;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc =
encode_get_sensor_reading_req(0, sensorId, rearmEventState, request);
struct pldm_get_sensor_reading_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_sensor_reading_req*>(request->payload);
EXPECT_EQ(rc, PLDM_SUCCESS);
@@ -3005,9 +3155,11 @@
uint16_t retsensorId;
bool8_t retrearmEventState;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_sensor_reading_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_sensor_reading_req*>(request->payload);
req->sensor_id = htole16(sensorId);
@@ -3037,9 +3189,11 @@
uint16_t retsensorId;
bool8_t retrearmEventState;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_get_sensor_reading_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_sensor_reading_req*>(request->payload);
req->sensor_id = htole16(sensorId);
@@ -3056,6 +3210,7 @@
std::array<uint8_t, hdrSize + PLDM_GET_SENSOR_READING_MIN_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t completionCode = 0;
@@ -3070,10 +3225,12 @@
auto rc = encode_get_sensor_reading_resp(
0, completionCode, sensor_dataSize, sensor_operationalState,
sensor_event_messageEnable, presentState, previousState, eventState,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&presentReading), response,
responseMsg.size() - hdrSize);
struct pldm_get_sensor_reading_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_sensor_reading_resp*>(
response->payload);
@@ -3086,6 +3243,7 @@
EXPECT_EQ(previousState, resp->previous_state);
EXPECT_EQ(eventState, resp->event_state);
EXPECT_EQ(presentReading,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
*(reinterpret_cast<uint8_t*>(&resp->present_reading[0])));
}
@@ -3094,6 +3252,7 @@
std::array<uint8_t, hdrSize + PLDM_GET_SENSOR_READING_MIN_RESP_BYTES + 3>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t presentReading = 0x1;
@@ -3105,6 +3264,7 @@
rc = encode_get_sensor_reading_resp(
0, PLDM_SUCCESS, 6, 1, 1, 1, 1, 1,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&presentReading), response,
responseMsg.size() - hdrSize);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
@@ -3113,6 +3273,7 @@
rc = encode_get_sensor_reading_resp(
0, PLDM_SUCCESS, sensor_dataSize, 1, 1, 1, 1, 1,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&presentReading), response,
responseMsg.size() - hdrSize);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
@@ -3141,8 +3302,10 @@
uint8_t reteventState;
uint8_t retpresentReading[4];
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_get_sensor_reading_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_sensor_reading_resp*>(
response->payload);
@@ -3173,6 +3336,7 @@
EXPECT_EQ(previousState, retpreviousState);
EXPECT_EQ(eventState, reteventState);
EXPECT_EQ(presentReading,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
*(reinterpret_cast<uint32_t*>(retpresentReading)));
}
@@ -3205,8 +3369,10 @@
uint8_t retevent_state;
uint8_t retpresentReading;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
struct pldm_get_sensor_reading_resp* resp =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_sensor_reading_resp*>(
response->payload);
@@ -3223,6 +3389,7 @@
response, responseMsg.size() - hdrSize, &retcompletionCode,
&retsensor_dataSize, &retsensor_operationalState,
&retsensor_event_messageEnable, &retpresent_state, &retprevious_state,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
&retevent_state, reinterpret_cast<uint8_t*>(&retpresentReading));
EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
@@ -3238,6 +3405,7 @@
std::vector<uint8_t> requestMsg(hdrSize +
PLDM_SET_EVENT_RECEIVER_REQ_BYTES);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_event_receiver_req(
@@ -3246,6 +3414,7 @@
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_set_event_receiver_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_event_receiver_req*>(request->payload);
EXPECT_EQ(eventMessageGlobalEnable, req->event_message_global_enable);
EXPECT_EQ(transportProtocolType, req->transport_protocol_type);
@@ -3263,6 +3432,7 @@
std::vector<uint8_t> requestMsg(hdrSize +
PLDM_SET_EVENT_RECEIVER_REQ_BYTES);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_set_event_receiver_req(
@@ -3280,6 +3450,7 @@
uint8_t retcompletion_code = 0;
responseMsg[hdrSize] = PLDM_SUCCESS;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_set_event_receiver_resp(
response, responseMsg.size() - sizeof(pldm_msg_hdr),
@@ -3294,6 +3465,7 @@
std::array<uint8_t, hdrSize + PLDM_SET_EVENT_RECEIVER_RESP_BYTES>
responseMsg{};
uint8_t retcompletion_code = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_set_event_receiver_resp(
@@ -3313,6 +3485,7 @@
std::array<uint8_t,
sizeof(pldm_msg_hdr) + PLDM_SET_EVENT_RECEIVER_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
uint8_t completionCode = 0;
@@ -3340,8 +3513,10 @@
uint8_t eventReceiverAddressInfo = 0x08;
uint16_t heartbeatTimer = 0x78;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_set_event_receiver_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_event_receiver_req*>(request->payload);
req->event_message_global_enable = eventMessageGlobalEnable;
@@ -3380,8 +3555,10 @@
uint8_t eventReceiverAddressInfo = 0x08;
uint16_t heartbeatTimer = 0x78;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
struct pldm_set_event_receiver_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_set_event_receiver_req*>(request->payload);
req->event_message_global_enable = eventMessageGlobalEnable;
@@ -5033,6 +5210,7 @@
constexpr uint16_t effecter_id = 0xab01;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_state_effecter_states_req(
@@ -5092,6 +5270,7 @@
decltype(expectedResponseMsg) responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
std::array<get_effecter_state_field, comp_effecterCnt> stateField{
@@ -5163,6 +5342,7 @@
PLDM_GET_EFFECTER_STATE_FIELD_SIZE * 2>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_state_effecter_states_resp(
@@ -5363,10 +5543,12 @@
size_t cperEventSize =
sizeof(struct pldm_platform_cper_event) + eventDataSize;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto cper_event = reinterpret_cast<struct pldm_platform_cper_event*>(
malloc(cperEventSize));
auto rc = decode_pldm_platform_cper_event(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const void*>(eventData.data()), eventData.size(),
cper_event, cperEventSize);
@@ -5401,6 +5583,7 @@
size_t cperEventSize =
sizeof(struct pldm_platform_cper_event) + eventDataSize;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto cperEvent = reinterpret_cast<struct pldm_platform_cper_event*>(
malloc(cperEventSize));
@@ -5409,28 +5592,34 @@
EXPECT_EQ(rc, -EINVAL);
rc = decode_pldm_platform_cper_event(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const void*>(eventData.data()), eventData.size(), NULL,
cperEventSize);
EXPECT_EQ(rc, -EINVAL);
#ifdef NDEBUG
rc = decode_pldm_platform_cper_event(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size() - 1,
cperEvent, cperEventSize);
EXPECT_EQ(rc, -EOVERFLOW);
#else
- EXPECT_DEATH(decode_pldm_platform_cper_event(
- reinterpret_cast<uint8_t*>(eventData.data()),
- eventData.size() - 1, cperEvent, cperEventSize),
- "ctx->remaining >= 0");
+ EXPECT_DEATH(
+ decode_pldm_platform_cper_event(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
+ reinterpret_cast<uint8_t*>(eventData.data()), eventData.size() - 1,
+ cperEvent, cperEventSize),
+ "ctx->remaining >= 0");
#endif
rc = decode_pldm_platform_cper_event(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size(),
cperEvent, cperEventSize - 1);
EXPECT_EQ(rc, -EOVERFLOW);
rc = decode_pldm_platform_cper_event(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size(),
cperEvent, cperEventSize + 1);
EXPECT_EQ(rc, 0);
@@ -5438,6 +5627,7 @@
// Invalid CPER Event Format Type
eventData[1] = 0x2;
rc = decode_pldm_platform_cper_event(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const void*>(eventData.data()), eventData.size(),
cperEvent, cperEventSize);
@@ -5447,6 +5637,7 @@
eventData[1] = 0x1;
eventData[2] = 3;
rc = decode_pldm_platform_cper_event(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const void*>(eventData.data()), eventData.size(),
cperEvent, cperEventSize);
@@ -5454,6 +5645,7 @@
eventData[2] = 5;
rc = decode_pldm_platform_cper_event(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const void*>(eventData.data()), eventData.size(),
cperEvent, cperEventSize);
diff --git a/tests/oem/ibm/fileio.cpp b/tests/oem/ibm/fileio.cpp
index 1e57f2d..16ef34e 100644
--- a/tests/oem/ibm/fileio.cpp
+++ b/tests/oem/ibm/fileio.cpp
@@ -40,6 +40,7 @@
uint32_t retLength = 0;
uint64_t retAddress = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Invoke decode the read file memory request
@@ -68,6 +69,7 @@
std::array<uint8_t, PLDM_RW_FILE_MEM_REQ_BYTES> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Address is NULL
@@ -87,6 +89,7 @@
responseMsg{};
uint32_t length = 0xff00ee11;
uint32_t lengthLe = htole32(length);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// ReadFileIntoMemory
@@ -121,6 +124,7 @@
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_RW_FILE_MEM_RESP_BYTES>
responseMsg{};
uint32_t length = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// ReadFileIntoMemory
@@ -162,6 +166,7 @@
uint8_t retCompletionCode = 0;
uint32_t retLength = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// Invoke decode the read file memory response
@@ -183,6 +188,7 @@
std::array<uint8_t, PLDM_RW_FILE_MEM_RESP_BYTES> responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// Payload length is invalid
@@ -204,6 +210,7 @@
uint32_t lengthLe = htole32(length);
uint64_t addressLe = htole64(address);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc =
@@ -264,6 +271,7 @@
uint8_t retTransferOpFlag = 0;
uint8_t retTableType = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Invoke decode get file table request
@@ -290,6 +298,7 @@
std::array<uint8_t, PLDM_GET_FILE_TABLE_REQ_BYTES> requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
// TableType is NULL
@@ -317,6 +326,7 @@
sizeof(transferFlag) + fileTable.size();
std::array<uint8_t, sizeof(pldm_msg_hdr) + responseSize> responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// GetFileTable
@@ -353,6 +363,7 @@
sizeof(transferFlag);
std::array<uint8_t, sizeof(pldm_msg_hdr) + responseSize> responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// GetFileTable
@@ -375,12 +386,14 @@
uint8_t transferOpFlag = 0x01;
uint8_t tableType = PLDM_FILE_ATTRIBUTE_TABLE;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_file_table_req(0, transferHandle, transferOpFlag,
tableType, request);
EXPECT_EQ(rc, PLDM_SUCCESS);
struct pldm_get_file_table_req* req =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<struct pldm_get_file_table_req*>(request->payload);
EXPECT_EQ(transferHandle, le32toh(req->transfer_handle));
EXPECT_EQ(transferOpFlag, req->operation_flag);
@@ -409,9 +422,11 @@
std::vector<uint8_t> responseMsg(
hdrSize + PLDM_GET_FILE_TABLE_MIN_RESP_BYTES + fileTableData.size());
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - hdrSize;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto resp = reinterpret_cast<struct pldm_get_file_table_resp*>(
responsePtr->payload);
@@ -450,6 +465,7 @@
std::vector<uint8_t> responseMsg(
hdrSize + PLDM_GET_FILE_TABLE_MIN_RESP_BYTES + fileTableData.size());
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_file_table_resp(
@@ -470,8 +486,10 @@
std::array<uint8_t, PLDM_READ_FILE_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
size_t payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_read_file_req*>(requestPtr->payload);
// Random value for fileHandle, offset and length
@@ -506,8 +524,10 @@
std::vector<uint8_t> requestMsg(PLDM_WRITE_FILE_REQ_BYTES +
sizeof(pldm_msg_hdr) + length);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
size_t payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_write_file_req*>(requestPtr->payload);
size_t fileDataOffset =
@@ -541,9 +561,11 @@
std::vector<uint8_t> responseMsg(PLDM_READ_FILE_RESP_BYTES +
sizeof(pldm_msg_hdr) + length);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
auto response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_read_file_resp*>(responsePtr->payload);
response->completion_code = completionCode;
@@ -570,9 +592,11 @@
{
std::array<uint8_t, PLDM_WRITE_FILE_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
auto response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_write_file_resp*>(responsePtr->payload);
uint8_t completionCode = PLDM_SUCCESS;
@@ -602,6 +626,7 @@
// Bad decode response for read file
std::vector<uint8_t> responseMsg(PLDM_READ_FILE_RESP_BYTES +
sizeof(pldm_msg_hdr) + length);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
// Request payload message is missing
@@ -617,6 +642,7 @@
// Bad decode response for write file
std::array<uint8_t, PLDM_WRITE_FILE_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsgWr{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responseWr = reinterpret_cast<pldm_msg*>(responseMsgWr.data());
// Request payload message is missing
@@ -637,6 +663,7 @@
// Bad decode request for read file
std::array<uint8_t, PLDM_READ_FILE_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Request payload message is missing
@@ -650,6 +677,7 @@
// Bad decode request for write file
size_t fileDataOffset = 0;
std::array<uint8_t, PLDM_WRITE_FILE_REQ_BYTES> requestMsgWr{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestWr = reinterpret_cast<pldm_msg*>(requestMsgWr.data());
// Request payload message is missing
@@ -670,8 +698,10 @@
std::vector<uint8_t> responseMsg(PLDM_READ_FILE_RESP_BYTES +
sizeof(pldm_msg_hdr) + length);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_read_file_resp*>(responsePtr->payload);
// ReadFile
@@ -693,8 +723,10 @@
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_WRITE_FILE_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto response =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_write_file_resp*>(responsePtr->payload);
// WriteFile
@@ -716,7 +748,9 @@
uint32_t fileHandle = 0x12345678;
uint32_t offset = 0x87654321;
uint32_t length = 0x13245768;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_read_file_req*>(requestPtr->payload);
// ReadFile
@@ -740,7 +774,9 @@
std::vector<uint8_t> requestMsg(PLDM_WRITE_FILE_REQ_BYTES +
sizeof(pldm_msg_hdr) + length);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_write_file_req*>(requestPtr->payload);
// WriteFile
@@ -765,6 +801,7 @@
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_READ_FILE_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
// ReadFile check invalid file length
@@ -775,6 +812,7 @@
// Bad encode request for write file
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_WRITE_FILE_REQ_BYTES>
requestMsgWr{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestWr = reinterpret_cast<pldm_msg*>(requestMsgWr.data());
// WriteFile check for invalid file length
@@ -790,6 +828,7 @@
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_READ_FILE_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
// ReadFile
@@ -805,6 +844,7 @@
// Bad encode response for write file
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_WRITE_FILE_RESP_BYTES>
responseMsgWr{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responseWr = reinterpret_cast<pldm_msg*>(responseMsgWr.data());
// WriteFile
@@ -824,8 +864,10 @@
PLDM_RW_FILE_BY_TYPE_MEM_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
size_t payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_read_write_file_by_type_memory_req*>(
requestPtr->payload);
@@ -867,8 +909,10 @@
PLDM_RW_FILE_BY_TYPE_MEM_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_read_write_file_by_type_memory_resp*>(
responsePtr->payload);
@@ -908,6 +952,7 @@
PLDM_RW_FILE_BY_TYPE_MEM_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Address is NULL
@@ -936,6 +981,7 @@
PLDM_RW_FILE_BY_TYPE_MEM_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
// Length is NULL
@@ -966,6 +1012,7 @@
uint32_t lengthLe = htole32(length);
uint64_t addressLe = htole64(address);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_rw_file_by_type_memory_req(
@@ -1004,6 +1051,7 @@
uint32_t lengthLe = htole32(length);
uint8_t completionCode = 0x0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_rw_file_by_type_memory_resp(
@@ -1028,6 +1076,7 @@
sizeof(pldm_msg_hdr) + PLDM_RW_FILE_BY_TYPE_MEM_RESP_BYTES>
responseMsg{};
uint32_t length = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// completion code is PLDM_ERROR
@@ -1069,8 +1118,10 @@
std::array<uint8_t, PLDM_NEW_FILE_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
size_t payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_new_file_req*>(requestPtr->payload);
// Random value for fileHandle and length
@@ -1101,8 +1152,10 @@
std::array<uint8_t, PLDM_NEW_FILE_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_new_file_resp*>(responsePtr->payload);
// Random value for completion code
@@ -1134,6 +1187,7 @@
std::array<uint8_t, PLDM_NEW_FILE_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Payload length is invalid
@@ -1152,6 +1206,7 @@
std::array<uint8_t, PLDM_NEW_FILE_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
// Payload length is invalid
@@ -1171,6 +1226,7 @@
uint32_t fileHandleLe = htole32(fileHandle);
uint32_t lengthLe = htole32(length);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_new_file_req(0, fileType, fileHandle, length, request);
@@ -1195,6 +1251,7 @@
uint8_t completionCode = 0x0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_new_file_resp(0, completionCode, response);
@@ -1212,6 +1269,7 @@
{
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_NEW_FILE_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// completion code is PLDM_ERROR
@@ -1247,8 +1305,10 @@
std::array<uint8_t, PLDM_RW_FILE_BY_TYPE_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
size_t payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_read_write_file_by_type_req*>(
requestPtr->payload);
@@ -1284,8 +1344,10 @@
std::array<uint8_t, PLDM_RW_FILE_BY_TYPE_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_read_write_file_by_type_resp*>(
responsePtr->payload);
@@ -1323,6 +1385,7 @@
std::array<uint8_t, PLDM_RW_FILE_BY_TYPE_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Payload length is invalid
@@ -1343,6 +1406,7 @@
std::array<uint8_t, PLDM_RW_FILE_BY_TYPE_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
// Length is NULL
@@ -1369,6 +1433,7 @@
uint32_t offsetLe = htole32(offset);
uint32_t lengthLe = htole32(length);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_rw_file_by_type_req(0, PLDM_READ_FILE_BY_TYPE, fileType,
@@ -1400,6 +1465,7 @@
uint32_t length = 0x13245768;
uint32_t lengthLe = htole32(length);
uint8_t completionCode = 0x0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_rw_file_by_type_resp(0, PLDM_READ_FILE_BY_TYPE,
@@ -1422,6 +1488,7 @@
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_RW_FILE_BY_TYPE_RESP_BYTES>
responseMsg{};
uint32_t length = 0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// completion code is PLDM_ERROR
@@ -1461,8 +1528,10 @@
std::array<uint8_t, PLDM_FILE_ACK_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
size_t payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_file_ack_req*>(requestPtr->payload);
// Random value for fileHandle
@@ -1493,8 +1562,10 @@
std::array<uint8_t, PLDM_FILE_ACK_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_file_ack_resp*>(responsePtr->payload);
// Random value for completion code
@@ -1526,6 +1597,7 @@
std::array<uint8_t, PLDM_FILE_ACK_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Payload length is invalid
@@ -1545,6 +1617,7 @@
std::array<uint8_t, PLDM_FILE_ACK_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
// Payload length is invalid
@@ -1563,6 +1636,7 @@
uint16_t fileTypeLe = htole16(fileType);
uint32_t fileHandleLe = htole32(fileHandle);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_file_ack_req(0, fileType, fileHandle, fileStatus, request);
@@ -1584,6 +1658,7 @@
uint8_t completionCode = 0x0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_file_ack_resp(0, completionCode, response);
@@ -1601,6 +1676,7 @@
{
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_FILE_ACK_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// completion code is PLDM_ERROR
@@ -1639,6 +1715,7 @@
uint8_t completionCode = 0x0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_file_ack_with_meta_data_resp(0, completionCode, response);
@@ -1657,6 +1734,7 @@
std::array<uint8_t,
sizeof(pldm_msg_hdr) + PLDM_FILE_ACK_WITH_META_DATA_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// completion code is PLDM_ERROR
@@ -1681,8 +1759,10 @@
PLDM_FILE_ACK_WITH_META_DATA_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_file_ack_with_meta_data_resp*>(
responsePtr->payload);
@@ -1713,6 +1793,7 @@
PLDM_FILE_ACK_WITH_META_DATA_RESP_BYTES + sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
// Payload length is invalid
@@ -1741,6 +1822,7 @@
uint32_t fileMetaData3Le = htole32(fileMetaData3);
uint32_t fileMetaData4Le = htole32(fileMetaData4);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_file_ack_with_meta_data_req(
@@ -1802,8 +1884,10 @@
sizeof(pldm_msg_hdr) + PLDM_FILE_ACK_WITH_META_DATA_REQ_BYTES>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
size_t payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto request = reinterpret_cast<pldm_file_ack_with_meta_data_req*>(
requestPtr->payload);
@@ -1866,6 +1950,7 @@
PLDM_FILE_ACK_WITH_META_DATA_REQ_BYTES + sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Payload length is invalid
@@ -1883,6 +1968,7 @@
uint8_t completionCode = 0x0;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = encode_new_file_with_metadata_resp(0, completionCode, response);
@@ -1901,6 +1987,7 @@
std::array<uint8_t, sizeof(pldm_msg_hdr) +
PLDM_NEW_FILE_AVAILABLE_WITH_META_DATA_RESP_BYTES>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* response = reinterpret_cast<pldm_msg*>(responseMsg.data());
// completion code is PLDM_ERROR
@@ -1925,8 +2012,10 @@
sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
size_t payload_length = responseMsg.size() - sizeof(pldm_msg_hdr);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto response = reinterpret_cast<pldm_file_ack_with_meta_data_resp*>(
responsePtr->payload);
@@ -1957,6 +2046,7 @@
sizeof(pldm_msg_hdr)>
responseMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto responsePtr = reinterpret_cast<pldm_msg*>(responseMsg.data());
// Payload length is invalid
@@ -1986,6 +2076,7 @@
uint32_t fileMetaData3Le = htole32(fileMetaData3);
uint32_t fileMetaData4Le = htole32(fileMetaData4);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
pldm_msg* request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_new_file_with_metadata_req(
@@ -2049,9 +2140,11 @@
sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
size_t payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
auto request =
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<pldm_new_file_with_metadata_req*>(requestPtr->payload);
// Random value for fileHandle and length
@@ -2116,6 +2209,7 @@
sizeof(pldm_msg_hdr)>
requestMsg{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Payload length is invalid