explicitly size fType in SkRRect, to ensure the are no uninitialized bytes
authorreed <reed@google.com>
Wed, 22 Oct 2014 18:23:56 +0000 (11:23 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 22 Oct 2014 18:23:56 +0000 (11:23 -0700)
(so it can be used as a key in a cache)

BUG=skia:

Review URL: https://codereview.chromium.org/670183002

include/core/SkRRect.h

index d3f48cd..16670aa 100644 (file)
@@ -95,7 +95,7 @@ public:
             this->computeType();
         }
         SkASSERT(kUnknown_Type != fType);
-        return fType;
+        return static_cast<Type>(fType);
     }
 
     Type type() const { return this->getType(); }
@@ -304,7 +304,8 @@ private:
     SkRect fRect;
     // Radii order is UL, UR, LR, LL. Use Corner enum to index into fRadii[]
     SkVector fRadii[4];
-    mutable Type fType;
+    // use an explicitly sized type so we're sure the class is dense (no uninitialized bytes)
+    mutable int32_t fType;
     // TODO: add padding so we can use memcpy for flattening and not copy
     // uninitialized data