From f98d003e354a1792117b7cbc771d1dd91475a156 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Mar 2011 17:48:29 +0200 Subject: Fix most old style cast except manaserv and libxml2 defines. --- src/net/messagein.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/net/messagein.cpp') diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index e39a443f1..9ffc052f6 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -30,8 +30,8 @@ #include "utils/stringutils.h" #define MAKEWORD(low, high) \ - ((unsigned short)(((unsigned char)(low)) | \ - ((unsigned short)((unsigned char)(high))) << 8)) + (static_cast((static_cast(low)) | \ + (static_cast(static_cast(high))) << 8)) namespace Net { @@ -121,14 +121,16 @@ void MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction) break; } default: - logger->log("incorrect direction: %d", (int)direction); + logger->log("incorrect direction: %d", + static_cast(direction)); // OOPSIE! Impossible or unknown direction = 0; } } mPos += 3; PacketCounters::incInBytes(3); - DEBUGLOG("readCoordinates: " + toString((int)x) + "," + toString((int)y)); + DEBUGLOG("readCoordinates: " + toString(static_cast(x)) + + "," + toString(static_cast(y))); } void MessageIn::readCoordinatePair(Uint16 &srcX, Uint16 &srcY, @@ -151,9 +153,10 @@ void MessageIn::readCoordinatePair(Uint16 &srcX, Uint16 &srcY, srcY = static_cast(temp >> 4); } mPos += 5; - DEBUGLOG("readCoordinatePair: " + toString((int)srcX) + "," - + toString((int)srcY) + " " + toString((int)dstX) + "," - + toString((int)dstY)); + DEBUGLOG("readCoordinatePair: " + toString(static_cast(srcX)) + "," + + toString(static_cast(srcY)) + " " + + toString(static_cast(dstX)) + "," + + toString(static_cast(dstY))); PacketCounters::incInBytes(5); } @@ -161,7 +164,7 @@ void MessageIn::skip(unsigned int length) { mPos += length; PacketCounters::incInBytes(length); - DEBUGLOG("skip: " + toString((int)length)); + DEBUGLOG("skip: " + toString(static_cast(length))); } std::string MessageIn::readString(int length) -- cgit v1.2.3-60-g2f50