neteja cppcheck (44 → 0) i aïllar impls de tercers

This commit is contained in:
2026-05-16 17:53:50 +02:00
parent fe186ad39a
commit e31a3e9182
20 changed files with 151 additions and 196 deletions
+7 -9
View File
@@ -24,7 +24,7 @@ Notifier* Notifier::notifier = nullptr;
// Parte un texto en varias líneas cuando no cabe en max_width píxeles.
// Divide por espacios; si una palabra sola excede el ancho, queda en su propia línea.
static auto wrapToWidth(const std::string& text, int max_width, Text* text_obj, int kerning = 1) -> std::vector<std::string> {
static auto wrapToWidth(const std::string& text, int max_width, const Text* text_obj, int kerning = 1) -> std::vector<std::string> {
if (max_width <= 0 || text_obj->length(text, kerning) <= max_width) {
return {text};
}
@@ -45,11 +45,11 @@ static auto wrapToWidth(const std::string& text, int max_width, Text* text_obj,
word.clear();
};
for (const char c : text) {
if (c == ' ') {
for (const char CH : text) {
if (CH == ' ') {
flush_word();
} else {
word += c;
word += CH;
}
}
flush_word();
@@ -336,8 +336,8 @@ auto Notifier::getVisibleHeight() const -> int {
int bottom = 0;
for (const auto& n : notifications_) {
if (n.state == Status::FINISHED) { continue; }
int n_bottom = static_cast<int>(n.rect.y + n.rect.h) - y_offset_;
if (n_bottom > bottom) { bottom = n_bottom; }
const int N_BOTTOM = static_cast<int>(n.rect.y + n.rect.h) - y_offset_;
bottom = std::max(N_BOTTOM, bottom);
}
return bottom;
}
@@ -346,8 +346,6 @@ auto Notifier::getVisibleHeight() const -> int {
auto Notifier::getCodes() -> std::vector<std::string> {
std::vector<std::string> codes;
codes.reserve(notifications_.size());
for (const auto& notification : notifications_) {
codes.emplace_back(notification.code);
}
std::ranges::transform(notifications_, std::back_inserter(codes), [](const auto& n) { return n.code; });
return codes;
}