summaryrefslogtreecommitdiff
path: root/src/net
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 /src/net
parent185a53c504a0d53e54a7425ea829b5c951661ea8 (diff)
downloadplus-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.gz
plus-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.bz2
plus-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.xz
plus-c3434fa53d1c83bc65b640951364f842fe6c79f4.zip
Fix some signed/unsigned chars issues.
Diffstat (limited to 'src/net')
-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
12 files changed, 24 insertions, 22 deletions
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);