| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 : m_collator(0) | 55 : m_collator(0) |
| 56 , m_locale(locale ? strdup(locale) : 0) | 56 , m_locale(locale ? strdup(locale) : 0) |
| 57 , m_lowerFirst(false) | 57 , m_lowerFirst(false) |
| 58 { | 58 { |
| 59 } | 59 } |
| 60 | 60 |
| 61 PassOwnPtr<Collator> Collator::userDefault() | 61 PassOwnPtr<Collator> Collator::userDefault() |
| 62 { | 62 { |
| 63 #if OS(DARWIN) && USE(CF) | 63 #if OS(DARWIN) && USE(CF) |
| 64 // Mac OS X doesn't set UNIX locale to match user-selected one, so ICU defau
lt doesn't work. | 64 // Mac OS X doesn't set UNIX locale to match user-selected one, so ICU defau
lt doesn't work. |
| 65 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 | |
| 66 RetainPtr<CFLocaleRef> currentLocale(AdoptCF, CFLocaleCopyCurrent()); | 65 RetainPtr<CFLocaleRef> currentLocale(AdoptCF, CFLocaleCopyCurrent()); |
| 67 CFStringRef collationOrder = (CFStringRef)CFLocaleGetValue(currentLocale.get
(), kCFLocaleCollatorIdentifier); | 66 CFStringRef collationOrder = (CFStringRef)CFLocaleGetValue(currentLocale.get
(), kCFLocaleCollatorIdentifier); |
| 68 #else | |
| 69 RetainPtr<CFStringRef> collationOrderRetainer(AdoptCF, (CFStringRef)CFPrefer
encesCopyValue(CFSTR("AppleCollationOrder"), kCFPreferencesAnyApplication, kCFPr
eferencesCurrentUser, kCFPreferencesAnyHost)); | |
| 70 CFStringRef collationOrder = collationOrderRetainer.get(); | |
| 71 #endif | |
| 72 char buf[256]; | 67 char buf[256]; |
| 73 if (!collationOrder) | 68 if (!collationOrder) |
| 74 return adoptPtr(new Collator("")); | 69 return adoptPtr(new Collator("")); |
| 75 CFStringGetCString(collationOrder, buf, sizeof(buf), kCFStringEncodingASCII)
; | 70 CFStringGetCString(collationOrder, buf, sizeof(buf), kCFStringEncodingASCII)
; |
| 76 return adoptPtr(new Collator(buf)); | 71 return adoptPtr(new Collator(buf)); |
| 77 #else | 72 #else |
| 78 return adoptPtr(new Collator(0)); | 73 return adoptPtr(new Collator(0)); |
| 79 #endif | 74 #endif |
| 80 } | 75 } |
| 81 | 76 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if (cachedCollator) | 139 if (cachedCollator) |
| 145 ucol_close(cachedCollator); | 140 ucol_close(cachedCollator); |
| 146 cachedCollator = m_collator; | 141 cachedCollator = m_collator; |
| 147 m_collator = 0; | 142 m_collator = 0; |
| 148 } | 143 } |
| 149 } | 144 } |
| 150 | 145 |
| 151 } // namespace WTF | 146 } // namespace WTF |
| 152 | 147 |
| 153 #endif // !UCONFIG_NO_COLLATION | 148 #endif // !UCONFIG_NO_COLLATION |
| OLD | NEW |