generalize define from __MINGW32__ to __MINGW__

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30001 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2010-03-19 12:10:11 +00:00
parent 7e8eeb6142
commit 1a5d643771
51 changed files with 404 additions and 350 deletions

View file

@ -1,3 +1,57 @@
2010-03-19 Richard Frith-Macdonald <rfm@gnu.org>
* config/config.reuseaddr.c:
* Examples/nsconnection_client.m:
* Examples/nsconnection_server.m:
* Headers/Additions/GNUstepBase/GSConfig.h.in:
* Headers/Additions/GNUstepBase/GSFileHandle.h:
* Headers/Additions/GNUstepBase/GSVersionMacros.h:
* Headers/Additions/GNUstepBase/preface.h.in:
* Headers/Foundation/NSPort.h:
* Headers/Foundation/NSRunLoop.h:
* Source/Additions/NSError+GNUstepBase.m:
* Source/Additions/NSTask+GNUstepBase.m:
* Source/cifframe.h:
* Source/GSFileHandle.m:
* Source/GSHTTPURLHandle.m:
* Source/GSNetwork.h:
* Source/GSPortPrivate.h:
* Source/GSPrivate.h:
* Source/GSRunLoopCtxt.h:
* Source/GSRunLoopWatcher.m:
* Source/GSSocketStream.m:
* Source/GSStream.m:
* Source/NSBundle.m:
* Source/NSCalendarDate.m:
* Source/NSConnection.m:
* Source/NSData.m:
* Source/NSDebug.m:
* Source/NSException.m:
* Source/NSFileManager.m:
* Source/NSHost.m:
* Source/NSInvocation.m:
* Source/NSLog.m:
* Source/NSObject.m:
* Source/NSPage.m:
* Source/NSPathUtilities.m:
* Source/NSPipe.m:
* Source/NSProcessInfo.m:
* Source/NSSocketPort.m:
* Source/NSSocketPortNameServer.m:
* Source/NSString.m:
* Source/NSTask.m:
* Source/NSThread.m:
* Source/NSTimeZone.m:
* Source/NSURL.m:
* Source/NSUserDefaults.m:
* Source/objc-load.m:
* Source/ObjectiveC2/blocks_runtime.m:
* SSL/GSSSLHandle.m:
* Tools/gdnc.m:
* Tools/gdomap.c:
* Tools/gspath.m:
Use __MINGW__ rather than __MINGW32__ for windows tests.
2010-03-18 Richard Frith-Macdonald <rfm@gnu.org> 2010-03-18 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSMime.m: * Source/Additions/GSMime.m:

View file

@ -212,7 +212,7 @@ int con_data (id prx)
printf(" got %x\n", ss.z); printf(" got %x\n", ss.z);
[pool release]; [pool release];
#if 1 || !defined(__MINGW32__) #if 1 || !defined(__MINGW__)
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
printf("Struct:\n"); printf("Struct:\n");
memcpy(&bck, &ffoo, sizeof(bck)); memcpy(&bck, &ffoo, sizeof(bck));
@ -507,7 +507,7 @@ int main (int argc, char *argv[], char **env)
NSAutoreleasePool *arp; NSAutoreleasePool *arp;
NSPortNameServer *ns; NSPortNameServer *ns;
Auth *auth; Auth *auth;
#ifndef __MINGW32__ #if !defined(__MINGW__)
extern int optind; extern int optind;
extern char *optarg; extern char *optarg;
#endif #endif

View file

@ -484,7 +484,7 @@ int main(int argc, char *argv[], char **env)
NSPortNameServer *ns; NSPortNameServer *ns;
NSPort *port; NSPort *port;
NSAutoreleasePool *arp = [NSAutoreleasePool new]; NSAutoreleasePool *arp = [NSAutoreleasePool new];
#ifndef __MINGW32__ #if !defined(__MINGW__)
extern int optind; extern int optind;
extern char *optarg; extern char *optarg;
#endif #endif

View file

@ -199,7 +199,7 @@ typedef gsuaddr gsaddr;
/* /*
* Native character type for use in systemcalls etc. * Native character type for use in systemcalls etc.
*/ */
#if defined(__MINGW32__) #if defined(__MINGW__)
#define GSNativeChar uint16_t #define GSNativeChar uint16_t
#else #else
#define GSNativeChar char #define GSNativeChar char

View file

@ -65,7 +65,7 @@
#if USE_ZLIB #if USE_ZLIB
gzFile gzDescriptor; gzFile gzDescriptor;
#endif #endif
#if defined(__MINGW32__) #if defined(__MINGW__)
WSAEVENT event; WSAEVENT event;
#endif #endif
#endif #endif

View file

@ -233,7 +233,7 @@
#if BUILD_libgnustep_base_DLL #if BUILD_libgnustep_base_DLL
# #
# if defined(__MINGW32__) # if defined(__MINGW__)
/* On Mingw, the compiler will export all symbols automatically, so /* On Mingw, the compiler will export all symbols automatically, so
* __declspec(dllexport) is not needed. * __declspec(dllexport) is not needed.
*/ */

View file

@ -29,18 +29,18 @@
#include <stdarg.h> #include <stdarg.h>
#if defined(__WIN32__) || defined(_WIN32) || defined(__MS_WIN32__) #if defined(__WIN32__) || defined(_WIN32) || defined(__MS_WIN32__)
#ifndef __WIN32__ # if !defined(__WIN32__)
#define __WIN32__ # define __WIN32__
#endif # endif
#endif #endif
#ifdef __MINGW32__ #if defined(__MINGW32__)
#ifndef __MINGW__ # if !defined(__MINGW__)
#define __MINGW__ # define __MINGW__
#endif # endif
#ifndef __WIN32__ # if !defined(__WIN32__)
#define __WIN32__ # define __WIN32__
#endif # endif
#endif #endif
#if defined(__WIN32__) #if defined(__WIN32__)

View file

@ -33,7 +33,7 @@
#import <Foundation/NSObject.h> #import <Foundation/NSObject.h>
#import <Foundation/NSMapTable.h> #import <Foundation/NSMapTable.h>
#if defined(__MINGW32__) #if defined(__MINGW__)
#include <winsock2.h> #include <winsock2.h>
#include <wininet.h> #include <wininet.h>
#else #else
@ -206,7 +206,7 @@ typedef SOCKET NSSocketNativeHandle;
uint16_t portNum; /* TCP port in host byte order. */ uint16_t portNum; /* TCP port in host byte order. */
SOCKET listener; SOCKET listener;
NSMapTable *handles; /* Handles indexed by socket. */ NSMapTable *handles; /* Handles indexed by socket. */
#if defined(__MINGW32__) #if defined(__MINGW__)
WSAEVENT eventListener; WSAEVENT eventListener;
NSMapTable *events; NSMapTable *events;
#endif #endif

View file

@ -121,7 +121,7 @@ GS_EXPORT NSString * const NSDefaultRunLoopMode;
* using NSStream, at which point this API will be redundant. * using NSStream, at which point this API will be redundant.
*/ */
typedef enum { typedef enum {
#ifdef __MINGW32__ #ifdef __MINGW__
ET_HANDLE, /* Watch for an I/O event on a handle. */ ET_HANDLE, /* Watch for an I/O event on a handle. */
ET_RPORT, /* Watch for message arriving on port. */ ET_RPORT, /* Watch for message arriving on port. */
ET_WINMSG, /* Watch for a message on a window handle. */ ET_WINMSG, /* Watch for a message on a window handle. */

View file

@ -31,7 +31,7 @@
#endif #endif
#endif #endif
#ifdef __MINGW32__ #ifdef __MINGW__
#ifndef __WIN32__ #ifndef __WIN32__
#define __WIN32__ #define __WIN32__
#endif #endif
@ -64,7 +64,7 @@
#import "GNUstepBase/GSFileHandle.h" #import "GNUstepBase/GSFileHandle.h"
#import "GSPrivate.h" #import "GSPrivate.h"
#if defined(__MINGW32__) #if defined(__MINGW__)
#include <winsock2.h> #include <winsock2.h>
#else #else
#include <time.h> #include <time.h>
@ -74,7 +74,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <signal.h> #include <signal.h>
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
#include <sys/file.h> #include <sys/file.h>
#include <sys/stat.h> #include <sys/stat.h>

View file

@ -27,7 +27,7 @@
#import "Foundation/NSError.h" #import "Foundation/NSError.h"
#import "GSPrivate.h" #import "GSPrivate.h"
#if !defined(__MINGW32__) #if !defined(__MINGW__)
#include <errno.h> #include <errno.h>
#endif #endif
@ -38,7 +38,7 @@
@implementation NSError(GNUstepBase) @implementation NSError(GNUstepBase)
#if !defined(__MINGW32__) #if !defined(__MINGW__)
#if !defined(HAVE_STRERROR_R) #if !defined(HAVE_STRERROR_R)
#if defined(HAVE_STRERROR) #if defined(HAVE_STRERROR)
static int static int
@ -89,7 +89,7 @@ strerror_r(int eno, char *buf, int len)
+ (NSError*) _last + (NSError*) _last
{ {
int eno; int eno;
#if defined(__MINGW32__) #if defined(__MINGW__)
eno = GetLastError(); eno = GetLastError();
if (eno == 0) eno = errno; if (eno == 0) eno = errno;
#else #else
@ -103,7 +103,7 @@ strerror_r(int eno, char *buf, int len)
NSError *error; NSError *error;
NSString *domain; NSString *domain;
NSDictionary *info; NSDictionary *info;
#if defined(__MINGW32__) #if defined(__MINGW__)
LPVOID lpMsgBuf; LPVOID lpMsgBuf;
NSString *message; NSString *message;

View file

@ -33,7 +33,7 @@
static NSString* static NSString*
executablePath(NSFileManager *mgr, NSString *path) executablePath(NSFileManager *mgr, NSString *path)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
NSString *tmp; NSString *tmp;
if ([mgr isExecutableFileAtPath: path]) if ([mgr isExecutableFileAtPath: path])
@ -99,7 +99,7 @@ executablePath(NSFileManager *mgr, NSString *path)
env = [[NSProcessInfo processInfo] environment]; env = [[NSProcessInfo processInfo] environment];
pathlist = [env objectForKey:@"PATH"]; pathlist = [env objectForKey:@"PATH"];
#if defined(__MINGW32__) #if defined(__MINGW__)
/* Windows 2000 and perhaps others have "Path" not "PATH" */ /* Windows 2000 and perhaps others have "Path" not "PATH" */
if (pathlist == nil) if (pathlist == nil)
{ {

View file

@ -1093,7 +1093,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (fstat(desc, &sbuf) < 0) if (fstat(desc, &sbuf) < 0)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
/* On windows, an fstat will fail if the descriptor is a pipe /* On windows, an fstat will fail if the descriptor is a pipe
* or socket, so we simply mark the descriptor as not being a * or socket, so we simply mark the descriptor as not being a
* standard file. * standard file.

View file

@ -313,7 +313,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
[[NSProcessInfo processInfo] processIdentifier]]; [[NSProcessInfo processInfo] processIdentifier]];
IF_NO_GC([debugFile retain];) IF_NO_GC([debugFile retain];)
#if !defined(__MINGW32__) #if !defined(__MINGW__)
sslClass = [NSFileHandle sslClass]; sslClass = [NSFileHandle sslClass];
#endif #endif
} }

View file

@ -38,7 +38,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#if defined(__MINGW32__) #if defined(__MINGW__)
#include <io.h> #include <io.h>
#include <winsock2.h> #include <winsock2.h>
@ -72,7 +72,7 @@
#define GSNETERROR errno #define GSNETERROR errno
#define GSWOULDBLOCK (errno == EINPROGRESS) #define GSWOULDBLOCK (errno == EINPROGRESS)
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
#ifndef INADDRSZ #ifndef INADDRSZ
#define INADDRSZ 4 #define INADDRSZ 4

View file

@ -33,7 +33,7 @@
- (BOOL) removePort: (NSPort*)port forName: (NSString*)name; - (BOOL) removePort: (NSPort*)port forName: (NSString*)name;
@end @end
#if defined(__MINGW32__) #if defined(__MINGW__)
@interface NSMessagePort(Private) @interface NSMessagePort(Private)
+ (id) newWithName: (NSString*)name; + (id) newWithName: (NSString*)name;
- (id) initWithName: (NSString*)name; - (id) initWithName: (NSString*)name;
@ -52,7 +52,7 @@
- (void) addHandle: (GSMessageHandle*)handle forSend: (BOOL)send; - (void) addHandle: (GSMessageHandle*)handle forSend: (BOOL)send;
- (void) removeHandle: (GSMessageHandle*)handle; - (void) removeHandle: (GSMessageHandle*)handle;
@end @end
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
@class GSTcpHandle; @class GSTcpHandle;

View file

@ -252,7 +252,7 @@ typedef enum {
NSRunLoop *loop; NSRunLoop *loop;
NSLock *lock; NSLock *lock;
NSMutableArray *performers; NSMutableArray *performers;
#ifdef __MINGW32__ #ifdef __MINGW__
HANDLE event; HANDLE event;
#else #else
int inputFd; int inputFd;

View file

@ -69,7 +69,7 @@ typedef struct{
unsigned maxWatchers; unsigned maxWatchers;
NSTimer *housekeeper; /** Housekeeping timer for loop. */ NSTimer *housekeeper; /** Housekeeping timer for loop. */
@private @private
#if defined(__MINGW32__) #if defined(__MINGW__)
NSMapTable *handleMap; NSMapTable *handleMap;
NSMapTable *winMsgMap; NSMapTable *winMsgMap;
#else #else

View file

@ -45,7 +45,7 @@
data = item; data = item;
switch (aType) switch (aType)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
case ET_HANDLE: type = aType; break; case ET_HANDLE: type = aType; break;
case ET_WINMSG: type = aType; break; case ET_WINMSG: type = aType; break;
#else #else

View file

@ -65,7 +65,7 @@ GSPrivateSockaddrLength(struct sockaddr *addr)
#ifdef AF_INET6 #ifdef AF_INET6
case AF_INET6: return sizeof(struct sockaddr_in6); case AF_INET6: return sizeof(struct sockaddr_in6);
#endif #endif
#ifndef __MINGW32__ #ifndef __MINGW__
case AF_LOCAL: return sizeof(struct sockaddr_un); case AF_LOCAL: return sizeof(struct sockaddr_un);
#endif #endif
default: return 0; default: return 0;
@ -1236,7 +1236,7 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn";
static inline BOOL static inline BOOL
socketError(int result) socketError(int result)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
return (result == SOCKET_ERROR) ? YES : NO; return (result == SOCKET_ERROR) ? YES : NO;
#else #else
return (result < 0) ? YES : NO; return (result < 0) ? YES : NO;
@ -1246,7 +1246,7 @@ socketError(int result)
static inline BOOL static inline BOOL
socketWouldBlock() socketWouldBlock()
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
int e = WSAGetLastError(); int e = WSAGetLastError();
return (e == WSAEWOULDBLOCK || e == WSAEINPROGRESS) ? YES : NO; return (e == WSAEWOULDBLOCK || e == WSAEINPROGRESS) ? YES : NO;
#else #else
@ -1258,7 +1258,7 @@ socketWouldBlock()
static void static void
setNonBlocking(SOCKET fd) setNonBlocking(SOCKET fd)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
unsigned long dummy = 1; unsigned long dummy = 1;
if (ioctlsocket(fd, FIONBIO, &dummy) == SOCKET_ERROR) if (ioctlsocket(fd, FIONBIO, &dummy) == SOCKET_ERROR)
@ -1298,7 +1298,7 @@ setNonBlocking(SOCKET fd)
_sibling = nil; _sibling = nil;
_closing = NO; _closing = NO;
_passive = NO; _passive = NO;
#if defined(__MINGW32__) #if defined(__MINGW__)
_loopID = WSA_INVALID_EVENT; _loopID = WSA_INVALID_EVENT;
#else #else
_loopID = (void*)(intptr_t)-1; _loopID = (void*)(intptr_t)-1;
@ -1505,7 +1505,7 @@ setNonBlocking(SOCKET fd)
} }
#endif #endif
#ifndef __MINGW32__ #ifndef __MINGW__
case AF_LOCAL: case AF_LOCAL:
{ {
struct sockaddr_un peer; struct sockaddr_un peer;
@ -1539,7 +1539,7 @@ setNonBlocking(SOCKET fd)
- (void) _setLoopID: (void *)ref - (void) _setLoopID: (void *)ref
{ {
#if !defined(__MINGW32__) #if !defined(__MINGW__)
_sock = (SOCKET)(intptr_t)ref; // On gnu/linux _sock is _loopID _sock = (SOCKET)(intptr_t)ref; // On gnu/linux _sock is _loopID
#endif #endif
_loopID = ref; _loopID = ref;
@ -1570,7 +1570,7 @@ setNonBlocking(SOCKET fd)
* monitored, and on mswindows systems we create an event object to be * monitored, and on mswindows systems we create an event object to be
* monitored (the socket events are assoociated with this object later). * monitored (the socket events are assoociated with this object later).
*/ */
#if defined(__MINGW32__) #if defined(__MINGW__)
_loopID = CreateEvent(NULL, NO, NO, NULL); _loopID = CreateEvent(NULL, NO, NO, NULL);
#else #else
_loopID = (void*)(intptr_t)sock; // On gnu/linux _sock is _loopID _loopID = (void*)(intptr_t)sock; // On gnu/linux _sock is _loopID
@ -1666,7 +1666,7 @@ setNonBlocking(SOCKET fd)
* indication of opened * indication of opened
*/ */
[self _setStatus: NSStreamStatusOpening]; [self _setStatus: NSStreamStatusOpening];
#if defined(__MINGW32__) #if defined(__MINGW__)
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS); WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
#endif #endif
if (NSCountMapTable(_loops) > 0) if (NSCountMapTable(_loops) > 0)
@ -1700,7 +1700,7 @@ setNonBlocking(SOCKET fd)
} }
open_ok: open_ok:
#if defined(__MINGW32__) #if defined(__MINGW__)
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS); WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
#endif #endif
[super open]; [super open];
@ -1721,7 +1721,7 @@ setNonBlocking(SOCKET fd)
return; return;
} }
[_handler bye]; [_handler bye];
#if defined(__MINGW32__) #if defined(__MINGW__)
if (_sibling && [_sibling streamStatus] != NSStreamStatusClosed) if (_sibling && [_sibling streamStatus] != NSStreamStatusClosed)
{ {
/* /*
@ -1790,7 +1790,7 @@ setNonBlocking(SOCKET fd)
} }
else else
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
readLen = recv([self _sock], (char*) buffer, (socklen_t) len, 0); readLen = recv([self _sock], (char*) buffer, (socklen_t) len, 0);
#else #else
readLen = read([self _sock], buffer, len); readLen = read([self _sock], buffer, len);
@ -1844,7 +1844,7 @@ setNonBlocking(SOCKET fd)
- (void) _dispatch - (void) _dispatch
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
AUTORELEASE(RETAIN(self)); AUTORELEASE(RETAIN(self));
/* /*
* Windows only permits a single event to be associated with a socket * Windows only permits a single event to be associated with a socket
@ -1999,7 +1999,7 @@ setNonBlocking(SOCKET fd)
#endif #endif
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
- (BOOL) runLoopShouldBlock: (BOOL*)trigger - (BOOL) runLoopShouldBlock: (BOOL*)trigger
{ {
*trigger = YES; *trigger = YES;
@ -2037,7 +2037,7 @@ setNonBlocking(SOCKET fd)
return 0; return 0;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
writeLen = send([self _sock], (char*) buffer, (socklen_t) len, 0); writeLen = send([self _sock], (char*) buffer, (socklen_t) len, 0);
#else #else
writeLen = write([self _sock], buffer, (socklen_t) len); writeLen = write([self _sock], buffer, (socklen_t) len);
@ -2138,7 +2138,7 @@ setNonBlocking(SOCKET fd)
* indication of opened * indication of opened
*/ */
[self _setStatus: NSStreamStatusOpening]; [self _setStatus: NSStreamStatusOpening];
#if defined(__MINGW32__) #if defined(__MINGW__)
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS); WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
#endif #endif
if (NSCountMapTable(_loops) > 0) if (NSCountMapTable(_loops) > 0)
@ -2172,7 +2172,7 @@ setNonBlocking(SOCKET fd)
} }
open_ok: open_ok:
#if defined(__MINGW32__) #if defined(__MINGW__)
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS); WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
#endif #endif
[super open]; [super open];
@ -2195,7 +2195,7 @@ setNonBlocking(SOCKET fd)
return; return;
} }
[_handler bye]; [_handler bye];
#if defined(__MINGW32__) #if defined(__MINGW__)
if (_sibling && [_sibling streamStatus] != NSStreamStatusClosed) if (_sibling && [_sibling streamStatus] != NSStreamStatusClosed)
{ {
/* /*
@ -2250,7 +2250,7 @@ setNonBlocking(SOCKET fd)
- (void) _dispatch - (void) _dispatch
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
AUTORELEASE(RETAIN(self)); AUTORELEASE(RETAIN(self));
/* /*
* Windows only permits a single event to be associated with a socket * Windows only permits a single event to be associated with a socket
@ -2403,7 +2403,7 @@ setNonBlocking(SOCKET fd)
#endif #endif
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
- (BOOL) runLoopShouldBlock: (BOOL*)trigger - (BOOL) runLoopShouldBlock: (BOOL*)trigger
{ {
*trigger = YES; *trigger = YES;
@ -2506,7 +2506,7 @@ setNonBlocking(SOCKET fd)
[self _sendEvent: NSStreamEventErrorOccurred]; [self _sendEvent: NSStreamEventErrorOccurred];
return; return;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS); WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
#endif #endif
[super open]; [super open];
@ -2514,7 +2514,7 @@ setNonBlocking(SOCKET fd)
- (void) close - (void) close
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
if (_loopID != WSA_INVALID_EVENT) if (_loopID != WSA_INVALID_EVENT)
{ {
WSACloseEvent(_loopID); WSACloseEvent(_loopID);
@ -2582,7 +2582,7 @@ setNonBlocking(SOCKET fd)
- (void) _dispatch - (void) _dispatch
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
WSANETWORKEVENTS events; WSANETWORKEVENTS events;
if (WSAEnumNetworkEvents(_sock, _loopID, &events) == SOCKET_ERROR) if (WSAEnumNetworkEvents(_sock, _loopID, &events) == SOCKET_ERROR)

View file

@ -89,7 +89,7 @@ NSString * const NSStreamSOCKSProxyVersionKey
*/ */
static RunLoopEventType typeForStream(NSStream *aStream) static RunLoopEventType typeForStream(NSStream *aStream)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
if ([aStream _loopID] == (void*)aStream) if ([aStream _loopID] == (void*)aStream)
{ {
return ET_TRIGGER; return ET_TRIGGER;

View file

@ -174,7 +174,7 @@ AbsolutePathOfExecutable(NSString *path, BOOL atLaunch)
{ {
pathlist = [env objectForKey:@"Path"]; pathlist = [env objectForKey:@"Path"];
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
patharr = [pathlist componentsSeparatedByString:@";"]; patharr = [pathlist componentsSeparatedByString:@";"];
#else #else
patharr = [pathlist componentsSeparatedByString:@":"]; patharr = [pathlist componentsSeparatedByString:@":"];
@ -327,7 +327,7 @@ bundle_object_name(NSString *path, NSString* executable)
return path1; return path1;
else if ([mgr isReadableFileAtPath: path0] == YES) else if ([mgr isReadableFileAtPath: path0] == YES)
return path0; return path0;
#if defined(__MINGW32__) #if defined(__MINGW__)
/* If we couldn't find the binary, and we are on windows, and the name /* If we couldn't find the binary, and we are on windows, and the name
* has no path extension, then let's try looking for a dll. * has no path extension, then let's try looking for a dll.
*/ */
@ -592,7 +592,7 @@ _find_main_bundle_for_tool(NSString *toolName)
{ {
bundlePath = [bundlePath stringByDeletingLastPathComponent]; bundlePath = [bundlePath stringByDeletingLastPathComponent];
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
/* On windows, the library (dll) is in the Tools area rather than /* On windows, the library (dll) is in the Tools area rather than
* in the framework, so we can adjust the path here. * in the framework, so we can adjust the path here.
*/ */
@ -626,7 +626,7 @@ _find_main_bundle_for_tool(NSString *toolName)
if (bundlePath) if (bundlePath)
bundle = [[self alloc] initWithPath: bundlePath]; bundle = [[self alloc] initWithPath: bundlePath];
} }
#if !defined(__MINGW32__) #if !defined(__MINGW__)
} }
#endif #endif
@ -1292,7 +1292,7 @@ IF_NO_GC(
NSWarnMLog(@"NSBundle -initWithPath: requires absolute path names, " NSWarnMLog(@"NSBundle -initWithPath: requires absolute path names, "
@"given '%@'", path); @"given '%@'", path);
#if defined(__MINGW32__) #if defined(__MINGW__)
if ([path length] > 0 && if ([path length] > 0 &&
([path characterAtIndex: 0]=='/' || [path characterAtIndex: 0]=='\\')) ([path characterAtIndex: 0]=='/' || [path characterAtIndex: 0]=='\\'))
{ {
@ -1756,7 +1756,7 @@ IF_NO_GC(
{ {
NSString *rootPath; NSString *rootPath;
#if !defined(__MINGW32__) #if !defined(__MINGW__)
if (_frameworkVersion) if (_frameworkVersion)
rootPath = [NSString stringWithFormat:@"%@/Versions/%@", [self bundlePath], rootPath = [NSString stringWithFormat:@"%@/Versions/%@", [self bundlePath],
_frameworkVersion]; _frameworkVersion];
@ -2176,7 +2176,7 @@ IF_NO_GC(
mangledName = [mangledName stringByReplacingString: @"+" mangledName = [mangledName stringByReplacingString: @"+"
withString: @"_1"]; withString: @"_1"];
#if !defined(__MINGW32__) #if !defined(__MINGW__)
path = [_path stringByAppendingPathComponent:@"Versions/Current"]; path = [_path stringByAppendingPathComponent:@"Versions/Current"];
#else #else
path = _path; path = _path;
@ -2204,7 +2204,7 @@ IF_NO_GC(
if (_bundleType == NSBUNDLE_FRAMEWORK) if (_bundleType == NSBUNDLE_FRAMEWORK)
{ {
#if !defined(__MINGW32__) #if !defined(__MINGW__)
return [_path stringByAppendingPathComponent: return [_path stringByAppendingPathComponent:
[NSString stringWithFormat:@"Versions/%@/Resources", [NSString stringWithFormat:@"Versions/%@/Resources",
version]]; version]];
@ -2255,7 +2255,7 @@ IF_NO_GC(
if (_bundleType == NSBUNDLE_FRAMEWORK) if (_bundleType == NSBUNDLE_FRAMEWORK)
{ {
#if !defined(__MINGW32__) #if !defined(__MINGW__)
return [_path stringByAppendingPathComponent: return [_path stringByAppendingPathComponent:
[NSString stringWithFormat:@"Versions/%@/PlugIns", [NSString stringWithFormat:@"Versions/%@/PlugIns",
version]]; version]];
@ -2319,7 +2319,7 @@ IF_NO_GC(
*/ */
libraryName = [libraryName lastPathComponent]; libraryName = [libraryName lastPathComponent];
#if defined(__MINGW32__) #if defined(__MINGW__)
/* A dll is usually of the form 'xxx-maj_min.dll' /* A dll is usually of the form 'xxx-maj_min.dll'
* so we can extract the version info and use it. * so we can extract the version info and use it.
*/ */

View file

@ -287,7 +287,7 @@ NSTimeInterval
GSTimeNow(void) GSTimeNow(void)
{ {
NSTimeInterval t; NSTimeInterval t;
#if !defined(__MINGW32__) #if !defined(__MINGW__)
struct timeval tp; struct timeval tp;
gettimeofday (&tp, NULL); gettimeofday (&tp, NULL);
@ -335,7 +335,7 @@ GSTimeNow(void)
GetSystemTime(&sys_time); GetSystemTime(&sys_time);
t = GSTime(sys_time.wDay, sys_time.wMonth, sys_time.wYear, sys_time.wHour, t = GSTime(sys_time.wDay, sys_time.wMonth, sys_time.wYear, sys_time.wHour,
sys_time.wMinute, sys_time.wSecond, sys_time.wMilliseconds); sys_time.wMinute, sys_time.wSecond, sys_time.wMilliseconds);
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
return t; return t;
} }

View file

@ -1257,7 +1257,7 @@ static NSLock *cached_proxies_gate = nil;
/* /*
* Make sure we are not registered. * Make sure we are not registered.
*/ */
#if !defined(__MINGW32__) #if !defined(__MINGW__)
if ([IreceivePort isKindOfClass: [NSMessagePort class]]) if ([IreceivePort isKindOfClass: [NSMessagePort class]])
{ {
[self registerName: nil [self registerName: nil
@ -1764,7 +1764,7 @@ static NSLock *cached_proxies_gate = nil;
- (void) setRootObject: (id)anObj - (void) setRootObject: (id)anObj
{ {
setRootObjectForInPort(anObj, IreceivePort); setRootObjectForInPort(anObj, IreceivePort);
#if defined(__MINGW32__) #if defined(__MINGW__)
/* On ms-windows, the operating system does not inform us when the remote /* On ms-windows, the operating system does not inform us when the remote
* client of a message port goes away ... so we need to enable keepalive * client of a message port goes away ... so we need to enable keepalive
* to detect that condition. * to detect that condition.

View file

@ -137,7 +137,7 @@ static IMP appendImp;
static BOOL static BOOL
readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone) readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
const unichar *thePath = 0; const unichar *thePath = 0;
#else #else
const char *thePath = 0; const char *thePath = 0;
@ -147,7 +147,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
int c; int c;
long fileLength; long fileLength;
#if defined(__MINGW32__) #if defined(__MINGW__)
thePath = (const unichar*)[path fileSystemRepresentation]; thePath = (const unichar*)[path fileSystemRepresentation];
#else #else
thePath = [path fileSystemRepresentation]; thePath = [path fileSystemRepresentation];
@ -158,7 +158,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
return NO; return NO;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
theFile = _wfopen(thePath, L"rb"); theFile = _wfopen(thePath, L"rb");
#else #else
theFile = fopen(thePath, "rb"); theFile = fopen(thePath, "rb");
@ -1295,7 +1295,7 @@ failure:
options: (NSUInteger)writeOptionsMask options: (NSUInteger)writeOptionsMask
error: (NSError **)errorPtr error: (NSError **)errorPtr
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
NSUInteger length = [path length]; NSUInteger length = [path length];
unichar wthePath[length + 100]; unichar wthePath[length + 100];
unichar wtheRealPath[length + 100]; unichar wtheRealPath[length + 100];
@ -1312,7 +1312,7 @@ failure:
{ {
useAuxiliaryFile = YES; useAuxiliaryFile = YES;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
[path getCharacters: wtheRealPath]; [path getCharacters: wtheRealPath];
wtheRealPath[length] = L'\0'; wtheRealPath[length] = L'\0';
error_BadPath = (length <= 0); error_BadPath = (length <= 0);
@ -1366,7 +1366,7 @@ failure:
/* Use the path name of the destination file as a prefix for the /* Use the path name of the destination file as a prefix for the
* mktemp() call so that we can be sure that both files are on * mktemp() call so that we can be sure that both files are on
* the same filesystem and the subsequent rename() will work. */ * the same filesystem and the subsequent rename() will work. */
#if defined(__MINGW32__) #if defined(__MINGW__)
wcscpy(wthePath, wtheRealPath); wcscpy(wthePath, wtheRealPath);
wcscat(wthePath, L"XXXXXX"); wcscat(wthePath, L"XXXXXX");
if (_wmktemp(wthePath) == 0) if (_wmktemp(wthePath) == 0)
@ -1388,7 +1388,7 @@ failure:
} }
else else
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
wcscpy(wthePath,wtheRealPath); wcscpy(wthePath,wtheRealPath);
#else #else
strcpy(thePath, theRealPath); strcpy(thePath, theRealPath);
@ -1396,7 +1396,7 @@ failure:
} }
/* Open the file (whether temp or real) for writing. */ /* Open the file (whether temp or real) for writing. */
#if defined(__MINGW32__) #if defined(__MINGW__)
theFile = _wfopen(wthePath, L"wb"); theFile = _wfopen(wthePath, L"wb");
#else #else
theFile = fopen(thePath, "wb"); theFile = fopen(thePath, "wb");
@ -1407,7 +1407,7 @@ failure:
{ {
/* Something went wrong; we weren't /* Something went wrong; we weren't
* even able to open the file. */ * even able to open the file. */
#if defined(__MINGW32__) #if defined(__MINGW__)
NSWarnMLog(@"Open (%@) failed - %@", NSWarnMLog(@"Open (%@) failed - %@",
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)], [NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
[NSError _last]); [NSError _last]);
@ -1425,7 +1425,7 @@ failure:
if (c < (int)[self length]) /* We failed to write everything for if (c < (int)[self length]) /* We failed to write everything for
* some reason. */ * some reason. */
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
NSWarnMLog(@"Fwrite (%@) failed - %@", NSWarnMLog(@"Fwrite (%@) failed - %@",
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)], [NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
[NSError _last]); [NSError _last]);
@ -1442,7 +1442,7 @@ failure:
* closing the file, but we got here, * closing the file, but we got here,
* so we need to deal with it. */ * so we need to deal with it. */
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
NSWarnMLog(@"Fclose (%@) failed - %@", NSWarnMLog(@"Fclose (%@) failed - %@",
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)], [NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
[NSError _last]); [NSError _last]);
@ -1459,7 +1459,7 @@ failure:
{ {
NSFileManager *mgr = [NSFileManager defaultManager]; NSFileManager *mgr = [NSFileManager defaultManager];
NSMutableDictionary *att = nil; NSMutableDictionary *att = nil;
#if defined(__MINGW32__) #if defined(__MINGW__)
NSUInteger perm; NSUInteger perm;
#endif #endif
@ -1470,7 +1470,7 @@ failure:
IF_NO_GC(AUTORELEASE(att)); IF_NO_GC(AUTORELEASE(att));
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
/* To replace the existing file on windows, it must be writable. /* To replace the existing file on windows, it must be writable.
*/ */
perm = [att filePosixPermissions]; perm = [att filePosixPermissions];
@ -1539,7 +1539,7 @@ failure:
#endif #endif
if (c != 0) /* Many things could go wrong, I guess. */ if (c != 0) /* Many things could go wrong, I guess. */
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
NSWarnMLog(@"Rename ('%@' to '%@') failed - %@", NSWarnMLog(@"Rename ('%@' to '%@') failed - %@",
[NSString stringWithCharacters: wthePath [NSString stringWithCharacters: wthePath
length: wcslen(wthePath)], length: wcslen(wthePath)],
@ -1572,7 +1572,7 @@ failure:
path); path);
} }
} }
#ifndef __MINGW32__ #ifndef __MINGW__
else if (geteuid() == 0 && [@"root" isEqualToString: NSUserName()] == NO) else if (geteuid() == 0 && [@"root" isEqualToString: NSUserName()] == NO)
{ {
att = [NSDictionary dictionaryWithObjectsAndKeys: att = [NSDictionary dictionaryWithObjectsAndKeys:
@ -1595,7 +1595,7 @@ failure:
*/ */
if (useAuxiliaryFile) if (useAuxiliaryFile)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
_wunlink(wthePath); _wunlink(wthePath);
#else #else
unlink(thePath); unlink(thePath);
@ -3007,7 +3007,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{ {
int fd; int fd;
#if defined(__MINGW32__) #if defined(__MINGW__)
const unichar *thePath = (const unichar*)[path filesystemRepresentation]; const unichar *thePath = (const unichar*)[path filesystemRepresentation];
#else #else
const char *thePath = [path fileSystemRepresentation]; const char *thePath = [path fileSystemRepresentation];
@ -3020,7 +3020,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
return nil; return nil;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
fd = _wopen(thePath, _O_RDONLY); fd = _wopen(thePath, _O_RDONLY);
#else #else
fd = open(thePath, O_RDONLY); fd = open(thePath, O_RDONLY);

View file

@ -852,7 +852,7 @@ case a: env->addr = __builtin_return_address(a + 1); break;
#include <signal.h> #include <signal.h>
#include <setjmp.h> #include <setjmp.h>
#if defined(__MINGW32__) #if defined(__MINGW__)
#ifndef SIGBUS #ifndef SIGBUS
#define SIGBUS SIGILL #define SIGBUS SIGILL
#endif #endif

View file

@ -91,7 +91,7 @@ static NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler = 0;
#endif #endif
#if defined(__MINGW32__) #if defined(__MINGW__)
#if defined(USE_BINUTILS) #if defined(USE_BINUTILS)
static NSString * static NSString *
GSPrivateBaseAddress(void *addr, void **base) GSPrivateBaseAddress(void *addr, void **base)
@ -119,7 +119,7 @@ GSPrivateBaseAddress(void *addr, void **base)
return nil; return nil;
} }
#endif /* USE_BINUTILS */ #endif /* USE_BINUTILS */
#else /* __MINGW32__ */ #else /* __MINGW__ */
#ifndef GNU_SOURCE #ifndef GNU_SOURCE
#define GNU_SOURCE #define GNU_SOURCE
@ -147,7 +147,7 @@ GSPrivateBaseAddress(void *addr, void **base)
#endif #endif
} }
#endif /* USE_BINUTILS */ #endif /* USE_BINUTILS */
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
#if defined(USE_BINUTILS) #if defined(USE_BINUTILS)
@ -1101,7 +1101,7 @@ _NSAddHandler (NSHandler* handler)
NSThread *thread; NSThread *thread;
thread = GSCurrentThread(); thread = GSCurrentThread();
#if defined(__MINGW32__) && defined(DEBUG) #if defined(__MINGW__) && defined(DEBUG)
if (thread->_exception_handler if (thread->_exception_handler
&& IsBadReadPtr(thread->_exception_handler, sizeof(NSHandler))) && IsBadReadPtr(thread->_exception_handler, sizeof(NSHandler)))
{ {
@ -1124,7 +1124,7 @@ _NSRemoveHandler (NSHandler* handler)
fprintf(stderr, "ERROR: Removing exception handler that is not on top " fprintf(stderr, "ERROR: Removing exception handler that is not on top "
"of the stack. (You probably called return in an NS_DURING block.)\n"); "of the stack. (You probably called return in an NS_DURING block.)\n");
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
if (IsBadReadPtr(handler, sizeof(NSHandler))) if (IsBadReadPtr(handler, sizeof(NSHandler)))
{ {
fprintf(stderr, "ERROR: Could not remove exception handler, " fprintf(stderr, "ERROR: Could not remove exception handler, "

View file

@ -85,7 +85,7 @@
# include <windows.h> # include <windows.h>
#endif #endif
#if defined(__MINGW32__) #if defined(__MINGW__)
#include <stdio.h> #include <stdio.h>
#include <tchar.h> #include <tchar.h>
#include <wchar.h> #include <wchar.h>
@ -97,7 +97,7 @@
/* determine filesystem max path length */ /* determine filesystem max path length */
#if defined(_POSIX_VERSION) || defined(__WIN32__) #if defined(_POSIX_VERSION) || defined(__WIN32__)
# if defined(__MINGW32__) # if defined(__MINGW__)
# include <sys/utime.h> # include <sys/utime.h>
# else # else
# include <utime.h> # include <utime.h>
@ -186,7 +186,7 @@
* Macros to handle unichar filesystem support. * Macros to handle unichar filesystem support.
*/ */
#if defined(__MINGW32__) #if defined(__MINGW__)
#define _CHMOD(A,B) _wchmod(A,B) #define _CHMOD(A,B) _wchmod(A,B)
#define _CLOSEDIR(A) _wclosedir(A) #define _CLOSEDIR(A) _wclosedir(A)
@ -376,7 +376,7 @@ static NSStringEncoding defaultEncoding;
{ {
bundleClass = [NSBundle class]; bundleClass = [NSBundle class];
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
return SetCurrentDirectoryW(lpath) == TRUE ? YES : NO; return SetCurrentDirectoryW(lpath) == TRUE ? YES : NO;
#else #else
return (chdir(lpath) == 0) ? YES : NO; return (chdir(lpath) == 0) ? YES : NO;
@ -403,7 +403,7 @@ static NSStringEncoding defaultEncoding;
} }
lpath = [defaultManager fileSystemRepresentationWithPath: path]; lpath = [defaultManager fileSystemRepresentationWithPath: path];
#ifndef __MINGW32__ #ifndef __MINGW__
if (object_getClass(attributes) == GSAttrDictionaryClass) if (object_getClass(attributes) == GSAttrDictionaryClass)
{ {
num = ((GSAttrDictionary*)attributes)->statbuf.st_uid; num = ((GSAttrDictionary*)attributes)->statbuf.st_uid;
@ -528,7 +528,7 @@ static NSStringEncoding defaultEncoding;
ASSIGN(_lastError, str); ASSIGN(_lastError, str);
} }
} }
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
num = [attributes filePosixPermissions]; num = [attributes filePosixPermissions];
if (num != NSNotFound) if (num != NSNotFound)
@ -740,7 +740,7 @@ static NSStringEncoding defaultEncoding;
- (BOOL) createDirectoryAtPath: (NSString*)path - (BOOL) createDirectoryAtPath: (NSString*)path
attributes: (NSDictionary*)attributes attributes: (NSDictionary*)attributes
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
NSEnumerator *paths = [[path pathComponents] objectEnumerator]; NSEnumerator *paths = [[path pathComponents] objectEnumerator];
NSString *subPath; NSString *subPath;
NSString *completePath = nil; NSString *completePath = nil;
@ -756,7 +756,7 @@ static NSStringEncoding defaultEncoding;
if ([path length] == 0) if ([path length] == 0)
return NO; return NO;
#if defined(__MINGW32__) #if defined(__MINGW__)
while ((subPath = [paths nextObject])) while ((subPath = [paths nextObject]))
{ {
BOOL isDir = NO; BOOL isDir = NO;
@ -898,7 +898,7 @@ static NSStringEncoding defaultEncoding;
contents: (NSData*)contents contents: (NSData*)contents
attributes: (NSDictionary*)attributes attributes: (NSDictionary*)attributes
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
const _CHAR *lpath = [self fileSystemRepresentationWithPath: path]; const _CHAR *lpath = [self fileSystemRepresentationWithPath: path];
HANDLE fh; HANDLE fh;
DWORD written = 0; DWORD written = 0;
@ -914,7 +914,7 @@ static NSStringEncoding defaultEncoding;
if ([path length] == 0) if ([path length] == 0)
return NO; return NO;
#if defined(__MINGW32__) #if defined(__MINGW__)
fh = CreateFileW(lpath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, fh = CreateFileW(lpath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0); FILE_ATTRIBUTE_NORMAL, 0);
if (fh == INVALID_HANDLE_VALUE) if (fh == INVALID_HANDLE_VALUE)
@ -990,7 +990,7 @@ static NSStringEncoding defaultEncoding;
{ {
NSString *currentDir = nil; NSString *currentDir = nil;
#if defined(__MINGW32__) #if defined(__MINGW__)
int len = GetCurrentDirectoryW(0, 0); int len = GetCurrentDirectoryW(0, 0);
if (len > 0) if (len > 0)
{ {
@ -1343,7 +1343,7 @@ static NSStringEncoding defaultEncoding;
} }
else else
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
DWORD res; DWORD res;
res = GetFileAttributesW(lpath); res = GetFileAttributesW(lpath);
@ -1373,7 +1373,7 @@ static NSStringEncoding defaultEncoding;
if (!is_dir) if (!is_dir)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
if (DeleteFileW(lpath) == FALSE) if (DeleteFileW(lpath) == FALSE)
#else #else
if (unlink(lpath) < 0) if (unlink(lpath) < 0)
@ -1456,7 +1456,7 @@ static NSStringEncoding defaultEncoding;
return NO; return NO;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
{ {
DWORD res; DWORD res;
@ -1510,7 +1510,7 @@ static NSStringEncoding defaultEncoding;
return NO; return NO;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
{ {
DWORD res; DWORD res;
@ -1546,7 +1546,7 @@ static NSStringEncoding defaultEncoding;
return NO; return NO;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
{ {
DWORD res; DWORD res;
@ -1587,7 +1587,7 @@ static NSStringEncoding defaultEncoding;
return NO; return NO;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
{ {
DWORD res; DWORD res;
@ -1634,7 +1634,7 @@ static NSStringEncoding defaultEncoding;
return NO; return NO;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
// TODO - handle directories // TODO - handle directories
{ {
DWORD res; DWORD res;
@ -1766,7 +1766,7 @@ static NSStringEncoding defaultEncoding;
*/ */
- (NSDictionary*) fileSystemAttributesAtPath: (NSString*)path - (NSDictionary*) fileSystemAttributesAtPath: (NSString*)path
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
unsigned long long totalsize, freesize; unsigned long long totalsize, freesize;
id values[5]; id values[5];
id keys[5] = { id keys[5] = {
@ -2023,7 +2023,7 @@ static NSStringEncoding defaultEncoding;
#endif #endif
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
- (const GSNativeChar*) fileSystemRepresentationWithPath: (NSString*)path - (const GSNativeChar*) fileSystemRepresentationWithPath: (NSString*)path
{ {
if (path != nil && [path rangeOfString: @"/"].length > 0) if (path != nil && [path rangeOfString: @"/"].length > 0)
@ -2234,7 +2234,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
if (dirbuf) if (dirbuf)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
/* Skip "." and ".." directory entries */ /* Skip "." and ".." directory entries */
if (wcscmp(dirbuf->d_name, L".") == 0 if (wcscmp(dirbuf->d_name, L".") == 0
|| wcscmp(dirbuf->d_name, L"..") == 0) || wcscmp(dirbuf->d_name, L"..") == 0)
@ -2269,7 +2269,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
{ {
// Do not follow links // Do not follow links
#ifdef S_IFLNK #ifdef S_IFLNK
#ifdef __MINGW32__ #ifdef __MINGW__
#warning "lstat does not support unichars" #warning "lstat does not support unichars"
#else #else
if (!_flags.isFollowing) if (!_flags.isFollowing)
@ -2504,7 +2504,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
toFile: (NSString*)destination toFile: (NSString*)destination
handler: (id)handler handler: (id)handler
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
if (CopyFileW([self fileSystemRepresentationWithPath: source], if (CopyFileW([self fileSystemRepresentationWithPath: source],
[self fileSystemRepresentationWithPath: destination], NO)) [self fileSystemRepresentationWithPath: destination], NO))
{ {
@ -2866,7 +2866,7 @@ static NSSet *fileKeys = nil;
d = (GSAttrDictionary*)NSAllocateObject(self, (l+1)*sizeof(_CHAR), d = (GSAttrDictionary*)NSAllocateObject(self, (l+1)*sizeof(_CHAR),
NSDefaultMallocZone()); NSDefaultMallocZone());
#if defined(S_IFLNK) && !defined(__MINGW32__) #if defined(S_IFLNK) && !defined(__MINGW__)
if (traverse == NO) if (traverse == NO)
{ {
if (lstat(lpath, &d->statbuf) != 0) if (lstat(lpath, &d->statbuf) != 0)
@ -2949,7 +2949,7 @@ static NSSet *fileKeys = nil;
{ {
NSString *group = @"UnknownGroup"; NSString *group = @"UnknownGroup";
#if defined(__MINGW32__) #if defined(__MINGW__)
DWORD returnCode = 0; DWORD returnCode = 0;
PSID sidOwner; PSID sidOwner;
BOOL result = TRUE; BOOL result = TRUE;
@ -3106,7 +3106,7 @@ static NSSet *fileKeys = nil;
{ {
NSString *owner = @"UnknownUser"; NSString *owner = @"UnknownUser";
#if defined(__MINGW32__) #if defined(__MINGW__)
DWORD returnCode = 0; DWORD returnCode = 0;
PSID sidOwner; PSID sidOwner;
BOOL result = TRUE; BOOL result = TRUE;
@ -3236,7 +3236,7 @@ static NSSet *fileKeys = nil;
- (NSUInteger) fileSystemNumber - (NSUInteger) fileSystemNumber
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
DWORD volumeSerialNumber = 0; DWORD volumeSerialNumber = 0;
_CHAR volumePathName[128]; _CHAR volumePathName[128];
if (GetVolumePathNameW(_path,volumePathName,128)) if (GetVolumePathNameW(_path,volumePathName,128))

View file

@ -37,7 +37,7 @@
#import "Foundation/NSSet.h" #import "Foundation/NSSet.h"
#import "Foundation/NSCoder.h" #import "Foundation/NSCoder.h"
#if defined(__MINGW32__) #if defined(__MINGW__)
#include <winsock2.h> #include <winsock2.h>
#else #else
#include <netdb.h> #include <netdb.h>
@ -48,7 +48,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#endif /* !__MINGW32__*/ #endif /* !__MINGW__*/
#ifndef INADDR_NONE #ifndef INADDR_NONE
#define INADDR_NONE -1 #define INADDR_NONE -1

View file

@ -73,7 +73,7 @@
{ {
#if defined(HAVE_MMAP) #if defined(HAVE_MMAP)
munmap(buffer, size); munmap(buffer, size);
#elif defined(__MINGW32__) #elif defined(__MINGW__)
VirtualFree(buffer, 0, MEM_RELEASE); VirtualFree(buffer, 0, MEM_RELEASE);
#else #else
free(buffer); free(buffer);
@ -100,7 +100,7 @@
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
#endif /* HAVE_MPROTECT */ #endif /* HAVE_MPROTECT */
if (buffer == (void*)-1) buffer = (void*)0; if (buffer == (void*)-1) buffer = (void*)0;
#elif defined(__MINGW32__) #elif defined(__MINGW__)
buffer = VirtualAlloc(NULL, _size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); buffer = VirtualAlloc(NULL, _size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
#else #else
buffer = malloc(_size); buffer = malloc(_size);
@ -125,7 +125,7 @@
*/ */
- (void) protect - (void) protect
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
DWORD old; DWORD old;
if (VirtualProtect(buffer, size, PAGE_EXECUTE, &old) == 0) if (VirtualProtect(buffer, size, PAGE_EXECUTE, &old) == 0)
{ {

View file

@ -108,7 +108,7 @@ _NSLog_standard_printf_handler (NSString* message)
NSData *d; NSData *d;
const char *buf; const char *buf;
unsigned len; unsigned len;
#if defined(__MINGW32__) #if defined(__MINGW__)
LPCWSTR null_terminated_buf; LPCWSTR null_terminated_buf;
#else #else
#if defined(HAVE_SYSLOG) #if defined(HAVE_SYSLOG)
@ -139,7 +139,7 @@ _NSLog_standard_printf_handler (NSString* message)
len = [d length]; len = [d length];
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
null_terminated_buf = UNISTR(message); null_terminated_buf = UNISTR(message);
OutputDebugStringW(null_terminated_buf); OutputDebugStringW(null_terminated_buf);
@ -184,7 +184,7 @@ _NSLog_standard_printf_handler (NSString* message)
#else #else
write(_NSLogDescriptor, buf, len); write(_NSLogDescriptor, buf, len);
#endif #endif
#endif // __MINGW32__ #endif // __MINGW__
} }
/** /**
@ -294,7 +294,7 @@ NSLogv (NSString* format, va_list args)
if (pid == 0) if (pid == 0)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
pid = (int)GetCurrentProcessId(); pid = (int)GetCurrentProcessId();
#else #else
pid = (int)getpid(); pid = (int)getpid();

View file

@ -190,7 +190,7 @@ static void GSLogZombie(id o, SEL sel)
#undef GSATOMICREAD #undef GSATOMICREAD
#endif #endif
#if defined(__MINGW32__) #if defined(__MINGW__)
#ifndef _WIN64 #ifndef _WIN64
#undef InterlockedIncrement #undef InterlockedIncrement
#undef InterlockedDecrement #undef InterlockedDecrement
@ -899,14 +899,14 @@ GSGarbageCollectorLog(char *msg, GC_word arg)
* Semi-private function in libobjc2 that initialises the classes used for * Semi-private function in libobjc2 that initialises the classes used for
* blocks. * blocks.
*/ */
#ifndef __MINGW32__ #ifndef __MINGW__
BOOL BOOL
objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
#endif #endif
+ (void)load + (void)load
{ {
#ifndef __MINGW32__ #ifndef __MINGW__
/* When NSObject is loaded, register it as the superclass of the block /* When NSObject is loaded, register it as the superclass of the block
* classes */ * classes */
if (objc_create_block_classes_as_subclasses_of) if (objc_create_block_classes_as_subclasses_of)
@ -933,13 +933,13 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
GC_set_warn_proc(GSGarbageCollectorLog); GC_set_warn_proc(GSGarbageCollectorLog);
#endif #endif
#ifdef __MINGW32__ #ifdef __MINGW__
{ {
// See libgnustep-base-entry.m // See libgnustep-base-entry.m
extern void gnustep_base_socket_init(void); extern void gnustep_base_socket_init(void);
gnustep_base_socket_init(); gnustep_base_socket_init();
} }
#else /* __MINGW32__ */ #else /* __MINGW__ */
#ifdef SIGPIPE #ifdef SIGPIPE
/* /*
@ -981,7 +981,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
} }
#endif /* HAVE_SIGACTION */ #endif /* HAVE_SIGACTION */
#endif /* SIGPIPE */ #endif /* SIGPIPE */
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
#if GS_WITH_GC #if GS_WITH_GC
finalize_sel = @selector(finalize); finalize_sel = @selector(finalize);

View file

@ -39,7 +39,7 @@
#include <malloc.h> #include <malloc.h>
#endif #endif
#ifdef __MINGW32__ #ifdef __MINGW__
#include <malloc.h> #include <malloc.h>
static size_t static size_t
getpagesize(void) getpagesize(void)
@ -136,7 +136,7 @@ NSRealMemoryAvailable ()
if ((sysinfo(&info)) != 0) if ((sysinfo(&info)) != 0)
return 0; return 0;
return info.freeram; return info.freeram;
#elif defined(__MINGW32__) #elif defined(__MINGW__)
MEMORYSTATUSEX memory; MEMORYSTATUSEX memory;
memory.dwLength = sizeof(memory); memory.dwLength = sizeof(memory);

View file

@ -119,7 +119,7 @@ static NSString *gnustep_is_flattened =
nil; nil;
#endif #endif
#if defined(__MINGW32__) #if defined(__MINGW__)
#include <lmaccess.h> #include <lmaccess.h>
@ -712,7 +712,7 @@ GNUstepConfig(NSDictionary *newConfig)
if (([attributes filePosixPermissions] if (([attributes filePosixPermissions]
& (0022 & ATTRMASK)) != 0) & (0022 & ATTRMASK)) != 0)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
fprintf(stderr, fprintf(stderr,
"The file '%S' is writable by someone other than" "The file '%S' is writable by someone other than"
" its owner (permissions 0%lo).\nIgnoring it.\n", " its owner (permissions 0%lo).\nIgnoring it.\n",
@ -1009,7 +1009,7 @@ ParseConfigurationFile(NSString *fileName, NSMutableDictionary *dict,
if ([userName isEqual: fileOwner] == NO) if ([userName isEqual: fileOwner] == NO)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
fprintf(stderr, "The file '%S' is owned by '%s' but we expect it" fprintf(stderr, "The file '%S' is owned by '%s' but we expect it"
" to be the personal config file of '%s'.\nIgnoring it.\n", " to be the personal config file of '%s'.\nIgnoring it.\n",
[fileName fileSystemRepresentation], [fileName fileSystemRepresentation],
@ -1025,7 +1025,7 @@ ParseConfigurationFile(NSString *fileName, NSMutableDictionary *dict,
} }
if (([attributes filePosixPermissions] & (0022 & ATTRMASK)) != 0) if (([attributes filePosixPermissions] & (0022 & ATTRMASK)) != 0)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
fprintf(stderr, "The file '%S' is writable by someone other than" fprintf(stderr, "The file '%S' is writable by someone other than"
" its owner (permissions 0%lo).\nIgnoring it.\n", " its owner (permissions 0%lo).\nIgnoring it.\n",
[fileName fileSystemRepresentation], [fileName fileSystemRepresentation],
@ -1315,7 +1315,7 @@ GSSetUserName(NSString *aName)
NSString * NSString *
NSUserName(void) NSUserName(void)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
if (theUserName == nil) if (theUserName == nil)
{ {
/* Use the LOGNAME environment variable if set. */ /* Use the LOGNAME environment variable if set. */
@ -1411,7 +1411,7 @@ NSHomeDirectoryForUser(NSString *loginName)
{ {
NSString *s = nil; NSString *s = nil;
#if !defined(__MINGW32__) #if !defined(__MINGW__)
#if defined(HAVE_GETPWNAM_R) #if defined(HAVE_GETPWNAM_R)
struct passwd pw; struct passwd pw;
struct passwd *p; struct passwd *p;
@ -1484,7 +1484,7 @@ NSFullUserName(void)
if (theFullUserName == nil) if (theFullUserName == nil)
{ {
NSString *userName = nil; NSString *userName = nil;
#if defined(__MINGW32__) #if defined(__MINGW__)
struct _USER_INFO_2 *userInfo; struct _USER_INFO_2 *userInfo;
if (NetUserGetInfo(NULL, (unichar*)[NSUserName() cStringUsingEncoding: if (NetUserGetInfo(NULL, (unichar*)[NSUserName() cStringUsingEncoding:
@ -1559,7 +1559,7 @@ GSDefaultsRootForUser(NSString *userName)
defaultsDir = @GNUSTEP_TARGET_USER_DEFAULTS_DIR; defaultsDir = @GNUSTEP_TARGET_USER_DEFAULTS_DIR;
} }
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
if ([defaultsDir rangeOfString: @":REGISTRY:"].length > 0) if ([defaultsDir rangeOfString: @":REGISTRY:"].length > 0)
{ {
return defaultsDir; // Just use windows registry. return defaultsDir; // Just use windows registry.
@ -1594,7 +1594,7 @@ NSTemporaryDirectory(void)
int perm; int perm;
int owner; int owner;
BOOL flag; BOOL flag;
#if !defined(__MINGW32__) #if !defined(__MINGW__)
int uid; int uid;
#else #else
unichar buffer[1024]; unichar buffer[1024];
@ -1623,7 +1623,7 @@ NSTemporaryDirectory(void)
{ {
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
baseTempDirName = @"/cygdrive/c/"; baseTempDirName = @"/cygdrive/c/";
#elif defined(__MINGW32__) #elif defined(__MINGW__)
baseTempDirName = @"C:\\"; baseTempDirName = @"C:\\";
#elif defined(__APPLE__) #elif defined(__APPLE__)
/* /*
@ -1662,9 +1662,9 @@ NSTemporaryDirectory(void)
perm = perm & 0777; perm = perm & 0777;
// Mateu Batle: secure temporary directories don't work in MinGW // Mateu Batle: secure temporary directories don't work in MinGW
#ifndef __MINGW32__ #ifndef __MINGW__
#if defined(__MINGW32__) #if defined(__MINGW__)
uid = owner; uid = owner;
#else #else
#ifdef HAVE_GETEUID #ifdef HAVE_GETEUID
@ -1734,7 +1734,7 @@ NSOpenStepRootDirectory(void)
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
root = @"/cygdrive/c/"; root = @"/cygdrive/c/";
#elif defined(__MINGW32__) #elif defined(__MINGW__)
root = @"C:\\"; root = @"C:\\";
#else #else
root = @"/"; root = @"/";

View file

@ -67,7 +67,7 @@
self = [super init]; self = [super init];
if (self != nil) if (self != nil)
{ {
#ifndef __MINGW32__ #ifndef __MINGW__
int p[2]; int p[2];
if (pipe(p) == 0) if (pipe(p) == 0)

View file

@ -243,7 +243,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
} }
else else
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
unichar *buffer; unichar *buffer;
int buffer_size = 0; int buffer_size = 0;
int needed_size = 0; int needed_size = 0;
@ -285,7 +285,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
/* Getting the process name */ /* Getting the process name */
IF_NO_GC(RELEASE(_gnu_processName)); IF_NO_GC(RELEASE(_gnu_processName));
_gnu_processName = [arg0 lastPathComponent]; _gnu_processName = [arg0 lastPathComponent];
#if defined(__MINGW32__) #if defined(__MINGW__)
/* On windows we remove any .exe extension for consistency with app names /* On windows we remove any .exe extension for consistency with app names
* under unix * under unix
*/ */
@ -301,7 +301,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
IF_NO_GC(RETAIN(_gnu_processName)); IF_NO_GC(RETAIN(_gnu_processName));
/* Copy the argument list */ /* Copy the argument list */
#if defined(__MINGW32__) #if defined(__MINGW__)
{ {
unichar **argvw = CommandLineToArgvW(GetCommandLineW(), &argc); unichar **argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
NSString *str; NSString *str;
@ -365,7 +365,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
NSMutableArray *values = [NSMutableArray new]; NSMutableArray *values = [NSMutableArray new];
NSStringEncoding enc = GSPrivateDefaultCStringEncoding(); NSStringEncoding enc = GSPrivateDefaultCStringEncoding();
#if defined(__MINGW32__) #if defined(__MINGW__)
if (fallbackInitialisation == NO) if (fallbackInitialisation == NO)
{ {
unichar *base; unichar *base;
@ -852,7 +852,7 @@ _gnu_noobjc_free_vars(void)
} }
#else /*! HAVE_PROCFS !HAVE_LOAD_METHOD !HAVE_KVM_ENV */ #else /*! HAVE_PROCFS !HAVE_LOAD_METHOD !HAVE_KVM_ENV */
#ifdef __MINGW32__ #ifdef __MINGW__
/* For WindowsAPI Library, we know the global variables (argc, etc) */ /* For WindowsAPI Library, we know the global variables (argc, etc) */
+ (void) initialize + (void) initialize
{ {
@ -889,7 +889,7 @@ int main(int argc, char *argv[], char *env[])
sizeof(_NSConstantStringClassReference)); sizeof(_NSConstantStringClassReference));
#endif #endif
#if defined(__MINGW32__) #if defined(__MINGW__)
WSADATA lpWSAData; WSADATA lpWSAData;
// Initialize Windows Sockets // Initialize Windows Sockets
@ -898,7 +898,7 @@ int main(int argc, char *argv[], char *env[])
printf("Could not startup Windows Sockets\n"); printf("Could not startup Windows Sockets\n");
exit(1); exit(1);
} }
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
#ifdef __MS_WIN__ #ifdef __MS_WIN__
_MB_init_runtime(); _MB_init_runtime();
@ -910,7 +910,7 @@ int main(int argc, char *argv[], char *env[])
return gnustep_base_user_main(argc, argv, env); return gnustep_base_user_main(argc, argv, env);
} }
#endif /* !GS_PASS_ARGUMENTS */ #endif /* !GS_PASS_ARGUMENTS */
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
#endif /* HAS_LOAD_METHOD && HAS_PROCFS */ #endif /* HAS_LOAD_METHOD && HAS_PROCFS */
@ -952,7 +952,7 @@ int main(int argc, char *argv[], char *env[])
{ {
if (pid > 0) if (pid > 0)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION,0,pid); HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION,0,pid);
if (h == NULL && GetLastError() != ERROR_ACCESS_DENIED) if (h == NULL && GetLastError() != ERROR_ACCESS_DENIED)
{ {
@ -1023,7 +1023,7 @@ static void determineOperatingSystem()
NSString *os = nil; NSString *os = nil;
BOOL parseOS = YES; BOOL parseOS = YES;
#if defined(__MINGW32__) #if defined(__MINGW__)
OSVERSIONINFOW osver; OSVERSIONINFOW osver;
osver.dwOSVersionInfoSize = sizeof(osver); osver.dwOSVersionInfoSize = sizeof(osver);
@ -1065,7 +1065,7 @@ static void determineOperatingSystem()
} }
} }
#endif /* HAVE_SYS_UTSNAME_H */ #endif /* HAVE_SYS_UTSNAME_H */
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
if (_operatingSystemVersion == nil) if (_operatingSystemVersion == nil)
{ {
@ -1183,7 +1183,7 @@ static void determineOperatingSystem()
{ {
int pid; int pid;
#if defined(__MINGW32__) #if defined(__MINGW__)
pid = (int)GetCurrentProcessId(); pid = (int)GetCurrentProcessId();
#else #else
pid = (int)getpid(); pid = (int)getpid();
@ -1213,7 +1213,7 @@ static void determineOperatingSystem()
if (beenHere == NO) if (beenHere == NO)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
SYSTEM_INFO info; SYSTEM_INFO info;
GetSystemInfo(&info); GetSystemInfo(&info);
@ -1269,7 +1269,7 @@ static void determineOperatingSystem()
- (NSUInteger) activeProcessorCount - (NSUInteger) activeProcessorCount
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
SYSTEM_INFO info; SYSTEM_INFO info;
int index; int index;
int count = 0; int count = 0;
@ -1310,7 +1310,7 @@ static void determineOperatingSystem()
if (beenHere == NO) if (beenHere == NO)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
MEMORYSTATUSEX memory; MEMORYSTATUSEX memory;
memory.dwLength = sizeof(memory); memory.dwLength = sizeof(memory);
@ -1391,7 +1391,7 @@ GSInitializeProcess(int argc, char **argv, char **envp)
extern int _NSLogDescriptor; extern int _NSLogDescriptor;
int desc; int desc;
#if defined(__MINGW32__) #if defined(__MINGW__)
desc = _wopen([path fileSystemRepresentation], O_RDWR|O_CREAT|O_APPEND, 0644); desc = _wopen([path fileSystemRepresentation], O_RDWR|O_CREAT|O_APPEND, 0644);
#else #else
desc = open([path fileSystemRepresentation], O_RDWR|O_CREAT|O_APPEND, 0644); desc = open([path fileSystemRepresentation], O_RDWR|O_CREAT|O_APPEND, 0644);

View file

@ -52,19 +52,19 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef __MINGW32__ #ifdef __MINGW__
#define close closesocket #define close closesocket
#else #else
#include <sys/param.h> /* for MAXHOSTNAMELEN */ #include <sys/param.h> /* for MAXHOSTNAMELEN */
#include <sys/types.h> #include <sys/types.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> /* for inet_ntoa() */ #include <arpa/inet.h> /* for inet_ntoa() */
#endif /* !__MINGW32__ */ #endif /* !__MINGW__ */
#include <errno.h> #include <errno.h>
#include <string.h> /* for strchr() */ #include <string.h> /* for strchr() */
#include <ctype.h> /* for strchr() */ #include <ctype.h> /* for strchr() */
#include <fcntl.h> #include <fcntl.h>
#ifdef __MINGW32__ #ifdef __MINGW__
#include <winsock2.h> #include <winsock2.h>
#include <wininet.h> #include <wininet.h>
#include <process.h> #include <process.h>
@ -101,7 +101,7 @@
#define SOCKET_ERROR -1 #define SOCKET_ERROR -1
#define INVALID_SOCKET -1 #define INVALID_SOCKET -1
#endif /* !__MINGW32__ */ #endif /* !__MINGW__ */
/* /*
* Largest chunk of data possible in DO * Largest chunk of data possible in DO
@ -202,7 +202,7 @@ typedef enum {
unsigned nItems; /* Number of items to be read. */ unsigned nItems; /* Number of items to be read. */
GSHandleState state; /* State of the handle. */ GSHandleState state; /* State of the handle. */
unsigned int addrNum; /* Address number within host. */ unsigned int addrNum; /* Address number within host. */
#ifdef __MINGW32__ #ifdef __MINGW__
WSAEVENT event; /* Win32 event associated to socket */ WSAEVENT event; /* Win32 event associated to socket */
WSAEVENT eventTemp; /* Win32 event for asynchronous */ WSAEVENT eventTemp; /* Win32 event for asynchronous */
@public @public
@ -223,7 +223,7 @@ typedef enum {
+ (GSTcpHandle*) handleWithDescriptor: (SOCKET)d; + (GSTcpHandle*) handleWithDescriptor: (SOCKET)d;
- (BOOL) connectToPort: (NSSocketPort*)aPort beforeDate: (NSDate*)when; - (BOOL) connectToPort: (NSSocketPort*)aPort beforeDate: (NSDate*)when;
- (int) descriptor; - (int) descriptor;
#if defined(__MINGW32__) #if defined(__MINGW__)
- (int) eventHandle; - (int) eventHandle;
#endif #endif
- (void) invalidate; - (void) invalidate;
@ -369,13 +369,13 @@ static Class runLoopClass;
+ (GSTcpHandle*) handleWithDescriptor: (SOCKET)d + (GSTcpHandle*) handleWithDescriptor: (SOCKET)d
{ {
GSTcpHandle *handle; GSTcpHandle *handle;
#ifdef __MINGW32__ #ifdef __MINGW__
unsigned long dummy; unsigned long dummy;
#else #else
int e; int e;
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
#ifdef __MINGW32__ #ifdef __MINGW__
WSAEVENT ev; WSAEVENT ev;
int rc; int rc;
#endif #endif
@ -385,7 +385,7 @@ static Class runLoopClass;
NSLog(@"illegal descriptor (%d) for Tcp Handle", d); NSLog(@"illegal descriptor (%d) for Tcp Handle", d);
return nil; return nil;
} }
#ifdef __MINGW32__ #ifdef __MINGW__
dummy = 1; dummy = 1;
if (ioctlsocket(d, FIONBIO, &dummy) == SOCKET_ERROR) if (ioctlsocket(d, FIONBIO, &dummy) == SOCKET_ERROR)
{ {
@ -393,7 +393,7 @@ static Class runLoopClass;
d, [NSError _last]); d, [NSError _last]);
return nil; return nil;
} }
#else /* !__MINGW32__ */ #else /* !__MINGW__ */
if ((e = fcntl(d, F_GETFL, 0)) >= 0) if ((e = fcntl(d, F_GETFL, 0)) >= 0)
{ {
e |= NBLK_OPT; e |= NBLK_OPT;
@ -416,7 +416,7 @@ static Class runLoopClass;
handle->wMsgs = [NSMutableArray new]; handle->wMsgs = [NSMutableArray new];
handle->myLock = [GSLazyRecursiveLock new]; handle->myLock = [GSLazyRecursiveLock new];
handle->valid = YES; handle->valid = YES;
#if defined(__MINGW32__) #if defined(__MINGW__)
ev = (WSAEVENT)CreateEvent(NULL,NO,NO,NULL); ev = (WSAEVENT)CreateEvent(NULL,NO,NO,NULL);
if (ev == WSA_INVALID_EVENT) if (ev == WSA_INVALID_EVENT)
{ {
@ -437,7 +437,7 @@ static Class runLoopClass;
{ {
if (self == [GSTcpHandle class]) if (self == [GSTcpHandle class])
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
WORD wVersionRequested; WORD wVersionRequested;
WSADATA wsaData; WSADATA wsaData;
@ -538,7 +538,7 @@ static Class runLoopClass;
if (connect(desc, (struct sockaddr*)&sockAddr, sizeof(sockAddr)) if (connect(desc, (struct sockaddr*)&sockAddr, sizeof(sockAddr))
== SOCKET_ERROR) == SOCKET_ERROR)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
if (WSAGetLastError() != WSAEWOULDBLOCK) if (WSAGetLastError() != WSAEWOULDBLOCK)
#else #else
if (errno != EINPROGRESS) if (errno != EINPROGRESS)
@ -565,7 +565,7 @@ static Class runLoopClass;
state = GS_H_TRYCON; state = GS_H_TRYCON;
l = [NSRunLoop currentRunLoop]; l = [NSRunLoop currentRunLoop];
#if defined(__MINGW32__) #if defined(__MINGW__)
NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!"); NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!");
[l addEvent: (void*)(uintptr_t)event [l addEvent: (void*)(uintptr_t)event
type: ET_HANDLE type: ET_HANDLE
@ -603,7 +603,7 @@ static Class runLoopClass;
M_LOCK(myLock); M_LOCK(myLock);
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
[l removeEvent: (void*)(uintptr_t)event [l removeEvent: (void*)(uintptr_t)event
type: ET_HANDLE type: ET_HANDLE
forMode: NSConnectionReplyMode forMode: NSConnectionReplyMode
@ -694,7 +694,7 @@ static Class runLoopClass;
return desc; return desc;
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
- (int) eventHandle - (int) eventHandle
{ {
return (int) (size_t) event; return (int) (size_t) event;
@ -719,7 +719,7 @@ static Class runLoopClass;
valid = NO; valid = NO;
l = [runLoopClass currentRunLoop]; l = [runLoopClass currentRunLoop];
#if defined(__MINGW32__) #if defined(__MINGW__)
[l removeEvent: (void*)(uintptr_t)event [l removeEvent: (void*)(uintptr_t)event
type: ET_HANDLE type: ET_HANDLE
forMode: nil forMode: nil
@ -741,7 +741,7 @@ static Class runLoopClass;
NSDebugMLLog(@"GSTcpHandle", @"invalidated 0x%x", self); NSDebugMLLog(@"GSTcpHandle", @"invalidated 0x%x", self);
[[self recvPort] removeHandle: self]; [[self recvPort] removeHandle: self];
[[self sendPort] removeHandle: self]; [[self sendPort] removeHandle: self];
#if defined(__MINGW32__) #if defined(__MINGW__)
WSACloseEvent(event); WSACloseEvent(event);
event = WSA_INVALID_EVENT; event = WSA_INVALID_EVENT;
#endif #endif
@ -808,12 +808,12 @@ static Class runLoopClass;
[self invalidate]; [self invalidate];
return; return;
} }
#ifdef __MINGW32__ #ifdef __MINGW__
else if (WSAGetLastError()!= WSAEINTR else if (WSAGetLastError()!= WSAEINTR
&& WSAGetLastError()!= WSAEWOULDBLOCK) && WSAGetLastError()!= WSAEWOULDBLOCK)
#else #else
else if (errno != EINTR && errno != EAGAIN) else if (errno != EINTR && errno != EAGAIN)
#endif /* !__MINGW32__ */ #endif /* !__MINGW__ */
{ {
NSDebugMLLog(@"GSTcpHandle", NSDebugMLLog(@"GSTcpHandle",
@"read failed - %@ on 0x%p", [NSError _last], self); @"read failed - %@ on 0x%p", [NSError _last], self);
@ -1162,23 +1162,23 @@ static Class runLoopClass;
res = send(desc, b + wLength, l - wLength, 0); res = send(desc, b + wLength, l - wLength, 0);
if (res < 0) if (res < 0)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
if (WSAGetLastError()!= WSAEINTR if (WSAGetLastError()!= WSAEINTR
&& WSAGetLastError()!= WSAEWOULDBLOCK) && WSAGetLastError()!= WSAEWOULDBLOCK)
#else #else
if (errno != EINTR && errno != EAGAIN) if (errno != EINTR && errno != EAGAIN)
#endif /* !__MINGW32__ */ #endif /* !__MINGW__ */
{ {
NSLog(@"write attempt failed - %@", [NSError _last]); NSLog(@"write attempt failed - %@", [NSError _last]);
[self invalidate]; [self invalidate];
return; return;
} }
#ifdef __MINGW32__ #ifdef __MINGW__
if (WSAGetLastError()== WSAEWOULDBLOCK) if (WSAGetLastError()== WSAEWOULDBLOCK)
{ {
readyToSend = NO; readyToSend = NO;
} }
#endif /* !__MINGW32__ */ #endif /* !__MINGW__ */
} }
else else
{ {
@ -1223,7 +1223,7 @@ static Class runLoopClass;
extra: (void*)extra extra: (void*)extra
forMode: (NSString*)mode forMode: (NSString*)mode
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
WSANETWORKEVENTS ocurredEvents; WSANETWORKEVENTS ocurredEvents;
#else #else
#endif #endif
@ -1235,7 +1235,7 @@ static Class runLoopClass;
{ {
NSRunLoop *l = [runLoopClass currentRunLoop]; NSRunLoop *l = [runLoopClass currentRunLoop];
#if defined(__MINGW32__) #if defined(__MINGW__)
[l removeEvent: data [l removeEvent: data
type: ET_HANDLE type: ET_HANDLE
forMode: mode forMode: mode
@ -1255,7 +1255,7 @@ static Class runLoopClass;
M_LOCK(myLock); M_LOCK(myLock);
#if defined(__MINGW32__) #if defined(__MINGW__)
if (WSAEnumNetworkEvents(desc, event, &ocurredEvents)==SOCKET_ERROR) if (WSAEnumNetworkEvents(desc, event, &ocurredEvents)==SOCKET_ERROR)
{ {
NSLog(@"Error getting event type %d", WSAGetLastError()); NSLog(@"Error getting event type %d", WSAGetLastError());
@ -1352,7 +1352,7 @@ static Class runLoopClass;
IF_NO_GC(RETAIN(self);) IF_NO_GC(RETAIN(self);)
#if defined(__MINGW32__) #if defined(__MINGW__)
NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!"); NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!");
[l addEvent: (void*)(uintptr_t)event [l addEvent: (void*)(uintptr_t)event
type: ET_HANDLE type: ET_HANDLE
@ -1387,7 +1387,7 @@ static Class runLoopClass;
&& [when timeIntervalSinceNow] > 0) && [when timeIntervalSinceNow] > 0)
{ {
M_UNLOCK(myLock); M_UNLOCK(myLock);
#if defined(__MINGW32__) #if defined(__MINGW__)
if (readyToSend) if (readyToSend)
{ {
[self receivedEventWrite]; [self receivedEventWrite];
@ -1402,7 +1402,7 @@ static Class runLoopClass;
M_LOCK(myLock); M_LOCK(myLock);
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
[l removeEvent: (void*)(uintptr_t)event [l removeEvent: (void*)(uintptr_t)event
type: ET_HANDLE type: ET_HANDLE
forMode: NSConnectionReplyMode forMode: NSConnectionReplyMode
@ -1583,7 +1583,7 @@ static Class tcpPortClass;
port->address = [addr copy]; port->address = [addr copy];
port->handles = NSCreateMapTable(NSIntMapKeyCallBacks, port->handles = NSCreateMapTable(NSIntMapKeyCallBacks,
NSObjectMapValueCallBacks, 0); NSObjectMapValueCallBacks, 0);
#if defined(__MINGW32__) #if defined(__MINGW__)
port->eventListener = WSA_INVALID_EVENT; port->eventListener = WSA_INVALID_EVENT;
port->events = NSCreateMapTable(NSIntMapKeyCallBacks, port->events = NSCreateMapTable(NSIntMapKeyCallBacks,
NSIntMapValueCallBacks, 0); NSIntMapValueCallBacks, 0);
@ -1679,7 +1679,7 @@ static Class tcpPortClass;
} }
else else
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
int rc; int rc;
#endif #endif
/* /*
@ -1689,7 +1689,7 @@ static Class tcpPortClass;
*/ */
port->listener = desc; port->listener = desc;
port->portNum = GSSwapBigI16ToHost(sockaddr.sin_port); port->portNum = GSSwapBigI16ToHost(sockaddr.sin_port);
#if defined(__MINGW32__) #if defined(__MINGW__)
port->eventListener = (WSAEVENT)CreateEvent(NULL,NO,NO,NULL); port->eventListener = (WSAEVENT)CreateEvent(NULL,NO,NO,NULL);
if (port->eventListener == WSA_INVALID_EVENT) if (port->eventListener == WSA_INVALID_EVENT)
{ {
@ -1775,7 +1775,7 @@ static Class tcpPortClass;
handle->recvPort = GS_GC_HIDE(self); handle->recvPort = GS_GC_HIDE(self);
} }
NSMapInsert(handles, (void*)(uintptr_t)[handle descriptor], (void*)handle); NSMapInsert(handles, (void*)(uintptr_t)[handle descriptor], (void*)handle);
#if defined(__MINGW32__) #if defined(__MINGW__)
NSMapInsert(events, (void*)(uintptr_t)[handle eventHandle], NSMapInsert(events, (void*)(uintptr_t)[handle eventHandle],
(void*)(uintptr_t)[handle descriptor]); (void*)(uintptr_t)[handle descriptor]);
#endif #endif
@ -1827,7 +1827,7 @@ static Class tcpPortClass;
* This is a callback method used by the NSRunLoop class to determine which * This is a callback method used by the NSRunLoop class to determine which
* descriptors to watch for the port. * descriptors to watch for the port.
*/ */
#if defined(__MINGW32__) #if defined(__MINGW__)
- (void) getFds: (int*)fds count: (int*)count - (void) getFds: (int*)fds count: (int*)count
{ {
NSMapEnumerator me; NSMapEnumerator me;
@ -2072,7 +2072,7 @@ static Class tcpPortClass;
{ {
(void) close(listener); (void) close(listener);
listener = -1; listener = -1;
#if defined(__MINGW32__) #if defined(__MINGW__)
WSACloseEvent(eventListener); WSACloseEvent(eventListener);
eventListener = WSA_INVALID_EVENT; eventListener = WSA_INVALID_EVENT;
#endif #endif
@ -2089,7 +2089,7 @@ static Class tcpPortClass;
[handle invalidate]; [handle invalidate];
} }
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
if (events != 0) if (events != 0)
{ {
NSFreeMapTable(events); NSFreeMapTable(events);
@ -2132,7 +2132,7 @@ static Class tcpPortClass;
extra: (void*)extra extra: (void*)extra
forMode: (NSString*)mode forMode: (NSString*)mode
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
WSAEVENT event = (WSAEVENT)extra; WSAEVENT event = (WSAEVENT)extra;
SOCKET desc; SOCKET desc;
#else #else
@ -2143,7 +2143,7 @@ static Class tcpPortClass;
NSDebugMLLog(@"NSPort", @"received %s event %p on 0x%x", NSDebugMLLog(@"NSPort", @"received %s event %p on 0x%x",
type == ET_RPORT ? "read" : "write", extra, self); type == ET_RPORT ? "read" : "write", extra, self);
#if defined(__MINGW32__) #if defined(__MINGW__)
if (event == eventListener) if (event == eventListener)
#else #else
if (desc == listener) if (desc == listener)
@ -2163,7 +2163,7 @@ static Class tcpPortClass;
setsockopt(desc, SOL_SOCKET, SO_KEEPALIVE, (char*)&status, setsockopt(desc, SOL_SOCKET, SO_KEEPALIVE, (char*)&status,
sizeof(status)); sizeof(status));
#if defined(__MINGW32__) #if defined(__MINGW__)
// reset associated event with new socket // reset associated event with new socket
WSAEventSelect(desc, eventListener, 0); WSAEventSelect(desc, eventListener, 0);
#endif #endif
@ -2184,7 +2184,7 @@ static Class tcpPortClass;
else else
{ {
M_LOCK(myLock); M_LOCK(myLock);
#if defined(__MINGW32__) #if defined(__MINGW__)
desc = (SOCKET)NSMapGet(events, (void*)(uintptr_t)event); desc = (SOCKET)NSMapGet(events, (void*)(uintptr_t)event);
#endif #endif
handle = (GSTcpHandle*)NSMapGet(handles, (void*)(uintptr_t)desc); handle = (GSTcpHandle*)NSMapGet(handles, (void*)(uintptr_t)desc);
@ -2194,7 +2194,7 @@ static Class tcpPortClass;
{ {
const char *t; const char *t;
#if defined(__MINGW32__) #if defined(__MINGW__)
if (type == ET_HANDLE) t = "winhandle"; if (type == ET_HANDLE) t = "winhandle";
#else #else
if (type == ET_RDESC) t = "rdesc"; if (type == ET_RDESC) t = "rdesc";
@ -2267,7 +2267,7 @@ static Class tcpPortClass;
handle->recvPort = nil; handle->recvPort = nil;
} }
NSMapRemove(handles, (void*)(uintptr_t)[handle descriptor]); NSMapRemove(handles, (void*)(uintptr_t)[handle descriptor]);
#if defined(__MINGW32__) #if defined(__MINGW__)
NSMapRemove(events, (void*)(uintptr_t)[handle eventHandle]); NSMapRemove(events, (void*)(uintptr_t)[handle eventHandle]);
#endif #endif
if (((int) listener) < 0 && NSCountMapTable(handles) == 0) if (((int) listener) < 0 && NSCountMapTable(handles) == 0)

View file

@ -49,7 +49,7 @@
#import "GSPortPrivate.h" #import "GSPortPrivate.h"
#ifdef __MINGW32__ #ifdef __MINGW__
#include <winsock2.h> #include <winsock2.h>
#include <wininet.h> #include <wininet.h>
#else #else

View file

@ -3153,7 +3153,7 @@ handle_printf_atsign (FILE *stream,
static NSFileManager *fm = nil; static NSFileManager *fm = nil;
#if defined(__MINGW32__) #if defined(__MINGW__)
- (const GSNativeChar*) fileSystemRepresentation - (const GSNativeChar*) fileSystemRepresentation
{ {
if (fm == nil) if (fm == nil)
@ -3883,7 +3883,7 @@ static NSFileManager *fm = nil;
- (NSString*) stringByResolvingSymlinksInPath - (NSString*) stringByResolvingSymlinksInPath
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
return IMMUTABLE(self); return IMMUTABLE(self);
#else #else
#ifndef PATH_MAX #ifndef PATH_MAX
@ -4050,7 +4050,7 @@ static NSFileManager *fm = nil;
} }
return [[NSFileManager defaultManager] return [[NSFileManager defaultManager]
stringWithFileSystemRepresentation: newBuf length: strlen(newBuf)]; stringWithFileSystemRepresentation: newBuf length: strlen(newBuf)];
#endif /* (__MINGW32__) */ #endif /* (__MINGW__) */
} }
- (NSString*) stringByStandardizingPath - (NSString*) stringByStandardizingPath
@ -4161,7 +4161,7 @@ static NSFileManager *fm = nil;
* For absolute paths, we must resolve symbolic links or (on MINGW) * For absolute paths, we must resolve symbolic links or (on MINGW)
* remove '/../' sequences and their matching parent directories. * remove '/../' sequences and their matching parent directories.
*/ */
#if defined(__MINGW32__) #if defined(__MINGW__)
/* Condense `/../' */ /* Condense `/../' */
r = (NSRange){root, l-root}; r = (NSRange){root, l-root};
while ((r = [s rangeOfString: @".." options: 0 range: r]).length == 2) while ((r = [s rangeOfString: @".." options: 0 range: r]).length == 2)
@ -4331,7 +4331,7 @@ static NSFileManager *fm = nil;
*/ */
if (c == pathSepChar()) if (c == pathSepChar())
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
if (GSPathHandlingUnix() == YES) if (GSPathHandlingUnix() == YES)
{ {
return YES; return YES;

View file

@ -119,12 +119,12 @@ static BOOL hadChildSignal = NO;
static void handleSignal(int sig) static void handleSignal(int sig)
{ {
hadChildSignal = YES; hadChildSignal = YES;
#ifndef __MINGW32__ #ifndef __MINGW__
signal(SIGCHLD, handleSignal); signal(SIGCHLD, handleSignal);
#endif #endif
} }
#ifdef __MINGW32__ #ifdef __MINGW__
@interface NSConcreteWindowsTask : NSTask @interface NSConcreteWindowsTask : NSTask
{ {
@public @public
@ -264,7 +264,7 @@ pty_slave(const char* name)
} }
[gnustep_global_lock unlock]; [gnustep_global_lock unlock];
#ifndef __MINGW32__ #ifndef __MINGW__
signal(SIGCHLD, handleSignal); signal(SIGCHLD, handleSignal);
#endif #endif
} }
@ -359,7 +359,7 @@ pty_slave(const char* name)
return; return;
} }
#ifndef __MINGW32__ #ifndef __MINGW__
#ifdef HAVE_KILLPG #ifdef HAVE_KILLPG
killpg(_taskId, SIGINT); killpg(_taskId, SIGINT);
#else #else
@ -427,7 +427,7 @@ pty_slave(const char* name)
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"NSTask - task has not yet launched"]; format: @"NSTask - task has not yet launched"];
} }
#ifndef __MINGW32__ #ifndef __MINGW__
#ifdef HAVE_KILLPG #ifdef HAVE_KILLPG
killpg(_taskId, SIGCONT); killpg(_taskId, SIGCONT);
#else #else
@ -618,7 +618,7 @@ pty_slave(const char* name)
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"NSTask - task has not yet launched"]; format: @"NSTask - task has not yet launched"];
} }
#ifndef __MINGW32__ #ifndef __MINGW__
#ifdef HAVE_KILLPG #ifdef HAVE_KILLPG
killpg(_taskId, SIGSTOP); killpg(_taskId, SIGSTOP);
#else #else
@ -650,7 +650,7 @@ pty_slave(const char* name)
} }
_hasTerminated = YES; _hasTerminated = YES;
#ifndef __MINGW32__ #ifndef __MINGW__
#ifdef HAVE_KILLPG #ifdef HAVE_KILLPG
killpg(_taskId, SIGTERM); killpg(_taskId, SIGTERM);
#else #else
@ -751,7 +751,7 @@ pty_slave(const char* name)
full_path = [arch_path stringByAppendingPathComponent: libs]; full_path = [arch_path stringByAppendingPathComponent: libs];
lpath = [full_path stringByAppendingPathComponent: prog]; lpath = [full_path stringByAppendingPathComponent: prog];
#ifdef __MINGW32__ #ifdef __MINGW__
if ([mgr isExecutableFileAtPath: lpath] == NO if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath: && [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO) (lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO)
@ -760,7 +760,7 @@ pty_slave(const char* name)
#endif #endif
{ {
lpath = [arch_path stringByAppendingPathComponent: prog]; lpath = [arch_path stringByAppendingPathComponent: prog];
#ifdef __MINGW32__ #ifdef __MINGW__
if ([mgr isExecutableFileAtPath: lpath] == NO if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath: && [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO) (lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO)
@ -769,7 +769,7 @@ pty_slave(const char* name)
#endif #endif
{ {
lpath = [base_path stringByAppendingPathComponent: prog]; lpath = [base_path stringByAppendingPathComponent: prog];
#ifdef __MINGW32__ #ifdef __MINGW__
if ([mgr isExecutableFileAtPath: lpath] == NO if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath: && [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO) (lpath = [lpath stringByAppendingPathExtension: @"exe"])] == NO)
@ -788,7 +788,7 @@ pty_slave(const char* name)
} }
if (lpath != nil) if (lpath != nil)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
if ([mgr isExecutableFileAtPath: lpath] == NO if ([mgr isExecutableFileAtPath: lpath] == NO
&& [mgr isExecutableFileAtPath: && [mgr isExecutableFileAtPath:
(lpath = [lpath stringByAppendingPathExtension: @"exe"])] (lpath = [lpath stringByAppendingPathExtension: @"exe"])]
@ -816,7 +816,7 @@ pty_slave(const char* name)
} }
lpath = [lpath stringByStandardizingPath]; lpath = [lpath stringByStandardizingPath];
} }
#ifdef __MINGW32__ #ifdef __MINGW__
/** We need this to be native windows format, and some of the standardisation /** We need this to be native windows format, and some of the standardisation
* above may have left unix style separators in the string. * above may have left unix style separators in the string.
*/ */
@ -919,7 +919,7 @@ pty_slave(const char* name)
@end @end
#ifdef __MINGW32__ #ifdef __MINGW__
@implementation NSConcreteWindowsTask @implementation NSConcreteWindowsTask
BOOL BOOL
@ -1517,7 +1517,7 @@ GSPrivateCheckTasks()
#endif #endif
#else #else
#if defined(HAVE_SETPGID) #if defined(HAVE_SETPGID)
#if defined(__MINGW32__) #if defined(__MINGW__)
pid = (int)GetCurrentProcessId(), pid = (int)GetCurrentProcessId(),
#else #else
pid = (int)getpid(); pid = (int)getpid();

View file

@ -202,7 +202,7 @@ GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when)
while (delay > 30.0*60.0) while (delay > 30.0*60.0)
{ {
// sleep 30 minutes // sleep 30 minutes
#if defined(__MINGW32__) #if defined(__MINGW__)
Sleep (30*60*1000); Sleep (30*60*1000);
#else #else
sleep (30*60); sleep (30*60);
@ -216,7 +216,7 @@ GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when)
*/ */
while (delay > 0) while (delay > 0)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
#if defined(HAVE_USLEEP) #if defined(HAVE_USLEEP)
/* On windows usleep() seems to perform a busy wait ... so we only /* On windows usleep() seems to perform a busy wait ... so we only
* use it for short delays ... otherwise use the less accurate Sleep() * use it for short delays ... otherwise use the less accurate Sleep()
@ -901,7 +901,7 @@ static void *nsthreadLauncher(void* thread)
{ {
[lock lock]; [lock lock];
[performers addObject: performer]; [performers addObject: performer];
#if defined(__MINGW32__) #if defined(__MINGW__)
if (SetEvent(event) == 0) if (SetEvent(event) == 0)
{ {
NSLog(@"Set event failed - %@", [NSError _last]); NSLog(@"Set event failed - %@", [NSError _last]);
@ -925,7 +925,7 @@ static void *nsthreadLauncher(void* thread)
- (id) init - (id) init
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
if ((event = CreateEvent(NULL, TRUE, FALSE, NULL)) == INVALID_HANDLE_VALUE) if ((event = CreateEvent(NULL, TRUE, FALSE, NULL)) == INVALID_HANDLE_VALUE)
{ {
DESTROY(self); DESTROY(self);
@ -973,7 +973,7 @@ static void *nsthreadLauncher(void* thread)
[lock lock]; [lock lock];
[performers makeObjectsPerformSelector: @selector(invalidate)]; [performers makeObjectsPerformSelector: @selector(invalidate)];
[performers removeAllObjects]; [performers removeAllObjects];
#ifdef __MINGW32__ #ifdef __MINGW__
if (event != INVALID_HANDLE_VALUE) if (event != INVALID_HANDLE_VALUE)
{ {
CloseHandle(event); CloseHandle(event);
@ -1001,7 +1001,7 @@ static void *nsthreadLauncher(void* thread)
unsigned int c; unsigned int c;
[lock lock]; [lock lock];
#if defined(__MINGW32__) #if defined(__MINGW__)
if (event != INVALID_HANDLE_VALUE) if (event != INVALID_HANDLE_VALUE)
{ {
if (ResetEvent(event) == 0) if (ResetEvent(event) == 0)

View file

@ -203,7 +203,7 @@ typedef struct {
} }
@end @end
#if defined(__MINGW32__) #if defined(__MINGW__)
@interface GSWindowsTimeZone : NSTimeZone @interface GSWindowsTimeZone : NSTimeZone
{ {
@public @public
@ -467,7 +467,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
fileName = [NSTimeZoneClass _getTimeZoneFile: name]; fileName = [NSTimeZoneClass _getTimeZoneFile: name];
if (fileName == nil if (fileName == nil
|| ![[NSFileManager defaultManager] fileExistsAtPath: fileName]) || ![[NSFileManager defaultManager] fileExistsAtPath: fileName])
#if defined(__MINGW32__) #if defined(__MINGW__)
{ {
zone = [[GSWindowsTimeZone alloc] initWithName: name data: 0]; zone = [[GSWindowsTimeZone alloc] initWithName: name data: 0];
DESTROY(self); DESTROY(self);
@ -481,7 +481,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
#endif #endif
data = [NSData dataWithContentsOfFile: fileName]; data = [NSData dataWithContentsOfFile: fileName];
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
if (!data) if (!data)
zone = [[GSWindowsTimeZone alloc] initWithName: name data: data]; zone = [[GSWindowsTimeZone alloc] initWithName: name data: data];
else else
@ -1028,7 +1028,7 @@ static NSMapTable *absolutes = 0;
path = _time_zone_path (ABBREV_MAP, nil); path = _time_zone_path (ABBREV_MAP, nil);
if (path != nil) if (path != nil)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
unichar mode[3]; unichar mode[3];
mode[0] = 'r'; mode[0] = 'r';
@ -1468,7 +1468,7 @@ static NSMapTable *absolutes = 0;
} }
#endif #endif
#if defined(__MINGW32__) #if defined(__MINGW__)
/* /*
* Try to get timezone from windows system call. * Try to get timezone from windows system call.
*/ */
@ -1559,7 +1559,7 @@ static NSMapTable *absolutes = 0;
path = _time_zone_path (REGIONS_FILE, nil); path = _time_zone_path (REGIONS_FILE, nil);
if (path != nil) if (path != nil)
{ {
#if defined(__MINGW32__) #if defined(__MINGW__)
unichar mode[3]; unichar mode[3];
mode[0] = 'r'; mode[0] = 'r';
@ -2105,7 +2105,7 @@ static NSString *zoneDirs[] = {
@end @end
#if defined(__MINGW32__) #if defined(__MINGW__)
/* Timezone information data as stored in the registry */ /* Timezone information data as stored in the registry */
typedef struct TZI_format { typedef struct TZI_format {
LONG Bias; LONG Bias;
@ -2540,7 +2540,7 @@ GSBreakTime(NSTimeInterval when, NSInteger*year, NSInteger*month, NSInteger*day,
return [self name]; return [self name];
} }
@end @end
#endif // __MINGW32__ #endif // __MINGW__
@implementation GSTimeZone @implementation GSTimeZone

View file

@ -1296,7 +1296,7 @@ static unsigned urlAlign;
unescape(buf, buf); unescape(buf, buf);
#if defined(__MINGW32__) #if defined(__MINGW__)
/* On windows a file URL path may be of the form C:\xxx (ie we should /* On windows a file URL path may be of the form C:\xxx (ie we should
* not insert the leading slash). * not insert the leading slash).
* Also the vertical bar symbol may have been used instead of the * Also the vertical bar symbol may have been used instead of the

View file

@ -58,7 +58,7 @@
#import "GNUstepBase/NSObject+GNUstepBase.h" #import "GNUstepBase/NSObject+GNUstepBase.h"
#import "GNUstepBase/NSString+GNUstepBase.h" #import "GNUstepBase/NSString+GNUstepBase.h"
#if defined(__MINGW32__) #if defined(__MINGW__)
@class NSUserDefaultsWin32; @class NSUserDefaultsWin32;
#endif #endif
@ -517,7 +517,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
NS_DURING NS_DURING
{ {
// Create new sharedDefaults (NOTE: Not added to the autorelease pool!) // Create new sharedDefaults (NOTE: Not added to the autorelease pool!)
#if defined(__MINGW32__) #if defined(__MINGW__)
{ {
NSString *path = GSDefaultsRootForUser(NSUserName()); NSString *path = GSDefaultsRootForUser(NSUserName());
NSRange r = [path rangeOfString: @":REGISTRY:"]; NSRange r = [path rangeOfString: @":REGISTRY:"];
@ -758,7 +758,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
{ {
currLang = [NSArray arrayWithObject: GSLanguageFromLocale(locale)]; currLang = [NSArray arrayWithObject: GSLanguageFromLocale(locale)];
} }
#ifdef __MINGW32__ #ifdef __MINGW__
if (currLang == nil && locale != nil) if (currLang == nil && locale != nil)
{ {
/* Check for language as the first part of the locale string */ /* Check for language as the first part of the locale string */
@ -877,7 +877,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
} }
r = [path rangeOfString: @":INTERNAL:"]; r = [path rangeOfString: @":INTERNAL:"];
#if defined(__MINGW32__) #if defined(__MINGW__)
if (r.length == 0) if (r.length == 0)
{ {
r = [path rangeOfString: @":REGISTRY:"]; r = [path rangeOfString: @":REGISTRY:"];

View file

@ -200,7 +200,7 @@ struct StackBlockClass {
const char *types; const char *types;
}; };
#if defined(__MINGW32__) #if defined(__MINGW__)
/* FIXME ... evil hack ... declare symbol to avoid linker error on windows /* FIXME ... evil hack ... declare symbol to avoid linker error on windows
* where the compiler/linker doesn't support a weak reference. * where the compiler/linker doesn't support a weak reference.
* This obviously breaks the code below... * This obviously breaks the code below...

View file

@ -28,7 +28,7 @@
#include <ffi.h> #include <ffi.h>
#if defined(__MINGW32__) #if defined(__MINGW__)
/* /*
* Avoid conflicts when other headers try to define UINT32 and UINT64 * Avoid conflicts when other headers try to define UINT32 and UINT64
*/ */

View file

@ -99,7 +99,7 @@ static int
objc_initialize_loading(FILE *errorStream) objc_initialize_loading(FILE *errorStream)
{ {
NSString *path; NSString *path;
#ifdef __MINGW32__ #ifdef __MINGW__
const unichar *fsPath; const unichar *fsPath;
#else #else
const char *fsPath; const char *fsPath;
@ -142,7 +142,7 @@ objc_load_callback(Class class, struct objc_category * category)
} }
} }
#if defined(__MINGW32__) #if defined(__MINGW__)
#define FSCHAR unichar #define FSCHAR unichar
#else #else
#define FSCHAR char #define FSCHAR char
@ -252,7 +252,7 @@ GSPrivateUnloadModule(FILE *errorStream,
} }
#ifdef __MINGW32__ #ifdef __MINGW__
NSString * NSString *
GSPrivateSymbolPath(Class theClass, Category *theCategory) GSPrivateSymbolPath(Class theClass, Category *theCategory)
{ {

View file

@ -41,7 +41,7 @@
#import "Foundation/NSUserDefaults.h" #import "Foundation/NSUserDefaults.h"
#if defined(__MINGW32__) #if defined(__MINGW__)
#include "process.h" #include "process.h"
#endif #endif
@ -1160,7 +1160,7 @@ main(int argc, char** argv, char** env)
#endif #endif
signal(sym, ihandler); signal(sym, ihandler);
} }
#ifndef __MINGW32__ #ifndef __MINGW__
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
signal(SIGTTOU, SIG_IGN); signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN); signal(SIGTTIN, SIG_IGN);
@ -1182,7 +1182,7 @@ main(int argc, char** argv, char** env)
*/ */
[[NSFileHandle fileHandleWithStandardInput] closeFile]; [[NSFileHandle fileHandleWithStandardInput] closeFile];
[[NSFileHandle fileHandleWithStandardOutput] closeFile]; [[NSFileHandle fileHandleWithStandardOutput] closeFile];
#ifndef __MINGW32__ #ifndef __MINGW__
if (debugging == NO) if (debugging == NO)
{ {
[[NSFileHandle fileHandleWithStandardError] closeFile]; [[NSFileHandle fileHandleWithStandardError] closeFile];

View file

@ -30,19 +30,19 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <unistd.h> /* for gethostname() */ #include <unistd.h> /* for gethostname() */
#ifndef __MINGW32__ #ifndef __MINGW__
#include <sys/param.h> /* for MAXHOSTNAMELEN */ #include <sys/param.h> /* for MAXHOSTNAMELEN */
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> /* for inet_ntoa() */ #include <arpa/inet.h> /* for inet_ntoa() */
#endif /* !__MINGW32__ */ #endif /* !__MINGW__ */
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <string.h> /* for strchr() */ #include <string.h> /* for strchr() */
#include <ctype.h> /* for strchr() */ #include <ctype.h> /* for strchr() */
#include <fcntl.h> #include <fcntl.h>
#ifdef __MINGW32__ #ifdef __MINGW__
#include <stdint.h> #include <stdint.h>
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
@ -91,7 +91,7 @@
#if defined(__svr4__) #if defined(__svr4__)
#include <sys/stropts.h> #include <sys/stropts.h>
#endif #endif
#endif /* !__MINGW32__ */ #endif /* !__MINGW__ */
#ifdef HAVE_SYSLOG_H #ifdef HAVE_SYSLOG_H
@ -101,7 +101,7 @@
#if HAVE_STRERROR #if HAVE_STRERROR
#define lastErr() strerror(errno) #define lastErr() strerror(errno)
#else #else
#ifdef __MINGW32__ #ifdef __MINGW__
static errbuf[BUFSIZ]; static errbuf[BUFSIZ];
#define lastErr() (sprintf(errbuf, "WSAGetLastError()=%d", WSAGetLastError()), errbuf) #define lastErr() (sprintf(errbuf, "WSAGetLastError()=%d", WSAGetLastError()), errbuf)
#else #else
@ -143,7 +143,7 @@ static errbuf[BUFSIZ];
__a*((__v+__a-1)/__a); }) __a*((__v+__a-1)/__a); })
typedef unsigned char *uptr; typedef unsigned char *uptr;
#ifndef __MINGW32__ #ifndef __MINGW__
static int is_daemon = 0; /* Currently running as daemon. */ static int is_daemon = 0; /* Currently running as daemon. */
#endif #endif
static int debug = 0; /* Extra debug gdomap_logging. */ static int debug = 0; /* Extra debug gdomap_logging. */
@ -175,7 +175,7 @@ struct in_addr class_c_mask;
* Predeclare some of the functions used. * Predeclare some of the functions used.
*/ */
static void dump_stats(); static void dump_stats();
#ifndef __MINGW32__ #ifndef __MINGW__
static void dump_tables(); static void dump_tables();
#endif #endif
static void handle_accept(); static void handle_accept();
@ -196,7 +196,7 @@ static void queue_probe(struct in_addr* to, struct in_addr *from,
char *xgethostname (void); char *xgethostname (void);
#ifdef __MINGW32__ #ifdef __MINGW__
#ifndef HAVE_GETOPT #ifndef HAVE_GETOPT
/* A simple implementation of getopt() */ /* A simple implementation of getopt() */
@ -392,11 +392,11 @@ static fd_set write_fds; /* Descriptors which are writable. */
Bjoern Giesler <Bjoern.Giesler@gmx.de> to work on Win32. */ Bjoern Giesler <Bjoern.Giesler@gmx.de> to work on Win32. */
typedef struct { typedef struct {
#ifdef __MINGW32__ #ifdef __MINGW__
SOCKET s; SOCKET s;
#else #else
int s; int s;
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
struct sockaddr_in addr; /* Address of process making request. */ struct sockaddr_in addr; /* Address of process making request. */
socklen_t pos; /* Position reading data. */ socklen_t pos; /* Position reading data. */
union { union {
@ -406,11 +406,11 @@ typedef struct {
} RInfo; /* State of reading each request. */ } RInfo; /* State of reading each request. */
typedef struct { typedef struct {
#ifdef __MINGW32__ #ifdef __MINGW__
SOCKET s; SOCKET s;
#else #else
int s; int s;
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
int len; /* Length of data to be written. */ int len; /* Length of data to be written. */
int pos; /* Amount of data already written. */ int pos; /* Amount of data already written. */
char* buf; /* Buffer for data. */ char* buf; /* Buffer for data. */
@ -424,11 +424,11 @@ static unsigned _wInfoCapacity = 0;
static unsigned _wInfoCount = 0; static unsigned _wInfoCount = 0;
static void static void
#ifdef __MINGW32__ #ifdef __MINGW__
delRInfo(SOCKET s) delRInfo(SOCKET s)
#else #else
delRInfo(int s) delRInfo(int s)
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
{ {
unsigned int i; unsigned int i;
@ -456,7 +456,7 @@ delRInfo(int s)
static RInfo * static RInfo *
#ifdef __MINGW32__ #ifdef __MINGW__
getRInfo(SOCKET s, int make) getRInfo(SOCKET s, int make)
#else #else
getRInfo(int s, int make) getRInfo(int s, int make)
@ -498,11 +498,11 @@ getRInfo(int s, int make)
} }
static void static void
#ifdef __MINGW32__ #ifdef __MINGW__
delWInfo(SOCKET s) delWInfo(SOCKET s)
#else #else
delWInfo(int s) delWInfo(int s)
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
{ {
unsigned int i; unsigned int i;
@ -530,7 +530,7 @@ delWInfo(int s)
static WInfo * static WInfo *
#ifdef __MINGW32__ #ifdef __MINGW__
getWInfo(SOCKET s, int make) getWInfo(SOCKET s, int make)
#else #else
getWInfo(int s, int make) getWInfo(int s, int make)
@ -981,7 +981,7 @@ prb_tim(time_t when)
static void static void
clear_chan(int desc) clear_chan(int desc)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
if (desc != INVALID_SOCKET) if (desc != INVALID_SOCKET)
#else #else
if (desc >= 0 && desc < FD_SETSIZE) if (desc >= 0 && desc < FD_SETSIZE)
@ -997,7 +997,7 @@ clear_chan(int desc)
else else
{ {
FD_CLR(desc, &read_fds); FD_CLR(desc, &read_fds);
#ifdef __MINGW32__ #ifdef __MINGW__
closesocket(desc); closesocket(desc);
#else #else
close(desc); close(desc);
@ -1053,7 +1053,7 @@ dump_stats()
gdomap_log(LOG_INFO); gdomap_log(LOG_INFO);
} }
#ifndef __MINGW32__ #ifndef __MINGW__
static void static void
dump_tables() dump_tables()
{ {
@ -1101,7 +1101,7 @@ dump_tables()
static void static void
init_iface() init_iface()
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
INTERFACE_INFO InterfaceList[20]; INTERFACE_INFO InterfaceList[20];
unsigned long nBytesReturned; unsigned long nBytesReturned;
int i, countActive, nNumInterfaces; int i, countActive, nNumInterfaces;
@ -1669,9 +1669,9 @@ init_ports()
{ {
int r; int r;
struct sockaddr_in sa; struct sockaddr_in sa;
#ifdef __MINGW32__ #ifdef __MINGW__
unsigned long dummy; unsigned long dummy;
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
/* /*
* Now we set up the sockets to accept incoming connections and set * Now we set up the sockets to accept incoming connections and set
@ -1680,7 +1680,7 @@ init_ports()
*/ */
udp_desc = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); udp_desc = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
#ifdef __MINGW32__ #ifdef __MINGW__
if (udp_desc == INVALID_SOCKET) if (udp_desc == INVALID_SOCKET)
#else #else
if (udp_desc < 0) if (udp_desc < 0)
@ -1734,7 +1734,7 @@ init_ports()
gdomap_log(LOG_WARNING); gdomap_log(LOG_WARNING);
} }
} }
#ifdef __MINGW32__ #ifdef __MINGW__
dummy = 1; dummy = 1;
if (ioctlsocket(udp_desc, FIONBIO, &dummy) < 0) if (ioctlsocket(udp_desc, FIONBIO, &dummy) < 0)
{ {
@ -1742,7 +1742,7 @@ init_ports()
gdomap_log(LOG_CRIT); gdomap_log(LOG_CRIT);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
#else /* !__MINGW32__ */ #else /* !__MINGW__ */
if ((r = fcntl(udp_desc, F_GETFL, 0)) >= 0) if ((r = fcntl(udp_desc, F_GETFL, 0)) >= 0)
{ {
r |= NBLK_OPT; r |= NBLK_OPT;
@ -1788,7 +1788,7 @@ init_ports()
* Now we do the TCP socket. * Now we do the TCP socket.
*/ */
tcp_desc = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); tcp_desc = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
#ifdef __MINGW32__ #ifdef __MINGW__
if (tcp_desc == INVALID_SOCKET) if (tcp_desc == INVALID_SOCKET)
#else #else
if (tcp_desc < 0) if (tcp_desc < 0)
@ -1834,7 +1834,7 @@ init_ports()
} }
#endif #endif
#ifdef __MINGW32__ #ifdef __MINGW__
dummy = 1; dummy = 1;
if (ioctlsocket(tcp_desc, FIONBIO, &dummy) < 0) if (ioctlsocket(tcp_desc, FIONBIO, &dummy) < 0)
{ {
@ -1842,7 +1842,7 @@ init_ports()
gdomap_log(LOG_CRIT); gdomap_log(LOG_CRIT);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
#else /* !__MINGW32__ */ #else /* !__MINGW__ */
if ((r = fcntl(tcp_desc, F_GETFL, 0)) >= 0) if ((r = fcntl(tcp_desc, F_GETFL, 0)) >= 0)
{ {
r |= NBLK_OPT; r |= NBLK_OPT;
@ -1859,7 +1859,7 @@ init_ports()
gdomap_log(LOG_CRIT); gdomap_log(LOG_CRIT);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
memset(&sa, '\0', sizeof(sa)); memset(&sa, '\0', sizeof(sa));
sa.sin_family = AF_INET; sa.sin_family = AF_INET;
@ -1900,7 +1900,7 @@ init_ports()
FD_SET(tcp_desc, &read_fds); FD_SET(tcp_desc, &read_fds);
FD_SET(udp_desc, &read_fds); FD_SET(udp_desc, &read_fds);
#ifndef __MINGW32__ #ifndef __MINGW__
/* /*
* Turn off pipe signals so we don't get interrupted if we attempt * Turn off pipe signals so we don't get interrupted if we attempt
* to write a response to a process which has died. * to write a response to a process which has died.
@ -1910,7 +1910,7 @@ init_ports()
* Enable table dumping to /tmp/gdomap.dump * Enable table dumping to /tmp/gdomap.dump
*/ */
signal(SIGUSR1, dump_tables); signal(SIGUSR1, dump_tables);
#endif /* !__MINGW32__ */ #endif /* !__MINGW__ */
} }
@ -2217,11 +2217,11 @@ handle_accept()
if (desc >= 0) if (desc >= 0)
{ {
RInfo *ri; RInfo *ri;
#ifdef __MINGW32__ #ifdef __MINGW__
unsigned long dummy = 1; unsigned long dummy = 1;
#else #else
int r; int r;
#endif /* !__MINGW32__ */ #endif /* !__MINGW__ */
FD_SET(desc, &read_fds); FD_SET(desc, &read_fds);
ri = getRInfo(desc, 1); ri = getRInfo(desc, 1);
@ -2237,7 +2237,7 @@ handle_accept()
/* /*
* Ensure that the connection is non-blocking. * Ensure that the connection is non-blocking.
*/ */
#ifdef __MINGW32__ #ifdef __MINGW__
if (ioctlsocket(desc, FIONBIO, &dummy) < 0) if (ioctlsocket(desc, FIONBIO, &dummy) < 0)
{ {
if (debug) if (debug)
@ -2248,7 +2248,7 @@ handle_accept()
} }
clear_chan(desc); clear_chan(desc);
} }
#else /* !__MINGW32__ */ #else /* !__MINGW__ */
if ((r = fcntl(desc, F_GETFL, 0)) >= 0) if ((r = fcntl(desc, F_GETFL, 0)) >= 0)
{ {
r |= NBLK_OPT; r |= NBLK_OPT;
@ -2273,16 +2273,16 @@ handle_accept()
} }
clear_chan(desc); clear_chan(desc);
} }
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
} }
else if (debug) else if (debug)
{ {
snprintf(ebuf, sizeof(ebuf), "accept failed - errno %d", snprintf(ebuf, sizeof(ebuf), "accept failed - errno %d",
#ifdef __MINGW32__ #ifdef __MINGW__
WSAGetLastError()); WSAGetLastError());
#else #else
errno); errno);
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
gdomap_log(LOG_DEBUG); gdomap_log(LOG_DEBUG);
} }
} }
@ -2406,7 +2406,7 @@ handle_io()
/* /*
* Got some descriptor activity - deal with it. * Got some descriptor activity - deal with it.
*/ */
#ifdef __MINGW32__ #ifdef __MINGW__
/* read file descriptors */ /* read file descriptors */
for (i = 0; i < rfds.fd_count; i++) for (i = 0; i < rfds.fd_count; i++)
{ {
@ -2438,7 +2438,7 @@ handle_io()
handle_write(wfds.fd_array[i]); handle_write(wfds.fd_array[i]);
} }
} }
#else /* !__MINGW32__ */ #else /* !__MINGW__ */
for (i = 0; i < FD_SETSIZE; i++) for (i = 0; i < FD_SETSIZE; i++)
{ {
if (FD_ISSET(i, &rfds)) if (FD_ISSET(i, &rfds))
@ -2472,7 +2472,7 @@ handle_io()
} }
} }
} }
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
} }
} }
} }
@ -2496,7 +2496,7 @@ handle_read(int desc)
while (ri->pos < GDO_REQ_SIZE && done == 0) while (ri->pos < GDO_REQ_SIZE && done == 0)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
r = recv(desc, (char *)&ptr[ri->pos], r = recv(desc, (char *)&ptr[ri->pos],
GDO_REQ_SIZE - ri->pos, 0); GDO_REQ_SIZE - ri->pos, 0);
#else #else
@ -2518,7 +2518,7 @@ handle_read(int desc)
tcp_read++; tcp_read++;
handle_request(desc); handle_request(desc);
} }
#ifdef __MINGW32__ #ifdef __MINGW__
else if (WSAGetLastError() != WSAEWOULDBLOCK || nothingRead == 1) else if (WSAGetLastError() != WSAEWOULDBLOCK || nothingRead == 1)
#else #else
else if (errno != EWOULDBLOCK || nothingRead == 1) else if (errno != EWOULDBLOCK || nothingRead == 1)
@ -2773,7 +2773,7 @@ handle_request(int desc)
*(unsigned long*)wi->buf = port; *(unsigned long*)wi->buf = port;
} }
} }
#ifdef __MINGW32__ #ifdef __MINGW__
/* closesocket(sock); */ /* closesocket(sock); */
#else #else
close(sock); close(sock);
@ -2858,7 +2858,7 @@ handle_request(int desc)
memset(&sa, '\0', sizeof(sa)); memset(&sa, '\0', sizeof(sa));
sa.sin_family = AF_INET; sa.sin_family = AF_INET;
#if defined(__MINGW32__) #if defined(__MINGW__)
/* COMMENT: (3 Nov 2004 by Wim Oudshoorn): /* COMMENT: (3 Nov 2004 by Wim Oudshoorn):
The comment below might be true. But The comment below might be true. But
using addr[0].s_addr has on windows 2003 server using addr[0].s_addr has on windows 2003 server
@ -2878,7 +2878,7 @@ handle_request(int desc)
sa.sin_addr.s_addr = htonl(INADDR_ANY); sa.sin_addr.s_addr = htonl(INADDR_ANY);
#else #else
sa.sin_addr.s_addr = htonl(INADDR_ANY); sa.sin_addr.s_addr = htonl(INADDR_ANY);
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
sa.sin_port = htons(p); sa.sin_port = htons(p);
result = bind(sock, (void*)&sa, sizeof(sa)); result = bind(sock, (void*)&sa, sizeof(sa));
if (result == 0) if (result == 0)
@ -2887,7 +2887,7 @@ handle_request(int desc)
m = 0; m = 0;
} }
} }
#ifdef __MINGW32__ #ifdef __MINGW__
closesocket(sock); closesocket(sock);
#else #else
close(sock); close(sock);
@ -3033,7 +3033,7 @@ handle_request(int desc)
snprintf(ebuf, sizeof(ebuf), "Probe from '%s'", inet_ntoa(sin)); snprintf(ebuf, sizeof(ebuf), "Probe from '%s'", inet_ntoa(sin));
gdomap_log(LOG_DEBUG); gdomap_log(LOG_DEBUG);
} }
#ifdef __MINGW32__ #ifdef __MINGW__
if (IN_CLASSA(sin.s_addr)) if (IN_CLASSA(sin.s_addr))
{ {
net = sin.s_addr & IN_CLASSA_NET; net = sin.s_addr & IN_CLASSA_NET;
@ -3172,7 +3172,7 @@ handle_request(int desc)
"Probe reply from '%s'", inet_ntoa(sin)); "Probe reply from '%s'", inet_ntoa(sin));
gdomap_log(LOG_DEBUG); gdomap_log(LOG_DEBUG);
} }
#ifdef __MINGW32__ #ifdef __MINGW__
if (IN_CLASSA(sin.s_addr)) if (IN_CLASSA(sin.s_addr))
{ {
net = sin.s_addr & IN_CLASSA_NET; net = sin.s_addr & IN_CLASSA_NET;
@ -3275,7 +3275,7 @@ handle_send()
*/ */
if (entry->pos != entry->len) if (entry->pos != entry->len)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
if (WSAGetLastError() != WSAEWOULDBLOCK) if (WSAGetLastError() != WSAEWOULDBLOCK)
#else #else
if (errno != EWOULDBLOCK) if (errno != EWOULDBLOCK)
@ -3340,7 +3340,7 @@ handle_write(int desc)
ptr = wi->buf; ptr = wi->buf;
len = wi->len; len = wi->len;
#ifdef __MINGW32__ #ifdef __MINGW__
r = send(desc, &ptr[wi->pos], len - wi->pos, 0); r = send(desc, &ptr[wi->pos], len - wi->pos, 0);
#else #else
r = write(desc, &ptr[wi->pos], len - wi->pos); r = write(desc, &ptr[wi->pos], len - wi->pos);
@ -3451,14 +3451,14 @@ tryRead(int desc, int tim, unsigned char* dat, int len)
} }
else if (len > 0) else if (len > 0)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
rval = recv(desc, (char *)&dat[pos], len - pos, 0); rval = recv(desc, (char *)&dat[pos], len - pos, 0);
#else #else
rval = read(desc, &dat[pos], len - pos); rval = read(desc, &dat[pos], len - pos);
#endif #endif
if (rval < 0) if (rval < 0)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
if (WSAGetLastError() != WSAEWOULDBLOCK) if (WSAGetLastError() != WSAEWOULDBLOCK)
#else #else
if (errno != EWOULDBLOCK) if (errno != EWOULDBLOCK)
@ -3557,7 +3557,7 @@ tryWrite(int desc, int tim, unsigned char* dat, int len)
} }
else if (len > 0) else if (len > 0)
{ {
#ifdef __MINGW32__ /* FIXME: Is this correct? */ #ifdef __MINGW__ /* FIXME: Is this correct? */
rval = send(desc, (const char*)&dat[pos], len - pos, 0); rval = send(desc, (const char*)&dat[pos], len - pos, 0);
#else #else
void (*ifun)(); void (*ifun)();
@ -3573,7 +3573,7 @@ tryWrite(int desc, int tim, unsigned char* dat, int len)
if (rval <= 0) if (rval <= 0)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
if (WSAGetLastError() != WSAEWOULDBLOCK) if (WSAGetLastError() != WSAEWOULDBLOCK)
#else #else
if (errno != EWOULDBLOCK) if (errno != EWOULDBLOCK)
@ -3613,9 +3613,9 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
unsigned long port = *p; unsigned long port = *p;
gdo_req msg; gdo_req msg;
struct sockaddr_in sin; struct sockaddr_in sin;
#ifdef __MINGW32__ #ifdef __MINGW__
unsigned long dummy; unsigned long dummy;
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
*p = 0; *p = 0;
if (desc < 0) if (desc < 0)
@ -3623,7 +3623,7 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
return 1; /* Couldn't create socket. */ return 1; /* Couldn't create socket. */
} }
#ifdef __MINGW32__ #ifdef __MINGW__
dummy = 1; dummy = 1;
if (ioctlsocket(desc, FIONBIO, &dummy) < 0) if (ioctlsocket(desc, FIONBIO, &dummy) < 0)
{ {
@ -3632,7 +3632,7 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
WSASetLastError(e); WSASetLastError(e);
return 2; /* Couldn't set non-blocking. */ return 2; /* Couldn't set non-blocking. */
} }
#else /* !__MINGW32__ */ #else /* !__MINGW__ */
if ((e = fcntl(desc, F_GETFL, 0)) >= 0) if ((e = fcntl(desc, F_GETFL, 0)) >= 0)
{ {
e |= NBLK_OPT; e |= NBLK_OPT;
@ -3651,12 +3651,12 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
errno = e; errno = e;
return 2; /* Couldn't set non-blocking. */ return 2; /* Couldn't set non-blocking. */
} }
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
memcpy(&sin, addr, sizeof(sin)); memcpy(&sin, addr, sizeof(sin));
if (connect(desc, (struct sockaddr*)&sin, sizeof(sin)) != 0) if (connect(desc, (struct sockaddr*)&sin, sizeof(sin)) != 0)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
if (WSAGetLastError() == WSAEWOULDBLOCK) if (WSAGetLastError() == WSAEWOULDBLOCK)
#else #else
if (errno == EINPROGRESS) if (errno == EINPROGRESS)
@ -3666,7 +3666,7 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
if (e == -2) if (e == -2)
{ {
e = errno; e = errno;
#ifdef __MINGW32__ #ifdef __MINGW__
closesocket(desc); closesocket(desc);
#else #else
close(desc); close(desc);
@ -3677,7 +3677,7 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
else if (e == -1) else if (e == -1)
{ {
e = errno; e = errno;
#ifdef __MINGW32__ #ifdef __MINGW__
closesocket(desc); closesocket(desc);
#else #else
close(desc); close(desc);
@ -3689,7 +3689,7 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
else else
{ {
e = errno; e = errno;
#ifdef __MINGW32__ #ifdef __MINGW__
closesocket(desc); closesocket(desc);
#else #else
close(desc); close(desc);
@ -3713,7 +3713,7 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
e = tryWrite(desc, 10, (uptr)&msg, GDO_REQ_SIZE); e = tryWrite(desc, 10, (uptr)&msg, GDO_REQ_SIZE);
if (e != GDO_REQ_SIZE) if (e != GDO_REQ_SIZE)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
e = WSAGetLastError(); e = WSAGetLastError();
closesocket(desc); closesocket(desc);
WSASetLastError(e); WSASetLastError(e);
@ -3727,7 +3727,7 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
e = tryRead(desc, 3, (uptr)&port, 4); e = tryRead(desc, 3, (uptr)&port, 4);
if (e != 4) if (e != 4)
{ {
#ifdef __MINGW32__ #ifdef __MINGW__
e = WSAGetLastError(); e = WSAGetLastError();
closesocket(desc); closesocket(desc);
WSASetLastError(e); WSASetLastError(e);
@ -3752,7 +3752,7 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
if (tryRead(desc, 3, b, len) != len) if (tryRead(desc, 3, b, len) != len)
{ {
free(b); free(b);
#ifdef __MINGW32__ #ifdef __MINGW__
e = WSAGetLastError(); e = WSAGetLastError();
closesocket(desc); closesocket(desc);
WSASetLastError(e); WSASetLastError(e);
@ -3778,7 +3778,7 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
if (tryRead(desc, 3, b, len) != len) if (tryRead(desc, 3, b, len) != len)
{ {
free(b); free(b);
#ifdef __MINGW32__ #ifdef __MINGW__
e = WSAGetLastError(); e = WSAGetLastError();
closesocket(desc); closesocket(desc);
WSASetLastError(e); WSASetLastError(e);
@ -3810,7 +3810,7 @@ int ptype, struct sockaddr_in* addr, unsigned short* p, uptr*v)
} }
*p = (unsigned short)port; *p = (unsigned short)port;
#ifdef __MINGW32__ #ifdef __MINGW__
closesocket(desc); closesocket(desc);
#else #else
close(desc); close(desc);
@ -4275,7 +4275,7 @@ static void do_help(int argc, char **argv, char *options)
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
#ifdef __MINGW32__ #ifdef __MINGW__
static char* static char*
quoteArg(const char *arg) quoteArg(const char *arg)
{ {
@ -4387,7 +4387,7 @@ main(int argc, char** argv)
#endif #endif
#endif #endif
#ifdef __MINGW32__ #ifdef __MINGW__
WORD wVersionRequested; WORD wVersionRequested;
WSADATA wsaData; WSADATA wsaData;
@ -4399,7 +4399,7 @@ main(int argc, char** argv)
* Would use inet_aton(), but older systems don't have it. * Would use inet_aton(), but older systems don't have it.
*/ */
loopback.s_addr = inet_addr("127.0.0.1"); loopback.s_addr = inet_addr("127.0.0.1");
#ifdef __MINGW32__ #ifdef __MINGW__
class_a_net = IN_CLASSA_NET; class_a_net = IN_CLASSA_NET;
class_a_mask.s_addr = class_a_net; class_a_mask.s_addr = class_a_net;
class_b_net = IN_CLASSB_NET; class_b_net = IN_CLASSB_NET;
@ -4680,7 +4680,7 @@ printf(
exit (0); exit (0);
} }
#ifdef __MINGW32__ /* On Win32, we don't fork */ #ifdef __MINGW__ /* On Win32, we don't fork */
if (nofork == 0) if (nofork == 0)
{ {
char **a = malloc((argc+2) * sizeof(char*)); char **a = malloc((argc+2) * sizeof(char*));
@ -4778,7 +4778,7 @@ printf(
gdomap_log(LOG_DEBUG); gdomap_log(LOG_DEBUG);
} }
#endif /* !__MINGW32__ */ #endif /* !__MINGW__ */
init_my_port(); /* Determine port to listen on. */ init_my_port(); /* Determine port to listen on. */
init_ports(); /* Create ports to handle requests. */ init_ports(); /* Create ports to handle requests. */
@ -4825,7 +4825,7 @@ printf(
{ {
FILE *fptr; FILE *fptr;
#ifndef __MINGW32__ #ifndef __MINGW__
if (getuid () == 0) if (getuid () == 0)
#endif #endif
{ {
@ -4843,7 +4843,7 @@ printf(
fclose(fptr); fclose(fptr);
chmod(pidfile, 0644); chmod(pidfile, 0644);
} }
#ifndef __MINGW32__ #ifndef __MINGW__
else else
{ {
snprintf(ebuf, sizeof(ebuf), snprintf(ebuf, sizeof(ebuf),
@ -4853,7 +4853,7 @@ printf(
#endif #endif
} }
{ {
#ifndef __MINGW32__ #ifndef __MINGW__
int uid = -2; int uid = -2;
int gid = -2; int gid = -2;
#endif #endif
@ -4874,7 +4874,7 @@ printf(
/* /*
* As another level of paranoia - restrict this process to /tmp * As another level of paranoia - restrict this process to /tmp
*/ */
#ifndef __MINGW32__ #ifndef __MINGW__
if (chdir("/tmp") < 0) if (chdir("/tmp") < 0)
{ {
snprintf(ebuf, sizeof(ebuf), "Unable to change directory to /tmp"); snprintf(ebuf, sizeof(ebuf), "Unable to change directory to /tmp");
@ -4892,10 +4892,10 @@ printf(
} }
chdir("/"); chdir("/");
} }
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
#endif /* __svr4__ */ #endif /* __svr4__ */
#ifndef __MINGW32__ #ifndef __MINGW__
/* /*
* Try to become a 'safe' user now that we have * Try to become a 'safe' user now that we have
* done everything that needs root priv. * done everything that needs root priv.
@ -4929,7 +4929,7 @@ printf(
gdomap_log(LOG_CRIT); gdomap_log(LOG_CRIT);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
} }
init_probe(); /* Probe other name servers on net. */ init_probe(); /* Probe other name servers on net. */

View file

@ -76,7 +76,7 @@ main(int argc, char** argv, char **env)
NSString *name = [[args objectAtIndex: 1] lowercaseString]; NSString *name = [[args objectAtIndex: 1] lowercaseString];
NSString *sep; NSString *sep;
#ifdef __MINGW32__ #ifdef __MINGW__
sep = @";"; sep = @";";
#else #else
sep = @":"; sep = @":";

View file

@ -5,7 +5,7 @@
are permitted in any medium without royalty provided the copyright are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. notice and this notice are preserved.
*/ */
#if defined(__MINGW32__) #if defined(__MINGW__)
#include <windows.h> #include <windows.h>
#include <winsock2.h> #include <winsock2.h>
#else #else
@ -16,7 +16,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <signal.h> #include <signal.h>
#endif /* __MINGW32__ */ #endif /* __MINGW__ */
#include <sys/file.h> #include <sys/file.h>
#include <sys/stat.h> #include <sys/stat.h>