Bug 1079321 - Fix some more bad implicit constructors in gfx; r=jrmuizel
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 24 Sep 2014 09:16:53 -0400
changeset 209486 34b96e14238c44c132a83dea78b5d70d61ee84df
parent 209485 eabbf84195071b3e2aa6035c3f972841bc451fbe
child 209487 1cc7fa64a589453961df1aacf6d07a7761a3897d
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjrmuizel
bugs1079321
milestone35.0a1
Bug 1079321 - Fix some more bad implicit constructors in gfx; r=jrmuizel
gfx/2d/Logging.h
gfx/thebes/gfxFontUtils.cpp
gfx/thebes/gfxMathTable.cpp
gfx/thebes/gfxSkipChars.cpp
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -106,17 +106,17 @@ public:
 };
 
 MOZ_BEGIN_ENUM_CLASS(LogOptions, int)
   NoNewline = 0x01
 MOZ_END_ENUM_CLASS(LogOptions)
 
 template<typename T>
 struct Hexa {
-  Hexa(T aVal) : mVal(aVal) {}
+  explicit Hexa(T aVal) : mVal(aVal) {}
   T mVal;
 };
 template<typename T>
 Hexa<T> hexa(T val) { return Hexa<T>(val); }
 
 template<int L, typename Logger = BasicLogger>
 class Log
 {
--- a/gfx/thebes/gfxFontUtils.cpp
+++ b/gfx/thebes/gfxFontUtils.cpp
@@ -701,26 +701,26 @@ gfxFontUtils::MapCharToGlyphFormat12(con
     return 0;
 }
 
 namespace {
 
 struct Format14CmapWrapper
 {
     const Format14Cmap& mCmap14;
-    Format14CmapWrapper(const Format14Cmap& cmap14) : mCmap14(cmap14) {}
+    explicit Format14CmapWrapper(const Format14Cmap& cmap14) : mCmap14(cmap14) {}
     uint32_t operator[](size_t index) const {
         return mCmap14.varSelectorRecords[index].varSelector;
     }
 };
 
 struct NonDefUVSTableWrapper
 {
     const NonDefUVSTable& mTable;
-    NonDefUVSTableWrapper(const NonDefUVSTable& table) : mTable(table) {}
+    explicit NonDefUVSTableWrapper(const NonDefUVSTable& table) : mTable(table) {}
     uint32_t operator[](size_t index) const {
         return mTable.uvsMappings[index].unicodeValue;
     }
 };
 
 } // namespace
 
 uint16_t
@@ -1332,17 +1332,17 @@ const char* gfxFontUtils::gMSFontNameCha
     /* [9] reserved */                          nullptr      ,
     /*[10] ENCODING_ID_MICROSOFT_UNICODEFULL */ ""
 };
 
 struct MacCharsetMappingComparator
 {
     typedef gfxFontUtils::MacFontNameCharsetMapping MacFontNameCharsetMapping;
     const MacFontNameCharsetMapping& mSearchValue;
-    MacCharsetMappingComparator(const MacFontNameCharsetMapping& aSearchValue)
+    explicit MacCharsetMappingComparator(const MacFontNameCharsetMapping& aSearchValue)
       : mSearchValue(aSearchValue) {}
     int operator()(const MacFontNameCharsetMapping& aEntry) const {
         if (mSearchValue < aEntry) {
             return -1;
         }
         if (aEntry < mSearchValue) {
             return 1;
         }
--- a/gfx/thebes/gfxMathTable.cpp
+++ b/gfx/thebes/gfxMathTable.cpp
@@ -356,27 +356,27 @@ gfxMathTable::GetGlyphAssembly(uint32_t 
   return reinterpret_cast<const GlyphAssembly*>(start);
 }
 
 namespace {
 
 struct GlyphArrayWrapper
 {
   const GlyphID* const mGlyphArray;
-  GlyphArrayWrapper(const GlyphID* const aGlyphArray) : mGlyphArray(aGlyphArray)
+  explicit GlyphArrayWrapper(const GlyphID* const aGlyphArray) : mGlyphArray(aGlyphArray)
   {}
   uint16_t operator[](size_t index) const {
     return mGlyphArray[index];
   }
 };
 
 struct RangeRecordComparator
 {
   const uint32_t mGlyph;
-  RangeRecordComparator(uint32_t aGlyph) : mGlyph(aGlyph) {}
+  explicit RangeRecordComparator(uint32_t aGlyph) : mGlyph(aGlyph) {}
   int operator()(const RangeRecord& aRecord) const {
     if (mGlyph < static_cast<uint16_t>(aRecord.mStart)) {
       return -1;
     }
     if (mGlyph > static_cast<uint16_t>(aRecord.mEnd)) {
       return 1;
     }
     return 0;
--- a/gfx/thebes/gfxSkipChars.cpp
+++ b/gfx/thebes/gfxSkipChars.cpp
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gfxSkipChars.h"
 #include "mozilla/BinarySearch.h"
 
 struct SkippedRangeStartComparator
 {
     const uint32_t mOffset;
-    SkippedRangeStartComparator(const uint32_t aOffset) : mOffset(aOffset) {}
+    explicit SkippedRangeStartComparator(const uint32_t aOffset) : mOffset(aOffset) {}
     int operator()(const gfxSkipChars::SkippedRange& aRange) const {
         return (mOffset < aRange.Start()) ? -1 : 1;
     }
 };
 
 void
 gfxSkipCharsIterator::SetOriginalOffset(int32_t aOffset)
 {
@@ -64,17 +64,17 @@ gfxSkipCharsIterator::SetOriginalOffset(
     }
 
     mSkippedStringOffset = aOffset - r.NextDelta();
 }
 
 struct SkippedRangeOffsetComparator
 {
     const uint32_t mOffset;
-    SkippedRangeOffsetComparator(const uint32_t aOffset) : mOffset(aOffset) {}
+    explicit SkippedRangeOffsetComparator(const uint32_t aOffset) : mOffset(aOffset) {}
     int operator()(const gfxSkipChars::SkippedRange& aRange) const {
         return (mOffset < aRange.SkippedOffset()) ? -1 : 1;
     }
 };
 
 void
 gfxSkipCharsIterator::SetSkippedOffset(uint32_t aOffset)
 {