Bug 918176 - Silence uninitialized variable warning in nsRuleNode::ComputeContentData. r=dholbert
☠☠ backed out by e1998769de9e ☠ ☠
authorCameron McCormack <cam@mcc.id.au>
Fri, 20 Sep 2013 11:24:04 +1000
changeset 147991 1a895d95c88b2165663368abbf2511fd907f7886
parent 147990 ccbfd1ddb131ffb1b7c459db5c064e0f00784a38
child 147992 9d5728797e772db19442ea21a32584fcad05c844
push id34068
push usercmccormack@mozilla.com
push dateFri, 20 Sep 2013 01:24:28 +0000
treeherdermozilla-inbound@9d5728797e77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs918176
milestone27.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 918176 - Silence uninitialized variable warning in nsRuleNode::ComputeContentData. r=dholbert
layout/base/nsCSSFrameConstructor.cpp
layout/style/nsRuleNode.cpp
layout/style/nsStyleStruct.h
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1634,16 +1634,20 @@ nsCSSFrameConstructor::CreateGeneratedCo
         nsXPIDLString temp;
         nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                            "Submit", temp);
         return CreateGenConTextNode(aState, temp, nullptr, nullptr);
       }
 
       break;
     }
+
+  case eStyleContentType_Uninitialized:
+    NS_NOTREACHED("uninitialized content type");
+    return nullptr;
   } // switch
 
   return nullptr;
 }
 
 /*
  * aParentFrame - the frame that should be the parent of the generated
  *   content.  This is the frame for the corresponding content node,
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -6989,20 +6989,21 @@ nsRuleNode::ComputeContentData(void* aSt
             case NS_STYLE_CONTENT_CLOSE_QUOTE:
               type = eStyleContentType_CloseQuote;    break;
             case NS_STYLE_CONTENT_NO_OPEN_QUOTE:
               type = eStyleContentType_NoOpenQuote;   break;
             case NS_STYLE_CONTENT_NO_CLOSE_QUOTE:
               type = eStyleContentType_NoCloseQuote;  break;
             default:
               NS_ERROR("bad content value");
+              type = eStyleContentType_Uninitialized; break;
             }
-            break;
           default:
             NS_ERROR("bad content type");
+            type = eStyleContentType_Uninitialized;
           }
           data.mType = type;
           if (type == eStyleContentType_Image) {
             NS_SET_IMAGE_REQUEST_WITH_DOC(data.SetImage,
                                           aContext,
                                           value.GetImageValue);
           }
           else if (type <= eStyleContentType_Attr) {
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1882,32 +1882,33 @@ enum nsStyleContentType {
   eStyleContentType_Image         = 10,
   eStyleContentType_Attr          = 20,
   eStyleContentType_Counter       = 30,
   eStyleContentType_Counters      = 31,
   eStyleContentType_OpenQuote     = 40,
   eStyleContentType_CloseQuote    = 41,
   eStyleContentType_NoOpenQuote   = 42,
   eStyleContentType_NoCloseQuote  = 43,
-  eStyleContentType_AltContent    = 50
+  eStyleContentType_AltContent    = 50,
+  eStyleContentType_Uninitialized
 };
 
 struct nsStyleContentData {
   nsStyleContentType  mType;
   union {
     PRUnichar *mString;
     imgRequestProxy *mImage;
     nsCSSValue::Array* mCounters;
   } mContent;
 #ifdef DEBUG
   bool mImageTracked;
 #endif
 
   nsStyleContentData()
-    : mType(nsStyleContentType(0))
+    : mType(eStyleContentType_Uninitialized)
 #ifdef DEBUG
     , mImageTracked(false)
 #endif
   { mContent.mString = nullptr; }
 
   ~nsStyleContentData();
   nsStyleContentData& operator=(const nsStyleContentData& aOther);
   bool operator==(const nsStyleContentData& aOther) const;