Index: src/OFConstString.m ================================================================== --- src/OFConstString.m +++ src/OFConstString.m @@ -136,13 +136,13 @@ - autorelease { return self; } -- (int32_t)retainCount +- (size_t)retainCount { - return INT32_MAX; + return SIZE_MAX; } - (void)release { } Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -257,17 +257,17 @@ - (void)release { } -- (int32_t)retainCount +- (size_t)retainCount { - return INT32_MAX; + return SIZE_MAX; } - (void)dealloc { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; [super dealloc]; /* Get rid of stupid warning */ } @end Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -264,11 +264,11 @@ - retain; /** * \return The retain count */ -- (int32_t)retainCount; +- (size_t)retainCount; /** * Decreases the retain count. * * Each time an object is released, the retain count gets decreased and the Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -28,13 +28,13 @@ #endif #ifdef OF_GNU_RUNTIME # import #endif +#ifdef OF_ATOMIC_OPS #import "atomic.h" - -#ifndef OF_ATOMIC_OPS +#else #import "threading.h" #endif struct pre_ivar { void **memchunks; @@ -510,22 +510,23 @@ #endif return self; } -- (int32_t)retainCount +- (size_t)retainCount { - return PRE_IVAR->retain_count; + assert(PRE_IVAR->retain_count >= 0); + return (size_t)PRE_IVAR->retain_count; } - (void)release { #ifdef OF_ATOMIC_OPS - if (!of_atomic_dec32(&PRE_IVAR->retain_count)) + if (of_atomic_dec32(&PRE_IVAR->retain_count) <= 0) [self dealloc]; #else - int32_t c; + size_t c; assert(of_spinlock_lock(&PRE_IVAR->retain_spinlock)); c = --PRE_IVAR->retain_count; assert(of_spinlock_unlock(&PRE_IVAR->retain_spinlock)); @@ -625,13 +626,13 @@ + autorelease { return self; } -+ (int32_t)retainCount ++ (size_t)retainCount { - return INT32_MAX; + return SIZE_MAX; } + (void)release { }