From b6d81e71ba0b600b0f90836dbc2609ecf829f3c6 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Sun, 14 Jan 2024 08:59:29 +0000 Subject: [PATCH] windows/serialInterface: Fixed some clang-tidy lints --- src/include/windows/serialInterface.hxx | 2 +- src/windows/serialInterface.cxx | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/include/windows/serialInterface.hxx b/src/include/windows/serialInterface.hxx index 4d1f9c7..135ffb0 100644 --- a/src/include/windows/serialInterface.hxx +++ b/src/include/windows/serialInterface.hxx @@ -13,7 +13,7 @@ struct serialInterface_t private: HANDLE device{INVALID_HANDLE_VALUE}; - void handleDeviceError(const std::string_view operation) noexcept; + void handleDeviceError(std::string_view operation) noexcept; public: serialInterface_t() noexcept = default; diff --git a/src/windows/serialInterface.cxx b/src/windows/serialInterface.cxx index 9b18509..22cba44 100644 --- a/src/windows/serialInterface.cxx +++ b/src/windows/serialInterface.cxx @@ -1,9 +1,15 @@ // SPDX-License-Identifier: BSD-3-Clause -// SPDX-FileCopyrightText: 2023 1BitSquared +// SPDX-FileCopyrightText: 2023a-2024 1BitSquared // SPDX-FileContributor: Written by Rachel Mant +#include +#include +#include +#include +#include #include #include #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(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 packet{};