From 38bbba081db455d5f84e64bd74dcc10236fa2120 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 10 Jul 2023 18:45:56 +0200 Subject: [PATCH] Fix some -Wsign-compare warnings. --- formations.cpp | 2 +- formations.h | 4 ++-- main.cpp | 4 ++-- players.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/formations.cpp b/formations.cpp index a23469b..dc07a1f 100644 --- a/formations.cpp +++ b/formations.cpp @@ -37,7 +37,7 @@ QVariant FormationsModel::data(const QModelIndex &index, int role) const if (index.column() == 0) { if (index.row() == 0) { return QString::fromUtf8("(None/unknown)"); - } else if (index.row() == formations.size() + 1) { + } else if (index.row() == int(formations.size() + 1)) { return QString::fromUtf8("Add new…"); } else { return QString::fromUtf8(formations[index.row() - 1].name); diff --git a/formations.h b/formations.h index c023173..efc87fe 100644 --- a/formations.h +++ b/formations.h @@ -31,7 +31,7 @@ public: } std::string get_formation_name_by_id(unsigned formation_id) { for (unsigned i = 0; i < formations.size(); ++i) { - if (formations[i].formation_id == formation_id) { + if (formations[i].formation_id == int(formation_id)) { return formations[i].name; } } @@ -39,7 +39,7 @@ public: } unsigned get_row_from_id(unsigned formation_id) { for (unsigned i = 0; i < formations.size(); ++i) { - if (formations[i].formation_id == formation_id) { + if (formations[i].formation_id == int(formation_id)) { return i + 1; } } diff --git a/main.cpp b/main.cpp index 80ebd6f..1c0f2e3 100644 --- a/main.cpp +++ b/main.cpp @@ -52,7 +52,7 @@ MainWindow::MainWindow(EventsModel *events, PlayersModel *players, ui->event_view->setColumnWidth(2, 150); connect(ui->event_view->selectionModel(), &QItemSelectionModel::currentRowChanged, [this, events](const QModelIndex ¤t, const QModelIndex &previous) { - uint64_t t = events->get_time(current.row()); + int64_t t = events->get_time(current.row()); if (t != video->position()) { video->setPosition(events->get_time(current.row())); } else { @@ -232,7 +232,7 @@ void MainWindow::insert_player_event(int button_id) { uint64_t t = video->position(); vector team = events->sort_team(events->get_team_at(t)); - if (button_id >= team.size()) { + if (unsigned(button_id) >= team.size()) { return; } int player_id = team[button_id]; diff --git a/players.cpp b/players.cpp index 1854408..0ed7d32 100644 --- a/players.cpp +++ b/players.cpp @@ -59,7 +59,7 @@ QVariant PlayersModel::data(const QModelIndex &index, int role) const string PlayersModel::get_player_name_by_id(unsigned player_id) { - auto it = find_if(players.begin(), players.end(), [player_id](const Player &p) { return p.player_id == player_id; }); + auto it = find_if(players.begin(), players.end(), [player_id](const Player &p) { return p.player_id == int(player_id); }); return it->name; } -- 2.39.2