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
parent a8de3991dc
commit 1a6d2922e1

View File

@ -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;
}