More variable initializations and curly braces to avoid Linux compiler
authortomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 29 Jul 2011 13:44:30 +0000 (13:44 +0000)
committertomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 29 Jul 2011 13:44:30 +0000 (13:44 +0000)
warnings.

git-svn-id: http://skia.googlecode.com/svn/trunk@1993 2bbb7eff-a529-9590-31e7-b0007b416f81

gpu/src/GrRedBlackTree.h
samplecode/SampleFuzz.cpp
src/core/SkPath.cpp
src/svg/SkSVGClipPath.cpp
src/views/SkStackViewLayout.cpp

index 1e81b27..da5ae3e 100644 (file)
@@ -354,7 +354,7 @@ typename GrRedBlackTree<T,C>::Iter GrRedBlackTree<T,C>::insert(const T& t) {
     Node* p = NULL;
     Node* n = fRoot;
     Child pc = kLeft_Child; // suppress uninit warning
-    Child gpc;
+    Child gpc = kLeft_Child;
 
     bool first = true;
     bool last = true;
index a6495b3..51350be 100644 (file)
@@ -45,7 +45,7 @@ static float huge() {
 }
 
 static float make_number() {
-  float v;
+  float v = 0;
   int sel;
 
   if (return_large == true && R(3) == 1) sel = R(6); else  sel = R(4);
index 1b9121e..e0d5b69 100644 (file)
@@ -218,10 +218,12 @@ bool SkPath::isRect(SkRect* rect) const {
 
     int corners = 0;
     SkPoint first, last;
-    int firstDirection;
-    int lastDirection;
-    int nextDirection;
-    bool closedOrMoved;
+    first.set(0, 0);
+    last.set(0, 0);
+    int firstDirection = 0;
+    int lastDirection = 0;
+    int nextDirection = 0;
+    bool closedOrMoved = false;
     bool autoClose = false;
     const uint8_t* verbs = fVerbs.begin();
     const uint8_t* verbStop = fVerbs.end();
@@ -269,7 +271,7 @@ bool SkPath::isRect(SkRect* rect) const {
                 // Possible values for corners are 2, 3, and 4.
                 // When corners == 3, nextDirection opposes firstDirection.
                 // Otherwise, nextDirection at corner 2 opposes corner 4.
-                int turn = firstDirection ^ corners - 1;
+                int turn = firstDirection ^ (corners - 1);
                 int directionCycle = 3 == corners ? 0 : nextDirection ^ turn;
                 if ((directionCycle ^ turn) != nextDirection) {
                     return false; // direction didn't follow cycle
index 03ff3fc..0a41764 100644 (file)
@@ -28,7 +28,7 @@ void SkSVGClipPath::translate(SkSVGParser& parser, bool defState) {
     SkSVGElement* child = *fChildren.begin();
     SkASSERT(child->getType() == SkSVGType_Use);
     SkSVGUse* use = (SkSVGUse*) child;
-    SkSVGElement* ref;
+    SkSVGElement* ref = NULL;
     const char* refStr = &use->f_xlink_href.c_str()[1];
     SkASSERT(parser.getIDs().find(refStr, &ref));
     SkASSERT(ref);
index a6e3f50..bf6f363 100644 (file)
@@ -202,8 +202,9 @@ void SkStackViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
 
        if ((index = dom.findList(node, "orient", "horizontal,vertical")) >= 0)
                this->setOrient((Orient)index);
-       else
+       else {
                assert_no_attr(dom, node, "orient");
+        }
 
        if (dom.findScalars(node, "margin", value, 4))
        {
@@ -211,23 +212,27 @@ void SkStackViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
                margin.set(value[0], value[1], value[2], value[3]);
                this->setMargin(margin);
        }
-       else
+       else {
                assert_no_attr(dom, node, "margin");
+        }
 
        if (dom.findScalar(node, "spacer", value))
                this->setSpacer(value[0]);
-       else
+       else {
                assert_no_attr(dom, node, "spacer");
+        }
 
        if ((index = dom.findList(node, "pack", "start,center,end")) >= 0)
                this->setPack((Pack)index);
-       else
+       else {
                assert_no_attr(dom, node, "pack");
+        }
 
        if ((index = dom.findList(node, "align", "start,center,end,stretch")) >= 0)
                this->setAlign((Align)index);
-       else
+       else {
                assert_no_attr(dom, node, "align");
+        }
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////