summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-23 22:01:44 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-23 22:01:44 +0300
commit3c404128c4669a1f4f190e20a89553677717fc50 (patch)
tree2db4e5031089c800c4e00fd6244e578f44a7c910 /src/net/eathena
parent89b267d6d73bbc59f7c313b8a22b97fbb27f99a8 (diff)
downloadmv-3c404128c4669a1f4f190e20a89553677717fc50.tar.gz
mv-3c404128c4669a1f4f190e20a89553677717fc50.tar.bz2
mv-3c404128c4669a1f4f190e20a89553677717fc50.tar.xz
mv-3c404128c4669a1f4f190e20a89553677717fc50.zip
Add missing comments into defines.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/messagein.cpp30
-rw-r--r--src/net/eathena/messageout.cpp14
2 files changed, 27 insertions, 17 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);
diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp
index 83fc381c5..6cbcba027 100644
--- a/src/net/eathena/messageout.cpp
+++ b/src/net/eathena/messageout.cpp
@@ -32,7 +32,7 @@
#ifndef SDL_BYTEORDER
#error missing SDL_endian.h
-#endif
+#endif // SDL_BYTEORDER
namespace EAthena
{
@@ -57,9 +57,11 @@ void MessageOut::writeInt16(const int16_t value, const char *const str)
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
int16_t swap = SDL_Swap16(value);
memcpy(mData + CAST_SIZE(mPos), &swap, sizeof(int16_t));
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
memcpy(mData + CAST_SIZE(mPos), &value, sizeof(int16_t));
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
DEBUGLOG2("writeInt16: " + toStringPrint(CAST_U32(
CAST_U16(value))),
mPos, str);
@@ -75,9 +77,11 @@ void MessageOut::writeInt32(const int32_t value, const char *const str)
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
int32_t swap = SDL_Swap32(value);
memcpy(mData + CAST_SIZE(mPos), &swap, sizeof(int32_t));
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
memcpy(mData + CAST_SIZE(mPos), &value, sizeof(int32_t));
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
mPos += 4;
PacketCounters::incOutBytes(4);
}