Bug 969878 - Do not try to check the return value of nsTArray::SetLength in nsDateTimeFormatMac::FormatTMTime; 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:53:20 -05:00
Родитель 6c8a6323f2
Коммит 8c0ee15eb7
1 изменённых файлов: 7 добавлений и 8 удалений

Просмотреть файл

@ -214,18 +214,17 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
CFStringRef formattedDate = CFDateFormatterCreateStringWithAbsoluteTime(nullptr,
formatter,
absTime);
CFIndex stringLen = CFStringGetLength(formattedDate);
nsAutoTArray<UniChar, 256> stringBuffer;
if (stringBuffer.SetLength(stringLen + 1)) {
CFStringGetCharacters(formattedDate, CFRangeMake(0, stringLen), stringBuffer.Elements());
stringOut.Assign(reinterpret_cast<char16_t*>(stringBuffer.Elements()), stringLen);
}
stringBuffer.SetLength(stringLen + 1);
CFStringGetCharacters(formattedDate, CFRangeMake(0, stringLen), stringBuffer.Elements());
stringOut.Assign(reinterpret_cast<char16_t*>(stringBuffer.Elements()), stringLen);
CFRelease(formattedDate);
CFRelease(formatter);
return res;
}