Skip to content

Commit

Permalink
Use NSInteger and NSUInteger.
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Sep 12, 2009
1 parent 0b5da91 commit 63f2515
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions KeywordMapping.m
@@ -1,3 +1,4 @@
#import "KeywurlPlugin.h"
#import "KeywordMapping.h"

@implementation QueryToken
Expand Down Expand Up @@ -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)];
Expand Down
5 changes: 5 additions & 0 deletions KeywurlPlugin.h
@@ -1,6 +1,11 @@
#import <Cocoa/Cocoa.h>
#import "KeywordMapper.h"

#ifndef NSINTEGER_DEFINED
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif

@interface KeywurlPlugin : NSObject {
IBOutlet NSWindow* introWindow;
KeywordMapper* fKeywordMapper;
Expand Down
12 changes: 6 additions & 6 deletions KeywurlPreferences.m
Expand Up @@ -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];
Expand Down Expand Up @@ -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: @""];
Expand All @@ -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];
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 63f2515

Please sign in to comment.