Bug 969878 - Do not try to check the return value of nsTArray::SetLength in nsDateTimeFormatMac::FormatTMTime; r=smontagu
authorEhsan Akhgari <ehsan.akhgari@gmail.com>
Tue, 11 Feb 2014 08:53:20 -0500
changeset 185251 97d852db7e3a7f849938cb04309eee56e3db8e7c
parent 185250 d7b6badfc1087820df0ae0c1dd249289abf83ae3
child 185252 3e252a679f72adfdd5fc2a8d527add97b4e312d1
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs969878, 969864
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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.)
intl/locale/src/mac/nsDateTimeFormatMac.cpp
--- a/intl/locale/src/mac/nsDateTimeFormatMac.cpp
+++ b/intl/locale/src/mac/nsDateTimeFormatMac.cpp
@@ -209,28 +209,27 @@ nsresult nsDateTimeFormatMac::FormatTMTi
 
   CFTimeZoneRef timeZone = CFTimeZoneCopySystem(); // tmTime is in local time
   CFAbsoluteTime absTime = CFGregorianDateGetAbsoluteTime(date, timeZone);
   CFRelease(timeZone);
 
   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;
 }
 
 // performs a locale sensitive date formatting operation on the PRTime parameter
 nsresult nsDateTimeFormatMac::FormatPRTime(nsILocale* locale, 
                                            const nsDateFormatSelector  dateFormatSelector, 
                                            const nsTimeFormatSelector timeFormatSelector, 
                                            const PRTime  prTime,