aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/renderer
diff options
context:
space:
mode:
authorGravatar Ken Grigsby <grigsby@thursby.com>2013-05-02 10:27:58 -0500
committerGravatar Ken Grigsby <grigsby@thursby.com>2013-05-02 10:49:38 -0500
commit324e3bc6ef254e18c55ca55dc3af00c700675b4a (patch)
tree38d4d660352175a79f3ec30461344cf01246c4e9 /src/core/renderer
parentecadad0533346b4181b14d0cbf63f44e048a19b1 (diff)
call CFRelease on localeRef not locale
Diffstat (limited to 'src/core/renderer')
-rw-r--r--src/core/renderer/MCDateFormatter.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/core/renderer/MCDateFormatter.cpp b/src/core/renderer/MCDateFormatter.cpp
index 065224d3..17e4c290 100644
--- a/src/core/renderer/MCDateFormatter.cpp
+++ b/src/core/renderer/MCDateFormatter.cpp
@@ -201,6 +201,28 @@ static CFDateFormatterStyle toAppleStyle(DateFormatStyle style)
void DateFormatter::prepare()
{
+#if USE_COREFOUNDATION
+ if (mAppleDateFormatter != NULL)
+ return;
+
+ CFStringRef localeIdentifier = NULL;
+ CFLocaleRef localeRef = NULL;
+ if (mLocale != NULL) {
+ localeIdentifier = CFStringCreateWithCharacters(NULL, (const UniChar *) mLocale->unicodeCharacters(),
+ mLocale->length());
+ localeRef = CFLocaleCreate(NULL, localeIdentifier);
+ }
+ if (localeRef == NULL) {
+ localeRef = CFLocaleCopyCurrent();
+ }
+ mAppleDateFormatter = CFDateFormatterCreate(NULL, localeRef, toAppleStyle(mDateStyle), toAppleStyle(mTimeStyle));
+ if (localeIdentifier != NULL) {
+ CFRelease(localeIdentifier);
+ }
+ if (localeRef != NULL) {
+ CFRelease(localeRef);
+ }
+#else
if (mDateFormatter != NULL)
return;
@@ -223,25 +245,6 @@ void DateFormatter::prepare()
locale = mLocale->UTF8Characters();
}
-#if USE_COREFOUNDATION
- CFStringRef localeIdentifier = NULL;
- CFLocaleRef localeRef = NULL;
- if (mLocale != NULL) {
- localeIdentifier = CFStringCreateWithCharacters(NULL, (const UniChar *) mLocale->unicodeCharacters(),
- mLocale->length());
- localeRef = CFLocaleCreate(NULL, localeIdentifier);
- }
- if (localeRef == NULL) {
- localeRef = CFLocaleCopyCurrent();
- }
- mAppleDateFormatter = CFDateFormatterCreate(NULL, localeRef, toAppleStyle(mDateStyle), toAppleStyle(mTimeStyle));
- if (localeIdentifier != NULL) {
- CFRelease(localeIdentifier);
- }
- if (locale != NULL) {
- CFRelease(locale);
- }
-#else
mDateFormatter = udat_open((UDateFormatStyle) mTimeStyle, (UDateFormatStyle) mDateStyle,
locale,
tzID, tzIDLength,