Skip to content
Browse files

Some changes for clang/ARC.

  • Loading branch information...
1 parent 7ae16c2 commit 01843107ceada4c70409bed3e22230eb13dcd007 Rob Rix committed with Jun 21, 2011
Showing with 10 additions and 9 deletions.
  1. +2 −1 RXAssertions.h
  2. +8 −8 RXAssertions.m
View
3 RXAssertions.h
@@ -41,7 +41,8 @@
#define RXAssertNotNil(_thing, ...) if((_thing) == nil) STFail(RXOptionalMessageString(, ## __VA_ARGS__, @"%s was unexpectedly nil.", #_thing))
-#ifdef __clang__
+//#ifdef __clang__
+#if 0
// this is bad, as strict aliasing will break it, but clang doesn’t handle union casts correctly
#define RXCast(x, toType) *(toType *)&(x)
#else
View
16 RXAssertions.m
@@ -105,10 +105,10 @@ BOOL RXAssertionHelperNSRangeComparison(const void *a, const void *b) {
return [NSString stringWithFormat: @"%@", *RXCast(ref, const id *)];
}
-NSString *RXAssertionHelperCFTypeRefDescription(const void *ref) {
- CFTypeRef _ref = *RXCast(ref, CFTypeRef *);
- return _ref ? [(id)CFCopyDescription(_ref) autorelease] : @"(null)";
-}
+//NSString *RXAssertionHelperCFTypeRefDescription(const void *ref) {
+// CFTypeRef _ref = *RXCast(ref, CFTypeRef *);
+// return _ref ? [(__bridge id)_ref description] : @"(null)";
+//}
NSString *RXAssertionHelperNSPointDescription(const void *ref) {
return NSStringFromPoint(*RXCast(ref, const NSPoint *));
@@ -169,9 +169,9 @@ +(void)initialize {
[self registerDescriptionFunction: RXAssertionHelperDoubleDescription forObjCType: @encode(double)];
[self registerDescriptionFunction: RXAssertionHelperObjectDescription forObjCType: @encode(id)];
[self registerDescriptionFunction: RXAssertionHelperObjectDescription forObjCType: @encode(Class)];
- [self registerDescriptionFunction: RXAssertionHelperCFTypeRefDescription forObjCType: @encode(__typeof__(string))]; // __typeof__ keeps qualifiers, e.g. const
- [self registerDescriptionFunction: RXAssertionHelperCFTypeRefDescription forObjCType: @encode(__typeof__(array))]; // __typeof__ keeps qualifiers, e.g. const
- [self registerDescriptionFunction: RXAssertionHelperCFTypeRefDescription forObjCType: @encode(__typeof__(characterSet))]; // __typeof__ keeps qualifiers, e.g. const
+// [self registerDescriptionFunction: RXAssertionHelperCFTypeRefDescription forObjCType: @encode(__typeof__(string))]; // __typeof__ keeps qualifiers, e.g. const
+// [self registerDescriptionFunction: RXAssertionHelperCFTypeRefDescription forObjCType: @encode(__typeof__(array))]; // __typeof__ keeps qualifiers, e.g. const
+// [self registerDescriptionFunction: RXAssertionHelperCFTypeRefDescription forObjCType: @encode(__typeof__(characterSet))]; // __typeof__ keeps qualifiers, e.g. const
[self registerDescriptionFunction: RXAssertionHelperNSPointDescription forObjCType: @encode(NSPoint)];
[self registerDescriptionFunction: RXAssertionHelperNSPointDescription forObjCType: @encode(CGPoint)];
[self registerDescriptionFunction: RXAssertionHelperNSRangeDescription forObjCType: @encode(NSRange)];
@@ -232,7 +232,7 @@ +(NSString *)humanReadableNameForTestCaseSelector:(SEL)selector {
[scanner scanString: @"test" intoString: nil]; // skip "test"
while(!scanner.isAtEnd) {
NSString *up = nil, *lo = nil;
- unsigned cursor = scanner.scanLocation;
+ NSUInteger cursor = scanner.scanLocation;
up = [scanner.string substringWithRange: NSMakeRange(cursor, 1)]; // grab the first character
scanner.scanLocation = cursor + 1;
[scanner scanCharactersFromSet: [NSCharacterSet lowercaseLetterCharacterSet] intoString: &lo];

0 comments on commit 0184310

Please sign in to comment.
Something went wrong with that request. Please try again.