Bug 969872 - Do not try to check the return value of nsTArray::SetLength in nsLocaleService; r=smontagu

This size is not controllable from content. and nsTArray::SetLength's
return value is always true for now (I'm converting it to void in bug
969864.)
This commit is contained in:
Ehsan Akhgari 2014-02-11 08:52:30 -05:00
parent 3edbced6b9
commit a8de3991dc

View File

@ -171,20 +171,18 @@ nsLocaleService::nsLocaleService(void)
nsAutoTArray<UniChar, 32> buffer;
int size = ::CFStringGetLength(userLocaleStr);
if (buffer.SetLength(size + 1))
{
CFRange range = ::CFRangeMake(0, size);
::CFStringGetCharacters(userLocaleStr, range, buffer.Elements());
buffer[size] = 0;
buffer.SetLength(size + 1);
CFRange range = ::CFRangeMake(0, size);
::CFStringGetCharacters(userLocaleStr, range, buffer.Elements());
buffer[size] = 0;
// Convert the locale string to the format that Mozilla expects
nsAutoString xpLocale(reinterpret_cast<char16_t*>(buffer.Elements()));
xpLocale.ReplaceChar('_', '-');
// Convert the locale string to the format that Mozilla expects
nsAutoString xpLocale(reinterpret_cast<char16_t*>(buffer.Elements()));
xpLocale.ReplaceChar('_', '-');
nsresult rv = NewLocale(xpLocale, getter_AddRefs(mSystemLocale));
if (NS_SUCCEEDED(rv)) {
mApplicationLocale = mSystemLocale;
}
nsresult rv = NewLocale(xpLocale, getter_AddRefs(mSystemLocale));
if (NS_SUCCEEDED(rv)) {
mApplicationLocale = mSystemLocale;
}
::CFRelease(userLocaleStr);