From: vandebo@chromium.org Date: Wed, 28 Mar 2012 20:29:38 +0000 (+0000) Subject: Fix a bunch of Coverity defects - class members not initialized in the constructor. X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~16520 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a728e35edcffd99216e3965a4b908ad0df7f69c2;p=platform%2Fupstream%2FlibSkiaSharp.git Fix a bunch of Coverity defects - class members not initialized in the constructor. CID=14533,14036,9275,9271,4156,4153,4151,1666,1665,1618,1617,1616,1615 Review URL: https://codereview.appspot.com/5940049 git-svn-id: http://skia.googlecode.com/svn/trunk@3532 2bbb7eff-a529-9590-31e7-b0007b416f81 --- diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h index 29679d6..2cb171b 100644 --- a/include/core/SkScalerContext.h +++ b/include/core/SkScalerContext.h @@ -328,7 +328,6 @@ private: SkPathEffect* fPathEffect; SkMaskFilter* fMaskFilter; SkRasterizer* fRasterizer; - SkScalar fDevFrameWidth; // if this is set, we draw the image from a path, rather than // calling generateImage. diff --git a/include/effects/SkPaintFlagsDrawFilter.h b/include/effects/SkPaintFlagsDrawFilter.h index 66a43cc..d8cc3ba 100644 --- a/include/effects/SkPaintFlagsDrawFilter.h +++ b/include/effects/SkPaintFlagsDrawFilter.h @@ -20,7 +20,6 @@ public: virtual void filter(SkPaint*, Type); private: - uint32_t fPrevFlags; // local cache for filter/restore uint16_t fClearFlags; // user specified uint16_t fSetFlags; // user specified }; diff --git a/src/core/SkBitmapSampler.cpp b/src/core/SkBitmapSampler.cpp index 37cbc5a..4c05be2 100644 --- a/src/core/SkBitmapSampler.cpp +++ b/src/core/SkBitmapSampler.cpp @@ -234,6 +234,7 @@ class A8_Bilinear_Sampler : public SkBitmapSampler { public: A8_Bilinear_Sampler(const SkBitmap& bm, SkShader::TileMode tmx, SkShader::TileMode tmy) : SkBitmapSampler(bm, true, tmx, tmy) + , fColor(0) { fProcTable = SkGetBilinearFilterProcTable(); } @@ -289,6 +290,7 @@ class A8_NoFilter_Sampler : public SkBitmapSampler { public: A8_NoFilter_Sampler(const SkBitmap& bm, SkShader::TileMode tmx, SkShader::TileMode tmy) : SkBitmapSampler(bm, false, tmx, tmy) + , fProcTable(NULL) { } diff --git a/src/core/SkCubicClipper.cpp b/src/core/SkCubicClipper.cpp index 662591f..3db2feb 100644 --- a/src/core/SkCubicClipper.cpp +++ b/src/core/SkCubicClipper.cpp @@ -10,7 +10,9 @@ #include "SkCubicClipper.h" #include "SkGeometry.h" -SkCubicClipper::SkCubicClipper() {} +SkCubicClipper::SkCubicClipper() { + fClip.setEmpty(); +} void SkCubicClipper::setClip(const SkIRect& clip) { // conver to scalars, since that's where we'll see the points diff --git a/src/core/SkMMapStream.cpp b/src/core/SkMMapStream.cpp index 0aec5e1..1579044 100644 --- a/src/core/SkMMapStream.cpp +++ b/src/core/SkMMapStream.cpp @@ -15,6 +15,7 @@ SkMMAPStream::SkMMAPStream(const char filename[]) { fAddr = NULL; // initialize to failure case + fSize = 0; int fildes = open(filename, O_RDONLY); if (fildes < 0) diff --git a/src/core/SkQuadClipper.cpp b/src/core/SkQuadClipper.cpp index b79d5a2..0c9c9ad 100644 --- a/src/core/SkQuadClipper.cpp +++ b/src/core/SkQuadClipper.cpp @@ -22,7 +22,9 @@ static inline void clamp_ge(SkScalar& value, SkScalar min) { } } -SkQuadClipper::SkQuadClipper() {} +SkQuadClipper::SkQuadClipper() { + fClip.setEmpty(); +} void SkQuadClipper::setClip(const SkIRect& clip) { // conver to scalars, since that's where we'll see the points diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp index 9ccc453..11170f4 100644 --- a/src/effects/Sk1DPathEffect.cpp +++ b/src/effects/Sk1DPathEffect.cpp @@ -34,6 +34,8 @@ SkPath1DPathEffect::SkPath1DPathEffect(const SkPath& path, SkScalar advance, if (advance <= 0 || path.isEmpty()) { SkDEBUGF(("SkPath1DPathEffect can't use advance <= 0\n")); fAdvance = 0; // signals we can't draw anything + fInitialOffset = 0; + fStyle = kStyleCount; } else { // cleanup their phase parameter, inverting it so that it becomes an // offset along the path (to match the interpretation in PostScript) @@ -142,6 +144,11 @@ SkPath1DPathEffect::SkPath1DPathEffect(SkFlattenableReadBuffer& buffer) { fPath.unflatten(buffer); fInitialOffset = buffer.readScalar(); fStyle = (Style) buffer.readU8(); + } else { + SkDEBUGF(("SkPath1DPathEffect can't use advance <= 0\n")); + // Make Coverity happy. + fInitialOffset = 0; + fStyle = kStyleCount; } } diff --git a/src/effects/SkBlurDrawLooper.cpp b/src/effects/SkBlurDrawLooper.cpp index a44f081..656f8f7 100644 --- a/src/effects/SkBlurDrawLooper.cpp +++ b/src/effects/SkBlurDrawLooper.cpp @@ -14,7 +14,7 @@ SkBlurDrawLooper::SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags) - : fDx(dx), fDy(dy), fBlurColor(color), fBlurFlags(flags) { + : fDx(dx), fDy(dy), fBlurColor(color), fBlurFlags(flags), fState(kDone) { SkASSERT(flags <= kAll_BlurFlag); if (radius > 0) { diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 10c5c44..ab16218 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -31,7 +31,8 @@ extern void gr_run_unittests(); #define DEBUG_INVAL_START_IDX -1 GrGpu::GrGpu() - : fContext(NULL) + : fClipInStencil(false) + , fContext(NULL) , fResetTimestamp(kExpiredTimestamp+1) , fVertexPool(NULL) , fIndexPool(NULL) diff --git a/src/images/SkScaledBitmapSampler.cpp b/src/images/SkScaledBitmapSampler.cpp index 1af433d..15633d3 100644 --- a/src/images/SkScaledBitmapSampler.cpp +++ b/src/images/SkScaledBitmapSampler.cpp @@ -295,6 +295,10 @@ static bool Sample_Index_DI(void* SK_RESTRICT dstRow, SkScaledBitmapSampler::SkScaledBitmapSampler(int width, int height, int sampleSize) { + fCTable = NULL; + fDstRow = NULL; + fRowProc = NULL; + if (width <= 0 || height <= 0) { sk_throw(); } @@ -327,9 +331,6 @@ SkScaledBitmapSampler::SkScaledBitmapSampler(int width, int height, SkASSERT(fDX > 0 && (fX0 + fDX * (fScaledWidth - 1)) < width); SkASSERT(fDY > 0 && (fY0 + fDY * (fScaledHeight - 1)) < height); - - fRowProc = NULL; - fCTable = NULL; } bool SkScaledBitmapSampler::begin(SkBitmap* dst, SrcConfig sc, bool dither,