X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=ThreadedTask.m;h=6deef52e0d09d830ef56e3678e1576d1a3ad6506;hb=refs%2Fheads%2Fyishen;hp=19a91abcd666aef372c4d98fc1375aab48baaa8a;hpb=d27548f80fe411fda2ee69c74a24eab4292267e9;p=chaz%2Fthecheat diff --git a/ThreadedTask.m b/ThreadedTask.m index 19a91ab..6deef52 100644 --- a/ThreadedTask.m +++ b/ThreadedTask.m @@ -3,7 +3,7 @@ // ThreadedTask 0.3 // Perform a long task without blocking the main thread. // -// Copyright (c) 2004-2005, Chaz McGarvey +// Copyright (c) 2004-2005, Charles McGarvey // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, are @@ -16,10 +16,6 @@ // list of conditions and the following disclaimer in the documentation and/or other // materials provided with the distribution. // -// 3. Neither the name of the BrokenZipper nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific -// prior written permission. -// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT @@ -31,9 +27,6 @@ // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. // -// Web: http://www.brokenzipper.com/ -// Email: chaz@brokenzipper.com -// #import "ThreadedTask.h" @@ -88,7 +81,7 @@ - (id)initWithTarget:(id)target selector:(SEL)selector context:(id)context delegate:(id)delegate { - if ( self = [self _initWithContext:context delegate:delegate] ) { + if ( (self = [self _initWithContext:context delegate:delegate]) ) { // set initial values [self setTarget:target selector:selector]; } @@ -102,7 +95,7 @@ - (id)initWithFunction:(int (*)(ThreadedTask *, unsigned))function context:(id)context delegate:(id)delegate { - if ( self = [self _initWithContext:context delegate:delegate] ) { + if ( (self = [self _initWithContext:context delegate:delegate]) ) { // set initial values [self setFunction:function]; } @@ -298,8 +291,12 @@ NSAutoreleasePool *pool; unsigned iteration; +#if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED + NSInteger returnCode; +#else int returnCode; - +#endif + // create the ever-so-important pool pool = [[NSAutoreleasePool alloc] init]; @@ -317,7 +314,11 @@ // do the actual work loopPool = [[NSAutoreleasePool alloc] init]; +#if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED + returnCode = (NSInteger)objc_msgSend( _target, _selector, self, iteration ); +#else returnCode = (int)objc_msgSend( _target, _selector, self, iteration ); +#endif [loopPool release]; iteration++;