changes for use of _WIN32 define on windows

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39492 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2016-03-09 13:16:16 +00:00
parent cf1970c544
commit 2efa3f43d0
46 changed files with 303 additions and 251 deletions

View file

@ -1,3 +1,52 @@
2016-03-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source\NSSocketPortNameServer.m:
* Source\GSSocketStream.h:
* Source\NSTimeZone.m:
* Source\GSSocketStream.m:
* Source\NSCalendarDate.m:
* Source\NSBundle.m:
* Source\NSPathUtilities.m:
* Source\NSProcessInfo.m:
* Source\NSSocketPort.m:
* Source\GSRunLoopWatcher.m:
* Source\NSUserDefaults.m:
* Source\GSStream.m:
* Source\NSDebug.m:
* Source\GSTLS.m:
* Source\NSFileHandle.m:
* Source\GSHTTPURLHandle.m:
* Source\NSPage.m:
* Source\GSRunLoopCtxt.h:
* Source\GSPrivate.h:
* Source\NSInvocation.m:
* Source\NSFileManager.m:
* Source\objc-load.m:
* Source\NSException.m:
* Source\NSURL.m:
* Source\NSObject.m:
* Source\NSString.m:
* Source\cifframe.h:
* Source\Additions\NSData+GNUstepBase.m:
* Source\Additions\NSError+GNUstepBase.m:
* Source\Additions\NSTask+GNUstepBase.m:
* Source\NSConnection.m:
* Source\GSPortPrivate.h:
* Source\NSThread.m:
* Source\NSData.m:
* Source\NSHost.m:
* Source\GSNetwork.h:
* Source\NSPipe.m:
* Source\GSFileHandle.h:
* Source\NSLog.m:
* Source\GSFileHandle.m:
* Source\NSTask.m:
* Tests\base\NSTask\launch.m:
* Tests\base\NSURL\basic.m:
* Tests\base\NSURL\mystep.m:
* Tests\base\NSString\test02.m:
More changes to standardise on using _WIN32 define for windows.
2016-03-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSCalendar.m: Fix 64bit issue with undefined components.

View file

@ -35,7 +35,7 @@
#include <zlib.h>
#endif
#if defined(__MINGW32__)
#if defined(_WIN32)
#include <wincrypt.h>
#else
#include <fcntl.h>
@ -44,7 +44,7 @@
static int
randombytes(uint8_t *buf, unsigned len)
{
#if defined(__MINGW32__)
#if defined(_WIN32)
HCRYPTPROV hProvider = 0;

View file

@ -37,7 +37,7 @@
@implementation NSError(GNUstepBase)
#if !defined(__MINGW__)
#if !defined(_WIN32)
#if !defined(HAVE_STRERROR_R)
#if defined(HAVE_STRERROR)
static int
@ -90,7 +90,7 @@ strerror_r(int eno, char *buf, int len)
+ (NSError*) _last
{
int eno;
#if defined(__MINGW__)
#if defined(_WIN32)
eno = GetLastError();
if (eno == 0) eno = errno;
#else
@ -108,7 +108,7 @@ strerror_r(int eno, char *buf, int len)
NSError *error;
NSString *domain;
NSDictionary *info;
#if defined(__MINGW__)
#if defined(_WIN32)
LPVOID lpMsgBuf;
NSString *message=nil;

View file

@ -36,7 +36,7 @@
{
static NSSet *executable = nil;
#if defined(__MINGW__)
#if defined(_WIN32)
if (nil == executable)
{
NSMutableSet *m;
@ -77,7 +77,7 @@
static NSString*
executablePath(NSFileManager *mgr, NSString *path)
{
#if defined(__MINGW__)
#if defined(_WIN32)
NSString *tmp = [path pathExtension];
if ([tmp length] == 0)
@ -159,7 +159,7 @@ executablePath(NSFileManager *mgr, NSString *path)
env = [[NSProcessInfo processInfo] environment];
pathlist = [env objectForKey:@"PATH"];
#if defined(__MINGW__)
#if defined(_WIN32)
/* Windows 2000 and perhaps others have "Path" not "PATH" */
if (pathlist == nil)
{

View file

@ -66,7 +66,7 @@ struct sockaddr_in;
#if USE_ZLIB
gzFile gzDescriptor;
#endif
#if defined(__MINGW__)
#if defined(_WIN32)
WSAEVENT event;
#endif
#endif

View file

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

View file

@ -322,7 +322,7 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
[[NSObject leakAt: &urlOrder] release];
urlLock = [GSLazyLock new];
[[NSObject leakAt: &urlLock] release];
#if !defined(__MINGW__)
#if !defined(_WIN32)
sslClass = [NSFileHandle sslClass];
#endif
}
@ -1380,7 +1380,7 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
*/
if (sock != nil)
{
#if defined(__MINGW__)
#if defined(_WIN32)
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSRunLoop *loop = [NSRunLoop currentRunLoop];
NSFileHandle *test = RETAIN(sock);

View file

@ -38,7 +38,7 @@
#endif
#if defined(__MINGW32__) || defined(__MINGW64__)
#if defined(_WIN32)
#include <io.h>
#include <winsock2.h>
@ -75,7 +75,7 @@
|| EINTR == errno\
|| EAGAIN == errno)
#endif /* __MINGW__ */
#endif /* _WIN32 */
/* The backlog argument to the listen() system call.
* Systems should silently truncate the backlog if they don't support one

View file

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

View file

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

View file

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

View file

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

View file

@ -35,7 +35,7 @@ typedef union {
#ifdef AF_INET6
struct sockaddr_in i6;
#endif
#ifndef __MINGW__
#ifndef _WIN32
struct sockaddr_un u;
#endif
} sockaddr_any;

View file

@ -68,7 +68,7 @@ GSPrivateSockaddrLength(struct sockaddr *addr)
#ifdef AF_INET6
case AF_INET6: return sizeof(struct sockaddr_in6);
#endif
#ifndef __MINGW__
#ifndef _WIN32
case AF_LOCAL: return sizeof(struct sockaddr_un);
#endif
default: return 0;
@ -1405,7 +1405,7 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn";
static inline BOOL
socketError(int result)
{
#if defined(__MINGW__)
#if defined(_WIN32)
return (result == SOCKET_ERROR) ? YES : NO;
#else
return (result < 0) ? YES : NO;
@ -1422,7 +1422,7 @@ socketWouldBlock()
static void
setNonBlocking(SOCKET fd)
{
#if defined(__MINGW__)
#if defined(_WIN32)
unsigned long dummy = 1;
if (ioctlsocket(fd, FIONBIO, &dummy) == SOCKET_ERROR)
@ -1462,7 +1462,7 @@ setNonBlocking(SOCKET fd)
_sibling = nil;
_closing = NO;
_passive = NO;
#if defined(__MINGW__)
#if defined(_WIN32)
_loopID = WSA_INVALID_EVENT;
#else
_loopID = (void*)(intptr_t)-1;
@ -1607,7 +1607,7 @@ setNonBlocking(SOCKET fd)
}
#endif
#ifndef __MINGW__
#ifndef _WIN32
case AF_LOCAL:
{
struct sockaddr_un peer;
@ -1641,7 +1641,7 @@ setNonBlocking(SOCKET fd)
- (void) _setLoopID: (void *)ref
{
#if !defined(__MINGW__)
#if !defined(_WIN32)
_sock = (SOCKET)(intptr_t)ref; // On gnu/linux _sock is _loopID
#endif
_loopID = ref;
@ -1672,7 +1672,7 @@ setNonBlocking(SOCKET fd)
* monitored, and on mswindows systems we create an event object to be
* monitored (the socket events are assoociated with this object later).
*/
#if defined(__MINGW__)
#if defined(_WIN32)
_loopID = CreateEvent(NULL, NO, NO, NULL);
#else
_loopID = (void*)(intptr_t)sock; // On gnu/linux _sock is _loopID
@ -1768,7 +1768,7 @@ setNonBlocking(SOCKET fd)
* indication of opened
*/
[self _setStatus: NSStreamStatusOpening];
#if defined(__MINGW__)
#if defined(_WIN32)
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
#endif
if (NSCountMapTable(_loops) > 0)
@ -1802,7 +1802,7 @@ setNonBlocking(SOCKET fd)
}
open_ok:
#if defined(__MINGW__)
#if defined(_WIN32)
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
#endif
[super open];
@ -1823,7 +1823,7 @@ setNonBlocking(SOCKET fd)
return;
}
[_handler bye];
#if defined(__MINGW__)
#if defined(_WIN32)
[super close];
if (_sibling && [_sibling streamStatus] != NSStreamStatusClosed)
{
@ -1892,7 +1892,7 @@ setNonBlocking(SOCKET fd)
}
else
{
#if defined(__MINGW__)
#if defined(_WIN32)
readLen = recv([self _sock], (char*) buffer, (socklen_t) len, 0);
#else
readLen = read([self _sock], buffer, len);
@ -1946,7 +1946,7 @@ setNonBlocking(SOCKET fd)
- (void) _dispatch
{
#if defined(__MINGW__)
#if defined(_WIN32)
AUTORELEASE(RETAIN(self));
/*
* Windows only permits a single event to be associated with a socket
@ -2101,7 +2101,7 @@ setNonBlocking(SOCKET fd)
#endif
}
#if defined(__MINGW__)
#if defined(_WIN32)
- (BOOL) runLoopShouldBlock: (BOOL*)trigger
{
*trigger = YES;
@ -2139,7 +2139,7 @@ setNonBlocking(SOCKET fd)
return 0;
}
#if defined(__MINGW__)
#if defined(_WIN32)
writeLen = send([self _sock], (char*) buffer, (socklen_t) len, 0);
#else
writeLen = write([self _sock], buffer, (socklen_t) len);
@ -2240,7 +2240,7 @@ setNonBlocking(SOCKET fd)
* indication of opened
*/
[self _setStatus: NSStreamStatusOpening];
#if defined(__MINGW__)
#if defined(_WIN32)
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
#endif
if (NSCountMapTable(_loops) > 0)
@ -2274,7 +2274,7 @@ setNonBlocking(SOCKET fd)
}
open_ok:
#if defined(__MINGW__)
#if defined(_WIN32)
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
#endif
[super open];
@ -2297,7 +2297,7 @@ setNonBlocking(SOCKET fd)
return;
}
[_handler bye];
#if defined(__MINGW__)
#if defined(_WIN32)
if (_sibling && [_sibling streamStatus] != NSStreamStatusClosed)
{
/*
@ -2368,7 +2368,7 @@ setNonBlocking(SOCKET fd)
- (void) _dispatch
{
#if defined(__MINGW__)
#if defined(_WIN32)
AUTORELEASE(RETAIN(self));
/*
* Windows only permits a single event to be associated with a socket
@ -2521,7 +2521,7 @@ setNonBlocking(SOCKET fd)
#endif
}
#if defined(__MINGW__)
#if defined(_WIN32)
- (BOOL) runLoopShouldBlock: (BOOL*)trigger
{
*trigger = YES;
@ -2622,7 +2622,7 @@ setNonBlocking(SOCKET fd)
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
#if defined(__MINGW__)
#if defined(_WIN32)
WSAEventSelect(_sock, _loopID, FD_ALL_EVENTS);
#endif
[super open];
@ -2630,7 +2630,7 @@ setNonBlocking(SOCKET fd)
- (void) close
{
#if defined(__MINGW__)
#if defined(_WIN32)
if (_loopID != WSA_INVALID_EVENT)
{
WSACloseEvent(_loopID);
@ -2749,7 +2749,7 @@ setNonBlocking(SOCKET fd)
- (void) _dispatch
{
#if defined(__MINGW__)
#if defined(_WIN32)
WSANETWORKEVENTS events;
if (WSAEnumNetworkEvents(_sock, _loopID, &events) == SOCKET_ERROR)

View file

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

View file

@ -49,7 +49,7 @@
@implementation NSString(gnutlsFileSystemRepresentation)
- (const char*) gnutlsFileSystemRepresentation
{
#if defined(__MINGW__)
#if defined(_WIN32)
const unichar *buf = (const unichar*)[self fileSystemRepresentation];
int len = 0;
NSString *str;

View file

@ -270,7 +270,7 @@ AbsolutePathOfExecutable(NSString *path, BOOL atLaunch)
{
pathlist = [env objectForKey:@"Path"];
}
#if defined(__MINGW__)
#if defined(_WIN32)
patharr = [pathlist componentsSeparatedByString:@";"];
#else
patharr = [pathlist componentsSeparatedByString:@":"];
@ -462,7 +462,7 @@ bundle_object_name(NSString *path, NSString* executable)
return path1;
else if ([mgr isReadableFileAtPath: path0] == YES)
return path0;
#if defined(__MINGW__)
#if defined(_WIN32)
/* 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.
*/
@ -788,7 +788,7 @@ _find_main_bundle_for_tool(NSString *toolName)
{
bundlePath = [bundlePath stringByDeletingLastPathComponent];
}
#if defined(__MINGW__)
#if defined(_WIN32)
/* On windows, the library (dll) is in the Tools area rather than
* in the framework, so we can adjust the path here.
*/
@ -823,7 +823,7 @@ _find_main_bundle_for_tool(NSString *toolName)
if (bundlePath)
bundle = [[self alloc] initWithPath: bundlePath];
}
#if !defined(__MINGW__)
#if !defined(_WIN32)
}
#endif
@ -1677,7 +1677,7 @@ IF_NO_GC(
NSWarnMLog(@"NSBundle -initWithPath: requires absolute path names, "
@"given '%@'", path);
#if defined(__MINGW__)
#if defined(_WIN32)
if ([path length] > 0 &&
([path characterAtIndex: 0]=='/' || [path characterAtIndex: 0]=='\\'))
{
@ -1863,7 +1863,7 @@ IF_NO_GC(
{
[pathCache removeObjectForKey: path];
}
#if defined(__MINGW__)
#if defined(_WIN32)
else if ('\\' == c)
{
[pathCache removeObjectForKey: path];
@ -2258,7 +2258,7 @@ IF_NO_GC(
{
NSString *rootPath;
#if !defined(__MINGW__)
#if !defined(_WIN32)
if (_frameworkVersion)
rootPath = [NSString stringWithFormat:@"%@/Versions/%@", [self bundlePath],
_frameworkVersion];
@ -2737,7 +2737,7 @@ IF_NO_GC(
mangledName = [mangledName stringByReplacingString: @"+"
withString: @"_1"];
#if !defined(__MINGW__)
#if !defined(_WIN32)
path = [_path stringByAppendingPathComponent:@"Versions/Current"];
#else
path = _path;
@ -2770,7 +2770,7 @@ IF_NO_GC(
if (_bundleType == NSBUNDLE_FRAMEWORK)
{
#if !defined(__MINGW__)
#if !defined(_WIN32)
return [_path stringByAppendingPathComponent:
[NSString stringWithFormat:@"Versions/%@/%@",
version, executableName]];
@ -2799,12 +2799,12 @@ IF_NO_GC(
if (_bundleType == NSBUNDLE_FRAMEWORK)
{
#if !defined(__MINGW__)
#if !defined(_WIN32)
return [_path stringByAppendingPathComponent:
[NSString stringWithFormat:@"Versions/%@/Resources",
version]];
#else
/* No Versions (that require symlinks) on MINGW */
/* No Versions (that require symlinks) on mswindows */
return [_path stringByAppendingPathComponent: @"Resources"];
#endif
}
@ -2856,7 +2856,7 @@ IF_NO_GC(
if (_bundleType == NSBUNDLE_FRAMEWORK)
{
#if !defined(__MINGW__)
#if !defined(_WIN32)
return [_path stringByAppendingPathComponent:
[NSString stringWithFormat:@"Versions/%@/PlugIns",
version]];
@ -2884,7 +2884,7 @@ IF_NO_GC(
if (_bundleType == NSBUNDLE_FRAMEWORK)
{
#if !defined(__MINGW__)
#if !defined(_WIN32)
return [_path stringByAppendingPathComponent:
[NSString stringWithFormat:@"Versions/%@/PrivateFrameworks",
version]];
@ -2954,7 +2954,7 @@ IF_NO_GC(
*/
libraryName = [libraryName lastPathComponent];
#if defined(__MINGW__)
#if defined(_WIN32)
/* A dll is usually of the form 'xxx-maj_min.dll'
* so we can extract the version info and use it.
*/

View file

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

View file

@ -1284,7 +1284,7 @@ static NSLock *cached_proxies_gate = nil;
/*
* Make sure we are not registered.
*/
#if !defined(__MINGW__)
#if !defined(_WIN32)
if ([IreceivePort isKindOfClass: [NSMessagePort class]])
{
[self registerName: nil
@ -1806,7 +1806,7 @@ static NSLock *cached_proxies_gate = nil;
- (void) setRootObject: (id)anObj
{
setRootObjectForInPort(anObj, IreceivePort);
#if defined(__MINGW__)
#if defined(_WIN32)
/* 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
* to detect that condition.

View file

@ -239,7 +239,7 @@ encodebase64(unsigned char **dstRef,
static BOOL
readContentsOfFile(NSString* path, void** buf, off_t* len, NSZone* zone)
{
#if defined(__MINGW__)
#if defined(_WIN32)
const unichar *thePath = 0;
#else
const char *thePath = 0;
@ -249,7 +249,7 @@ readContentsOfFile(NSString* path, void** buf, off_t* len, NSZone* zone)
int c;
off_t fileLength;
#if defined(__MINGW__)
#if defined(_WIN32)
thePath = (const unichar*)[path fileSystemRepresentation];
#else
thePath = [path fileSystemRepresentation];
@ -260,7 +260,7 @@ readContentsOfFile(NSString* path, void** buf, off_t* len, NSZone* zone)
return NO;
}
#if defined(__MINGW__)
#if defined(_WIN32)
theFile = _wfopen(thePath, L"rb");
#else
theFile = fopen(thePath, "rb");
@ -1606,7 +1606,7 @@ failure:
options: (NSUInteger)writeOptionsMask
error: (NSError **)errorPtr
{
#if defined(__MINGW__)
#if defined(_WIN32)
NSUInteger length = [path length];
unichar wthePath[length + 100];
unichar wtheRealPath[length + 100];
@ -3444,7 +3444,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
off_t off;
int fd;
#if defined(__MINGW__)
#if defined(_WIN32)
const unichar *thePath = (const unichar*)[path fileSystemRepresentation];
#else
const char *thePath = [path fileSystemRepresentation];
@ -3457,7 +3457,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
return nil;
}
#if defined(__MINGW__)
#if defined(_WIN32)
fd = _wopen(thePath, _O_RDONLY);
#else
fd = open(thePath, O_RDONLY);

View file

@ -796,7 +796,7 @@ __builtin_extract_return_address(__builtin_return_address(a + 1)) : 0); break;
#include <setjmp.h>
#if defined(__MINGW__)
#if defined(_WIN32)
#ifndef SIGBUS
#define SIGBUS SIGILL
#endif

View file

@ -100,7 +100,7 @@ static NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler = 0;
#endif
#if defined(__MINGW__)
#if defined(_WIN32)
#if defined(USE_BINUTILS)
static NSString *
GSPrivateBaseAddress(void *addr, void **base)
@ -128,7 +128,7 @@ GSPrivateBaseAddress(void *addr, void **base)
return nil;
}
#endif /* USE_BINUTILS */
#else /* __MINGW__ */
#else /* _WIN32 */
#include <dlfcn.h>
@ -150,7 +150,7 @@ GSPrivateBaseAddress(void *addr, void **base)
#endif
}
#endif /* USE_BINUTILS */
#endif /* __MINGW__ */
#endif /* _WIN32 */
#if defined(USE_BINUTILS)
@ -1126,7 +1126,7 @@ _NSAddHandler (NSHandler* handler)
NSThread *thread;
thread = GSCurrentThread();
#if defined(__MINGW__) && defined(DEBUG)
#if defined(_WIN32) && defined(DEBUG)
if (thread->_exception_handler
&& IsBadReadPtr(thread->_exception_handler, sizeof(NSHandler)))
{
@ -1149,7 +1149,7 @@ _NSRemoveHandler (NSHandler* handler)
fprintf(stderr, "ERROR: Removing exception handler that is not on top "
"of the stack. (You probably called return in an NS_DURING block.)\n");
}
#if defined(__MINGW__)
#if defined(_WIN32)
if (IsBadReadPtr(handler, sizeof(NSHandler)))
{
fprintf(stderr, "ERROR: Could not remove exception handler, "

View file

@ -887,7 +887,7 @@ NSString * const NSFileHandleOperationException
#if defined(HAVE_GNUTLS)
#if !defined(__MINGW__)
#if !defined(_WIN32)
@interface GSTLSHandle : GSFileHandle
{
@ -1082,7 +1082,7 @@ GSTLSHandlePush(gnutls_transport_ptr_t handle, const void *buffer, size_t len)
}
@end
#endif /* MINGW */
#endif /* _WIN32 */
#endif /* HAVE_GNUTLS */

View file

@ -81,7 +81,7 @@
# include <windows.h>
#endif
#if defined(__MINGW__)
#if defined(_WIN32)
#include <stdio.h>
#include <tchar.h>
#include <wchar.h>
@ -93,7 +93,7 @@
/* determine filesystem max path length */
#if defined(_POSIX_VERSION) || defined(_WIN32)
# if defined(__MINGW__)
# if defined(_WIN32)
# include <sys/utime.h>
# else
# include <utime.h>
@ -185,7 +185,7 @@
* Macros to handle unichar filesystem support.
*/
#if defined(__MINGW__)
#if defined(_WIN32)
#define _CHMOD(A,B) _wchmod(A,B)
#define _CLOSEDIR(A) _wclosedir(A)
@ -371,7 +371,7 @@ static NSStringEncoding defaultEncoding;
{
bundleClass = [NSBundle class];
}
#if defined(__MINGW__)
#if defined(_WIN32)
return SetCurrentDirectoryW(lpath) == TRUE ? YES : NO;
#else
return (chdir(lpath) == 0) ? YES : NO;
@ -400,7 +400,7 @@ static NSStringEncoding defaultEncoding;
old = [self fileAttributesAtPath: path traverseLink: YES];
lpath = [defaultManager fileSystemRepresentationWithPath: path];
#ifndef __MINGW__
#ifndef _WIN32
if (object_getClass(attributes) == GSAttrDictionaryClass)
{
num = ((GSAttrDictionary*)attributes)->statbuf.st_uid;
@ -528,7 +528,7 @@ static NSStringEncoding defaultEncoding;
ASSIGN(_lastError, str);
}
}
#endif /* __MINGW__ */
#endif /* _WIN32 */
num = [attributes filePosixPermissions];
if (num != NSNotFound && num != [old filePosixPermissions])
@ -896,7 +896,7 @@ static NSStringEncoding defaultEncoding;
}
else
{
#if defined(__MINGW__)
#if defined(_WIN32)
const _CHAR *lpath;
lpath = [self fileSystemRepresentationWithPath: path];
@ -957,7 +957,7 @@ static NSStringEncoding defaultEncoding;
contents: (NSData*)contents
attributes: (NSDictionary*)attributes
{
#if defined(__MINGW__)
#if defined(_WIN32)
const _CHAR *lpath = [self fileSystemRepresentationWithPath: path];
HANDLE fh;
DWORD written = 0;
@ -976,7 +976,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(_WIN32)
fh = CreateFileW(lpath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
if (fh == INVALID_HANDLE_VALUE)
@ -1052,7 +1052,7 @@ static NSStringEncoding defaultEncoding;
{
NSString *currentDir = nil;
#if defined(__MINGW__)
#if defined(_WIN32)
int len = GetCurrentDirectoryW(0, 0);
if (len > 0)
{
@ -1085,7 +1085,7 @@ static NSStringEncoding defaultEncoding;
#endif /* HAVE_GETCWD */
currentDir = [self stringWithFileSystemRepresentation: path
length: strlen(path)];
#endif /* !MINGW */
#endif /* !_WIN32 */
return currentDir;
}
@ -1464,7 +1464,7 @@ static NSStringEncoding defaultEncoding;
}
else
{
#if defined(__MINGW__)
#if defined(_WIN32)
DWORD res;
res = GetFileAttributesW(lpath);
@ -1489,12 +1489,12 @@ static NSStringEncoding defaultEncoding;
return NO;
}
is_dir = ((statbuf.st_mode & S_IFMT) == S_IFDIR);
#endif /* MINGW */
#endif /* _WIN32 */
}
if (!is_dir)
{
#if defined(__MINGW__)
#if defined(_WIN32)
if (DeleteFileW(lpath) == FALSE)
#else
if (unlink(lpath) < 0)
@ -1594,7 +1594,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(_WIN32)
{
DWORD res;
@ -1632,7 +1632,7 @@ static NSStringEncoding defaultEncoding;
return YES;
}
#endif /* MINGW */
#endif /* _WIN32 */
}
/**
@ -1649,7 +1649,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(_WIN32)
{
DWORD res;
@ -1686,7 +1686,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(_WIN32)
{
DWORD res;
@ -1728,7 +1728,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(_WIN32)
{
DWORD res;
NSString *ext;
@ -1787,7 +1787,7 @@ static NSStringEncoding defaultEncoding;
return NO;
}
#if defined(__MINGW__)
#if defined(_WIN32)
// TODO - handle directories
{
DWORD res;
@ -2011,7 +2011,7 @@ static NSStringEncoding defaultEncoding;
*/
- (NSDictionary*) fileSystemAttributesAtPath: (NSString*)path
{
#if defined(__MINGW__)
#if defined(_WIN32)
unsigned long long totalsize, freesize;
id values[5];
id keys[5] = {
@ -2118,7 +2118,7 @@ static NSStringEncoding defaultEncoding;
ASSIGN(_lastError, @"no support for filesystem attributes");
return nil;
#endif
#endif /* MINGW */
#endif /* _WIN32 */
}
/**
@ -2274,7 +2274,7 @@ static NSStringEncoding defaultEncoding;
#endif
}
#if defined(__MINGW__)
#if defined(_WIN32)
- (const GSNativeChar*) fileSystemRepresentationWithPath: (NSString*)path
{
if (path != nil && [path rangeOfString: @"/"].length > 0)
@ -2486,7 +2486,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
if (dirbuf)
{
#if defined(__MINGW__)
#if defined(_WIN32)
/* Skip "." and ".." directory entries */
if (wcscmp(dirbuf->d_name, L".") == 0
|| wcscmp(dirbuf->d_name, L"..") == 0)
@ -2521,7 +2521,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
{
// Do not follow links
#ifdef S_IFLNK
#ifdef __MINGW__
#ifdef _WIN32
#warning "lstat does not support unichars"
#else
if (!_flags.isFollowing)
@ -2756,7 +2756,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
toFile: (NSString*)destination
handler: (id)handler
{
#if defined(__MINGW__)
#if defined(_WIN32)
if (CopyFileW([self fileSystemRepresentationWithPath: source],
[self fileSystemRepresentationWithPath: destination], NO))
{
@ -3190,7 +3190,7 @@ static NSSet *fileKeys = nil;
d = (GSAttrDictionary*)NSAllocateObject(self, (l+1)*sizeof(_CHAR),
NSDefaultMallocZone());
#if defined(S_IFLNK) && !defined(__MINGW__)
#if defined(S_IFLNK) && !defined(_WIN32)
if (traverse == NO)
{
if (lstat(lpath, &d->statbuf) != 0)
@ -3273,7 +3273,7 @@ static NSSet *fileKeys = nil;
{
NSString *group = @"UnknownGroup";
#if defined(__MINGW__)
#if defined(_WIN32)
DWORD returnCode = 0;
PSID sidOwner;
int result = TRUE;
@ -3430,7 +3430,7 @@ static NSSet *fileKeys = nil;
{
NSString *owner = @"UnknownUser";
#if defined(__MINGW__)
#if defined(_WIN32)
DWORD returnCode = 0;
PSID sidOwner;
int result = TRUE;
@ -3560,7 +3560,7 @@ static NSSet *fileKeys = nil;
- (NSUInteger) fileSystemNumber
{
#if defined(__MINGW__)
#if defined(_WIN32)
DWORD volumeSerialNumber = 0;
_CHAR volumePathName[128];
if (GetVolumePathNameW(_path,volumePathName,128))

View file

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

View file

@ -79,7 +79,7 @@
#if defined(HAVE_MMAP)
munmap(buffer, size);
#else
#if !defined(__MINGW__) && defined(HAVE_MPROTECT)
#if !defined(_WIN32) && defined(HAVE_MPROTECT)
if (mprotect(buffer, NSPageSize(), PROT_READ|PROT_WRITE) == -1)
{
NSLog(@"Failed to protect memory as writable: %@", [NSError _last]);
@ -159,7 +159,7 @@
- (void) protect
{
#if !defined(HAVE_FFI_PREP_CLOSURE_LOC)
#if defined(__MINGW__)
#if defined(_WIN32)
DWORD old;
if (VirtualProtect(buffer, size, PAGE_EXECUTE, &old) == 0)
{

View file

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

View file

@ -201,7 +201,7 @@ static void GSLogZombie(id o, SEL sel)
#endif
#if defined(__MINGW__)
#if defined(_WIN32)
#ifndef _WIN64
#undef InterlockedIncrement
#undef InterlockedDecrement
@ -1011,13 +1011,13 @@ static id gs_weak_load(id obj)
GC_set_warn_proc(GSGarbageCollectorLog);
#endif
#ifdef __MINGW__
#ifdef _WIN32
{
// See libgnustep-base-entry.m
extern void gnustep_base_socket_init(void);
gnustep_base_socket_init();
}
#else /* __MINGW__ */
#else /* _WIN32 */
#ifdef SIGPIPE
/*
@ -1059,7 +1059,7 @@ static id gs_weak_load(id obj)
}
#endif /* HAVE_SIGACTION */
#endif /* SIGPIPE */
#endif /* __MINGW__ */
#endif /* _WIN32 */
finalize_sel = @selector(finalize);
finalize_imp = class_getMethodImplementation(self, finalize_sel);

View file

@ -35,7 +35,7 @@
#include <malloc.h>
#endif
#ifdef __MINGW__
#ifdef _WIN32
#include <malloc.h>
static size_t
getpagesize(void)
@ -132,7 +132,7 @@ NSRealMemoryAvailable ()
if ((sysinfo(&info)) != 0)
return 0;
return info.freeram;
#elif defined(__MINGW__)
#elif defined(_WIN32)
MEMORYSTATUSEX memory;
memory.dwLength = sizeof(memory);
@ -160,7 +160,7 @@ NSAllocateMemoryPages (NSUInteger bytes)
{
NSUInteger size = NSRoundUpToMultipleOfPageSize (bytes);
void *where;
#if defined(__MINGW__)
#if defined(_WIN32)
where = VirtualAlloc(NULL, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
#elif __mach__
kern_return_t r;
@ -189,7 +189,7 @@ NSAllocateMemoryPages (NSUInteger bytes)
void
NSDeallocateMemoryPages (void *ptr, NSUInteger bytes)
{
#if defined(__MINGW__)
#if defined(_WIN32)
VirtualFree(ptr, 0, MEM_RELEASE);
#elif __mach__
vm_deallocate (mach_task_self (), ptr, NSRoundUpToMultipleOfPageSize (bytes));

View file

@ -115,7 +115,7 @@ static NSString *gnustep_is_flattened =
nil;
#endif
#if defined(__MINGW__)
#if defined(_WIN32)
#include <sddl.h>
#include <lmaccess.h>
@ -399,7 +399,7 @@ getPathConfig(NSDictionary *dict, NSString *key)
"an absolute path.\nPlease fix your configuration file.\n",
[key UTF8String],
[[[dict objectForKey: key] description] UTF8String]);
#if defined(__MINGW_)
#if defined(_WIN32)
if ([path length] > 2)
{
unichar buf[3];
@ -409,7 +409,7 @@ getPathConfig(NSDictionary *dict, NSString *key)
&& (buf[2] == '/' || buf[2] == '\\'))
{
path = [NSString stringWithFormat: @"%c:%@", (char)buf[1],
[path substringFromindex: 2]];
[path substringFromIndex: 2]];
path = [path stringByReplacingString: @"/"
withString: @"\\"];
fprintf(stderr, "I am guessing that you meant '%s'\n",
@ -797,7 +797,7 @@ addDefaults(NSString *defs, NSMutableDictionary *conf)
if (([attributes filePosixPermissions]
& (0022 & ATTRMASK)) != 0)
{
#if defined(__MINGW__)
#if defined(_WIN32)
fprintf(stderr,
"\nThe file '%S' is writable by someone other than"
" its owner (permissions 0%lo).\nIgnoring it.\n",
@ -846,7 +846,7 @@ addDefaults(NSString *defs, NSMutableDictionary *conf)
}
if (nil == d)
{
#if defined(__MINGW__)
#if defined(_WIN32)
fprintf(stderr,
"\nThe file '%S' is not parseable as a property list"
" containing a dictionary.\nIgnoring it.\n",
@ -988,17 +988,17 @@ GNUstepConfig(NSDictionary *newConfig)
" specifying a valid path to the config file.\n",
[file UTF8String]);
}
#if defined(__MINGW_)
#if defined(_WIN32)
if ([file length] > 2)
{
unichar buf[3];
[file getCharacters: buf range: NSMakeRange(0, 3)];
if ((buf[0] == '/' || bug[0] == '\\') && isalpha(buf[1])
&& (buf[2] == '/' || bug[2] == '\\'))
if ((buf[0] == '/' || buf[0] == '\\') && isalpha(buf[1])
&& (buf[2] == '/' || buf[2] == '\\'))
{
file = [NSString stringWithFormat: @"%c:%@",
(char)buf[1], [file substringFromindex: 2]];
(char)buf[1], [file substringFromIndex: 2]];
file = [file stringByReplacingString: @"/"
withString: @"\\"];
fprintf(stderr, "I am guessing that you meant '%s'\n",
@ -1155,7 +1155,7 @@ static void InitialisePathUtilities(void)
ASSIGNCOPY(uninstalled, [[[NSProcessInfo processInfo] environment]
objectForKey: @"GNUSTEP_UNINSTALLED_LIBRARY_DIRECTORY"]);
gnustepUserName = [NSUserName() copy];
#if defined(__MINGW__)
#if defined(_WIN32)
{
union {
SID sid;
@ -1331,7 +1331,7 @@ ParseConfigurationFile(NSString *fileName, NSMutableDictionary *dict,
if ([userName isEqual: fileOwner] == NO)
{
#if defined(__MINGW__)
#if defined(_WIN32)
fprintf(stderr, "The file '%S' is owned by '%s' but we expect it"
" to be the personal config file of '%s'.\nIgnoring it.\n",
[fileName fileSystemRepresentation],
@ -1347,7 +1347,7 @@ ParseConfigurationFile(NSString *fileName, NSMutableDictionary *dict,
}
if (([attributes filePosixPermissions] & (0022 & ATTRMASK)) != 0)
{
#if defined(__MINGW__)
#if defined(_WIN32)
fprintf(stderr, "The file '%S' is writable by someone other than"
" its owner (permissions 0%lo).\nIgnoring it.\n",
[fileName fileSystemRepresentation],
@ -1637,7 +1637,7 @@ GSSetUserName(NSString *aName)
NSString *
NSUserName(void)
{
#if defined(__MINGW__)
#if defined(_WIN32)
if (theUserName == nil)
{
/* Use the LOGNAME environment variable if set. */
@ -1740,7 +1740,7 @@ NSHomeDirectoryForUser(NSString *loginName)
{
NSString *s = nil;
#if !defined(__MINGW__)
#if !defined(_WIN32)
#if defined(HAVE_GETPWNAM_R)
struct passwd pw;
struct passwd *p;
@ -1824,7 +1824,7 @@ NSFullUserName(void)
if (theFullUserName == nil)
{
NSString *userName = NSUserName();
#if defined(__MINGW__)
#if defined(_WIN32)
struct _USER_INFO_2 *userInfo;
if (NetUserGetInfo(NULL, (unichar*)[userName cStringUsingEncoding:
@ -1908,7 +1908,7 @@ GSDefaultsRootForUser(NSString *userName)
defaultsDir = @GNUSTEP_TARGET_USER_DEFAULTS_DIR;
}
}
#if defined(__MINGW__)
#if defined(_WIN32)
if ([defaultsDir rangeOfString: @":REGISTRY:"].length > 0)
{
return defaultsDir; // Just use windows registry.
@ -1948,7 +1948,7 @@ NSTemporaryDirectory(void)
int perm;
int owner;
BOOL flag;
#if !defined(__MINGW__)
#if !defined(_WIN32)
int uid;
#else
unichar buffer[1024];
@ -1978,7 +1978,7 @@ NSTemporaryDirectory(void)
#if defined(__CYGWIN__)
#warning Basing temporary directory in /cygdrive/c; any reason?
baseTempDirName = @"/cygdrive/c/";
#elif defined(__MINGW__)
#elif defined(_WIN32)
baseTempDirName = @"C:\\";
#elif defined(__APPLE__)
/*
@ -2019,9 +2019,9 @@ NSTemporaryDirectory(void)
// Mateu Batle: secure temporary directories don't work in MinGW
// Ivan Vucica: there are also problems with Cygwin
// probable cause: http://stackoverflow.com/q/9561759/39974
#if !defined(__MINGW__) && !defined(__CYGWIN__)
#if !defined(_WIN32) && !defined(__CYGWIN__)
#if defined(__MINGW__)
#if defined(_WIN32)
uid = owner;
#else
#ifdef HAVE_GETEUID
@ -2097,7 +2097,7 @@ NSOpenStepRootDirectory(void)
#if defined(__CYGWIN__)
root = @"/cygdrive/c/";
#elif defined(__MINGW__)
#elif defined(_WIN32)
root = @"C:/";
#else
root = @"/";
@ -2105,7 +2105,7 @@ NSOpenStepRootDirectory(void)
return root;
}
#if defined(__MINGW__)
#if defined(_WIN32)
/* The developer root on a windows system (where we have an msys environment
* set up) is the point in the filesystem where we can reference make.exe via
* msys/.../bin/. That is, it's the windows path at which msys is installed.
@ -2294,7 +2294,7 @@ if (domainMask & mask) \
case NSDeveloperDirectory:
{
#if defined(__MINGW__)
#if defined(_WIN32)
if (nil == gnustepDeveloperDir)
{
NSString *path = nil;

View file

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

View file

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

View file

@ -49,14 +49,14 @@
#include <stdio.h>
#ifdef __MINGW__
#ifdef _WIN32
#define close closesocket
#else
#include <sys/param.h> /* for MAXHOSTNAMELEN */
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h> /* for inet_ntoa() */
#endif /* !__MINGW__ */
#endif /* !_WIN32 */
#include <ctype.h> /* for strchr() */
#if defined(HAVE_SYS_FCNTL_H)
@ -65,7 +65,7 @@
# include <fcntl.h>
#endif
#ifdef __MINGW__
#ifdef _WIN32
#include <winsock2.h>
#include <wininet.h>
#include <process.h>
@ -110,7 +110,7 @@
#define SOCKET_ERROR -1
#define INVALID_SOCKET -1
#endif /* !__MINGW__ */
#endif /* !_WIN32 */
/*
* Largest chunk of data possible in DO
@ -211,7 +211,7 @@ typedef enum {
unsigned nItems; /* Number of items to be read. */
GSHandleState state; /* State of the handle. */
unsigned int addrNum; /* Address number within host. */
#ifdef __MINGW__
#ifdef _WIN32
WSAEVENT event; /* Win32 event associated to socket */
WSAEVENT eventTemp; /* Win32 event for asynchronous */
@public
@ -232,7 +232,7 @@ typedef enum {
+ (GSTcpHandle*) handleWithDescriptor: (SOCKET)d;
- (BOOL) connectToPort: (NSSocketPort*)aPort beforeDate: (NSDate*)when;
- (int) descriptor;
#if defined(__MINGW__)
#if defined(_WIN32)
- (int) eventHandle;
#endif
- (void) invalidate;
@ -376,13 +376,13 @@ static Class runLoopClass;
+ (GSTcpHandle*) handleWithDescriptor: (SOCKET)d
{
GSTcpHandle *handle;
#ifdef __MINGW__
#ifdef _WIN32
unsigned long dummy;
#else
int e;
#endif /* __MINGW__ */
#endif /* _WIN32 */
#ifdef __MINGW__
#ifdef _WIN32
WSAEVENT ev;
int rc;
#endif
@ -392,7 +392,7 @@ static Class runLoopClass;
NSLog(@"illegal descriptor (%d) for Tcp Handle", d);
return nil;
}
#ifdef __MINGW__
#ifdef _WIN32
dummy = 1;
if (ioctlsocket(d, FIONBIO, &dummy) == SOCKET_ERROR)
{
@ -400,7 +400,7 @@ static Class runLoopClass;
d, [NSError _last]);
return nil;
}
#else /* !__MINGW__ */
#else /* !_WIN32 */
if ((e = fcntl(d, F_GETFL, 0)) >= 0)
{
e |= NBLK_OPT;
@ -423,7 +423,7 @@ static Class runLoopClass;
handle->wMsgs = [NSMutableArray new];
handle->myLock = [GSLazyRecursiveLock new];
handle->valid = YES;
#if defined(__MINGW__)
#if defined(_WIN32)
ev = (WSAEVENT)CreateEvent(NULL,NO,NO,NULL);
if (ev == WSA_INVALID_EVENT)
{
@ -444,7 +444,7 @@ static Class runLoopClass;
{
if (self == [GSTcpHandle class])
{
#ifdef __MINGW__
#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
@ -561,7 +561,7 @@ static Class runLoopClass;
state = GS_H_TRYCON;
l = [NSRunLoop currentRunLoop];
#if defined(__MINGW__)
#if defined(_WIN32)
NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!");
[l addEvent: (void*)(uintptr_t)event
type: ET_HANDLE
@ -599,7 +599,7 @@ static Class runLoopClass;
M_LOCK(myLock);
}
#if defined(__MINGW__)
#if defined(_WIN32)
[l removeEvent: (void*)(uintptr_t)event
type: ET_HANDLE
forMode: NSConnectionReplyMode
@ -690,7 +690,7 @@ static Class runLoopClass;
return desc;
}
#if defined(__MINGW__)
#if defined(_WIN32)
- (int) eventHandle
{
return (int) (size_t) event;
@ -715,7 +715,7 @@ static Class runLoopClass;
valid = NO;
l = [runLoopClass currentRunLoop];
#if defined(__MINGW__)
#if defined(_WIN32)
[l removeEvent: (void*)(uintptr_t)event
type: ET_HANDLE
forMode: nil
@ -738,7 +738,7 @@ static Class runLoopClass;
@"invalidated 0x%"PRIxPTR, (NSUInteger)self);
[[self recvPort] removeHandle: self];
[[self sendPort] removeHandle: self];
#if defined(__MINGW__)
#if defined(_WIN32)
WSACloseEvent(event);
event = WSA_INVALID_EVENT;
#endif
@ -806,12 +806,12 @@ static Class runLoopClass;
[self invalidate];
return;
}
#ifdef __MINGW__
#ifdef _WIN32
else if (WSAGetLastError()!= WSAEINTR
&& WSAGetLastError()!= WSAEWOULDBLOCK)
#else
else if (errno != EINTR && errno != EAGAIN)
#endif /* !__MINGW__ */
#endif /* !_WIN32 */
{
NSDebugMLLog(@"GSTcpHandle",
@"read failed - %@ on 0x%p", [NSError _last], self);
@ -1159,23 +1159,23 @@ static Class runLoopClass;
res = send(desc, b + wLength, l - wLength, 0);
if (res < 0)
{
#ifdef __MINGW__
#ifdef _WIN32
if (WSAGetLastError()!= WSAEINTR
&& WSAGetLastError()!= WSAEWOULDBLOCK)
#else
if (errno != EINTR && errno != EAGAIN)
#endif /* !__MINGW__ */
#endif /* !_WIN32 */
{
NSLog(@"write attempt failed - %@", [NSError _last]);
[self invalidate];
return;
}
#ifdef __MINGW__
#ifdef _WIN32
if (WSAGetLastError()== WSAEWOULDBLOCK)
{
readyToSend = NO;
}
#endif /* !__MINGW__ */
#endif /* !_WIN32 */
}
else
{
@ -1221,7 +1221,7 @@ static Class runLoopClass;
extra: (void*)extra
forMode: (NSString*)mode
{
#if defined(__MINGW__)
#if defined(_WIN32)
WSANETWORKEVENTS ocurredEvents;
/* If we have been invalidated then we should ignore this
@ -1360,7 +1360,7 @@ static Class runLoopClass;
IF_NO_GC(RETAIN(self);)
#if defined(__MINGW__)
#if defined(_WIN32)
NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!");
[l addEvent: (void*)(uintptr_t)event
type: ET_HANDLE
@ -1395,7 +1395,7 @@ static Class runLoopClass;
&& [when timeIntervalSinceNow] > 0)
{
M_UNLOCK(myLock);
#if defined(__MINGW__)
#if defined(_WIN32)
if (readyToSend)
{
[self receivedEventWrite];
@ -1410,7 +1410,7 @@ static Class runLoopClass;
M_LOCK(myLock);
}
#if defined(__MINGW__)
#if defined(_WIN32)
[l removeEvent: (void*)(uintptr_t)event
type: ET_HANDLE
forMode: NSConnectionReplyMode
@ -1593,7 +1593,7 @@ static Class tcpPortClass;
port->address = [addr copy];
port->handles = NSCreateMapTable(NSIntegerMapKeyCallBacks,
NSObjectMapValueCallBacks, 0);
#if defined(__MINGW__)
#if defined(_WIN32)
port->eventListener = WSA_INVALID_EVENT;
port->events = NSCreateMapTable(NSIntegerMapKeyCallBacks,
NSIntegerMapValueCallBacks, 0);
@ -1671,7 +1671,7 @@ static Class tcpPortClass;
}
else
{
#if defined(__MINGW__)
#if defined(_WIN32)
int rc;
#endif
/*
@ -1681,7 +1681,7 @@ static Class tcpPortClass;
*/
port->listener = desc;
port->portNum = GSPrivateSockaddrPort(&sockaddr);
#if defined(__MINGW__)
#if defined(_WIN32)
port->eventListener = (WSAEVENT)CreateEvent(NULL,NO,NO,NULL);
if (port->eventListener == WSA_INVALID_EVENT)
{
@ -1769,7 +1769,7 @@ static Class tcpPortClass;
handle->recvPort = GS_GC_HIDE(self);
}
NSMapInsert(handles, (void*)(uintptr_t)[handle descriptor], (void*)handle);
#if defined(__MINGW__)
#if defined(_WIN32)
NSMapInsert(events, (void*)(uintptr_t)[handle eventHandle],
(void*)(uintptr_t)[handle descriptor]);
#endif
@ -1822,7 +1822,7 @@ static Class tcpPortClass;
* This is a callback method used by the NSRunLoop class to determine which
* descriptors to watch for the port.
*/
#if defined(__MINGW__)
#if defined(_WIN32)
- (void) getFds: (NSInteger*)fds count: (NSInteger*)count
{
NSInteger limit = *count;
@ -2074,7 +2074,7 @@ static Class tcpPortClass;
{
(void) close(listener);
listener = -1;
#if defined(__MINGW__)
#if defined(_WIN32)
WSACloseEvent(eventListener);
eventListener = WSA_INVALID_EVENT;
#endif
@ -2091,7 +2091,7 @@ static Class tcpPortClass;
[handle invalidate];
}
}
#if defined(__MINGW__)
#if defined(_WIN32)
if (events != 0)
{
NSFreeMapTable(events);
@ -2134,7 +2134,7 @@ static Class tcpPortClass;
extra: (void*)extra
forMode: (NSString*)mode
{
#if defined(__MINGW__)
#if defined(_WIN32)
WSAEVENT event = (WSAEVENT)extra;
SOCKET desc;
#else
@ -2145,7 +2145,7 @@ static Class tcpPortClass;
NSDebugMLLog(@"NSPort", @"received %s event %p on 0x%"PRIxPTR,
type == ET_RPORT ? "read" : "write", extra, (NSUInteger)self);
#if defined(__MINGW__)
#if defined(_WIN32)
if (event == eventListener)
#else
if (desc == listener)
@ -2165,7 +2165,7 @@ static Class tcpPortClass;
setsockopt(desc, SOL_SOCKET, SO_KEEPALIVE, (char*)&status,
sizeof(status));
#if defined(__MINGW__)
#if defined(_WIN32)
// reset associated event with new socket
WSAEventSelect(desc, eventListener, 0);
#endif
@ -2185,7 +2185,7 @@ static Class tcpPortClass;
else
{
M_LOCK(myLock);
#if defined(__MINGW__)
#if defined(_WIN32)
desc = (SOCKET)NSMapGet(events, (void*)(uintptr_t)event);
#endif
handle = (GSTcpHandle*)NSMapGet(handles, (void*)(uintptr_t)desc);
@ -2195,7 +2195,7 @@ static Class tcpPortClass;
{
const char *t;
#if defined(__MINGW__)
#if defined(_WIN32)
if (type == ET_HANDLE) t = "winhandle";
#else
if (type == ET_RDESC) t = "rdesc";
@ -2268,7 +2268,7 @@ static Class tcpPortClass;
handle->recvPort = nil;
}
NSMapRemove(handles, (void*)(uintptr_t)[handle descriptor]);
#if defined(__MINGW__)
#if defined(_WIN32)
NSMapRemove(events, (void*)(uintptr_t)[handle eventHandle]);
#endif
if (((int) listener) < 0 && NSCountMapTable(handles) == 0)

View file

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

View file

@ -4134,7 +4134,7 @@ static BOOL (*nbImp)(id, SEL, unichar) = 0;
static NSFileManager *fm = nil;
#if defined(__MINGW__)
#if defined(_WIN32)
- (const GSNativeChar*) fileSystemRepresentation
{
if (fm == nil)
@ -4947,7 +4947,7 @@ static NSFileManager *fm = nil;
{
s = [s stringByExpandingTildeInPath];
}
#if defined(__MINGW__)
#if defined(_WIN32)
return IMMUTABLE(s);
#else
@ -5451,7 +5451,7 @@ static NSFileManager *fm = nil;
*/
if (c == pathSepChar())
{
#if defined(__MINGW__)
#if defined(_WIN32)
if (GSPathHandlingUnix() == YES)
{
return YES;

View file

@ -112,12 +112,12 @@ static BOOL hadChildSignal = NO;
static void handleSignal(int sig)
{
hadChildSignal = YES;
#ifndef __MINGW__
#ifndef _WIN32
signal(SIGCHLD, handleSignal);
#endif
}
#ifdef __MINGW__
#ifdef _WIN32
@interface NSConcreteWindowsTask : NSTask
{
@public
@ -280,7 +280,7 @@ pty_slave(const char* name)
}
[gnustep_global_lock unlock];
#ifndef __MINGW__
#ifndef _WIN32
signal(SIGCHLD, handleSignal);
#endif
}
@ -373,7 +373,7 @@ pty_slave(const char* name)
return;
}
#ifndef __MINGW__
#ifndef _WIN32
#ifdef HAVE_KILLPG
killpg(_taskId, SIGINT);
#else
@ -441,7 +441,7 @@ pty_slave(const char* name)
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has not yet launched"];
}
#ifndef __MINGW__
#ifndef _WIN32
#ifdef HAVE_KILLPG
killpg(_taskId, SIGCONT);
#else
@ -632,7 +632,7 @@ pty_slave(const char* name)
[NSException raise: NSInvalidArgumentException
format: @"NSTask - task has not yet launched"];
}
#ifndef __MINGW__
#ifndef _WIN32
#ifdef HAVE_KILLPG
killpg(_taskId, SIGSTOP);
#else
@ -664,7 +664,7 @@ pty_slave(const char* name)
}
_hasTerminated = YES;
#ifndef __MINGW__
#ifndef _WIN32
#ifdef HAVE_KILLPG
killpg(_taskId, SIGTERM);
#else
@ -799,7 +799,7 @@ pty_slave(const char* name)
lpath = [current stringByAppendingPathComponent: lpath];
}
lpath = [lpath stringByStandardizingPath];
#if defined(__MINGW__)
#if defined(_WIN32)
if ([lpath rangeOfString: @"/"].length > 0)
{
lpath = [lpath stringByReplacingString: @"/" withString: @"\\"];
@ -903,7 +903,7 @@ pty_slave(const char* name)
@end
#ifdef __MINGW__
#ifdef _WIN32
@implementation NSConcreteWindowsTask
BOOL
@ -1314,7 +1314,7 @@ quotedFromString(NSString *aString)
@end
#else /* !MINGW */
#else /* !_WIN32 */
@implementation NSConcreteUnixTask
@ -1521,7 +1521,7 @@ GSPrivateCheckTasks()
#endif
#else
#if defined(HAVE_SETPGID)
#if defined(__MINGW__)
#if defined(_WIN32)
pid = (int)GetCurrentProcessId(),
#else
pid = (int)getpid();
@ -1721,4 +1721,4 @@ GSPrivateCheckTasks()
}
@end
#endif /* !MINGW */
#endif /* !_WIN32 */

View file

@ -115,7 +115,7 @@
NSUInteger
GSPrivateThreadID()
{
#if defined(__MINGW__)
#if defined(_WIN32)
return (NSUInteger)GetCurrentThreadId();
#elif defined(HAVE_GETTID)
return (NSUInteger)syscall(SYS_gettid);
@ -132,7 +132,7 @@ GSPrivateThreadID()
* FIXME ... This is code for the microsoft compiler;
* how do we make it work for gcc/clang?
*/
#if defined(__MINGW__) && defined(HAVE_WINDOWS_H)
#if defined(_WIN32) && defined(HAVE_WINDOWS_H)
// Usage: SetThreadName (-1, "MainThread");
#include <windows.h>
const DWORD MS_VC_EXCEPTION=0x406D1388;
@ -263,7 +263,7 @@ GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when)
return;
}
#if defined(__MINGW__)
#if defined(_WIN32)
/*
* Avoid integer overflow by breaking up long sleeps.
*/
@ -299,7 +299,7 @@ GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when)
delay = when - GSPrivateTimeNow();
}
#else /* __MINGW__ */
#else /* _WIN32 */
/*
* Avoid integer overflow by breaking up long sleeps.
@ -352,7 +352,7 @@ GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when)
delay = when - GSPrivateTimeNow();
}
#endif /* !HAVE_NANOSLEEP */
#endif /* !__MINGW__ */
#endif /* !_WIN32 */
}
static NSArray *
@ -1257,7 +1257,7 @@ static void *nsthreadLauncher(void* thread)
BOOL signalled = NO;
[lock lock];
#if defined(__MINGW__)
#if defined(_WIN32)
if (INVALID_HANDLE_VALUE != event)
{
if (SetEvent(event) == 0)
@ -1307,7 +1307,7 @@ static void *nsthreadLauncher(void* thread)
- (id) init
{
#ifdef __MINGW__
#ifdef _WIN32
if ((event = CreateEvent(NULL, TRUE, FALSE, NULL)) == INVALID_HANDLE_VALUE)
{
DESTROY(self);
@ -1371,7 +1371,7 @@ static void *nsthreadLauncher(void* thread)
[lock lock];
p = AUTORELEASE(performers);
performers = nil;
#ifdef __MINGW__
#ifdef _WIN32
if (event != INVALID_HANDLE_VALUE)
{
CloseHandle(event);
@ -1400,7 +1400,7 @@ static void *nsthreadLauncher(void* thread)
unsigned int c;
[lock lock];
#if defined(__MINGW__)
#if defined(_WIN32)
if (event != INVALID_HANDLE_VALUE)
{
if (ResetEvent(event) == 0)

View file

@ -260,7 +260,7 @@ typedef struct {
}
@end
#if defined(__MINGW__)
#if defined(_WIN32)
@interface GSWindowsTimeZone : NSTimeZone
{
@public
@ -510,7 +510,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
data = [NSData dataWithContentsOfFile: fileName];
}
if (nil == data)
#if defined(__MINGW__)
#if defined(_WIN32)
{
zone = [[GSWindowsTimeZone alloc] initWithName: name data: 0];
DESTROY(self);
@ -522,7 +522,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
}
#endif
}
#if defined(__MINGW__)
#if defined(_WIN32)
if (!data)
zone = [[GSWindowsTimeZone alloc] initWithName: name data: data];
else
@ -1090,7 +1090,7 @@ static NSMapTable *absolutes = 0;
path = _time_zone_path (ABBREV_MAP, nil);
if (path != nil)
{
#if defined(__MINGW__)
#if defined(_WIN32)
unichar mode[3];
mode[0] = 'r';
@ -1476,7 +1476,7 @@ static NSMapTable *absolutes = 0;
}
}
#if defined(__MINGW__)
#if defined(_WIN32)
/*
* Try to get timezone from windows system call.
*/
@ -1821,7 +1821,7 @@ localZoneString, [zone name], sign, s/3600, (s/60)%60);
path = _time_zone_path (REGIONS_FILE, nil);
if (path != nil)
{
#if defined(__MINGW__)
#if defined(_WIN32)
unichar mode[3];
mode[0] = 'r';
@ -2525,7 +2525,7 @@ static NSString *zoneDirs[] = {
@end
#if defined(__MINGW__)
#if defined(_WIN32)
/* Timezone information data as stored in the registry */
typedef struct TZI_format {
LONG Bias;
@ -2964,7 +2964,7 @@ GSBreakTime(NSTimeInterval when, NSInteger*year, NSInteger*month, NSInteger*day,
return [self name];
}
@end
#endif // __MINGW__
#endif // _WIN32
@implementation GSTimeZone

View file

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

View file

@ -56,7 +56,7 @@
#import "GNUstepBase/NSProcessInfo+GNUstepBase.h"
#import "GNUstepBase/NSString+GNUstepBase.h"
#if defined(__MINGW__)
#if defined(_WIN32)
@class NSUserDefaultsWin32;
#endif
@ -830,7 +830,7 @@ newLanguages(NSArray *oldNames)
* instance locked ourselves at the point when it first becomes
* visible to other threads.
*/
#if defined(__MINGW__)
#if defined(_WIN32)
{
NSString *path = GSDefaultsRootForUser(NSUserName());
NSRange r = [path rangeOfString: @":REGISTRY:"];
@ -1207,7 +1207,7 @@ newLanguages(NSArray *oldNames)
}
r = [path rangeOfString: @":INTERNAL:"];
#if defined(__MINGW__)
#if defined(_WIN32)
if (r.length == 0)
{
r = [path rangeOfString: @":REGISTRY:"];

View file

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

View file

@ -87,7 +87,7 @@ static int
objc_initialize_loading(FILE *errorStream)
{
NSString *path;
#if defined(__MINGW__) || defined(__CYGWIN__)
#if defined(_WIN32) || defined(__CYGWIN__)
const unichar *fsPath;
#else
const char *fsPath;
@ -130,7 +130,7 @@ objc_load_callback(Class class, struct objc_category * category)
}
}
#if defined(__MINGW__) || defined(__CYGWIN__)
#if defined(_WIN32) || defined(__CYGWIN__)
#define FSCHAR unichar
#else
#define FSCHAR char
@ -241,7 +241,7 @@ GSPrivateUnloadModule(FILE *errorStream,
}
#if defined(__MINGW__) || defined(__CYGWIN__)
#if defined(_WIN32) || defined(__CYGWIN__)
// FIXME: We can probably get rid of this now - MinGW should include a working
// dladdr() wrapping this function, so we no longer need a Windows-only code
// path

View file

@ -200,7 +200,7 @@ NSLog(@"Developer: %@", NSSearchPathForDirectoriesInDomains(NSDeveloperDirectory
isEqual: @"~/nil"],
"'~/nil' stringByExpandingTildeInPath: != '~/nil'");
#if defined(__MINGW32__)
#if defined(_WIN32)
{
NSString *s = [@"~" stringByAppendingString: NSUserName()];
PASS(![[s stringByExpandingTildeInPath] isEqual: s],
@ -308,7 +308,7 @@ NSLog(@"Developer: %@", NSSearchPathForDirectoriesInDomains(NSDeveloperDirectory
[fm removeFileAtPath: tmpsrc handler: nil];
[fm createSymbolicLinkAtPath: tmpsrc pathContent: tmpdst];
#if !defined(__MINGW32__)
#if !defined(_WIN32)
PASS_EQUAL([tmpsrc stringByStandardizingPath], tmpsrc,
"foo->bar symlink not expanded by stringByStandardizingPath")
PASS_EQUAL([tmpsrc stringByResolvingSymlinksInPath], tmpdst,
@ -346,7 +346,7 @@ NSLog(@"Developer: %@", NSSearchPathForDirectoriesInDomains(NSDeveloperDirectory
PASS([@"home" isAbsolutePath] == NO,
"'home' isAbsolutePath == NO");
#if defined(__MINGW32__)
#if defined(_WIN32)
PASS([@"/home" isAbsolutePath] == NO,
"'/home' isAbsolutePath == NO");
PASS([@"//host/share" isAbsolutePath] == NO,

View file

@ -56,7 +56,7 @@ int main()
[outPipe release];
[task release];
#if !defined(__MINGW32__)
#if !defined(_WIN32)
task = [[NSTask alloc] init];
[task setLaunchPath:
[helpers stringByAppendingPathComponent: @"processgroup"]];

View file

@ -77,7 +77,7 @@ int main()
PASS([str isEqual: @"http://www.w3.org/silly-file-path/"],
"Abs of http://www.w3.org/silly-file-path/ is correct");
#if defined(__MINGW32__)
#if defined(_WIN32)
url = [NSURL fileURLWithPath: @"C:\\WINDOWS"];
str = [url path];
PASS_EQUAL(str, @"C:\\WINDOWS",
@ -239,7 +239,7 @@ int main()
//NSLog(@"with link %@, obtained URL: %@ String: %@", str, rel, [rel absoluteString]);
PASS([[rel absoluteString] isEqual: @"file://localhost/System/Library/Documentation/Developer/Gui/Reference/NSApplication.html#class$NSApplication"], "Adding relative file URL with fragment works");
#if defined(__MINGW32__)
#if defined(_WIN32)
GSPathHandling("unix");
#endif
@ -266,7 +266,7 @@ GSPathHandling("unix");
PASS_EQUAL([url relativeString], @"file://localhost/this%23is%20a%20Path%20with%20%25%20+%20=%20&%20%3C%20%3E%20%3F", "complex -relativeString");
PASS_EQUAL([url description], @"file://localhost/this%23is%20a%20Path%20with%20%25%20+%20=%20&%20%3C%20%3E%20%3F", "complex -description");
#if defined(__MINGW32__)
#if defined(_WIN32)
GSPathHandling("right");
#endif

View file

@ -82,6 +82,9 @@ int main()
END_SET("test4b")
START_SET("test5")
#ifdef _WIN32
GSPathHandling("unix");
#endif
NSURL *url = [NSURL fileURLWithPath: @"/this#is a Path with % < > ?"];
PASS_EQUAL([url scheme], @"file", "scheme");
PASS_EQUAL([url host], @"localhost", "host");