aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-28 21:03:22 +0000
committerGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-28 21:03:22 +0000
commit6390c72cfb3e371a774a627d5f496dc67558e119 (patch)
tree8cbe4da51ed2b8d427ce099a429ce806ddddf1e3
parent5370cd969d8f3957e4306068e6195ac1bca3d6cd (diff)
Fix Coverity reports. (Mostly use of uninitialised values.)
CID=537,103419,103631,103632,103633 Initial review: https://codereview.appspot.com/5936047/ Review URL: https://codereview.appspot.com/5935051 git-svn-id: http://skia.googlecode.com/svn/trunk@3534 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/gpu/GrAAConvexPathRenderer.cpp5
-rw-r--r--src/ports/SkFontHost_FreeType.cpp4
-rw-r--r--src/ports/SkOSFile_stdio.cpp12
3 files changed, 13 insertions, 8 deletions
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 7638067f1a..c539060aac 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -53,10 +53,9 @@ typedef SkTArray<Segment, true> SegmentArray;
void center_of_mass(const SegmentArray& segments, SkPoint* c) {
GrScalar area = 0;
- SkPoint center;
- center.set(0, 0);
+ SkPoint center = {0, 0};
int count = segments.count();
- SkPoint p0;
+ SkPoint p0 = {0, 0};
if (count > 2) {
// We translate the polygon so that the first point is at the origin.
// This avoids some precision issues with small area polygons far away
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 55845dcadd..b16f781563 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -1024,7 +1024,7 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
return;
}
- SkFixed vLeft, vTop;
+ SkFixed vLeft = 0, vTop = 0;
switch ( fFace->glyph->format ) {
case FT_GLYPH_FORMAT_OUTLINE: {
@@ -1116,7 +1116,7 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
}
// bounding box of the unskewed and unscaled glyph
- FT_BBox bbox;
+ FT_BBox bbox = {0, 0, 0, 0}; // Suppress Coverity warning.
getBBoxForCurrentGlyph(glyph, &bbox);
// compute the vertical gap above and below the glyph if the glyph were
diff --git a/src/ports/SkOSFile_stdio.cpp b/src/ports/SkOSFile_stdio.cpp
index 764b466878..1254394431 100644
--- a/src/ports/SkOSFile_stdio.cpp
+++ b/src/ports/SkOSFile_stdio.cpp
@@ -36,10 +36,16 @@ size_t sk_fgetsize(SkFILE* f)
{
SkASSERT(f);
- size_t curr = ::ftell((FILE*)f); // remember where we are
+ long curr = ::ftell((FILE*)f); // remember where we are
+ if (curr < 0) {
+ return 0;
+ }
::fseek((FILE*)f, 0, SEEK_END); // go to the end
- size_t size = ::ftell((FILE*)f); // record the size
- ::fseek((FILE*)f, (long)curr, SEEK_SET); // go back to our prev loc
+ long size = ::ftell((FILE*)f); // record the size
+ if (size < 0) {
+ size = 0;
+ }
+ ::fseek((FILE*)f, curr, SEEK_SET); // go back to our prev loc
return size;
}