* Full author contact details are available in file CREDITS.
*/
-#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
#import <AvailabilityMacros.h>
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]) {
checkSpellingOfString:word_
startingAt:start
language:lang_
- wrap:NO
+ wrap:(BOOL)NO
inSpellDocumentWithTag:speller->doctag
wordCount:NULL];
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]];
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;
}
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
}