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 10 matching lines...) Expand all Loading... |
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "platform/wtf/text/Collator.h" | 29 #include "platform/wtf/text/Collator.h" |
30 | 30 |
| 31 #include <stdlib.h> |
| 32 #include <string.h> |
| 33 #include <unicode/ucol.h> |
| 34 #include <memory> |
31 #include "platform/wtf/Assertions.h" | 35 #include "platform/wtf/Assertions.h" |
32 #include "platform/wtf/PtrUtil.h" | 36 #include "platform/wtf/PtrUtil.h" |
33 #include "platform/wtf/StdLibExtras.h" | 37 #include "platform/wtf/StdLibExtras.h" |
34 #include "platform/wtf/StringExtras.h" | 38 #include "platform/wtf/StringExtras.h" |
35 #include "platform/wtf/Threading.h" | 39 #include "platform/wtf/Threading.h" |
36 #include "platform/wtf/ThreadingPrimitives.h" | 40 #include "platform/wtf/ThreadingPrimitives.h" |
37 #include <memory> | |
38 #include <stdlib.h> | |
39 #include <string.h> | |
40 #include <unicode/ucol.h> | |
41 | 41 |
42 namespace WTF { | 42 namespace WTF { |
43 | 43 |
44 static UCollator* g_cached_collator; | 44 static UCollator* g_cached_collator; |
45 static char g_cached_equivalent_locale[Collator::kUlocFullnameCapacity]; | 45 static char g_cached_equivalent_locale[Collator::kUlocFullnameCapacity]; |
46 static Mutex& CachedCollatorMutex() { | 46 static Mutex& CachedCollatorMutex() { |
47 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, ()); | 47 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, ()); |
48 return mutex; | 48 return mutex; |
49 } | 49 } |
50 | 50 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 char* equivalent_locale) { | 134 char* equivalent_locale) { |
135 UErrorCode status = U_ZERO_ERROR; | 135 UErrorCode status = U_ZERO_ERROR; |
136 UBool is_available; | 136 UBool is_available; |
137 ucol_getFunctionalEquivalent(equivalent_locale, kUlocFullnameCapacity, | 137 ucol_getFunctionalEquivalent(equivalent_locale, kUlocFullnameCapacity, |
138 "collation", locale, &is_available, &status); | 138 "collation", locale, &is_available, &status); |
139 if (U_FAILURE(status)) | 139 if (U_FAILURE(status)) |
140 strcpy(equivalent_locale, "root"); | 140 strcpy(equivalent_locale, "root"); |
141 } | 141 } |
142 | 142 |
143 } // namespace WTF | 143 } // namespace WTF |
OLD | NEW |