summaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/connection.cpp7
-rw-r--r--src/net/connection.hpp4
-rw-r--r--src/net/messagein.cpp4
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;