From ceff9177ea052c9e398fc9f337cf5320deba14ed Mon Sep 17 00:00:00 2001 From: David Athay Date: Mon, 13 Apr 2009 16:03:38 +0100 Subject: Fixed broken links --- src/gui/widgets/browserbox.cpp | 11 +++++++---- src/gui/widgets/chattab.cpp | 3 --- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 6b1cb434..603f2056 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -70,7 +70,7 @@ void BrowserBox::addRow(const std::string &row) std::string tmp = row; std::string newRow; BROWSER_LINK bLink; - int idx1, idx2, idx3; + std::string::size_type idx1, idx2, idx3; TrueTypeFont *font = static_cast(getFont()); // Use links and user defined colors @@ -78,10 +78,13 @@ void BrowserBox::addRow(const std::string &row) { // Check for links in format "@@link|Caption@@" idx1 = tmp.find("@@"); - while (idx1 >= 0) + while (idx1 != std::string::npos) { idx2 = tmp.find("|", idx1); idx3 = tmp.find("@@", idx2); + + if (idx2 == std::string::npos || idx3 == std::string::npos) + break; bLink.link = tmp.substr(idx1 + 2, idx2 - (idx1 + 2)); bLink.caption = tmp.substr(idx2 + 1, idx3 - (idx2 + 1)); bLink.y1 = mTextRows.size() * font->getHeight(); @@ -91,7 +94,7 @@ void BrowserBox::addRow(const std::string &row) std::string tmp2 = newRow; idx1 = tmp2.find("##"); - while (idx1 >= 0) + while (idx1 != std::string::npos) { tmp2.erase(idx1, 3); idx1 = tmp2.find("##"); @@ -143,7 +146,7 @@ void BrowserBox::addRow(const std::string &row) if (mMode == AUTO_SIZE) { std::string plain = newRow; - for (idx1 = plain.find("##"); idx1 >= 0; idx1 = plain.find("##")) + for (idx1 = plain.find("##"); idx1 != std::string::npos; idx1 = plain.find("##")) plain.erase(idx1, 3); // Adjust the BrowserBox size diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index bbf71e83..1879a918 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -163,9 +163,6 @@ void ChatTab::chatLog(std::string line, int own, bool ignoreRecord) tmp.nick = ""; lineColor = "##S"; } - - // check for @, # or [ in nick - tmp.nick = removeBadChars(tmp.nick); #ifdef EATHENA_SUPPORT if (tmp.nick.empty() && tmp.text.substr(0, 17) == "Visible GM status") -- cgit v1.2.3-70-g09d2