]> git.lyx.org Git - lyx.git/blobdiff - src/support/AppleSpeller.m
correct use of NSNumber constructor for NSTimeInterval;remove superfluous semicolons...
[lyx.git] / src / support / AppleSpeller.m
index feba78c1a1b4b55cfee4509d20e24390b9c47153..86384cc885c09807f3f1d15eaaf3e74ee7d77b87 100644 (file)
@@ -94,11 +94,12 @@ SpellCheckResult AppleSpeller_check(AppleSpeller speller, const char * word, con
        NSString * lang_ = toString(lang);
        SpellCheckResult result = SPELL_CHECK_FAILED;
        int start = 0;
-
+       int length = [word_ length];
+       
        [speller->misspelled release];
        speller->misspelled = nil;
 
-       while (result == SPELL_CHECK_FAILED) {
+       while (result == SPELL_CHECK_FAILED && start < length) {
                NSRange match = [speller->checker
                        checkSpellingOfString:word_
                        startingAt:start
@@ -114,7 +115,7 @@ SpellCheckResult AppleSpeller_check(AppleSpeller speller, const char * word, con
                                        result = SPELL_CHECK_LEARNED;
                        }
                } else {
-                       int capacity = [speller->misspelled count] + 1;
+                       NSUInteger capacity = [speller->misspelled count] + 1;
                        NSMutableArray * misspelled = [NSMutableArray arrayWithCapacity:capacity];
                        [misspelled addObjectsFromArray:speller->misspelled];
                        [misspelled addObject:[NSValue valueWithRange:match]];
@@ -232,7 +233,7 @@ int AppleSpeller_numMisspelledWords(AppleSpeller speller)
 
 void AppleSpeller_misspelledWord(AppleSpeller speller, int index, int * start, int * length)
 {
-       NSRange range = [[speller->misspelled objectAtIndex:index] rangeValue];
+       NSRange range = [[speller->misspelled objectAtIndex:(NSUInteger)index] rangeValue];
        *start = range.location;
        *length = range.length;
 }