summaryrefslogtreecommitdiff
path: root/src/guichan
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-07-18 01:51:36 +0300
committerAndrei Karas <akaras@inbox.ru>2012-07-18 01:51:36 +0300
commitf0e95132f27ceb901fbd779fafc798a1f67a06a6 (patch)
tree52ee9ab21f4e01c2c8ae70b86841b0138349645d /src/guichan
parent7e0a97d2521b9ce57003176e82a0b5564aa003c2 (diff)
downloadplus-f0e95132f27ceb901fbd779fafc798a1f67a06a6.tar.gz
plus-f0e95132f27ceb901fbd779fafc798a1f67a06a6.tar.bz2
plus-f0e95132f27ceb901fbd779fafc798a1f67a06a6.tar.xz
plus-f0e95132f27ceb901fbd779fafc798a1f67a06a6.zip
Another warning fixes.
Diffstat (limited to 'src/guichan')
-rw-r--r--src/guichan/defaultfont.cpp4
-rw-r--r--src/guichan/focushandler.cpp4
-rw-r--r--src/guichan/font.cpp2
-rw-r--r--src/guichan/include/guichan/platform.hpp6
-rw-r--r--src/guichan/widgets/textbox.cpp23
-rw-r--r--src/guichan/widgets/textfield.cpp4
6 files changed, 22 insertions, 21 deletions
diff --git a/src/guichan/defaultfont.cpp b/src/guichan/defaultfont.cpp
index feeb91001..8d0b23623 100644
--- a/src/guichan/defaultfont.cpp
+++ b/src/guichan/defaultfont.cpp
@@ -64,7 +64,7 @@ namespace gcn
int DefaultFont::getWidth(const std::string& text) const
{
- return 8*text.size();
+ return static_cast<int>(8 * text.size());
}
int DefaultFont::drawGlyph(Graphics* graphics,
@@ -88,7 +88,7 @@ namespace gcn
int DefaultFont::getStringIndexAt(const std::string& text, int x) const
{
if (x > static_cast<int>(text.size() * 8))
- return text.size();
+ return static_cast<int>(text.size());
return x / 8;
}
diff --git a/src/guichan/focushandler.cpp b/src/guichan/focushandler.cpp
index 839c35cc1..393c08880 100644
--- a/src/guichan/focushandler.cpp
+++ b/src/guichan/focushandler.cpp
@@ -235,7 +235,7 @@ namespace gcn
-- i;
if (focusedWidget <= 0)
- focusedWidget = mWidgets.size() - 1;
+ focusedWidget = static_cast<int>(mWidgets.size() - 1);
if (focusedWidget == focused)
return;
@@ -433,7 +433,7 @@ namespace gcn
-- i;
if (focusedWidget <= 0)
- focusedWidget = mWidgets.size() - 1;
+ focusedWidget = static_cast<int>(mWidgets.size() - 1);
if (focusedWidget == focused)
return;
diff --git a/src/guichan/font.cpp b/src/guichan/font.cpp
index 598b1610b..6fec94121 100644
--- a/src/guichan/font.cpp
+++ b/src/guichan/font.cpp
@@ -62,6 +62,6 @@ namespace gcn
return i;
}
- return text.size();
+ return static_cast<int>(text.size());
}
}
diff --git a/src/guichan/include/guichan/platform.hpp b/src/guichan/include/guichan/platform.hpp
index 9a18191d2..9e3d1338a 100644
--- a/src/guichan/include/guichan/platform.hpp
+++ b/src/guichan/include/guichan/platform.hpp
@@ -73,8 +73,8 @@
#define GCN_EXTENSION_DECLSPEC
#endif
-#ifndef NULL
-#define NULL 0
-#endif
+//#ifndef NULL
+//#define NULL 0
+//#endif
#endif // end GCN_PLATFORM_HPP
diff --git a/src/guichan/widgets/textbox.cpp b/src/guichan/widgets/textbox.cpp
index 0103cdb99..6b03a1cb5 100644
--- a/src/guichan/widgets/textbox.cpp
+++ b/src/guichan/widgets/textbox.cpp
@@ -100,9 +100,9 @@ namespace gcn
pos = text.find("\n", lastPos);
if (pos != std::string::npos)
- length = pos - lastPos;
+ length = static_cast<int>(pos - lastPos);
else
- length = text.size() - lastPos;
+ length = static_cast<int>(text.size() - lastPos);
std::string sub = text.substr(lastPos, length);
mTextRows.push_back(sub);
lastPos = pos + 1;
@@ -133,7 +133,8 @@ namespace gcn
for (size_t i = 0; i < mTextRows.size(); i++)
{
// Move the text one pixel so we can have a caret before a letter.
- graphics->drawText(mTextRows[i], 1, i * getFont()->getHeight());
+ graphics->drawText(mTextRows[i], 1,
+ static_cast<int>(i * getFont()->getHeight()));
}
}
@@ -150,7 +151,7 @@ namespace gcn
mCaretRow = mouseEvent.getY() / getFont()->getHeight();
if (mCaretRow >= static_cast<int>(mTextRows.size()))
- mCaretRow = mTextRows.size() - 1;
+ mCaretRow = static_cast<int>(mTextRows.size() - 1);
mCaretColumn = getFont()->getStringIndexAt(
mTextRows[mCaretRow], mouseEvent.getX());
@@ -177,7 +178,7 @@ namespace gcn
}
setWidth(width + 1);
- setHeight(getFont()->getHeight() * mTextRows.size());
+ setHeight(static_cast<int>(getFont()->getHeight() * mTextRows.size()));
}
void TextBox::setCaretPosition(unsigned int position)
@@ -197,8 +198,8 @@ namespace gcn
}
// position beyond end of text
- mCaretRow = mTextRows.size() - 1;
- mCaretColumn = mTextRows[mCaretRow].size();
+ mCaretRow = static_cast<int>(mTextRows.size() - 1);
+ mCaretColumn = static_cast<int>(mTextRows[mCaretRow].size());
}
unsigned int TextBox::getCaretPosition() const
@@ -206,7 +207,7 @@ namespace gcn
int pos = 0, row;
for (row = 0; row < mCaretRow; row++)
- pos += mTextRows[row].size();
+ pos += static_cast<int>(mTextRows[row].size());
return pos + mCaretColumn;
}
@@ -222,7 +223,7 @@ namespace gcn
mCaretRow = row;
if (mCaretRow >= static_cast<int>(mTextRows.size()))
- mCaretRow = mTextRows.size() - 1;
+ mCaretRow = static_cast<int>(mTextRows.size() - 1);
if (mCaretRow < 0)
mCaretRow = 0;
@@ -240,7 +241,7 @@ namespace gcn
mCaretColumn = column;
if (mCaretColumn > static_cast<int>(mTextRows[mCaretRow].size()))
- mCaretColumn = mTextRows[mCaretRow].size();
+ mCaretColumn = static_cast<int>(mTextRows[mCaretRow].size());
if (mCaretColumn < 0)
mCaretColumn = 0;
@@ -268,7 +269,7 @@ namespace gcn
unsigned int TextBox::getNumberOfRows() const
{
- return mTextRows.size();
+ return static_cast<int>(mTextRows.size());
}
std::string TextBox::getText() const
diff --git a/src/guichan/widgets/textfield.cpp b/src/guichan/widgets/textfield.cpp
index b23722cc4..b74d2333f 100644
--- a/src/guichan/widgets/textfield.cpp
+++ b/src/guichan/widgets/textfield.cpp
@@ -83,7 +83,7 @@ namespace gcn
void TextField::setText(const std::string& text)
{
if (text.size() < mCaretPosition)
- mCaretPosition = text.size();
+ mCaretPosition = static_cast<int>(text.size());
mText = text;
}
@@ -151,7 +151,7 @@ namespace gcn
void TextField::setCaretPosition(unsigned int position)
{
if (position > mText.size())
- mCaretPosition = mText.size();
+ mCaretPosition = static_cast<int>(mText.size());
else
mCaretPosition = position;