Fix indentation.
This commit is contained in:
+17
-17
@@ -13,12 +13,12 @@
|
||||
|
||||
#if defined(_XBOX)
|
||||
#elif defined(_WINDOWS) // We need the WinSock32 Library on Windows
|
||||
#pragma comment(lib,"wsock32.lib")
|
||||
#pragma comment(lib,"wsock32.lib")
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
EzSockets::EzSockets()
|
||||
@@ -26,9 +26,9 @@ EzSockets::EzSockets()
|
||||
MAXCON = 5;
|
||||
memset (&addr,0,sizeof(addr)); //Clear the sockaddr_in structure
|
||||
|
||||
#if defined(_WINDOWS) || defined(_XBOX) // Windows REQUIRES WinSock Startup
|
||||
#if defined(_WINDOWS) || defined(_XBOX) // Windows REQUIRES WinSock Startup
|
||||
WSAStartup( MAKEWORD(1,1), &wsda );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
sock = -1;
|
||||
blocking = true;
|
||||
@@ -108,7 +108,7 @@ bool EzSockets::listen()
|
||||
}
|
||||
|
||||
#if defined(WIN32) || defined(DARWIN)// glibc already has socklen_t defined
|
||||
typedef int socklen_t;
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
bool EzSockets::accept(EzSockets& socket)
|
||||
@@ -121,7 +121,7 @@ bool EzSockets::accept(EzSockets& socket)
|
||||
socket.sock = ::accept(sock,(struct sockaddr*) &socket.addr,
|
||||
(socklen_t*) &length);
|
||||
|
||||
if(socket.sock<=0)
|
||||
if (socket.sock <= 0)
|
||||
return false;
|
||||
|
||||
socket.state = skCONNECTED;
|
||||
@@ -134,11 +134,11 @@ void EzSockets::close()
|
||||
inBuffer = "";
|
||||
outBuffer = "";
|
||||
|
||||
#if defined(WIN32) // The close socket command is different in Windows
|
||||
#if defined(WIN32) // The close socket command is different in Windows
|
||||
::closesocket(sock);
|
||||
#else
|
||||
#else
|
||||
::close(sock);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
long EzSockets::uAddr()
|
||||
@@ -152,17 +152,17 @@ bool EzSockets::connect(const std::string& host,unsigned short port)
|
||||
if(!check())
|
||||
return false;
|
||||
|
||||
#if defined(_XBOX)
|
||||
#if defined(_XBOX)
|
||||
// FIXME: Xbox doesn't have gethostbyname or any way to get a hostent.
|
||||
// Investigate the samples and figure out how this is supposed to work.
|
||||
return false;
|
||||
#elif defined(_WINDOWS)
|
||||
#elif defined(_WINDOWS)
|
||||
struct hostent* phe;
|
||||
phe = gethostbyname(host.c_str());
|
||||
addr.sin_addr = *((LPIN_ADDR)* phe->h_addr_list);
|
||||
#else
|
||||
#else
|
||||
inet_pton(AF_INET,host.c_str(), &addr.sin_addr);
|
||||
#endif
|
||||
#endif
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
|
||||
@@ -249,7 +249,7 @@ int EzSockets::ReadData(char *data, unsigned int bytes)
|
||||
|
||||
int EzSockets::PeekData(char *data, unsigned int bytes)
|
||||
{
|
||||
if(blocking)
|
||||
if (blocking)
|
||||
while ((inBuffer.length()<bytes) && !IsError())
|
||||
pUpdateRead();
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user