treewide: Cleanup pedantic C++ warnings
Change-Id: I9c770506d78bd30dde1903645d9bfe92bceab44d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/cable.cpp b/cable.cpp
index 464b812..37167c3 100644
--- a/cable.cpp
+++ b/cable.cpp
@@ -33,7 +33,6 @@
{
uint8_t subcommand;
uint8_t ifNameLength;
- uint8_t ifName[0];
} __attribute__((packed));
ipmi_ret_t cableCheck(const uint8_t* reqBuf, uint8_t* replyBuf, size_t* dataLen,
@@ -76,7 +75,7 @@
// Maximum length one can specify, plus null terminator.
char nameBuf[256] = {};
// Copy the string out of the request buffer.
- std::memcpy(&nameBuf[0], request->ifName, request->ifNameLength);
+ std::memcpy(&nameBuf[0], request + 1, request->ifNameLength);
std::string name = nameBuf;
int64_t count;
diff --git a/entity_name.cpp b/entity_name.cpp
index 6cc5b0d..00668cd 100644
--- a/entity_name.cpp
+++ b/entity_name.cpp
@@ -51,7 +51,6 @@
{
uint8_t subcommand;
uint8_t entityNameLength;
- uint8_t entityName[0];
} __attribute__((packed));
ipmi_ret_t getEntityName(const uint8_t* reqBuf, uint8_t* replyBuf,
@@ -90,7 +89,7 @@
auto reply = reinterpret_cast<struct GetEntityNameReply*>(&replyBuf[0]);
reply->subcommand = SysEntityName;
reply->entityNameLength = entityName.length();
- std::memcpy(reply->entityName, entityName.c_str(), entityName.length());
+ std::memcpy(reply + 1, entityName.c_str(), entityName.length());
(*dataLen) = length;
return IPMI_CC_OK;
diff --git a/eth.cpp b/eth.cpp
index 51f303c..127309a 100644
--- a/eth.cpp
+++ b/eth.cpp
@@ -40,8 +40,8 @@
#define MAX_IPMI_BUFFER 64
#endif
-ipmi_ret_t getEthDevice(const uint8_t* reqBuf, uint8_t* replyBuf,
- size_t* dataLen, const HandlerInterface* handler)
+ipmi_ret_t getEthDevice(const uint8_t*, uint8_t* replyBuf, size_t* dataLen,
+ const HandlerInterface* handler)
{
if ((*dataLen) < sizeof(struct EthDeviceRequest))
{
@@ -70,7 +70,7 @@
reply->subcommand = SysGetEthDevice;
reply->channel = std::get<0>(details);
reply->ifNameLength = device.length();
- std::memcpy(reply->ifName, device.c_str(), device.length());
+ std::memcpy(reply + 1, device.c_str(), device.length());
(*dataLen) = sizeof(struct EthDeviceReply) + device.length();
diff --git a/eth.hpp b/eth.hpp
index 4454818..85650dd 100644
--- a/eth.hpp
+++ b/eth.hpp
@@ -18,7 +18,6 @@
uint8_t channel;
// ifNameLength doesn't include the null-terminator.
uint8_t ifNameLength;
- uint8_t ifName[0];
} __attribute__((packed));
// Handle the eth query command.
diff --git a/ipmi.cpp b/ipmi.cpp
index bcd2b4d..64617aa 100644
--- a/ipmi.cpp
+++ b/ipmi.cpp
@@ -38,7 +38,7 @@
namespace ipmi
{
-ipmi_ret_t handleSysCommand(HandlerInterface* handler, ipmi_cmd_t cmd,
+ipmi_ret_t handleSysCommand(HandlerInterface* handler, ipmi_cmd_t,
const uint8_t* reqBuf, uint8_t* replyCmdBuf,
size_t* dataLen)
{
diff --git a/machine_name.cpp b/machine_name.cpp
index 9fcbd10..e50e150 100644
--- a/machine_name.cpp
+++ b/machine_name.cpp
@@ -38,7 +38,6 @@
{
uint8_t subcommand;
uint8_t machineNameLength;
- uint8_t machineName[0];
} __attribute__((packed));
ipmi_ret_t getMachineName(const uint8_t* reqBuf, uint8_t* replyBuf,
diff --git a/pcie_i2c.cpp b/pcie_i2c.cpp
index c587c76..2ccba89 100644
--- a/pcie_i2c.cpp
+++ b/pcie_i2c.cpp
@@ -55,11 +55,10 @@
uint8_t subcommand;
uint8_t i2c_bus_number;
uint8_t pcie_slot_name_len;
- uint8_t pcie_slot_name[0];
} __attribute__((packed));
-ipmi_ret_t pcieSlotCount(const uint8_t* reqBuf, uint8_t* replyBuf,
- size_t* dataLen, HandlerInterface* handler)
+ipmi_ret_t pcieSlotCount(const uint8_t*, uint8_t* replyBuf, size_t* dataLen,
+ HandlerInterface* handler)
{
if ((*dataLen) < sizeof(struct PcieSlotCountRequest))
{
@@ -134,8 +133,7 @@
// Copy the i2c bus number and the pcie slot name to the reply struct.
reply->i2c_bus_number = i2c_bus_number;
reply->pcie_slot_name_len = pcie_slot_name.length();
- std::memcpy(reply->pcie_slot_name, pcie_slot_name.c_str(),
- pcie_slot_name.length());
+ std::memcpy(reply + 1, pcie_slot_name.c_str(), pcie_slot_name.length());
// Return the subcommand and the result.
(*dataLen) = length;