diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-23 22:01:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-23 22:01:44 +0300 |
commit | 3c404128c4669a1f4f190e20a89553677717fc50 (patch) | |
tree | 2db4e5031089c800c4e00fd6244e578f44a7c910 /src/net | |
parent | 89b267d6d73bbc59f7c313b8a22b97fbb27f99a8 (diff) | |
download | ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.tar.gz ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.tar.bz2 ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.tar.xz ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.zip |
Add missing comments into defines.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/download.cpp | 28 | ||||
-rw-r--r-- | src/net/ea/network.cpp | 7 | ||||
-rw-r--r-- | src/net/eathena/messagein.cpp | 30 | ||||
-rw-r--r-- | src/net/eathena/messageout.cpp | 14 | ||||
-rw-r--r-- | src/net/ipc.cpp | 3 | ||||
-rw-r--r-- | src/net/messagein.cpp | 2 | ||||
-rw-r--r-- | src/net/net.cpp | 8 | ||||
-rw-r--r-- | src/net/sdltcpnet.cpp | 18 | ||||
-rw-r--r-- | src/net/sdltcpnet.h | 4 | ||||
-rw-r--r-- | src/net/serverinfo.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/messagein.cpp | 27 | ||||
-rw-r--r-- | src/net/tmwa/messageout.cpp | 14 |
12 files changed, 96 insertions, 63 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp index b92385076..3844cc01f 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -38,7 +38,7 @@ #if defined __native_client__ #include "utils/files.h" -#endif +#endif // defined __native_client__ #include <sstream> @@ -530,7 +530,8 @@ void Download::addProxy(CURL *const curl) case 3: // HTTP 1.0 #if CURLVERSION_ATLEAST(7, 19, 4) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP_1_0); -#endif +#endif // CURLVERSION_ATLEAST(7, 19, 4) + break; case 4: // SOCKS4 curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); @@ -538,20 +539,24 @@ void Download::addProxy(CURL *const curl) case 5: // SOCKS4A #if CURLVERSION_ATLEAST(7, 18, 0) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A); -#else +#else // CURLVERSION_ATLEAST(7, 18, 0) + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); -#endif +#endif // CURLVERSION_ATLEAST(7, 18, 0) + break; case 6: // SOCKS5 #if CURLVERSION_ATLEAST(7, 18, 0) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); -#endif +#endif // CURLVERSION_ATLEAST(7, 18, 0) + break; case 7: // SOCKS5 hostname #if CURLVERSION_ATLEAST(7, 18, 0) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME); -#endif +#endif // CURLVERSION_ATLEAST(7, 18, 0) + break; } } @@ -563,13 +568,13 @@ void Download::secureCurl(CURL *const curl) CURLPROTO_HTTP | CURLPROTO_HTTPS); curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); -#endif +#endif // CURLVERSION_ATLEAST(7, 19, 4) #if CURLVERSION_ATLEAST(7, 21, 0) curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 0); -#endif +#endif // CURLVERSION_ATLEAST(7, 21, 0) #if CURLVERSION_ATLEAST(7, 15, 1) curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3); -#endif +#endif // CURLVERSION_ATLEAST(7, 15, 1) } #if CURLVERSION_ATLEAST(7, 21, 7) @@ -577,11 +582,12 @@ void Download::addHeaders(CURL *const curl) { curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, ""); } -#else +#else // CURLVERSION_ATLEAST(7, 21, 7) + void Download::addHeaders(CURL *const curl A_UNUSED) { } -#endif +#endif // CURLVERSION_ATLEAST(7, 21, 7) void Download::prepareForm(curl_httppost **form, const std::string &fileName) { diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index 15a45fde0..571fa2ebb 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -37,7 +37,7 @@ #ifndef SDL_BYTEORDER #error missing SDL_endian.h -#endif +#endif // SDL_BYTEORDER extern unsigned int mLastHost; @@ -353,10 +353,11 @@ uint16_t Network::readWord(const int pos) const #if SDL_BYTEORDER == SDL_BIG_ENDIAN return SDL_Swap16(*reinterpret_cast<uint16_t*>( mInBuffer + CAST_SIZE(pos))); -#else +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + return (*reinterpret_cast<uint16_t*>( mInBuffer + CAST_SIZE(pos))); -#endif +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN } void Network::fixSendBuffer() 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); } diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp index 088bd3b81..cc1ad7ad1 100644 --- a/src/net/ipc.cpp +++ b/src/net/ipc.cpp @@ -197,7 +197,8 @@ void IPC::flush() chatWindow->chatInput(*it); } } -#endif +#endif // DYECMD + mDelayedCommands.clear(); SDL_mutexV(mMutex); } diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 8c2e32a75..60b4f9793 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -322,7 +322,7 @@ unsigned char *MessageIn::readBytes(int length, const char *const dstr) if (dstr) logger->dlog(dstr); logger->dlog("ReadBytes: " + str); -#endif +#endif // ENABLEDEBUGLOG PacketCounters::incInBytes(length); return buf; diff --git a/src/net/net.cpp b/src/net/net.cpp index 9b6be857a..007b4a83c 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -28,7 +28,7 @@ #ifdef TMWA_SUPPORT #include "net/tmwa/generalhandler.h" -#endif +#endif // TMWA_SUPPORT #include "net/eathena/generalhandler.h" @@ -133,9 +133,11 @@ void connectToServer(const ServerInfo &server) default: #ifdef TMWA_SUPPORT new TmwAthena::GeneralHandler; -#else +#else // TMWA_SUPPORT + new EAthena::GeneralHandler; -#endif +#endif // TMWA_SUPPORT + break; } diff --git a/src/net/sdltcpnet.cpp b/src/net/sdltcpnet.cpp index bea2d0e11..3337cd260 100644 --- a/src/net/sdltcpnet.cpp +++ b/src/net/sdltcpnet.cpp @@ -28,7 +28,7 @@ #include <netinet/in.h> #include <netdb.h> #include <linux/tcp.h> -#else +#else // defined(M_TCPOK) && !defined(ANDROID) #include <netinet/in.h> #include <netinet/tcp.h> #include <netdb.h> @@ -37,9 +37,9 @@ #define TCP_THIN_LINEAR_TIMEOUTS 16 // Fast retrans. after 1 dupack #define TCP_THIN_DUPACK 17 -#endif +#endif // defined(M_TCPOK) && !defined(ANDROID) -#endif +#endif // defined __linux__ || defined __linux PRAGMACLANG6(GCC diagnostic push) PRAGMACLANG6(GCC diagnostic ignored "-Wold-style-cast") @@ -60,7 +60,9 @@ struct TCPsocketHack final IPaddress localAddress; int sflag; }; -#endif +#endif // !defined(__native_client__) + // && (defined(TCP_THIN_LINEAR_TIMEOUTS) + // || defined(TCP_THIN_DUPACK)) void TcpNet::init() { @@ -118,18 +120,20 @@ TcpNet::Socket TcpNet::open(IPaddress *const ip) { logger->log_r("error on set TCP_THIN_LINEAR_TIMEOUTS"); } -#endif +#endif // TCP_THIN_LINEAR_TIMEOUTS #ifdef TCP_THIN_DUPACK if (setsockopt(hack->channel, IPPROTO_TCP, TCP_THIN_DUPACK, &val, sizeof(val))) { logger->log_r("error on set TCP_THIN_DUPACK"); } -#endif +#endif // TCP_THIN_DUPACK } } } -#endif +#endif // !defined(__native_client__) + // && (defined(TCP_THIN_LINEAR_TIMEOUTS) + // || defined(TCP_THIN_DUPACK)) return sock; } diff --git a/src/net/sdltcpnet.h b/src/net/sdltcpnet.h index 37b78e146..a43220371 100644 --- a/src/net/sdltcpnet.h +++ b/src/net/sdltcpnet.h @@ -24,12 +24,12 @@ #ifdef USE_SDL2 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wswitch-default" -#endif +#endif // USE_SDL2 #include <SDL_stdinc.h> _SDL_stdinc_h #ifdef USE_SDL2 #pragma GCC diagnostic pop -#endif +#endif // USE_SDL2 #include <SDL_net.h> diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h index 1e87f88f8..033bf4ad6 100644 --- a/src/net/serverinfo.h +++ b/src/net/serverinfo.h @@ -67,9 +67,9 @@ class ServerInfo final updateHosts(), #ifdef TMWA_SUPPORT port(6901), -#else +#else // TMWA_SUPPORT port(6900), -#endif +#endif // TMWA_SUPPORT version(), packetVersion(), save(false), diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp index ffea1ee4e..219466187 100644 --- a/src/net/tmwa/messagein.cpp +++ b/src/net/tmwa/messagein.cpp @@ -35,7 +35,7 @@ #ifndef SDL_BYTEORDER #error missing SDL_endian.h -#endif +#endif // SDL_BYTEORDER namespace TmwAthena { @@ -64,9 +64,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; } @@ -80,9 +81,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))), @@ -101,9 +103,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))), @@ -122,9 +125,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); @@ -147,9 +151,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/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index 237d4f185..e0e7ffdb2 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -32,7 +32,7 @@ #ifndef SDL_BYTEORDER #error missing SDL_endian.h -#endif +#endif // SDL_BYTEORDER namespace TmwAthena { @@ -60,9 +60,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 + mPos += 2; PacketCounters::incOutBytes(2); } @@ -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); } |