diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-02-23 12:41:16 -0500 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-02-23 12:41:16 -0500 |
commit | 0e9fdcf103b9e5fbb897ae5b83e6d25dcdc6ed7c (patch) | |
tree | 3f93a9c4567520dd9738c1581186a64cbf15f9b9 | |
parent | faf61e3369ff00128dfa087555856f8513601a56 (diff) | |
parent | 55d88cb7b554029228a2d0e6e0624a429b66ed27 (diff) |
Merge pull request #112 from thomasvl/update
Two small tweaks
-rw-r--r-- | Foundation/GTMLogger+ASL.h | 1 | ||||
-rw-r--r-- | Foundation/GTMLogger+ASL.m | 17 | ||||
-rw-r--r-- | Foundation/GTMSystemVersion.m | 2 | ||||
-rw-r--r-- | UnitTesting/GTMSenTestCase.m | 2 |
4 files changed, 19 insertions, 3 deletions
diff --git a/Foundation/GTMLogger+ASL.h b/Foundation/GTMLogger+ASL.h index 3b41e68..b9a932e 100644 --- a/Foundation/GTMLogger+ASL.h +++ b/Foundation/GTMLogger+ASL.h @@ -93,6 +93,7 @@ @interface GTMLoggerASLClient : NSObject { @private aslclient client_; + aslmsg msgOptions_; } // Designated initializer, |facility| is supplied to asl_open(). diff --git a/Foundation/GTMLogger+ASL.m b/Foundation/GTMLogger+ASL.m index 43375fe..3b35361 100644 --- a/Foundation/GTMLogger+ASL.m +++ b/Foundation/GTMLogger+ASL.m @@ -148,11 +148,26 @@ return nil; // COV_NF_END } +#if TARGET_OS_IPHONE + // On iOS we need to flag the messages as available for read so + // asl_search() can see our own output. + msgOptions_ = asl_new(ASL_TYPE_MSG); + if ((msgOptions_ == NULL) || + (asl_set(msgOptions_, + ASL_KEY_READ_UID, + [[NSString stringWithFormat:@"%d", getuid()] UTF8String]) != 0)) { + // COV_NF_START - no real way to test this + [self release]; + return nil; + // COV_NF_END + } +#endif } return self; } - (void)dealloc { + if (msgOptions_ != NULL) asl_free(msgOptions_); if (client_ != NULL) asl_close(client_); [super dealloc]; } @@ -161,7 +176,7 @@ // logs with test messages. // COV_NF_START - (void)log:(NSString *)msg level:(int)level { - asl_log(client_, NULL, level, "%s", [msg UTF8String]); + asl_log(client_, msgOptions_, level, "%s", [msg UTF8String]); } // COV_NF_END diff --git a/Foundation/GTMSystemVersion.m b/Foundation/GTMSystemVersion.m index b234c2c..f3a8559 100644 --- a/Foundation/GTMSystemVersion.m +++ b/Foundation/GTMSystemVersion.m @@ -85,7 +85,7 @@ static NSString *const kSystemVersionPlistPath = @"/System/Library/CoreServices/ // version number instead of an iOS version number. Class uideviceClass = NSClassFromString(@"UIDevice"); if (uideviceClass) { - id currentDevice = objc_msgSend(uideviceClass, @selector(currentDevice)); + id currentDevice = ((id (*)(id, SEL))objc_msgSend)(uideviceClass, @selector(currentDevice)); version = [currentDevice performSelector:@selector(systemVersion)]; } if (!version) { diff --git a/UnitTesting/GTMSenTestCase.m b/UnitTesting/GTMSenTestCase.m index e2f2ceb..ecab057 100644 --- a/UnitTesting/GTMSenTestCase.m +++ b/UnitTesting/GTMSenTestCase.m @@ -298,7 +298,7 @@ NSString *const SenTestLineNumberKey = @"SenTestLineNumberKey"; // It turns out that on iOS4 (and 3.2) exceptions thrown inside an // [invocation invoke] on the simulator cannot be caught. // http://openradar.appspot.com/8081169 - objc_msgSend(self, [invocation selector]); + ((void (*)(id, SEL))objc_msgSend)(self, [invocation selector]); #else [invocation invokeWithTarget:self]; #endif |