提交 2de2f7dd 编写于 作者: S stooke

8203324: Use out of scope in getMacOSXLocale of java_props_macosx.c:120

Reviewed-by: shade, andrew
上级 11abfba6
...@@ -47,6 +47,8 @@ char *getPosixLocale(int cat) { ...@@ -47,6 +47,8 @@ char *getPosixLocale(int cat) {
#define LOCALEIDLENGTH 128 #define LOCALEIDLENGTH 128
char *getMacOSXLocale(int cat) { char *getMacOSXLocale(int cat) {
const char* retVal = NULL; const char* retVal = NULL;
char languageString[LOCALEIDLENGTH];
char localeString[LOCALEIDLENGTH];
switch (cat) { switch (cat) {
case LC_MESSAGES: case LC_MESSAGES:
...@@ -66,7 +68,6 @@ char *getMacOSXLocale(int cat) { ...@@ -66,7 +68,6 @@ char *getMacOSXLocale(int cat) {
CFRelease(languages); CFRelease(languages);
return NULL; return NULL;
} }
char languageString[LOCALEIDLENGTH];
if (CFStringGetCString(primaryLanguage, languageString, if (CFStringGetCString(primaryLanguage, languageString,
LOCALEIDLENGTH, CFStringGetSystemEncoding()) == false) { LOCALEIDLENGTH, CFStringGetSystemEncoding()) == false) {
CFRelease(languages); CFRelease(languages);
...@@ -81,7 +82,6 @@ char *getMacOSXLocale(int cat) { ...@@ -81,7 +82,6 @@ char *getMacOSXLocale(int cat) {
// from Portuguese in Portugal), but this is missing when using the // from Portuguese in Portugal), but this is missing when using the
// "Portuguese (Brazil)" language. // "Portuguese (Brazil)" language.
// If language is "pt" and the current locale is pt_BR, return pt_BR. // If language is "pt" and the current locale is pt_BR, return pt_BR.
char localeString[LOCALEIDLENGTH];
if (strcmp(retVal, "pt") == 0 && if (strcmp(retVal, "pt") == 0 &&
CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()), CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding()) && localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding()) &&
...@@ -92,7 +92,6 @@ char *getMacOSXLocale(int cat) { ...@@ -92,7 +92,6 @@ char *getMacOSXLocale(int cat) {
break; break;
default: default:
{ {
char localeString[LOCALEIDLENGTH];
if (!CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()), if (!CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) { localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) {
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册