diff --git a/objc-appscript/trunk/src/Appscript/appdata.m b/objc-appscript/trunk/src/Appscript/appdata.m index 4e1300e..13a21ad 100644 --- a/objc-appscript/trunk/src/Appscript/appdata.m +++ b/objc-appscript/trunk/src/Appscript/appdata.m @@ -57,7 +57,7 @@ - (BOOL)connectWithError:(out NSError **)error { target = [[aemApplicationClass alloc] initWithURL: targetData error: error]; break; case kASTargetPID: - target = [[aemApplicationClass alloc] initWithPID: [targetData unsignedLongValue]]; + target = [[aemApplicationClass alloc] initWithPID: (pid_t)[targetData unsignedLongValue]]; break; case kASTargetDescriptor: target = [[aemApplicationClass alloc] initWithDescriptor: targetData]; @@ -90,7 +90,7 @@ - (BOOL)isRunning { result = [AEMApplication processExistsForEppcURL: targetData]; break; case kASTargetPID: - result = [AEMApplication processExistsForPID: [targetData unsignedLongValue]]; + result = [AEMApplication processExistsForPID: (pid_t)[targetData unsignedLongValue]]; break; case kASTargetDescriptor: result = [AEMApplication processExistsForDescriptor: targetData]; diff --git a/objc-appscript/trunk/src/Appscript/application.m b/objc-appscript/trunk/src/Appscript/application.m index c9d6237..b6b5b40 100644 --- a/objc-appscript/trunk/src/Appscript/application.m +++ b/objc-appscript/trunk/src/Appscript/application.m @@ -85,8 +85,8 @@ + (pid_t)findProcessIDForApplication:(NSURL *)fileURL error:(out NSError **)erro return pid; error: if (error) { - errorDescription = [NSString stringWithFormat: @"Can't find process ID for application %@: %@ (%i)", - fileURL, ASDescriptionForError(err), err]; + errorDescription = [NSString stringWithFormat: @"Can't find process ID for application %@: %@ (%ld)", + fileURL, ASDescriptionForError(err), (long)err]; errorInfo = [NSDictionary dictionaryWithObjectsAndKeys: errorDescription, NSLocalizedDescriptionKey, [NSNumber numberWithInt: err], kASErrorNumberKey, @@ -172,8 +172,8 @@ + (pid_t)launchApplication:(NSURL *)fileURL return pid; error: if (error) { - errorDescription = [NSString stringWithFormat: @"Can't launch application %@: %@ (%i)", - fileURL, ASDescriptionForError(err), err]; + errorDescription = [NSString stringWithFormat: @"Can't launch application %@: %@ (%ld)", + fileURL, ASDescriptionForError(err), (long)err]; errorInfo = [NSDictionary dictionaryWithObjectsAndKeys: errorDescription, NSLocalizedDescriptionKey, [NSNumber numberWithInt: err], kASErrorNumberKey, diff --git a/objc-appscript/trunk/src/Appscript/base.h b/objc-appscript/trunk/src/Appscript/base.h index d254eca..d48f9f1 100644 --- a/objc-appscript/trunk/src/Appscript/base.h +++ b/objc-appscript/trunk/src/Appscript/base.h @@ -11,7 +11,7 @@ @interface AEMQuery : NSObject { NSAppleEventDescriptor *cachedDesc; - unsigned cachedHash; + NSUInteger cachedHash; } // set cached descriptor; performance optimisation, used internally by AEMCodecs diff --git a/objc-appscript/trunk/src/Appscript/codecs.m b/objc-appscript/trunk/src/Appscript/codecs.m index da2bee4..2f9048f 100644 --- a/objc-appscript/trunk/src/Appscript/codecs.m +++ b/objc-appscript/trunk/src/Appscript/codecs.m @@ -460,7 +460,7 @@ - (id)unpackUnknown:(NSAppleEventDescriptor *)desc { - (id)unpackAEList:(NSAppleEventDescriptor *)desc { NSMutableArray *result; - int i, length; + NSUInteger i, length; result = [NSMutableArray array]; length = [desc numberOfItems]; @@ -476,7 +476,7 @@ - (id)unpackAERecord:(NSAppleEventDescriptor *)desc { AEKeyword key; const AEDesc *record; AEDesc valueAEDesc; - int i, j, length, length2; + NSInteger i, j, length, length2; id value; result = [NSMutableDictionary dictionary]; diff --git a/objc-appscript/trunk/src/Appscript/command.m b/objc-appscript/trunk/src/Appscript/command.m index 9f9ac8d..27f9bc9 100644 --- a/objc-appscript/trunk/src/Appscript/command.m +++ b/objc-appscript/trunk/src/Appscript/command.m @@ -283,7 +283,7 @@ - (NSString *)description { } // format attributes if (timeout != kAEDefaultTimeout) - result = [NSString stringWithFormat: @"[%@ timeout: %i]", result, timeout / 60]; + result = [NSString stringWithFormat: @"[%@ timeout: %ld]", result, (long)(timeout / 60)]; if (sendMode != (kAEWaitReply | kAECanSwitchLayer)) { if (sendMode & ~(kAEWaitReply | kAEQueueReply | kAENoReply) == kAECanSwitchLayer) { if (sendMode & kAENoReply) @@ -291,10 +291,10 @@ - (NSString *)description { if (sendMode & kAEQueueReply) result = [NSString stringWithFormat: @"[%@ queueReply]", result]; } else - result = [NSString stringWithFormat: @"[%@ sendMode: %#08x]", result, sendMode]; + result = [NSString stringWithFormat: @"[%@ sendMode: %#08lx]", result, (long)sendMode]; } if (considsAndIgnoresFlags != kAECaseIgnoreMask) - result = [NSString stringWithFormat: @"[%@ considering: %#08x]", result, considsAndIgnoresFlags]; + result = [NSString stringWithFormat: @"[%@ considering: %#08lx]", result, (long)considsAndIgnoresFlags]; // format unpacking options [AS_event getUnpackFormat: &format type: &type]; if (format == kAEMUnpackAsItem && type != typeWildCard) diff --git a/objc-appscript/trunk/src/Appscript/event.m b/objc-appscript/trunk/src/Appscript/event.m index 04b4fd9..b3148fb 100644 --- a/objc-appscript/trunk/src/Appscript/event.m +++ b/objc-appscript/trunk/src/Appscript/event.m @@ -223,7 +223,8 @@ - (void)getUnpackFormat:(AEMUnpackFormat *)format_ type:(DescType *)type_ { */ - (id)sendWithMode:(AESendMode)sendMode timeout:(long)timeoutInTicks error:(out NSError **)error { - OSErr err, errorNumber; + OSErr err; + OSStatus errorNumber; NSString *errorString, *errorDescription; NSDictionary *errorInfo; AEDesc replyDesc = {typeNull, NULL}; @@ -253,8 +254,8 @@ - (id)sendWithMode:(AESendMode)sendMode timeout:(long)timeoutInTicks error:(out } // for any other Apple Event Manager errors, generate an NSError if one is requested, then return nil if (error) { - errorDescription = [NSString stringWithFormat: @"Apple Event Manager error: %@ (%i)", - ASDescriptionForError(errorNumber), errorNumber]; + errorDescription = [NSString stringWithFormat: @"Apple Event Manager error: %@ (%ld)", + ASDescriptionForError(errorNumber), (long)errorNumber]; errorInfo = [NSDictionary dictionaryWithObjectsAndKeys: errorDescription, NSLocalizedDescriptionKey, [NSNumber numberWithInt: errorNumber], kASErrorNumberKey, @@ -282,10 +283,10 @@ - (id)sendWithMode:(AESendMode)sendMode timeout:(long)timeoutInTicks error:(out if (error) { errorString = [[replyData paramDescriptorForKeyword: keyErrorString] stringValue]; if (errorString) - errorDescription = [NSString stringWithFormat: @"Application error: %@ (%i)", errorString, errorNumber]; + errorDescription = [NSString stringWithFormat: @"Application error: %@ (%ld)", errorString, (long)errorNumber]; else - errorDescription = [NSString stringWithFormat: @"Application error: %@ (%i)", - ASDescriptionForError(errorNumber), errorNumber]; + errorDescription = [NSString stringWithFormat: @"Application error: %@ (%ld)", + ASDescriptionForError(errorNumber), (long)errorNumber]; errorInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys: errorDescription, NSLocalizedDescriptionKey, [NSNumber numberWithInt: errorNumber], kASErrorNumberKey, @@ -323,7 +324,7 @@ - (id)sendWithMode:(AESendMode)sendMode timeout:(long)timeoutInTicks error:(out if (resultType != typeWildCard) { NSMutableArray *resultList; NSAppleEventDescriptor *item; - int i, length; + NSInteger i, length; resultList = [NSMutableArray array]; length = [result numberOfItems]; for (i = 1; i <= length; i++) { diff --git a/objc-appscript/trunk/src/Appscript/objectrenderer.m b/objc-appscript/trunk/src/Appscript/objectrenderer.m index 13de80d..cb2c071 100644 --- a/objc-appscript/trunk/src/Appscript/objectrenderer.m +++ b/objc-appscript/trunk/src/Appscript/objectrenderer.m @@ -11,7 +11,7 @@ @implementation AEMObjectRenderer +(NSString *)formatOSType:(OSType)code { NSMutableString *str; char c; - int i; + size_t i; code = CFSwapInt32HostToBig(code); str = [NSMutableString stringWithCapacity: 16]; diff --git a/objc-appscript/trunk/src/Appscript/parser.h b/objc-appscript/trunk/src/Appscript/parser.h index 2afd86c..c738103 100644 --- a/objc-appscript/trunk/src/Appscript/parser.h +++ b/objc-appscript/trunk/src/Appscript/parser.h @@ -14,7 +14,7 @@ @interface ASParserDef : NSObject { NSString *name; OSType code; - unsigned hash; + NSUInteger hash; } - (id)initWithName:(NSString*)name_ code:(OSType)code_; diff --git a/objc-appscript/trunk/src/Appscript/parser.m b/objc-appscript/trunk/src/Appscript/parser.m index 4a17a0f..3792b1e 100644 --- a/objc-appscript/trunk/src/Appscript/parser.m +++ b/objc-appscript/trunk/src/Appscript/parser.m @@ -26,7 +26,7 @@ #define CHECK_CURSOR \ if (cursor > aeteSize) \ [NSException raise: @"Bad aete" \ - format: @"Data ended prematurely (%i bytes expected, %i bytes read)", \ + format: @"Data ended prematurely (%lu bytes expected, %lu bytes read)", \ aeteSize, cursor]; @@ -435,12 +435,12 @@ - (ASAETEParser *)parse:(id)aetes { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSEnumerator *enumerator; NSString *code; - int i; + NSUInteger i; if ([aetes isKindOfClass: [NSAppleEventDescriptor class]]) { if ([aetes descriptorType] != typeAEList) aetes = [aetes coerceToDescriptorType: typeAEList]; - for (i = 1; i <= [aetes numberOfItems]; i++) + for (i = 1; (NSInteger)i <= [aetes numberOfItems]; i++) [self parseAETEDescriptor: [aetes descriptorAtIndex: i]]; } else if ([aetes isKindOfClass: [NSArray class]]) { for (i = 0; i < [aetes count]; i++) diff --git a/objc-appscript/trunk/src/Appscript/terminology.m b/objc-appscript/trunk/src/Appscript/terminology.m index 73d633d..05ae1ba 100644 --- a/objc-appscript/trunk/src/Appscript/terminology.m +++ b/objc-appscript/trunk/src/Appscript/terminology.m @@ -168,7 +168,7 @@ - (void)addTypeTableDefinitions:(NSArray *)definitions ofType:(OSType)descType { OSType code; NSAppleEventDescriptor *desc; NSDictionary *defaultTypeByName; - unsigned len, i; + NSUInteger len, i; defaultTypeByName = [defaultTerms typeByNameTable]; len = [definitions count]; @@ -220,7 +220,7 @@ - (void)addReferenceTableDefinitions:(NSArray *)definitions codeTable:(NSMutableDictionary *)codeTable { ASParserDef *parserDef; NSString *name, *convertedName; - unsigned len, i; + NSUInteger len, i; len = [definitions count]; for (i = 0; i < len; i++) { @@ -258,7 +258,7 @@ - (void)addCommandTableDefinitions:(NSArray *)commands { NSString *name, *convertedName, *parameterName; NSDictionary *defaultCommandByName; OSType eventClass, eventID; - unsigned len, i; + NSUInteger len, i; defaultCommandByName = [defaultTerms commandByNameTable]; // To handle synonyms, if two commands have same name but different codes, only the first diff --git a/objc-appscript/trunk/src/Appscript/utils.m b/objc-appscript/trunk/src/Appscript/utils.m index d052581..dd8edc7 100644 --- a/objc-appscript/trunk/src/Appscript/utils.m +++ b/objc-appscript/trunk/src/Appscript/utils.m @@ -13,7 +13,7 @@ if (errorString && ![errorString isEqual: @""]) return errorString; } - return [NSString stringWithFormat: @"Mac OS error %i", err]; + return [NSString stringWithFormat: @"Mac OS error %ld", (long)err]; }