From 1a11998ecf8aa5e8c08c20576cdbccf72074b619 Mon Sep 17 00:00:00 2001 From: rfm Date: Sat, 12 Sep 2009 07:37:00 +0000 Subject: [PATCH] Cleanups and minor bugfixes for new code. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28665 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 37 +++++++++- .../Additions/GNUstepBase/GSVersionMacros.h | 2 +- Headers/Foundation/NSException.h | 7 +- Headers/Foundation/NSHTTPCookie.h | 2 +- Headers/Foundation/NSHTTPCookieStorage.h | 2 +- Headers/Foundation/NSIndexPath.h | 2 +- Headers/Foundation/NSInvocation.h | 2 +- Headers/Foundation/NSKeyValueObserving.h | 2 +- Headers/Foundation/NSObject.h | 56 ++++++++------ Headers/Foundation/NSStream.h | 2 +- Headers/Foundation/NSString.h | 6 +- Headers/Foundation/NSThread.h | 4 +- .../Foundation/NSURLAuthenticationChallenge.h | 2 +- Headers/Foundation/NSURLCache.h | 2 +- Headers/Foundation/NSURLConnection.h | 2 +- Headers/Foundation/NSURLCredential.h | 2 +- Headers/Foundation/NSURLCredentialStorage.h | 2 +- Headers/Foundation/NSURLDownload.h | 2 +- Headers/Foundation/NSURLError.h | 2 +- Headers/Foundation/NSURLProtectionSpace.h | 2 +- Headers/Foundation/NSURLProtocol.h | 2 +- Headers/Foundation/NSURLRequest.h | 2 +- Headers/Foundation/NSURLResponse.h | 2 +- Headers/Foundation/NSValueTransformer.h | 2 +- Source/NSCalendarDate.m | 24 ++++-- Source/NSException.m | 2 +- Source/NSObject.m | 74 ++++++++++--------- 27 files changed, 156 insertions(+), 92 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7fd69150f..5d18b27c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +2009-09-12 Richard Frith-Macdonald + + * Source/NSCalendarDate.m: Add optional diagnostics to detect system + time changes and warn about them. + * Source/NSException.m: Clean up to match coding standards. + Fix uninitialised variable bug. + * Source/NSObject.m: clean up and fix missing dealloc. + * Headers/Foundation/NSURLCredential.h: + * Headers/Foundation/NSHTTPCookieStorage.h: + * Headers/Foundation/NSException.h: + * Headers/Foundation/NSValueTransformer.h: + * Headers/Foundation/NSURLAuthenticationChallenge.h: + * Headers/Foundation/NSObject.h: + * Headers/Foundation/NSString.h: + * Headers/Foundation/NSStream.h: + * Headers/Foundation/NSThread.h: + * Headers/Foundation/NSHTTPCookie.h: + * Headers/Foundation/NSURLError.h: + * Headers/Foundation/NSURLProtectionSpace.h: + * Headers/Foundation/NSURLDownload.h: + * Headers/Foundation/NSKeyValueObserving.h: + * Headers/Foundation/NSURLRequest.h: + * Headers/Foundation/NSURLCredentialStorage.h: + * Headers/Foundation/NSInvocation.h: + * Headers/Foundation/NSURLResponse.h: + * Headers/Foundation/NSURLConnection.h: + * Headers/Foundation/NSIndexPath.h: + * Headers/Foundation/NSURLProtocol.h: + * Headers/Foundation/NSURLCache.h: + * Headers/Additions/GNUstepBase/GSVersionMacros.h: + Fix up errors in version of feature addition to GNUstep. Some + GNUstep version constants had leading zeros so they were interpreted + as octal rather than decimal. + 2009-09-11 David Chisnall * Source/NSException.m: @@ -16,7 +50,8 @@ Added implementations of the hooks provided by the new runtime. This brings NSObject up to feature-parity with the OS X 10.5 implementation when using the new runtime and up to feature-parity with the 10.6 - implementation if you are using the new runtime and compiling with clang. + implementation if you are using the new runtime and compiling with + clang. Also removes the objc_mutex_wibble stuff from NSObject in favour of just using NSLocks (which, with the new implementation, are now faster than diff --git a/Headers/Additions/GNUstepBase/GSVersionMacros.h b/Headers/Additions/GNUstepBase/GSVersionMacros.h index 9e04c80d1..38d544fbf 100644 --- a/Headers/Additions/GNUstepBase/GSVersionMacros.h +++ b/Headers/Additions/GNUstepBase/GSVersionMacros.h @@ -29,7 +29,7 @@ * Check consistency of definitions for system compatibility. */ #if defined(STRICT_OPENSTEP) -#define GS_OPENSTEP_V 010000 +#define GS_OPENSTEP_V 10000 #define NO_GNUSTEP 1 #elif defined(STRICT_MACOS_X) #define GS_OPENSTEP_V 100000 diff --git a/Headers/Foundation/NSException.h b/Headers/Foundation/NSException.h index ca5ac1585..94e84374e 100644 --- a/Headers/Foundation/NSException.h +++ b/Headers/Foundation/NSException.h @@ -117,19 +117,22 @@ extern "C" { format: (NSString*)format arguments: (va_list)argList; -#if OS_API_VERSION(100500,GS_API_LATEST) && GS_API_VERSION(011501,GS_API_LATEST) +#if OS_API_VERSION(100500,GS_API_LATEST) && GS_API_VERSION( 11501,GS_API_LATEST) /** Returns an array of the call stack return addresses at the point when * the exception was raised. Re-raising the exception does not change * this value. */ - (NSArray*) callStackReturnAddresses; +#endif + +#if OS_API_VERSION(100600,GS_API_LATEST) && GS_API_VERSION( 11903,GS_API_LATEST) /** * Returns an array of the symbolic names of the call stack return addresses. * Note that, on some platforms, symbols are only exported in * position-independent code and so these may only return numeric addresses for * code in static libraries or the main application. */ -- (NSArray *)callStackSymbols; +- (NSArray*) callStackSymbols; #endif /** diff --git a/Headers/Foundation/NSHTTPCookie.h b/Headers/Foundation/NSHTTPCookie.h index 9d792ce49..0255476ee 100644 --- a/Headers/Foundation/NSHTTPCookie.h +++ b/Headers/Foundation/NSHTTPCookie.h @@ -26,7 +26,7 @@ #define __NSHTTPCookie_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSHTTPCookieStorage.h b/Headers/Foundation/NSHTTPCookieStorage.h index eac4c5026..3956ec94c 100644 --- a/Headers/Foundation/NSHTTPCookieStorage.h +++ b/Headers/Foundation/NSHTTPCookieStorage.h @@ -26,7 +26,7 @@ #define __NSHTTPCookieStorage_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSIndexPath.h b/Headers/Foundation/NSIndexPath.h index 70875a195..5ddd12424 100644 --- a/Headers/Foundation/NSIndexPath.h +++ b/Headers/Foundation/NSIndexPath.h @@ -35,7 +35,7 @@ extern "C" { #endif -#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST) +#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST) /** * Instances of this class represent a series of indexes into a hierarchy diff --git a/Headers/Foundation/NSInvocation.h b/Headers/Foundation/NSInvocation.h index 7eca3b294..c6fd20a56 100644 --- a/Headers/Foundation/NSInvocation.h +++ b/Headers/Foundation/NSInvocation.h @@ -77,7 +77,7 @@ extern "C" { - (BOOL) argumentsRetained; - (void) retainArguments; -#if OS_API_VERSION(GS_API_NONE,GS_API_NONE) && GS_API_VERSION(011101,GS_API_LATEST) +#if OS_API_VERSION(GS_API_NONE,GS_API_NONE) && GS_API_VERSION( 11101,GS_API_LATEST) - (BOOL) targetRetained; - (void) retainArgumentsIncludingTarget: (BOOL)retainTargetFlag; #endif diff --git a/Headers/Foundation/NSKeyValueObserving.h b/Headers/Foundation/NSKeyValueObserving.h index 4f216145b..53ce85488 100644 --- a/Headers/Foundation/NSKeyValueObserving.h +++ b/Headers/Foundation/NSKeyValueObserving.h @@ -26,7 +26,7 @@ #define __NSKeyValueObserving_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100300,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST) +#if OS_API_VERSION(100300,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST) #import #import diff --git a/Headers/Foundation/NSObject.h b/Headers/Foundation/NSObject.h index 86a94556a..b9c185fe9 100644 --- a/Headers/Foundation/NSObject.h +++ b/Headers/Foundation/NSObject.h @@ -245,7 +245,8 @@ extern "C" { * -forwardInvocation: with equivalent semantics. This will be considerably * slower, but more portable. */ -+ (BOOL)resolveClassMethod:(SEL)name; ++ (BOOL) resolveClassMethod: (SEL)name; + /** * This method will be called when attempting to send a message an instance * that does not understand it. The class may install a new method for the @@ -256,9 +257,23 @@ extern "C" { * -forwardInvocation: with equivalent semantics. This will be considerably * slower, but more portable. */ -+ (BOOL)resolveInstanceMethod:(SEL)name; ++ (BOOL) resolveInstanceMethod: (SEL)name; #endif #if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) +/** + * Returns an auto-accessing proxy for the given object. This proxy sends a + * -beginContentAccess message to the receiver when it is created and an + * -endContentAccess message when it is destroyed. This prevents an object + * that implements the NSDiscardableContent protocol from having its contents + * discarded for as long as the proxy exists. + * + * On systems using the GNUstep runtime, messages send to the proxy will be + * slightly slower than direct messages. With the GCC runtime, they will be + * approximately two orders of magnitude slower. The GNUstep runtime, + * therefore, is strongly recommended for code calling this method. + */ +- (id) autoContentAccessingProxy; + /** * If an object does not understand a message, it may delegate it to another * object. Returning nil indicates that forwarding should not take place. The @@ -271,20 +286,8 @@ extern "C" { * runtime, you must also implement -forwardInvocation: with equivalent * semantics. This will be considerably slower, but more portable. */ -- (id)forwardingTargetForSelector:(SEL)aSelector; -/** - * Returns an auto-accessing proxy for the given object. This proxy sends a - * -beginContentAccess message to the receiver when it is created and an - * -endContentAccess message when it is destroyed. This prevents an object - * that implements the NSDiscardableContent protocol from having its contents - * discarded for as long as the proxy exists. - * - * On systems using the GNUstep runtime, messages send to the proxy will be - * slightly slower than direct messages. With the GCC runtime, they will be - * approximately two orders of magnitude slower. The GNUstep runtime, - * therefore, is strongly recommended for code calling this method. - */ -- (id)autoContentAccessingProxy; +- (id) forwardingTargetForSelector: (SEL)aSelector; + #endif @end @@ -459,6 +462,7 @@ GS_EXPORT NSRecursiveLock *gnustep_global_lock; afterDelay: (NSTimeInterval)seconds inModes: (NSArray*)modes; @end + #if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) /** * The NSDiscardableContent protocol is used by objects which encapsulate data @@ -466,29 +470,33 @@ GS_EXPORT NSRecursiveLock *gnustep_global_lock; * constraints are typically, but not always, related memory. */ @protocol NSDiscardableContent + /** * This method is called before any access to the object. It returns YES if * the object's content is still valid. The caller must call -endContentAccess * once for every call to -beginContentAccess; */ -- (BOOL)beginContentAccess; +- (BOOL) beginContentAccess; + +/** + * Discards the contents of the object if it is not currently being edited. + */ +- (void) discardContentIfPossible; + /** * This method indicates that the caller has finished accessing the contents of * the object adopting this protocol. Every call to -beginContentAccess must * be be paired with a call to this method after the caller has finished * accessing the contents. */ -- (void)endContentAccess; -/** - * Discards the contents of the object if it is not currently being edited. - */ -- (void)discardContentIfPossible; +- (void) endContentAccess; + /** * Returns YES if the contents of the object have been discarded, either via a * call to -discardContentIfPossible while the object is not in use, or by some - * implementation-dependent mechanism. + * implementation dependent mechanism. */ -- (BOOL)isContentDiscarded; +- (BOOL) isContentDiscarded; @end #endif #if defined(__cplusplus) diff --git a/Headers/Foundation/NSStream.h b/Headers/Foundation/NSStream.h index 120f217ac..8ad6e4564 100644 --- a/Headers/Foundation/NSStream.h +++ b/Headers/Foundation/NSStream.h @@ -25,7 +25,7 @@ #define __NSStream_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST) +#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSString.h b/Headers/Foundation/NSString.h index 2bec2058a..3f90b9578 100644 --- a/Headers/Foundation/NSString.h +++ b/Headers/Foundation/NSString.h @@ -252,7 +252,7 @@ typedef NSUInteger NSStringEncodingConversionOptions; + (id) string; + (id) stringWithCharacters: (const unichar*)chars length: (NSUInteger)length; -#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST) +#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST) + (id) stringWithCString: (const char*)byteString encoding: (NSStringEncoding)encoding; #endif @@ -264,7 +264,7 @@ typedef NSUInteger NSStringEncodingConversionOptions; // Initializing Newly Allocated Strings - (id) init; -#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST) +#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST) - (id) initWithBytes: (const void*)bytes length: (NSUInteger)length encoding: (NSStringEncoding)encoding; @@ -367,7 +367,7 @@ typedef NSUInteger NSStringEncodingConversionOptions; - (const char*) cString; #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) -#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST) +#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST) - (const char*) cStringUsingEncoding: (NSStringEncoding)encoding; - (BOOL) getCString: (char*)buffer maxLength: (NSUInteger)maxLength diff --git a/Headers/Foundation/NSThread.h b/Headers/Foundation/NSThread.h index afdc7a1d3..058a18886 100644 --- a/Headers/Foundation/NSThread.h +++ b/Headers/Foundation/NSThread.h @@ -114,13 +114,13 @@ extern "C" { - (NSMutableDictionary*) threadDictionary; #if OS_API_VERSION(MAC_OS_X_VERSION_10_2,GS_API_LATEST) \ - && GS_API_VERSION(010200,GS_API_LATEST) + && GS_API_VERSION( 10200,GS_API_LATEST) + (void) setThreadPriority: (double)pri; + (double) threadPriority; #endif #if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST) \ - && GS_API_VERSION(011501,GS_API_LATEST) + && GS_API_VERSION( 11501,GS_API_LATEST) /** Returns an array of the call stack return addresses. */ diff --git a/Headers/Foundation/NSURLAuthenticationChallenge.h b/Headers/Foundation/NSURLAuthenticationChallenge.h index 98174e5a3..6445437d3 100644 --- a/Headers/Foundation/NSURLAuthenticationChallenge.h +++ b/Headers/Foundation/NSURLAuthenticationChallenge.h @@ -26,7 +26,7 @@ #define __NSURLAuthenticationChallenge_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSURLCache.h b/Headers/Foundation/NSURLCache.h index 8116344a2..319bb434d 100644 --- a/Headers/Foundation/NSURLCache.h +++ b/Headers/Foundation/NSURLCache.h @@ -26,7 +26,7 @@ #define __NSURLCache_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSURLConnection.h b/Headers/Foundation/NSURLConnection.h index a2a9a549d..0b0651854 100644 --- a/Headers/Foundation/NSURLConnection.h +++ b/Headers/Foundation/NSURLConnection.h @@ -26,7 +26,7 @@ #define __NSURLConnection_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSURLCredential.h b/Headers/Foundation/NSURLCredential.h index 8235e8eed..2fbfd1e6d 100644 --- a/Headers/Foundation/NSURLCredential.h +++ b/Headers/Foundation/NSURLCredential.h @@ -26,7 +26,7 @@ #define __NSURLCredential_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSURLCredentialStorage.h b/Headers/Foundation/NSURLCredentialStorage.h index 0d839fecc..49d9114a4 100644 --- a/Headers/Foundation/NSURLCredentialStorage.h +++ b/Headers/Foundation/NSURLCredentialStorage.h @@ -26,7 +26,7 @@ #define __NSURLCredentialStorage_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSURLDownload.h b/Headers/Foundation/NSURLDownload.h index fd62d136b..32e1971bf 100644 --- a/Headers/Foundation/NSURLDownload.h +++ b/Headers/Foundation/NSURLDownload.h @@ -26,7 +26,7 @@ #define __NSURLDownload_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSURLError.h b/Headers/Foundation/NSURLError.h index 37d16c43f..e949a13e4 100644 --- a/Headers/Foundation/NSURLError.h +++ b/Headers/Foundation/NSURLError.h @@ -26,7 +26,7 @@ #define __NSURLError_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSURLProtectionSpace.h b/Headers/Foundation/NSURLProtectionSpace.h index 3625b6583..d69a6b2d1 100644 --- a/Headers/Foundation/NSURLProtectionSpace.h +++ b/Headers/Foundation/NSURLProtectionSpace.h @@ -26,7 +26,7 @@ #define __NSURLProtectionSpace_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSURLProtocol.h b/Headers/Foundation/NSURLProtocol.h index ca1f5ea22..b0a165e53 100644 --- a/Headers/Foundation/NSURLProtocol.h +++ b/Headers/Foundation/NSURLProtocol.h @@ -26,7 +26,7 @@ #define __NSURLProtocol_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSURLRequest.h b/Headers/Foundation/NSURLRequest.h index 6226d6638..52a5907d2 100644 --- a/Headers/Foundation/NSURLRequest.h +++ b/Headers/Foundation/NSURLRequest.h @@ -26,7 +26,7 @@ #define __NSURLRequest_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSURLResponse.h b/Headers/Foundation/NSURLResponse.h index 62ba21237..991465e82 100644 --- a/Headers/Foundation/NSURLResponse.h +++ b/Headers/Foundation/NSURLResponse.h @@ -26,7 +26,7 @@ #define __NSURLResponse_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST) +#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSValueTransformer.h b/Headers/Foundation/NSValueTransformer.h index d8dec04ca..f8f6b30b2 100644 --- a/Headers/Foundation/NSValueTransformer.h +++ b/Headers/Foundation/NSValueTransformer.h @@ -27,7 +27,7 @@ #define __NSValueTransformer_h_GNUSTEP_BASE_INCLUDE #import -#if OS_API_VERSION(100300,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST) +#if OS_API_VERSION(100300,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST) #import diff --git a/Source/NSCalendarDate.m b/Source/NSCalendarDate.m index 44efe7a18..3d6ccf11a 100644 --- a/Source/NSCalendarDate.m +++ b/Source/NSCalendarDate.m @@ -289,26 +289,36 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day, NSTimeInterval GSTimeNow(void) { + NSTimeInterval t; #if !defined(__MINGW32__) - NSTimeInterval interval; struct timeval tp; gettimeofday (&tp, NULL); - interval = -NSTimeIntervalSince1970; - interval += tp.tv_sec; - interval += (double)tp.tv_usec / 1000000.0; - return interval; + t = (NSTimeInterval)tp.tv_sec - NSTimeIntervalSince1970; + t += (NSTimeInterval)tp.tv_usec / (NSTimeInterval)1000000.0; #else SYSTEMTIME sys_time; - NSTimeInterval t; /* * Get current GMT time, convert to NSTimeInterval since reference date, */ 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); - return t; #endif /* __MINGW32__ */ + +#if defined(DEBUG) +{ + static NSTimeInterval old = 0.0; + if (t < old) + { + fprintf(stderr, "WARNING: system time changed by %g seconds\n", + t - old); + } + old = t; +} +#endif + + return t; } /** diff --git a/Source/NSException.m b/Source/NSException.m index 2c582b501..75d6ce504 100644 --- a/Source/NSException.m +++ b/Source/NSException.m @@ -96,7 +96,7 @@ Class GSStackTraceClass; { NSMutableString *trace = [NSMutableString string]; NSEnumerator *e = [[self symbols] objectEnumerator]; - int i; + int i = 0; id obj; while ((obj = [e nextObject])) diff --git a/Source/NSObject.m b/Source/NSObject.m index b268f57a5..dd0a9c824 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -117,9 +117,9 @@ static Class NSConstantStringClass; @interface GSContentAccessingProxy : NSProxy { - NSObject *object; + NSObject *object; } -- (id)initWithObject: (id)anObject; +- (id) initWithObject: (id)anObject; @end /* @@ -1991,14 +1991,14 @@ GSGarbageCollectorLog(char *msg, GC_word arg) return self; } -/** - * Returns the version number of the receiving class. This will default to - * a number assigned by the Objective C compiler if [NSObject -setVersion] has - * not been called. - */ -+ (NSInteger) version ++ (BOOL) resolveClassMethod: (SEL)name { - return class_get_version(self); + return NO; +} + ++ (BOOL) resolveInstanceMethod: (SEL)name; +{ + return NO; } /** @@ -2014,21 +2014,24 @@ GSGarbageCollectorLog(char *msg, GC_word arg) return self; } -+ (BOOL)resolveClassMethod:(SEL)name +/** + * Returns the version number of the receiving class. This will default to + * a number assigned by the Objective C compiler if [NSObject -setVersion] has + * not been called. + */ ++ (NSInteger) version { - return NO; + return class_get_version(self); } -+ (BOOL)resolveInstanceMethod:(SEL)name; + +- (id) autoContentAccessingProxy { - return NO; + return AUTORELEASE([[GSContentAccessingProxy alloc] initWithObject: self]); } -- (id)forwardingTargetForSelector:(SEL)aSelector; + +- (id) forwardingTargetForSelector:(SEL)aSelector; { - return nil; -} -- (id)autoContentAccessingProxy -{ - return AUTORELEASE([[GSContentAccessingProxy alloc] initWithObject: self]); + return nil; } @end @@ -2475,31 +2478,36 @@ GSGarbageCollectorLog(char *msg, GC_word arg) @end @implementation GSContentAccessingProxy -- (id)initWithObject: (id)anObject +- (void) dealloc { - ASSIGN(object, anObject); - [object beginContentAccess]; - return self; + [object endContentAccess]; + [super dealloc]; } -- (void)finalize + +- (void) finalize { - [object endContentAccess]; + [object endContentAccess]; } -- (void)dealloc + +- (id) forwardingTargetForSelector: (SEL)aSelector { - [object endContentAccess]; -} -- (id)forwardingTargetForSelector: (SEL)aSelector -{ - return object; + return object; } /* Support for legacy runtimes... */ - (void) forwardInvocation: (NSInvocation*)anInvocation { - [anInvocation invokeWithTarget: object]; + [anInvocation invokeWithTarget: object]; } + +- (id) initWithObject: (id)anObject +{ + ASSIGN(object, anObject); + [object beginContentAccess]; + return self; +} + - (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector { - return [object methodSignatureForSelector: aSelector]; + return [object methodSignatureForSelector: aSelector]; } @end