From 2ed0917b4ee942ff55639500f846ae9cb4f48b90 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/net/ea/gui/partytab.cpp | 4 ++-- src/net/ea/network.h | 6 ++++-- src/net/ea/playerhandler.cpp | 2 +- src/net/ea/specialhandler.cpp | 4 ++-- src/net/eathena/chathandler.cpp | 4 ++-- src/net/eathena/playerhandler.cpp | 4 ++-- src/net/eathena/playerhandler.h | 2 +- src/net/playerhandler.h | 2 +- src/net/tmwa/chathandler.cpp | 4 ++-- src/net/tmwa/loginhandler.cpp | 10 +++++----- src/net/tmwa/playerhandler.cpp | 2 +- src/net/tmwa/playerhandler.h | 2 +- 12 files changed, 24 insertions(+), 22 deletions(-) (limited to 'src/net') 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(SKILL_FAILED) && bskill == static_cast(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(i)); + outMsg.writeInt8(static_cast(i)); else if (line.length() <= 5) outMsg.writeInt16(static_cast(i)); else @@ -210,7 +210,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line) switch (header[0]) { case '1': - outMsg.writeInt8(static_cast(i)); + outMsg.writeInt8(static_cast(i)); break; case '2': outMsg.writeInt16(static_cast(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(i)); + outMsg.writeInt8(static_cast(i)); else if (line.length() <= 5) outMsg.writeInt16(static_cast(i)); else @@ -210,7 +210,7 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line) switch (header[0]) { case '1': - outMsg.writeInt8(static_cast(i)); + outMsg.writeInt8(static_cast(i)); break; case '2': outMsg.writeInt16(static_cast(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); -- cgit v1.2.3-70-g09d2