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; fType = kSimple_Type;
if (xRad >= SkScalarHalf(fRect.width()) && yRad >= SkScalarHalf(fRect.height())) { if (xRad >= SkScalarHalf(fRect.width()) && yRad >= SkScalarHalf(fRect.height())) {
fType = kOval_Type; fType = kOval_Type;
// TODO: try asserting they are already W/2 & H/2 already // TODO: assert that all the x&y radii are already W/2 & H/2
xRad = SkScalarHalf(fRect.width());
yRad = SkScalarHalf(fRect.height());
} }
SkDEBUGCODE(this->validate();) 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); RgnOper oper(SkMin32(a_top, b_top), dst, op);
bool firstInterval = true;
int prevBot = SkRegion::kRunTypeSentinel; // so we fail the first test int prevBot = SkRegion::kRunTypeSentinel; // so we fail the first test
while (a_bot < SkRegion::kRunTypeSentinel || while (a_bot < SkRegion::kRunTypeSentinel ||
@ -895,7 +894,6 @@ static int operate(const SkRegion::RunType a_runs[],
oper.addSpan(top, gSentinel, gSentinel); oper.addSpan(top, gSentinel, gSentinel);
} }
oper.addSpan(bot, run0, run1); oper.addSpan(bot, run0, run1);
firstInterval = false;
if (quickExit && !oper.isEmpty()) { if (quickExit && !oper.isEmpty()) {
return QUICK_EXIT_TRUE_COUNT; return QUICK_EXIT_TRUE_COUNT;

View File

@ -278,7 +278,6 @@ static void hair_path(const SkPath& path, const SkRasterClip& rclip, SkBlitter*
} }
SkAAClipBlitterWrapper wrap; SkAAClipBlitterWrapper wrap;
const SkIRect* clipR = NULL;
const SkRegion* clip = NULL; const SkRegion* clip = NULL;
{ {
@ -290,7 +289,6 @@ static void hair_path(const SkPath& path, const SkRasterClip& rclip, SkBlitter*
return; return;
} }
if (!rclip.quickContains(ibounds)) { if (!rclip.quickContains(ibounds)) {
clipR = &rclip.getBounds();
if (rclip.isBW()) { if (rclip.isBW()) {
clip = &rclip.bwRgn(); clip = &rclip.bwRgn();
} else { } else {

View File

@ -413,12 +413,10 @@ bool SkDashPathEffect::asPoints(PointData* results,
results->fNumPoints = 0; results->fNumPoints = 0;
SkScalar len2 = length; SkScalar len2 = length;
bool partialFirst = false;
if (clampedInitialDashLength > 0 || 0 == fInitialDashIndex) { if (clampedInitialDashLength > 0 || 0 == fInitialDashIndex) {
SkASSERT(len2 >= clampedInitialDashLength); SkASSERT(len2 >= clampedInitialDashLength);
if (0 == fInitialDashIndex) { if (0 == fInitialDashIndex) {
if (clampedInitialDashLength > 0) { if (clampedInitialDashLength > 0) {
partialFirst = true;
if (clampedInitialDashLength >= fIntervals[0]) { if (clampedInitialDashLength >= fIntervals[0]) {
++results->fNumPoints; // partial first dash ++results->fNumPoints; // partial first dash
} }

View File

@ -611,7 +611,6 @@ bool GrClipMaskManager::createStencilClipMask(InitialState initialState,
// with the existing clip. // with the existing clip.
for (ElementList::Iter iter(elements.headIter()); NULL != iter.get(); iter.next()) { for (ElementList::Iter iter(elements.headIter()); NULL != iter.get(); iter.next()) {
const Element* element = iter.get(); const Element* element = iter.get();
SkPath::FillType fill;
bool fillInverted = false; bool fillInverted = false;
// enabled at bottom of loop // enabled at bottom of loop
drawState->disableState(GrGpu::kModifyStencilClip_StateBit); drawState->disableState(GrGpu::kModifyStencilClip_StateBit);
@ -632,16 +631,13 @@ bool GrClipMaskManager::createStencilClipMask(InitialState initialState,
SkTCopyOnFirstWrite<SkPath> clipPath; SkTCopyOnFirstWrite<SkPath> clipPath;
if (Element::kRect_Type == element->getType()) { if (Element::kRect_Type == element->getType()) {
stencilSupport = GrPathRenderer::kNoRestriction_StencilSupport; stencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
fill = SkPath::kEvenOdd_FillType;
fillInverted = false; fillInverted = false;
} else { } else {
GrAssert(Element::kPath_Type == element->getType()); GrAssert(Element::kPath_Type == element->getType());
clipPath.init(element->getPath()); clipPath.init(element->getPath());
fill = clipPath->getFillType();
fillInverted = clipPath->isInverseFillType(); fillInverted = clipPath->isInverseFillType();
if (fillInverted) { if (fillInverted) {
clipPath.writable()->toggleInverseFillType(); clipPath.writable()->toggleInverseFillType();
fill = clipPath->getFillType();
} }
pr = this->getContext()->getPathRenderer(*clipPath, pr = this->getContext()->getPathRenderer(*clipPath,
stroke, stroke,

View File

@ -504,7 +504,6 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
SkFontDescriptor descriptor(stream); SkFontDescriptor descriptor(stream);
const char* familyName = descriptor.getFamilyName(); const char* familyName = descriptor.getFamilyName();
const char* typefaceName = descriptor.getFontFileName();
const SkTypeface::Style style = descriptor.getStyle(); const SkTypeface::Style style = descriptor.getStyle();
const uint32_t customFontDataLength = stream->readPackedUInt(); 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) { static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) {
SkFontID fontID = face->uniqueID();
if (false) { // avoid bit rot, suppress warning if (false) { // avoid bit rot, suppress warning
SkFontID fontID = face->uniqueID();
REPORTER_ASSERT(reporter, fontID); REPORTER_ASSERT(reporter, fontID);
} }