Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueAndi committed Mar 14, 2021
2 parents 968219a + 3f3fab0 commit d7f3c49
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: platformio run --environment esp32doit-devkit-v1-usb

- name: Perform static checks on target esp32doit-devkit-v1-usb
run: platformio check --environment esp32doit-devkit-v1-usb --skip-packages
run: platformio check --environment esp32doit-devkit-v1-usb

- name: Perform static checks on native environment
run: platformio check --environment test
Expand Down
11 changes: 7 additions & 4 deletions lib/Gfx/LampWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ class LampWidget : public Widget
*/
LampWidget& operator=(const LampWidget& widget)
{
m_isOn = widget.m_isOn;
m_colorOff = widget.m_colorOff;
m_colorOn = widget.m_colorOn;
m_width = widget.m_width;
if (&widget != this)
{
m_isOn = widget.m_isOn;
m_colorOff = widget.m_colorOff;
m_colorOn = widget.m_colorOn;
m_width = widget.m_width;
}

return *this;
}
Expand Down
9 changes: 6 additions & 3 deletions lib/Gfx/ProgressBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ class ProgressBar : public Widget
*/
ProgressBar& operator=(const ProgressBar& widget)
{
m_progress = widget.m_progress;
m_color = widget.m_color;
m_algorithm = widget.m_algorithm;
if (&widget != this)
{
m_progress = widget.m_progress;
m_color = widget.m_color;
m_algorithm = widget.m_algorithm;
}

return *this;
}
Expand Down
11 changes: 7 additions & 4 deletions lib/Gfx/Widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,13 @@ class Widget
*/
Widget& operator=(const Widget& widget)
{
m_type = widget.m_type;
m_posX = widget.m_posX;
m_posY = widget.m_posY;
/* m_name is not assigned! */
if (&widget != this)
{
m_type = widget.m_type;
m_posX = widget.m_posX;
m_posY = widget.m_posY;
/* m_name is not assigned! */
}

return *this;
}
Expand Down
15 changes: 9 additions & 6 deletions lib/LinkedList/LinkedList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,16 @@ class DLinkedList
*/
DLinkedList& operator=(const DLinkedList& list)
{
ListElement<T>* listElement = list.m_head;

clear();
while(nullptr != listElement)
if (&list != this)
{
append(listElement->getElement());
listElement = listElement->getNext();
ListElement<T>* listElement = list.m_head;

clear();
while(nullptr != listElement)
{
append(listElement->getElement());
listElement = listElement->getNext();
}
}

return *this;
Expand Down
11 changes: 7 additions & 4 deletions lib/Utilities/SimpleTimer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ class SimpleTimer
*/
SimpleTimer& operator=(const SimpleTimer& sTimer)
{
m_isRunning = sTimer.m_isRunning;
m_isTimeout = sTimer.m_isTimeout;
m_duration = sTimer.m_duration;
m_start = sTimer.m_start;
if (&sTimer != this)
{
m_isRunning = sTimer.m_isRunning;
m_isTimeout = sTimer.m_isTimeout;
m_duration = sTimer.m_duration;
m_start = sTimer.m_start;
}

return *this;
}
Expand Down
6 changes: 5 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ check_patterns =
lib/StateMachine
lib/Utilities
check_flags =
cppcheck: --std=c++11 --inline-suppr --suppress=noExplicitConstructor --suppress=unreadVariable --suppress=unusedFunction
cppcheck: --std=c++11 --inline-suppr --suppress=noExplicitConstructor --suppress=unreadVariable --suppress=unusedFunction --suppress=*:*/libdeps/*
clangtidy: --checks=-*,clang-analyzer-*,performance-*
check_skip_packages = yes
; Check for the compatibility with frameworks and dev/platforms
lib_compat_mode = strict
; Parses ALL C/C++ source files of the project and follows only by nested includes (#include ..., chain…) from the libraries.
Expand All @@ -68,6 +69,7 @@ check_tool = ${esp32_env_data.check_tool}
check_severity = ${esp32_env_data.check_severity}
check_patterns = ${esp32_env_data.check_patterns}
check_flags = ${esp32_env_data.check_flags}
check_skip_packages = ${esp32_env_data.check_skip_packages}
lib_compat_mode = ${esp32_env_data.lib_compat_mode}
lib_ldf_mode = ${esp32_env_data.lib_ldf_mode}
build_flags = ${esp32_env_data.build_flags}
Expand All @@ -93,6 +95,7 @@ check_tool = ${esp32_env_data.check_tool}
check_severity = ${esp32_env_data.check_severity}
check_patterns = ${esp32_env_data.check_patterns}
check_flags = ${esp32_env_data.check_flags}
check_skip_packages = ${esp32_env_data.check_skip_packages}
lib_compat_mode = ${esp32_env_data.lib_compat_mode}
lib_ldf_mode = ${esp32_env_data.lib_ldf_mode}
build_flags = ${esp32_env_data.build_flags}
Expand Down Expand Up @@ -125,3 +128,4 @@ check_tool = ${esp32_env_data.check_tool}
check_severity = ${esp32_env_data.check_severity}
check_patterns = ${esp32_env_data.check_patterns}
check_flags = ${esp32_env_data.check_flags}
check_skip_packages = ${esp32_env_data.check_skip_packages}

0 comments on commit d7f3c49

Please sign in to comment.