author | naoto |
Tue, 12 Nov 2019 14:05:18 -0800 | |
changeset 59043 | 1a79b4bfc85a |
parent 54097 | 9fc262a75638 |
permissions | -rw-r--r-- |
13583 | 1 |
/* |
54097
9fc262a75638
8220227: Host Locale Provider getDisplayCountry returns error message under non-English Win10
tnakamura
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
13583 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
#include "sun_util_locale_provider_HostLocaleProviderAdapterImpl.h" |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
27 |
#include "jni_util.h" |
13583 | 28 |
#include <windows.h> |
29 |
#include <gdefs.h> |
|
30 |
#include <stdlib.h> |
|
31 |
||
32 |
#define BUFLEN 256 |
|
33 |
||
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
34 |
// java.util.Calendar constants |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
35 |
#define CALENDAR_FIELD_ERA 0 // Calendar.ERA |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
36 |
#define CALENDAR_FIELD_MONTH 2 // Calendar.MONTH |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
37 |
#define CALENDAR_STYLE_SHORT_MASK 0x00000001 // Calendar.SHORT |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
38 |
#define CALENDAR_STYLE_STANDALONE_MASK 0x00008000 // Calendar.STANDALONE |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
39 |
|
13583 | 40 |
// global variables |
41 |
typedef int (WINAPI *PGLIE)(const jchar *, LCTYPE, LPWSTR, int); |
|
42 |
typedef int (WINAPI *PGCIE)(const jchar *, CALID, LPCWSTR, CALTYPE, LPWSTR, int, LPDWORD); |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
43 |
typedef int (WINAPI *PECIEE)(CALINFO_ENUMPROCEXEX, const jchar *, CALID, LPCWSTR, CALTYPE, LPARAM); |
13583 | 44 |
PGLIE pGetLocaleInfoEx; |
45 |
PGCIE pGetCalendarInfoEx; |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
46 |
PECIEE pEnumCalendarInfoExEx; |
13583 | 47 |
BOOL initialized = FALSE; |
48 |
||
49 |
// prototypes |
|
50 |
int getLocaleInfoWrapper(const jchar *langtag, LCTYPE type, LPWSTR data, int buflen); |
|
51 |
int getCalendarInfoWrapper(const jchar *langtag, CALID id, LPCWSTR reserved, CALTYPE type, LPWSTR data, int buflen, LPDWORD val); |
|
52 |
jint getCalendarID(const jchar *langtag); |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
53 |
void replaceCalendarArrayElems(JNIEnv *env, jstring jlangtag, jint calid, jobjectArray jarray, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
54 |
CALTYPE* pCalTypes, int offset, int length, int style); |
13583 | 55 |
WCHAR * getNumberPattern(const jchar * langtag, const jint numberStyle); |
56 |
void getNumberPart(const jchar * langtag, const jint numberStyle, WCHAR * number); |
|
57 |
void getFixPart(const jchar * langtag, const jint numberStyle, BOOL positive, BOOL prefix, WCHAR * ret); |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
58 |
int enumCalendarInfoWrapper(const jchar * langtag, CALID calid, CALTYPE type, LPWSTR buf, int buflen); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
59 |
BOOL CALLBACK EnumCalendarInfoProc(LPWSTR lpCalInfoStr, CALID calid, LPWSTR lpReserved, LPARAM lParam); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
60 |
jobjectArray getErasImpl(JNIEnv *env, jstring jlangtag, jint calid, jint style, jobjectArray eras); |
13583 | 61 |
|
62 |
// from java_props_md.c |
|
63 |
extern __declspec(dllexport) const char * getJavaIDFromLangID(LANGID langID); |
|
64 |
||
65 |
CALTYPE monthsType[] = { |
|
66 |
CAL_SMONTHNAME1, |
|
67 |
CAL_SMONTHNAME2, |
|
68 |
CAL_SMONTHNAME3, |
|
69 |
CAL_SMONTHNAME4, |
|
70 |
CAL_SMONTHNAME5, |
|
71 |
CAL_SMONTHNAME6, |
|
72 |
CAL_SMONTHNAME7, |
|
73 |
CAL_SMONTHNAME8, |
|
74 |
CAL_SMONTHNAME9, |
|
75 |
CAL_SMONTHNAME10, |
|
76 |
CAL_SMONTHNAME11, |
|
77 |
CAL_SMONTHNAME12, |
|
78 |
CAL_SMONTHNAME13, |
|
79 |
}; |
|
80 |
||
81 |
CALTYPE sMonthsType[] = { |
|
82 |
CAL_SABBREVMONTHNAME1, |
|
83 |
CAL_SABBREVMONTHNAME2, |
|
84 |
CAL_SABBREVMONTHNAME3, |
|
85 |
CAL_SABBREVMONTHNAME4, |
|
86 |
CAL_SABBREVMONTHNAME5, |
|
87 |
CAL_SABBREVMONTHNAME6, |
|
88 |
CAL_SABBREVMONTHNAME7, |
|
89 |
CAL_SABBREVMONTHNAME8, |
|
90 |
CAL_SABBREVMONTHNAME9, |
|
91 |
CAL_SABBREVMONTHNAME10, |
|
92 |
CAL_SABBREVMONTHNAME11, |
|
93 |
CAL_SABBREVMONTHNAME12, |
|
94 |
CAL_SABBREVMONTHNAME13, |
|
95 |
}; |
|
96 |
||
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
97 |
#define MONTHTYPES (sizeof(monthsType) / sizeof(CALTYPE)) |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
98 |
|
13583 | 99 |
CALTYPE wDaysType[] = { |
100 |
CAL_SDAYNAME7, |
|
101 |
CAL_SDAYNAME1, |
|
102 |
CAL_SDAYNAME2, |
|
103 |
CAL_SDAYNAME3, |
|
104 |
CAL_SDAYNAME4, |
|
105 |
CAL_SDAYNAME5, |
|
106 |
CAL_SDAYNAME6, |
|
107 |
}; |
|
108 |
||
109 |
CALTYPE sWDaysType[] = { |
|
110 |
CAL_SABBREVDAYNAME7, |
|
111 |
CAL_SABBREVDAYNAME1, |
|
112 |
CAL_SABBREVDAYNAME2, |
|
113 |
CAL_SABBREVDAYNAME3, |
|
114 |
CAL_SABBREVDAYNAME4, |
|
115 |
CAL_SABBREVDAYNAME5, |
|
116 |
CAL_SABBREVDAYNAME6, |
|
117 |
}; |
|
118 |
||
119 |
WCHAR * fixes[2][2][3][16] = |
|
120 |
{ |
|
121 |
{ //prefix |
|
122 |
{ //positive |
|
123 |
{ // number |
|
124 |
L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", |
|
125 |
}, |
|
126 |
{ // currency |
|
127 |
L"\xA4", L"", L"\xA4 ", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", |
|
128 |
}, |
|
129 |
{ // percent |
|
130 |
L"", L"", L"%", L"% ", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", |
|
131 |
} |
|
132 |
}, |
|
133 |
{ // negative |
|
134 |
{ // number |
|
135 |
L"(", L"-", L"- ", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", |
|
136 |
}, |
|
137 |
{ //currency |
|
138 |
L"(\xA4", L"-\xA4", L"\xA4-", L"\xA4", L"(", L"-", L"", L"", L"-", L"-\xA4 ", L"", L"\xA4 ", L"\xA4 -", L"", L"(\xA4 ", L"(" |
|
139 |
}, |
|
140 |
{ // percent |
|
141 |
L"-", L"-", L"-%", L"%-", L"%", L"", L"", L"-% ", L"", L"% ", L"% -", L"", L"", L"", L"", L"", |
|
142 |
} |
|
143 |
} |
|
144 |
}, |
|
145 |
{ // suffix |
|
146 |
{ //positive |
|
147 |
{ // number |
|
148 |
L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"" |
|
149 |
}, |
|
150 |
{ // currency |
|
151 |
L"", L"\xA4 ", L"", L" \xA4", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", |
|
152 |
}, |
|
153 |
{ // percent |
|
154 |
L" %", L"%", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", |
|
155 |
} |
|
156 |
}, |
|
157 |
{ // negative |
|
158 |
{ // number |
|
159 |
L")", L"", L" ", L"-", L" -", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", L"", |
|
160 |
}, |
|
161 |
{ //currency |
|
162 |
L")", L"", L"", L"-", L"\xA4)", L"\xA4", L"-\xA4", L"\xA4-", L" \xA4", L"", L" \xA4-", L"-", L"", L"- \xA4", L")", L" \xA4)" |
|
163 |
}, |
|
164 |
{ // percent |
|
165 |
L" %", L"%", L"", L"", L"-", L"-%", L"%-", L"", L" %-", L"-", L"", L"- %", L"", L"", L"", L"", |
|
166 |
} |
|
167 |
} |
|
168 |
} |
|
169 |
}; |
|
170 |
||
171 |
/* |
|
172 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
173 |
* Method: initialize |
|
174 |
* Signature: ()Z |
|
175 |
*/ |
|
176 |
JNIEXPORT jboolean JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_initialize |
|
177 |
(JNIEnv *env, jclass cls) { |
|
178 |
if (!initialized) { |
|
179 |
pGetLocaleInfoEx = (PGLIE)GetProcAddress( |
|
180 |
GetModuleHandle("kernel32.dll"), |
|
181 |
"GetLocaleInfoEx"); |
|
182 |
pGetCalendarInfoEx = (PGCIE)GetProcAddress( |
|
183 |
GetModuleHandle("kernel32.dll"), |
|
184 |
"GetCalendarInfoEx"); |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
185 |
pEnumCalendarInfoExEx = (PECIEE)GetProcAddress( |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
186 |
GetModuleHandle("kernel32.dll"), |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
187 |
"EnumCalendarInfoExEx"); |
13583 | 188 |
initialized =TRUE; |
189 |
} |
|
190 |
||
191 |
return pGetLocaleInfoEx != NULL && |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
192 |
pGetCalendarInfoEx != NULL && |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
193 |
pEnumCalendarInfoExEx != NULL; |
13583 | 194 |
} |
195 |
||
196 |
/* |
|
197 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
198 |
* Method: getDefaultLocale |
|
199 |
* Signature: (I)Ljava/lang/String; |
|
200 |
*/ |
|
201 |
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDefaultLocale |
|
202 |
(JNIEnv *env, jclass cls, jint cat) { |
|
203 |
char * localeString = NULL; |
|
204 |
LANGID langid; |
|
205 |
jstring ret; |
|
206 |
||
207 |
switch (cat) { |
|
208 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CAT_DISPLAY: |
|
209 |
langid = LANGIDFROMLCID(GetUserDefaultUILanguage()); |
|
210 |
break; |
|
211 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CAT_FORMAT: |
|
212 |
default: |
|
213 |
langid = LANGIDFROMLCID(GetUserDefaultLCID()); |
|
214 |
break; |
|
215 |
} |
|
216 |
||
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
217 |
localeString = (char *)getJavaIDFromLangID(langid); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
218 |
if (localeString != NULL) { |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
219 |
ret = (*env)->NewStringUTF(env, localeString); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
220 |
free(localeString); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
221 |
} else { |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
222 |
JNU_ThrowOutOfMemoryError(env, "memory allocation error"); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
223 |
ret = NULL; |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
224 |
} |
13583 | 225 |
return ret; |
226 |
} |
|
227 |
||
228 |
/* |
|
229 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
230 |
* Method: getDateTimePattern |
|
231 |
* Signature: (IILjava/lang/String;)Ljava/lang/String; |
|
232 |
*/ |
|
233 |
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDateTimePattern |
|
234 |
(JNIEnv *env, jclass cls, jint dateStyle, jint timeStyle, jstring jlangtag) { |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
13583
diff
changeset
|
235 |
WCHAR pattern[BUFLEN]; |
13583 | 236 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
237 |
CHECK_NULL_RETURN(langtag, NULL); |
13583 | 238 |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
13583
diff
changeset
|
239 |
pattern[0] = L'\0'; |
13583 | 240 |
|
241 |
if (dateStyle == 0 || dateStyle == 1) { |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
13583
diff
changeset
|
242 |
getLocaleInfoWrapper(langtag, LOCALE_SLONGDATE, pattern, BUFLEN); |
13583 | 243 |
} else if (dateStyle == 2 || dateStyle == 3) { |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
13583
diff
changeset
|
244 |
getLocaleInfoWrapper(langtag, LOCALE_SSHORTDATE, pattern, BUFLEN); |
13583 | 245 |
} |
246 |
||
247 |
if (timeStyle == 0 || timeStyle == 1) { |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
13583
diff
changeset
|
248 |
getLocaleInfoWrapper(langtag, LOCALE_STIMEFORMAT, pattern, BUFLEN); |
13583 | 249 |
} else if (timeStyle == 2 || timeStyle == 3) { |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
13583
diff
changeset
|
250 |
getLocaleInfoWrapper(langtag, LOCALE_SSHORTTIME, pattern, BUFLEN); |
13583 | 251 |
} |
252 |
||
253 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
|
254 |
||
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
255 |
return (*env)->NewString(env, pattern, (jsize)wcslen(pattern)); |
13583 | 256 |
} |
257 |
||
258 |
/* |
|
259 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
260 |
* Method: getCalendarID |
|
261 |
* Signature: (Ljava/lang/String;)I |
|
262 |
*/ |
|
263 |
JNIEXPORT jint JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCalendarID |
|
264 |
(JNIEnv *env, jclass cls, jstring jlangtag) { |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
265 |
const jchar *langtag; |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
266 |
jint ret; |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
267 |
langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
268 |
CHECK_NULL_RETURN(langtag, 0); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
269 |
ret = getCalendarID(langtag); |
13583 | 270 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
271 |
return ret; |
|
272 |
} |
|
273 |
||
274 |
/* |
|
275 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
276 |
* Method: getAmPmStrings |
|
277 |
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String; |
|
278 |
*/ |
|
279 |
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getAmPmStrings |
|
280 |
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray ampms) { |
|
281 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
282 |
const jchar *langtag; |
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
283 |
jstring tmp_string; |
13583 | 284 |
|
285 |
// AM |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
286 |
int got; |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
287 |
langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
288 |
CHECK_NULL_RETURN(langtag, NULL); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
289 |
got = getLocaleInfoWrapper(langtag, LOCALE_S1159, buf, BUFLEN); |
13583 | 290 |
if (got) { |
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
291 |
tmp_string = (*env)->NewString(env, buf, (jsize)wcslen(buf)); |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
292 |
if (tmp_string != NULL) { |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
293 |
(*env)->SetObjectArrayElement(env, ampms, 0, tmp_string); |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
294 |
} |
13583 | 295 |
} |
296 |
||
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
297 |
if (!(*env)->ExceptionCheck(env)){ |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
298 |
// PM |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
299 |
got = getLocaleInfoWrapper(langtag, LOCALE_S2359, buf, BUFLEN); |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
300 |
if (got) { |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
301 |
tmp_string = (*env)->NewString(env, buf, (jsize)wcslen(buf)); |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
302 |
if (tmp_string != NULL) { |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
303 |
(*env)->SetObjectArrayElement(env, ampms, 1, tmp_string); |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
304 |
} |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
305 |
} |
13583 | 306 |
} |
307 |
||
308 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
|
309 |
||
310 |
return ampms; |
|
311 |
} |
|
312 |
||
313 |
/* |
|
314 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
315 |
* Method: getEras |
|
316 |
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String; |
|
317 |
*/ |
|
318 |
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getEras |
|
319 |
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray eras) { |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
320 |
return getErasImpl(env, jlangtag, -1, 0, eras); |
13583 | 321 |
} |
322 |
||
323 |
/* |
|
324 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
325 |
* Method: getMonths |
|
326 |
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String; |
|
327 |
*/ |
|
328 |
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMonths |
|
329 |
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray months) { |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
330 |
replaceCalendarArrayElems(env, jlangtag, -1, months, monthsType, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
331 |
0, MONTHTYPES, 0); |
13583 | 332 |
return months; |
333 |
} |
|
334 |
||
335 |
/* |
|
336 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
337 |
* Method: getShortMonths |
|
338 |
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String; |
|
339 |
*/ |
|
340 |
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getShortMonths |
|
341 |
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray smonths) { |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
342 |
replaceCalendarArrayElems(env, jlangtag, -1, smonths, sMonthsType, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
343 |
0, MONTHTYPES, 0); |
13583 | 344 |
return smonths; |
345 |
} |
|
346 |
||
347 |
/* |
|
348 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
349 |
* Method: getWeekdays |
|
350 |
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String; |
|
351 |
*/ |
|
352 |
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getWeekdays |
|
353 |
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray wdays) { |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
354 |
replaceCalendarArrayElems(env, jlangtag, -1, wdays, wDaysType, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
355 |
1, sizeof(wDaysType)/sizeof(CALTYPE), 0); |
13583 | 356 |
return wdays; |
357 |
} |
|
358 |
||
359 |
/* |
|
360 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
361 |
* Method: getShortWeekdays |
|
362 |
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String; |
|
363 |
*/ |
|
364 |
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getShortWeekdays |
|
365 |
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray swdays) { |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
366 |
replaceCalendarArrayElems(env, jlangtag, -1, swdays, sWDaysType, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
367 |
1, sizeof(sWDaysType)/sizeof(CALTYPE), 0); |
13583 | 368 |
return swdays; |
369 |
} |
|
370 |
||
371 |
/* |
|
372 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
373 |
* Method: getNumberPattern |
|
374 |
* Signature: (ILjava/lang/String;)Ljava/lang/String; |
|
375 |
*/ |
|
376 |
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getNumberPattern |
|
377 |
(JNIEnv *env, jclass cls, jint numberStyle, jstring jlangtag) { |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
378 |
const jchar *langtag; |
13583 | 379 |
jstring ret; |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
380 |
WCHAR * pattern; |
13583 | 381 |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
382 |
langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
383 |
CHECK_NULL_RETURN(langtag, NULL); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
384 |
pattern = getNumberPattern(langtag, numberStyle); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
385 |
CHECK_NULL_RETURN(pattern, NULL); |
13583 | 386 |
|
387 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
|
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
388 |
ret = (*env)->NewString(env, pattern, (jsize)wcslen(pattern)); |
13583 | 389 |
free(pattern); |
390 |
||
391 |
return ret; |
|
392 |
} |
|
393 |
||
394 |
/* |
|
395 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
396 |
* Method: isNativeDigit |
|
397 |
* Signature: (Ljava/lang/String;)Z |
|
398 |
*/ |
|
399 |
JNIEXPORT jboolean JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_isNativeDigit |
|
400 |
(JNIEnv *env, jclass cls, jstring jlangtag) { |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
401 |
DWORD num; |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
402 |
int got; |
13583 | 403 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
404 |
CHECK_NULL_RETURN(langtag, JNI_FALSE); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
405 |
got = getLocaleInfoWrapper(langtag, |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
406 |
LOCALE_IDIGITSUBSTITUTION | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
407 |
(LPWSTR)&num, sizeof(num)); |
13583 | 408 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
409 |
||
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
410 |
return got && num == 2; // 2: native digit substitution |
13583 | 411 |
} |
412 |
||
413 |
/* |
|
414 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
415 |
* Method: getCurrencySymbol |
|
416 |
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; |
|
417 |
*/ |
|
418 |
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCurrencySymbol |
|
419 |
(JNIEnv *env, jclass cls, jstring jlangtag, jstring currencySymbol) { |
|
420 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
421 |
int got; |
13583 | 422 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
423 |
CHECK_NULL_RETURN(langtag, currencySymbol); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
424 |
got = getLocaleInfoWrapper(langtag, LOCALE_SCURRENCY, buf, BUFLEN); |
13583 | 425 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
426 |
||
427 |
if (got) { |
|
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
428 |
return (*env)->NewString(env, buf, (jsize)wcslen(buf)); |
13583 | 429 |
} else { |
430 |
return currencySymbol; |
|
431 |
} |
|
432 |
} |
|
433 |
||
434 |
/* |
|
435 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
436 |
* Method: getDecimalSeparator |
|
437 |
* Signature: (Ljava/lang/String;C)C |
|
438 |
*/ |
|
439 |
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDecimalSeparator |
|
440 |
(JNIEnv *env, jclass cls, jstring jlangtag, jchar decimalSeparator) { |
|
441 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
442 |
int got; |
13583 | 443 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
444 |
CHECK_NULL_RETURN(langtag, decimalSeparator); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
445 |
got = getLocaleInfoWrapper(langtag, LOCALE_SDECIMAL, buf, BUFLEN); |
13583 | 446 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
447 |
||
448 |
if (got) { |
|
449 |
return buf[0]; |
|
450 |
} else { |
|
451 |
return decimalSeparator; |
|
452 |
} |
|
453 |
} |
|
454 |
||
455 |
/* |
|
456 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
457 |
* Method: getGroupingSeparator |
|
458 |
* Signature: (Ljava/lang/String;C)C |
|
459 |
*/ |
|
460 |
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getGroupingSeparator |
|
461 |
(JNIEnv *env, jclass cls, jstring jlangtag, jchar groupingSeparator) { |
|
462 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
463 |
int got; |
13583 | 464 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
465 |
CHECK_NULL_RETURN(langtag, groupingSeparator); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
466 |
got = getLocaleInfoWrapper(langtag, LOCALE_STHOUSAND, buf, BUFLEN); |
13583 | 467 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
468 |
||
469 |
if (got) { |
|
470 |
return buf[0]; |
|
471 |
} else { |
|
472 |
return groupingSeparator; |
|
473 |
} |
|
474 |
} |
|
475 |
||
476 |
/* |
|
477 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
478 |
* Method: getInfinity |
|
479 |
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; |
|
480 |
*/ |
|
481 |
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getInfinity |
|
482 |
(JNIEnv *env, jclass cls, jstring jlangtag, jstring infinity) { |
|
483 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
484 |
int got; |
13583 | 485 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
486 |
CHECK_NULL_RETURN(langtag, infinity); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
487 |
got = getLocaleInfoWrapper(langtag, LOCALE_SPOSINFINITY, buf, BUFLEN); |
13583 | 488 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
489 |
||
490 |
if (got) { |
|
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
491 |
return (*env)->NewString(env, buf, (jsize)wcslen(buf)); |
13583 | 492 |
} else { |
493 |
return infinity; |
|
494 |
} |
|
495 |
} |
|
496 |
||
497 |
/* |
|
498 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
499 |
* Method: getInternationalCurrencySymbol |
|
500 |
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; |
|
501 |
*/ |
|
502 |
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getInternationalCurrencySymbol |
|
503 |
(JNIEnv *env, jclass cls, jstring jlangtag, jstring internationalCurrencySymbol) { |
|
504 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
505 |
int got; |
13583 | 506 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
507 |
CHECK_NULL_RETURN(langtag, internationalCurrencySymbol); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
508 |
got = getLocaleInfoWrapper(langtag, LOCALE_SINTLSYMBOL, buf, BUFLEN); |
13583 | 509 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
510 |
||
511 |
if (got) { |
|
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
512 |
return (*env)->NewString(env, buf, (jsize)wcslen(buf)); |
13583 | 513 |
} else { |
514 |
return internationalCurrencySymbol; |
|
515 |
} |
|
516 |
} |
|
517 |
||
518 |
/* |
|
519 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
520 |
* Method: getMinusSign |
|
521 |
* Signature: (Ljava/lang/String;C)C |
|
522 |
*/ |
|
523 |
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMinusSign |
|
524 |
(JNIEnv *env, jclass cls, jstring jlangtag, jchar minusSign) { |
|
525 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
526 |
int got; |
13583 | 527 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
528 |
CHECK_NULL_RETURN(langtag, minusSign); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
529 |
got = getLocaleInfoWrapper(langtag, LOCALE_SNEGATIVESIGN, buf, BUFLEN); |
13583 | 530 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
531 |
||
532 |
if (got) { |
|
533 |
return buf[0]; |
|
534 |
} else { |
|
535 |
return minusSign; |
|
536 |
} |
|
537 |
} |
|
538 |
||
539 |
/* |
|
540 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
541 |
* Method: getMonetaryDecimalSeparator |
|
542 |
* Signature: (Ljava/lang/String;C)C |
|
543 |
*/ |
|
544 |
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMonetaryDecimalSeparator |
|
545 |
(JNIEnv *env, jclass cls, jstring jlangtag, jchar monetaryDecimalSeparator) { |
|
546 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
547 |
int got; |
13583 | 548 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
549 |
CHECK_NULL_RETURN(langtag, monetaryDecimalSeparator); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
550 |
got = getLocaleInfoWrapper(langtag, LOCALE_SMONDECIMALSEP, buf, BUFLEN); |
13583 | 551 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
552 |
||
553 |
if (got) { |
|
554 |
return buf[0]; |
|
555 |
} else { |
|
556 |
return monetaryDecimalSeparator; |
|
557 |
} |
|
558 |
} |
|
559 |
||
560 |
/* |
|
561 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
562 |
* Method: getNaN |
|
563 |
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; |
|
564 |
*/ |
|
565 |
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getNaN |
|
566 |
(JNIEnv *env, jclass cls, jstring jlangtag, jstring nan) { |
|
567 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
568 |
int got; |
13583 | 569 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
570 |
CHECK_NULL_RETURN(langtag, nan); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
571 |
got = getLocaleInfoWrapper(langtag, LOCALE_SNAN, buf, BUFLEN); |
13583 | 572 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
573 |
||
574 |
if (got) { |
|
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
575 |
return (*env)->NewString(env, buf, (jsize)wcslen(buf)); |
13583 | 576 |
} else { |
577 |
return nan; |
|
578 |
} |
|
579 |
} |
|
580 |
||
581 |
/* |
|
582 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
583 |
* Method: getPercent |
|
584 |
* Signature: (Ljava/lang/String;C)C |
|
585 |
*/ |
|
586 |
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPercent |
|
587 |
(JNIEnv *env, jclass cls, jstring jlangtag, jchar percent) { |
|
588 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
589 |
int got; |
13583 | 590 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
591 |
CHECK_NULL_RETURN(langtag, percent); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
592 |
got = getLocaleInfoWrapper(langtag, LOCALE_SPERCENT, buf, BUFLEN); |
13583 | 593 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
594 |
||
595 |
if (got) { |
|
596 |
return buf[0]; |
|
597 |
} else { |
|
598 |
return percent; |
|
599 |
} |
|
600 |
} |
|
601 |
||
602 |
/* |
|
603 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
604 |
* Method: getPerMill |
|
605 |
* Signature: (Ljava/lang/String;C)C |
|
606 |
*/ |
|
607 |
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPerMill |
|
608 |
(JNIEnv *env, jclass cls, jstring jlangtag, jchar perMill) { |
|
609 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
610 |
const jchar *langtag; |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
611 |
int got; |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
612 |
langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
613 |
CHECK_NULL_RETURN(langtag, perMill); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
614 |
got = getLocaleInfoWrapper(langtag, LOCALE_SPERMILLE, buf, BUFLEN); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
615 |
|
13583 | 616 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
617 |
||
618 |
if (got) { |
|
619 |
return buf[0]; |
|
620 |
} else { |
|
621 |
return perMill; |
|
622 |
} |
|
623 |
} |
|
624 |
||
625 |
/* |
|
626 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
627 |
* Method: getZeroDigit |
|
628 |
* Signature: (Ljava/lang/String;C)C |
|
629 |
*/ |
|
630 |
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getZeroDigit |
|
631 |
(JNIEnv *env, jclass cls, jstring jlangtag, jchar zeroDigit) { |
|
632 |
WCHAR buf[BUFLEN]; |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
633 |
const jchar *langtag; |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
634 |
int got; |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
635 |
langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
636 |
CHECK_NULL_RETURN(langtag, zeroDigit); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
637 |
got = getLocaleInfoWrapper(langtag, LOCALE_SNATIVEDIGITS, buf, BUFLEN); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
638 |
|
13583 | 639 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
640 |
||
641 |
if (got) { |
|
642 |
return buf[0]; |
|
643 |
} else { |
|
644 |
return zeroDigit; |
|
645 |
} |
|
646 |
} |
|
647 |
||
648 |
/* |
|
649 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
|
650 |
* Method: getCalendarDataValue |
|
651 |
* Signature: (Ljava/lang/String;I)I |
|
652 |
*/ |
|
653 |
JNIEXPORT jint JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCalendarDataValue |
|
654 |
(JNIEnv *env, jclass cls, jstring jlangtag, jint type) { |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
655 |
DWORD num; |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
656 |
const jchar *langtag; |
13583 | 657 |
int got = 0; |
658 |
||
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
659 |
langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
660 |
CHECK_NULL_RETURN(langtag, -1); |
13583 | 661 |
switch (type) { |
662 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CD_FIRSTDAYOFWEEK: |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
663 |
got = getLocaleInfoWrapper(langtag, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
664 |
LOCALE_IFIRSTDAYOFWEEK | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
665 |
(LPWSTR)&num, sizeof(num)); |
13583 | 666 |
break; |
667 |
} |
|
668 |
||
669 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
|
670 |
||
671 |
if (got) { |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
672 |
return num; |
13583 | 673 |
} else { |
674 |
return -1; |
|
675 |
} |
|
676 |
} |
|
677 |
||
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
678 |
/* |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
679 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
680 |
* Method: getCalendarDisplayStrings |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
681 |
* Signature: (Ljava/lang/String;III)[Ljava/lang/String; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
682 |
*/ |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
683 |
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCalendarDisplayStrings |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
684 |
(JNIEnv *env, jclass cls, jstring jlangtag, jint calid, jint field, jint style) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
685 |
jobjectArray ret = NULL; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
686 |
CALTYPE * pCalType = NULL; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
687 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
688 |
switch (field) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
689 |
case CALENDAR_FIELD_ERA: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
690 |
return getErasImpl(env, jlangtag, calid, style, NULL); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
691 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
692 |
case CALENDAR_FIELD_MONTH: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
693 |
ret = (*env)->NewObjectArray(env, MONTHTYPES, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
694 |
(*env)->FindClass(env, "java/lang/String"), NULL); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
695 |
if (ret != NULL) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
696 |
if (style & CALENDAR_STYLE_SHORT_MASK) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
697 |
pCalType = sMonthsType; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
698 |
} else { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
699 |
pCalType = monthsType; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
700 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
701 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
702 |
replaceCalendarArrayElems(env, jlangtag, calid, ret, pCalType, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
703 |
0, MONTHTYPES, style); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
704 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
705 |
return ret; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
706 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
707 |
default: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
708 |
// not supported |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
709 |
return NULL; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
710 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
711 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
712 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
713 |
/* |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
714 |
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
715 |
* Method: getDisplayString |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
716 |
* Signature: (Ljava/lang/String;ILjava/lang/String;)Ljava/lang/String; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
717 |
*/ |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
718 |
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDisplayString |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
719 |
(JNIEnv *env, jclass cls, jstring jlangtag, jint type, jstring jvalue) { |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
720 |
LCTYPE lcType; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
721 |
jstring jStr; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
722 |
const jchar * pjChar; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
723 |
WCHAR buf[BUFLEN]; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
724 |
int got = 0; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
725 |
|
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
726 |
switch (type) { |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
727 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_CURRENCY_NAME: |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
728 |
lcType = LOCALE_SNATIVECURRNAME; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
729 |
jStr = jlangtag; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
730 |
break; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
731 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_CURRENCY_SYMBOL: |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
732 |
lcType = LOCALE_SCURRENCY; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
733 |
jStr = jlangtag; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
734 |
break; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
735 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_LANGUAGE: |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
736 |
lcType = LOCALE_SLOCALIZEDLANGUAGENAME; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
737 |
jStr = jvalue; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
738 |
break; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
739 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_REGION: |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
740 |
lcType = LOCALE_SLOCALIZEDCOUNTRYNAME; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
741 |
jStr = jvalue; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
742 |
break; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
743 |
default: |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
744 |
return NULL; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
745 |
} |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
746 |
|
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
747 |
pjChar = (*env)->GetStringChars(env, jStr, JNI_FALSE); |
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
748 |
CHECK_NULL_RETURN(pjChar, NULL); |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
749 |
got = getLocaleInfoWrapper(pjChar, lcType, buf, BUFLEN); |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
750 |
(*env)->ReleaseStringChars(env, jStr, pjChar); |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
751 |
|
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
752 |
if (got) { |
54097
9fc262a75638
8220227: Host Locale Provider getDisplayCountry returns error message under non-English Win10
tnakamura
parents:
47216
diff
changeset
|
753 |
return (*env)->NewString(env, buf, (jsize)wcslen(buf)); |
9fc262a75638
8220227: Host Locale Provider getDisplayCountry returns error message under non-English Win10
tnakamura
parents:
47216
diff
changeset
|
754 |
} else { |
9fc262a75638
8220227: Host Locale Provider getDisplayCountry returns error message under non-English Win10
tnakamura
parents:
47216
diff
changeset
|
755 |
return NULL; |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
756 |
} |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
757 |
} |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
758 |
|
13583 | 759 |
int getLocaleInfoWrapper(const jchar *langtag, LCTYPE type, LPWSTR data, int buflen) { |
760 |
if (pGetLocaleInfoEx) { |
|
16481
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
761 |
if (wcscmp(L"und", (LPWSTR)langtag) == 0) { |
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
762 |
// defaults to "en" |
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
763 |
return pGetLocaleInfoEx(L"en", type, data, buflen); |
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
764 |
} else { |
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
765 |
return pGetLocaleInfoEx((LPWSTR)langtag, type, data, buflen); |
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
766 |
} |
13583 | 767 |
} else { |
768 |
// If we ever wanted to support WinXP, we will need extra module from |
|
769 |
// MS... |
|
770 |
// return GetLocaleInfo(DownlevelLocaleNameToLCID(langtag, 0), type, data, buflen); |
|
771 |
return 0; |
|
772 |
} |
|
773 |
} |
|
774 |
||
775 |
int getCalendarInfoWrapper(const jchar *langtag, CALID id, LPCWSTR reserved, CALTYPE type, LPWSTR data, int buflen, LPDWORD val) { |
|
776 |
if (pGetCalendarInfoEx) { |
|
16481
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
777 |
if (wcscmp(L"und", (LPWSTR)langtag) == 0) { |
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
778 |
// defaults to "en" |
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
779 |
return pGetCalendarInfoEx(L"en", id, reserved, type, data, buflen, val); |
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
780 |
} else { |
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
781 |
return pGetCalendarInfoEx((LPWSTR)langtag, id, reserved, type, data, buflen, val); |
8e30386cc014
8008576: Calendar mismatch using Host LocaleProviderAdapter
naoto
parents:
14028
diff
changeset
|
782 |
} |
13583 | 783 |
} else { |
784 |
// If we ever wanted to support WinXP, we will need extra module from |
|
785 |
// MS... |
|
786 |
// return GetCalendarInfo(DownlevelLocaleNameToLCID(langtag, 0), ...); |
|
787 |
return 0; |
|
788 |
} |
|
789 |
} |
|
790 |
||
791 |
jint getCalendarID(const jchar *langtag) { |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
792 |
DWORD type = -1; |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
793 |
int got = getLocaleInfoWrapper(langtag, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
794 |
LOCALE_ICALENDARTYPE | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
795 |
(LPWSTR)&type, sizeof(type)); |
13583 | 796 |
|
797 |
if (got) { |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
798 |
switch (type) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
799 |
case CAL_GREGORIAN: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
800 |
case CAL_GREGORIAN_US: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
801 |
case CAL_JAPAN: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
802 |
case CAL_TAIWAN: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
803 |
case CAL_HIJRI: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
804 |
case CAL_THAI: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
805 |
case CAL_GREGORIAN_ME_FRENCH: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
806 |
case CAL_GREGORIAN_ARABIC: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
807 |
case CAL_GREGORIAN_XLIT_ENGLISH: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
808 |
case CAL_GREGORIAN_XLIT_FRENCH: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
809 |
case CAL_UMALQURA: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
810 |
break; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
811 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
812 |
default: |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
813 |
// non-supported calendars return -1 |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
814 |
type = -1; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
815 |
break; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
816 |
} |
13583 | 817 |
} |
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
818 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
819 |
return type; |
13583 | 820 |
} |
821 |
||
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
822 |
void replaceCalendarArrayElems(JNIEnv *env, jstring jlangtag, jint calid, jobjectArray jarray, CALTYPE* pCalTypes, int offset, int length, int style) { |
13583 | 823 |
WCHAR name[BUFLEN]; |
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
824 |
const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
825 |
jstring tmp_string; |
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
826 |
CALTYPE isGenitive; |
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
827 |
|
22939
fc08f20ea32f
8033370: [parfait] warning from b126 for solaris/native/sun/util/locale/provider: JNI exception pending
naoto
parents:
17169
diff
changeset
|
828 |
CHECK_NULL(langtag); |
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
829 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
830 |
if (calid < 0) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
831 |
calid = getCalendarID(langtag); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
832 |
} |
13583 | 833 |
|
834 |
if (calid != -1) { |
|
835 |
int i; |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
836 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
837 |
if (!(style & CALENDAR_STYLE_STANDALONE_MASK)) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
838 |
isGenitive = CAL_RETURN_GENITIVE_NAMES; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
839 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
840 |
|
13583 | 841 |
for (i = 0; i < length; i++) { |
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
842 |
if (getCalendarInfoWrapper(langtag, calid, NULL, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
843 |
pCalTypes[i] | isGenitive, name, BUFLEN, NULL) != 0) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
844 |
tmp_string = (*env)->NewString(env, name, (jsize)wcslen(name)); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
845 |
if (tmp_string != NULL) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
846 |
(*env)->SetObjectArrayElement(env, jarray, i + offset, tmp_string); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
847 |
} |
24121
0de1e14447a8
8035826: [parfait] JNI exception pending in src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
naoto
parents:
22939
diff
changeset
|
848 |
} |
13583 | 849 |
} |
850 |
} |
|
851 |
||
852 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
|
853 |
} |
|
854 |
||
855 |
WCHAR * getNumberPattern(const jchar * langtag, const jint numberStyle) { |
|
856 |
WCHAR ret[BUFLEN]; |
|
857 |
WCHAR number[BUFLEN]; |
|
858 |
WCHAR fix[BUFLEN]; |
|
859 |
||
860 |
getFixPart(langtag, numberStyle, TRUE, TRUE, ret); // "+" |
|
861 |
getNumberPart(langtag, numberStyle, number); |
|
862 |
wcscat_s(ret, BUFLEN-wcslen(ret), number); // "+12.34" |
|
863 |
getFixPart(langtag, numberStyle, TRUE, FALSE, fix); |
|
864 |
wcscat_s(ret, BUFLEN-wcslen(ret), fix); // "+12.34$" |
|
865 |
wcscat_s(ret, BUFLEN-wcslen(ret), L";"); // "+12.34$;" |
|
866 |
getFixPart(langtag, numberStyle, FALSE, TRUE, fix); |
|
867 |
wcscat_s(ret, BUFLEN-wcslen(ret), fix); // "+12.34$;(" |
|
868 |
wcscat_s(ret, BUFLEN-wcslen(ret), number); // "+12.34$;(12.34" |
|
869 |
getFixPart(langtag, numberStyle, FALSE, FALSE, fix); |
|
870 |
wcscat_s(ret, BUFLEN-wcslen(ret), fix); // "+12.34$;(12.34$)" |
|
871 |
||
872 |
return _wcsdup(ret); |
|
873 |
} |
|
874 |
||
875 |
void getNumberPart(const jchar * langtag, const jint numberStyle, WCHAR * number) { |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
876 |
DWORD digits = 0; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
877 |
DWORD leadingZero = 0; |
13583 | 878 |
WCHAR grouping[BUFLEN]; |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
879 |
int groupingLen; |
13583 | 880 |
WCHAR fractionPattern[BUFLEN]; |
881 |
WCHAR * integerPattern = number; |
|
882 |
WCHAR * pDest; |
|
883 |
||
884 |
// Get info from Windows |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
885 |
switch (numberStyle) { |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
886 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY: |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
887 |
getLocaleInfoWrapper(langtag, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
888 |
LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
889 |
(LPWSTR)&digits, sizeof(digits)); |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
890 |
break; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
891 |
|
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
892 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_INTEGER: |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
893 |
break; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
894 |
|
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
895 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_NUMBER: |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
896 |
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_PERCENT: |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
897 |
default: |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
898 |
getLocaleInfoWrapper(langtag, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
899 |
LOCALE_IDIGITS | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
900 |
(LPWSTR)&digits, sizeof(digits)); |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
901 |
break; |
13583 | 902 |
} |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
903 |
|
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
904 |
getLocaleInfoWrapper(langtag, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
905 |
LOCALE_ILZERO | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
906 |
(LPWSTR)&leadingZero, sizeof(leadingZero)); |
13583 | 907 |
groupingLen = getLocaleInfoWrapper(langtag, LOCALE_SGROUPING, grouping, BUFLEN); |
908 |
||
909 |
// fraction pattern |
|
910 |
if (digits > 0) { |
|
911 |
int i; |
|
912 |
for(i = digits; i > 0; i--) { |
|
59043
1a79b4bfc85a
8232860: Error formatting integer values with MessageFormat.format() using HOST provider
naoto
parents:
54097
diff
changeset
|
913 |
fractionPattern[i] = L'#'; |
13583 | 914 |
} |
915 |
fractionPattern[0] = L'.'; |
|
916 |
fractionPattern[digits+1] = L'\0'; |
|
917 |
} else { |
|
918 |
fractionPattern[0] = L'\0'; |
|
919 |
} |
|
920 |
||
921 |
// integer pattern |
|
922 |
pDest = integerPattern; |
|
923 |
if (groupingLen > 0) { |
|
924 |
int cur = groupingLen - 1;// subtracting null terminator |
|
925 |
while (--cur >= 0) { |
|
926 |
int repnum; |
|
927 |
||
928 |
if (grouping[cur] == L';') { |
|
929 |
continue; |
|
930 |
} |
|
931 |
||
932 |
repnum = grouping[cur] - 0x30; |
|
933 |
if (repnum > 0) { |
|
934 |
*pDest++ = L'#'; |
|
935 |
*pDest++ = L','; |
|
936 |
while(--repnum > 0) { |
|
937 |
*pDest++ = L'#'; |
|
938 |
} |
|
939 |
} |
|
940 |
} |
|
941 |
} |
|
942 |
||
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
943 |
if (leadingZero != 0) { |
13583 | 944 |
*pDest++ = L'0'; |
945 |
} else { |
|
946 |
*pDest++ = L'#'; |
|
947 |
} |
|
948 |
*pDest = L'\0'; |
|
949 |
||
950 |
wcscat_s(integerPattern, BUFLEN, fractionPattern); |
|
951 |
} |
|
952 |
||
953 |
void getFixPart(const jchar * langtag, const jint numberStyle, BOOL positive, BOOL prefix, WCHAR * ret) { |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
954 |
DWORD pattern = 0; |
13583 | 955 |
int style = numberStyle; |
956 |
int got = 0; |
|
957 |
||
958 |
if (positive) { |
|
959 |
if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY) { |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
960 |
got = getLocaleInfoWrapper(langtag, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
961 |
LOCALE_ICURRENCY | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
962 |
(LPWSTR)&pattern, sizeof(pattern)); |
13583 | 963 |
} else if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_PERCENT) { |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
964 |
got = getLocaleInfoWrapper(langtag, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
965 |
LOCALE_IPOSITIVEPERCENT | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
966 |
(LPWSTR)&pattern, sizeof(pattern)); |
13583 | 967 |
} |
968 |
} else { |
|
969 |
if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY) { |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
970 |
got = getLocaleInfoWrapper(langtag, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
971 |
LOCALE_INEGCURR | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
972 |
(LPWSTR)&pattern, sizeof(pattern)); |
13583 | 973 |
} else if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_PERCENT) { |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
974 |
got = getLocaleInfoWrapper(langtag, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
975 |
LOCALE_INEGATIVEPERCENT | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
976 |
(LPWSTR)&pattern, sizeof(pattern)); |
13583 | 977 |
} else { |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
978 |
got = getLocaleInfoWrapper(langtag, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
979 |
LOCALE_INEGNUMBER | LOCALE_RETURN_NUMBER, |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
16481
diff
changeset
|
980 |
(LPWSTR)&pattern, sizeof(pattern)); |
13583 | 981 |
} |
982 |
} |
|
983 |
||
984 |
if (numberStyle == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_INTEGER) { |
|
985 |
style = sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_NUMBER; |
|
986 |
} |
|
987 |
||
988 |
wcscpy(ret, fixes[!prefix][!positive][style][pattern]); |
|
989 |
} |
|
34878
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
990 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
991 |
int enumCalendarInfoWrapper(const jchar *langtag, CALID calid, CALTYPE type, LPWSTR buf, int buflen) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
992 |
if (pEnumCalendarInfoExEx) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
993 |
if (wcscmp(L"und", (LPWSTR)langtag) == 0) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
994 |
// defaults to "en" |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
995 |
return pEnumCalendarInfoExEx(&EnumCalendarInfoProc, L"en", |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
996 |
calid, NULL, type, (LPARAM)buf); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
997 |
} else { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
998 |
return pEnumCalendarInfoExEx(&EnumCalendarInfoProc, langtag, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
999 |
calid, NULL, type, (LPARAM)buf); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1000 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1001 |
} else { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1002 |
return 0; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1003 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1004 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1005 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1006 |
BOOL CALLBACK EnumCalendarInfoProc(LPWSTR lpCalInfoStr, CALID calid, LPWSTR lpReserved, LPARAM lParam) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1007 |
wcscat_s((LPWSTR)lParam, BUFLEN, lpCalInfoStr); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1008 |
wcscat_s((LPWSTR)lParam, BUFLEN, L","); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1009 |
return TRUE; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1010 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1011 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1012 |
jobjectArray getErasImpl(JNIEnv *env, jstring jlangtag, jint calid, jint style, jobjectArray eras) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1013 |
const jchar * langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1014 |
WCHAR buf[BUFLEN]; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1015 |
jobjectArray ret = eras; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1016 |
CALTYPE type; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1017 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1018 |
CHECK_NULL_RETURN(langtag, ret); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1019 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1020 |
buf[0] = '\0'; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1021 |
if (style & CALENDAR_STYLE_SHORT_MASK) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1022 |
type = CAL_SABBREVERASTRING; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1023 |
} else { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1024 |
type = CAL_SERASTRING; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1025 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1026 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1027 |
if (calid < 0) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1028 |
calid = getCalendarID(langtag); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1029 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1030 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1031 |
if (calid != -1 && enumCalendarInfoWrapper(langtag, calid, type, buf, BUFLEN)) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1032 |
// format in buf: "era0,era1,era2," where era0 is the current one |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1033 |
int eraCount; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1034 |
LPWSTR current; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1035 |
jsize array_length; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1036 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1037 |
for(eraCount = 0, current = buf; *current != '\0'; current++) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1038 |
if (*current == L',') { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1039 |
eraCount ++; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1040 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1041 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1042 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1043 |
if (eras != NULL) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1044 |
array_length = (*env)->GetArrayLength(env, eras); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1045 |
} else { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1046 |
// +1 for the "before" era, e.g., BC, which Windows does not return. |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1047 |
array_length = (jsize)eraCount + 1; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1048 |
ret = (*env)->NewObjectArray(env, array_length, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1049 |
(*env)->FindClass(env, "java/lang/String"), NULL); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1050 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1051 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1052 |
if (ret != NULL) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1053 |
int eraIndex; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1054 |
LPWSTR era; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1055 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1056 |
for(eraIndex = 0, era = current = buf; eraIndex < eraCount; era = current, eraIndex++) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1057 |
while (*current != L',') { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1058 |
current++; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1059 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1060 |
*current++ = '\0'; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1061 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1062 |
if (eraCount - eraIndex < array_length && |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1063 |
*era != '\0') { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1064 |
(*env)->SetObjectArrayElement(env, ret, |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1065 |
(jsize)(eraCount - eraIndex), |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1066 |
(*env)->NewString(env, era, (jsize)wcslen(era))); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1067 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1068 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1069 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1070 |
// Hack for the Japanese Imperial Calendar to insert Gregorian era for |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1071 |
// "Before Meiji" |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1072 |
if (calid == CAL_JAPAN) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1073 |
buf[0] = '\0'; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1074 |
if (enumCalendarInfoWrapper(langtag, CAL_GREGORIAN, type, buf, BUFLEN)) { |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1075 |
jsize len = (jsize)wcslen(buf); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1076 |
buf[--len] = '\0'; // remove the last ',' |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1077 |
(*env)->SetObjectArrayElement(env, ret, 0, (*env)->NewString(env, buf, len)); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1078 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1079 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1080 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1081 |
} |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1082 |
|
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1083 |
(*env)->ReleaseStringChars(env, jlangtag, langtag); |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1084 |
return ret; |
7d7e55ff253a
8039301: [ja] Host Locale Provider uses non-translated Calendar field names
naoto
parents:
25859
diff
changeset
|
1085 |
} |