Bug 793880 - Fix the assertion in nsCSSSelector::SetPseudoType to shut up the compiler warning; r=dholbert
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 02 Oct 2012 15:50:50 -0400
changeset 109041 f63b7f854ce400192d5f155821b063ffb472ad86
parent 109040 d6f8b964ca275847feed01c5a3f96e19773a8854
child 109042 d5a3c148545c244b31b1a7217c31b49873f0a0f9
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersdholbert
bugs793880
milestone18.0a1
Bug 793880 - Fix the assertion in nsCSSSelector::SetPseudoType to shut up the compiler warning; r=dholbert
layout/style/StyleRule.h
--- a/layout/style/StyleRule.h
+++ b/layout/style/StyleRule.h
@@ -178,17 +178,19 @@ private:
   int32_t CalcWeightWithoutNegations() const;
 
 public:
   // Get and set the selector's pseudo type
   nsCSSPseudoElements::Type PseudoType() const {
     return static_cast<nsCSSPseudoElements::Type>(mPseudoType);
   }
   void SetPseudoType(nsCSSPseudoElements::Type aType) {
-    NS_ASSERTION(aType > INT16_MIN && aType < INT16_MAX, "Out of bounds");
+    NS_ASSERTION(static_cast<int32_t>(aType) >= INT16_MIN &&
+                 static_cast<int32_t>(aType) <= INT16_MAX,
+                 "Out of bounds - this will overflow mPseudoType");
     mPseudoType = static_cast<int16_t>(aType);
   }
 
   size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
 
   // For case-sensitive documents, mLowercaseTag is the same as mCasedTag,
   // but in case-insensitive documents (HTML) mLowercaseTag is lowercase.
   // Also, for pseudo-elements mCasedTag will be null but mLowercaseTag