Initialize three locals to avoid the risk of uninitialized reads.
/analyze recently reported two new warnings about reading from potentially uninitialized local variables: src\third_party\skia\src\gpu\grclipmaskmanager.cpp(290) : warning C6001: Using uninitialized memory 'requiresAA'. src\third_party\skia\src\gpu\grclipmaskmanager.cpp(336) : warning C6001: Using uninitialized memory 'genID'. It is not clear whether the uninitialized reads can actually happen, but the guarantees seem sufficiently non-obvious that the prudent thing to do to guarantee future stability is to initialized them -- it's cheap. I also initialized initialState because it seemed to fall in the same class, despite there being no warning for it. BUG=427616 Review URL: https://codereview.chromium.org/957133002
This commit is contained in:
parent
e6cf9cb685
commit
71d7f7f002
@ -218,10 +218,10 @@ bool GrClipMaskManager::setupClipping(GrPipelineBuilder* pipelineBuilder,
|
||||
}
|
||||
|
||||
GrReducedClip::ElementList elements(16);
|
||||
int32_t genID;
|
||||
GrReducedClip::InitialState initialState;
|
||||
int32_t genID = 0;
|
||||
GrReducedClip::InitialState initialState = GrReducedClip::kAllIn_InitialState;
|
||||
SkIRect clipSpaceIBounds;
|
||||
bool requiresAA;
|
||||
bool requiresAA = false;
|
||||
GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
|
||||
|
||||
// GrDrawTarget should have filtered this for us
|
||||
@ -239,7 +239,6 @@ bool GrClipMaskManager::setupClipping(GrPipelineBuilder* pipelineBuilder,
|
||||
// we should have handled this case above
|
||||
SkASSERT(false);
|
||||
case GrClip::kIRect_ClipType: {
|
||||
initialState = GrReducedClip::kAllIn_InitialState;
|
||||
clipSpaceIBounds = clip.irect();
|
||||
SkNEW_INSERT_AT_LLIST_HEAD(&elements,
|
||||
Element,
|
||||
@ -247,7 +246,6 @@ bool GrClipMaskManager::setupClipping(GrPipelineBuilder* pipelineBuilder,
|
||||
SkRegion::kIntersect_Op, false));
|
||||
} break;
|
||||
case GrClip::kRect_ClipType: {
|
||||
initialState = GrReducedClip::kAllIn_InitialState;
|
||||
clipSpaceIBounds.setLTRB(SkScalarCeilToInt(clip.rect().fLeft),
|
||||
SkScalarCeilToInt(clip.rect().fTop),
|
||||
SkScalarCeilToInt(clip.rect().fRight),
|
||||
|
Loading…
Reference in New Issue
Block a user