mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8228501: java_props_macosx.c - provide missing CFRelease for CFLocaleCopyCurrent
Reviewed-by: naoto
This commit is contained in:
parent
6a94be7047
commit
ff6b5404eb
1 changed files with 26 additions and 15 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -91,18 +91,22 @@ char *getMacOSXLocale(int cat) {
|
||||||
|
|
||||||
if (hyphenPos == NULL || // languageString contains ISO639 only, e.g., "en"
|
if (hyphenPos == NULL || // languageString contains ISO639 only, e.g., "en"
|
||||||
languageString + langStrLen - hyphenPos == 5) { // ISO639-ScriptCode, e.g., "en-Latn"
|
languageString + langStrLen - hyphenPos == 5) { // ISO639-ScriptCode, e.g., "en-Latn"
|
||||||
CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
|
CFLocaleRef cflocale = CFLocaleCopyCurrent();
|
||||||
localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding());
|
if (cflocale != NULL) {
|
||||||
char *underscorePos = strrchr(localeString, '_');
|
CFStringGetCString(CFLocaleGetIdentifier(cflocale),
|
||||||
char *region = NULL;
|
localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding());
|
||||||
|
char *underscorePos = strrchr(localeString, '_');
|
||||||
|
char *region = NULL;
|
||||||
|
|
||||||
if (underscorePos != NULL) {
|
if (underscorePos != NULL) {
|
||||||
region = underscorePos + 1;
|
region = underscorePos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (region != NULL) {
|
if (region != NULL) {
|
||||||
strcat(languageString, "-");
|
strcat(languageString, "-");
|
||||||
strcat(languageString, region);
|
strcat(languageString, region);
|
||||||
|
}
|
||||||
|
CFRelease(cflocale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,12 +116,19 @@ char *getMacOSXLocale(int cat) {
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (!CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
|
CFLocaleRef cflocale = CFLocaleCopyCurrent();
|
||||||
localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) {
|
if (cflocale != NULL) {
|
||||||
|
if (!CFStringGetCString(CFLocaleGetIdentifier(cflocale),
|
||||||
|
localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) {
|
||||||
|
CFRelease(cflocale);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
retVal = localeString;
|
||||||
|
CFRelease(cflocale);
|
||||||
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
retVal = localeString;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue