Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1510)

Unified Diff: Source/platform/exported/linux/WebFontInfo.cpp

Issue 472423002: Fix ttcIndex value checking logic and intialize vars (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@coreTextRemovalIncHalfWidth
Patch Set: -1 initialization Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/exported/linux/WebFontInfo.cpp
diff --git a/Source/platform/exported/linux/WebFontInfo.cpp b/Source/platform/exported/linux/WebFontInfo.cpp
index cb8a1da2afe884b25db113b24e381e3e686d33e3..70c3c330dde033402b59212dbde86c71a99177ce 100644
--- a/Source/platform/exported/linux/WebFontInfo.cpp
+++ b/Source/platform/exported/linux/WebFontInfo.cpp
@@ -70,7 +70,7 @@ public:
private:
static WebCString fontName(FcPattern* pattern)
{
- FcChar8* familyName;
+ FcChar8* familyName = nullptr;
if (FcPatternGetString(pattern, FC_FAMILY, 0, &familyName) != FcResultMatch)
return WebCString();
@@ -81,7 +81,7 @@ private:
static WebCString fontFilename(FcPattern* pattern)
{
- FcChar8* cFilename;
+ FcChar8* cFilename = nullptr;
if (FcPatternGetString(pattern, FC_FILE, 0, &cFilename) != FcResultMatch)
return WebCString();
const char* fontFilename = reinterpret_cast<char*>(cFilename);
@@ -90,15 +90,15 @@ private:
static int fontTtcIndex(FcPattern* pattern)
{
- int ttcIndex;
- if (FcPatternGetInteger(pattern, FC_INDEX, 0, &ttcIndex) != FcResultMatch && ttcIndex < 0)
+ int ttcIndex = -1;
+ if (FcPatternGetInteger(pattern, FC_INDEX, 0, &ttcIndex) != FcResultMatch || ttcIndex < 0)
return 0;
return ttcIndex;
}
static bool fontIsBold(FcPattern* pattern)
{
- int weight;
+ int weight = 0;
if (FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight) != FcResultMatch)
return false;
return weight >= FC_WEIGHT_BOLD;
@@ -106,7 +106,7 @@ private:
static bool fontIsItalic(FcPattern* pattern)
{
- int slant;
+ int slant = 0;
if (FcPatternGetInteger(pattern, FC_SLANT, 0, &slant) != FcResultMatch)
return false;
return slant != FC_SLANT_ROMAN;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698