summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-08 22:47:17 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-08 22:47:17 +0300
commit3f9d0c023f3d84de0c68dbf9f7c29aa1b0abb9c9 (patch)
tree93589fc3f913324254ad543481691565e0baf67e /src/net/ea
parent8daa939a45794c26a33e109c13c4d6f58a46e00e (diff)
downloadmv-3f9d0c023f3d84de0c68dbf9f7c29aa1b0abb9c9.tar.gz
mv-3f9d0c023f3d84de0c68dbf9f7c29aa1b0abb9c9.tar.bz2
mv-3f9d0c023f3d84de0c68dbf9f7c29aa1b0abb9c9.tar.xz
mv-3f9d0c023f3d84de0c68dbf9f7c29aa1b0abb9c9.zip
Fix code style in net.
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/inventoryhandler.cpp4
-rw-r--r--src/net/ea/loginhandler.cpp2
-rw-r--r--src/net/ea/network.cpp15
3 files changed, 13 insertions, 8 deletions
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 1daafc2d5..eacb98711 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -150,7 +150,7 @@ int InventoryHandler::convertFromServerSlot(const int serverSlot) const
if (serverSlot < 0 || serverSlot > 13)
return 0;
- return EQUIP_CONVERT[serverSlot];
+ return static_cast<int>(EQUIP_CONVERT[serverSlot]);
}
int InventoryHandler::getSlot(const int eAthenaSlot)
@@ -168,7 +168,7 @@ int InventoryHandler::getSlot(const int eAthenaSlot)
mask <<= 1;
position++;
}
- return EQUIP_POINTS[position];
+ return static_cast<int>(EQUIP_POINTS[position]);
}
void InventoryHandler::processPlayerInventory(Net::MessageIn &msg,
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index d4cf0e59e..25ad6d916 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -78,7 +78,7 @@ void LoginHandler::loginAccount(LoginData *const loginData1) const
void LoginHandler::chooseServer(const unsigned int server,
const bool persistentIp) const
{
- if (server >= mWorlds.size() || !mWorlds[server])
+ if (static_cast<size_t>(server) >= mWorlds.size() || !mWorlds[server])
return;
ServerInfo *const charServer = getCharServer();
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index 61a9499d0..c9360e9c9 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -176,7 +176,7 @@ void Network::skip(const int len)
if (mInSize >= mToSkip)
{
mInSize -= mToSkip;
- memmove(mInBuffer, mInBuffer + mToSkip, mInSize);
+ memmove(mInBuffer, mInBuffer + static_cast<size_t>(mToSkip), mInSize);
mToSkip = 0;
}
else
@@ -267,7 +267,8 @@ void Network::receive()
continue;
}
- const int ret = TcpNet::recv(mSocket, mInBuffer + mInSize,
+ const int ret = TcpNet::recv(mSocket,
+ mInBuffer + static_cast<size_t>(mInSize),
BUFFER_SIZE - mInSize);
if (!ret)
@@ -291,7 +292,9 @@ void Network::receive()
if (mInSize >= mToSkip)
{
mInSize -= mToSkip;
- memmove(mInBuffer, mInBuffer + mToSkip, mInSize);
+ memmove(mInBuffer,
+ mInBuffer + static_cast<size_t>(mToSkip),
+ mInSize);
mToSkip = 0;
}
else
@@ -332,9 +335,11 @@ void Network::setError(const std::string &error)
uint16_t Network::readWord(const int pos) const
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- return SDL_Swap16(*reinterpret_cast<uint16_t*>(mInBuffer + (pos)));
+ return SDL_Swap16(*reinterpret_cast<uint16_t*>(
+ mInBuffer + static_cast<size_t>(pos)));
#else
- return (*reinterpret_cast<uint16_t*>(mInBuffer + (pos)));
+ return (*reinterpret_cast<uint16_t*>(
+ mInBuffer + static_cast<size_t>(pos)));
#endif
}