# HG changeset patch # User Jens Alfke # Date 1238258371 25200 # Node ID 88d7e2455a7f7704567ed434b1e2efb45e89de25 # Parent 5a71993a1a70708b5ab733102a315888ed33e5a4# Parent 5ade3e09a827a83ec6b3a6da4250fd7d16255992 (merge) diff -r 5a71993a1a70 -r 88d7e2455a7f DateUtils.m --- a/DateUtils.m Sat Mar 28 09:36:46 2009 -0700 +++ b/DateUtils.m Sat Mar 28 09:39:31 2009 -0700 @@ -33,13 +33,17 @@ NSTimeInterval TimeIntervalSinceBoot(void) { - // From http://developer.apple.com/qa/qa2004/qa1398.html - uint64_t abstime = mach_absolute_time(); - // Have to do some pointer fun because AbsoluteToNanoseconds + // Adapted from http://developer.apple.com/qa/qa2004/qa1398.html + // Have to do some union tricks because AbsoluteToNanoseconds // works in terms of UnsignedWide, which is a structure rather // than a proper 64-bit integer. - Nanoseconds elapsedNano = AbsoluteToNanoseconds( *(AbsoluteTime *) &abstime ); - return *(uint64_t*)&elapsedNano / 1.0e9; + union { + uint64_t asUInt64; + UnsignedWide asUWide; + } t; + t.asUInt64 = mach_absolute_time(); + t.asUWide = AbsoluteToNanoseconds(t.asUWide); + return t.asUInt64 / 1.0e9; } diff -r 5a71993a1a70 -r 88d7e2455a7f FileAlias.m --- a/FileAlias.m Sat Mar 28 09:36:46 2009 -0700 +++ b/FileAlias.m Sat Mar 28 09:39:31 2009 -0700 @@ -33,7 +33,7 @@ } if( ! CheckOSErr(err,error) ) { - Warn(@"FileAlias init failed with OSStatus %i",err); + Warn(@"FileAlias init failed with OSStatus %i for %@",err,targetPath); [self release]; return nil; } @@ -74,7 +74,7 @@ self = [super init]; if( self ) { - Handle handle; + Handle handle = NULL; unsigned length; const void *bytes = [arch decodeBytesForKey:@"aliasHandle" returnedLength: &length]; if( bytes ) diff -r 5a71993a1a70 -r 88d7e2455a7f Logging.h --- a/Logging.h Sat Mar 28 09:36:46 2009 -0700 +++ b/Logging.h Sat Mar 28 09:39:31 2009 -0700 @@ -36,9 +36,9 @@ #define Warn Warn void AlwaysLog( NSString *msg, ... ) __attribute__((format(__NSString__, 1, 2))); -BOOL _WillLogTo( NSString *domain ); BOOL EnableLog( BOOL enable ); #define EnableLogTo( DOMAIN, VALUE ) _EnableLogTo(@""#DOMAIN, VALUE) +#define WillLog() _WillLogTo(nil) #define WillLogTo( DOMAIN ) _WillLogTo(@""#DOMAIN) diff -r 5a71993a1a70 -r 88d7e2455a7f Logging.m --- a/Logging.m Sat Mar 28 09:36:46 2009 -0700 +++ b/Logging.m Sat Mar 28 09:39:31 2009 -0700 @@ -99,7 +99,7 @@ { if( _gShouldLog == -1 ) InitLogging(); - return _gShouldLog && [sEnabledDomains containsObject: domain]; + return _gShouldLog && (domain==nil || [sEnabledDomains containsObject: domain]); } BOOL _EnableLogTo( NSString *domain, BOOL enable ) diff -r 5a71993a1a70 -r 88d7e2455a7f URLUtils.m --- a/URLUtils.m Sat Mar 28 09:36:46 2009 -0700 +++ b/URLUtils.m Sat Mar 28 09:39:31 2009 -0700 @@ -75,8 +75,7 @@ // HTTP status >= 300 is considered an error: int status = self.statusCode; if( status >= 300 ) { - NSString *reason = NSLocalizedStringFromTable( @"HTTP_ERROR_MESSAGE",@"UKCrashReporter",@""); - reason = [NSHTTPURLResponse localizedStringForStatusCode: status]; + NSString *reason = [NSHTTPURLResponse localizedStringForStatusCode: status]; NSDictionary *info = $dict({NSLocalizedFailureReasonErrorKey,reason}); return [NSError errorWithDomain: MyHTTPErrorDomain code: status userInfo: info]; } else