From 63f2515e52147f109b6bec4610c65d863f9c9588 Mon Sep 17 00:00:00 2001 From: nox Date: Sat, 12 Sep 2009 05:21:42 +0200 Subject: [PATCH] Use NSInteger and NSUInteger. --- KeywordMapping.m | 5 +++-- KeywurlPlugin.h | 5 +++++ KeywurlPreferences.m | 12 ++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/KeywordMapping.m b/KeywordMapping.m index 4707fff..e6188da 100644 --- a/KeywordMapping.m +++ b/KeywordMapping.m @@ -1,3 +1,4 @@ +#import "KeywurlPlugin.h" #import "KeywordMapping.h" @implementation QueryToken @@ -100,8 +101,8 @@ - (NSArray*) expansionAsTokens { int searchStart = 0; while (start < [expansion length]) { NSRange searchRange = NSMakeRange(searchStart, [expansion length] - searchStart); - int curlStart = [expansion rangeOfString: @"{" options: 0 range: searchRange].location; - int curlEnd = curlStart == NSNotFound ? NSNotFound : [expansion rangeOfString: @"}" options: 0 + NSInteger curlStart = [expansion rangeOfString: @"{" options: 0 range: searchRange].location; + NSInteger curlEnd = curlStart == NSNotFound ? NSNotFound : [expansion rangeOfString: @"}" options: 0 range: NSMakeRange(curlStart, [expansion length] - curlStart)].location; if (curlEnd != NSNotFound) { NSString* symbol = [expansion substringWithRange: NSMakeRange(curlStart + 1, curlEnd - curlStart - 1)]; diff --git a/KeywurlPlugin.h b/KeywurlPlugin.h index 867ab07..db73b21 100644 --- a/KeywurlPlugin.h +++ b/KeywurlPlugin.h @@ -1,6 +1,11 @@ #import #import "KeywordMapper.h" +#ifndef NSINTEGER_DEFINED +typedef int NSInteger; +typedef unsigned int NSUInteger; +#endif + @interface KeywurlPlugin : NSObject { IBOutlet NSWindow* introWindow; KeywordMapper* fKeywordMapper; diff --git a/KeywurlPreferences.m b/KeywurlPreferences.m index 4b2f3d5..19abc32 100644 --- a/KeywurlPreferences.m +++ b/KeywurlPreferences.m @@ -226,7 +226,7 @@ - (NSString*) tokenField: (NSTokenField*) tokenField - (NSArray*) tokenField: (NSTokenField*) tokenField shouldAddObjects: (NSArray*) tokens - atIndex: (unsigned) index { + atIndex: (NSUInteger) index { NSMutableArray* result = [NSMutableArray new]; for (unsigned i = 0; i < [tokens count]; i++) { id item = [tokens objectAtIndex: i]; @@ -282,7 +282,7 @@ - (void) reloadKeywords { [keywords addObject: [mapping keyword]]; } [keywords sortUsingSelector: @selector(caseInsensitiveCompare:)]; - int emptyIndex = [keywords indexOfObject: @""]; + NSInteger emptyIndex = [keywords indexOfObject: @""]; if (emptyIndex != NSNotFound) { [keywords removeObjectAtIndex: emptyIndex]; [keywords addObject: @""]; @@ -300,7 +300,7 @@ - (void) reloadKeywords { - (void) selectKeyword: (NSString*) keyword edit: (BOOL) edit { if (keyword) { - int rowIndex = [keywords indexOfObject: keyword]; + NSInteger rowIndex = [keywords indexOfObject: keyword]; if (rowIndex != NSNotFound) { [tableView scrollRowToVisible: rowIndex]; [tableView selectRowIndexes: [NSIndexSet indexSetWithIndex: rowIndex] byExtendingSelection: NO]; @@ -323,13 +323,13 @@ - (void) mappingsDidChange: (NSNotification*) notification { /* Table view data source methods */ -- (int) numberOfRowsInTableView: (NSTableView*) aTableView { +- (NSInteger) numberOfRowsInTableView: (NSTableView*) aTableView { return [keywords count]; } - (id) tableView: (NSTableView*) aTableView objectValueForTableColumn: (NSTableColumn*) aTableColumn - row: (int) rowIndex { + row: (NSInteger) rowIndex { if ([[aTableColumn identifier] isEqualToString: @"Keyword"]) { NSString* keyword = [keywords objectAtIndex: rowIndex]; if (keyword) { @@ -343,7 +343,7 @@ - (id) tableView: (NSTableView*) aTableView - (void) tableView: (NSTableView*) aTableView setObjectValue: (id) newValue forTableColumn: (NSTableColumn*) aTableColumn - row: (int) rowIndex { + row: (NSInteger) rowIndex { if ([[aTableColumn identifier] isEqualToString: @"Keyword"]) { NSString* keyword = [keywords objectAtIndex: rowIndex]; if (keyword) {