Start addressing the clang static analyzer issues

https://codereview.appspot.com/7249043/



git-svn-id: http://skia.googlecode.com/svn/trunk@7469 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2013-01-30 20:33:12 +00:00
parent 70476652a0
commit 5b33211c5e
7 changed files with 2 additions and 15 deletions

View 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();)

View 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;

View 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 {

View 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
}

View 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,

View 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();

View 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);
}