diff options
Diffstat (limited to 'src/net/eathena/messagein.cpp')
-rw-r--r-- | src/net/eathena/messagein.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/net/eathena/messagein.cpp b/src/net/eathena/messagein.cpp index 3f5149ef9..b32db3060 100644 --- a/src/net/eathena/messagein.cpp +++ b/src/net/eathena/messagein.cpp @@ -35,7 +35,7 @@ #ifndef SDL_BYTEORDER #error missing SDL_endian.h -#endif +#endif // SDL_BYTEORDER namespace EAthena { @@ -60,7 +60,8 @@ void MessageIn::postInit(const char *const str, const std::string verStr = toString(mVersion); DEBUGLOG2("Version", 0, verStr.c_str()); } -#endif +#endif // ENABLEDEBUGLOG + readInt16(str); } @@ -73,9 +74,10 @@ uint16_t MessageIn::readId() const int16_t swap; memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int16_t)); value = SDL_Swap16(swap); -#else +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int16_t)); -#endif +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN } return value; } @@ -89,9 +91,10 @@ int16_t MessageIn::readInt16(const char *const str) int16_t swap; memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int16_t)); value = SDL_Swap16(swap); -#else +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int16_t)); -#endif +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN } DEBUGLOG2("readInt16: " + toStringPrint(CAST_U32( CAST_U16(value))), @@ -110,9 +113,10 @@ uint16_t MessageIn::readUInt16(const char *const str) uint16_t swap; memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(uint16_t)); value = SDL_Swap16(swap); -#else +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + memcpy(&value, mData + CAST_SIZE(mPos), sizeof(uint16_t)); -#endif +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN } DEBUGLOG2("readUInt16: " + toStringPrint(CAST_U32( CAST_U16(value))), @@ -131,9 +135,10 @@ int32_t MessageIn::readInt32(const char *const str) int32_t swap; memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int32_t)); value = SDL_Swap32(swap); -#else +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int32_t)); -#endif +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN } DEBUGLOG2("readInt32: " + toStringPrint(CAST_U32(value)), mPos, str); @@ -156,9 +161,10 @@ int64_t MessageIn::readInt64(const char *const str) int64_t swap; memcpy(&swap, mData + CAST_SIZE(mPos), sizeof(int64_t)); value = SDL_Swap64(swap); -#else +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + memcpy(&value, mData + CAST_SIZE(mPos), sizeof(int64_t)); -#endif +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN } DEBUGLOG2("readInt64: " + toStringPrint(CAST_U32(value)), mPos, str); |