mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
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
This commit is contained in:
parent
88fd37ca57
commit
1a11998ecf
27 changed files with 156 additions and 92 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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]))
|
||||
|
|
|
@ -117,9 +117,9 @@ static Class NSConstantStringClass;
|
|||
|
||||
@interface GSContentAccessingProxy : NSProxy
|
||||
{
|
||||
NSObject<NSDiscardableContent> *object;
|
||||
NSObject<NSDiscardableContent> *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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue