bug 1020008 - use mozilla::ArrayLength for array size. r=smontagu
authorJonathan Kew <jkew@mozilla.com>
Thu, 05 Jun 2014 11:15:26 +0100
changeset 206036 cbb2e610473e33fecd11c80489b4d4756a5a1f17
parent 206035 70713dd1ee5ebd149be45dfcab324983ad19821c
child 206037 39d4cddd05424bfb94358f8573607195e6ed5450
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs1020008
milestone32.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 1020008 - use mozilla::ArrayLength for array size. r=smontagu
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1236,21 +1236,23 @@ bool gfxPlatform::ForEachPrefFont(eFontP
     }
 
     return true;
 }
 
 eFontPrefLang
 gfxPlatform::GetFontPrefLangFor(const char* aLang)
 {
-    if (!aLang || !aLang[0])
+    if (!aLang || !aLang[0]) {
         return eFontPrefLang_Others;
-    for (uint32_t i = 0; i < uint32_t(eFontPrefLang_LangCount); ++i) {
-        if (!PL_strcasecmp(gPrefLangNames[i], aLang))
+    }
+    for (uint32_t i = 0; i < ArrayLength(gPrefLangNames); ++i) {
+        if (!PL_strcasecmp(gPrefLangNames[i], aLang)) {
             return eFontPrefLang(i);
+        }
     }
     return eFontPrefLang_Others;
 }
 
 eFontPrefLang
 gfxPlatform::GetFontPrefLangFor(nsIAtom *aLang)
 {
     if (!aLang)
@@ -1258,18 +1260,19 @@ gfxPlatform::GetFontPrefLangFor(nsIAtom 
     nsAutoCString lang;
     aLang->ToUTF8String(lang);
     return GetFontPrefLangFor(lang.get());
 }
 
 const char*
 gfxPlatform::GetPrefLangName(eFontPrefLang aLang)
 {
-    if (uint32_t(aLang) < uint32_t(eFontPrefLang_AllCount))
+    if (uint32_t(aLang) < ArrayLength(gPrefLangNames)) {
         return gPrefLangNames[uint32_t(aLang)];
+    }
     return nullptr;
 }
 
 eFontPrefLang
 gfxPlatform::GetFontPrefLangFor(uint8_t aUnicodeRange)
 {
     switch (aUnicodeRange) {
         case kRangeSetLatin:   return eFontPrefLang_Western;
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -90,22 +90,19 @@ enum eFontPrefLang {
     eFontPrefLang_Khmer       = 23,
     eFontPrefLang_Malayalam   = 24,
     eFontPrefLang_Oriya       = 25,
     eFontPrefLang_Telugu      = 26,
     eFontPrefLang_Kannada     = 27,
     eFontPrefLang_Sinhala     = 28,
     eFontPrefLang_Tibetan     = 29,
 
-    eFontPrefLang_LangCount   = 30, // except Others.
-
     eFontPrefLang_Others      = 30, // x-unicode
 
-    eFontPrefLang_CJKSet      = 31, // special code for CJK set
-    eFontPrefLang_AllCount    = 32
+    eFontPrefLang_CJKSet      = 31  // special code for CJK set
 };
 
 enum eCMSMode {
     eCMSMode_Off          = 0,     // No color management
     eCMSMode_All          = 1,     // Color manage everything
     eCMSMode_TaggedOnly   = 2,     // Color manage tagged Images Only
     eCMSMode_AllCount     = 3
 };