diff options
-rw-r--r-- | include/sockets.h | 8 | ||||
-rw-r--r-- | modules/extra/ssl_gnutls.cpp | 12 | ||||
-rw-r--r-- | modules/extra/ssl_openssl.cpp | 8 | ||||
-rw-r--r-- | src/pipeengine.cpp | 2 | ||||
-rw-r--r-- | src/sockets.cpp | 10 | ||||
-rw-r--r-- | src/win32/anope_windows.h | 2 |
6 files changed, 21 insertions, 21 deletions
diff --git a/include/sockets.h b/include/sockets.h index 853ba0470..1f7f9acc2 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -164,15 +164,15 @@ public: * @param sz How much to read * @return Number of bytes received */ - virtual int Recv(Socket *s, char *buf, size_t sz); + virtual ssize_t Recv(Socket *s, char *buf, size_t sz); /** Write something to the socket * @param s The socket * @param buf The data to write * @param size The length of the data */ - virtual int Send(Socket *s, const char *buf, size_t sz); - int Send(Socket *s, const Anope::string &buf); + virtual ssize_t Send(Socket *s, const char *buf, size_t sz); + ssize_t Send(Socket *s, const Anope::string &buf); /** Accept a connection from a socket * @param s The socket @@ -503,7 +503,7 @@ public: * @param sz The size of the buffer * @return The amount of data read */ - int Read(char *data, size_t sz); + ssize_t Read(char *data, size_t sz); /** Mark the write end of this pipe (non)blocking * @param state true to enable blocking, false to disable blocking diff --git a/modules/extra/ssl_gnutls.cpp b/modules/extra/ssl_gnutls.cpp index e2c9aa23c..78a70f091 100644 --- a/modules/extra/ssl_gnutls.cpp +++ b/modules/extra/ssl_gnutls.cpp @@ -51,14 +51,14 @@ public: * @param sz How much to read * @return Number of bytes received */ - int Recv(Socket *s, char *buf, size_t sz) override; + ssize_t Recv(Socket *s, char *buf, size_t sz) override; /** Write something to the socket * @param s The socket * @param buf The data to write * @param size The length of the data */ - int Send(Socket *s, const char *buf, size_t sz) override; + ssize_t Send(Socket *s, const char *buf, size_t sz) override; /** Accept a connection from a socket * @param s The socket @@ -384,9 +384,9 @@ void MySSLService::Init(Socket *s) s->io = new SSLSocketIO(); } -int SSLSocketIO::Recv(Socket *s, char *buf, size_t sz) +ssize_t SSLSocketIO::Recv(Socket *s, char *buf, size_t sz) { - int ret = gnutls_record_recv(this->sess, buf, sz); + ssize_t ret = gnutls_record_recv(this->sess, buf, sz); if (ret > 0) TotalRead += ret; @@ -411,9 +411,9 @@ int SSLSocketIO::Recv(Socket *s, char *buf, size_t sz) return ret; } -int SSLSocketIO::Send(Socket *s, const char *buf, size_t sz) +ssize_t SSLSocketIO::Send(Socket *s, const char *buf, size_t sz) { - int ret = gnutls_record_send(this->sess, buf, sz); + ssize_t ret = gnutls_record_send(this->sess, buf, sz); if (ret > 0) TotalWritten += ret; diff --git a/modules/extra/ssl_openssl.cpp b/modules/extra/ssl_openssl.cpp index 0e6ad2abc..ce2222fa4 100644 --- a/modules/extra/ssl_openssl.cpp +++ b/modules/extra/ssl_openssl.cpp @@ -52,14 +52,14 @@ public: * @param sz How much to read * @return Number of bytes received */ - int Recv(Socket *s, char *buf, size_t sz) override; + ssize_t Recv(Socket *s, char *buf, size_t sz) override; /** Write something to the socket * @param s The socket * @param buf The data to write * @param size The length of the data */ - int Send(Socket *s, const char *buf, size_t sz) override; + ssize_t Send(Socket *s, const char *buf, size_t sz) override; /** Accept a connection from a socket * @param s The socket @@ -237,7 +237,7 @@ SSLSocketIO::SSLSocketIO() this->sslsock = NULL; } -int SSLSocketIO::Recv(Socket *s, char *buf, size_t sz) +ssize_t SSLSocketIO::Recv(Socket *s, char *buf, size_t sz) { int i = SSL_read(this->sslsock, buf, sz); if (i > 0) @@ -256,7 +256,7 @@ int SSLSocketIO::Recv(Socket *s, char *buf, size_t sz) return i; } -int SSLSocketIO::Send(Socket *s, const char *buf, size_t sz) +ssize_t SSLSocketIO::Send(Socket *s, const char *buf, size_t sz) { int i = SSL_write(this->sslsock, buf, sz); if (i > 0) diff --git a/src/pipeengine.cpp b/src/pipeengine.cpp index 9b55134fb..6a5b57db6 100644 --- a/src/pipeengine.cpp +++ b/src/pipeengine.cpp @@ -60,7 +60,7 @@ void Pipe::Write(const char *data, size_t sz) write(this->write_pipe, data, sz); } -int Pipe::Read(char *data, size_t sz) +ssize_t Pipe::Read(char *data, size_t sz) { return read(this->GetFD(), data, sz); } diff --git a/src/sockets.cpp b/src/sockets.cpp index 6d6718547..9bf78b1f9 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -426,23 +426,23 @@ size_t cidr::hash::operator()(const cidr &s) const } } -int SocketIO::Recv(Socket *s, char *buf, size_t sz) +ssize_t SocketIO::Recv(Socket *s, char *buf, size_t sz) { - int i = recv(s->GetFD(), buf, sz, 0); + ssize_t i = recv(s->GetFD(), buf, sz, 0); if (i > 0) TotalRead += i; return i; } -int SocketIO::Send(Socket *s, const char *buf, size_t sz) +ssize_t SocketIO::Send(Socket *s, const char *buf, size_t sz) { - int i = send(s->GetFD(), buf, sz, 0); + ssize_t i = send(s->GetFD(), buf, sz, 0); if (i > 0) TotalWritten += i; return i; } -int SocketIO::Send(Socket *s, const Anope::string &buf) +ssize_t SocketIO::Send(Socket *s, const Anope::string &buf) { return this->Send(s, buf.c_str(), buf.length()); } diff --git a/src/win32/anope_windows.h b/src/win32/anope_windows.h index 87eaff2a9..1b7e01915 100644 --- a/src/win32/anope_windows.h +++ b/src/win32/anope_windows.h @@ -55,7 +55,7 @@ #include "pipe/pipe.h" #include "sigaction/sigaction.h" -typedef int ssize_t; +typedef SSIZE_T ssize_t; namespace Anope { |