Bug 969872 - Do not try to check the return value of nsTArray::SetLength in nsLocaleService; r=smontagu
authorEhsan Akhgari <ehsan.akhgari@gmail.com>
Tue, 11 Feb 2014 08:52:30 -0500
changeset 168059 d7b6badfc1087820df0ae0c1dd249289abf83ae3
parent 168058 86823e9bbae28154f322675060d382394ee248be
child 168060 97d852db7e3a7f849938cb04309eee56e3db8e7c
push id26195
push userryanvm@gmail.com
push dateTue, 11 Feb 2014 19:45:49 +0000
treeherdermozilla-central@e93b626422f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs969872, 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 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.)
intl/locale/src/nsLocaleService.cpp
--- a/intl/locale/src/nsLocaleService.cpp
+++ b/intl/locale/src/nsLocaleService.cpp
@@ -166,30 +166,28 @@ nsLocaleService::nsLocaleService(void)
 #ifdef XP_MACOSX
     // Get string representation of user's current locale
     CFLocaleRef userLocaleRef = ::CFLocaleCopyCurrent();
     CFStringRef userLocaleStr = ::CFLocaleGetIdentifier(userLocaleRef);
     ::CFRetain(userLocaleStr);
 
     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);
     ::CFRelease(userLocaleRef);
 
     NS_ASSERTION(mApplicationLocale, "Failed to create locale objects");
 #endif // XP_MACOSX
 }