X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FAppleSpeller.m;h=3e9a2f84529f286ab2174669fdd92e63567948e5;hb=351363c599db664d612fbe1b426403f91758de05;hp=86384cc885c09807f3f1d15eaaf3e74ee7d77b87;hpb=e7da6a6bc98271aad82a5db17e2af30c95b4c2ac;p=lyx.git diff --git a/src/support/AppleSpeller.m b/src/support/AppleSpeller.m index 86384cc885..3e9a2f8452 100644 --- a/src/support/AppleSpeller.m +++ b/src/support/AppleSpeller.m @@ -8,7 +8,6 @@ * Full author contact details are available in file CREDITS. */ -#import #import #import @@ -69,7 +68,7 @@ static NSString * toLanguage(AppleSpeller speller, const char * lang) NSArray * languages = [speller->checker availableLanguages]; for (NSString *element in languages) { - if ([element isEqualToString:lang_]) { + if (0 == [element caseInsensitiveCompare:lang_]) { result = element; break; } else if ([lang_ hasPrefix:element]) { @@ -104,7 +103,7 @@ SpellCheckResult AppleSpeller_check(AppleSpeller speller, const char * word, con checkSpellingOfString:word_ startingAt:start language:lang_ - wrap:NO + wrap:(BOOL)NO inSpellDocumentWithTag:speller->doctag wordCount:NULL]; @@ -115,7 +114,11 @@ SpellCheckResult AppleSpeller_check(AppleSpeller speller, const char * word, con result = SPELL_CHECK_LEARNED; } } else { +#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) NSUInteger capacity = [speller->misspelled count] + 1; +#else + int capacity = [speller->misspelled count] + 1; +#endif NSMutableArray * misspelled = [NSMutableArray arrayWithCapacity:capacity]; [misspelled addObjectsFromArray:speller->misspelled]; [misspelled addObject:[NSValue valueWithRange:match]]; @@ -233,7 +236,11 @@ int AppleSpeller_numMisspelledWords(AppleSpeller speller) void AppleSpeller_misspelledWord(AppleSpeller speller, int index, int * start, int * length) { +#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) NSRange range = [[speller->misspelled objectAtIndex:(NSUInteger)index] rangeValue]; +#else + NSRange range = [[speller->misspelled objectAtIndex:index] rangeValue]; +#endif *start = range.location; *length = range.length; } @@ -241,5 +248,9 @@ void AppleSpeller_misspelledWord(AppleSpeller speller, int index, int * start, i int AppleSpeller_hasLanguage(AppleSpeller speller, const char * lang) { +#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1050) return toLanguage(speller, lang) != nil; +#else + return true; +#endif }