Start addressing the clang static analyzer issues
authorrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 30 Jan 2013 20:33:12 +0000 (20:33 +0000)
committerrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 30 Jan 2013 20:33:12 +0000 (20:33 +0000)
https://codereview.appspot.com/7249043/

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

src/core/SkRRect.cpp
src/core/SkRegion.cpp
src/core/SkScan_Hairline.cpp
src/effects/SkDashPathEffect.cpp
src/gpu/GrClipMaskManager.cpp
src/ports/SkFontHost_linux.cpp
tests/FontHostTest.cpp

index a1c4e32..fc1a1cf 100644 (file)
@@ -36,9 +36,7 @@ void SkRRect::setRectXY(const SkRect& rect, SkScalar xRad, SkScalar yRad) {
     fType = kSimple_Type;
     if (xRad >= SkScalarHalf(fRect.width()) && yRad >= SkScalarHalf(fRect.height())) {
         fType = kOval_Type;
-        // TODO: try asserting they are already W/2 & H/2 already
-        xRad = SkScalarHalf(fRect.width());
-        yRad = SkScalarHalf(fRect.height());
+        // TODO: assert that all the x&y radii are already W/2 & H/2
     }
 
     SkDEBUGCODE(this->validate();)
index e6ed68f..dcad9ea 100644 (file)
@@ -848,7 +848,6 @@ static int operate(const SkRegion::RunType a_runs[],
 
     RgnOper oper(SkMin32(a_top, b_top), dst, op);
 
-    bool firstInterval = true;
     int prevBot = SkRegion::kRunTypeSentinel; // so we fail the first test
 
     while (a_bot < SkRegion::kRunTypeSentinel ||
@@ -895,7 +894,6 @@ static int operate(const SkRegion::RunType a_runs[],
             oper.addSpan(top, gSentinel, gSentinel);
         }
         oper.addSpan(bot, run0, run1);
-        firstInterval = false;
 
         if (quickExit && !oper.isEmpty()) {
             return QUICK_EXIT_TRUE_COUNT;
index 9e567b6..ada0078 100644 (file)
@@ -278,7 +278,6 @@ static void hair_path(const SkPath& path, const SkRasterClip& rclip, SkBlitter*
     }
 
     SkAAClipBlitterWrapper wrap;
-    const SkIRect* clipR = NULL;
     const SkRegion* clip = NULL;
 
     {
@@ -290,7 +289,6 @@ static void hair_path(const SkPath& path, const SkRasterClip& rclip, SkBlitter*
             return;
         }
         if (!rclip.quickContains(ibounds)) {
-            clipR = &rclip.getBounds();
             if (rclip.isBW()) {
                 clip = &rclip.bwRgn();
             } else {
index 1283628..1032270 100644 (file)
@@ -413,12 +413,10 @@ bool SkDashPathEffect::asPoints(PointData* results,
 
         results->fNumPoints = 0;
         SkScalar len2 = length;
-        bool partialFirst = false;
         if (clampedInitialDashLength > 0 || 0 == fInitialDashIndex) {
             SkASSERT(len2 >= clampedInitialDashLength);
             if (0 == fInitialDashIndex) {
                 if (clampedInitialDashLength > 0) {
-                    partialFirst = true;
                     if (clampedInitialDashLength >= fIntervals[0]) {
                         ++results->fNumPoints;  // partial first dash
                     }
index bc7b791..d2bfe7b 100644 (file)
@@ -611,7 +611,6 @@ bool GrClipMaskManager::createStencilClipMask(InitialState initialState,
         // with the existing clip.
         for (ElementList::Iter iter(elements.headIter()); NULL != iter.get(); iter.next()) {
             const Element* element = iter.get();
-            SkPath::FillType fill;
             bool fillInverted = false;
             // enabled at bottom of loop
             drawState->disableState(GrGpu::kModifyStencilClip_StateBit);
@@ -632,16 +631,13 @@ bool GrClipMaskManager::createStencilClipMask(InitialState initialState,
             SkTCopyOnFirstWrite<SkPath> clipPath;
             if (Element::kRect_Type == element->getType()) {
                 stencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
-                fill = SkPath::kEvenOdd_FillType;
                 fillInverted = false;
             } else {
                 GrAssert(Element::kPath_Type == element->getType());
                 clipPath.init(element->getPath());
-                fill = clipPath->getFillType();
                 fillInverted = clipPath->isInverseFillType();
                 if (fillInverted) {
                     clipPath.writable()->toggleInverseFillType();
-                    fill = clipPath->getFillType();
                 }
                 pr = this->getContext()->getPathRenderer(*clipPath,
                                                          stroke,
index fb6c6d5..07235c8 100644 (file)
@@ -504,7 +504,6 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
 
     SkFontDescriptor descriptor(stream);
     const char* familyName = descriptor.getFamilyName();
-    const char* typefaceName = descriptor.getFontFileName();
     const SkTypeface::Style style = descriptor.getStyle();
 
     const uint32_t customFontDataLength = stream->readPackedUInt();
index 879fdd0..4cd7812 100644 (file)
@@ -41,8 +41,8 @@ static void test_unitsPerEm(skiatest::Reporter* reporter, SkTypeface* face) {
 }
 
 static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) {
-    SkFontID fontID = face->uniqueID();
     if (false) { // avoid bit rot, suppress warning
+        SkFontID fontID = face->uniqueID();
         REPORTER_ASSERT(reporter, fontID);
     }