-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
windows/serialInterface: Fixed some clang-tidy lints
- Loading branch information
Showing
2 changed files
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// SPDX-FileCopyrightText: 2023 1BitSquared <[email protected]> | ||
// SPDX-FileCopyrightText: 2023a-2024 1BitSquared <[email protected]> | ||
// SPDX-FileContributor: Written by Rachel Mant <[email protected]> | ||
#include <cstdint> | ||
#include <cstddef> | ||
#include <array> | ||
#include <string> | ||
#include <string_view> | ||
#include <fmt/format.h> | ||
#include <substrate/console> | ||
#include "windows/serialInterface.hxx" | ||
#include "usbDevice.hxx" | ||
#include "bmp.hxx" | ||
|
||
using substrate::console; | ||
|
@@ -65,6 +71,7 @@ struct hklmRegistryKey_t | |
}() | ||
} { } | ||
|
||
// NOLINTNEXTLINE(modernize-use-equals-default) | ||
~hklmRegistryKey_t() noexcept | ||
{ | ||
// Close the key if we're destructing a valid object that holds a handle to one | ||
|
@@ -75,6 +82,7 @@ struct hklmRegistryKey_t | |
[[nodiscard]] bool valid() const noexcept { return handle != INVALID_HANDLE_VALUE; } | ||
|
||
// Reads the string key `keyName` from the registry | ||
// NOLINTNEXTLINE(readability-convert-member-functions-to-static) | ||
[[nodiscard]] std::string readStringKey(std::string_view keyName) const | ||
{ | ||
DWORD valueLength{0U}; | ||
|
@@ -213,12 +221,14 @@ serialInterface_t::serialInterface_t(const usbDevice_t &usbDevice) : device | |
static_cast<void>(ReadFile(device, serialState.data(), serialState.size(), nullptr, nullptr)); | ||
} | ||
|
||
// NOLINTNEXTLINE(modernize-use-equals-default) | ||
serialInterface_t::~serialInterface_t() noexcept | ||
{ | ||
if (device != INVALID_HANDLE_VALUE) | ||
CloseHandle(device); | ||
} | ||
|
||
// NOLINTNEXTLINE(readability-convert-member-functions-to-static) | ||
void serialInterface_t::handleDeviceError(const std::string_view operation) noexcept | ||
{ | ||
// Get the last error that occured | ||
|
@@ -243,6 +253,7 @@ void serialInterface_t::swap(serialInterface_t &interface) noexcept | |
std::swap(device, interface.device); | ||
} | ||
|
||
// NOLINTNEXTLINE(readability-convert-member-functions-to-static) | ||
void serialInterface_t::writePacket(const std::string_view &packet) const | ||
{ | ||
console.debug("Remote write: "sv, packet); | ||
|
@@ -257,6 +268,7 @@ void serialInterface_t::writePacket(const std::string_view &packet) const | |
} | ||
} | ||
|
||
// NOLINTNEXTLINE(readability-convert-member-functions-to-static) | ||
std::string serialInterface_t::readPacket() const | ||
{ | ||
std::array<char, bmp_t::maxPacketSize + 1U> packet{}; | ||
|