summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_font
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-14 22:22:13 -0700
committerLei Zhang <thestig@chromium.org>2015-08-14 22:22:13 -0700
commitda180e9fdd4385df024cc18046f62ca47bc74d74 (patch)
tree931e0e64ac2cbc82e3718e43418ee6bd676da4a5 /core/src/fpdfapi/fpdf_font
parent2b1a2d528469cda4e9f3e36d3c7a649e0d476480 (diff)
downloadpdfium-da180e9fdd4385df024cc18046f62ca47bc74d74.tar.xz
Merge to XFA: Don't bother checking pointers before delete[] and FX_Free().
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1297713003 . (cherry picked from commit cb62e7657b3a9a04142028a4e6614029a08e894b) Review URL: https://codereview.chromium.org/1287053005 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_font')
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.h60
3 files changed, 14 insertions, 62 deletions
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index 0107000dd9..8eae7cf3f8 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -30,9 +30,7 @@ CPDF_FontGlobals::CPDF_FontGlobals() : m_pContrastRamps(NULL) {
}
CPDF_FontGlobals::~CPDF_FontGlobals() {
ClearAll();
- if (m_pContrastRamps) {
- FX_Free(m_pContrastRamps);
- }
+ FX_Free(m_pContrastRamps);
}
class CFX_StockFontArray {
public:
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 3c8b2567fe..6c728242e6 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -301,15 +301,9 @@ CPDF_CMap::CPDF_CMap() {
m_nCodeRanges = 0;
}
CPDF_CMap::~CPDF_CMap() {
- if (m_pMapping) {
- FX_Free(m_pMapping);
- }
- if (m_pAddMapping) {
- FX_Free(m_pAddMapping);
- }
- if (m_pLeadingBytes) {
- FX_Free(m_pLeadingBytes);
- }
+ FX_Free(m_pMapping);
+ FX_Free(m_pAddMapping);
+ FX_Free(m_pLeadingBytes);
delete m_pUseMap;
}
void CPDF_CMap::Release() {
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
index 78de3f0a28..395544ddbf 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
@@ -49,11 +49,7 @@ class CFX_CTTGSUBTable {
ReqFeatureIndex(0),
FeatureCount(0),
FeatureIndex(NULL) {}
- ~TLangSys() {
- if (FeatureIndex) {
- delete[] FeatureIndex;
- }
- }
+ ~TLangSys() { delete[] FeatureIndex; }
private:
TLangSys(const TLangSys&);
@@ -73,11 +69,7 @@ class CFX_CTTGSUBTable {
TT_uint16_t LangSysCount;
struct TLangSysRecord* LangSysRecord;
TScript() : DefaultLangSys(0), LangSysCount(0), LangSysRecord(NULL) {}
- ~TScript() {
- if (LangSysRecord) {
- delete[] LangSysRecord;
- }
- }
+ ~TScript() { delete[] LangSysRecord; }
private:
TScript(const TScript&);
@@ -96,11 +88,7 @@ class CFX_CTTGSUBTable {
TT_uint16_t ScriptCount;
struct TScriptRecord* ScriptRecord;
TScriptList() : ScriptCount(0), ScriptRecord(NULL) {}
- ~TScriptList() {
- if (ScriptRecord) {
- delete[] ScriptRecord;
- }
- }
+ ~TScriptList() { delete[] ScriptRecord; }
private:
TScriptList(const TScriptList&);
@@ -111,11 +99,7 @@ class CFX_CTTGSUBTable {
int LookupCount;
TT_uint16_t* LookupListIndex;
TFeature() : FeatureParams(0), LookupCount(0), LookupListIndex(NULL) {}
- ~TFeature() {
- if (LookupListIndex) {
- delete[] LookupListIndex;
- }
- }
+ ~TFeature() { delete[] LookupListIndex; }
private:
TFeature(const TFeature&);
@@ -134,11 +118,7 @@ class CFX_CTTGSUBTable {
int FeatureCount;
struct TFeatureRecord* FeatureRecord;
TFeatureList() : FeatureCount(0), FeatureRecord(NULL) {}
- ~TFeatureList() {
- if (FeatureRecord) {
- delete[] FeatureRecord;
- }
- }
+ ~TFeatureList() { delete[] FeatureRecord; }
private:
TFeatureList(const TFeatureList&);
@@ -166,11 +146,7 @@ class CFX_CTTGSUBTable {
TT_uint16_t GlyphCount;
TT_uint16_t* GlyphArray;
TCoverageFormat1() : GlyphCount(0), GlyphArray(NULL) { CoverageFormat = 1; }
- ~TCoverageFormat1() override {
- if (GlyphArray) {
- delete[] GlyphArray;
- }
- }
+ ~TCoverageFormat1() override { delete[] GlyphArray; }
private:
TCoverageFormat1(const TCoverageFormat1&);
@@ -194,11 +170,7 @@ class CFX_CTTGSUBTable {
TCoverageFormat2() : RangeCount(0), RangeRecord(NULL) {
CoverageFormat = 2;
}
- ~TCoverageFormat2() override {
- if (RangeRecord) {
- delete[] RangeRecord;
- }
- }
+ ~TCoverageFormat2() override { delete[] RangeRecord; }
private:
TCoverageFormat2(const TCoverageFormat2&);
@@ -220,11 +192,7 @@ class CFX_CTTGSUBTable {
TClassDefFormat1() : StartGlyph(0), GlyphCount(0), ClassValueArray(NULL) {
ClassFormat = 1;
}
- ~TClassDefFormat1() override {
- if (ClassValueArray) {
- delete[] ClassValueArray;
- }
- }
+ ~TClassDefFormat1() override { delete[] ClassValueArray; }
private:
TClassDefFormat1(const TClassDefFormat1&);
@@ -246,11 +214,7 @@ class CFX_CTTGSUBTable {
TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(NULL) {
ClassFormat = 2;
}
- ~TClassDefFormat2() override {
- if (ClassRangeRecord) {
- delete[] ClassRangeRecord;
- }
- }
+ ~TClassDefFormat2() override { delete[] ClassRangeRecord; }
private:
TClassDefFormat2(const TClassDefFormat2&);
@@ -325,11 +289,7 @@ class CFX_CTTGSUBTable {
int LookupCount;
struct TLookup* Lookup;
TLookupList() : LookupCount(0), Lookup(NULL) {}
- ~TLookupList() {
- if (Lookup) {
- delete[] Lookup;
- }
- }
+ ~TLookupList() { delete[] Lookup; }
private:
TLookupList(const TLookupList&);