Index: src/OFEnumerator.h ================================================================== --- src/OFEnumerator.h +++ src/OFEnumerator.h @@ -62,11 +62,11 @@ */ typedef struct of_fast_enumeration_state_t { /// Arbitrary state information for the enumeration unsigned long state; /// Pointer to a C array of objects to return - id *itemsPtr; + __unsafe_unretained id *itemsPtr; /// Arbitrary state information to detect mutations unsigned long *mutationsPtr; /// Additional arbitrary state information unsigned long extra[5]; } of_fast_enumeration_state_t; Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -30,11 +30,11 @@ /// A pointer to the next list object in the list of_list_object_t *next; /// A pointer to the previous list object in the list of_list_object_t *previous; /// The object for the list object - id object; + __unsafe_unretained id object; }; /** * \brief A class which provides easy to use double-linked lists. */ Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -59,10 +59,12 @@ # define OF_RETURNS_NOT_RETAINED # define OF_RETURNS_INNER_POINTER # define OF_CONSUMED # define OF_WEAK_UNAVAILABLE # define __unsafe_unretained +# define __bridge +# define __autoreleasing #endif #define OF_RETAIN_COUNT_MAX UINT_MAX #define OF_INVALID_INDEX SIZE_MAX Index: src/OFStreamObserver.h ================================================================== --- src/OFStreamObserver.h +++ src/OFStreamObserver.h @@ -78,11 +78,11 @@ */ @interface OFStreamObserver: OFObject { OFMutableArray *readStreams; OFMutableArray *writeStreams; - OFStream **FDToStream; + __unsafe_unretained OFStream **FDToStream; size_t maxFD; OFMutableArray *queue; OFDataArray *queueInfo, *queueFDs; id delegate; int cancelFD[2]; Index: src/runtime/runtime.h ================================================================== --- src/runtime/runtime.h +++ src/runtime/runtime.h @@ -21,12 +21,14 @@ #ifndef __has_feature # define __has_feature(x) 0 #endif #if __has_feature(objc_arc) +# define OBJC_UNSAFE_UNRETAINED __unsafe_unretained # define OBJC_BRIDGE __bridge #else +# define OBJC_UNSAFE_UNRETAINED # define OBJC_BRIDGE #endif typedef struct objc_class *Class; typedef struct objc_object *id; @@ -71,11 +73,11 @@ uintptr_t uid; const char *types; }; struct objc_super { - id self; + OBJC_UNSAFE_UNRETAINED id self; Class cls; }; struct objc_method { struct objc_selector sel; @@ -152,11 +154,11 @@ #endif struct objc_protocol_list { struct objc_protocol_list *next; long count; - Protocol *list[1]; + OBJC_UNSAFE_UNRETAINED Protocol *list[1]; }; #define Nil (Class)0 #define nil (id)0 #define YES (BOOL)1 @@ -220,13 +222,14 @@ } static inline BOOL class_isMetaClass(Class cls_) { - struct objc_class *cls = (struct objc_class*)cls_; + struct objc_class *cls = (OBJC_BRIDGE struct objc_class*)cls_; return (cls->info & OBJC_CLASS_INFO_METACLASS); } +#undef OBJC_UNSAFE_UNRETAINED #undef OBJC_BRIDGE #endif Index: src/threading.h ================================================================== --- src/threading.h +++ src/threading.h @@ -69,14 +69,14 @@ static OF_INLINE BOOL of_thread_new(of_thread_t *thread, id (*main)(id), id data) { #if defined(OF_HAVE_PTHREADS) return !pthread_create(thread, NULL, (void*(*)(void*))main, - (void*)data); + (__bridge void*)data); #elif defined(_WIN32) *thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)main, - (void*)data, 0, NULL); + (__bridge void*)data, 0, NULL); return (thread != NULL); #endif }