diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-08 22:46:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-08 22:46:48 +0300 |
commit | 6d4da51f0fdcecc2d4398f60dbca43f499fdbe16 (patch) | |
tree | c71c7c6e49ed36a55c6b6a2b1ba70073300634dd | |
parent | 4125ac707288a244a7175b755d74dd963e762f56 (diff) | |
download | manaverse-6d4da51f0fdcecc2d4398f60dbca43f499fdbe16.tar.gz manaverse-6d4da51f0fdcecc2d4398f60dbca43f499fdbe16.tar.bz2 manaverse-6d4da51f0fdcecc2d4398f60dbca43f499fdbe16.tar.xz manaverse-6d4da51f0fdcecc2d4398f60dbca43f499fdbe16.zip |
Fix code style in gui.
28 files changed, 84 insertions, 72 deletions
diff --git a/src/gui/font.cpp b/src/gui/font.cpp index b5bb46eb0..9eef7fbcd 100644 --- a/src/gui/font.cpp +++ b/src/gui/font.cpp @@ -602,7 +602,7 @@ void Font::doClean() for (unsigned int f = 0; f < CACHES_NUMBER; f ++) { TextChunkList *const cache = &mCache[f]; - const size_t size = cache->size; + const size_t size = static_cast<size_t>(cache->size); #ifdef DEBUG_FONT_COUNTERS logger->log("ptr: %d, size: %d", f, size); #endif diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index dda1cc64a..7c17b5991 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -658,7 +658,7 @@ void Gui::handleMouseMoved(const MouseInput &mouseInput) } widgetWithMouseQueueCheckDone = - (iterations == mWidgetWithMouseQueue.size()); + (static_cast<size_t>(iterations) == mWidgetWithMouseQueue.size()); } // Check all widgets below the mouse to see if they are diff --git a/src/gui/gui.h b/src/gui/gui.h index 43594ad9f..97604ad3a 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -68,6 +68,8 @@ #include "gui/color.h" +#include "resources/cursor.h" + #include <deque> #include <list> @@ -187,7 +189,7 @@ class Gui final /** * Sets which cursor should be used. */ - void setCursorType(const int index) + void setCursorType(const Cursor::Cursor index) { mCursorType = index; } void setDoubleClick(const bool b) @@ -508,7 +510,7 @@ class Gui final ImageSet *mMouseCursors; /**< Mouse cursor images */ float mMouseCursorAlpha; int mMouseInactivityTimer; - int mCursorType; + Cursor::Cursor mCursorType; #ifdef ANDROID uint16_t mLastMouseRealX; uint16_t mLastMouseRealY; diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp index 492409e76..58bfe0023 100644 --- a/src/gui/models/shopitems.cpp +++ b/src/gui/models/shopitems.cpp @@ -41,8 +41,8 @@ ShopItems::~ShopItems() std::string ShopItems::getElementAt(int i) { - if (i < 0 || static_cast<unsigned>(i) >= mShopItems.size() - || !mShopItems.at(i)) + if (i < 0 || static_cast<unsigned>(i) + >= static_cast<unsigned int>(mShopItems.size()) || !mShopItems.at(i)) { return ""; } @@ -85,7 +85,7 @@ void ShopItems::addItem2(const int inventoryIndex, const int id, ShopItem *ShopItems::at(unsigned int i) const { - if (i >= mShopItems.size()) + if (i >= static_cast<unsigned int>(mShopItems.size())) return nullptr; return mShopItems.at(i); @@ -93,7 +93,7 @@ ShopItem *ShopItems::at(unsigned int i) const void ShopItems::erase(const unsigned int i) { - if (i >= mShopItems.size()) + if (i >= static_cast<unsigned int>(mShopItems.size())) return; mShopItems.erase(mShopItems.begin() + i); @@ -101,7 +101,7 @@ void ShopItems::erase(const unsigned int i) void ShopItems::del(const unsigned int i) { - if (i >= mShopItems.size()) + if (i >= static_cast<unsigned int>(mShopItems.size())) return; ShopItem *item = *(mShopItems.begin() + i); diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index e863f0b2a..b10147bc7 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -480,7 +480,7 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event) break; } - if (!(keysym.mod & KMOD_NUM)) + if (!(static_cast<unsigned int>(keysym.mod) & KMOD_NUM)) { switch (keysym.sym) { diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index ea902e2b5..b42f8c234 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -461,7 +461,7 @@ struct SkinHelper final bool loadList(const SkinParameter *const params, const size_t size) { - for (unsigned f = 0; f < size; f ++) + for (size_t f = 0; f < size; f ++) { const SkinParameter ¶m = params[f]; if (partType == param.name) diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index af2125cb5..33690ba39 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -577,8 +577,11 @@ void Viewport::walkByMouse(const MouseEvent &event) int dy = 0; if (x2 > y2) { - if (y2 && x2 / y2 / wh > diff) + if (y2 && static_cast<float>(x2) / static_cast<float>(y2) + / wh > diff) + { y = 0; + } } else { diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 2696bcdbc..25b5444fc 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -289,7 +289,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) // discard older rows when a row limit has been set if (mMaxRows > 0 && !mTextRows.empty()) { - while (mTextRows.size() > mMaxRows) + while (mTextRows.size() > static_cast<size_t>(mMaxRows)) { mTextRows.pop_front(); int cnt = mTextRowLinksCount.front(); @@ -740,7 +740,7 @@ int BrowserBox::calcHeight() if (mEmotes) { const size_t sz = mEmotes->size(); - if (static_cast<unsigned>(cid) < sz) + if (static_cast<size_t>(cid) < sz) { Image *const img = mEmotes->get(cid); if (img) diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index cbdd50cab..68d508a5a 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -129,8 +129,8 @@ int EmotePage::getIndexFromGrid(const int x, const int y) const if (x < 0 || x > width || y < 0 || y > mDimension.height) return -1; const int cols = width / emoteWidth; - const unsigned int index = (y / emoteHeight) * cols + (x / emoteWidth); - if (index >= mEmotes->size()) + const int index = (y / emoteHeight) * cols + (x / emoteWidth); + if (index >= static_cast<int>(mEmotes->size())) return -1; return index; } diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index c731e86d8..5331eab42 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -220,7 +220,7 @@ void EmoteShortcutContainer::mouseMoved(MouseEvent &event) mEmotePopup->setVisible(false); - if (static_cast<unsigned>(index) < mEmoteImg.size() && mEmoteImg[index]) + if (static_cast<size_t>(index) < mEmoteImg.size() && mEmoteImg[index]) { const EmoteSprite *const sprite = mEmoteImg[index]; mEmotePopup->show(viewport->getMouseX(), viewport->getMouseY(), diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index f24be7737..4a944c276 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -145,12 +145,13 @@ namespace if (!pair1 || !pair2) return false; - const int t1 = pair1->mItem->getInfo().getType(); - const int t2 = pair2->mItem->getInfo().getType(); + const ItemInfo &info1 = pair1->mItem->getInfo(); + const ItemInfo &info2 = pair2->mItem->getInfo(); + const ItemType t1 = info1.getType(); + const ItemType t2 = info2.getType(); if (t1 == t2) { - return (pair1->mItem->getInfo().getName() - < pair2->mItem->getInfo().getName()); + return (info1.getName() < info2.getName()); } return t1 < t2; } @@ -645,7 +646,7 @@ void ItemContainer::updateMatrix() return; delete []mShowMatrix; - mShowMatrix = new int[mGridRows * mGridColumns]; + mShowMatrix = new int[static_cast<size_t>(mGridRows * mGridColumns)]; std::vector<ItemIdPair*> sortedItems; int i = 0; diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index 27af0840d..c9092f8bd 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.h @@ -198,49 +198,52 @@ class LayoutCell /** * Sets the horizontal alignment of the cell content. */ - LayoutCell &setHAlign(Alignment a) + LayoutCell &setHAlign(const Alignment a) { mAlign[0] = a; return *this; } /** * Sets the vertical alignment of the cell content. */ - LayoutCell &setVAlign(Alignment a) + LayoutCell &setVAlign(const Alignment a) { mAlign[1] = a; return *this; } /** * @see LayoutArray::at */ - LayoutCell &at(int x, int y) A_WARN_UNUSED + LayoutCell &at(const int x, const int y) A_WARN_UNUSED { return getArray().at(x, y); } /** * @see LayoutArray::place */ - LayoutCell &place(Widget *wg, int x, int y, int w = 1, int h = 1) + LayoutCell &place(Widget *wg, + const int x, const int y, + const int w = 1, const int h = 1) { return getArray().place(wg, x, y, w, h); } /** * @see LayoutArray::matchColWidth */ - void matchColWidth(int n1, int n2) + void matchColWidth(const int n1, const int n2) { getArray().matchColWidth(n1, n2); } /** * @see LayoutArray::setColWidth */ - void setColWidth(int n, int w) + void setColWidth(const int n, const int w) { getArray().setColWidth(n, w); } /** * @see LayoutArray::setRowHeight */ - void setRowHeight(int n, int h) + void setRowHeight(const int n, const int h) { getArray().setRowHeight(n, h); } /** * @see LayoutArray::extend. */ - void extend(int x, int y, int w, int h) + void extend(const int x, const int y, + const int w, const int h) { getArray().extend(x, y, w, h); } /** @@ -258,10 +261,10 @@ class LayoutCell int getHeight() const A_WARN_UNUSED { return mExtent[1]; } - void setWidth(int w) + void setWidth(const int w) { mExtent[0] = w; } - void setHeight(int h) + void setHeight(const int h) { mExtent[1] = h; } enum @@ -280,8 +283,8 @@ class LayoutCell { mExtent[0] = 0; mExtent[1] = 0; - mAlign[0] = 0; - mAlign[1] = 0; + mAlign[0] = LEFT; + mAlign[1] = LEFT; mNbFill[0] = 0; mNbFill[1] = 0; mSize[0] = 0; @@ -313,7 +316,7 @@ class LayoutCell int mHPadding; int mVPadding; int mExtent[2]; - int mAlign[2]; + Alignment mAlign[2]; int mNbFill[2]; int mType; }; diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index cd439a95a..5596bdd21 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -266,7 +266,7 @@ void TabbedArea::addTab(Image *const image, Widget *const widget) addTab(tab, widget); } -bool TabbedArea::isTabSelected(const unsigned int index) const +bool TabbedArea::isTabSelected(const size_t index) const { if (index >= mTabs.size()) return false; @@ -289,7 +289,7 @@ bool TabbedArea::isTabSelected(const Tab *const tab) const return mSelectedTab == tab; } -void TabbedArea::setSelectedTabByIndex(const unsigned int index) +void TabbedArea::setSelectedTabByIndex(const size_t index) { if (index >= mTabs.size()) return; @@ -383,14 +383,13 @@ void TabbedArea::mousePressed(MouseEvent &event) void TabbedArea::setSelectedTab(Tab *const tab) { - unsigned int i; - for (i = 0; i < mTabs.size(); i++) + for (size_t i = 0; i < mTabs.size(); i++) { if (mTabs[i].first == mSelectedTab) mWidgetContainer->remove(mTabs[i].second); } - for (i = 0; i < mTabs.size(); i++) + for (size_t i = 0; i < mTabs.size(); i++) { if (mTabs[i].first == tab) { @@ -518,7 +517,7 @@ void TabbedArea::updateVisibleTabsWidth() for (size_t i = mTabScrollIndex, sz = mTabs.size(); i < sz; ++i) { if (mTabs[i].first) - mVisibleTabsWidth += mTabs[i].first->getWidth(); + mVisibleTabsWidth += static_cast<int>(mTabs[i].first->getWidth()); } } @@ -616,7 +615,7 @@ void TabbedArea::action(const ActionEvent& actionEvent) } else if (eventId == "shift_right") { - if (mTabScrollIndex < mTabs.size() - 1) + if (static_cast<size_t>(mTabScrollIndex) < mTabs.size() - 1) ++mTabScrollIndex; } adjustTabPositions(); diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 578128abf..f28a4a17b 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -142,7 +142,7 @@ class TabbedArea final : public ActionListener, void addTab(Image *const image, Widget *const widget); - bool isTabSelected(const unsigned int index) const A_WARN_UNUSED; + bool isTabSelected(const size_t index) const A_WARN_UNUSED; bool isTabSelected(const Tab *const tab) const A_WARN_UNUSED; @@ -165,7 +165,7 @@ class TabbedArea final : public ActionListener, void setSelectedTab(Tab *const tab); - void setSelectedTabByIndex(const unsigned int index); + void setSelectedTabByIndex(const size_t index); int getSelectedTabIndex() const A_WARN_UNUSED; diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp index 4d2845656..eb7e163f0 100644 --- a/src/gui/widgets/tabs/setup_joystick.cpp +++ b/src/gui/widgets/tabs/setup_joystick.cpp @@ -78,8 +78,8 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) : } else { - unsigned sel = config.getIntValue("selectedJoystick"); - if (sel >= mNamesModel->size()) + unsigned int sel = config.getIntValue("selectedJoystick"); + if (sel >= static_cast<unsigned int>(mNamesModel->size())) sel = 0; mNamesDropDown->setSelected(sel); } diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index 77a758cb4..613e2c7f0 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -134,7 +134,8 @@ public: mWidgets.push_back(widget); DropDown *const choicebox = new DropDown(this, mListModel); - choicebox->setSelected(player_relations.getRelation(name)); + choicebox->setSelected(static_cast<int>( + player_relations.getRelation(name))); mWidgets.push_back(choicebox); } diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index d616ecd0d..c03835a0e 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -457,7 +457,7 @@ void TextBox::draw(Graphics* graphics) { // Move the text one pixel so we can have a caret before a letter. font->drawString(graphics, mTextRows[i], 1, - static_cast<int>(i * fontHeight)); + static_cast<int>(i * static_cast<size_t>(fontHeight))); } BLOCK_END("TextBox::draw") } @@ -626,5 +626,5 @@ void TextBox::adjustSize() } setWidth(width + 1); - setHeight(static_cast<int>(font->getHeight() * mTextRows.size())); + setHeight(font->getHeight() * static_cast<int>(mTextRows.size())); } diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 342e97ee8..db194419e 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -557,12 +557,12 @@ void TextField::caretDelete() void TextField::handlePaste() { std::string text = getText(); - size_t caretPos = getCaretPosition(); + size_t caretPos = static_cast<size_t>(getCaretPosition()); if (retrieveBuffer(text, caretPos)) { setText(text); - setCaretPosition(static_cast<unsigned>(caretPos)); + setCaretPosition(static_cast<unsigned int>(caretPos)); } } @@ -744,9 +744,9 @@ void TextField::focusLost(const Event &event A_UNUSED) void TextField::setText(const std::string& text) { - const size_t sz = text.size(); + const unsigned int sz = static_cast<unsigned int>(text.size()); if (sz < mCaretPosition) - mCaretPosition = static_cast<unsigned int>(sz); + mCaretPosition = sz; mText = text; } diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index e86bf344e..f8e87e846 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -148,8 +148,8 @@ class SortItemTypeFunctor final if (!item1 || !item2) return false; - const int type1 = item1->getInfo().getType(); - const int type2 = item2->getInfo().getType(); + const ItemType type1 = item1->getInfo().getType(); + const ItemType type2 = item2->getInfo().getType(); if (type1 == type2) return item1->getPrice() < item2->getPrice(); return type1 < type2; diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 182ce5f03..c1e8217d8 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -488,7 +488,7 @@ void CharCreateDialog::setAttributes(const StringVect &labels, { mMaxPoints = available; - for (unsigned i = 0; i < mAttributeLabel.size(); i++) + for (size_t i = 0; i < mAttributeLabel.size(); i++) { remove(mAttributeLabel[i]); delete2(mAttributeLabel[i]) diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index ad646ce82..316b276f3 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -880,11 +880,11 @@ void ChatWindow::keyPressed(KeyEvent &event) { const std::list<std::string> &rows = tab->getRows(); const size_t &tabSize = rows.size(); - if (mChatHistoryIndex + 1 < tabSize) + if (static_cast<size_t>(mChatHistoryIndex) + 1 < tabSize) { mChatHistoryIndex ++; } - else if (mChatHistoryIndex < tabSize) + else if (static_cast<size_t>(mChatHistoryIndex) < tabSize) { mChatHistoryIndex ++; mChatInput->setText(""); @@ -1423,7 +1423,7 @@ bool ChatWindow::resortChatLog(std::string line, Own own, const bool ignoreRecord, const bool tryRemoveColors) { - if (own == -1) + if (own == BY_UNKNOWN) own = BY_SERVER; std::string prefix; @@ -1535,7 +1535,7 @@ void ChatWindow::battleChatLog(const std::string &line, Own own, const bool ignoreRecord, const bool tryRemoveColors) { - if (own == -1) + if (own == BY_UNKNOWN) own = BY_SERVER; if (battleChatTab) battleChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors); diff --git a/src/gui/windows/killstats.h b/src/gui/windows/killstats.h index 1e2da9ada..ae8ce3487 100644 --- a/src/gui/windows/killstats.h +++ b/src/gui/windows/killstats.h @@ -84,7 +84,7 @@ class KillStats final : public Window, private: void validateJacko(); - time_t mKillTimer; /**< Timer for kill stats. */ + int mKillTimer; /**< Timer for kill stats. */ Button *mResetButton; Button *mTimerButton; Label *mLine1; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 015c94f00..2b890a7af 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -719,7 +719,7 @@ void ServerDialog::saveCustomServers(const ServerInfo ¤tServer, // Make sure the current server is mentioned first if (currentServer.isValid()) { - if (index >= 0 && static_cast<unsigned>(index) < mServers.size()) + if (index >= 0 && static_cast<size_t>(index) < mServers.size()) { mServers[index] = currentServer; } @@ -789,7 +789,7 @@ int ServerDialog::downloadUpdate(void *ptr, DownloadStatus status, { finished = true; } - else if (status < 0) + else if (static_cast<int>(status) < 0) { logger->log("Error retreiving server list: %s\n", sd->mDownload->getError()); diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 4e22595a6..34a8bcf12 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -802,7 +802,7 @@ public: return; std::vector<Avatar*> *const avatars = mBeings->getMembers(); - if (!avatars || avatars->size() <= num) + if (!avatars || avatars->size() <= static_cast<size_t>(num)) return; const Avatar *const ava = avatars->at(num); diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index 2eccb255d..29e1bd81e 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -138,9 +138,10 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : mCommandTextField->setText(command->getCommand()); mCommentTextField->setText(command->getComment()); mManaField->setValue(command->getMana()); - mTypeDropDown->setSelected(command->getTargetType()); + mTypeDropDown->setSelected(static_cast<int>(command->getTargetType())); mMagicLvlField->setValue(command->getBaseLvl()); - mSchoolDropDown->setSelected(command->getSchool() - MAGIC_START_ID); + mSchoolDropDown->setSelected(static_cast<int>(command->getSchool()) + - MAGIC_START_ID); mSchoolLvlField->setValue(command->getSchoolLvl()); ContainerPlacer placer; diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index dab1a6ebc..249748d43 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -512,7 +512,7 @@ size_t UpdaterWindow::memoryWrite(void *ptr, size_t size, UpdaterWindow *const uw = reinterpret_cast<UpdaterWindow *>(stream); const size_t totalMem = size * nmemb; uw->mMemoryBuffer = static_cast<char*>(realloc(uw->mMemoryBuffer, - uw->mDownloadedBytes + totalMem)); + static_cast<size_t>(uw->mDownloadedBytes) + totalMem)); if (uw->mMemoryBuffer) { memcpy(&(uw->mMemoryBuffer[uw->mDownloadedBytes]), ptr, totalMem); @@ -757,7 +757,8 @@ void UpdaterWindow::logic() } mProgressBar->setProgress(mDownloadProgress); - if (mUpdateFiles.size() && mUpdateIndex <= mUpdateFiles.size()) + if (mUpdateFiles.size() + && static_cast<size_t>(mUpdateIndex) <= mUpdateFiles.size()) { mProgressBar->setText(strprintf("%u/%u", mUpdateIndex + mUpdateIndexOffset + 1, static_cast<unsigned>( @@ -853,7 +854,7 @@ void UpdaterWindow::logic() case UPDATE_RESOURCES: if (mDownloadComplete) { - if (mUpdateIndex < mUpdateFiles.size()) + if (static_cast<size_t>(mUpdateIndex) < mUpdateFiles.size()) { UpdateFile thisFile = mUpdateFiles[mUpdateIndex]; if (thisFile.type == "music" @@ -918,7 +919,8 @@ void UpdaterWindow::logic() if (mDownloadComplete) { mValidateXml = false; - if (mUpdateIndex < mTempUpdateFiles.size()) + if (static_cast<size_t>(mUpdateIndex) + < mTempUpdateFiles.size()) { const UpdateFile thisFile = mTempUpdateFiles[mUpdateIndex]; mCurrentFile = thisFile.name; diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 0bf05a129..c417e6b37 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -474,7 +474,7 @@ size_t WhoIsOnline::memoryWrite(void *ptr, size_t size, WhoIsOnline *const wio = reinterpret_cast<WhoIsOnline *>(stream); const size_t totalMem = size * nmemb; wio->mMemoryBuffer = static_cast<char*>(realloc(wio->mMemoryBuffer, - wio->mDownloadedBytes + totalMem)); + static_cast<size_t>(wio->mDownloadedBytes) + totalMem)); if (wio->mMemoryBuffer) { memcpy(&(wio->mMemoryBuffer[wio->mDownloadedBytes]), ptr, totalMem); diff --git a/src/gui/windows/whoisonline.h b/src/gui/windows/whoisonline.h index 448321866..35b36fd7e 100644 --- a/src/gui/windows/whoisonline.h +++ b/src/gui/windows/whoisonline.h @@ -189,7 +189,7 @@ private: UPDATE_LIST }; - time_t mUpdateTimer; + int mUpdateTimer; /** A thread that use libcurl to download updates. */ SDL_Thread *mThread; |