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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -91,7 +91,9 @@ char *getMacOSXLocale(int cat) {
|
|||
|
||||
if (hyphenPos == NULL || // languageString contains ISO639 only, e.g., "en"
|
||||
languageString + langStrLen - hyphenPos == 5) { // ISO639-ScriptCode, e.g., "en-Latn"
|
||||
CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
|
||||
CFLocaleRef cflocale = CFLocaleCopyCurrent();
|
||||
if (cflocale != NULL) {
|
||||
CFStringGetCString(CFLocaleGetIdentifier(cflocale),
|
||||
localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding());
|
||||
char *underscorePos = strrchr(localeString, '_');
|
||||
char *region = NULL;
|
||||
|
@ -104,6 +106,8 @@ char *getMacOSXLocale(int cat) {
|
|||
strcat(languageString, "-");
|
||||
strcat(languageString, region);
|
||||
}
|
||||
CFRelease(cflocale);
|
||||
}
|
||||
}
|
||||
|
||||
retVal = languageString;
|
||||
|
@ -112,12 +116,19 @@ char *getMacOSXLocale(int cat) {
|
|||
|
||||
default:
|
||||
{
|
||||
if (!CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
|
||||
CFLocaleRef cflocale = CFLocaleCopyCurrent();
|
||||
if (cflocale != NULL) {
|
||||
if (!CFStringGetCString(CFLocaleGetIdentifier(cflocale),
|
||||
localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) {
|
||||
CFRelease(cflocale);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
retVal = localeString;
|
||||
CFRelease(cflocale);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue