diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/slider.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/tab.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/textbox.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.cpp | 2 |
7 files changed, 19 insertions, 18 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 5ef7adfcd..6b5263aa9 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -105,7 +105,9 @@ void BrowserBox::addRow(const std::string &row, bool atTop) { std::string tmp = row; std::string newRow; - std::string::size_type idx1, idx2, idx3; + size_t idx1; + size_t idx2; + size_t idx3; gcn::Font *font = getFont(); if (getWidth() < 0) @@ -479,7 +481,7 @@ int BrowserBox::calcHeight() // TODO: Check if we must take texture size limits into account here // TODO: Check if some of the O(n) calls can be removed - for (std::string::size_type start = 0, end = std::string::npos; + for (size_t start = 0, end = std::string::npos; start != std::string::npos; start = end, end = std::string::npos) { @@ -566,8 +568,7 @@ int BrowserBox::calcHeight() } } - std::string::size_type len = - end == std::string::npos ? end : end - start; + size_t len = (end == std::string::npos) ? end : end - start; if (start >= row.length()) break; diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 5f1b02d98..9b3a00963 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -116,7 +116,7 @@ void ChatTab::chatLog(std::string line, Own own, tmp.nick = ""; tmp.text = line; - std::string::size_type pos = line.find(" : "); + size_t pos = line.find(" : "); if (pos != std::string::npos) { if (line.length() <= pos + 3) @@ -343,11 +343,11 @@ void ChatTab::chatInput(const std::string &message) return; // Check for item link - std::string::size_type start = msg.find('['); + size_t start = msg.find('['); while (start + 1 < msg.size() && start != std::string::npos && msg[start + 1] != '@') { - std::string::size_type end = msg.find(']', start); + size_t end = msg.find(']', start); if (start + 1 != end && end != std::string::npos) { // Catch multiple embeds and ignore them @@ -440,9 +440,9 @@ int ChatTab::getType() const void ChatTab::addRow(std::string &line) { - std::string::size_type idx = 0; + size_t idx = 0; - for (unsigned int f = 0; f < line.length(); f++) + for (size_t f = 0; f < line.length(); f++) { if (line.at(f) == ' ') { diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index c6b57858c..7142cd202 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -228,7 +228,7 @@ void Slider::updateAlpha() void Slider::draw(gcn::Graphics *graphics) { - if (!hStart || !hStartHi) + if (!hStart || !hStartHi || !hEnd) return; int w = getWidth(); @@ -253,8 +253,7 @@ void Slider::draw(gcn::Graphics *graphics) } x += w; - if (hEnd) - static_cast<Graphics*>(graphics)->drawImage(hEnd, x, y); + static_cast<Graphics*>(graphics)->drawImage(hEnd, x, y); } else { diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index c09fb423d..4dbfe45e4 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -129,8 +129,7 @@ void Tab::init() a++; } } - if (tab[mode]) - tab[mode]->decRef(); + tab[mode]->decRef(); } } mInstances++; diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 575036612..01cb4bddb 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -48,7 +48,9 @@ void TextBox::setTextWrapped(const std::string &text, int minDimension) mMinWidth = minDimension; std::stringstream wrappedStream; - std::string::size_type spacePos, newlinePos, lastNewlinePos = 0; + size_t spacePos; + size_t newlinePos; + size_t lastNewlinePos = 0; int minWidth = 0; int xpos; @@ -73,7 +75,7 @@ void TextBox::setTextWrapped(const std::string &text, int minDimension) std::string line = text.substr(lastNewlinePos, newlinePos - lastNewlinePos); - std::string::size_type lastSpacePos = 0; + size_t lastSpacePos = 0; xpos = 0; do diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index a90712340..7892b3c0d 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -365,7 +365,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) void TextField::handlePaste() { std::string text = getText(); - std::string::size_type caretPos = getCaretPosition(); + size_t caretPos = getCaretPosition(); if (retrieveBuffer(text, caretPos)) { diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index 007002e21..2b3b0436f 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -82,7 +82,7 @@ void WhisperTab::handleCommand(const std::string &msg) return; } - std::string::size_type pos = msg.find(' '); + size_t pos = msg.find(' '); std::string type(msg, 0, pos); std::string args(msg, pos == std::string::npos ? msg.size() : pos + 1); |