M module-apps/application-calendar/include/application-calendar/data/CalendarData.hpp => module-apps/application-calendar/include/application-calendar/data/CalendarData.hpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 46,7 46,7 @@ class DayMonthData : public gui::SwitchData
return dateFilter;
};
- virtual void setData(std::string dayMonthText, const TimePoint &dateNumb)
+ virtual void setData(const std::string &dayMonthText, const TimePoint &dateNumb)
{
dayMonth = dayMonthText;
dateFilter = dateNumb;
M module-apps/application-calllog/windows/CallLogDetailsWindow.cpp => module-apps/application-calllog/windows/CallLogDetailsWindow.cpp +3 -3
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "CallLogDetailsWindow.hpp"
@@ 144,13 144,13 @@ namespace gui
{
Expects(numberHBox != nullptr);
numberHBox->erase();
- ActiveIconFactory factory(this->application);
const auto &numberView = record.phoneNumber;
if (record.presentation == PresentationType::PR_UNKNOWN) {
numberHBox->addText(utils::translate(callLogStyle::strings::privateNumber),
style::window::font::mediumbold);
}
else {
+ ActiveIconFactory factory(this->application);
numberHBox->addText(numberView.getFormatted(), style::window::font::mediumbold);
numberHBox->addIcon(factory.makeCallIcon(numberView));
numberHBox->addIcon(factory.makeSMSIcon(numberView));
@@ 211,7 211,7 @@ namespace gui
return;
}
- if (auto switchData = dynamic_cast<calllog::CallLogSwitchData *>(data); data != nullptr) {
+ if (auto switchData = dynamic_cast<calllog::CallLogSwitchData *>(data); switchData != nullptr) {
record = switchData->getRecord();
setTitle(record.name);
initNumberWidget();
M module-apps/application-settings/windows/OptionsWidgetMaker.cpp => module-apps/application-settings/windows/OptionsWidgetMaker.cpp +9 -6
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "OptionsWidgetMaker.hpp"
@@ 10,11 10,14 @@ namespace gui
OptionsWidgetMaker::OptionsWidgetMaker(OptionWindow *window) : mWindow(window)
{}
- void OptionsWidgetMaker::addSwitchOption(
- std::list<gui::Option> &list, const UTF8 &text, bool &option, std::function<void()> callback, bool indent)
+ void OptionsWidgetMaker::addSwitchOption(std::list<gui::Option> &list,
+ const UTF8 &text,
+ bool &option,
+ const std::function<void()> &callback,
+ bool indent)
{
list.emplace_back(std::make_unique<option::OptionSettings>(
- std::move(text),
+ text,
[=](Item &item) {
callback();
return true;
@@ 35,11 38,11 @@ namespace gui
void OptionsWidgetMaker::addSelectOption(std::list<gui::Option> &list,
const UTF8 &text,
- std::function<void(void)> callback,
+ const std::function<void(void)> &callback,
bool indent)
{
list.emplace_back(std::make_unique<option::OptionSettings>(
- std::move(text),
+ text,
[=](Item &item) {
callback();
return true;
M module-apps/application-settings/windows/OptionsWidgetMaker.hpp => module-apps/application-settings/windows/OptionsWidgetMaker.hpp +3 -3
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 24,7 24,7 @@ namespace gui
void addSwitchOption(std::list<gui::Option> &list,
const UTF8 &text,
bool &option,
- std::function<void()> callback,
+ const std::function<void()> &callback,
bool indent = false);
/// Adds select option to the given options list
@@ 34,7 34,7 @@ namespace gui
/// @param indent should the option be indent
void addSelectOption(std::list<gui::Option> &list,
const UTF8 &text,
- std::function<void(void)> callback,
+ const std::function<void(void)> &callback,
bool indent = false);
private:
M module-apps/application-settings/windows/advanced/ColorTestWindow.cpp => module-apps/application-settings/windows/advanced/ColorTestWindow.cpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "ColorTestWindow.hpp"
@@ 76,7 76,7 @@ namespace gui
if (scheme != currentColorScheme) {
currentColorScheme = scheme;
application->bus.sendUnicastSync(
- std::make_shared<service::gui::ChangeColorScheme>(std::move(scheme)), service::name::gui, 100);
+ std::make_shared<service::gui::ChangeColorScheme>(scheme), service::name::gui, 100);
LOG_INFO("Updated color scheme");
application->refreshWindow(RefreshModes::GUI_REFRESH_DEEP);
M module-apps/application-settings/windows/bluetooth/PhoneNameWindow.cpp => module-apps/application-settings/windows/bluetooth/PhoneNameWindow.cpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "PhoneNameWindow.hpp"
@@ 44,7 44,7 @@ namespace gui
void PhoneNameWindow::onBeforeShow(ShowMode /*mode*/, SwitchData *data)
{
- if (const auto newData = dynamic_cast<PhoneNameData *>(data); data != nullptr) {
+ if (const auto newData = dynamic_cast<PhoneNameData *>(data); newData != nullptr) {
inputField->setText(newData->getName());
inputField->setTextLimitType(gui::TextLimitType::MaxSignsCount, maxNameLength);
}
M module-apps/apps-common/notifications/NotificationProvider.cpp => module-apps/apps-common/notifications/NotificationProvider.cpp +1 -1
@@ 114,7 114,7 @@ void NotificationProvider::handleSnooze(unsigned snoozeCount)
notifications[NotificationType::AlarmSnooze] =
std::make_shared<notifications::AlarmSnoozeNotification>(snoozeCount);
}
- else if (snoozeCount == 0) {
+ else {
notifications.erase(NotificationType::AlarmSnooze);
}
send();
M => +1 -1
@@ 24,7 24,7 @@ namespace app::popup
void AlarmPopupContract::AlarmModel::setSnoozed(std::vector<SingleEventRecord> snoozed)
{
this->snoozedRecord = snoozed;
this->snoozedRecord = std::move(snoozed);
}
void AlarmPopupContract::AlarmModel::reset()
M module-apps/apps-common/widgets/ButtonOnOff.cpp => module-apps/apps-common/widgets/ButtonOnOff.cpp +1 -1
@@ 38,7 38,7 @@ namespace gui
setColor(ColorFullWhite);
setText(utils::translate("app_settings_toggle_on"));
}
- else if (currentState == ButtonState::Off) {
+ else {
fill->setFillColor(ColorFullWhite);
setColor(ColorFullBlack);
setText(utils::translate("app_settings_toggle_off"));
M module-audio/Audio/equalizer/Equalizer.cpp => module-audio/Audio/equalizer/Equalizer.cpp +3 -0
@@ 21,6 21,9 @@ namespace audio::equalizer
if ((Q < qMinValue || Q > qMaxValue) && filter != FilterType::None) {
throw std::invalid_argument("Q out of range");
}
+ if (samplerate == 0 && filter != FilterType::None) {
+ throw std::invalid_argument("Sample rate has to be greater than zero");
+ }
QFilterCoefficients filter_coeff;
float a0 = 0;
float omega = 2 * M_PI * frequency / samplerate;
M module-audio/Audio/test/unittest_equalizer.cpp => module-audio/Audio/test/unittest_equalizer.cpp +8 -0
@@ 152,4 152,12 @@ SCENARIO("Calculate filter coeff")
std::invalid_argument);
}
}
+
+ GIVEN("Filter with sample rate equal to 0")
+ {
+ THEN("Calculation of coefficients should throw")
+ {
+ REQUIRE_THROWS_AS(qfilter_CalculateCoeffs(FilterType::HighPass, 300.9f, 0, 0.2f, 0), std::invalid_argument);
+ }
+ }
}
M module-bluetooth/Bluetooth/Device.cpp => module-bluetooth/Bluetooth/Device.cpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "Device.hpp"
@@ 42,7 42,7 @@ Devicei::Devicei(const Devicei &d) : Devicei(d.name.data())
operator=(d);
}
-Devicei &Devicei::operator=(Devicei &&d) noexcept
+Devicei &Devicei::operator=(Devicei &&d)
{
setAddress(&d.address);
setName(d.name.data());
M module-bluetooth/Bluetooth/Device.hpp => module-bluetooth/Bluetooth/Device.hpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 112,7 112,7 @@ struct Devicei : public Device
explicit Devicei(bd_addr_t &address);
Devicei &operator=(const Devicei &d);
Devicei(const Devicei &d);
- Devicei &operator=(Devicei &&d) noexcept;
+ Devicei &operator=(Devicei &&d);
Devicei(Devicei &&d) noexcept;
~Devicei() override = default;
void setAddress(bd_addr_t *addr);
M module-cellular/modem/ATStream.cpp => module-cellular/modem/ATStream.cpp +10 -8
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <cstring>
#include "ATStream.hpp"
@@ 75,7 75,7 @@ namespace at
result.errorCode = atmp_ec.value();
}
else {
- LOG_ERROR("Unknow CMS error code %" PRIu32, errcode);
+ LOG_ERROR("Unknown CMS error code %" PRIu32, errcode);
result.errorCode = at::NetworkErrorCode::Unknown;
}
}
@@ 83,10 83,11 @@ namespace at
bool ATStream::checkATBegin()
{
- auto pos = atBuffer.find(at::delimiter, std::strlen(at::delimiter));
+ const auto delimiterLength = std::strlen(at::delimiter);
+ auto pos = atBuffer.find(at::delimiter, delimiterLength);
if (pos != std::string::npos) {
beginChecked = true;
- std::string rr = atBuffer.substr(std::strlen(at::delimiter), pos - std::strlen(at::delimiter)).c_str();
+ std::string rr = atBuffer.substr(delimiterLength, pos - delimiterLength);
auto code = parseState(rr, errcode);
if (code != Result::Code::NONE) {
result.code = code;
@@ 99,11 100,11 @@ namespace at
bool ATStream::checkATEnd()
{
auto pos = atBuffer.rfind(at::delimiter);
+ const auto delimiterLength = std::strlen(at::delimiter);
if (pos != std::string::npos) {
- auto pos2 = atBuffer.rfind(at::delimiter, pos - std::strlen(at::delimiter));
+ auto pos2 = atBuffer.rfind(at::delimiter, pos - delimiterLength);
if (pos2 != std::string::npos) {
- std::string rr =
- atBuffer.substr(pos2 + std::strlen(at::delimiter), pos - pos2 - std::strlen(at::delimiter)).c_str();
+ std::string rr = atBuffer.substr(pos2 + delimiterLength, pos - pos2 - delimiterLength);
auto code = parseState(rr, errcode);
if (code != Result::Code::NONE) {
result.code = code;
@@ 119,12 120,13 @@ namespace at
{
if (rxCount != 0) {
auto pos = atBuffer.find(at::delimiter, lastPos);
+ const auto delimiterLength = std::strlen(at::delimiter);
while (pos != std::string::npos) {
/// do not count empty lines, see implementation of utils:split
if ((lastPos) != pos) {
lineCounter++;
}
- lastPos = pos + std::strlen(at::delimiter);
+ lastPos = pos + delimiterLength;
pos = atBuffer.find(at::delimiter, lastPos);
}
}
M module-gui/gui/widgets/BoxLayoutSizeStore.cpp => module-gui/gui/widgets/BoxLayoutSizeStore.cpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "BoxLayoutSizeStore.hpp"
@@ 16,8 16,8 @@ namespace gui
Size BoxLayoutSizeStore::get(Item *it)
{
- Size size = {0, 0};
if (it == nullptr) {
+ Size size = {0, 0};
return size;
}
auto found = grants.find(it);
M module-gui/gui/widgets/text/core/TextDocument.cpp => module-gui/gui/widgets/text/core/TextDocument.cpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "TextDocument.hpp"
@@ 10,7 10,7 @@ namespace gui
const std::string TextDocument::newline = "\n";
- TextDocument::TextDocument(const std::list<TextBlock> &blocks) : blocks(std::move(blocks))
+ TextDocument::TextDocument(const std::list<TextBlock> &blocks) : blocks(blocks)
{}
TextDocument::~TextDocument()
M module-gui/gui/widgets/text/core/cursors/TextBlockCursor.cpp => module-gui/gui/widgets/text/core/cursors/TextBlockCursor.cpp +4 -1
@@ 5,6 5,7 @@
#include <core/TextBlock.hpp>
#include <core/TextDocument.hpp>
#include <log/log.hpp>
+#include <cassert>
static const int last_char_inclusive = 0; // if then -1 / else 0
@@ 367,11 368,13 @@ namespace gui
auto BlockCursor::begin() -> std::list<TextBlock>::iterator
{
- return document == nullptr ? document->blocks.end() : document->blocks.begin();
+ assert(document != nullptr);
+ return document->blocks.begin();
}
auto BlockCursor::end() -> std::list<TextBlock>::iterator
{
+ assert(document != nullptr);
return document->blocks.end();
}
M module-gui/gui/widgets/text/parsers/RichTextParser.cpp => module-gui/gui/widgets/text/parsers/RichTextParser.cpp +2 -3
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "RichTextParser.hpp"
@@ 382,12 382,11 @@ struct walker : pugi::xml_tree_walker
auto push_short_text_node(pugi::xml_node &node)
{
log_parser("shortened text node name: %s", node.name());
- auto local_style = style_stack.back();
auto &decor = text::NodeDecor::get();
-
auto attrName = text::ShortTextNodes::get(node.name(), text::ShortTextNodes::AttributeContent::Name);
auto attrValue = text::ShortTextNodes::get(node.name(), text::ShortTextNodes::AttributeContent::Value);
if (attrName.has_value() && attrValue.has_value()) {
+ auto local_style = style_stack.back();
decor.stack_visit(local_style, attrName.value(), attrValue.value());
style_stack.push_back(local_style);
log_parser("Attr loaded: %s", style_stack.back().str().c_str());
M module-vfs/drivers/src/purefs/fs/filesystem_vfat.cpp => module-vfs/drivers/src/purefs/fs/filesystem_vfat.cpp +5 -3
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <purefs/fs/drivers/filesystem_vfat.hpp>
@@ 557,7 557,8 @@ namespace purefs::fs::drivers
return -ENXIO;
}
const auto fspath = vmnt->native_path(path);
- const auto fret = f_chmod(fspath.c_str(), translate_mode_to_attrib(mode), translate_mode_to_attrib(mode));
+ const auto attrib = translate_mode_to_attrib(mode);
+ const auto fret = f_chmod(fspath.c_str(), attrib, attrib);
return translate_error(fret);
}
@@ 569,7 570,8 @@ namespace purefs::fs::drivers
return -EBADF;
}
const auto fspath = vfile->open_path();
- const auto fret = f_chmod(fspath.c_str(), translate_mode_to_attrib(mode), translate_mode_to_attrib(mode));
+ const auto attrib = translate_mode_to_attrib(mode);
+ const auto fret = f_chmod(fspath.c_str(), attrib, attrib);
return translate_error(fret);
}
M products/BellHybrid/BellHybridMain.cpp => products/BellHybrid/BellHybridMain.cpp +1 -1
@@ 74,7 74,7 @@ int main()
std::vector<std::unique_ptr<sys::BaseServiceCreator>> systemServices;
systemServices.emplace_back(sys::CreatorFor<EventManager>([]() { return dumpLogs(); }));
- systemServices.emplace_back(sys::CreatorFor<service::ServiceFileIndexer>(std::move(fileIndexerAudioPaths)));
+ systemServices.emplace_back(sys::CreatorFor<service::ServiceFileIndexer>(fileIndexerAudioPaths));
systemServices.emplace_back(sys::CreatorFor<ServiceDB>());
systemServices.emplace_back(sys::CreatorFor<service::Audio>());
systemServices.emplace_back(sys::CreatorFor<ServiceDesktop>());
M => +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 27,7 27,7 @@ namespace gui::option
std::function<bool(Item &)> activatedCallback,
std::function<bool(Item &)> focusChangedCallback,
AppWindow *app)
: text(std::move(text)), activatedCallback(std::move(activatedCallback)),
: text(text), activatedCallback(std::move(activatedCallback)),
focusChangedCallback(std::move(focusChangedCallback)), app(app)
{}
[[nodiscard]] auto build() const -> ListItem * override;
M products/BellHybrid/apps/common/src/AudioModel.cpp => products/BellHybrid/apps/common/src/AudioModel.cpp +3 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "models/AudioModel.hpp"
@@ 78,10 78,11 @@ namespace app
auto task = app::AsyncRequest::createFromMessage(std::move(msg), service::audioServiceName);
auto cb = [_callback = callback, this](auto response) {
auto result = dynamic_cast<service::AudioStartPlaybackResponse *>(response);
- lastPlayedToken = result->token;
if (result == nullptr) {
return false;
}
+ lastPlayedToken = result->token;
+
if (_callback) {
_callback(result->retCode);
}
M products/BellHybrid/services/audio/ServiceAudio.cpp => products/BellHybrid/services/audio/ServiceAudio.cpp +1 -1
@@ 246,7 246,7 @@ namespace service
const auto clampedValue = std::clamp(utils::getNumericValue<audio::Volume>(value), minVolume, maxInVolume);
if (const auto activeInput = audioMux.GetActiveInput(); activeInput) {
- if (activeInput) {
+ if (activeInput.value()) {
retCode = activeInput.value()->audio->SetOutputVolume(clampedValue);
}
}