fix: get rid of some more warnings (#5672)

This commit is contained in:
nerix
2024-10-27 13:42:23 +01:00
committed by GitHub
parent 74a385dfee
commit bbcd8c5eb2
21 changed files with 79 additions and 64 deletions
+2 -2
View File
@@ -119,9 +119,9 @@ void TooltipWidget::set(const std::vector<TooltipEntry> &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<int>(i)))
{
const auto &entry = entries[i];
entryWidget->setImage(entry.image);
+3 -3
View File
@@ -79,7 +79,7 @@ void EditHotkeyDialog::setFromHotkey(std::shared_ptr<Hotkey> 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> 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> hotkey)
}
if (matches)
{
matchIdx = i;
matchIdx = static_cast<int>(i);
}
}
if (matchIdx != -1)
+9 -6
View File
@@ -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<int>(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<int>(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<int>(vector.size()); i++)
{
if (this->userName_ == vector[i].getPattern())
if (this->userName_ ==
vector[static_cast<size_t>(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;
+8 -8
View File
@@ -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;
}
+1 -3
View File
@@ -241,10 +241,8 @@ LimitedQueueSnapshot<MessagePtr> SearchPopup::buildSnapshot()
const LimitedQueueSnapshot<MessagePtr> &snapshot =
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;
+1 -1
View File
@@ -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<int>(this->items_.size()))
{
return {};
}
+1 -1
View File
@@ -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<const TwitchChannel::RoomModes> &modes) -> QString