summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-16 00:27:51 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-16 00:27:51 +0300
commitc3434fa53d1c83bc65b640951364f842fe6c79f4 (patch)
tree51aa552c585518d7b2e2d67eba7c9500065dae05
parent185a53c504a0d53e54a7425ea829b5c951661ea8 (diff)
downloadplus-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.gz
plus-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.bz2
plus-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.xz
plus-c3434fa53d1c83bc65b640951364f842fe6c79f4.zip
Fix some signed/unsigned chars issues.
-rw-r--r--src/being.cpp2
-rw-r--r--src/being.h2
-rw-r--r--src/dropshortcut.cpp2
-rw-r--r--src/gui/palette.cpp2
-rw-r--r--src/gui/palette.h4
-rw-r--r--src/gui/theme.cpp2
-rw-r--r--src/gui/theme.h3
-rw-r--r--src/gui/userpalette.cpp2
-rw-r--r--src/gui/whoisonline.cpp5
-rw-r--r--src/gui/widgets/browserbox.cpp4
-rw-r--r--src/gui/widgets/textbox.cpp2
-rw-r--r--src/itemshortcut.cpp2
-rw-r--r--src/localplayer.cpp8
-rw-r--r--src/net/ea/gui/partytab.cpp4
-rw-r--r--src/net/ea/network.h6
-rw-r--r--src/net/ea/playerhandler.cpp2
-rw-r--r--src/net/ea/specialhandler.cpp4
-rw-r--r--src/net/eathena/chathandler.cpp4
-rw-r--r--src/net/eathena/playerhandler.cpp4
-rw-r--r--src/net/eathena/playerhandler.h2
-rw-r--r--src/net/playerhandler.h2
-rw-r--r--src/net/tmwa/chathandler.cpp4
-rw-r--r--src/net/tmwa/loginhandler.cpp10
-rw-r--r--src/net/tmwa/playerhandler.cpp2
-rw-r--r--src/net/tmwa/playerhandler.h2
-rw-r--r--src/particle.cpp10
-rw-r--r--src/particle.h6
-rw-r--r--src/particleemitter.cpp10
-rw-r--r--src/particleemitter.h2
-rw-r--r--src/playerinfo.cpp2
-rw-r--r--src/resources/dye.cpp2
-rw-r--r--src/resources/dye.h2
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/iteminfo.cpp2
-rw-r--r--src/utils/base64.cpp2
-rw-r--r--src/utils/copynpaste.cpp3
-rw-r--r--src/utils/stringutils.cpp16
-rw-r--r--src/utils/stringutils.h10
38 files changed, 82 insertions, 73 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 6be9effb4..210736117 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -1521,7 +1521,7 @@ void Being::drawSpeech(const int offsetX, const int offsetY)
}
/** TODO: eAthena only */
-int Being::getOffset(const char pos, const char neg) const
+int Being::getOffset(const signed char pos, const signed char neg) const
{
// Check whether we're walking in the requested direction
if (mAction != MOVE || !(mDirection & (pos | neg)))
diff --git a/src/being.h b/src/being.h
index 438707567..a9ccba82e 100644
--- a/src/being.h
+++ b/src/being.h
@@ -922,7 +922,7 @@ class Being : public ActorSprite, public ConfigListener
* If walking in direction 'neg' the value is negated.
* TODO: Used by eAthena only?
*/
- int getOffset(const char pos, const char neg) const;
+ int getOffset(const signed char pos, const signed char neg) const;
int searchSlotValue(std::vector<int> &slotRemap, const int val) const;
diff --git a/src/dropshortcut.cpp b/src/dropshortcut.cpp
index 6fe67ce06..1117ec16f 100644
--- a/src/dropshortcut.cpp
+++ b/src/dropshortcut.cpp
@@ -63,7 +63,7 @@ void DropShortcut::load(const bool oldConfig)
for (int i = 0; i < DROP_SHORTCUT_ITEMS; i++)
{
const int itemId = cfg->getValue("drop" + toString(i), -1);
- const unsigned char itemColor = static_cast<unsigned char>(
+ const unsigned char itemColor = static_cast<const unsigned char>(
cfg->getValue("dropColor" + toString(i), -1));
if (itemId != -1)
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<char>(tolower(typeName[i]));
+ res[pos] = static_cast<signed char>(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<char>(255), level, GENDER_UNSPECIFIED, -1);
+ static_cast<signed char>(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<WhoIsOnline *>(stream);
const size_t totalMem = size * nmemb;
wio->mMemoryBuffer = static_cast<char*>(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<char>(key.getValue())));
+ std::string(1, static_cast<signed char>(key.getValue())));
++ mCaretColumn;
}
break;
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 132fbc619..773df7e10 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -74,7 +74,7 @@ void ItemShortcut::load(const bool oldConfig)
for (unsigned int i = 0; i < SHORTCUT_ITEMS; i++)
{
const int itemId = cfg->getValue(name + toString(i), -1);
- const unsigned char itemColor = static_cast<unsigned char>(
+ const unsigned char itemColor = static_cast<const unsigned char>(
cfg->getValue(color + toString(i), 1));
mItems[i] = itemId;
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index bc201359a..f3a45bdeb 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -2054,7 +2054,7 @@ std::string LocalPlayer::getQuickDropCounterString()
{
if (mQuickDropCounter > 9)
{
- return strprintf("(%c) drop counter %u", static_cast<char>(
+ return strprintf("(%c) drop counter %u", static_cast<signed char>(
'a' + mQuickDropCounter - 10), mQuickDropCounter);
}
else
@@ -2758,7 +2758,7 @@ void LocalPlayer::crazyMoveA()
int dx = 0;
int dy = 0;
- char param = mMoveProgram[mCrazyMoveState++];
+ signed char param = mMoveProgram[mCrazyMoveState++];
if (param == '?')
{
const char cmd[] = {'l', 'r', 'u', 'd'};
@@ -2813,7 +2813,7 @@ void LocalPlayer::crazyMoveA()
if (mCrazyMoveState < mMoveProgram.length())
{
- char param = mMoveProgram[mCrazyMoveState++];
+ signed char param = mMoveProgram[mCrazyMoveState++];
if (param == '?')
{
const char cmd[] = {'l', 'r', 'u', 'd'};
@@ -2952,7 +2952,7 @@ void LocalPlayer::crazyMoveA()
else if (mMoveProgram[mCrazyMoveState] == 'e')
{
mCrazyMoveState ++;
- const char emo = mMoveProgram[mCrazyMoveState];
+ const signed char emo = mMoveProgram[mCrazyMoveState];
if (emo == '?')
{
srand(tick_time);
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index cc2c653b6..198cfea33 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -164,7 +164,7 @@ bool PartyTab::handleCommand(const std::string &type, const std::string &args)
}
}
- const char opt = CommandHandler::parseBoolean(args);
+ const signed char opt = CommandHandler::parseBoolean(args);
switch (opt)
{
@@ -203,7 +203,7 @@ bool PartyTab::handleCommand(const std::string &type, const std::string &args)
}
}
- const char opt = CommandHandler::parseBoolean(args);
+ const signed char opt = CommandHandler::parseBoolean(args);
switch (opt)
{
diff --git a/src/net/ea/network.h b/src/net/ea/network.h
index deb770dba..4fbf0ebbe 100644
--- a/src/net/ea/network.h
+++ b/src/net/ea/network.h
@@ -96,8 +96,10 @@ class Network
ServerInfo mServer;
- char *mInBuffer, *mOutBuffer;
- unsigned int mInSize, mOutSize;
+ char *mInBuffer;
+ char *mOutBuffer;
+ unsigned int mInSize;
+ unsigned int mOutSize;
unsigned int mToSkip;
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index de687e96b..0beea449f 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -91,7 +91,7 @@ namespace
static const char *randomDeathMessage()
{
- static char const *const deadMsg[] =
+ static const char *const deadMsg[] =
{
N_("You are dead."),
N_("We regret to inform you that your character was killed in "
diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp
index 7bb69954f..527437f84 100644
--- a/src/net/ea/specialhandler.cpp
+++ b/src/net/ea/specialhandler.cpp
@@ -127,8 +127,8 @@ void SpecialHandler::processSkillFailed(Net::MessageIn &msg)
const int skillId = msg.readInt16();
const short bskill = msg.readInt16();
msg.readInt16(); // btype
- const char success = msg.readInt8();
- const char reason = msg.readInt8();
+ const signed char success = msg.readInt8();
+ const signed char reason = msg.readInt8();
if (success != static_cast<int>(SKILL_FAILED)
&& bskill == static_cast<int>(BSKILL_EMOTE))
{
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index bd516ef26..679cdefc2 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -181,7 +181,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line)
{
const int i = atoi(line.c_str());
if (line.length() <= 3)
- outMsg.writeInt8(static_cast<char>(i));
+ outMsg.writeInt8(static_cast<unsigned char>(i));
else if (line.length() <= 5)
outMsg.writeInt16(static_cast<short>(i));
else
@@ -210,7 +210,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line)
switch (header[0])
{
case '1':
- outMsg.writeInt8(static_cast<char>(i));
+ outMsg.writeInt8(static_cast<unsigned char>(i));
break;
case '2':
outMsg.writeInt16(static_cast<short>(i));
diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp
index 0d4a51bc9..f7a2dccb6 100644
--- a/src/net/eathena/playerhandler.cpp
+++ b/src/net/eathena/playerhandler.cpp
@@ -168,7 +168,7 @@ void PlayerHandler::pickUp(const FloorItem *floorItem)
handler->pushPickup(floorItem->getId());
}
-void PlayerHandler::setDirection(char direction)
+void PlayerHandler::setDirection(unsigned char direction)
{
MessageOut outMsg(CMSG_PLAYER_CHANGE_DIR);
outMsg.writeInt16(0);
@@ -185,7 +185,7 @@ void PlayerHandler::setDestination(int x, int y, int direction)
void PlayerHandler::changeAction(Being::Action action)
{
- char type;
+ unsigned char type;
switch (action)
{
case Being::SIT:
diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h
index 80d905460..ca2dc3fc3 100644
--- a/src/net/eathena/playerhandler.h
+++ b/src/net/eathena/playerhandler.h
@@ -50,7 +50,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler
void increaseSkill(unsigned short skillId);
void pickUp(const FloorItem *floorItem);
- void setDirection(char direction);
+ void setDirection(unsigned char direction);
void setDestination(int x, int y, int direction = -1);
void changeAction(Being::Action action);
void updateStatus(uint8_t status);
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index 8c77c356c..66193eedc 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -50,7 +50,7 @@ class PlayerHandler
virtual void pickUp(const FloorItem *floorItem) = 0;
- virtual void setDirection(char direction) = 0;
+ virtual void setDirection(unsigned char direction) = 0;
virtual void setDestination(int x, int y, int direction = -1) = 0;
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 3c9f335a9..ef6ff2847 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -181,7 +181,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line)
{
const int i = atoi(line.c_str());
if (line.length() <= 3)
- outMsg.writeInt8(static_cast<char>(i));
+ outMsg.writeInt8(static_cast<unsigned char>(i));
else if (line.length() <= 5)
outMsg.writeInt16(static_cast<short>(i));
else
@@ -210,7 +210,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line)
switch (header[0])
{
case '1':
- outMsg.writeInt8(static_cast<char>(i));
+ outMsg.writeInt8(static_cast<unsigned char>(i));
break;
case '2':
outMsg.writeInt16(static_cast<short>(i));
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index f8daecf20..eb0364d44 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -159,11 +159,11 @@ void LoginHandler::requestUpdateHosts()
void LoginHandler::processServerVersion(Net::MessageIn &msg)
{
- const char b1 = msg.readInt8(); // -1
- const char b2 = msg.readInt8(); // E
- const char b3 = msg.readInt8(); // V
- const char b4 = msg.readInt8(); // L
- if (b1 == -1 && b2 == 'E' && b3 == 'V' && b4 == 'L')
+ const uint8_t b1 = msg.readInt8(); // -1
+ const uint8_t b2 = msg.readInt8(); // E
+ const uint8_t b3 = msg.readInt8(); // V
+ const uint8_t b4 = msg.readInt8(); // L
+ if (b1 == 255 && b2 == 'E' && b3 == 'V' && b4 == 'L')
{
const unsigned int options = msg.readInt8();
mRegistrationEnabled = options;
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 963f4839d..1067418e2 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -162,7 +162,7 @@ void PlayerHandler::pickUp(const FloorItem *floorItem)
handler->pushPickup(floorItem->getId());
}
-void PlayerHandler::setDirection(char direction)
+void PlayerHandler::setDirection(unsigned char direction)
{
MessageOut outMsg(CMSG_PLAYER_CHANGE_DIR);
outMsg.writeInt16(0);
diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h
index 6c342785c..90a25fb79 100644
--- a/src/net/tmwa/playerhandler.h
+++ b/src/net/tmwa/playerhandler.h
@@ -50,7 +50,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler
void increaseSkill(unsigned short skillId);
void pickUp(const FloorItem *floorItem);
- void setDirection(char direction);
+ void setDirection(unsigned char direction);
void setDestination(int x, int y, int direction = -1);
void changeAction(Being::Action action);
void processOnlineList(Net::MessageIn &msg);
diff --git a/src/particle.cpp b/src/particle.cpp
index 4a59810d4..e962c6980 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -379,27 +379,27 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
char deathEffectConditions = 0x00;
if (XML::getBoolProperty(emitterNode, "on-floor", true))
{
- deathEffectConditions += static_cast<char>(
+ deathEffectConditions += static_cast<signed char>(
Particle::DEAD_FLOOR);
}
if (XML::getBoolProperty(emitterNode, "on-sky", true))
{
- deathEffectConditions += static_cast<char>(
+ deathEffectConditions += static_cast<signed char>(
Particle::DEAD_SKY);
}
if (XML::getBoolProperty(emitterNode, "on-other", false))
{
- deathEffectConditions += static_cast<char>(
+ deathEffectConditions += static_cast<signed char>(
Particle::DEAD_OTHER);
}
if (XML::getBoolProperty(emitterNode, "on-impact", true))
{
- deathEffectConditions += static_cast<char>(
+ deathEffectConditions += static_cast<signed char>(
Particle::DEAD_IMPACT);
}
if (XML::getBoolProperty(emitterNode, "on-timeout", true))
{
- deathEffectConditions += static_cast<char>(
+ deathEffectConditions += static_cast<signed char>(
Particle::DEAD_TIMEOUT);
}
newParticle->setDeathEffect(
diff --git a/src/particle.h b/src/particle.h
index 821be8baa..4dc419aea 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -291,7 +291,7 @@ class Particle : public Actor
{ }
virtual void setDeathEffect(const std::string &effectFile,
- const char conditions)
+ const signed char conditions)
{ mDeathEffect = effectFile; mDeathEffectConditions = conditions; }
protected:
@@ -318,8 +318,8 @@ class Particle : public Actor
the object props in the map file? */
std::string mDeathEffect; /**< Particle effect file to be spawned
when the particle dies */
- char mDeathEffectConditions; /**< Bitfield of death conditions which
- trigger spawning of the death
+ signed char mDeathEffectConditions; /**< Bitfield of death conditions
+ which trigger spawning of the death
particle */
// dynamic particle
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 2a303d4d1..ea03d7b48 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -372,27 +372,27 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode,
mDeathEffectConditions = 0x00;
if (XML::getBoolProperty(propertyNode, "on-floor", true))
{
- mDeathEffectConditions += static_cast<char>(
+ mDeathEffectConditions += static_cast<signed char>(
Particle::DEAD_FLOOR);
}
if (XML::getBoolProperty(propertyNode, "on-sky", true))
{
- mDeathEffectConditions += static_cast<char>(
+ mDeathEffectConditions += static_cast<signed char>(
Particle::DEAD_SKY);
}
if (XML::getBoolProperty(propertyNode, "on-other", false))
{
- mDeathEffectConditions += static_cast<char>(
+ mDeathEffectConditions += static_cast<signed char>(
Particle::DEAD_OTHER);
}
if (XML::getBoolProperty(propertyNode, "on-impact", true))
{
- mDeathEffectConditions += static_cast<char>(
+ mDeathEffectConditions += static_cast<signed char>(
Particle::DEAD_IMPACT);
}
if (XML::getBoolProperty(propertyNode, "on-timeout", true))
{
- mDeathEffectConditions += static_cast<char>(
+ mDeathEffectConditions += static_cast<signed char>(
Particle::DEAD_TIMEOUT);
}
}
diff --git a/src/particleemitter.h b/src/particleemitter.h
index a9bf44b45..a3657c1b3 100644
--- a/src/particleemitter.h
+++ b/src/particleemitter.h
@@ -145,7 +145,7 @@ class ParticleEmitter final
* Death effect of the particles
*/
std::string mDeathEffect;
- char mDeathEffectConditions;
+ signed char mDeathEffectConditions;
/** List of emitters the spawned particles are equipped with */
std::list<ParticleEmitter> mParticleChildEmitters;
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp
index 04a5ba178..6e75b1500 100644
--- a/src/playerinfo.cpp
+++ b/src/playerinfo.cpp
@@ -51,7 +51,7 @@ Inventory *mInventory = nullptr;
Equipment *mEquipment = nullptr;
std::map<int, Special> mSpecials;
-char mSpecialRechargeUpdateNeeded = 0;
+signed char mSpecialRechargeUpdateNeeded = 0;
bool mTrading = false;
int mLevelProgress = 0;
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 4b5c1268c..62be4e09e 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -72,7 +72,7 @@ DyePalette::DyePalette(const std::string &description, const int8_t blockSize)
logger->log("Error, invalid embedded palette: %s", description.c_str());
}
-int DyePalette::hexDecode(const char c)
+int DyePalette::hexDecode(const signed char c)
{
if ('0' <= c && c <= '9')
return c - '0';
diff --git a/src/resources/dye.h b/src/resources/dye.h
index d3960f04c..400010f37 100644
--- a/src/resources/dye.h
+++ b/src/resources/dye.h
@@ -80,7 +80,7 @@ class DyePalette final
*/
void replaceAOGLColor(uint8_t *const color) const;
- static int hexDecode(const char c);
+ static int hexDecode(const signed char c);
private:
struct Color
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 559015be9..f2e07ce48 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -56,7 +56,7 @@ static void loadOrderSprite(ItemInfo *const itemInfo, const XmlNodePtr node,
static int parseSpriteName(std::string name);
static int parseDirectionName(std::string name);
-static char const *const fields[][2] =
+static const char *const fields[][2] =
{
{ "attack", N_("Attack %+d") },
{ "defense", N_("Defense %+d") },
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index eb85e5c9e..c0fb962c7 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -206,7 +206,7 @@ const std::string ItemInfo::replaceColors(std::string str,
str = replaceAll(str, "%color%", name);
if (!name.empty())
- name[0] = static_cast<char>(toupper(name[0]));
+ name[0] = static_cast<signed char>(toupper(name[0]));
return replaceAll(str, "%Color%", name);
}
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp
index 52c6821fd..fe3d1cb90 100644
--- a/src/utils/base64.cpp
+++ b/src/utils/base64.cpp
@@ -50,7 +50,7 @@ unsigned char *php3_base64_encode(const unsigned char *const string,
const unsigned char *current = string;
int i = 0;
unsigned char *const result = static_cast<unsigned char *>(calloc(
- ((length + 3 - length % 3) * 4 / 3 + 1) * sizeof(char), 1));
+ ((length + 3 - length % 3) * 4 / 3 + 1) * sizeof(unsigned char), 1));
while (length > 2)
{ /* keep going until we have less than 24 bits */
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index 2b7acc0e1..5d7c32e29 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -196,7 +196,8 @@ bool getDataFromPasteboard(PasteboardRef inPasteboard,
for (short dataIndex = 0; dataIndex <= flavorDataSize;
dataIndex ++)
{
- char byte = *(CFDataGetBytePtr(flavorData) + dataIndex);
+ signed char byte = *(CFDataGetBytePtr(
+ flavorData) + dataIndex);
flavorText[dataIndex] = byte;
}
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index c201e9593..e28013320 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -87,7 +87,7 @@ const char *ipToString(const int address)
return asciiIP;
}
-std::string strprintf(char const *const format, ...)
+std::string strprintf(const char *const format, ...)
{
char buf[257];
va_list(args);
@@ -161,7 +161,7 @@ int compareStrI(const std::string &a, const std::string &b)
}
-bool isWordSeparator(const char chr)
+bool isWordSeparator(const signed char chr)
{
return (chr == ' ' || chr == ',' || chr == '.' || chr == '"');
}
@@ -229,13 +229,13 @@ const std::string encodeStr(unsigned int value, const unsigned int size)
do
{
- buf += static_cast<char>(value % base + start);
+ buf += static_cast<signed char>(value % base + start);
value /= base;
}
while (value);
while (buf.length() < size)
- buf += static_cast<char>(start);
+ buf += static_cast<signed char>(start);
return buf;
}
@@ -393,7 +393,7 @@ void replaceSpecialChars(std::string &text)
if (idx + 1 < f && text[f] == ';')
{
std::string str = " ";
- str[0] = static_cast<char>(atoi(text.substr(
+ str[0] = static_cast<signed char>(atoi(text.substr(
idx, f - idx).c_str()));
text = text.substr(0, pos1) + str + text.substr(f + 1);
pos1 += 1;
@@ -413,7 +413,8 @@ std::string normalize(const std::string &name)
return toLower(trim(normalized));
}
-std::set<int> splitToIntSet(const std::string &text, const char separator)
+std::set<int> splitToIntSet(const std::string &text,
+ const char separator)
{
std::set<int> tokens;
std::stringstream ss(text);
@@ -424,7 +425,8 @@ std::set<int> splitToIntSet(const std::string &text, const char separator)
return tokens;
}
-std::list<int> splitToIntList(const std::string &text, const char separator)
+std::list<int> splitToIntList(const std::string &text,
+ const char separator)
{
std::list<int> tokens;
std::stringstream ss(text);
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 582f7f8ed..9355e1720 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -93,7 +93,7 @@ const char *ipToString(const int address);
/**
* A safe version of sprintf that returns a std::string of the result.
*/
-std::string strprintf(char const *const format, ...)
+std::string strprintf(const char *const format, ...)
#ifdef __GNUC__
/* This attribute is nice: it even works through gettext invokation. For
example, gcc will complain that strprintf(_("%s"), 42) is ill-formed. */
@@ -136,7 +136,7 @@ int compareStrI(const std::string &a, const std::string &b);
/**
* Tells wether the character is a word separator.
*/
-bool isWordSeparator(const char chr);
+bool isWordSeparator(const signed char chr);
size_t findI(std::string str, std::string subStr);
@@ -176,9 +176,11 @@ void replaceSpecialChars(std::string &text);
*/
std::string normalize(const std::string &name);
-std::set<int> splitToIntSet(const std::string &text, const char separator);
+std::set<int> splitToIntSet(const std::string &text,
+ const char separator);
-std::list<int> splitToIntList(const std::string &text, const char separator);
+std::list<int> splitToIntList(const std::string &text,
+ const char separator);
std::list<std::string> splitToStringList(const std::string &text,
const char separator);