Skip to content

Commit

Permalink
Merge pull request letscontrolit#3042 from TD-er/bugfix/PVS_studio_is…
Browse files Browse the repository at this point in the history
…sues

[Bugfix] PVS Studio issues
  • Loading branch information
TD-er authored May 2, 2020
2 parents 73ff639 + 9016e37 commit 9538a71
Show file tree
Hide file tree
Showing 33 changed files with 148 additions and 119 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ script:
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_IRext_ESP8266_4M2M
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_242_ESP8266_1M_OTA
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_242_ESP8285_1M_OTA
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_263_ESP8266_1M_OTA_Domoticz
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_263_ESP8266_1M_OTA_FHEM_HA
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_263_ESP8285_1M_OTA_Domoticz
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_263_ESP8285_1M_OTA_FHEM_HA
#- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_263_sdk3_ESP8266_1M_OTA_Domoticz
#- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_263_sdk3_ESP8266_1M_OTA_FHEM_HA
#- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_263_sdk3_ESP8285_1M_OTA_Domoticz
#- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_263_sdk3_ESP8285_1M_OTA_FHEM_HA
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_270_ESP8266_1M_OTA_Domoticz
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_270_ESP8266_1M_OTA_FHEM_HA
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_270_ESP8285_1M_OTA_Domoticz
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_270_ESP8285_1M_OTA_FHEM_HA
#- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_270_sdk3_ESP8266_1M_OTA_Domoticz
#- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_270_sdk3_ESP8266_1M_OTA_FHEM_HA
#- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_270_sdk3_ESP8285_1M_OTA_Domoticz
#- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e minimal_core_270_sdk3_ESP8285_1M_OTA_FHEM_HA
#- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e normal_ESP8266_16M
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e normal_ESP8266_1M
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e normal_ESP8266_1M_VCC
Expand Down
2 changes: 2 additions & 0 deletions lib/ccronexpr/ccronexpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#ifndef CCRONEXPR_H
#define CCRONEXPR_H

//-V::795

#if defined(__cplusplus) && !defined(CRON_COMPILE_AS_CXX)
extern "C" {
#endif
Expand Down
2 changes: 1 addition & 1 deletion lib/esp8266-oled-ssd1306/OLEDDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#ifndef DISPLAY_HEIGHT
#define DISPLAY_HEIGHT 64
#endif
#define DISPLAY_BUFFER_SIZE DISPLAY_WIDTH * DISPLAY_HEIGHT / 8
#define DISPLAY_BUFFER_SIZE ((DISPLAY_WIDTH) * (DISPLAY_HEIGHT) / 8)

// Header Values
#define JUMPTABLE_BYTES 4
Expand Down
2 changes: 2 additions & 0 deletions lib/esp8266-oled-ssd1306/OLEDDisplayFonts.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef OLEDDISPLAYFONTS_h
#define OLEDDISPLAYFONTS_h

//-V::569

const char ArialMT_Plain_10[] PROGMEM = {
0x0A, // Width: 10
0x0D, // Height: 13
Expand Down
40 changes: 4 additions & 36 deletions platformio_core_defs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -98,52 +98,20 @@ lib_ignore = ${esp82xx_defaults.lib_ignore}, IRremoteESP8266, Hea

; See for SDK flags: https://github.com/esp8266/Arduino/blob/master/tools/platformio-build.py

;[core_2_6_0]
;platform = https://github.com/Jason2866/platform-espressif8266.git#core_2_6_0
;build_flags = ${esp82xx_2_6_x.build_flags}
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703

;[core_2_6_1]
;platform = https://github.com/Jason2866/platform-espressif8266.git#core_2_6_1
;build_flags = ${esp82xx_2_6_x.build_flags}
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703

;[core_2_6_1_sdk3]
;platform = https://github.com/Jason2866/platform-espressif8266.git#core_2_6_1
;build_flags = ${esp82xx_2_6_x.build_flags}
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3

[core_2_6_2]
extends = esp82xx_2_6_x
platform = [email protected]
platform_packages =
framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#2.6.2
build_flags = ${esp82xx_2_6_x.build_flags}
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703

[core_2_6_2_sdk3]
extends = esp82xx_2_6_x
platform = [email protected]
platform_packages =
framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#2.6.2
build_flags = ${esp82xx_2_6_x.build_flags}
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3


[core_2_6_3]
[core_2_7_0]
extends = esp82xx_2_6_x
platform = [email protected]
platform_packages =
framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#2.6.3
framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#2.7.0
build_flags = ${esp82xx_2_6_x.build_flags}
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703


[core_2_6_3_sdk3]
[core_2_7_0_sdk3]
extends = esp82xx_2_6_x
platform = [email protected]
platform_packages =
framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#2.6.3
framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#2.7.0
build_flags = ${esp82xx_2_6_x.build_flags}
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3

Expand Down
16 changes: 8 additions & 8 deletions platformio_esp82xx_base.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

[regular_platform]
build_unflags =
build_flags = ${core_2_6_3.build_flags}
platform = ${core_2_6_3.platform}
platform_packages = ${core_2_6_3.platform_packages}
lib_ignore = ${core_2_6_3.lib_ignore}
build_flags = ${core_2_7_0.build_flags}
platform = ${core_2_7_0.platform}
platform_packages = ${core_2_7_0.platform_packages}
lib_ignore = ${core_2_7_0.lib_ignore}


[core262_sdk3_platform]
build_unflags =
build_flags = ${core_2_6_3_sdk3.build_flags}
platform = ${core_2_6_3_sdk3.platform}
platform_packages = ${core_2_6_3_sdk3.platform_packages}
lib_ignore = ${core_2_6_3_sdk3.lib_ignore}
build_flags = ${core_2_7_0_sdk3.build_flags}
platform = ${core_2_7_0_sdk3.platform}
platform_packages = ${core_2_7_0_sdk3.platform_packages}
lib_ignore = ${core_2_7_0_sdk3.lib_ignore}


[beta_platform]
Expand Down
65 changes: 38 additions & 27 deletions platformio_esp82xx_envs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ extra_scripts = pre:pre_custom_esp82xx.py

[env:custom_sdk3_ESP8266_4M1M]
extends = esp8266_4M1M
platform = ${core_2_6_3_sdk3.platform}
platform_packages = ${core_2_6_3_sdk3.platform_packages}
build_flags = ${core_2_6_3_sdk3.build_flags}
platform = ${core_2_7_0_sdk3.platform}
platform_packages = ${core_2_7_0_sdk3.platform_packages}
build_flags = ${core_2_7_0_sdk3.build_flags}
${esp8266_4M1M.build_flags}
-DPLUGIN_BUILD_CUSTOM
lib_ignore = ${core_2_6_3_sdk3.lib_ignore}
lib_ignore = ${core_2_7_0_sdk3.lib_ignore}
extra_scripts = pre:pre_custom_esp82xx.py


Expand Down Expand Up @@ -68,6 +68,17 @@ build_flags = ${regular_platform.build_flags}
lib_ignore = ${regular_platform.lib_ignore}
extra_scripts = pre:pre_custom_esp82xx.py

[env:custom_beta_ESP8266_1M]
extends = esp8266_1M
platform = ${beta_platform.platform}
platform_packages = ${beta_platform.platform_packages}
build_flags = ${beta_platform.build_flags}
${esp8266_1M.build_flags}
-DPLUGIN_BUILD_CUSTOM
lib_ignore = ${beta_platform.lib_ignore}
extra_scripts = pre:pre_custom_esp82xx.py




;;; NORMAL (STABLE) ***************************************************
Expand All @@ -85,9 +96,9 @@ build_flags = ${regular_platform.build_flags}

[env:normal_sdk3_ESP8266_1M]
extends = esp8266_1M
platform = ${core_2_6_3_sdk3.platform}
platform_packages = ${core_2_6_3_sdk3.platform_packages}
build_flags = ${core_2_6_3_sdk3.build_flags}
platform = ${core_2_7_0_sdk3.platform}
platform_packages = ${core_2_7_0_sdk3.platform_packages}
build_flags = ${core_2_7_0_sdk3.build_flags}
${esp8266_1M.build_flags}


Expand Down Expand Up @@ -168,68 +179,68 @@ platform = ${core_2_4_2.platform}
build_flags = ${core_2_4_2.build_flags}
${esp8285_1M_OTA.build_flags}

[env:minimal_core_263_ESP8266_1M_OTA_Domoticz]
[env:minimal_core_270_ESP8266_1M_OTA_Domoticz]
extends = esp8266_1M_OTA
platform = ${regular_platform.platform}
platform_packages = ${regular_platform.platform_packages}
build_flags = ${regular_platform.build_flags}
${esp8266_1M_OTA.build_flags}
${minimal_OTA_domoticz.build_flags}

[env:minimal_core_263_ESP8285_1M_OTA_Domoticz]
[env:minimal_core_270_ESP8285_1M_OTA_Domoticz]
extends = esp8285_1M_OTA
platform = ${regular_platform.platform}
platform_packages = ${regular_platform.platform_packages}
build_flags = ${regular_platform.build_flags}
${esp8285_1M_OTA.build_flags}
${minimal_OTA_domoticz.build_flags}

[env:minimal_core_263_sdk3_ESP8266_1M_OTA_Domoticz]
[env:minimal_core_270_sdk3_ESP8266_1M_OTA_Domoticz]
extends = esp8266_1M_OTA
platform = ${core_2_6_3_sdk3.platform}
platform_packages = ${core_2_6_3_sdk3.platform_packages}
build_flags = ${core_2_6_3_sdk3.build_flags}
platform = ${core_2_7_0_sdk3.platform}
platform_packages = ${core_2_7_0_sdk3.platform_packages}
build_flags = ${core_2_7_0_sdk3.build_flags}
${esp8266_1M_OTA.build_flags}
${minimal_OTA_domoticz.build_flags}

[env:minimal_core_263_sdk3_ESP8285_1M_OTA_Domoticz]
[env:minimal_core_270_sdk3_ESP8285_1M_OTA_Domoticz]
extends = esp8285_1M_OTA
platform = ${core_2_6_3_sdk3.platform}
platform_packages = ${core_2_6_3_sdk3.platform_packages}
build_flags = ${core_2_6_3_sdk3.build_flags}
platform = ${core_2_7_0_sdk3.platform}
platform_packages = ${core_2_7_0_sdk3.platform_packages}
build_flags = ${core_2_7_0_sdk3.build_flags}
${esp8285_1M_OTA.build_flags}
${minimal_OTA_domoticz.build_flags}


[env:minimal_core_263_ESP8266_1M_OTA_FHEM_HA]
[env:minimal_core_270_ESP8266_1M_OTA_FHEM_HA]
extends = esp8266_1M_OTA
platform = ${regular_platform.platform}
platform_packages = ${regular_platform.platform_packages}
build_flags = ${regular_platform.build_flags}
${esp8266_1M_OTA.build_flags}
${minimal_OTA_FHEM_HA.build_flags}

[env:minimal_core_263_ESP8285_1M_OTA_FHEM_HA]
[env:minimal_core_270_ESP8285_1M_OTA_FHEM_HA]
extends = esp8285_1M_OTA
platform = ${regular_platform.platform}
platform_packages = ${regular_platform.platform_packages}
build_flags = ${regular_platform.build_flags}
${esp8285_1M_OTA.build_flags}
${minimal_OTA_FHEM_HA.build_flags}

[env:minimal_core_263_sdk3_ESP8266_1M_OTA_FHEM_HA]
[env:minimal_core_270_sdk3_ESP8266_1M_OTA_FHEM_HA]
extends = esp8266_1M_OTA
platform = ${core_2_6_3_sdk3.platform}
platform_packages = ${core_2_6_3_sdk3.platform_packages}
build_flags = ${core_2_6_3_sdk3.build_flags}
platform = ${core_2_7_0_sdk3.platform}
platform_packages = ${core_2_7_0_sdk3.platform_packages}
build_flags = ${core_2_7_0_sdk3.build_flags}
${esp8266_1M_OTA.build_flags}
${minimal_OTA_FHEM_HA.build_flags}

[env:minimal_core_263_sdk3_ESP8285_1M_OTA_FHEM_HA]
[env:minimal_core_270_sdk3_ESP8285_1M_OTA_FHEM_HA]
extends = esp8285_1M_OTA
platform = ${core_2_6_3_sdk3.platform}
platform_packages = ${core_2_6_3_sdk3.platform_packages}
build_flags = ${core_2_6_3_sdk3.build_flags}
platform = ${core_2_7_0_sdk3.platform}
platform_packages = ${core_2_7_0_sdk3.platform_packages}
build_flags = ${core_2_7_0_sdk3.build_flags}
${esp8285_1M_OTA.build_flags}
${minimal_OTA_FHEM_HA.build_flags}

Expand Down
8 changes: 4 additions & 4 deletions pre_custom_esp82xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
"USES_P059", # Encoder
"USES_P081", # Cron
"USES_P082", # GPS
"USES_P085", # AcuDC24x
"USES_P087", # Serial Proxy
"USES_P094", # CUL Reader
"USES_P095", # TFT ILI9341
# "USES_P085", # AcuDC24x
# "USES_P087", # Serial Proxy
# "USES_P094", # CUL Reader
# "USES_P095", # TFT ILI9341

"USES_C016", # Cache Controller
"USES_C018", # TTN/RN2483
Expand Down
4 changes: 2 additions & 2 deletions src/ESPEasyRules.ino
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ void processMatchedRule(String& action, String& event,
if (loglevelActiveFor(LOG_LEVEL_ERROR)) {
log = F("Lev.");
log += String(ifBlock);
log = F(": Error: IF Nesting level exceeded!");
log += F(": Error: IF Nesting level exceeded!");
addLog(LOG_LEVEL_ERROR, log);
}
}
Expand Down Expand Up @@ -889,7 +889,7 @@ bool conditionMatchExtended(String& check) {
condOr = check.indexOf(F(" or "));

if ((condAnd > 0) || (condOr > 0)) { // we got AND/OR
if ((condAnd > 0) && (((condOr < 0) && (condOr < condAnd)) ||
if ((condAnd > 0) && (((condOr < 0) /*&& (condOr < condAnd)*/) ||
((condOr > 0) && (condOr > condAnd)))) { // AND is first
check = check.substring(condAnd + 5);
rightcond = conditionMatch(check);
Expand Down
2 changes: 0 additions & 2 deletions src/Misc.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2648,8 +2648,6 @@ void play_rtttl(uint8_t _pin, const char *p )
else duration = wholenote / default_dur; // we will need to check if we are a dotted note after

// now get the note
note = 0;

switch(*p)
{
case 'c':
Expand Down
4 changes: 2 additions & 2 deletions src/Networking.ino
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void checkUDP()
int len = portUDP.read(&packetBuffer[0], packetSize);

if (len >= 2) {
if (packetBuffer[0] != 255)
if (reinterpret_cast<unsigned char&>(packetBuffer[0]) != 255)
{
packetBuffer[len] = 0;
addLog(LOG_LEVEL_DEBUG, &packetBuffer[0]);
Expand Down Expand Up @@ -450,7 +450,7 @@ void SSDP_schema(WiFiClient& client) {
"</root>\r\n"
"\r\n");

client.printf(ssdp_schema.c_str());
client.printf("%s", ssdp_schema.c_str());
}

/********************************************************************************************\
Expand Down
4 changes: 2 additions & 2 deletions src/Scheduler.ino
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ void setIntervalTimer(unsigned long id, unsigned long lasttimer) {
case TIMER_20MSEC: interval = 20; break;
case TIMER_100MSEC: interval = 100; break;
case TIMER_1SEC: interval = 1000; break;
case TIMER_30SEC: interval = 30000; break;
case TIMER_MQTT: interval = timermqtt_interval; break;
case TIMER_30SEC:
case TIMER_STATISTICS: interval = 30000; break;
case TIMER_MQTT: interval = timermqtt_interval; break;
case TIMER_GRATUITOUS_ARP: interval = timer_gratuitous_arp_interval; break;

// Fall-through for all DelayQueue, which are just the fall-back timers.
Expand Down
2 changes: 2 additions & 0 deletions src/StringConverter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "src/Helpers/StringConverter.h"
#include "src/Helpers/SystemVariables.h"

//-V::569

/********************************************************************************************\
Convert a char string to integer
\*********************************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/WebServer_Rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
typedef struct s_fileinfo
{
String Name;
int Size;
int Size = 0;
bool isDirectory = false;
} fileInfo;

typedef std::function<bool (fileInfo)> HandlerFileInfo;


#endif // WEBSERVER_RULES_H
#endif // WEBSERVER_RULES_H
1 change: 1 addition & 0 deletions src/_C018.ino
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ bool CPlugin_018(CPlugin::Function function, struct EventStruct *event, String&
break;
case ControllerSettingsStruct::CONTROLLER_PORT:
string = F("Port");
break;
default:
success = false;
break;
Expand Down
4 changes: 2 additions & 2 deletions src/_P028_BME280.ino
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ struct P028_sensordata {
switch (sensorID) {
case BMP280_DEVICE_SAMPLE1:
case BMP280_DEVICE_SAMPLE2:
case BMP280_DEVICE: return 0x28; // Tstandby 62.5ms, filter 4, 3-wire SPI Disable
case BMP280_DEVICE:
case BME280_DEVICE: return 0x28; // Tstandby 62.5ms, filter 4, 3-wire SPI Disable
default: return 0;
}
Expand All @@ -138,7 +138,7 @@ struct P028_sensordata {
switch (sensorID) {
case BMP280_DEVICE_SAMPLE1:
case BMP280_DEVICE_SAMPLE2:
case BMP280_DEVICE: return 0x93; // Oversampling: 8x P, 8x T, normal mode
case BMP280_DEVICE:
case BME280_DEVICE: return 0x93; // Oversampling: 8x P, 8x T, normal mode
default: return 0;
}
Expand Down
Loading

0 comments on commit 9538a71

Please sign in to comment.