General tidying, addressing issues found by static analysis tool.

This commit is contained in:
Nav
2021-06-22 23:52:31 +01:00
parent 69cee4d579
commit d365f6348b
151 changed files with 386 additions and 420 deletions

View File

@@ -65,7 +65,7 @@ namespace Bloom::Usb
}
public:
std::size_t getInputReportSize() {
std::size_t getInputReportSize() const {
return this->inputReportSize;
}

View File

@@ -8,7 +8,8 @@
*
* https://github.com/signal11/hidapi
*/
struct hid_device_ {
struct hid_device_
{
// Handle to the actual device.
libusb_device_handle* device_handle;

View File

@@ -1,9 +1,7 @@
#include <libusb-1.0/libusb.h>
#include <chrono>
#include <thread>
#include "Interface.hpp"
#include "src/Logger/Logger.hpp"
#include "src/Exceptions/Exception.hpp"
using namespace Bloom::Usb;

View File

@@ -18,7 +18,7 @@ namespace Bloom::Usb
std::uint16_t productId = 0;
std::uint8_t number = 0;
std::string name = "";
std::string name;
bool initialised = false;
bool claimed = false;
@@ -52,11 +52,11 @@ namespace Bloom::Usb
this->name = name;
}
bool isClaimed() {
bool isClaimed() const {
return this->claimed;
}
bool isInitialised() {
bool isInitialised() const {
return this->initialised;
}

View File

@@ -26,8 +26,6 @@ namespace Bloom::Usb
void close();
public:
void init();
UsbDevice(std::uint16_t vendorId, std::uint16_t productId) {
this->vendorId = vendorId;
this->productId = productId;
@@ -35,6 +33,8 @@ namespace Bloom::Usb
~UsbDevice() = default;
void init();
[[nodiscard]] libusb_device* getLibUsbDevice() const {
return this->libUsbDevice;
}
@@ -43,11 +43,11 @@ namespace Bloom::Usb
this->libUsbDevice = libUsbDevice;
}
std::uint16_t getVendorId() const {
[[nodiscard]] std::uint16_t getVendorId() const {
return this->vendorId;
}
std::uint16_t getProductId() const {
[[nodiscard]] std::uint16_t getProductId() const {
return this->productId;
}