From 0561af8232b50071676ae18d5e78ba43b15bff94 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 17 Sep 2014 17:24:35 +0300 Subject: Fix casting in logging packets. --- src/net/eathena/messagein.cpp | 9 ++++++--- src/net/eathena/messageout.cpp | 6 ++++-- src/net/messagein.cpp | 5 +++-- src/net/messageout.cpp | 3 ++- src/net/tmwa/messagein.cpp | 9 ++++++--- src/net/tmwa/messageout.cpp | 6 ++++-- 6 files changed, 25 insertions(+), 13 deletions(-) (limited to 'src/net') diff --git a/src/net/eathena/messagein.cpp b/src/net/eathena/messagein.cpp index bacf189c6..49e320aa7 100644 --- a/src/net/eathena/messagein.cpp +++ b/src/net/eathena/messagein.cpp @@ -79,7 +79,8 @@ int16_t MessageIn::readInt16(const char *const str) memcpy(&value, mData + static_cast(mPos), sizeof(int16_t)); #endif } - DEBUGLOG2("readInt16: " + toStringPrint(static_cast(value)), + DEBUGLOG2("readInt16: " + toStringPrint(static_cast( + static_cast(value))), mPos, str); mPos += 2; PacketCounters::incInBytes(2); @@ -99,7 +100,8 @@ int32_t MessageIn::readInt32(const char *const str) memcpy(&value, mData + static_cast(mPos), sizeof(int32_t)); #endif } - DEBUGLOG2("readInt32: " + toStringPrint(value), mPos, str); + DEBUGLOG2("readInt32: " + toStringPrint(static_cast(value)), + mPos, str); mPos += 4; PacketCounters::incInBytes(4); return value; @@ -118,7 +120,8 @@ int64_t MessageIn::readInt64(const char *const str) memcpy(&value, mData + static_cast(mPos), sizeof(int64_t)); #endif } - DEBUGLOG2("readInt64: " + toStringPrint(value), mPos, str); + DEBUGLOG2("readInt64: " + toStringPrint(static_cast(value)), + mPos, str); mPos += 8; PacketCounters::incInBytes(8); return value; diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp index 1b0dae6f1..f2b851ad4 100644 --- a/src/net/eathena/messageout.cpp +++ b/src/net/eathena/messageout.cpp @@ -64,7 +64,8 @@ void MessageOut::writeInt16(const int16_t value, const char *const str) #else memcpy(mData + static_cast(mPos), &value, sizeof(int16_t)); #endif - DEBUGLOG2("writeInt16: " + toStringPrint(static_cast(value)), + DEBUGLOG2("writeInt16: " + toStringPrint(static_cast( + static_cast(value))), mPos, str); mPos += 2; PacketCounters::incOutBytes(2); @@ -72,7 +73,8 @@ void MessageOut::writeInt16(const int16_t value, const char *const str) void MessageOut::writeInt32(const int32_t value, const char *const str) { - DEBUGLOG2("writeInt32: " + toStringPrint(value), mPos, str); + DEBUGLOG2("writeInt32: " + toStringPrint(static_cast(value)), + mPos, str); expand(4); #if SDL_BYTEORDER == SDL_BIG_ENDIAN int32_t swap = SDL_Swap32(value); diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index fde20a423..79e506715 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -73,7 +73,7 @@ unsigned char MessageIn::readUInt8(const char *const str) if (mPos < mLength) value = static_cast(mData[mPos]); - DEBUGLOG2("readUInt8: " + toStringPrint(static_cast(value)), + DEBUGLOG2("readUInt8: " + toStringPrint(static_cast(value)), mPos, str); mPos += 1; PacketCounters::incInBytes(1); @@ -86,7 +86,8 @@ signed char MessageIn::readInt8(const char *const str) if (mPos < mLength) value = static_cast(mData[mPos]); - DEBUGLOG2("readInt8: " + toStringPrint(static_cast(value)), + DEBUGLOG2("readInt8: " + toStringPrint(static_cast( + static_cast(value))), mPos, str); mPos += 1; PacketCounters::incInBytes(1); diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index 7ee08b0d4..3241ffbfd 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -53,7 +53,8 @@ void MessageOut::writeInt8(const int8_t value, const char *const str) { expand(1); mData[mPos] = value; - DEBUGLOG2("writeInt8: " + toStringPrint(static_cast(value)), + DEBUGLOG2("writeInt8: " + toStringPrint(static_cast( + static_cast(value))), mPos, str); mPos += 1; PacketCounters::incOutBytes(1); diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp index 75dcb917c..01956bc3b 100644 --- a/src/net/tmwa/messagein.cpp +++ b/src/net/tmwa/messagein.cpp @@ -79,7 +79,8 @@ int16_t MessageIn::readInt16(const char *const str) memcpy(&value, mData + static_cast(mPos), sizeof(int16_t)); #endif } - DEBUGLOG2("readInt16: " + toStringPrint(static_cast(value)), + DEBUGLOG2("readInt16: " + toStringPrint(static_cast( + static_cast(value))), mPos, str); mPos += 2; PacketCounters::incInBytes(2); @@ -99,7 +100,8 @@ int32_t MessageIn::readInt32(const char *const str) memcpy(&value, mData + static_cast(mPos), sizeof(int32_t)); #endif } - DEBUGLOG2("readInt32: " + toStringPrint(value), mPos, str); + DEBUGLOG2("readInt32: " + toStringPrint(static_cast(value)), + mPos, str); mPos += 4; PacketCounters::incInBytes(4); return value; @@ -118,7 +120,8 @@ int64_t MessageIn::readInt64(const char *const str) memcpy(&value, mData + static_cast(mPos), sizeof(int64_t)); #endif } - DEBUGLOG2("readInt64: " + toStringPrint(value), mPos, str); + DEBUGLOG2("readInt64: " + toStringPrint(static_cast(value)), + mPos, str); mPos += 8; PacketCounters::incInBytes(8); return value; diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index a66c1c2b1..f1bc7dd02 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -57,7 +57,8 @@ void MessageOut::expand(const size_t bytes) void MessageOut::writeInt16(const int16_t value, const char *const str) { - DEBUGLOG2("writeInt16: " + toStringPrint(static_cast(value)), + DEBUGLOG2("writeInt16: " + toStringPrint(static_cast( + static_cast(value))), mPos, str); expand(2); #if SDL_BYTEORDER == SDL_BIG_ENDIAN @@ -72,7 +73,8 @@ void MessageOut::writeInt16(const int16_t value, const char *const str) void MessageOut::writeInt32(const int32_t value, const char *const str) { - DEBUGLOG2("writeInt32: " + toStringPrint(value), mPos, str); + DEBUGLOG2("writeInt32: " + toStringPrint(static_cast(value)), + mPos, str); expand(4); #if SDL_BYTEORDER == SDL_BIG_ENDIAN int32_t swap = SDL_Swap32(value); -- cgit v1.2.3-60-g2f50