Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

objc: Fix a number of 64-bit errors. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions objc-appscript/trunk/src/Appscript/appdata.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down
8 changes: 4 additions & 4 deletions objc-appscript/trunk/src/Appscript/application.m
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion objc-appscript/trunk/src/Appscript/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@interface AEMQuery : NSObject <AEMSelfPackingProtocol> {
NSAppleEventDescriptor *cachedDesc;
unsigned cachedHash;
NSUInteger cachedHash;
}

// set cached descriptor; performance optimisation, used internally by AEMCodecs
Expand Down
4 changes: 2 additions & 2 deletions objc-appscript/trunk/src/Appscript/codecs.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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];
Expand Down
6 changes: 3 additions & 3 deletions objc-appscript/trunk/src/Appscript/command.m
Original file line number Diff line number Diff line change
Expand Up @@ -283,18 +283,18 @@ - (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)
result = [NSString stringWithFormat: @"[%@ ignoreReply]", result];
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)
Expand Down
15 changes: 8 additions & 7 deletions objc-appscript/trunk/src/Appscript/event.m
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion objc-appscript/trunk/src/Appscript/objectrenderer.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion objc-appscript/trunk/src/Appscript/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@interface ASParserDef : NSObject {
NSString *name;
OSType code;
unsigned hash;
NSUInteger hash;
}

- (id)initWithName:(NSString*)name_ code:(OSType)code_;
Expand Down
6 changes: 3 additions & 3 deletions objc-appscript/trunk/src/Appscript/parser.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];


Expand Down Expand Up @@ -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++)
Expand Down
6 changes: 3 additions & 3 deletions objc-appscript/trunk/src/Appscript/terminology.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion objc-appscript/trunk/src/Appscript/utils.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}


Expand Down