summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp6
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp10
-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
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp34
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp34
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp9
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp9
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp4
-rw-r--r--core/src/fpdftext/fpdf_text.cpp4
-rw-r--r--core/src/fxcodec/codec/codec_int.h4
-rw-r--r--core/src/fxcodec/codec/fx_codec.cpp8
-rw-r--r--core/src/fxcodec/codec/fx_codec_fax.cpp16
-rw-r--r--core/src/fxcodec/codec/fx_codec_flate.cpp16
-rw-r--r--core/src/fxcodec/codec/fx_codec_icc.cpp4
-rw-r--r--core/src/fxcodec/codec/fx_codec_jbig.cpp12
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpeg.cpp8
-rw-r--r--core/src/fxcrt/fx_basic_buffer.cpp14
-rw-r--r--core/src/fxcrt/fx_basic_maps.cpp18
-rw-r--r--core/src/fxcrt/xml_int.h6
-rw-r--r--core/src/fxge/android/fpf_skiafontmgr.h20
-rw-r--r--core/src/fxge/dib/dib_int.h4
-rw-r--r--core/src/fxge/dib/fx_dib_composite.cpp24
-rw-r--r--core/src/fxge/dib/fx_dib_convert.cpp44
-rw-r--r--core/src/fxge/dib/fx_dib_engine.cpp30
-rw-r--r--core/src/fxge/dib/fx_dib_main.cpp22
-rw-r--r--core/src/fxge/ge/fx_ge_font.cpp18
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp4
-rw-r--r--core/src/fxge/ge/fx_ge_path.cpp25
-rw-r--r--core/src/fxge/ge/fx_ge_ps.cpp4
-rw-r--r--core/src/fxge/win32/fx_win32_device.cpp4
-rw-r--r--core/src/fxge/win32/fx_win32_print.cpp4
39 files changed, 147 insertions, 420 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index ff0539c61f..668c70b243 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -403,7 +403,7 @@ CPDF_FlateEncoder::~CPDF_FlateEncoder() {
if (m_bCloned && m_pDict) {
m_pDict->Release();
}
- if (m_bNewData && m_pData) {
+ if (m_bNewData) {
FX_Free(m_pData);
}
}
@@ -2054,9 +2054,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) {
CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD));
m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument);
}
- if (pBuffer) {
- FX_Free(pBuffer);
- }
+ FX_Free(pBuffer);
}
if (!bDefault) {
return;
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
index 9ea94bdd00..488d8393c7 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -278,10 +278,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
pDict->Release();
pDict = NULL;
}
- if (dest_buf) {
- FX_Free(dest_buf);
- dest_buf = NULL;
- }
+ FX_Free(dest_buf);
+ dest_buf = NULL;
dest_size = 0;
delete pNewBitmap;
return;
@@ -380,9 +378,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
m_bIsMask = pBitmap->IsAlphaMask();
m_Width = BitmapWidth;
m_Height = BitmapHeight;
- if (dest_buf) {
- FX_Free(dest_buf);
- }
+ FX_Free(dest_buf);
}
void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) {
pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap);
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&);
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index 0421aba2d5..f6f03336a0 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -95,12 +95,10 @@ CPDF_TextObject::CPDF_TextObject()
}
CPDF_TextObject::~CPDF_TextObject() {
- if (m_nChars > 1 && m_pCharCodes) {
+ if (m_nChars > 1) {
FX_Free(m_pCharCodes);
}
- if (m_pCharPos) {
- FX_Free(m_pCharPos);
- }
+ FX_Free(m_pCharPos);
}
void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const {
@@ -186,14 +184,12 @@ void CPDF_TextObject::GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const {
void CPDF_TextObject::CopyData(const CPDF_PageObject* pSrc) {
const CPDF_TextObject* pSrcObj = (const CPDF_TextObject*)pSrc;
- if (m_nChars > 1 && m_pCharCodes) {
+ if (m_nChars > 1) {
FX_Free(m_pCharCodes);
m_pCharCodes = nullptr;
}
- if (m_pCharPos) {
- FX_Free(m_pCharPos);
- m_pCharPos = nullptr;
- }
+ FX_Free(m_pCharPos);
+ m_pCharPos = nullptr;
m_nChars = pSrcObj->m_nChars;
if (m_nChars > 1) {
m_pCharCodes = FX_Alloc(FX_DWORD, m_nChars);
@@ -220,14 +216,12 @@ void CPDF_TextObject::GetTextMatrix(CFX_AffineMatrix* pMatrix) const {
void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
FX_FLOAT* pKerning,
int nsegs) {
- if (m_nChars > 1 && m_pCharCodes) {
+ if (m_nChars > 1) {
FX_Free(m_pCharCodes);
m_pCharCodes = nullptr;
}
- if (m_pCharPos) {
- FX_Free(m_pCharPos);
- m_pCharPos = nullptr;
- }
+ FX_Free(m_pCharPos);
+ m_pCharPos = nullptr;
CPDF_Font* pFont = m_TextState.GetFont();
m_nChars = 0;
for (int i = 0; i < nsegs; ++i) {
@@ -262,10 +256,10 @@ void CPDF_TextObject::SetText(const CFX_ByteString& str) {
}
void CPDF_TextObject::SetEmpty() {
- if (m_nChars > 1 && m_pCharCodes) {
+ if (m_nChars > 1) {
FX_Free(m_pCharCodes);
}
- if (m_nChars > 1 && m_pCharPos) {
+ if (m_nChars > 1) {
FX_Free(m_pCharPos);
}
m_nChars = 0;
@@ -285,14 +279,12 @@ void CPDF_TextObject::SetText(CFX_ByteString* pStrs,
void CPDF_TextObject::SetText(int nChars,
FX_DWORD* pCharCodes,
FX_FLOAT* pKernings) {
- if (m_nChars > 1 && m_pCharCodes) {
+ if (m_nChars > 1) {
FX_Free(m_pCharCodes);
m_pCharCodes = nullptr;
}
- if (m_pCharPos) {
- FX_Free(m_pCharPos);
- m_pCharPos = nullptr;
- }
+ FX_Free(m_pCharPos);
+ m_pCharPos = nullptr;
int nKernings = 0;
int i;
for (i = 0; i < nChars - 1; ++i) {
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index cc6c9e9d56..a3fef3df82 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -671,12 +671,8 @@ class CPDF_ICCBasedCS : public CPDF_ColorSpace {
};
CPDF_ICCBasedCS::~CPDF_ICCBasedCS() {
- if (m_pCache) {
- FX_Free(m_pCache);
- }
- if (m_pRanges) {
- FX_Free(m_pRanges);
- }
+ FX_Free(m_pCache);
+ FX_Free(m_pRanges);
if (m_pAlterCS && m_bOwn) {
m_pAlterCS->ReleaseCS();
}
@@ -882,9 +878,7 @@ class CPDF_IndexedCS : public CPDF_ColorSpace {
FX_FLOAT* m_pCompMinMax;
};
CPDF_IndexedCS::~CPDF_IndexedCS() {
- if (m_pCompMinMax) {
- FX_Free(m_pCompMinMax);
- }
+ FX_Free(m_pCompMinMax);
CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : NULL;
if (pCS && m_pDocument) {
m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
@@ -1460,9 +1454,7 @@ void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps) {
return;
}
if (m_pCS == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) {
- if (m_pBuffer) {
- FX_Free(m_pBuffer);
- }
+ FX_Free(m_pBuffer);
m_pCS = CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN);
m_pBuffer = m_pCS->CreateBuf();
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index 1ee062ee7c..8c909a9e68 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -487,12 +487,8 @@ CPDF_SampledFunc::CPDF_SampledFunc() {
}
CPDF_SampledFunc::~CPDF_SampledFunc() {
delete m_pSampleStream;
- if (m_pEncodeInfo) {
- FX_Free(m_pEncodeInfo);
- }
- if (m_pDecodeInfo) {
- FX_Free(m_pDecodeInfo);
- }
+ FX_Free(m_pEncodeInfo);
+ FX_Free(m_pDecodeInfo);
}
FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
if (pObj->GetType() != PDFOBJ_STREAM) {
@@ -678,12 +674,8 @@ CPDF_ExpIntFunc::CPDF_ExpIntFunc() {
m_pEndValues = NULL;
}
CPDF_ExpIntFunc::~CPDF_ExpIntFunc() {
- if (m_pBeginValues) {
FX_Free(m_pBeginValues);
- }
- if (m_pEndValues) {
FX_Free(m_pEndValues);
- }
}
FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
@@ -747,15 +739,9 @@ CPDF_StitchFunc::CPDF_StitchFunc() {
CPDF_StitchFunc::~CPDF_StitchFunc() {
for (int i = 0; i < m_nSubs; i++)
delete m_pSubFunctions[i];
- if (m_pSubFunctions) {
- FX_Free(m_pSubFunctions);
- }
- if (m_pBounds) {
- FX_Free(m_pBounds);
- }
- if (m_pEncode) {
- FX_Free(m_pEncode);
- }
+ FX_Free(m_pSubFunctions);
+ FX_Free(m_pBounds);
+ FX_Free(m_pEncode);
}
FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
@@ -859,14 +845,8 @@ CPDF_Function::CPDF_Function() {
m_pRanges = NULL;
}
CPDF_Function::~CPDF_Function() {
- if (m_pDomains) {
- FX_Free(m_pDomains);
- m_pDomains = NULL;
- }
- if (m_pRanges) {
- FX_Free(m_pRanges);
- m_pRanges = NULL;
- }
+ FX_Free(m_pDomains);
+ FX_Free(m_pRanges);
}
FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index e010a28b02..f11a2bb8d1 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -31,14 +31,10 @@ CPDF_ClipPathData::CPDF_ClipPathData() {
CPDF_ClipPathData::~CPDF_ClipPathData() {
int i;
delete[] m_pPathList;
- if (m_pTypeList) {
- FX_Free(m_pTypeList);
- }
+ FX_Free(m_pTypeList);
for (i = m_TextCount - 1; i > -1; i--)
delete m_pTextList[i];
- if (m_pTextList) {
- FX_Free(m_pTextList);
- }
+ FX_Free(m_pTextList);
}
CPDF_ClipPathData::CPDF_ClipPathData(const CPDF_ClipPathData& src) {
m_pPathList = NULL;
@@ -148,9 +144,7 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge) {
delete[] pData->m_pPathList;
uint8_t* pNewType = FX_Alloc(uint8_t, pData->m_PathCount + 8);
FXSYS_memcpy(pNewType, pData->m_pTypeList, pData->m_PathCount);
- if (pData->m_pTypeList) {
- FX_Free(pData->m_pTypeList);
- }
+ FX_Free(pData->m_pTypeList);
pData->m_pPathList = pNewPath;
pData->m_pTypeList = pNewType;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 47ba46a0f3..059dd4c2a6 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -83,9 +83,7 @@ CPDF_StreamContentParser::~CPDF_StreamContentParser() {
for (int i = 0; i < m_StateStack.GetSize(); ++i) {
delete (CPDF_AllStates*)m_StateStack[i];
}
- if (m_pPathPoints) {
- FX_Free(m_pPathPoints);
- }
+ FX_Free(m_pPathPoints);
if (m_pLastImageDict) {
m_pLastImageDict->Release();
}
@@ -1087,9 +1085,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill() {
} else {
m_pCurStates->m_ColorState.SetFillColor(NULL, values, nvalues);
}
- if (values) {
- FX_Free(values);
- }
+ FX_Free(values);
}
void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() {
if (m_Options.m_bTextOnly) {
@@ -1119,9 +1115,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() {
} else {
m_pCurStates->m_ColorState.SetStrokeColor(NULL, values, nvalues);
}
- if (values) {
- FX_Free(values);
- }
+ FX_Free(values);
}
CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream,
int type,
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 78169614bd..48e9b98d3a 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -439,9 +439,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
pDict->RemoveAt(FX_BSTRC("DecodeParms"));
}
} else {
- if (pData) {
- FX_Free(pData);
- }
+ FX_Free(pData);
FX_DWORD dwSavePos = m_Pos;
m_Pos += dwStreamSize;
while (1) {
@@ -960,9 +958,8 @@ void CPDF_ContentParser::Clear() {
delete m_pStreamArray[i];
FX_Free(m_pStreamArray);
}
- if (m_pData && m_pSingleStream == NULL) {
- FX_Free((void*)m_pData);
- }
+ if (!m_pSingleStream)
+ FX_Free(m_pData);
m_pParser = NULL;
m_pStreamArray = NULL;
m_pSingleStream = NULL;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index 55e648a054..125b7e0bf5 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -1040,7 +1040,5 @@ CPDF_StandardCryptoHandler::CPDF_StandardCryptoHandler() {
m_KeyLen = 0;
}
CPDF_StandardCryptoHandler::~CPDF_StandardCryptoHandler() {
- if (m_pAESContext) {
- FX_Free(m_pAESContext);
- }
+ FX_Free(m_pAESContext);
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index 3830ad68a3..9227536ec7 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -828,7 +828,7 @@ CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict)
m_pCryptoHandler = NULL;
}
CPDF_Stream::~CPDF_Stream() {
- if (m_GenNum == (FX_DWORD)-1 && m_pDataBuf != NULL) {
+ if (m_GenNum == (FX_DWORD)-1) {
FX_Free(m_pDataBuf);
}
if (m_pDict) {
@@ -843,9 +843,7 @@ void CPDF_Stream::InitStream(CPDF_Dictionary* pDict) {
m_pDict = pDict;
}
if (m_GenNum == (FX_DWORD)-1) {
- if (m_pDataBuf) {
- FX_Free(m_pDataBuf);
- }
+ FX_Free(m_pDataBuf);
}
m_GenNum = 0;
m_pFile = NULL;
@@ -871,9 +869,7 @@ void CPDF_Stream::SetData(const uint8_t* pData,
FX_BOOL bCompressed,
FX_BOOL bKeepBuf) {
if (m_GenNum == (FX_DWORD)-1) {
- if (m_pDataBuf) {
- FX_Free(m_pDataBuf);
- }
+ FX_Free(m_pDataBuf);
} else {
m_GenNum = (FX_DWORD)-1;
m_pCryptoHandler = NULL;
@@ -1070,12 +1066,10 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
m_bNewBuf = m_pData != pStream->m_pDataBuf;
}
CPDF_StreamAcc::~CPDF_StreamAcc() {
- if (m_bNewBuf && m_pData) {
+ if (m_bNewBuf) {
FX_Free(m_pData);
}
- if (m_pSrcData) {
- FX_Free(m_pSrcData);
- }
+ FX_Free(m_pSrcData);
}
const uint8_t* CPDF_StreamAcc::GetData() const {
if (m_bNewBuf) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 74eabe1396..a12a2894a5 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -1732,9 +1732,7 @@ CPDF_SyntaxParser::CPDF_SyntaxParser() {
m_bFileStream = FALSE;
}
CPDF_SyntaxParser::~CPDF_SyntaxParser() {
- if (m_pFileBuf) {
- FX_Free(m_pFileBuf);
- }
+ FX_Free(m_pFileBuf);
}
FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) {
FX_FILESIZE save_pos = m_Pos;
@@ -2589,10 +2587,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
}
void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess,
FX_DWORD HeaderOffset) {
- if (m_pFileBuf) {
- FX_Free(m_pFileBuf);
- m_pFileBuf = NULL;
- }
+ FX_Free(m_pFileBuf);
m_pFileBuf = FX_Alloc(uint8_t, m_BufSize);
m_HeaderOffset = HeaderOffset;
m_FileLen = pFileAccess->GetSize();
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index e066957e62..8a614810df 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -182,17 +182,11 @@ CPDF_DIBSource::CPDF_DIBSource() {
}
CPDF_DIBSource::~CPDF_DIBSource() {
delete m_pStreamAcc;
- if (m_pMaskedLine) {
- FX_Free(m_pMaskedLine);
- }
- if (m_pLineBuf) {
- FX_Free(m_pLineBuf);
- }
+ FX_Free(m_pMaskedLine);
+ FX_Free(m_pLineBuf);
m_pCachedBitmap.reset();
delete m_pDecoder;
- if (m_pCompData) {
- FX_Free(m_pCompData);
- }
+ FX_Free(m_pCompData);
CPDF_ColorSpace* pCS = m_pColorSpace;
if (pCS && m_pDocument) {
m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 7d6921f544..d36125e1b8 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -531,9 +531,7 @@ CPDF_CharPosList::CPDF_CharPosList() {
m_pCharPos = NULL;
}
CPDF_CharPosList::~CPDF_CharPosList() {
- if (m_pCharPos) {
- FX_Free(m_pCharPos);
- }
+ FX_Free(m_pCharPos);
}
void CPDF_CharPosList::Load(int nChars,
FX_DWORD* pCharCodes,
diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp
index 52fcb5abd7..e7ca6c136f 100644
--- a/core/src/fpdftext/fpdf_text.cpp
+++ b/core/src/fpdftext/fpdf_text.cpp
@@ -104,9 +104,7 @@ void CTextPage::ProcessObject(CPDF_PageObject* pObject) {
InsertTextBox(NULL, char_origy, char_left, char_right, char_top,
char_bottom, spacew, fontsize_v, str, pFont);
}
- if (pPosArray) {
- FX_Free(pPosArray);
- }
+ FX_Free(pPosArray);
return;
}
FX_FLOAT ratio_h = fontsize_h / pText->m_TextState.GetFontSize();
diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h
index 9fe77a44f7..e7baa585f9 100644
--- a/core/src/fxcodec/codec/codec_int.h
+++ b/core/src/fxcodec/codec/codec_int.h
@@ -54,9 +54,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder {
int GetBPC() override { return m_bpc; }
FX_BOOL IsColorTransformed() override { return m_bColorTransformed; }
void ClearImageData() override {
- if (m_pDataCache) {
- FX_Free(m_pDataCache);
- }
+ FX_Free(m_pDataCache);
m_pDataCache = NULL;
}
diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp
index 4ed02dc2c0..0d89ea6e98 100644
--- a/core/src/fxcodec/codec/fx_codec.cpp
+++ b/core/src/fxcodec/codec/fx_codec.cpp
@@ -20,9 +20,7 @@ CCodec_ScanlineDecoder::CCodec_ScanlineDecoder() {
m_pLastScanline = NULL;
}
CCodec_ScanlineDecoder::~CCodec_ScanlineDecoder() {
- if (m_pDataCache) {
- FX_Free(m_pDataCache);
- }
+ FX_Free(m_pDataCache);
}
uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) {
if (m_pDataCache && line < m_pDataCache->m_nCachedLines) {
@@ -254,9 +252,7 @@ CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder()
m_bEOD(FALSE),
m_Operator(0) {}
CCodec_RLScanlineDecoder::~CCodec_RLScanlineDecoder() {
- if (m_pScanline) {
- FX_Free(m_pScanline);
- }
+ FX_Free(m_pScanline);
}
FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() {
FX_DWORD i = 0;
diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp
index 34c07ac484..63a45c7aea 100644
--- a/core/src/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/src/fxcodec/codec/fx_codec_fax.cpp
@@ -491,12 +491,8 @@ CCodec_FaxDecoder::CCodec_FaxDecoder() {
m_pRefBuf = NULL;
}
CCodec_FaxDecoder::~CCodec_FaxDecoder() {
- if (m_pScanlineBuf) {
- FX_Free(m_pScanlineBuf);
- }
- if (m_pRefBuf) {
- FX_Free(m_pRefBuf);
- }
+ FX_Free(m_pScanlineBuf);
+ FX_Free(m_pRefBuf);
}
FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf,
FX_DWORD src_size,
@@ -770,12 +766,8 @@ CCodec_FaxEncoder::CCodec_FaxEncoder(const uint8_t* src_buf,
m_DestBuf.EstimateSize(0, 10240);
}
CCodec_FaxEncoder::~CCodec_FaxEncoder() {
- if (m_pRefLine) {
- FX_Free(m_pRefLine);
- }
- if (m_pLineBuf) {
- FX_Free(m_pLineBuf);
- }
+ FX_Free(m_pRefLine);
+ FX_Free(m_pLineBuf);
}
void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size) {
int dest_bitpos = 0;
diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp
index a4b37c1ca3..e8878e4535 100644
--- a/core/src/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/src/fxcodec/codec/fx_codec_flate.cpp
@@ -647,18 +647,10 @@ CCodec_FlateScanlineDecoder::CCodec_FlateScanlineDecoder() {
m_LeftOver = 0;
}
CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() {
- if (m_pScanline) {
- FX_Free(m_pScanline);
- }
- if (m_pLastLine) {
- FX_Free(m_pLastLine);
- }
- if (m_pPredictBuffer) {
- FX_Free(m_pPredictBuffer);
- }
- if (m_pPredictRaw) {
- FX_Free(m_pPredictRaw);
- }
+ FX_Free(m_pScanline);
+ FX_Free(m_pLastLine);
+ FX_Free(m_pPredictBuffer);
+ FX_Free(m_pPredictRaw);
if (m_pFlate) {
FPDFAPI_FlateEnd(m_pFlate);
}
diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp
index 856766e4ea..dad880a936 100644
--- a/core/src/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/src/fxcodec/codec/fx_codec_icc.cpp
@@ -392,9 +392,7 @@ CFX_IccTransformCache::~CFX_IccTransformCache() {
if (m_pIccTransform) {
cmsDeleteTransform(m_pIccTransform);
}
- if (m_pCmm) {
- FX_Free(m_pCmm);
- }
+ FX_Free(m_pCmm);
}
void CFX_IccTransformCache::Purge() {}
class CFX_ByteStringKey : public CFX_BinaryBuf {
diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp
index 9d78bba3bb..1551060b60 100644
--- a/core/src/fxcodec/codec/fx_codec_jbig.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp
@@ -82,9 +82,7 @@ FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr,
FX_Free(src_buf);
return TRUE;
failed:
- if (src_buf) {
- FX_Free(src_buf);
- }
+ FX_Free(src_buf);
return FALSE;
}
FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context,
@@ -188,9 +186,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context,
FX_Free(m_pJbig2Context->m_src_buf);
return FXCODEC_STATUS_DECODE_FINISH;
failed:
- if (m_pJbig2Context->m_src_buf) {
- FX_Free(m_pJbig2Context->m_src_buf);
- }
+ FX_Free(m_pJbig2Context->m_src_buf);
m_pJbig2Context->m_src_buf = NULL;
return FXCODEC_STATUS_ERROR;
}
@@ -206,9 +202,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode(void* pJbig2Context,
CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext);
m_pJbig2Context->m_pContext = NULL;
if (ret != JBIG2_SUCCESS) {
- if (m_pJbig2Context->m_src_buf) {
- FX_Free(m_pJbig2Context->m_src_buf);
- }
+ FX_Free(m_pJbig2Context->m_src_buf);
m_pJbig2Context->m_src_buf = NULL;
return FXCODEC_STATUS_ERROR;
}
diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
index 779e7f6b37..7e95bd358f 100644
--- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
@@ -221,9 +221,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource,
}
jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo);
- if (line_buf) {
- FX_Free(line_buf);
- }
+ FX_Free(line_buf);
dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer;
}
static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf,
@@ -345,9 +343,7 @@ CCodec_JpegDecoder::~CCodec_JpegDecoder() {
m_pExtProvider->DestroyDecoder(m_pExtContext);
return;
}
- if (m_pScanlineBuf) {
- FX_Free(m_pScanlineBuf);
- }
+ FX_Free(m_pScanlineBuf);
if (m_bInited) {
jpeg_destroy_decompress(&cinfo);
}
diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp
index deb8133489..d993e5e567 100644
--- a/core/src/fxcrt/fx_basic_buffer.cpp
+++ b/core/src/fxcrt/fx_basic_buffer.cpp
@@ -13,9 +13,7 @@ CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size)
m_pBuffer = FX_Alloc(uint8_t, size);
}
CFX_BinaryBuf::~CFX_BinaryBuf() {
- if (m_pBuffer) {
- FX_Free(m_pBuffer);
- }
+ FX_Free(m_pBuffer);
}
void CFX_BinaryBuf::Delete(int start_index, int count) {
if (!m_pBuffer || start_index < 0 || start_index + count > m_DataSize) {
@@ -34,9 +32,7 @@ void CFX_BinaryBuf::DetachBuffer() {
m_AllocSize = 0;
}
void CFX_BinaryBuf::AttachData(void* buffer, FX_STRSIZE size) {
- if (m_pBuffer) {
- FX_Free(m_pBuffer);
- }
+ FX_Free(m_pBuffer);
m_DataSize = size;
m_pBuffer = (uint8_t*)buffer;
m_AllocSize = size;
@@ -258,10 +254,8 @@ IFX_BufferArchive::IFX_BufferArchive(FX_STRSIZE size)
: m_BufSize(size), m_pBuffer(NULL), m_Length(0) {}
void IFX_BufferArchive::Clear() {
m_Length = 0;
- if (m_pBuffer) {
- FX_Free(m_pBuffer);
- m_pBuffer = NULL;
- }
+ FX_Free(m_pBuffer);
+ m_pBuffer = NULL;
}
FX_BOOL IFX_BufferArchive::Flush() {
FX_BOOL bRet = DoWork(m_pBuffer, m_Length);
diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp
index 14a681b832..1558ae6f75 100644
--- a/core/src/fxcrt/fx_basic_maps.cpp
+++ b/core/src/fxcrt/fx_basic_maps.cpp
@@ -23,10 +23,8 @@ CFX_MapPtrToPtr::CFX_MapPtrToPtr(int nBlockSize)
ASSERT(m_nBlockSize > 0);
}
void CFX_MapPtrToPtr::RemoveAll() {
- if (m_pHashTable) {
- FX_Free(m_pHashTable);
- m_pHashTable = NULL;
- }
+ FX_Free(m_pHashTable);
+ m_pHashTable = NULL;
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks->FreeDataChain();
@@ -134,10 +132,8 @@ CFX_MapPtrToPtr::CAssoc* CFX_MapPtrToPtr::NewAssoc() {
void CFX_MapPtrToPtr::InitHashTable(FX_DWORD nHashSize, FX_BOOL bAllocNow) {
ASSERT(m_nCount == 0);
ASSERT(nHashSize > 0);
- if (m_pHashTable != NULL) {
- FX_Free(m_pHashTable);
- m_pHashTable = NULL;
- }
+ FX_Free(m_pHashTable);
+ m_pHashTable = NULL;
if (bAllocNow) {
m_pHashTable = FX_Alloc(CAssoc*, nHashSize);
}
@@ -321,10 +317,8 @@ void CFX_MapByteStringToPtr::InitHashTable(FX_DWORD nHashSize,
FX_BOOL bAllocNow) {
ASSERT(m_nCount == 0);
ASSERT(nHashSize > 0);
- if (m_pHashTable != NULL) {
- FX_Free(m_pHashTable);
- m_pHashTable = NULL;
- }
+ FX_Free(m_pHashTable);
+ m_pHashTable = NULL;
if (bAllocNow) {
m_pHashTable = FX_Alloc(CAssoc*, nHashSize);
}
diff --git a/core/src/fxcrt/xml_int.h b/core/src/fxcrt/xml_int.h
index 6020f45819..ccd5bfdb7d 100644
--- a/core/src/fxcrt/xml_int.h
+++ b/core/src/fxcrt/xml_int.h
@@ -47,11 +47,7 @@ class CXML_DataStmAcc : public IFX_BufferRead {
: m_pFileRead(pFileRead), m_pBuffer(NULL), m_nStart(0), m_dwSize(0) {
FXSYS_assert(m_pFileRead != NULL);
}
- ~CXML_DataStmAcc() override {
- if (m_pBuffer) {
- FX_Free(m_pBuffer);
- }
- }
+ ~CXML_DataStmAcc() override { FX_Free(m_pBuffer); }
void Release() override { delete this; }
FX_BOOL IsEOF() override {
diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h
index 17bcb48ca1..0b33627cf3 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.h
+++ b/core/src/fxge/android/fpf_skiafontmgr.h
@@ -24,18 +24,12 @@ class CFPF_SkiaFontDescriptor {
m_iFaceIndex(0),
m_dwCharsets(0),
m_iGlyphNum(0) {}
- virtual ~CFPF_SkiaFontDescriptor() {
- if (m_pFamily) {
- FX_Free(m_pFamily);
- }
- }
+ virtual ~CFPF_SkiaFontDescriptor() { FX_Free(m_pFamily); }
virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; }
void SetFamily(const FX_CHAR* pFamily) {
- if (m_pFamily) {
- FX_Free(m_pFamily);
- }
+ FX_Free(m_pFamily);
int32_t iSize = FXSYS_strlen(pFamily);
m_pFamily = FX_Alloc(FX_CHAR, iSize + 1);
FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(FX_CHAR));
@@ -51,19 +45,13 @@ class CFPF_SkiaFontDescriptor {
class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor {
public:
CFPF_SkiaPathFont() : m_pPath(NULL) {}
- ~CFPF_SkiaPathFont() override {
- if (m_pPath) {
- FX_Free(m_pPath);
- }
- }
+ ~CFPF_SkiaPathFont() override { FX_Free(m_pPath); }
// CFPF_SkiaFontDescriptor
int32_t GetType() const override { return FPF_SKIAFONTTYPE_Path; }
void SetPath(const FX_CHAR* pPath) {
- if (m_pPath) {
- FX_Free(m_pPath);
- }
+ FX_Free(m_pPath);
int32_t iSize = FXSYS_strlen(pPath);
m_pPath = FX_Alloc(FX_CHAR, iSize + 1);
FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(FX_CHAR));
diff --git a/core/src/fxge/dib/dib_int.h b/core/src/fxge/dib/dib_int.h
index 74e77d46da..d40e3a4f95 100644
--- a/core/src/fxge/dib/dib_int.h
+++ b/core/src/fxge/dib/dib_int.h
@@ -35,9 +35,7 @@ class CWeightTable {
public:
CWeightTable() { m_pWeightTables = NULL; }
~CWeightTable() {
- if (m_pWeightTables) {
- FX_Free(m_pWeightTables);
- }
+ FX_Free(m_pWeightTables);
m_pWeightTables = NULL;
}
void Calc(int dest_len,
diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp
index 84062d80b1..89a52f3dba 100644
--- a/core/src/fxge/dib/fx_dib_composite.cpp
+++ b/core/src/fxge/dib/fx_dib_composite.cpp
@@ -4193,12 +4193,8 @@ CFX_ScanlineCompositor::CFX_ScanlineCompositor() {
m_BlendType = FXDIB_BLEND_NORMAL;
}
CFX_ScanlineCompositor::~CFX_ScanlineCompositor() {
- if (m_pSrcPalette) {
- FX_Free(m_pSrcPalette);
- }
- if (m_pCacheScanline) {
- FX_Free(m_pCacheScanline);
- }
+ FX_Free(m_pSrcPalette);
+ FX_Free(m_pCacheScanline);
}
FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format,
FXDIB_Format src_format,
@@ -5010,18 +5006,10 @@ CFX_BitmapComposer::CFX_BitmapComposer() {
m_BlendType = FXDIB_BLEND_NORMAL;
}
CFX_BitmapComposer::~CFX_BitmapComposer() {
- if (m_pScanlineV) {
- FX_Free(m_pScanlineV);
- }
- if (m_pScanlineAlphaV) {
- FX_Free(m_pScanlineAlphaV);
- }
- if (m_pClipScanV) {
- FX_Free(m_pClipScanV);
- }
- if (m_pAddClipScan) {
- FX_Free(m_pAddClipScan);
- }
+ FX_Free(m_pScanlineV);
+ FX_Free(m_pScanlineAlphaV);
+ FX_Free(m_pClipScanV);
+ FX_Free(m_pAddClipScan);
}
void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest,
const CFX_ClipRgn* pClipRgn,
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp
index 74818f4a1b..4b50a0cdf3 100644
--- a/core/src/fxge/dib/fx_dib_convert.cpp
+++ b/core/src/fxge/dib/fx_dib_convert.cpp
@@ -202,36 +202,24 @@ CFX_Palette::CFX_Palette() {
m_lut = 0;
}
CFX_Palette::~CFX_Palette() {
- if (m_pPalette) {
- FX_Free(m_pPalette);
- }
- if (m_cLut) {
- FX_Free(m_cLut);
- }
- if (m_aLut) {
- FX_Free(m_aLut);
- }
+ FX_Free(m_pPalette);
+ FX_Free(m_cLut);
+ FX_Free(m_aLut);
m_lut = 0;
}
FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) {
if (pBitmap == NULL) {
return FALSE;
}
- if (m_pPalette != NULL) {
- FX_Free(m_pPalette);
- }
+ FX_Free(m_pPalette);
m_pPalette = FX_Alloc(FX_DWORD, 256);
int bpp = pBitmap->GetBPP() / 8;
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
- if (m_cLut) {
- FX_Free(m_cLut);
- m_cLut = NULL;
- }
- if (m_aLut) {
- FX_Free(m_aLut);
- m_aLut = NULL;
- }
+ FX_Free(m_cLut);
+ m_cLut = NULL;
+ FX_Free(m_aLut);
+ m_aLut = NULL;
m_cLut = FX_Alloc(FX_DWORD, 4096);
m_aLut = FX_Alloc(FX_DWORD, 4096);
int row, col;
@@ -1135,9 +1123,7 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
ret = ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(),
m_Width, m_Height, this, 0, 0, pal_8bpp, pIccTransform);
if (!ret) {
- if (pal_8bpp) {
- FX_Free(pal_8bpp);
- }
+ FX_Free(pal_8bpp);
delete pClone;
return NULL;
}
@@ -1215,24 +1201,18 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format,
ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height,
this, 0, 0, pal_8bpp, pIccTransform);
if (!ret) {
- if (pal_8bpp) {
- FX_Free(pal_8bpp);
- }
+ FX_Free(pal_8bpp);
if (pAlphaMask != m_pAlphaMask) {
delete pAlphaMask;
}
- if (dest_buf) {
- FX_Free(dest_buf);
- }
+ FX_Free(dest_buf);
return FALSE;
}
if (m_pAlphaMask && pAlphaMask != m_pAlphaMask) {
delete m_pAlphaMask;
}
m_pAlphaMask = pAlphaMask;
- if (m_pPalette) {
- FX_Free(m_pPalette);
- }
+ FX_Free(m_pPalette);
m_pPalette = pal_8bpp;
if (!m_bExtBuf) {
FX_Free(m_pBuffer);
diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp
index a91d99d935..7443926df4 100644
--- a/core/src/fxge/dib/fx_dib_engine.cpp
+++ b/core/src/fxge/dib/fx_dib_engine.cpp
@@ -16,10 +16,8 @@ void CWeightTable::Calc(int dest_len,
int src_min,
int src_max,
int flags) {
- if (m_pWeightTables) {
- FX_Free(m_pWeightTables);
- m_pWeightTables = NULL;
- }
+ FX_Free(m_pWeightTables);
+ m_pWeightTables = NULL;
double scale, base;
scale = FXSYS_Div((FX_FLOAT)(src_len), (FX_FLOAT)(dest_len));
if (dest_len < 0) {
@@ -334,18 +332,10 @@ FX_BOOL CStretchEngine::Continue(IFX_Pause* pPause) {
return FALSE;
}
CStretchEngine::~CStretchEngine() {
- if (m_pDestScanline) {
- FX_Free(m_pDestScanline);
- }
- if (m_pInterBuf) {
- FX_Free(m_pInterBuf);
- }
- if (m_pExtraAlphaBuf) {
- FX_Free(m_pExtraAlphaBuf);
- }
- if (m_pDestMaskScanline) {
- FX_Free(m_pDestMaskScanline);
- }
+ FX_Free(m_pDestScanline);
+ FX_Free(m_pInterBuf);
+ FX_Free(m_pExtraAlphaBuf);
+ FX_Free(m_pDestMaskScanline);
}
FX_BOOL CStretchEngine::StartStretchHorz() {
if (m_DestWidth == 0 || m_pDestScanline == NULL ||
@@ -769,13 +759,9 @@ CFX_ImageStretcher::CFX_ImageStretcher() {
m_pMaskScanline = NULL;
}
CFX_ImageStretcher::~CFX_ImageStretcher() {
- if (m_pScanline) {
- FX_Free(m_pScanline);
- }
+ FX_Free(m_pScanline);
delete m_pStretchEngine;
- if (m_pMaskScanline) {
- FX_Free(m_pMaskScanline);
- }
+ FX_Free(m_pMaskScanline);
}
FXDIB_Format _GetStretchedFormat(const CFX_DIBSource* pSrc) {
FXDIB_Format format = pSrc->GetFormat();
diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp
index 3c886e5cfe..b98fc6b359 100644
--- a/core/src/fxge/dib/fx_dib_main.cpp
+++ b/core/src/fxge/dib/fx_dib_main.cpp
@@ -48,9 +48,7 @@ CFX_DIBSource::CFX_DIBSource() {
m_pAlphaMask = NULL;
}
CFX_DIBSource::~CFX_DIBSource() {
- if (m_pPalette) {
- FX_Free(m_pPalette);
- }
+ FX_Free(m_pPalette);
delete m_pAlphaMask;
}
CFX_DIBitmap::CFX_DIBitmap() {
@@ -102,7 +100,7 @@ FX_BOOL CFX_DIBitmap::Create(int width,
FX_BOOL ret = TRUE;
ret = BuildAlphaMask();
if (!ret) {
- if (!m_bExtBuf && m_pBuffer) {
+ if (!m_bExtBuf) {
FX_Free(m_pBuffer);
m_pBuffer = NULL;
m_Width = m_Height = m_Pitch = 0;
@@ -127,18 +125,16 @@ FX_BOOL CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) {
return TRUE;
}
CFX_DIBitmap::~CFX_DIBitmap() {
- if (m_pBuffer && !m_bExtBuf) {
+ if (!m_bExtBuf) {
FX_Free(m_pBuffer);
}
m_pBuffer = NULL;
}
void CFX_DIBitmap::TakeOver(CFX_DIBitmap* pSrcBitmap) {
- if (m_pBuffer && !m_bExtBuf) {
+ if (!m_bExtBuf) {
FX_Free(m_pBuffer);
}
- if (m_pPalette) {
- FX_Free(m_pPalette);
- }
+ FX_Free(m_pPalette);
delete m_pAlphaMask;
m_pBuffer = pSrcBitmap->m_pBuffer;
m_pPalette = pSrcBitmap->m_pPalette;
@@ -542,9 +538,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left,
}
void CFX_DIBSource::CopyPalette(const FX_DWORD* pSrc, FX_DWORD size) {
if (pSrc == NULL || GetBPP() > 8) {
- if (m_pPalette) {
- FX_Free(m_pPalette);
- }
+ FX_Free(m_pPalette);
m_pPalette = NULL;
} else {
FX_DWORD pal_size = 1 << GetBPP();
@@ -1519,9 +1513,7 @@ CFX_FilteredDIB::~CFX_FilteredDIB() {
if (m_bAutoDropSrc) {
delete m_pSrc;
}
- if (m_pScanline) {
- FX_Free(m_pScanline);
- }
+ FX_Free(m_pScanline);
}
void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) {
m_pSrc = pSrc;
diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp
index e701ee9492..8be177ed14 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -30,10 +30,8 @@ CFX_Font::CFX_Font() {
CFX_Font::~CFX_Font() {
delete m_pSubstFont;
m_pSubstFont = NULL;
- if (m_pFontDataAllocation) {
- FX_Free(m_pFontDataAllocation);
- m_pFontDataAllocation = NULL;
- }
+ FX_Free(m_pFontDataAllocation);
+ m_pFontDataAllocation = NULL;
if (m_Face) {
if (FXFT_Get_Face_External_Stream(m_Face)) {
FXFT_Clear_Face_External_Stream(m_Face);
@@ -44,14 +42,10 @@ CFX_Font::~CFX_Font() {
CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face);
}
}
- if (m_pOwnedStream) {
- FX_Free(m_pOwnedStream);
- m_pOwnedStream = NULL;
- }
- if (m_pGsubData) {
- FX_Free(m_pGsubData);
- m_pGsubData = NULL;
- }
+ FX_Free(m_pOwnedStream);
+ m_pOwnedStream = NULL;
+ FX_Free(m_pGsubData);
+ m_pGsubData = NULL;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
ReleasePlatformResource();
#endif
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index d4416d9487..100688c4e0 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -33,9 +33,7 @@ CTTFontDesc::~CTTFontDesc() {
FXFT_Done_Face(m_TTCFace.m_pFaces[i]);
}
}
- if (m_pFontData) {
- FX_Free(m_pFontData);
- }
+ FX_Free(m_pFontData);
}
FX_BOOL CTTFontDesc::ReleaseFace(FXFT_Face face) {
if (m_Type == 1) {
diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp
index b50c271c20..9acbcabfbf 100644
--- a/core/src/fxge/ge/fx_ge_path.cpp
+++ b/core/src/fxge/ge/fx_ge_path.cpp
@@ -117,17 +117,12 @@ CFX_PathData::CFX_PathData() {
m_pPoints = NULL;
}
CFX_PathData::~CFX_PathData() {
- if (m_pPoints) {
- FX_Free(m_pPoints);
- }
+ FX_Free(m_pPoints);
}
void CFX_PathData::SetPointCount(int nPoints) {
m_PointCount = nPoints;
if (m_AllocCount < nPoints) {
- if (m_pPoints) {
- FX_Free(m_pPoints);
- m_pPoints = NULL;
- }
+ FX_Free(m_pPoints);
m_pPoints = FX_Alloc(FX_PATHPOINT, nPoints);
m_AllocCount = nPoints;
}
@@ -138,9 +133,7 @@ void CFX_PathData::AllocPointCount(int nPoints) {
if (m_PointCount) {
FXSYS_memcpy(pNewBuf, m_pPoints, m_PointCount * sizeof(FX_PATHPOINT));
}
- if (m_pPoints) {
- FX_Free(m_pPoints);
- }
+ FX_Free(m_pPoints);
m_pPoints = pNewBuf;
m_AllocCount = nPoints;
}
@@ -640,9 +633,7 @@ CFX_GraphStateData::CFX_GraphStateData(const CFX_GraphStateData& src) {
void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) {
m_LineCap = src.m_LineCap;
m_DashCount = src.m_DashCount;
- if (m_DashArray) {
- FX_Free(m_DashArray);
- }
+ FX_Free(m_DashArray);
m_DashArray = NULL;
m_DashPhase = src.m_DashPhase;
m_LineJoin = src.m_LineJoin;
@@ -654,14 +645,10 @@ void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) {
}
}
CFX_GraphStateData::~CFX_GraphStateData() {
- if (m_DashArray) {
- FX_Free(m_DashArray);
- }
+ FX_Free(m_DashArray);
}
void CFX_GraphStateData::SetDashCount(int count) {
- if (m_DashArray) {
- FX_Free(m_DashArray);
- }
+ FX_Free(m_DashArray);
m_DashArray = NULL;
m_DashCount = count;
if (count == 0) {
diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp
index d20825d458..dacec0455c 100644
--- a/core/src/fxge/ge/fx_ge_ps.cpp
+++ b/core/src/fxge/ge/fx_ge_ps.cpp
@@ -322,9 +322,7 @@ static void PSCompressData(int PSLevel,
output_size = dest_size;
} else {
filter = NULL;
- if (dest_buf) {
- FX_Free(dest_buf);
- }
+ FX_Free(dest_buf);
}
}
FX_BOOL CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource,
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index 9dbad11492..2db35f7f68 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -699,9 +699,7 @@ static HPEN _CreatePen(const CFX_GraphStateData* pGraphState,
}
HPEN hPen = ExtCreatePen(PenStyle, (DWORD)FXSYS_ceil(width), &lb,
pGraphState->m_DashCount, (const DWORD*)pDash);
- if (pDash) {
- FX_Free(pDash);
- }
+ FX_Free(pDash);
return hPen;
}
static HBRUSH _CreateBrush(FX_DWORD argb) {
diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp
index 85f339b529..18fe1eb6fa 100644
--- a/core/src/fxge/win32/fx_win32_print.cpp
+++ b/core/src/fxge/win32/fx_win32_print.cpp
@@ -283,9 +283,7 @@ CPSOutput::CPSOutput(HDC hDC) {
m_pBuf = NULL;
}
CPSOutput::~CPSOutput() {
- if (m_pBuf) {
- FX_Free(m_pBuf);
- }
+ FX_Free(m_pBuf);
}
void CPSOutput::Init() {
m_pBuf = FX_Alloc(FX_CHAR, 1026);