mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
[PVS Studio] Fix issues found by PVS Studio
This commit is contained in:
@@ -413,8 +413,8 @@ extern "C" {
|
||||
/* Macro variant to handle the bitname position if it is zero */
|
||||
#define BMP3_GET_BITS_POS_0(reg_data, bitname) (reg_data & (bitname##_MSK))
|
||||
|
||||
#define BMP3_GET_LSB(var) (uint8_t)(var & BMP3_SET_LOW_BYTE)
|
||||
#define BMP3_GET_MSB(var) (uint8_t)((var & BMP3_SET_HIGH_BYTE) >> 8)
|
||||
#define BMP3_GET_LSB(var) (uint8_t)((var) & BMP3_SET_LOW_BYTE)
|
||||
#define BMP3_GET_MSB(var) (uint8_t)(((var) & BMP3_SET_HIGH_BYTE) >> 8)
|
||||
|
||||
/**\name Macros related to size */
|
||||
#define BMP3_LEN_CALIB_DATA UINT8_C(21)
|
||||
|
||||
@@ -101,7 +101,7 @@ constexpr unsigned CEIL_LOG2(unsigned x)
|
||||
# define NR_BITS(NR_STATES) CEIL_LOG2(NR_STATES)
|
||||
|
||||
// Compute a mask given number of bits
|
||||
# define MASK_BITS(x) ((1 << x) - 1)
|
||||
# define MASK_BITS(x) ((1 << (x)) - 1)
|
||||
|
||||
|
||||
#ifdef ESP32
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
struct deviceIndex_t {
|
||||
deviceIndex_t() = default;
|
||||
|
||||
deviceIndex_t(const deviceIndex_t& other)
|
||||
{
|
||||
value = other.value;
|
||||
}
|
||||
|
||||
static deviceIndex_t toDeviceIndex(unsigned other)
|
||||
{
|
||||
deviceIndex_t res;
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
struct npluginID_t {
|
||||
constexpr npluginID_t() = default;
|
||||
|
||||
npluginID_t(const npluginID_t& other)
|
||||
{
|
||||
value = other.value;
|
||||
}
|
||||
|
||||
constexpr explicit npluginID_t(uint8_t id) : value(id) {}
|
||||
|
||||
static npluginID_t toPluginID(unsigned other)
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
struct pluginID_t {
|
||||
pluginID_t() = default;
|
||||
|
||||
pluginID_t(const pluginID_t& other)
|
||||
{
|
||||
value = other.value;
|
||||
}
|
||||
|
||||
constexpr explicit pluginID_t(uint8_t id) : value(id) {}
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ bool validProtocolIndex(protocolIndex_t index);
|
||||
|
||||
|
||||
// bool validControllerIndex(controllerIndex_t index);
|
||||
#define validControllerIndex(C_X) (C_X < CONTROLLER_MAX)
|
||||
#define validControllerIndex(C_X) ((C_X) < CONTROLLER_MAX)
|
||||
|
||||
// Check whether CPlugin is included in build.
|
||||
bool validCPluginID(cpluginID_t cpluginID);
|
||||
|
||||
@@ -48,18 +48,18 @@ bool validDeviceIndex(deviceIndex_t index);
|
||||
// TD-er: Converted simple functions to defines to reduce bin size
|
||||
|
||||
// bool validTaskIndex(taskIndex_t index);
|
||||
#define validTaskIndex(X) (X < TASKS_MAX)
|
||||
#define validTaskIndex(X) ((X) < (TASKS_MAX))
|
||||
|
||||
// bool validPluginID(pluginID_t pluginID);
|
||||
#define validPluginID(P_ID) (P_ID != INVALID_PLUGIN_ID)
|
||||
#define validPluginID(P_ID) ((P_ID) != (INVALID_PLUGIN_ID))
|
||||
|
||||
bool validPluginID_fullcheck(pluginID_t pluginID);
|
||||
|
||||
// bool validUserVarIndex(userVarIndex_t index);
|
||||
#define validUserVarIndex(U_VAR_X) (U_VAR_X < USERVAR_MAX_INDEX)
|
||||
#define validUserVarIndex(U_VAR_X) ((U_VAR_X) < (USERVAR_MAX_INDEX))
|
||||
|
||||
// bool validTaskVarIndex(taskVarIndex_t index);
|
||||
#define validTaskVarIndex(T_VAR_X) (T_VAR_X < VARS_PER_TASK)
|
||||
#define validTaskVarIndex(T_VAR_X) ((T_VAR_X) < (VARS_PER_TASK))
|
||||
|
||||
// Check if plugin is included in build.
|
||||
// N.B. Invalid plugin is also not considered supported.
|
||||
|
||||
@@ -347,7 +347,7 @@ void HSV2RGB(float H, float S, float I, int rgb[3]) {
|
||||
|
||||
int rgbw[4]{};
|
||||
HSV2RGBW(H, S, I, rgbw);
|
||||
memcpy(rgb, rgbw, 3);
|
||||
memcpy(rgb, rgbw, 3 * sizeof(int));
|
||||
/*
|
||||
|
||||
int r, g, b;
|
||||
|
||||
Reference in New Issue
Block a user