diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-26 17:05:18 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-26 17:18:21 +0200 |
commit | 43e99491a76bb85faf60c004e84b6c2b14cf41e7 (patch) | |
tree | 4aba689b76138118b4da043425fb3e8576db418c /src/net | |
parent | e726c34606f85347e70a0deb6b180db03b6d0c25 (diff) | |
download | manaserv-43e99491a76bb85faf60c004e84b6c2b14cf41e7.tar.gz manaserv-43e99491a76bb85faf60c004e84b6c2b14cf41e7.tar.xz manaserv-43e99491a76bb85faf60c004e84b6c2b14cf41e7.zip |
Standardize on the position of the const keyword
Same as for the client.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/connection.cpp | 7 | ||||
-rw-r--r-- | src/net/connection.hpp | 4 | ||||
-rw-r--r-- | src/net/messagein.cpp | 4 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/net/connection.cpp b/src/net/connection.cpp index 0b1f607..18d6e2c 100644 --- a/src/net/connection.cpp +++ b/src/net/connection.cpp @@ -31,7 +31,7 @@ Connection::Connection(): { } -bool Connection::start(std::string const &address, int port) +bool Connection::start(const std::string &address, int port) { ENetAddress enetAddress; enet_address_set_host(&enetAddress, address.c_str()); @@ -42,7 +42,8 @@ bool Connection::start(std::string const &address, int port) 0 /* assume any amount of incoming bandwidth */, 0 /* assume any amount of outgoing bandwidth */); - if (!mLocal) return false; + if (!mLocal) + return false; // Initiate the connection, allocating channel 0. mRemote = enet_host_connect(mLocal, &enetAddress, 1); @@ -77,7 +78,7 @@ bool Connection::isConnected() const return mRemote && mRemote->state == ENET_PEER_STATE_CONNECTED; } -void Connection::send(MessageOut const &msg, bool reliable, unsigned channel) +void Connection::send(const MessageOut &msg, bool reliable, unsigned channel) { if (!mRemote) { LOG_WARN("Can't send message to unconnected host! (" << msg << ")"); diff --git a/src/net/connection.hpp b/src/net/connection.hpp index f815d46..2beeb04 100644 --- a/src/net/connection.hpp +++ b/src/net/connection.hpp @@ -43,7 +43,7 @@ class Connection * Connects to the given host/port and waits until the connection is * established. Returns false if it fails to connect. */ - bool start(std::string const &, int); + bool start(const std::string &, int); /** * Disconnects. @@ -58,7 +58,7 @@ class Connection /** * Sends a message to the remote host. */ - void send(MessageOut const &msg, bool reliable = true, + void send(const MessageOut &msg, bool reliable = true, unsigned channel = 0); /** diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 714def5..767ed4c 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -89,8 +89,8 @@ std::string MessageIn::readString(int length) } // Read the string - char const *stringBeg = mData + mPos; - char const *stringEnd = (char const *)memchr(stringBeg, '\0', length); + const char *stringBeg = mData + mPos; + const char *stringEnd = (const char *)memchr(stringBeg, '\0', length); std::string readString(stringBeg, stringEnd ? stringEnd - stringBeg : length); mPos += length; |