diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-08 22:47:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-08 22:47:17 +0300 |
commit | 3f9d0c023f3d84de0c68dbf9f7c29aa1b0abb9c9 (patch) | |
tree | 93589fc3f913324254ad543481691565e0baf67e /src/net/tmwa | |
parent | 8daa939a45794c26a33e109c13c4d6f58a46e00e (diff) | |
download | ManaVerse-3f9d0c023f3d84de0c68dbf9f7c29aa1b0abb9c9.tar.gz ManaVerse-3f9d0c023f3d84de0c68dbf9f7c29aa1b0abb9c9.tar.bz2 ManaVerse-3f9d0c023f3d84de0c68dbf9f7c29aa1b0abb9c9.tar.xz ManaVerse-3f9d0c023f3d84de0c68dbf9f7c29aa1b0abb9c9.zip |
Fix code style in net.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/messagein.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/messageout.cpp | 12 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 3 |
3 files changed, 12 insertions, 11 deletions
diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp index c1a3032d0..0e855ef56 100644 --- a/src/net/tmwa/messagein.cpp +++ b/src/net/tmwa/messagein.cpp @@ -53,10 +53,10 @@ int16_t MessageIn::readInt16() { #if SDL_BYTEORDER == SDL_BIG_ENDIAN int16_t swap; - memcpy(&swap, mData + mPos, sizeof(int16_t)); + memcpy(&swap, mData + static_cast<size_t>(mPos), sizeof(int16_t)); value = SDL_Swap16(swap); #else - memcpy(&value, mData + mPos, sizeof(int16_t)); + memcpy(&value, mData + static_cast<size_t>(mPos), sizeof(int16_t)); #endif } mPos += 2; @@ -72,10 +72,10 @@ int32_t MessageIn::readInt32() { #if SDL_BYTEORDER == SDL_BIG_ENDIAN int32_t swap; - memcpy(&swap, mData + mPos, sizeof(int32_t)); + memcpy(&swap, mData + static_cast<size_t>(mPos), sizeof(int32_t)); value = SDL_Swap32(swap); #else - memcpy(&value, mData + mPos, sizeof(int32_t)); + memcpy(&value, mData + static_cast<size_t>(mPos), sizeof(int32_t)); #endif } mPos += 4; diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index 9962e7975..b32dcb3e5 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -43,7 +43,7 @@ MessageOut::MessageOut(const int16_t id): mNetwork(TmwAthena::Network::instance()) { mNetwork->fixSendBuffer(); - mData = mNetwork->mOutBuffer + mNetwork->mOutSize; + mData = mNetwork->mOutBuffer + static_cast<size_t>(mNetwork->mOutSize); // +++ can be issue. call to virtual member writeInt16(id); @@ -61,9 +61,9 @@ void MessageOut::writeInt16(const int16_t value) expand(2); #if SDL_BYTEORDER == SDL_BIG_ENDIAN int16_t swap = SDL_Swap16(value); - memcpy(mData + mPos, &swap, sizeof(int16_t)); + memcpy(mData + static_cast<size_t>(mPos), &swap, sizeof(int16_t)); #else - memcpy(mData + mPos, &value, sizeof(int16_t)); + memcpy(mData + static_cast<size_t>(mPos), &value, sizeof(int16_t)); #endif mPos += 2; PacketCounters::incOutBytes(2); @@ -75,9 +75,9 @@ void MessageOut::writeInt32(const int32_t value) expand(4); #if SDL_BYTEORDER == SDL_BIG_ENDIAN int32_t swap = SDL_Swap32(value); - memcpy(mData + mPos, &swap, sizeof(int32_t)); + memcpy(mData + static_cast<size_t>(mPos), &swap, sizeof(int32_t)); #else - memcpy(mData + mPos, &value, sizeof(int32_t)); + memcpy(mData + static_cast<size_t>(mPos), &value, sizeof(int32_t)); #endif mPos += 4; PacketCounters::incOutBytes(4); @@ -94,7 +94,7 @@ void MessageOut::writeCoordinates(const uint16_t x, DEBUGLOG(strprintf("writeCoordinates: %u,%u %u", static_cast<unsigned>(x), static_cast<unsigned>(y), static_cast<unsigned>(direction))); - char *const data = mData + mPos; + char *const data = mData + static_cast<size_t>(mPos); mNetwork->mOutSize += 3; mPos += 3; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index eea74a2a5..25a2e0cde 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -263,7 +263,8 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) if (serverVersion >= 4) addVal = 3; - while (buf - start + 1 < size && *(buf + addVal)) + while (buf - start + 1 < size + && *(buf + static_cast<size_t>(addVal))) { unsigned char status = 255; unsigned char ver = 0; |