From 429b5363dc8bbcef579d20bcae2021d83a1f26a6 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Wed, 23 Oct 2024 21:01:50 +0200 Subject: [PATCH 1/5] fix: get rid of `-Wsign-compare` warnings --- mocks/include/mocks/Helix.hpp | 2 +- src/common/ProviderId.hpp | 4 +- src/common/SignalVector.hpp | 10 +++-- src/common/SignalVectorModel.hpp | 38 +++++++++++-------- .../completion/sources/UnifiedSource.cpp | 8 ++-- src/messages/LimitedQueue.hpp | 4 +- src/messages/MessageBuilder.cpp | 2 +- .../layouts/MessageLayoutContainer.cpp | 3 +- src/messages/layouts/MessageLayoutElement.cpp | 2 +- src/providers/twitch/IrcMessageHandler.cpp | 2 +- src/providers/twitch/api/Helix.cpp | 6 +-- src/providers/twitch/api/Helix.hpp | 8 ++-- src/widgets/TooltipWidget.cpp | 4 +- src/widgets/dialogs/EditHotkeyDialog.cpp | 6 +-- src/widgets/dialogs/UserInfoPopup.cpp | 15 +++++--- src/widgets/helper/ChannelView.cpp | 16 ++++---- src/widgets/helper/SearchPopup.cpp | 3 +- src/widgets/listview/GenericListModel.cpp | 2 +- src/widgets/splits/SplitHeader.cpp | 2 +- 19 files changed, 75 insertions(+), 62 deletions(-) diff --git a/mocks/include/mocks/Helix.hpp b/mocks/include/mocks/Helix.hpp index 5156de55750..cfb2d71b6fe 100644 --- a/mocks/include/mocks/Helix.hpp +++ b/mocks/include/mocks/Helix.hpp @@ -350,7 +350,7 @@ class Helix : public IHelix // contains a comma MOCK_METHOD( void, getChatters, - (QString broadcasterID, QString moderatorID, int maxChattersToFetch, + (QString broadcasterID, QString moderatorID, size_t maxChattersToFetch, ResultCallback successCallback, (FailureCallback failureCallback)), (override)); // getChatters diff --git a/src/common/ProviderId.hpp b/src/common/ProviderId.hpp index 18ccf880388..ccf997476da 100644 --- a/src/common/ProviderId.hpp +++ b/src/common/ProviderId.hpp @@ -2,6 +2,8 @@ namespace chatterino { -enum class ProviderId { Twitch, Irc }; +enum class ProviderId { // NOLINT(performance-enum-size) + Twitch, +}; // } // namespace chatterino diff --git a/src/common/SignalVector.hpp b/src/common/SignalVector.hpp index e01ebd5aa4f..47d536cbe16 100644 --- a/src/common/SignalVector.hpp +++ b/src/common/SignalVector.hpp @@ -87,7 +87,8 @@ class SignalVector } else { - assert(index >= 0 && index <= this->items_.size()); + assert(index >= 0 && + index <= static_cast(this->items_.size())); } this->items_.insert(this->items_.begin() + index, item); @@ -116,7 +117,7 @@ class SignalVector void removeAt(int index, void *caller = nullptr) { assertInGuiThread(); - assert(index >= 0 && index < int(this->items_.size())); + assert(index >= 0 && index < static_cast(this->items_.size())); T item = this->items_[index]; this->items_.erase(this->items_.begin() + index); @@ -132,13 +133,14 @@ class SignalVector { assertInGuiThread(); - for (int index = 0; index < this->items_.size(); ++index) + for (size_t index = 0; index < this->items_.size(); ++index) { T item = this->items_[index]; if (matcher(item)) { this->items_.erase(this->items_.begin() + index); - SignalVectorItemEvent args{item, index, caller}; + SignalVectorItemEvent args{item, static_cast(index), + caller}; this->itemRemoved.invoke(args); this->itemsChanged_(); return true; diff --git a/src/common/SignalVectorModel.hpp b/src/common/SignalVectorModel.hpp index 620ca452d0c..f7983288b16 100644 --- a/src/common/SignalVectorModel.hpp +++ b/src/common/SignalVectorModel.hpp @@ -43,7 +43,7 @@ class SignalVectorModel : public QAbstractTableModel, } // get row index int index = this->getModelIndexFromVectorIndex(args.index); - assert(index >= 0 && index <= this->rows_.size()); + assert(index >= 0 && index <= static_cast(this->rows_.size())); // get row items std::vector row = this->createRow(); @@ -75,7 +75,7 @@ class SignalVectorModel : public QAbstractTableModel, } int row = this->getModelIndexFromVectorIndex(args.index); - assert(row >= 0 && row <= this->rows_.size()); + assert(row >= 0 && row <= static_cast(this->rows_.size())); // remove row std::vector items = this->rows_[row].items; @@ -130,7 +130,8 @@ class SignalVectorModel : public QAbstractTableModel, { int row = index.row(); int column = index.column(); - if (row < 0 || column < 0 || row >= this->rows_.size() || + if (row < 0 || column < 0 || + row >= static_cast(this->rows_.size()) || column >= this->columnCount_) { return QVariant(); @@ -144,7 +145,8 @@ class SignalVectorModel : public QAbstractTableModel, { int row = index.row(); int column = index.column(); - if (row < 0 || column < 0 || row >= this->rows_.size() || + if (row < 0 || column < 0 || + row >= static_cast(this->rows_.size()) || column >= this->columnCount_) { return false; @@ -152,7 +154,7 @@ class SignalVectorModel : public QAbstractTableModel, Row &rowItem = this->rows_[row]; - assert(this->columnCount_ == rowItem.items.size()); + assert(this->columnCount_ == static_cast(rowItem.items.size())); auto &cell = rowItem.items[column]; @@ -167,7 +169,7 @@ class SignalVectorModel : public QAbstractTableModel, int vecRow = this->getVectorIndexFromModelIndex(row); // TODO: This is only a safety-thing for when we modify data that's being modified right now. // It should not be necessary, but it would require some rethinking about this surrounding logic - if (vecRow >= this->vector_->readOnly()->size()) + if (vecRow >= static_cast(this->vector_->readOnly()->size())) { return false; } @@ -224,18 +226,19 @@ class SignalVectorModel : public QAbstractTableModel, { int row = index.row(), column = index.column(); - if (row < 0 || column < 0 || row >= this->rows_.size() || + if (row < 0 || column < 0 || + row >= static_cast(this->rows_.size()) || column >= this->columnCount_) { return Qt::NoItemFlags; } - assert(row >= 0 && row < this->rows_.size() && column >= 0 && - column < this->columnCount_); + assert(row >= 0 && row < static_cast(this->rows_.size()) && + column >= 0 && column < this->columnCount_); const auto &rowItem = this->rows_[row]; - assert(this->columnCount_ == rowItem.items.size()); + assert(this->columnCount_ == static_cast(rowItem.items.size())); return rowItem.items[column]->flags(); } @@ -267,7 +270,8 @@ class SignalVectorModel : public QAbstractTableModel, return false; } - assert(sourceRow >= 0 && sourceRow < this->rows_.size()); + assert(sourceRow >= 0 && + sourceRow < static_cast(this->rows_.size())); int signalVectorRow = this->getVectorIndexFromModelIndex(sourceRow); this->beginMoveRows(sourceParent, sourceRow, sourceRow, @@ -294,7 +298,7 @@ class SignalVectorModel : public QAbstractTableModel, return false; } - assert(row >= 0 && row < this->rows_.size()); + assert(row >= 0 && row < static_cast(this->rows_.size())); int signalVectorRow = this->getVectorIndexFromModelIndex(row); this->vector_->removeAt(signalVectorRow); @@ -337,8 +341,10 @@ class SignalVectorModel : public QAbstractTableModel, int from = data->data("chatterino_row_id").toInt(); int to = parent.row(); - int vectorFrom = this->getVectorIndexFromModelIndex(from); - int vectorTo = this->getVectorIndexFromModelIndex(to); + auto vectorFrom = + static_cast(this->getVectorIndexFromModelIndex(from)); + auto vectorTo = + static_cast(this->getVectorIndexFromModelIndex(to)); if (vectorFrom < 0 || vectorFrom > this->vector_->raw().size() || vectorTo < 0 || vectorTo > this->vector_->raw().size()) @@ -402,7 +408,7 @@ class SignalVectorModel : public QAbstractTableModel, void insertCustomRow(std::vector row, int index) { - assert(index >= 0 && index <= this->rows_.size()); + assert(index >= 0 && index <= static_cast(this->rows_.size())); this->beginInsertRows(QModelIndex(), index, index); this->rows_.insert(this->rows_.begin() + index, @@ -412,7 +418,7 @@ class SignalVectorModel : public QAbstractTableModel, void removeCustomRow(int index) { - assert(index >= 0 && index <= this->rows_.size()); + assert(index >= 0 && index <= static_cast(this->rows_.size())); assert(this->rows_[index].isCustomRow); this->beginRemoveRows(QModelIndex(), index, index); diff --git a/src/controllers/completion/sources/UnifiedSource.cpp b/src/controllers/completion/sources/UnifiedSource.cpp index a0f462ace74..6d8dfe15dc4 100644 --- a/src/controllers/completion/sources/UnifiedSource.cpp +++ b/src/controllers/completion/sources/UnifiedSource.cpp @@ -37,7 +37,7 @@ void UnifiedSource::addToListModel(GenericListModel &model, source->addToListModel(model, maxCount - used); // Calculate how many items have been added so far used = model.rowCount() - startingSize; - if (used >= maxCount) + if (used >= static_cast(maxCount)) { // Used up all of limit break; @@ -58,15 +58,15 @@ void UnifiedSource::addToStringList(QStringList &list, size_t maxCount, } // Make sure to only add maxCount elements in total. - int startingSize = list.size(); - int used = 0; + auto startingSize = list.size(); + QStringList::size_type used = 0; for (const auto &source : this->sources_) { source->addToStringList(list, maxCount - used, isFirstWord); // Calculate how many items have been added so far used = list.size() - startingSize; - if (used >= maxCount) + if (used >= static_cast(maxCount)) { // Used up all of limit break; diff --git a/src/messages/LimitedQueue.hpp b/src/messages/LimitedQueue.hpp index e06e5a0f2b4..a204c84a931 100644 --- a/src/messages/LimitedQueue.hpp +++ b/src/messages/LimitedQueue.hpp @@ -196,12 +196,12 @@ class LimitedQueue std::unique_lock lock(this->mutex_); Equals eq; - for (int i = 0; i < this->buffer_.size(); ++i) + for (size_t i = 0; i < this->buffer_.size(); ++i) { if (eq(this->buffer_[i], needle)) { this->buffer_[i] = replacement; - return i; + return static_cast(i); } } return -1; diff --git a/src/messages/MessageBuilder.cpp b/src/messages/MessageBuilder.cpp index 601ba8ec935..cee5a7c87bd 100644 --- a/src/messages/MessageBuilder.cpp +++ b/src/messages/MessageBuilder.cpp @@ -116,7 +116,7 @@ QString formatUpdatedEmoteList(const QString &platform, text += QString(" %1 %2 emotes ").arg(emoteNames.size()).arg(platform); } - auto i = 0; + size_t i = 0; for (const auto &emoteName : emoteNames) { i++; diff --git a/src/messages/layouts/MessageLayoutContainer.cpp b/src/messages/layouts/MessageLayoutContainer.cpp index 0e84d325201..dbf04fb7735 100644 --- a/src/messages/layouts/MessageLayoutContainer.cpp +++ b/src/messages/layouts/MessageLayoutContainer.cpp @@ -212,7 +212,8 @@ void MessageLayoutContainer::breakLine() this->lineStart_ = this->elements_.size(); // this->currentX = (int)(this->scale * 8); - if (this->canCollapse() && this->line_ + 1 >= maxUncollapsedLines()) + if (this->canCollapse() && + static_cast(this->line_ + 1) >= maxUncollapsedLines()) { this->canAddMessages_ = false; return; diff --git a/src/messages/layouts/MessageLayoutElement.cpp b/src/messages/layouts/MessageLayoutElement.cpp index 7b5e3fb5842..50b8126df6c 100644 --- a/src/messages/layouts/MessageLayoutElement.cpp +++ b/src/messages/layouts/MessageLayoutElement.cpp @@ -514,7 +514,7 @@ int TextLayoutElement::getXFromIndex(size_t index) else if (index < static_cast(this->getText().size())) { int x = 0; - for (int i = 0; i < index; i++) + for (size_t i = 0; i < index; i++) { x += metrics.horizontalAdvance(this->getText()[i]); } diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 0c345da83cc..249bd6c3c53 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -1411,7 +1411,7 @@ float IrcMessageHandler::similarity( float similarityPercent = 0.0F; int checked = 0; - for (int i = 1; i <= messages.size(); ++i) + for (size_t i = 1; i <= messages.size(); ++i) { if (checked >= getSettings()->hideSimilarMaxMessagesToCheck) { diff --git a/src/providers/twitch/api/Helix.cpp b/src/providers/twitch/api/Helix.cpp index a756a0f47a2..593c6837f16 100644 --- a/src/providers/twitch/api/Helix.cpp +++ b/src/providers/twitch/api/Helix.cpp @@ -1909,7 +1909,7 @@ void Helix::updateChatSettings( void Helix::onFetchChattersSuccess( std::shared_ptr finalChatters, QString broadcasterID, - QString moderatorID, int maxChattersToFetch, + QString moderatorID, size_t maxChattersToFetch, ResultCallback successCallback, FailureCallback failureCallback, HelixChatters chatters) @@ -2022,7 +2022,7 @@ void Helix::fetchChatters( void Helix::onFetchModeratorsSuccess( std::shared_ptr> finalModerators, - QString broadcasterID, int maxModeratorsToFetch, + QString broadcasterID, size_t maxModeratorsToFetch, ResultCallback> successCallback, FailureCallback failureCallback, HelixModerators moderators) @@ -2459,7 +2459,7 @@ void Helix::sendWhisper( // https://dev.twitch.tv/docs/api/reference#get-chatters void Helix::getChatters( - QString broadcasterID, QString moderatorID, int maxChattersToFetch, + QString broadcasterID, QString moderatorID, size_t maxChattersToFetch, ResultCallback successCallback, FailureCallback failureCallback) { diff --git a/src/providers/twitch/api/Helix.hpp b/src/providers/twitch/api/Helix.hpp index ec82f165441..3a81a9908f8 100644 --- a/src/providers/twitch/api/Helix.hpp +++ b/src/providers/twitch/api/Helix.hpp @@ -1073,7 +1073,7 @@ class IHelix // This will follow the returned cursor and return up to `maxChattersToFetch` chatters // https://dev.twitch.tv/docs/api/reference#get-chatters virtual void getChatters( - QString broadcasterID, QString moderatorID, int maxChattersToFetch, + QString broadcasterID, QString moderatorID, size_t maxChattersToFetch, ResultCallback successCallback, FailureCallback failureCallback) = 0; @@ -1417,7 +1417,7 @@ class Helix final : public IHelix // This will follow the returned cursor and return up to `maxChattersToFetch` chatters // https://dev.twitch.tv/docs/api/reference#get-chatters void getChatters( - QString broadcasterID, QString moderatorID, int maxChattersToFetch, + QString broadcasterID, QString moderatorID, size_t maxChattersToFetch, ResultCallback successCallback, FailureCallback failureCallback) final; @@ -1505,7 +1505,7 @@ class Helix final : public IHelix // Recursive boy void onFetchChattersSuccess( std::shared_ptr finalChatters, QString broadcasterID, - QString moderatorID, int maxChattersToFetch, + QString moderatorID, size_t maxChattersToFetch, ResultCallback successCallback, FailureCallback failureCallback, HelixChatters chatters); @@ -1520,7 +1520,7 @@ class Helix final : public IHelix // Recursive boy void onFetchModeratorsSuccess( std::shared_ptr> finalModerators, - QString broadcasterID, int maxModeratorsToFetch, + QString broadcasterID, size_t maxModeratorsToFetch, ResultCallback> successCallback, FailureCallback failureCallback, HelixModerators moderators); diff --git a/src/widgets/TooltipWidget.cpp b/src/widgets/TooltipWidget.cpp index 64b3bec8218..266b2ea03c9 100644 --- a/src/widgets/TooltipWidget.cpp +++ b/src/widgets/TooltipWidget.cpp @@ -119,9 +119,9 @@ void TooltipWidget::set(const std::vector &entries, this->setVisibleEntries(entries.size()); - for (int i = 0; i < entries.size(); ++i) + for (size_t i = 0; i < entries.size(); ++i) { - if (auto *entryWidget = this->entryAt(i)) + if (auto *entryWidget = this->entryAt(static_cast(i))) { const auto &entry = entries[i]; entryWidget->setImage(entry.image); diff --git a/src/widgets/dialogs/EditHotkeyDialog.cpp b/src/widgets/dialogs/EditHotkeyDialog.cpp index 3f7c6124285..0749e47490e 100644 --- a/src/widgets/dialogs/EditHotkeyDialog.cpp +++ b/src/widgets/dialogs/EditHotkeyDialog.cpp @@ -79,7 +79,7 @@ void EditHotkeyDialog::setFromHotkey(std::shared_ptr hotkey) this->ui_->easyArgsLabel->setText(def->argumentsPrompt); this->ui_->easyArgsLabel->setToolTip(def->argumentsPromptHover); int matchIdx = -1; - for (int i = 0; i < def->possibleArguments.size(); i++) + for (size_t i = 0; i < def->possibleArguments.size(); i++) { const auto &[displayText, argData] = def->possibleArguments.at(i); this->ui_->easyArgsPicker->addItem(displayText); @@ -90,7 +90,7 @@ void EditHotkeyDialog::setFromHotkey(std::shared_ptr hotkey) continue; } bool matches = true; - for (int j = 0; j < argData.size(); j++) + for (size_t j = 0; j < argData.size(); j++) { if (argData.at(j) != hotkey->arguments().at(j)) { @@ -100,7 +100,7 @@ void EditHotkeyDialog::setFromHotkey(std::shared_ptr hotkey) } if (matches) { - matchIdx = i; + matchIdx = static_cast(i); } } if (matchIdx != -1) diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index fabae271d11..f8bec9b1b09 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -219,11 +219,13 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split) const auto &timeoutButtons = getSettings()->timeoutButtons.getValue(); - if (timeoutButtons.size() < buttonNum || 0 >= buttonNum) + if (static_cast(timeoutButtons.size()) < buttonNum || + 0 >= buttonNum) { return QString("Invalid argument for execModeratorAction: " "%1. Integer out of usable range: [1, %2]") - .arg(buttonNum, timeoutButtons.size() - 1); + .arg(buttonNum, + static_cast(timeoutButtons.size()) - 1); } const auto &button = timeoutButtons.at(buttonNum - 1); msg = QString("/timeout %1 %2") @@ -690,9 +692,10 @@ void UserInfoPopup::installEvents() { const auto &vector = getSettings()->blacklistedUsers.raw(); - for (int i = 0; i < vector.size(); i++) + for (int i = 0; i < static_cast(vector.size()); i++) { - if (this->userName_ == vector[i].getPattern()) + if (this->userName_ == + vector[static_cast(i)].getPattern()) { getSettings()->blacklistedUsers.removeAt(i); i--; @@ -899,9 +902,9 @@ void UserInfoPopup::updateUserData() // get ignoreHighlights state bool isIgnoringHighlights = false; const auto &vector = getSettings()->blacklistedUsers.raw(); - for (int i = 0; i < vector.size(); i++) + for (const auto &user : vector) { - if (this->userName_ == vector[i].getPattern()) + if (this->userName_ == user.getPattern()) { isIgnoringHighlights = true; break; diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 50f6d1acc4d..dc0a98cbdcf 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -2204,8 +2204,8 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event) { this->isDoubleClick_ = false; // Was actually not a wanted triple-click - if (fabsf(distanceBetweenPoints(this->lastDoubleClickPosition_, - event->screenPos())) > 10.F) + if (std::abs(distanceBetweenPoints(this->lastDoubleClickPosition_, + event->screenPos())) > 10.F) { this->clickTimer_.stop(); return; @@ -2215,16 +2215,16 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event) { this->isLeftMouseDown_ = false; - if (fabsf(distanceBetweenPoints(this->lastLeftPressPosition_, - event->screenPos())) > 15.F) + if (std::abs(distanceBetweenPoints(this->lastLeftPressPosition_, + event->screenPos())) > 15.F) { return; } // Triple-clicking a message selects the whole message if (foundElement && this->clickTimer_.isActive() && - (fabsf(distanceBetweenPoints(this->lastDoubleClickPosition_, - event->screenPos())) < 10.F)) + (std::abs(distanceBetweenPoints(this->lastDoubleClickPosition_, + event->screenPos())) < 10.F)) { this->selectWholeMessage(layout.get(), messageIndex); return; @@ -2241,8 +2241,8 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event) { this->isRightMouseDown_ = false; - if (fabsf(distanceBetweenPoints(this->lastRightPressPosition_, - event->screenPos())) > 15.F) + if (std::abs(distanceBetweenPoints(this->lastRightPressPosition_, + event->screenPos())) > 15.F) { return; } diff --git a/src/widgets/helper/SearchPopup.cpp b/src/widgets/helper/SearchPopup.cpp index ff7e08816b0..b371cfb9787 100644 --- a/src/widgets/helper/SearchPopup.cpp +++ b/src/widgets/helper/SearchPopup.cpp @@ -242,9 +242,8 @@ LimitedQueueSnapshot SearchPopup::buildSnapshot() sharedView.channel()->getMessageSnapshot(); // TODO: implement iterator on LimitedQueueSnapshot? - for (auto i = 0; i < snapshot.size(); ++i) + for (const auto &message : snapshot) { - const MessagePtr &message = snapshot[i]; if (filterSet && !filterSet->filter(message, sharedView.channel())) { continue; diff --git a/src/widgets/listview/GenericListModel.cpp b/src/widgets/listview/GenericListModel.cpp index 0bb11117081..a76e6124e8c 100644 --- a/src/widgets/listview/GenericListModel.cpp +++ b/src/widgets/listview/GenericListModel.cpp @@ -19,7 +19,7 @@ QVariant GenericListModel::data(const QModelIndex &index, int /* role */) const return {}; } - if (index.row() >= this->items_.size()) + if (index.row() >= static_cast(this->items_.size())) { return {}; } diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index b82f817be66..f1f84eff475 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -42,7 +42,7 @@ namespace { using namespace chatterino; // 5 minutes -constexpr const uint64_t THUMBNAIL_MAX_AGE_MS = 5ULL * 60 * 1000; +constexpr const qint64 THUMBNAIL_MAX_AGE_MS = 5LL * 60 * 1000; auto formatRoomModeUnclean( const SharedAccessGuard &modes) -> QString From a383a2f60d2fbfd9a227435f9f5951c6784bc197 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Wed, 23 Oct 2024 21:03:49 +0200 Subject: [PATCH 2/5] chore: disable depecation warnings for Qt 6.x+ functions --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9d7134b9796..bace57a9c01 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,7 @@ set(LIBRARY_PROJECT "${PROJECT_NAME}-lib") set(VERSION_PROJECT "${LIBRARY_PROJECT}-version") set(EXECUTABLE_PROJECT "${PROJECT_NAME}") add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00) +add_compile_definitions(QT_WARN_DEPRECATED_UP_TO=0x050F00) # registers the native messageing host option(CHATTERINO_DEBUG_NATIVE_MESSAGES "Debug native messages" OFF) From 022677578087d13357081c9f56709c3e2e21c88e Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Wed, 23 Oct 2024 21:33:43 +0200 Subject: [PATCH 3/5] chore: add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7497e46dc35..3a0fffd77c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -112,6 +112,7 @@ - Dev: Refactored static `MessageBuilder` helpers to standalone functions. (#5652) - Dev: Decoupled reply parsing from `MessageBuilder`. (#5660, #5668) - Dev: Refactored IRC message building. (#5663) +- Dev: Fixed some compiler warnings. (#5672) ## 2.5.1 From 2e30ebc8251addfeaa24ef0cb8fc313e096a804a Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Wed, 23 Oct 2024 21:52:02 +0200 Subject: [PATCH 4/5] fix: qt5 --- src/messages/layouts/MessageLayoutElement.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/messages/layouts/MessageLayoutElement.cpp b/src/messages/layouts/MessageLayoutElement.cpp index 50b8126df6c..0031348d6f5 100644 --- a/src/messages/layouts/MessageLayoutElement.cpp +++ b/src/messages/layouts/MessageLayoutElement.cpp @@ -516,7 +516,8 @@ int TextLayoutElement::getXFromIndex(size_t index) int x = 0; for (size_t i = 0; i < index; i++) { - x += metrics.horizontalAdvance(this->getText()[i]); + x += metrics.horizontalAdvance( + this->getText()[static_cast(i)]); } return x + this->getRect().left(); } From 6d6541d0b57a060f2b3b9e19a4d378781bc32e12 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 27 Oct 2024 13:14:41 +0100 Subject: [PATCH 5/5] nit: remove old comment --- src/widgets/helper/SearchPopup.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/widgets/helper/SearchPopup.cpp b/src/widgets/helper/SearchPopup.cpp index b371cfb9787..73f6c47a4a4 100644 --- a/src/widgets/helper/SearchPopup.cpp +++ b/src/widgets/helper/SearchPopup.cpp @@ -241,7 +241,6 @@ LimitedQueueSnapshot SearchPopup::buildSnapshot() const LimitedQueueSnapshot &snapshot = sharedView.channel()->getMessageSnapshot(); - // TODO: implement iterator on LimitedQueueSnapshot? for (const auto &message : snapshot) { if (filterSet && !filterSet->filter(message, sharedView.channel()))