From 81db0022e50e25d922ac7d67d9ec6017b8856f13 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 25 Feb 2012 21:28:51 +0300 Subject: Fix old casts. --- src/gui/widgets/browserbox.cpp | 22 +++++++++++----------- src/gui/widgets/guitable.cpp | 9 +++++---- src/gui/widgets/setupitem.cpp | 4 ++-- src/gui/widgets/textfield.cpp | 2 +- 4 files changed, 19 insertions(+), 18 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 5856a91b1..47c5616b6 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -232,15 +232,17 @@ void BrowserBox::addRow(const std::string &row, bool atTop) tempRow.substr(nextChar, (nextSpacePos - nextChar))); - if ((x + nextWordWidth + 10) > (unsigned)getWidth()) + if ((x + nextWordWidth + 10) + > static_cast(getWidth())) { x = 15; // Ident in new line y += 1; - j++; + j ++; } } // Wrapping looong lines (brutal force) - else if ((x + 2 * hyphenWidth) > (unsigned)getWidth()) + else if ((x + 2 * hyphenWidth) + > static_cast(getWidth())) { x = 15; // Ident in new line y += 1; @@ -249,7 +251,7 @@ void BrowserBox::addRow(const std::string &row, bool atTop) } setHeight(font->getHeight() * (static_cast( - mTextRows.size()) + y)); + mTextRows.size()) + y)); } else { @@ -423,7 +425,7 @@ int BrowserBox::calcHeight() if (row.find("---", 0) == 0) { const int dashWidth = fontWidthMinus; - for (x = 0; x < (unsigned)getWidth(); x++) + for (x = 0; x < static_cast(getWidth()); x ++) { mLineParts.push_back(LinePart(x, y, selColor, "-", false)); x += dashWidth - 2; @@ -557,9 +559,8 @@ int BrowserBox::calcHeight() width = font->getWidth(part); // Auto wrap mode - if (mMode == AUTO_WRAP && getWidth() > 0 - && width > 0 - && (x + width + 10) > (unsigned)getWidth()) + if (mMode == AUTO_WRAP && getWidth() > 0 && width > 0 + && (x + width + 10) > static_cast(getWidth())) { bool forced = false; @@ -592,9 +593,8 @@ int BrowserBox::calcHeight() else width = font->getWidth(part); } - while (end > start && width > 0 - && (x + width + 10) - > (unsigned)getWidth()); + while (end > start && width > 0 && (x + width + 10) + > static_cast(getWidth())); if (forced) { diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index d620cbb8d..6434f5453 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -348,14 +348,15 @@ void GuiTable::draw(gcn::Graphics* graphics) if (mSelectedRow > 0) { - if (mLinewiseMode && r == (unsigned)mSelectedRow && c == 0) + if (mLinewiseMode && r == static_cast( + mSelectedRow) && c == 0) { graphics->fillRectangle(gcn::Rectangle(0, y_offset, - getWidth(), height)); + getWidth(), height)); } else if (!mLinewiseMode && mSelectedColumn > 0 - && c == (unsigned)mSelectedColumn - && r == (unsigned)mSelectedRow) + && c == static_cast(mSelectedColumn) + && r == static_cast(mSelectedRow)) { graphics->fillRectangle(gcn::Rectangle( x_offset, y_offset, width, height)); diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 490c046c3..8987719da 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -830,8 +830,8 @@ void SetupItemSlider2::updateLabel() int val = mSlider->getValue() - mMin; if (val < 0) val = 0; - else if (val >= (signed)mValues->size()) - val = (signed)mValues->size() - 1; + else if (val >= static_cast(mValues->size())) + val = static_cast(mValues->size()) - 1; std::string str = mValues->at(val); mLabel2->setCaption(str); } diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index e207b0613..a90712340 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -183,7 +183,7 @@ int TextField::getValue() const if (value < mMinimum) return mMinimum; - if (value > (signed)mMaximum) + if (value > static_cast(mMaximum)) return mMaximum; return value; -- cgit v1.2.3-60-g2f50