summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net/eathena/network.cpp7
-rw-r--r--src/net/tmwa/network.cpp5
2 files changed, 9 insertions, 3 deletions
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp
index 5cfe0af1a..67018e7b5 100644
--- a/src/net/eathena/network.cpp
+++ b/src/net/eathena/network.cpp
@@ -218,7 +218,7 @@ MessageIn Network::getNextMessage()
SDL_mutexP(mMutex);
int msgId = readWord(0);
- int len;
+ int len = -1;
if (msgId == SMSG_SERVER_VERSION_RESPONSE)
{
len = 10;
@@ -229,8 +229,11 @@ MessageIn Network::getNextMessage()
}
else
{
- if (msgId >= 0 && msgId < sizeof(packet_lengths) / sizeof (short))
+ if (msgId >= 0 && msgId < static_cast<signed>(
+ sizeof(packet_lengths) / sizeof (short)))
+ {
len = packet_lengths[msgId];
+ }
}
if (len == -1)
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 98f6485a7..0492f6609 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -179,8 +179,11 @@ bool Network::messageReady()
}
else
{
- if (msgId >= 0 && msgId < sizeof(packet_lengths) / sizeof (short))
+ if (msgId >= 0 && msgId < static_cast<signed>(
+ sizeof(packet_lengths) / sizeof (short)))
+ {
len = packet_lengths[msgId];
+ }
}
if (len == -1 && mInSize > 4)