From 3e8fecc9a62afff0054fa0fa23af86c8ef15a1c9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Feb 2016 21:19:35 +0300 Subject: Add missing const in gui directory. --- src/gui/models/namesmodel.cpp | 3 ++- src/gui/models/namesmodel.h | 3 ++- src/gui/models/playertablemodel.cpp | 4 ++-- src/gui/models/shopitems.cpp | 4 ++-- src/gui/models/shopitems.h | 2 +- src/gui/models/touchactionmodel.cpp | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/gui/models') diff --git a/src/gui/models/namesmodel.cpp b/src/gui/models/namesmodel.cpp index 2e7606274..8d0d77251 100644 --- a/src/gui/models/namesmodel.cpp +++ b/src/gui/models/namesmodel.cpp @@ -45,7 +45,8 @@ std::string NamesModel::getElementAt(int i) return mNames[CAST_SIZE(i)]; } -void NamesModel::fillFromArray(const char *const *const arr, std::size_t sz) +void NamesModel::fillFromArray(const char *const *const arr, + const std::size_t sz) { if (!arr) return; diff --git a/src/gui/models/namesmodel.h b/src/gui/models/namesmodel.h index 0f75b0bc8..63af17db6 100644 --- a/src/gui/models/namesmodel.h +++ b/src/gui/models/namesmodel.h @@ -52,7 +52,8 @@ class NamesModel notfinal : public ListModel void add(const std::string &str) { mNames.push_back(str); } - void fillFromArray(const char *const *const arr, std::size_t size); + void fillFromArray(const char *const *const arr, + const std::size_t size); protected: StringVect mNames; diff --git a/src/gui/models/playertablemodel.cpp b/src/gui/models/playertablemodel.cpp index 80eab3694..e3458abc3 100644 --- a/src/gui/models/playertablemodel.cpp +++ b/src/gui/models/playertablemodel.cpp @@ -100,8 +100,8 @@ void PlayerTableModel::playerRelationsUpdated() mPlayers = player_names; // set up widgets - for (unsigned int r = 0, sz = CAST_U32( - player_names->size()); r < sz; ++r) + for (unsigned int r = 0, fsz = CAST_U32( + player_names->size()); r < fsz; ++r) { const std::string name = (*player_names)[r]; Widget *const widget = new Label(this, name); diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp index 952e5fe19..2a2b75ae8 100644 --- a/src/gui/models/shopitems.cpp +++ b/src/gui/models/shopitems.cpp @@ -103,9 +103,9 @@ ShopItem *ShopItems::addItem2(const int inventoryIndex, return item; } -ShopItem *ShopItems::at(unsigned int i) const +ShopItem *ShopItems::at(const size_t i) const { - if (i >= CAST_U32(mShopItems.size())) + if (i >= mShopItems.size()) return nullptr; return mShopItems.at(i); diff --git a/src/gui/models/shopitems.h b/src/gui/models/shopitems.h index c75fee7e1..d346c38b7 100644 --- a/src/gui/models/shopitems.h +++ b/src/gui/models/shopitems.h @@ -107,7 +107,7 @@ class ShopItems final : public ListModel /** * Returns the item number i in the shop. */ - ShopItem *at(unsigned int i) const A_WARN_UNUSED; + ShopItem *at(const size_t i) const A_WARN_UNUSED; /** * Removes an element from the shop. diff --git a/src/gui/models/touchactionmodel.cpp b/src/gui/models/touchactionmodel.cpp index c75c5985e..12059cb08 100644 --- a/src/gui/models/touchactionmodel.cpp +++ b/src/gui/models/touchactionmodel.cpp @@ -48,7 +48,7 @@ TouchActionsModel::TouchActionsModel() : { std::vector data; - for (int f = 0, sz = touchActionDataSize; f < sz; f ++) + for (int f = 0, fsz = touchActionDataSize; f < fsz; f ++) { int k = 0; while (!touchActionData[f][k].name.empty()) -- cgit v1.2.3-60-g2f50