From c3434fa53d1c83bc65b640951364f842fe6c79f4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 16 Oct 2012 00:27:51 +0300 Subject: Fix some signed/unsigned chars issues. --- src/gui/palette.cpp | 2 +- src/gui/palette.h | 4 ++-- src/gui/theme.cpp | 2 +- src/gui/theme.h | 3 ++- src/gui/userpalette.cpp | 2 +- src/gui/whoisonline.cpp | 5 +++-- src/gui/widgets/browserbox.cpp | 4 ++-- src/gui/widgets/textbox.cpp | 2 +- 8 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/gui') diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index 94604c128..558a977b5 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -64,7 +64,7 @@ Palette::~Palette() mInstances.erase(this); } -const gcn::Color& Palette::getColor(const char c, bool &valid) +const gcn::Color& Palette::getColor(const signed char c, bool &valid) { const CharColors::const_iterator it = mCharColors.find(c); if (it != mCharColors.end()) diff --git a/src/gui/palette.h b/src/gui/palette.h index 8fae00d6a..ed9b14e22 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -67,7 +67,7 @@ class Palette * * @return the requested color or Palette::BLACK */ - const gcn::Color &getColor(const char c, bool &valid); + const gcn::Color &getColor(const signed char c, bool &valid); /** * Gets the color associated with the type. Sets the alpha channel @@ -180,7 +180,7 @@ class Palette gcn::Color testColor; gcn::Color committedColor; std::string text; - char ch; + signed char ch; GradientType grad; GradientType committedGrad; int gradientIndex; diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 61b45232b..d13f04656 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -810,7 +810,7 @@ static gcn::Color readColor(const std::string &description) int v = 0; for (int i = 1; i < 7; ++i) { - const char c = description[i]; + signed const char c = description[i]; int n; if ('0' <= c && c <= '9') diff --git a/src/gui/theme.h b/src/gui/theme.h index 651bcb9bc..92ff6073b 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -284,7 +284,8 @@ class Theme final : public Palette, public ConfigListener const int alpha = 255) { return mInstance->getColor(type, alpha); } - static const gcn::Color &getThemeColor(const char c, bool &valid) + static const gcn::Color &getThemeColor(const signed char c, + bool &valid) { return mInstance->getColor(c, valid); } static gcn::Color getProgressColor(const int type, diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index cb4aa3587..91530a451 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -93,7 +93,7 @@ std::string UserPalette::getConfigName(const std::string &typeName) } else { - res[pos] = static_cast(tolower(typeName[i])); + res[pos] = static_cast(tolower(typeName[i])); } pos ++; } diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 68ea0f67b..d71b595fe 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -411,7 +411,8 @@ void WhoIsOnline::loadWebList() level = 0; OnlinePlayer *player = new OnlinePlayer(nick, - static_cast(255), level, GENDER_UNSPECIFIED, -1); + static_cast(255), level, + GENDER_UNSPECIFIED, -1); mOnlinePlayers.insert(player); mOnlineNicks.insert(nick); @@ -477,7 +478,7 @@ size_t WhoIsOnline::memoryWrite(void *ptr, size_t size, WhoIsOnline *wio = reinterpret_cast(stream); const size_t totalMem = size * nmemb; wio->mMemoryBuffer = static_cast(realloc(wio->mMemoryBuffer, - wio->mDownloadedBytes + totalMem)); + wio->mDownloadedBytes + totalMem)); if (wio->mMemoryBuffer) { memcpy(&(wio->mMemoryBuffer[wio->mDownloadedBytes]), ptr, totalMem); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index cac2a53f2..e338ab009 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -421,7 +421,7 @@ int BrowserBox::calcHeight() const int fontHeight = font->getHeight(); const int fontWidthMinus = font->getWidth("-"); - char const *const hyphen = "~"; + const char *const hyphen = "~"; const int hyphenWidth = font->getWidth(hyphen); gcn::Color selColor = mForegroundColor; @@ -495,7 +495,7 @@ int BrowserBox::calcHeight() // Check for color change in format "##x", x = [L,P,0..9] if (row.find("##", start) == start && row.size() > start + 2) { - const char c = row.at(start + 2); + const signed char c = row.at(start + 2); bool valid; const gcn::Color col = Theme::getThemeColor(c, valid); diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 8af080294..cbefa4006 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -327,7 +327,7 @@ void TextBox::keyPressed(gcn::KeyEvent& keyEvent) if (key.isCharacter() && mEditable) { mTextRows[mCaretRow].insert(mCaretColumn, - std::string(1, static_cast(key.getValue()))); + std::string(1, static_cast(key.getValue()))); ++ mCaretColumn; } break; -- cgit v1.2.3-70-g09d2