From 8f7173abc4a901249df3ae13a91d3f19874ac269 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Fri, 6 Aug 1999 18:23:49 +0000 Subject: [PATCH] Changed Ungetch(void *, ...) to Ungetch(const void *, ...) Fixed some bug in gsocket git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/stream.h | 2 +- src/common/stream.cpp | 2 +- src/unix/gsocket.c | 17 +++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/wx/stream.h b/include/wx/stream.h index 5a95880ffb..d9fe1b89c0 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -93,7 +93,7 @@ class WXDLLEXPORT wxInputStream: public wxStreamBase { virtual size_t LastRead() { return wxStreamBase::m_lastcount; } // Ungetch - size_t Ungetch(void *buffer, size_t size); + size_t Ungetch(const void *buffer, size_t size); bool Ungetch(char c); // Operators diff --git a/src/common/stream.cpp b/src/common/stream.cpp index b22e5adb46..c755d78c9d 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -499,7 +499,7 @@ size_t wxInputStream::GetWBack(char *buf, size_t bsize) return s_toget; } -size_t wxInputStream::Ungetch(void *buf, size_t bufsize) +size_t wxInputStream::Ungetch(const void *buf, size_t bufsize) { char *ptrback; diff --git a/src/unix/gsocket.c b/src/unix/gsocket.c index 4255501bd8..af3349248b 100644 --- a/src/unix/gsocket.c +++ b/src/unix/gsocket.c @@ -263,6 +263,7 @@ GSocketError GSocket_SetServer(GSocket *sck) /* We always have a stream here */ sck->m_stream = TRUE; + sck->m_server = TRUE; /* Create the socket */ sck->m_fd = socket(sck->m_local->m_realfamily, SOCK_STREAM, 0); @@ -670,11 +671,11 @@ int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size) DISABLE_TIMEOUT(socket); UNMASK_SIGNAL(); - if (ret == -1 && errno != EAGAIN) { + if (ret == -1 && errno != EWOULDBLOCK) { socket->m_error = GSOCK_IOERR; return -1; } - if (errno == EAGAIN) { + if (errno == EWOULDBLOCK) { socket->m_error = GSOCK_TRYAGAIN; return -1; } @@ -694,11 +695,11 @@ int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size) ret = recvfrom(socket->m_fd, buffer, size, 0, &from, &fromlen); DISABLE_TIMEOUT(socket); UNMASK_SIGNAL(); - if (ret == -1 && errno != EAGAIN) { + if (ret == -1 && errno != EWOULDBLOCK) { socket->m_error = GSOCK_IOERR; return -1; } - if (errno == EAGAIN) { + if (errno == EWOULDBLOCK) { socket->m_error = GSOCK_TRYAGAIN; return -1; } @@ -726,11 +727,11 @@ int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size) ret = send(socket->m_fd, buffer, size, 0); DISABLE_TIMEOUT(socket); UNMASK_SIGNAL(); - if (ret == -1 && errno != EAGAIN) { + if (ret == -1 && errno != EWOULDBLOCK) { socket->m_error = GSOCK_IOERR; return -1; } - if (errno == EAGAIN) { + if (errno == EWOULDBLOCK) { socket->m_error = GSOCK_TRYAGAIN; return -1; } @@ -760,11 +761,11 @@ int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size) /* Frees memory allocated from _GAddress_translate_to */ free(addr); - if (ret == -1 && errno != EAGAIN) { + if (ret == -1 && errno != EWOULDBLOCK) { socket->m_error = GSOCK_IOERR; return -1; } - if (errno == EAGAIN) { + if (errno == EWOULDBLOCK) { socket->m_error = GSOCK_TRYAGAIN; return -1; } -- 2.45.2