equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
156 return 0; |
156 return 0; |
157 } |
157 } |
158 |
158 |
159 temp = malloc(strlen(lc) + 1); |
159 temp = malloc(strlen(lc) + 1); |
160 if (temp == NULL) { |
160 if (temp == NULL) { |
|
161 #ifdef MACOSX |
|
162 free(lc); // malloced memory |
|
163 #endif |
161 JNU_ThrowOutOfMemoryError(env, NULL); |
164 JNU_ThrowOutOfMemoryError(env, NULL); |
162 return 0; |
165 return 0; |
163 } |
166 } |
164 |
167 |
165 if (cat == LC_CTYPE) { |
168 if (cat == LC_CTYPE) { |
170 * On Linux, the bug doesn't occur; on the other hand, @euro |
173 * On Linux, the bug doesn't occur; on the other hand, @euro |
171 * is needed there because it's a shortcut that also determines |
174 * is needed there because it's a shortcut that also determines |
172 * the encoding - without it, we wouldn't get ISO-8859-15. |
175 * the encoding - without it, we wouldn't get ISO-8859-15. |
173 * Therefore, this code section is Solaris-specific. |
176 * Therefore, this code section is Solaris-specific. |
174 */ |
177 */ |
175 lc = strdup(lc); /* keep a copy, setlocale trashes original. */ |
|
176 strcpy(temp, lc); |
178 strcpy(temp, lc); |
177 p = strstr(temp, "@euro"); |
179 p = strstr(temp, "@euro"); |
178 if (p != NULL) { |
180 if (p != NULL) { |
179 *p = '\0'; |
181 *p = '\0'; |
180 setlocale(LC_ALL, temp); |
182 setlocale(LC_ALL, temp); |