From eff71248f2996db4af86b6f81ef598a33079b66a Mon Sep 17 00:00:00 2001 From: rfm Date: Wed, 22 Feb 2006 09:30:55 +0000 Subject: [PATCH] Fixup some conditional compilation to use __MINGW32__ git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22535 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/NSException.m | 4 ++-- Source/NSLog.m | 6 +++--- Source/NSPage.m | 3 --- Source/NSPathUtilities.m | 20 +++++++++----------- Source/NSTimeZone.m | 19 ++++++++++--------- 6 files changed, 30 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 046ccb06c..d084c541f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,12 @@ * Source/Additions/GSXML.m: Fix parsing error .. was not recognising base64 elements. * Headers/Foundation/NSPathUtilitites.h: Expand config documentation + * NSTimeZone.m: + * NSPathUtilities.m: + * NSPage.m: + * NSException.m: + * NSLog.m: + Fix some MINGW32 conditional compilation to use __MINGW32__ 2006-02-21 Richard Frith-Macdonald diff --git a/Source/NSException.m b/Source/NSException.m index 8dfd32305..e99f448d7 100644 --- a/Source/NSException.m +++ b/Source/NSException.m @@ -276,7 +276,7 @@ _NSAddHandler (NSHandler* handler) NSThread *thread; thread = GSCurrentThread(); -#if defined(__WIN32__) && defined(DEBUG) +#if defined(__MINGW32__) && defined(DEBUG) if (thread->_exception_handler && IsBadReadPtr(thread->_exception_handler, sizeof(NSHandler))) { @@ -299,7 +299,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(__WIN32__) +#if defined(__MINGW32__) if (IsBadReadPtr(handler, sizeof(NSHandler))) { fprintf(stderr, "ERROR: Could not remove exception handler, " diff --git a/Source/NSLog.m b/Source/NSLog.m index e1458ed9b..8812cc47f 100644 --- a/Source/NSLog.m +++ b/Source/NSLog.m @@ -108,7 +108,7 @@ _NSLog_standard_printf_handler (NSString* message) NSData *d; const char *buf; unsigned len; -#if defined(__WIN32__) +#if defined(__MINGW32__) LPCWSTR null_terminated_buf; #else #if defined(HAVE_SYSLOG) @@ -139,7 +139,7 @@ _NSLog_standard_printf_handler (NSString* message) len = [d length]; } -#if defined(__WIN32__) +#if defined(__MINGW32__) null_terminated_buf = UNISTR(message); OutputDebugStringW(null_terminated_buf); @@ -184,7 +184,7 @@ _NSLog_standard_printf_handler (NSString* message) #else write(_NSLogDescriptor, buf, len); #endif -#endif // __WIN32__ +#endif // __MINGW32__ } /** diff --git a/Source/NSPage.m b/Source/NSPage.m index 02064b54d..abdc4fc10 100644 --- a/Source/NSPage.m +++ b/Source/NSPage.m @@ -29,9 +29,6 @@ #include "Foundation/NSObjCRuntime.h" #include "Foundation/NSZone.h" #include -#ifdef __WIN32__ -#include -#endif #ifdef HAVE_UNISTD_H #include #endif diff --git a/Source/NSPathUtilities.m b/Source/NSPathUtilities.m index 6e486da39..9801e28af 100644 --- a/Source/NSPathUtilities.m +++ b/Source/NSPathUtilities.m @@ -117,7 +117,7 @@ static NSString *gnustep_flattened = nil; #endif -#if defined(__WIN32__) +#if defined(__MINGW32__) /* * FIXME ... should check access properly if the file is on an NTFS volume. */ @@ -663,7 +663,7 @@ ParseConfigurationFile(NSString *fileName, NSMutableDictionary *dict, if ([userName isEqual: fileOwner] == NO) { -#if defined(__WIN32__) +#if defined(__MINGW32__) 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], @@ -679,7 +679,7 @@ ParseConfigurationFile(NSString *fileName, NSMutableDictionary *dict, } if (([attributes filePosixPermissions] & (0022 & ATTRMASK)) != 0) { -#if defined(__WIN32__) +#if defined(__MINGW32__) fprintf(stderr, "The file '%S' is writable by someone other than" " its owner (permissions 0%lo).\nIgnoring it.\n", [fileName fileSystemRepresentation], @@ -968,7 +968,7 @@ GSSetUserName(NSString *aName) NSString * NSUserName(void) { -#if defined(__WIN32__) +#if defined(__MINGW32__) if (theUserName == nil) { /* Use the LOGNAME environment variable if set. */ @@ -1108,7 +1108,7 @@ NSHomeDirectoryForUser(NSString *loginName) NSString * NSFullUserName(void) { -#if defined(__WIN32__) +#if defined(__MINGW32__) /* FIXME: Win32 way to get full user name via Net API */ return NSUserName(); #else @@ -1210,7 +1210,7 @@ NSTemporaryDirectory(void) int perm; int owner; BOOL flag; -#if !defined(__WIN32__) +#if !defined(__MINGW32__) int uid; #else unichar buffer[1024]; @@ -1237,12 +1237,10 @@ NSTemporaryDirectory(void) baseTempDirName = [env objectForKey: @"TMP"]; if (baseTempDirName == nil) { -#if defined(__MINGW32__) -#ifdef __CYGWIN__ +#if defined(__CYGWIN__) baseTempDirName = @"/cygdrive/c/"; -#else - baseTempDirName = @"/c/"; -#endif +#elif defined(__MINGW32__) + baseTempDirName = @"C:\\"; #else baseTempDirName = @"/tmp"; #endif diff --git a/Source/NSTimeZone.m b/Source/NSTimeZone.m index f8f36d2a4..e94a0fd64 100644 --- a/Source/NSTimeZone.m +++ b/Source/NSTimeZone.m @@ -199,7 +199,7 @@ typedef struct { } @end -#if defined(__WIN32__) +#if defined(__MINGW32__) @interface GSWindowsTimeZone : NSTimeZone { @public @@ -423,7 +423,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type) fileName = [NSTimeZoneClass getTimeZoneFile: name]; if (fileName == nil || ![[NSFileManager defaultManager] fileExistsAtPath: fileName]) -#if defined(__WIN32__) +#if defined(__MINGW32__) { zone = [[GSWindowsTimeZone alloc] initWithName: name data: 0]; RELEASE(self); @@ -437,7 +437,7 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type) #endif data = [NSData dataWithContentsOfFile: fileName]; } -#if defined(__WIN32__) +#if defined(__MINGW32__) if (!data) zone = [[GSWindowsTimeZone alloc] initWithName: name data: data]; else @@ -1405,7 +1405,7 @@ static NSMapTable *absolutes = 0; } #endif -#if defined(__WIN32__) +#if defined(__MINGW32__) /* * Try to get timezone from windows registry. */ @@ -1898,9 +1898,10 @@ static NSMapTable *absolutes = 0; @end /** - * This class serves no useful purpose in GNUstep, and is provided - * solely for backward compatibility with the OpenStep spec. It is - * missing entirely from MacOS-X. + * This class serves no useful purpose in GNUstep other than to provide + * a backup mechanism for handling abbreviations where the precomputed + * data files cannot be found. It is provided primarily for backward + * compatibility with the OpenStep spec. It is missing entirely from MacOS-X. */ @implementation NSTimeZoneDetail @@ -2011,7 +2012,7 @@ static NSString *zoneDirs[] = { @end -#if defined(__WIN32__) +#if defined(__MINGW32__) /* Timezone information data as stored in the registry */ typedef struct TZI_format { LONG Bias; @@ -2435,7 +2436,7 @@ int dayOfCommonEra(NSTimeInterval when); return timeZoneName; } @end -#endif // __WIN32__ +#endif // __MINGW32__ @implementation GSTimeZone