Index: src/OFSocket.h ================================================================== --- src/OFSocket.h +++ src/OFSocket.h @@ -7,30 +7,15 @@ * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ -/* - * Headers for UNIX systems - */ -#ifndef _WIN32 -#include -#include -#include -#endif - #import "OFStream.h" -/* - * Headers for Win32 - * - * These must be imported after objc/objc.h and thus OFObject! - */ #ifdef _WIN32 -#define _WIN32_WINNT 0x0501 -#include -#include +# define _WIN32_WINNT 0x0501 +# include #endif /** * The OFTCPSocket class provides functions to create and use sockets. */ @@ -39,12 +24,10 @@ #ifndef _WIN32 int sock; #else SOCKET sock; #endif - struct sockaddr *saddr; - socklen_t saddr_len; BOOL eos; } /** * \return A new autoreleased OFTCPSocket Index: src/OFSocket.m ================================================================== --- src/OFSocket.m +++ src/OFSocket.m @@ -38,20 +38,10 @@ + socket { return [[[self alloc] init] autorelease]; } -- init -{ - self = [super init]; - - sock = INVALID_SOCKET; - saddr = NULL; - - return self; -} - - (BOOL)atEndOfStreamWithoutCache { return eos; } Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -6,19 +6,34 @@ * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#ifndef _WIN32 +# include +# include +# include +#endif #import "OFSocket.h" + +#ifdef _WIN32 +# include +#endif @class OFString; /** * The OFTCPSocket class provides functions to create and use sockets. */ -@interface OFTCPSocket: OFSocket {} +@interface OFTCPSocket: OFSocket +{ + struct sockaddr *saddr; + socklen_t saddr_len; +} + /** * Connect the OFTCPSocket to the specified destination. * * \param service The service on the node to connect to * \param node The node to connect to Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -41,10 +41,20 @@ { if (self == [OFTCPSocket class]) mutex = [[OFMutex alloc] init]; } #endif + +- init +{ + self = [super init]; + + sock = INVALID_SOCKET; + saddr = NULL; + + return self; +} - (void)dealloc { if (sock != INVALID_SOCKET) close(sock);