Use bool instead of int. Replace TRUE/FALSE with true/false.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28709 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -42,13 +42,13 @@ public:
|
|||||||
GAddress *GetPeer();
|
GAddress *GetPeer();
|
||||||
GSocketError SetServer();
|
GSocketError SetServer();
|
||||||
GSocket *WaitConnection();
|
GSocket *WaitConnection();
|
||||||
int SetReusable() { return 0; }
|
bool SetReusable() { return false; }
|
||||||
GSocketError SetNonOriented();
|
GSocketError SetNonOriented();
|
||||||
GSocketError Connect(GSocketStream stream);
|
GSocketError Connect(GSocketStream stream);
|
||||||
int Read(char *buffer, int size);
|
int Read(char *buffer, int size);
|
||||||
int Write(const char *buffer, int size);
|
int Write(const char *buffer, int size);
|
||||||
GSocketEventFlags Select(GSocketEventFlags flags);
|
GSocketEventFlags Select(GSocketEventFlags flags);
|
||||||
void SetNonBlocking(int non_block);
|
void SetNonBlocking(bool non_block);
|
||||||
void SetTimeout(unsigned long millisec);
|
void SetTimeout(unsigned long millisec);
|
||||||
GSocketError WXDLLIMPEXP_NET GetError();
|
GSocketError WXDLLIMPEXP_NET GetError();
|
||||||
void SetCallback(GSocketEventFlags flags,
|
void SetCallback(GSocketEventFlags flags,
|
||||||
@@ -83,17 +83,17 @@ public:
|
|||||||
GAddress *m_peer;
|
GAddress *m_peer;
|
||||||
GSocketError m_error;
|
GSocketError m_error;
|
||||||
|
|
||||||
int m_non_blocking;
|
bool m_non_blocking;
|
||||||
int m_server;
|
bool m_server;
|
||||||
int m_stream;
|
bool m_stream;
|
||||||
int m_oriented;
|
bool m_oriented;
|
||||||
unsigned long m_timeout;
|
unsigned long m_timeout;
|
||||||
|
|
||||||
/* Callbacks */
|
/* Callbacks */
|
||||||
GSocketEventFlags m_detected;
|
GSocketEventFlags m_detected;
|
||||||
GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
|
GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
|
||||||
char *m_data[GSOCK_MAX_EVENT];
|
char *m_data[GSOCK_MAX_EVENT];
|
||||||
int m_takesEvents ;
|
bool m_takesEvents ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -23,14 +23,6 @@
|
|||||||
|
|
||||||
#include "wx/msw/wrapwin.h"
|
#include "wx/msw/wrapwin.h"
|
||||||
|
|
||||||
#ifndef TRUE
|
|
||||||
#define TRUE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FALSE
|
|
||||||
#define FALSE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable
|
class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -58,7 +50,7 @@ public:
|
|||||||
GAddress *GetPeer();
|
GAddress *GetPeer();
|
||||||
GSocketError SetServer();
|
GSocketError SetServer();
|
||||||
GSocket *WaitConnection();
|
GSocket *WaitConnection();
|
||||||
int SetReusable();
|
bool SetReusable();
|
||||||
GSocketError Connect(GSocketStream stream);
|
GSocketError Connect(GSocketStream stream);
|
||||||
GSocketError SetNonOriented();
|
GSocketError SetNonOriented();
|
||||||
int Read(char *buffer, int size);
|
int Read(char *buffer, int size);
|
||||||
@@ -92,11 +84,11 @@ public:
|
|||||||
GSocketError m_error;
|
GSocketError m_error;
|
||||||
|
|
||||||
/* Attributes */
|
/* Attributes */
|
||||||
int m_non_blocking;
|
bool m_non_blocking;
|
||||||
int m_server;
|
bool m_server;
|
||||||
int m_stream;
|
bool m_stream;
|
||||||
int m_establishing;
|
bool m_establishing;
|
||||||
int m_reusable;
|
bool m_reusable;
|
||||||
struct timeval m_timeout;
|
struct timeval m_timeout;
|
||||||
|
|
||||||
/* Callbacks */
|
/* Callbacks */
|
||||||
|
@@ -21,14 +21,6 @@
|
|||||||
#include "gsocket.h"
|
#include "gsocket.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TRUE
|
|
||||||
#define TRUE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FALSE
|
|
||||||
#define FALSE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable
|
class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -57,13 +49,13 @@ public:
|
|||||||
GAddress *GetPeer();
|
GAddress *GetPeer();
|
||||||
GSocketError SetServer();
|
GSocketError SetServer();
|
||||||
GSocket *WaitConnection();
|
GSocket *WaitConnection();
|
||||||
int SetReusable();
|
bool SetReusable();
|
||||||
GSocketError Connect(GSocketStream stream);
|
GSocketError Connect(GSocketStream stream);
|
||||||
GSocketError SetNonOriented();
|
GSocketError SetNonOriented();
|
||||||
int Read(char *buffer, int size);
|
int Read(char *buffer, int size);
|
||||||
int Write(const char *buffer, int size);
|
int Write(const char *buffer, int size);
|
||||||
GSocketEventFlags Select(GSocketEventFlags flags);
|
GSocketEventFlags Select(GSocketEventFlags flags);
|
||||||
void SetNonBlocking(int non_block);
|
void SetNonBlocking(bool non_block);
|
||||||
void SetTimeout(unsigned long millisec);
|
void SetTimeout(unsigned long millisec);
|
||||||
GSocketError WXDLLIMPEXP_NET GetError();
|
GSocketError WXDLLIMPEXP_NET GetError();
|
||||||
void SetCallback(GSocketEventFlags flags,
|
void SetCallback(GSocketEventFlags flags,
|
||||||
@@ -95,11 +87,11 @@ public:
|
|||||||
GAddress *m_peer;
|
GAddress *m_peer;
|
||||||
GSocketError m_error;
|
GSocketError m_error;
|
||||||
|
|
||||||
int m_non_blocking;
|
bool m_non_blocking;
|
||||||
int m_server;
|
bool m_server;
|
||||||
int m_stream;
|
bool m_stream;
|
||||||
int m_establishing;
|
bool m_establishing;
|
||||||
int m_reusable;
|
bool m_reusable;
|
||||||
unsigned long m_timeout;
|
unsigned long m_timeout;
|
||||||
|
|
||||||
/* Callbacks */
|
/* Callbacks */
|
||||||
|
@@ -23,12 +23,6 @@
|
|||||||
#ifdef __DARWIN__
|
#ifdef __DARWIN__
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
|
|
||||||
#ifndef FALSE
|
|
||||||
#define FALSE 0
|
|
||||||
#endif
|
|
||||||
#ifndef TRUE
|
|
||||||
#define TRUE 1
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#include <MacHeaders.c>
|
#include <MacHeaders.c>
|
||||||
#define OTUNIXERRORS 1
|
#define OTUNIXERRORS 1
|
||||||
@@ -209,11 +203,11 @@ void GSocket_SetGUIFunctions(GSocketGUIFunctionsTable *table)
|
|||||||
|
|
||||||
int GSocket_Init()
|
int GSocket_Init()
|
||||||
{
|
{
|
||||||
return TRUE;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GSocket_Verify_Inited() ;
|
bool GSocket_Verify_Inited() ;
|
||||||
int GSocket_Verify_Inited()
|
bool GSocket_Verify_Inited()
|
||||||
{
|
{
|
||||||
OSStatus err ;
|
OSStatus err ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -222,7 +216,7 @@ int GSocket_Verify_Inited()
|
|||||||
OTClientContextPtr clientcontext;
|
OTClientContextPtr clientcontext;
|
||||||
|
|
||||||
if ( gInetSvcRef )
|
if ( gInetSvcRef )
|
||||||
return TRUE ;
|
return true ;
|
||||||
|
|
||||||
InitOpenTransportInContext(kInitOTForApplicationMask, &clientcontext);
|
InitOpenTransportInContext(kInitOTForApplicationMask, &clientcontext);
|
||||||
gOTInited = 1 ;
|
gOTInited = 1 ;
|
||||||
@@ -230,7 +224,7 @@ int GSocket_Verify_Inited()
|
|||||||
NULL, &err, clientcontext);
|
NULL, &err, clientcontext);
|
||||||
#else
|
#else
|
||||||
if ( gInetSvcRef )
|
if ( gInetSvcRef )
|
||||||
return TRUE ;
|
return true ;
|
||||||
|
|
||||||
InitOpenTransport() ;
|
InitOpenTransport() ;
|
||||||
gOTInited = 1 ;
|
gOTInited = 1 ;
|
||||||
@@ -239,10 +233,10 @@ int GSocket_Verify_Inited()
|
|||||||
if ( gInetSvcRef == NULL || err != kOTNoError )
|
if ( gInetSvcRef == NULL || err != kOTNoError )
|
||||||
{
|
{
|
||||||
OTAssert("Could not open Inet Services", err == noErr);
|
OTAssert("Could not open Inet Services", err == noErr);
|
||||||
return FALSE ;
|
return false ;
|
||||||
}
|
}
|
||||||
gOTNotifierUPP = NewOTNotifyUPP( OTInetEventHandler ) ;
|
gOTNotifierUPP = NewOTNotifyUPP( OTInetEventHandler ) ;
|
||||||
return TRUE ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSocket_Cleanup()
|
void GSocket_Cleanup()
|
||||||
@@ -267,7 +261,7 @@ GSocket::GSocket()
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
m_ok = (GSocket_Verify_Inited() != FALSE);
|
m_ok = GSocket_Verify_Inited();
|
||||||
|
|
||||||
m_endpoint = NULL ;
|
m_endpoint = NULL ;
|
||||||
for (i=0;i<GSOCK_MAX_EVENT;i++)
|
for (i=0;i<GSOCK_MAX_EVENT;i++)
|
||||||
@@ -278,12 +272,12 @@ GSocket::GSocket()
|
|||||||
m_local = NULL;
|
m_local = NULL;
|
||||||
m_peer = NULL;
|
m_peer = NULL;
|
||||||
m_error = GSOCK_NOERROR;
|
m_error = GSOCK_NOERROR;
|
||||||
m_server = FALSE;
|
m_server = false;
|
||||||
m_stream = TRUE;
|
m_stream = true;
|
||||||
m_non_blocking = FALSE;
|
m_non_blocking = false;
|
||||||
m_timeout = 1*1000;
|
m_timeout = 1*1000;
|
||||||
/* 10 sec * 1000 millisec */
|
/* 10 sec * 1000 millisec */
|
||||||
m_takesEvents = TRUE ;
|
m_takesEvents = true ;
|
||||||
m_mac_events = wxMacGetNotifierTable() ;
|
m_mac_events = wxMacGetNotifierTable() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,9 +487,9 @@ GSocketError GSocket::SetServer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all fields */
|
/* Initialize all fields */
|
||||||
m_stream = TRUE;
|
m_stream = true;
|
||||||
m_server = TRUE;
|
m_server = true;
|
||||||
m_oriented = TRUE;
|
m_oriented = true;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
#if 0
|
#if 0
|
||||||
@@ -592,9 +586,9 @@ GSocket *GSocket::WaitConnection()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all fields */
|
/* Initialize all fields */
|
||||||
connection->m_server = FALSE;
|
connection->m_server = false;
|
||||||
connection->m_stream = TRUE;
|
connection->m_stream = true;
|
||||||
connection->m_oriented = TRUE;
|
connection->m_oriented = true;
|
||||||
|
|
||||||
/* Setup the peer address field */
|
/* Setup the peer address field */
|
||||||
connection->m_peer = GAddress_new();
|
connection->m_peer = GAddress_new();
|
||||||
@@ -652,9 +646,9 @@ GSocketError GSocket::SetNonOriented()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all fields */
|
/* Initialize all fields */
|
||||||
m_stream = FALSE;
|
m_stream = false;
|
||||||
m_server = FALSE;
|
m_server = false;
|
||||||
m_oriented = FALSE;
|
m_oriented = false;
|
||||||
|
|
||||||
/* Create the socket */
|
/* Create the socket */
|
||||||
|
|
||||||
@@ -745,8 +739,8 @@ GSocketError GSocket::Connect(GSocketStream stream)
|
|||||||
|
|
||||||
/* Streamed or dgram socket? */
|
/* Streamed or dgram socket? */
|
||||||
m_stream = (stream == GSOCK_STREAMED);
|
m_stream = (stream == GSOCK_STREAMED);
|
||||||
m_oriented = TRUE;
|
m_oriented = true;
|
||||||
m_server = FALSE;
|
m_server = false;
|
||||||
|
|
||||||
/* Create the socket */
|
/* Create the socket */
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -957,7 +951,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
* Sets the socket to non-blocking mode. All IO calls will return
|
* Sets the socket to non-blocking mode. All IO calls will return
|
||||||
* immediately.
|
* immediately.
|
||||||
*/
|
*/
|
||||||
void GSocket::SetNonBlocking(int non_block)
|
void GSocket::SetNonBlocking(bool non_block)
|
||||||
{
|
{
|
||||||
assert(this);
|
assert(this);
|
||||||
|
|
||||||
@@ -1267,7 +1261,7 @@ GSocketError _GAddress_translate_from(GAddress *address,
|
|||||||
GSocketError _GAddress_translate_to(GAddress *address,
|
GSocketError _GAddress_translate_to(GAddress *address,
|
||||||
InetAddress *addr)
|
InetAddress *addr)
|
||||||
{
|
{
|
||||||
if ( GSocket_Verify_Inited() == FALSE )
|
if ( !GSocket_Verify_Inited() )
|
||||||
return GSOCK_IOERR ;
|
return GSOCK_IOERR ;
|
||||||
memset(addr, 0 , sizeof(struct InetAddress));
|
memset(addr, 0 , sizeof(struct InetAddress));
|
||||||
OTInitInetAddress( addr , address->m_port , address->m_host ) ;
|
OTInitInetAddress( addr , address->m_port , address->m_host ) ;
|
||||||
@@ -1293,7 +1287,7 @@ GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname)
|
|||||||
InetHostInfo hinfo ;
|
InetHostInfo hinfo ;
|
||||||
OSStatus ret ;
|
OSStatus ret ;
|
||||||
|
|
||||||
if ( GSocket_Verify_Inited() == FALSE )
|
if ( !GSocket_Verify_Inited() )
|
||||||
return GSOCK_IOERR ;
|
return GSOCK_IOERR ;
|
||||||
|
|
||||||
assert(address != NULL);
|
assert(address != NULL);
|
||||||
@@ -1387,7 +1381,7 @@ GSocketError GAddress_INET_SetPort(GAddress *address, unsigned short port)
|
|||||||
GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, size_t sbuf)
|
GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, size_t sbuf)
|
||||||
{
|
{
|
||||||
InetDomainName name ;
|
InetDomainName name ;
|
||||||
if ( GSocket_Verify_Inited() == FALSE )
|
if ( !GSocket_Verify_Inited() )
|
||||||
return GSOCK_IOERR ;
|
return GSOCK_IOERR ;
|
||||||
|
|
||||||
assert(address != NULL);
|
assert(address != NULL);
|
||||||
@@ -1421,7 +1415,7 @@ void GSocket::Enable_Events()
|
|||||||
|
|
||||||
{
|
{
|
||||||
OTResult state ;
|
OTResult state ;
|
||||||
m_takesEvents = TRUE ;
|
m_takesEvents = true ;
|
||||||
state = OTGetEndpointState(m_endpoint);
|
state = OTGetEndpointState(m_endpoint);
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -1445,7 +1439,7 @@ void GSocket::Enable_Events()
|
|||||||
|
|
||||||
void GSocket::Disable_Events()
|
void GSocket::Disable_Events()
|
||||||
{
|
{
|
||||||
m_takesEvents = FALSE ;
|
m_takesEvents = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* _GSocket_Input_Timeout:
|
/* _GSocket_Input_Timeout:
|
||||||
@@ -1457,10 +1451,10 @@ GSocketError GSocket::Input_Timeout()
|
|||||||
if ( !m_non_blocking )
|
if ( !m_non_blocking )
|
||||||
{
|
{
|
||||||
UnsignedWide now , start ;
|
UnsignedWide now , start ;
|
||||||
short formerTakesEvents = m_takesEvents ;
|
bool formerTakesEvents = m_takesEvents ;
|
||||||
Microseconds(&start);
|
Microseconds(&start);
|
||||||
now = start ;
|
now = start ;
|
||||||
m_takesEvents = FALSE ;
|
m_takesEvents = false ;
|
||||||
|
|
||||||
while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < m_timeout * 1000.0 )
|
while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < m_timeout * 1000.0 )
|
||||||
{
|
{
|
||||||
@@ -1492,10 +1486,10 @@ GSocketError GSocket::Output_Timeout()
|
|||||||
if ( !m_non_blocking )
|
if ( !m_non_blocking )
|
||||||
{
|
{
|
||||||
UnsignedWide now , start ;
|
UnsignedWide now , start ;
|
||||||
short formerTakesEvents = m_takesEvents ;
|
bool formerTakesEvents = m_takesEvents ;
|
||||||
Microseconds(&start);
|
Microseconds(&start);
|
||||||
now = start ;
|
now = start ;
|
||||||
m_takesEvents = FALSE ;
|
m_takesEvents = false ;
|
||||||
|
|
||||||
while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < m_timeout * 1000.0 )
|
while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < m_timeout * 1000.0 )
|
||||||
{
|
{
|
||||||
|
@@ -55,7 +55,7 @@ bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket)
|
|||||||
m_id[0] = -1;
|
m_id[0] = -1;
|
||||||
m_id[1] = -1;
|
m_id[1] = -1;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket)
|
void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket)
|
||||||
|
@@ -171,13 +171,13 @@ GSocket::GSocket()
|
|||||||
m_local = NULL;
|
m_local = NULL;
|
||||||
m_peer = NULL;
|
m_peer = NULL;
|
||||||
m_error = GSOCK_NOERROR;
|
m_error = GSOCK_NOERROR;
|
||||||
m_server = FALSE;
|
m_server = false;
|
||||||
m_stream = TRUE;
|
m_stream = true;
|
||||||
m_non_blocking = false;
|
m_non_blocking = false;
|
||||||
m_timeout.tv_sec = 10 * 60; /* 10 minutes */
|
m_timeout.tv_sec = 10 * 60; /* 10 minutes */
|
||||||
m_timeout.tv_usec = 0;
|
m_timeout.tv_usec = 0;
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
m_reusable = FALSE;
|
m_reusable = false;
|
||||||
|
|
||||||
assert(gs_gui_functions);
|
assert(gs_gui_functions);
|
||||||
/* Per-socket GUI-specific initialization */
|
/* Per-socket GUI-specific initialization */
|
||||||
@@ -382,8 +382,8 @@ GSocketError GSocket::SetServer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all fields */
|
/* Initialize all fields */
|
||||||
m_server = TRUE;
|
m_server = true;
|
||||||
m_stream = TRUE;
|
m_stream = true;
|
||||||
|
|
||||||
/* Create the socket */
|
/* Create the socket */
|
||||||
m_fd = socket(m_local->m_realfamily, SOCK_STREAM, 0);
|
m_fd = socket(m_local->m_realfamily, SOCK_STREAM, 0);
|
||||||
@@ -485,8 +485,8 @@ GSocket *GSocket::WaitConnection()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all fields */
|
/* Initialize all fields */
|
||||||
connection->m_server = FALSE;
|
connection->m_server = false;
|
||||||
connection->m_stream = TRUE;
|
connection->m_stream = true;
|
||||||
|
|
||||||
/* Setup the peer address field */
|
/* Setup the peer address field */
|
||||||
connection->m_peer = GAddress_new();
|
connection->m_peer = GAddress_new();
|
||||||
@@ -519,14 +519,14 @@ GSocket *GSocket::WaitConnection()
|
|||||||
* Returns TRUE if the flag was set correctly, FALSE if an error occured
|
* Returns TRUE if the flag was set correctly, FALSE if an error occured
|
||||||
* (ie, if the parameter was NULL)
|
* (ie, if the parameter was NULL)
|
||||||
*/
|
*/
|
||||||
int GSocket::SetReusable()
|
bool GSocket::SetReusable()
|
||||||
{
|
{
|
||||||
/* socket must not be null, and must not be in use/already bound */
|
/* socket must not be null, and must not be in use/already bound */
|
||||||
if (this && m_fd == INVALID_SOCKET) {
|
if (this && m_fd == INVALID_SOCKET) {
|
||||||
m_reusable = TRUE;
|
m_reusable = true;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Client specific parts */
|
/* Client specific parts */
|
||||||
@@ -578,8 +578,8 @@ GSocketError GSocket::Connect(GSocketStream stream)
|
|||||||
|
|
||||||
/* Streamed or dgram socket? */
|
/* Streamed or dgram socket? */
|
||||||
m_stream = (stream == GSOCK_STREAMED);
|
m_stream = (stream == GSOCK_STREAMED);
|
||||||
m_server = FALSE;
|
m_server = false;
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
/* Create the socket */
|
/* Create the socket */
|
||||||
m_fd = socket(m_peer->m_realfamily,
|
m_fd = socket(m_peer->m_realfamily,
|
||||||
@@ -627,7 +627,7 @@ GSocketError GSocket::Connect(GSocketStream stream)
|
|||||||
*/
|
*/
|
||||||
if ((err == WSAEWOULDBLOCK) && (m_non_blocking))
|
if ((err == WSAEWOULDBLOCK) && (m_non_blocking))
|
||||||
{
|
{
|
||||||
m_establishing = TRUE;
|
m_establishing = true;
|
||||||
m_error = GSOCK_WOULDBLOCK;
|
m_error = GSOCK_WOULDBLOCK;
|
||||||
return GSOCK_WOULDBLOCK;
|
return GSOCK_WOULDBLOCK;
|
||||||
}
|
}
|
||||||
@@ -675,8 +675,8 @@ GSocketError GSocket::SetNonOriented()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all fields */
|
/* Initialize all fields */
|
||||||
m_stream = FALSE;
|
m_stream = false;
|
||||||
m_server = FALSE;
|
m_server = false;
|
||||||
|
|
||||||
/* Create the socket */
|
/* Create the socket */
|
||||||
m_fd = socket(m_local->m_realfamily, SOCK_DGRAM, 0);
|
m_fd = socket(m_local->m_realfamily, SOCK_DGRAM, 0);
|
||||||
@@ -821,7 +821,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
*/
|
*/
|
||||||
if ((m_detected & GSOCK_LOST_FLAG) != 0)
|
if ((m_detected & GSOCK_LOST_FLAG) != 0)
|
||||||
{
|
{
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
return (GSOCK_LOST_FLAG & flags);
|
return (GSOCK_LOST_FLAG & flags);
|
||||||
}
|
}
|
||||||
@@ -853,7 +853,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_detected = GSOCK_LOST_FLAG;
|
m_detected = GSOCK_LOST_FLAG;
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
/* LOST event: Abort any further processing */
|
/* LOST event: Abort any further processing */
|
||||||
return (GSOCK_LOST_FLAG & flags);
|
return (GSOCK_LOST_FLAG & flags);
|
||||||
@@ -869,7 +869,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
int error;
|
int error;
|
||||||
SOCKLEN_T len = sizeof(error);
|
SOCKLEN_T len = sizeof(error);
|
||||||
|
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (char*)&error, &len);
|
getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (char*)&error, &len);
|
||||||
|
|
||||||
@@ -895,7 +895,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
/* Check for exceptions and errors (is this useful in Unices?) */
|
/* Check for exceptions and errors (is this useful in Unices?) */
|
||||||
if (FD_ISSET(m_fd, &exceptfds))
|
if (FD_ISSET(m_fd, &exceptfds))
|
||||||
{
|
{
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
m_detected = GSOCK_LOST_FLAG;
|
m_detected = GSOCK_LOST_FLAG;
|
||||||
|
|
||||||
/* LOST event: Abort any further processing */
|
/* LOST event: Abort any further processing */
|
||||||
|
@@ -54,7 +54,7 @@ bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket)
|
|||||||
|
|
||||||
m_id[0] = -1;
|
m_id[0] = -1;
|
||||||
m_id[1] = -1;
|
m_id[1] = -1;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket)
|
void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket)
|
||||||
|
@@ -240,13 +240,13 @@ GSocket::GSocket()
|
|||||||
m_local = NULL;
|
m_local = NULL;
|
||||||
m_peer = NULL;
|
m_peer = NULL;
|
||||||
m_error = GSOCK_NOERROR;
|
m_error = GSOCK_NOERROR;
|
||||||
m_server = FALSE;
|
m_server = false;
|
||||||
m_stream = TRUE;
|
m_stream = true;
|
||||||
m_gui_dependent = NULL;
|
m_gui_dependent = NULL;
|
||||||
m_non_blocking = FALSE;
|
m_non_blocking = false;
|
||||||
m_timeout = 10*60*1000;
|
m_timeout = 10*60*1000;
|
||||||
/* 10 minutes * 60 sec * 1000 millisec */
|
/* 10 minutes * 60 sec * 1000 millisec */
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
assert(gs_gui_functions);
|
assert(gs_gui_functions);
|
||||||
/* Per-socket GUI-specific initialization */
|
/* Per-socket GUI-specific initialization */
|
||||||
@@ -456,8 +456,8 @@ GSocketError GSocket::SetServer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all fields */
|
/* Initialize all fields */
|
||||||
m_stream = TRUE;
|
m_stream = true;
|
||||||
m_server = TRUE;
|
m_server = true;
|
||||||
|
|
||||||
/* Create the socket */
|
/* Create the socket */
|
||||||
m_fd = socket(m_local->m_realfamily, SOCK_STREAM, 0);
|
m_fd = socket(m_local->m_realfamily, SOCK_STREAM, 0);
|
||||||
@@ -561,8 +561,8 @@ GSocket *GSocket::WaitConnection()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all fields */
|
/* Initialize all fields */
|
||||||
connection->m_server = FALSE;
|
connection->m_server = false;
|
||||||
connection->m_stream = TRUE;
|
connection->m_stream = true;
|
||||||
|
|
||||||
/* Setup the peer address field */
|
/* Setup the peer address field */
|
||||||
connection->m_peer = GAddress_new();
|
connection->m_peer = GAddress_new();
|
||||||
@@ -590,14 +590,14 @@ GSocket *GSocket::WaitConnection()
|
|||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GSocket::SetReusable()
|
bool GSocket::SetReusable()
|
||||||
{
|
{
|
||||||
/* socket must not be null, and must not be in use/already bound */
|
/* socket must not be null, and must not be in use/already bound */
|
||||||
if (this && m_fd == INVALID_SOCKET) {
|
if (this && m_fd == INVALID_SOCKET) {
|
||||||
m_reusable = TRUE;
|
m_reusable = true;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Client specific parts */
|
/* Client specific parts */
|
||||||
@@ -649,8 +649,8 @@ GSocketError GSocket::Connect(GSocketStream stream)
|
|||||||
|
|
||||||
/* Streamed or dgram socket? */
|
/* Streamed or dgram socket? */
|
||||||
m_stream = (stream == GSOCK_STREAMED);
|
m_stream = (stream == GSOCK_STREAMED);
|
||||||
m_server = FALSE;
|
m_server = false;
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
/* Create the socket */
|
/* Create the socket */
|
||||||
m_fd = socket(m_peer->m_realfamily,
|
m_fd = socket(m_peer->m_realfamily,
|
||||||
@@ -708,7 +708,7 @@ GSocketError GSocket::Connect(GSocketStream stream)
|
|||||||
*/
|
*/
|
||||||
if ((err == EINPROGRESS) && (m_non_blocking))
|
if ((err == EINPROGRESS) && (m_non_blocking))
|
||||||
{
|
{
|
||||||
m_establishing = TRUE;
|
m_establishing = true;
|
||||||
m_error = GSOCK_WOULDBLOCK;
|
m_error = GSOCK_WOULDBLOCK;
|
||||||
return GSOCK_WOULDBLOCK;
|
return GSOCK_WOULDBLOCK;
|
||||||
}
|
}
|
||||||
@@ -756,8 +756,8 @@ GSocketError GSocket::SetNonOriented()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all fields */
|
/* Initialize all fields */
|
||||||
m_stream = FALSE;
|
m_stream = false;
|
||||||
m_server = FALSE;
|
m_server = false;
|
||||||
|
|
||||||
/* Create the socket */
|
/* Create the socket */
|
||||||
m_fd = socket(m_local->m_realfamily, SOCK_DGRAM, 0);
|
m_fd = socket(m_local->m_realfamily, SOCK_DGRAM, 0);
|
||||||
@@ -931,7 +931,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
*/
|
*/
|
||||||
if ((m_detected & GSOCK_LOST_FLAG) != 0)
|
if ((m_detected & GSOCK_LOST_FLAG) != 0)
|
||||||
{
|
{
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
return (GSOCK_LOST_FLAG & flags);
|
return (GSOCK_LOST_FLAG & flags);
|
||||||
}
|
}
|
||||||
@@ -962,7 +962,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_detected = GSOCK_LOST_FLAG;
|
m_detected = GSOCK_LOST_FLAG;
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
/* LOST event: Abort any further processing */
|
/* LOST event: Abort any further processing */
|
||||||
return (GSOCK_LOST_FLAG & flags);
|
return (GSOCK_LOST_FLAG & flags);
|
||||||
@@ -978,7 +978,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
int error;
|
int error;
|
||||||
SOCKLEN_T len = sizeof(error);
|
SOCKLEN_T len = sizeof(error);
|
||||||
|
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (void*)&error, &len);
|
getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (void*)&error, &len);
|
||||||
|
|
||||||
@@ -1004,7 +1004,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
/* Check for exceptions and errors (is this useful in Unices?) */
|
/* Check for exceptions and errors (is this useful in Unices?) */
|
||||||
if (FD_ISSET(m_fd, &exceptfds))
|
if (FD_ISSET(m_fd, &exceptfds))
|
||||||
{
|
{
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
m_detected = GSOCK_LOST_FLAG;
|
m_detected = GSOCK_LOST_FLAG;
|
||||||
|
|
||||||
/* LOST event: Abort any further processing */
|
/* LOST event: Abort any further processing */
|
||||||
@@ -1029,7 +1029,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
* Sets the socket to non-blocking mode. All IO calls will return
|
* Sets the socket to non-blocking mode. All IO calls will return
|
||||||
* immediately.
|
* immediately.
|
||||||
*/
|
*/
|
||||||
void GSocket::SetNonBlocking(int non_block)
|
void GSocket::SetNonBlocking(bool non_block)
|
||||||
{
|
{
|
||||||
assert(this);
|
assert(this);
|
||||||
|
|
||||||
@@ -1356,7 +1356,7 @@ void GSocket::Detected_Read()
|
|||||||
*/
|
*/
|
||||||
if ((m_detected & GSOCK_LOST_FLAG) != 0)
|
if ((m_detected & GSOCK_LOST_FLAG) != 0)
|
||||||
{
|
{
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
CALL_CALLBACK(this, GSOCK_LOST);
|
CALL_CALLBACK(this, GSOCK_LOST);
|
||||||
Shutdown();
|
Shutdown();
|
||||||
@@ -1388,7 +1388,7 @@ void GSocket::Detected_Write()
|
|||||||
*/
|
*/
|
||||||
if ((m_detected & GSOCK_LOST_FLAG) != 0)
|
if ((m_detected & GSOCK_LOST_FLAG) != 0)
|
||||||
{
|
{
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
CALL_CALLBACK(this, GSOCK_LOST);
|
CALL_CALLBACK(this, GSOCK_LOST);
|
||||||
Shutdown();
|
Shutdown();
|
||||||
@@ -1400,7 +1400,7 @@ void GSocket::Detected_Write()
|
|||||||
int error;
|
int error;
|
||||||
SOCKLEN_T len = sizeof(error);
|
SOCKLEN_T len = sizeof(error);
|
||||||
|
|
||||||
m_establishing = FALSE;
|
m_establishing = false;
|
||||||
|
|
||||||
getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (void*)&error, &len);
|
getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (void*)&error, &len);
|
||||||
|
|
||||||
|
@@ -64,7 +64,7 @@ bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket)
|
|||||||
m_id[0] = -1;
|
m_id[0] = -1;
|
||||||
m_id[1] = -1;
|
m_id[1] = -1;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket)
|
void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket)
|
||||||
|
Reference in New Issue
Block a user