summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-02 13:32:17 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-02 13:32:17 +0300
commit641508260de553b89e6d077115513bfba69ef98e (patch)
tree962f906960707f65e6571387ce7ba568a2c574e9 /src
parent41ffafd17ad8f0a7ee060cc9f48bca04a1e16cb6 (diff)
downloadmv-641508260de553b89e6d077115513bfba69ef98e.tar.gz
mv-641508260de553b89e6d077115513bfba69ef98e.tar.bz2
mv-641508260de553b89e6d077115513bfba69ef98e.tar.xz
mv-641508260de553b89e6d077115513bfba69ef98e.zip
Fix compilation warnings with some compilers.
Diffstat (limited to 'src')
-rw-r--r--src/net/eathena/network.cpp8
-rw-r--r--src/net/tmwa/network.cpp13
2 files changed, 12 insertions, 9 deletions
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp
index 9b3ede389..d1d3cfdde 100644
--- a/src/net/eathena/network.cpp
+++ b/src/net/eathena/network.cpp
@@ -106,9 +106,9 @@ int16_t packet_lengths[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-static const int packet_lengths_size
- = static_cast<int>(sizeof(packet_lengths) / sizeof(int16_t));
-static const int messagesSize = 0xffff;
+static const unsigned int packet_lengths_size
+ = static_cast<unsigned int>(sizeof(packet_lengths) / sizeof(int16_t));
+static const unsigned int messagesSize = 0xFFFFU;
Network *Network::mInstance = nullptr;
Network::Network() :
@@ -150,7 +150,7 @@ void Network::unregisterHandler(MessageHandler *const handler)
void Network::clearHandlers()
{
- for (int f = 0; f < messagesSize; f ++)
+ for (size_t f = 0; f < messagesSize; f ++)
{
if (mMessageHandlers[f])
{
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 8f4b2452a..a9e5e9ee6 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -84,9 +84,9 @@ int16_t packet_lengths[] =
-1, 122, -1, -1, -1, -1, 10, -1, -1, 0, 0, 0, 0, 0, 0, 0,
};
-static const int packet_lengths_size
- = static_cast<int>(sizeof(packet_lengths) / sizeof(int16_t));
-static const int messagesSize = 0xffff;
+static const unsigned int packet_lengths_size
+ = static_cast<unsigned int>(sizeof(packet_lengths) / sizeof(int16_t));
+static const unsigned int messagesSize = 0xFFFFU;
Network *Network::mInstance = nullptr;
Network::Network() :
@@ -128,7 +128,7 @@ void Network::unregisterHandler(MessageHandler *const handler)
void Network::clearHandlers()
{
- for (int f = 0; f < messagesSize; f ++)
+ for (size_t f = 0; f < messagesSize; f ++)
{
if (mMessageHandlers[f])
{
@@ -204,8 +204,11 @@ bool Network::messageReady()
}
else
{
- if (msgId >= 0 && msgId < packet_lengths_size)
+ if (msgId >= 0 && static_cast<unsigned int>(msgId)
+ < packet_lengths_size)
+ {
len = packet_lengths[msgId];
+ }
}
if (len == -1 && mInSize > 4)