summaryrefslogtreecommitdiff
path: root/src/net/tmwa/messagein.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
commit9fe21fcd8883b37bdc30224822e6e42afb35b8f0 (patch)
tree798117abd4dc7e610997d59d530a96ddc1509f53 /src/net/tmwa/messagein.cpp
parent4429cb14e9e187edef27aba692a4266733f79c17 (diff)
downloadplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.gz
plus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.bz2
plus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.xz
plus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.zip
Replace most static_cast<Type> to shorter versions from defines.
Diffstat (limited to 'src/net/tmwa/messagein.cpp')
-rw-r--r--src/net/tmwa/messagein.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp
index 21e679b25..c8cf350e7 100644
--- a/src/net/tmwa/messagein.cpp
+++ b/src/net/tmwa/messagein.cpp
@@ -56,10 +56,10 @@ uint16_t MessageIn::readId()
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
int16_t swap;
- memcpy(&swap, mData + static_cast<size_t>(mPos), sizeof(int16_t));
+ memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int16_t));
value = SDL_Swap16(swap);
#else
- memcpy(&value, mData + static_cast<size_t>(mPos), sizeof(int16_t));
+ memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int16_t));
#endif
}
return value;
@@ -72,14 +72,14 @@ int16_t MessageIn::readInt16(const char *const str)
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
int16_t swap;
- memcpy(&swap, mData + static_cast<size_t>(mPos), sizeof(int16_t));
+ memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int16_t));
value = SDL_Swap16(swap);
#else
- memcpy(&value, mData + static_cast<size_t>(mPos), sizeof(int16_t));
+ memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int16_t));
#endif
}
- DEBUGLOG2("readInt16: " + toStringPrint(static_cast<unsigned int>(
- static_cast<uint16_t>(value))),
+ DEBUGLOG2("readInt16: " + toStringPrint(CAST_U32(
+ CAST_U16(value))),
mPos, str);
mPos += 2;
PacketCounters::incInBytes(2);
@@ -93,13 +93,13 @@ int32_t MessageIn::readInt32(const char *const str)
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
int32_t swap;
- memcpy(&swap, mData + static_cast<size_t>(mPos), sizeof(int32_t));
+ memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int32_t));
value = SDL_Swap32(swap);
#else
- memcpy(&value, mData + static_cast<size_t>(mPos), sizeof(int32_t));
+ memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int32_t));
#endif
}
- DEBUGLOG2("readInt32: " + toStringPrint(static_cast<unsigned int>(value)),
+ DEBUGLOG2("readInt32: " + toStringPrint(CAST_U32(value)),
mPos, str);
mPos += 4;
PacketCounters::incInBytes(4);
@@ -118,13 +118,13 @@ int64_t MessageIn::readInt64(const char *const str)
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
int64_t swap;
- memcpy(&swap, mData + static_cast<size_t>(mPos), sizeof(int64_t));
+ memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int64_t));
value = SDL_Swap64(swap);
#else
- memcpy(&value, mData + static_cast<size_t>(mPos), sizeof(int64_t));
+ memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int64_t));
#endif
}
- DEBUGLOG2("readInt64: " + toStringPrint(static_cast<unsigned int>(value)),
+ DEBUGLOG2("readInt64: " + toStringPrint(CAST_U32(value)),
mPos, str);
mPos += 8;
PacketCounters::incInBytes(8);