From 41ffafd17ad8f0a7ee060cc9f48bca04a1e16cb6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 Aug 2014 21:21:06 +0300 Subject: Fix code style. --- src/net/ea/beinghandler.cpp | 1 - src/net/ea/playerhandler.cpp | 1 - src/net/ipc.cpp | 18 ++++++++---------- src/net/ipc.h | 6 +++--- 4 files changed, 11 insertions(+), 15 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 65e14040e..7ee755a5f 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -42,7 +42,6 @@ #include "gui/windows/outfitwindow.h" #include "gui/windows/socialwindow.h" #include "gui/windows/killstats.h" -#include "gui/windows/questswindow.h" #include "utils/timer.h" diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 4f5200573..225162e9a 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -43,7 +43,6 @@ #include "resources/map/map.h" -#include "listeners/updatestatuslistener.h" #include "listeners/playerdeathlistener.h" #include "listeners/weightlistener.h" diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp index 22fbb4ce4..a1bed683a 100644 --- a/src/net/ipc.cpp +++ b/src/net/ipc.cpp @@ -28,8 +28,6 @@ #include "utils/sdlhelper.h" #include "utils/stringutils.h" -#include - #include "debug.h" IPC *ipc = nullptr; @@ -66,7 +64,7 @@ bool IPC::init() { IPaddress ip; - if(TcpNet::resolveHost(&ip, nullptr, mPort) == -1) + if (TcpNet::resolveHost(&ip, nullptr, mPort) == -1) { logger->log("IPC: resolveHost error: %s\n", TcpNet::getError()); return false; @@ -95,7 +93,7 @@ int IPC::acceptLoop(void *ptr) IPC *const ipc1 = reinterpret_cast(ptr); const int max_length = 1024; - TcpNet::SocketSet set = TcpNet::allocSocketSet(1); + const TcpNet::SocketSet set = TcpNet::allocSocketSet(1); TcpNet::addSocket(set, ipc1->mSocket); ipc->mListen = true; while (ipc1->mListen) @@ -104,7 +102,7 @@ int IPC::acceptLoop(void *ptr) if (!TcpNet::socketReady(ipc1->mSocket)) continue; - TcpNet::Socket sock = TcpNet::accept(ipc1->mSocket); + const TcpNet::Socket sock = TcpNet::accept(ipc1->mSocket); if (!sock) { logger->log_r("IPC: unable to accept connection"); @@ -129,11 +127,11 @@ int IPC::acceptLoop(void *ptr) ipc1->mThreadLocked = false; ipc1->mNumReqs ++; - const std::string resp = strprintf("[%d] %s\n", + const std::string resp = strprintf("[%u] %s\n", ipc1->mNumReqs, req.c_str()); - const char *respc = resp.c_str(); - const int len = strlen(respc) + 1; + const char *const respc = resp.c_str(); + const int len = static_cast(strlen(respc)) + 1; result = TcpNet::send(sock, respc, len); if (result < len) { @@ -165,13 +163,13 @@ void IPC::start() unsigned short port(44007); if (getenv("IPC_PORT")) - port = atoi(getenv("IPC_PORT")); + port = static_cast(atoi(getenv("IPC_PORT"))); logger->log("Starting IPC..."); ipc = new IPC; for (int f = port; f < 65535; f ++) { - ipc->setPort(f); + ipc->setPort(static_cast(f)); logger->log(" -> trying port %d...", f); if (ipc->init()) { diff --git a/src/net/ipc.h b/src/net/ipc.h index 739eb746e..b1216815b 100644 --- a/src/net/ipc.h +++ b/src/net/ipc.h @@ -18,8 +18,8 @@ * along with this program. If not, see . */ -#ifndef IPC_H -#define IPC_H +#ifndef NET_IPC_H +#define NET_IPC_H #include "net/sdltcpnet.h" @@ -72,4 +72,4 @@ class IPC final extern IPC *ipc; -#endif // IPC_H +#endif // NET_IPC_H -- cgit v1.2.3-60-g2f50