clang-format: copy latest and re-format
clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I2dc163b785f76d8712d411772e130136fb0887ce
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/dbus_raw_peci.cpp b/dbus_raw_peci.cpp
index 1016a45..3e95ece 100644
--- a/dbus_raw_peci.cpp
+++ b/dbus_raw_peci.cpp
@@ -40,42 +40,42 @@
ifaceRawPeci->register_method(
"Send", [](const std::string& peciDev,
const std::vector<std::vector<uint8_t>>& rawCmds) {
- peci_SetDevName(const_cast<char*>(peciDev.c_str()));
- // D-Bus will time out after too long, so set a deadline for when to
- // abort the PECI commands (at 25s, it mostly times out, at 24s it
- // doesn't, so use 23s to be safe)
- constexpr int peciTimeout = 23;
- std::chrono::steady_clock::time_point peciDeadline =
- std::chrono::steady_clock::now() +
- std::chrono::duration<int>(peciTimeout);
- std::vector<std::vector<uint8_t>> rawResp;
- rawResp.resize(rawCmds.size());
- for (size_t i = 0; i < rawCmds.size(); i++)
+ peci_SetDevName(const_cast<char*>(peciDev.c_str()));
+ // D-Bus will time out after too long, so set a deadline for when to
+ // abort the PECI commands (at 25s, it mostly times out, at 24s it
+ // doesn't, so use 23s to be safe)
+ constexpr int peciTimeout = 23;
+ std::chrono::steady_clock::time_point peciDeadline =
+ std::chrono::steady_clock::now() +
+ std::chrono::duration<int>(peciTimeout);
+ std::vector<std::vector<uint8_t>> rawResp;
+ rawResp.resize(rawCmds.size());
+ for (size_t i = 0; i < rawCmds.size(); i++)
+ {
+ const std::vector<uint8_t>& rawCmd = rawCmds[i];
+ // If the commands are taking too long, return early to avoid a
+ // D-Bus timeout
+ if (std::chrono::steady_clock::now() > peciDeadline)
{
- const std::vector<uint8_t>& rawCmd = rawCmds[i];
- // If the commands are taking too long, return early to avoid a
- // D-Bus timeout
- if (std::chrono::steady_clock::now() > peciDeadline)
- {
- std::cerr << peciTimeout
- << " second deadline reached. Aborting PECI "
- "commands to avoid a timeout\n";
- break;
- }
-
- if (rawCmd.size() < 3)
- {
- peci_SetDevName(NULL);
- throw std::invalid_argument("Command Length too short");
- }
- rawResp[i].resize(rawCmd[2]);
- peci_raw(rawCmd[0], rawCmd[2], &rawCmd[3], rawCmd[1],
- rawResp[i].data(),
- static_cast<uint32_t>(rawResp[i].size()));
+ std::cerr << peciTimeout
+ << " second deadline reached. Aborting PECI "
+ "commands to avoid a timeout\n";
+ break;
}
- peci_SetDevName(NULL);
- return rawResp;
- });
+
+ if (rawCmd.size() < 3)
+ {
+ peci_SetDevName(NULL);
+ throw std::invalid_argument("Command Length too short");
+ }
+ rawResp[i].resize(rawCmd[2]);
+ peci_raw(rawCmd[0], rawCmd[2], &rawCmd[3], rawCmd[1],
+ rawResp[i].data(),
+ static_cast<uint32_t>(rawResp[i].size()));
+ }
+ peci_SetDevName(NULL);
+ return rawResp;
+ });
ifaceRawPeci->initialize();
io.run();