Bug 918176 - Silence uninitialized variable warning in nsRuleNode::ComputeContentData. r=dholbert
authorCameron McCormack <cam@mcc.id.au>
Fri, 20 Sep 2013 11:24:04 +1000
changeset 149235 ccfc5f4492f17270f0704c2684829b47838f6f5f
parent 149234 196a2b00d509f4e6052fcabf30543673b0ad59d2
child 149236 4a5e5518ca4c3ab4be2f7e7a5aebb8f753b8ef85
push id25380
push userryanvm@gmail.com
push dateMon, 30 Sep 2013 20:16:36 +0000
treeherdermozilla-central@1332fc1c15e1 [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
@@ -1638,16 +1638,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,22 @@ 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;
           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;