From 64887d7ee931fa8426d25c4aaf0ee1a767d4a761 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 8 Aug 2017 21:20:53 +0300 Subject: Use size_t type for index in other shortcut classes. --- src/gui/shortcut/shortcutbase.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/gui/shortcut/shortcutbase.h') diff --git a/src/gui/shortcut/shortcutbase.h b/src/gui/shortcut/shortcutbase.h index 7fb656dbf..90ca41ee7 100644 --- a/src/gui/shortcut/shortcutbase.h +++ b/src/gui/shortcut/shortcutbase.h @@ -25,6 +25,8 @@ #include "enums/simpletypes/itemcolor.h" +#include "utils/cast.h" + #include #include "localconsts.h" @@ -66,17 +68,17 @@ class ShortcutBase notfinal * * @param index Index of the shortcut item. */ - int getItem(const int index) const A_WARN_UNUSED + int getItem(const size_t index) const A_WARN_UNUSED { return mItems[index]; } - ItemColor getItemColor(const int index) const A_WARN_UNUSED + ItemColor getItemColor(const size_t index) const A_WARN_UNUSED { return mItemColors[index]; } /** * Returns the amount of shortcut items. */ int getItemCount() const noexcept2 A_WARN_UNUSED - { return mMaxSize; } + { return CAST_S32(mMaxSize); } /** * Returns the item ID that is currently selected. @@ -89,7 +91,7 @@ class ShortcutBase notfinal * * @param index Index of the items. */ - void setItem(const int index); + void setItem(const size_t index); /** * Adds an item to the items store specified by the index. @@ -97,7 +99,7 @@ class ShortcutBase notfinal * @param index Index of the item. * @param itemId ID of the item. */ - void setItems(const int index, + void setItems(const size_t index, const int itemId, const ItemColor color) { mItems[index] = itemId; mItemColors[index] = color; save(); } @@ -121,7 +123,7 @@ class ShortcutBase notfinal /** * Remove a item from the shortcut. */ - void removeItem(const int index) + void removeItem(const size_t index) { mItems[index] = -1; save(); } void clear(const bool isSave = true); @@ -131,8 +133,8 @@ class ShortcutBase notfinal ItemColor *mItemColors A_NONNULLPOINTER; std::string mItemName; std::string mColorName; + size_t mMaxSize; int mItemSelected; - int mMaxSize; ItemColor mItemColorSelected; }; -- cgit v1.2.3-60-g2f50