minor derivative to reduce compiler warnings and tag read-only parameters as const.
Fork of Socket by
Revision 20:5abbc0e39fb1, committed 2015-07-07
- Comitter:
- WiredHome
- Date:
- Tue Jul 07 14:03:07 2015 +0000
- Parent:
- 19:434906b5b977
- Child:
- 21:04922f6a3602
- Commit message:
- Add const declaration for read-only parameters.
Changed in this revision
TCPSocketConnection.cpp | Show annotated file Show diff for this revision Revisions of this file |
TCPSocketConnection.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/TCPSocketConnection.cpp Mon Aug 19 18:38:18 2013 +0300 +++ b/TCPSocketConnection.cpp Tue Jul 07 14:03:07 2015 +0000 @@ -45,7 +45,7 @@ return _is_connected; } -int TCPSocketConnection::send(char* data, int length) { +int TCPSocketConnection::send(const char* data, int length) { if ((_sock_fd < 0) || !_is_connected) return -1; @@ -62,7 +62,7 @@ } // -1 if unsuccessful, else number of bytes written -int TCPSocketConnection::send_all(char* data, int length) { +int TCPSocketConnection::send_all(const char* data, int length) { if ((_sock_fd < 0) || !_is_connected) return -1;
--- a/TCPSocketConnection.h Mon Aug 19 18:38:18 2013 +0300 +++ b/TCPSocketConnection.h Tue Jul 07 14:03:07 2015 +0000 @@ -50,14 +50,14 @@ \param length The length of the buffer to send. \return the number of written bytes on success (>=0) or -1 on failure */ - int send(char* data, int length); + int send(const char* data, int length); /** Send all the data to the remote host. \param data The buffer to send to the host. \param length The length of the buffer to send. \return the number of written bytes on success (>=0) or -1 on failure */ - int send_all(char* data, int length); + int send_all(const char* data, int length); /** Receive data from the remote host. \param data The buffer in which to store the data received from the host.