Bug 1339119 - Actually use the locale from macOS instead of throwing it away in OSPreferences::ReadSystemLocales. r=gandalf
--- a/intl/locale/mac/OSPreferences_mac.cpp
+++ b/intl/locale/mac/OSPreferences_mac.cpp
@@ -15,16 +15,17 @@ OSPreferences::ReadSystemLocales(nsTArra
MOZ_ASSERT(aLocaleList.IsEmpty());
// Get string representation of user's current locale
CFLocaleRef userLocaleRef = ::CFLocaleCopyCurrent();
CFStringRef userLocaleStr = ::CFLocaleGetIdentifier(userLocaleRef);
AutoTArray<UniChar, 32> buffer;
int size = ::CFStringGetLength(userLocaleStr);
+ buffer.SetLength(size);
CFRange range = ::CFRangeMake(0, size);
::CFStringGetCharacters(userLocaleStr, range, buffer.Elements());
// Convert the locale string to the format that Mozilla expects
NS_LossyConvertUTF16toASCII locale(
reinterpret_cast<const char16_t*>(buffer.Elements()), buffer.Length());