summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-19 17:26:17 -0700
committerLei Zhang <thestig@chromium.org>2015-06-19 17:26:17 -0700
commit6d8b1c2c7b1cbada20109f70ae971a4192330bb5 (patch)
treee755b7cb2624622cba606134493d25fb7f1ce6c8 /core/src
parent9883a7da2d4f31910073c03e703d5b97a45d9254 (diff)
downloadpdfium-6d8b1c2c7b1cbada20109f70ae971a4192330bb5.tar.xz
Merge to XFA: Cleanup: Do not check pointers before deleting them.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1192743004. (cherry picked from commit cfac954abcab7caf47d3fa3d641c553cba998271) Review URL: https://codereview.chromium.org/1196783003.
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp10
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.h12
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp14
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp26
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp4
-rw-r--r--core/src/fpdfdoc/doc_vt.cpp6
-rw-r--r--core/src/fpdfdoc/pdf_vt.h12
-rw-r--r--core/src/fxcodec/codec/fx_codec_icc.cpp8
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Context.cpp170
-rw-r--r--core/src/fxcodec/jbig2/JBig2_PatternDict.cpp4
-rw-r--r--core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp4
-rw-r--r--core/src/fxge/agg/src/fx_agg_driver.cpp18
-rw-r--r--core/src/fxge/android/fpf_skiafontmgr.cpp4
-rw-r--r--core/src/fxge/android/fpf_skiamodule.cpp4
-rw-r--r--core/src/fxge/apple/apple_int.h4
-rw-r--r--core/src/fxge/apple/fx_quartz_device.cpp2
-rw-r--r--core/src/fxge/dib/fx_dib_engine.cpp4
-rw-r--r--core/src/fxge/dib/fx_dib_main.cpp26
-rw-r--r--core/src/fxge/ge/fx_ge.cpp12
-rw-r--r--core/src/fxge/ge/fx_ge_device.cpp8
-rw-r--r--core/src/fxge/ge/fx_ge_font.cpp6
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp4
-rw-r--r--core/src/fxge/ge/fx_ge_text.cpp4
-rw-r--r--core/src/fxge/skia/fx_skia_device.cpp2
-rw-r--r--core/src/fxge/win32/fx_win32_dib.cpp12
-rw-r--r--core/src/fxge/win32/fx_win32_print.cpp4
37 files changed, 134 insertions, 362 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index b7eb05f452..22826a3609 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -1967,10 +1967,8 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause *pPause)
}
void CPDF_Creator::Clear()
{
- if (m_pXRefStream) {
- delete m_pXRefStream;
- m_pXRefStream = NULL;
- }
+ delete m_pXRefStream;
+ m_pXRefStream = NULL;
m_File.Clear();
m_NewObjNumArray.RemoveAll();
if (m_pIDArray) {
@@ -2068,7 +2066,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault )
CFX_ByteString user_pass = m_pParser->GetPassword();
FX_DWORD flag = PDF_ENCRYPT_CONTENT;
handler.OnCreate(m_pEncryptDict, m_pIDArray, (const uint8_t*)user_pass, user_pass.GetLength(), flag);
- if (m_pCryptoHandler && m_bNewCrypto) {
+ if (m_bNewCrypto) {
delete m_pCryptoHandler;
}
m_pCryptoHandler = new CPDF_StandardCryptoHandler;
@@ -2122,7 +2120,7 @@ void CPDF_Creator::RemoveSecurity()
}
void CPDF_Creator::ResetStandardSecurity()
{
- if ((m_bStandardSecurity || m_bNewCrypto) && m_pCryptoHandler) {
+ if (m_bStandardSecurity || m_bNewCrypto) {
delete m_pCryptoHandler;
m_pCryptoHandler = NULL;
}
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 784fc0169e..2db8d6095f 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -1044,9 +1044,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert)
}
}
}
- if (pEncoding) {
- delete pEncoding;
- }
+ delete pEncoding;
pFontDesc->SetAtInteger("StemV", nStemV);
AddIndirectObject(pFontDesc);
pFontDict->SetAtReference("FontDescriptor", this, pFontDesc);
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index 14207f7e6b..e7072e8d55 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -1744,10 +1744,6 @@ CPDF_Type3Char::CPDF_Type3Char()
}
CPDF_Type3Char::~CPDF_Type3Char()
{
- if (m_pForm) {
- delete m_pForm;
- }
- if (m_pBitmap) {
- delete m_pBitmap;
- }
+ delete m_pForm;
+ delete m_pBitmap;
}
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 0b4064b3c6..7dd019da85 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -300,9 +300,7 @@ CPDF_CMap::~CPDF_CMap()
if (m_pLeadingBytes) {
FX_Free(m_pLeadingBytes);
}
- if (m_pUseMap) {
- delete m_pUseMap;
- }
+ delete m_pUseMap;
}
void CPDF_CMap::Release()
{
@@ -710,15 +708,9 @@ CPDF_CIDFont::~CPDF_CIDFont()
if (m_pAnsiWidths) {
FX_Free(m_pAnsiWidths);
}
- if (m_pAllocatedCMap) {
- delete m_pAllocatedCMap;
- }
- if (m_pCIDToGIDMap) {
- delete m_pCIDToGIDMap;
- }
- if (m_pTTGSUBTable) {
- delete m_pTTGSUBTable;
- }
+ delete m_pAllocatedCMap;
+ delete m_pCIDToGIDMap;
+ delete m_pTTGSUBTable;
}
FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const
{
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
index 69ccc3e453..1b18f82d6e 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
@@ -282,9 +282,7 @@ private:
}
~TSingleSubstFormat1()
{
- if(Coverage) {
- delete Coverage;
- }
+ delete Coverage;
}
private:
TSingleSubstFormat1(const TSingleSubstFormat1&);
@@ -300,12 +298,8 @@ private:
}
~TSingleSubstFormat2()
{
- if(Coverage) {
- delete Coverage;
- }
- if(Substitute) {
- delete[] Substitute;
- }
+ delete Coverage;
+ delete[] Substitute;
}
private:
TSingleSubstFormat2(const TSingleSubstFormat2&);
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index 85c785fd22..db3966ec17 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -697,9 +697,7 @@ void CPDF_ShadingObject::CalcBoundingBox()
}
CPDF_FormObject::~CPDF_FormObject()
{
- if (m_pForm) {
- delete m_pForm;
- }
+ delete m_pForm;
}
void CPDF_FormObject::Transform(const CFX_AffineMatrix& matrix)
{
@@ -709,9 +707,7 @@ void CPDF_FormObject::Transform(const CFX_AffineMatrix& matrix)
void CPDF_FormObject::CopyData(const CPDF_PageObject* pSrc)
{
const CPDF_FormObject* pSrcObj = (const CPDF_FormObject*)pSrc;
- if (m_pForm) {
- delete m_pForm;
- }
+ delete m_pForm;
m_pForm = pSrcObj->m_pForm->Clone();
m_FormMatrix = pSrcObj->m_FormMatrix;
}
@@ -735,9 +731,7 @@ CPDF_PageObjects::CPDF_PageObjects(FX_BOOL bReleaseMembers) : m_ObjectList(128)
}
CPDF_PageObjects::~CPDF_PageObjects()
{
- if (m_pParser) {
- delete m_pParser;
- }
+ delete m_pParser;
if (!m_bReleaseMembers) {
return;
}
@@ -851,9 +845,7 @@ void CPDF_PageObjects::LoadTransInfo()
void CPDF_PageObjects::ClearCacheObjects()
{
m_ParseState = PDF_CONTENT_NOT_PARSED;
- if (m_pParser) {
- delete m_pParser;
- }
+ delete m_pParser;
m_pParser = NULL;
if (m_bReleaseMembers) {
FX_POSITION pos = m_ObjectList.GetHeadPosition();
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 1146d76695..0ee7a0da7d 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -930,9 +930,7 @@ CPDF_SeparationCS::~CPDF_SeparationCS()
if (m_pAltCS) {
m_pAltCS->ReleaseCS();
}
- if (m_pFunc) {
- delete m_pFunc;
- }
+ delete m_pFunc;
}
void CPDF_SeparationCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const
{
@@ -1020,9 +1018,7 @@ public:
};
CPDF_DeviceNCS::~CPDF_DeviceNCS()
{
- if (m_pFunc) {
- delete m_pFunc;
- }
+ delete m_pFunc;
if (m_pAltCS) {
m_pAltCS->ReleaseCS();
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index 6362be973b..f115b6770d 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -460,9 +460,7 @@ CPDF_SampledFunc::CPDF_SampledFunc()
}
CPDF_SampledFunc::~CPDF_SampledFunc()
{
- if (m_pSampleStream) {
- delete m_pSampleStream;
- }
+ delete m_pSampleStream;
if (m_pEncodeInfo) {
FX_Free(m_pEncodeInfo);
}
@@ -713,9 +711,7 @@ CPDF_StitchFunc::CPDF_StitchFunc()
CPDF_StitchFunc::~CPDF_StitchFunc()
{
for (int i = 0; i < m_nSubs; i ++)
- if (m_pSubFunctions[i]) {
- delete m_pSubFunctions[i];
- }
+ delete m_pSubFunctions[i];
if (m_pSubFunctions) {
FX_Free(m_pSubFunctions);
}
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 e2d075e02c..70d0743f58 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -38,9 +38,7 @@ CPDF_ClipPathData::~CPDF_ClipPathData()
FX_Free(m_pTypeList);
}
for (i = m_TextCount - 1; i > -1; i --)
- if (m_pTextList[i]) {
- delete m_pTextList[i];
- }
+ delete m_pTextList[i];
if (m_pTextList) {
FX_Free(m_pTextList);
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 5f4023a278..fdc4a27989 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -44,9 +44,7 @@ CPDF_StreamContentParser::~CPDF_StreamContentParser()
if (m_pPathPoints) {
FX_Free(m_pPathPoints);
}
- if (m_pCurStates) {
- delete m_pCurStates;
- }
+ delete m_pCurStates;
if (m_pLastImageDict) {
m_pLastImageDict->Release();
}
@@ -801,9 +799,7 @@ void CPDF_StreamContentParser::Handle_EndText()
if (m_pCurStates->m_TextState.GetObject()->m_TextMode < 4) {
for (int i = 0; i < count; i ++) {
CPDF_TextObject* pText = (CPDF_TextObject*)m_ClipTextList.GetAt(i);
- if (pText) {
- delete pText;
- }
+ delete pText;
}
} else {
m_pCurStates->m_ClipPath.AppendTexts((CPDF_TextObject**)m_ClipTextList.GetData(), count);
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 6f0996977f..ff1f6c4aa0 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -918,17 +918,11 @@ CPDF_ContentParser::~CPDF_ContentParser()
}
void CPDF_ContentParser::Clear()
{
- if (m_pParser) {
- delete m_pParser;
- }
- if (m_pSingleStream) {
- delete m_pSingleStream;
- }
+ delete m_pParser;
+ delete m_pSingleStream;
if (m_pStreamArray) {
for (FX_DWORD i = 0; i < m_nStreams; i ++)
- if (m_pStreamArray[i]) {
- delete m_pStreamArray[i];
- }
+ delete m_pStreamArray[i];
FX_Free(m_pStreamArray);
}
if (m_pData && m_pSingleStream == NULL) {
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index bd53874af4..48b3a40495 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -34,10 +34,8 @@ CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatter
}
CPDF_TilingPattern::~CPDF_TilingPattern()
{
- if (m_pForm) {
- delete m_pForm;
- m_pForm = NULL;
- }
+ delete m_pForm;
+ m_pForm = NULL;
}
FX_BOOL CPDF_TilingPattern::Load()
{
@@ -92,9 +90,7 @@ CPDF_ShadingPattern::~CPDF_ShadingPattern()
void CPDF_ShadingPattern::Clear()
{
for (int i = 0; i < m_nFuncs; i ++) {
- if (m_pFunctions[i]) {
- delete m_pFunctions[i];
- }
+ delete m_pFunctions[i];
m_pFunctions[i] = NULL;
}
CPDF_ColorSpace* pCS = m_pCountedCS ? m_pCountedCS->get() : NULL;
@@ -117,9 +113,7 @@ FX_BOOL CPDF_ShadingPattern::Load()
}
if (m_nFuncs) {
for (int i = 0; i < m_nFuncs; i ++)
- if (m_pFunctions[i]) {
- delete m_pFunctions[i];
- }
+ delete m_pFunctions[i];
m_nFuncs = 0;
}
CPDF_Object* pFunc = pShadingDict->GetElementValue(FX_BSTRC("Function"));
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
index ac48dc6c65..efe085c2ee 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
@@ -18,9 +18,7 @@ CFX_DataFilter::CFX_DataFilter()
}
CFX_DataFilter::~CFX_DataFilter()
{
- if (m_pDestFilter) {
- delete m_pDestFilter;
- }
+ delete m_pDestFilter;
}
void CFX_DataFilter::SetDestFilter(CFX_DataFilter* pFilter)
{
@@ -192,12 +190,8 @@ CPDF_StreamFilter* CPDF_Stream::GetStreamFilter(FX_BOOL bRaw) const
}
CPDF_StreamFilter::~CPDF_StreamFilter()
{
- if (m_pFilter) {
- delete m_pFilter;
- }
- if (m_pBuffer) {
- delete m_pBuffer;
- }
+ delete m_pFilter;
+ delete m_pBuffer;
}
#define FPDF_FILTER_BUFFER_IN_SIZE FPDF_FILTER_BUFFER_SIZE
FX_DWORD CPDF_StreamFilter::ReadBlock(uint8_t* buffer, FX_DWORD buf_size)
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 9f5acb5257..5e673b0829 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -72,7 +72,7 @@ void CPDF_Parser::SetEncryptDictionary(CPDF_Dictionary* pDict)
void CPDF_Parser::CloseParser(FX_BOOL bReParse)
{
m_bVersionUpdated = FALSE;
- if (m_pDocument && !bReParse) {
+ if (!bReParse) {
delete m_pDocument;
m_pDocument = NULL;
}
@@ -313,11 +313,9 @@ FX_DWORD CPDF_Parser::SetEncryptHandler()
}
void CPDF_Parser::ReleaseEncryptHandler()
{
- if (m_Syntax.m_pCryptoHandler) {
- delete m_Syntax.m_pCryptoHandler;
- m_Syntax.m_pCryptoHandler = NULL;
- }
- if (m_pSecurityHandler && !m_bForceUseSecurityHandler) {
+ delete m_Syntax.m_pCryptoHandler;
+ m_Syntax.m_pCryptoHandler = NULL;
+ if (!m_bForceUseSecurityHandler) {
delete m_pSecurityHandler;
m_pSecurityHandler = NULL;
}
@@ -1486,7 +1484,7 @@ FX_BOOL CPDF_Parser::IsOwner()
void CPDF_Parser::SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, FX_BOOL bForced)
{
ASSERT(m_pSecurityHandler == NULL);
- if (m_pSecurityHandler && !m_bForceUseSecurityHandler) {
+ if (!m_bForceUseSecurityHandler) {
delete m_pSecurityHandler;
m_pSecurityHandler = NULL;
}
@@ -2988,12 +2986,8 @@ CPDF_DataAvail::~CPDF_DataAvail()
if (m_pTrailer) {
m_pTrailer->Release();
}
- if (m_pageMapCheckState) {
- delete m_pageMapCheckState;
- }
- if (m_pagesLoadState) {
- delete m_pagesLoadState;
- }
+ delete m_pageMapCheckState;
+ delete m_pagesLoadState;
int32_t i = 0;
int32_t iSize = m_arrayAcroforms.GetSize();
for (i = 0; i < iSize; ++i) {
@@ -4644,10 +4638,8 @@ CPDF_PageNode::~CPDF_PageNode()
{
int32_t iSize = m_childNode.GetSize();
for (int32_t i = 0; i < iSize; ++i) {
- CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
- if (pNode) {
- delete pNode;
- }
+ CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i];
+ delete pNode;
}
m_childNode.RemoveAll();
}
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
index 6a876a2390..cdbecd65ea 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
@@ -188,20 +188,14 @@ CPDF_ImageCache::CPDF_ImageCache(CPDF_Document* pDoc, CPDF_Stream* pStream)
}
CPDF_ImageCache::~CPDF_ImageCache()
{
- if (m_pCachedBitmap) {
- delete m_pCachedBitmap;
- m_pCachedBitmap = NULL;
- }
- if (m_pCachedMask) {
- delete m_pCachedMask;
- m_pCachedMask = NULL;
- }
+ delete m_pCachedBitmap;
+ m_pCachedBitmap = NULL;
+ delete m_pCachedMask;
+ m_pCachedMask = NULL;
}
void CPDF_ImageCache::Reset(const CFX_DIBitmap* pBitmap)
{
- if (m_pCachedBitmap) {
- delete m_pCachedBitmap;
- }
+ delete m_pCachedBitmap;
m_pCachedBitmap = NULL;
if (pBitmap) {
m_pCachedBitmap = pBitmap->Clone();
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 5748e23efe..3ee2222d8b 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -994,9 +994,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_Pag
m_pDevice->RestoreState();
}
m_pDevice->RestoreState();
- if (pStates) {
- delete pStates;
- }
+ delete pStates;
return;
}
if (bAligned) {
diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp
index bd23670b9a..c9f5673a60 100644
--- a/core/src/fpdfdoc/doc_vt.cpp
+++ b/core/src/fpdfdoc/doc_vt.cpp
@@ -823,10 +823,8 @@ CPDF_VariableText::CPDF_VariableText() :
}
CPDF_VariableText::~CPDF_VariableText()
{
- if (m_pVTIterator) {
- delete m_pVTIterator;
- m_pVTIterator = NULL;
- }
+ delete m_pVTIterator;
+ m_pVTIterator = NULL;
ResetAll();
}
void CPDF_VariableText::Initialize()
diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h
index 1c372a6026..baf3625f0d 100644
--- a/core/src/fpdfdoc/pdf_vt.h
+++ b/core/src/fpdfdoc/pdf_vt.h
@@ -84,12 +84,8 @@ struct CPVT_SectionInfo {
}
virtual ~CPVT_SectionInfo()
{
- if (pSecProps) {
- delete pSecProps;
- }
- if (pWordProps) {
- delete pWordProps;
- }
+ delete pSecProps;
+ delete pWordProps;
}
CPVT_SectionInfo(const CPVT_SectionInfo & other): rcSection(), nTotalLine(0), pSecProps(NULL), pWordProps(NULL)
{
@@ -148,9 +144,7 @@ struct CPVT_WordInfo {
}
virtual ~CPVT_WordInfo()
{
- if (pWordProps) {
- delete pWordProps;
- }
+ delete pWordProps;
}
CPVT_WordInfo(const CPVT_WordInfo & word): Word(0), nCharset(0),
fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps(NULL)
diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp
index 703d00a496..da503c03fd 100644
--- a/core/src/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/src/fxcodec/codec/fx_codec_icc.cpp
@@ -514,17 +514,13 @@ CCodec_IccModule::~CCodec_IccModule()
CFX_IccProfileCache* pProfileCache;
while (pos) {
m_MapProfile.GetNextAssoc(pos, key, (void*&)pProfileCache);
- if (pProfileCache) {
- delete pProfileCache;
- }
+ delete pProfileCache;
}
pos = m_MapTranform.GetStartPosition();
CFX_IccTransformCache* pTransformCache;
while (pos) {
m_MapTranform.GetNextAssoc(pos, key, (void*&)pTransformCache);
- if (pTransformCache) {
- delete pTransformCache;
- }
+ delete pTransformCache;
}
}
void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWORD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat)
diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp
index f58b7f36f5..41a3cced8c 100644
--- a/core/src/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp
@@ -30,9 +30,7 @@ CJBig2_Context *CJBig2_Context::CreateContext(CJBig2_Module *pModule, uint8_t *p
}
void CJBig2_Context::DestroyContext(CJBig2_Context *pContext)
{
- if(pContext) {
- delete pContext;
- }
+ delete pContext;
}
CJBig2_Context::CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength,
uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause)
@@ -63,37 +61,25 @@ CJBig2_Context::CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength,
}
CJBig2_Context::~CJBig2_Context()
{
- if(m_pArithDecoder) {
- delete m_pArithDecoder;
- }
+ delete m_pArithDecoder;
m_pArithDecoder = NULL;
- if(m_pGRD) {
- delete m_pGRD;
- }
+ delete m_pGRD;
m_pGRD = NULL;
if(m_gbContext) {
m_pModule->JBig2_Free(m_gbContext);
}
m_gbContext = NULL;
- if(m_pGlobalContext) {
- delete m_pGlobalContext;
- }
+ delete m_pGlobalContext;
m_pGlobalContext = NULL;
- if(m_pPageInfoList) {
- delete m_pPageInfoList;
- }
+ delete m_pPageInfoList;
m_pPageInfoList = NULL;
- if(m_bBufSpecified && m_pPage) {
+ if(m_bBufSpecified) {
delete m_pPage;
}
m_pPage = NULL;
- if(m_pStream) {
- delete m_pStream;
- }
+ delete m_pStream;
m_pStream = NULL;
- if(m_pSegmentList) {
- delete m_pSegmentList;
- }
+ delete m_pSegmentList;
m_pSegmentList = NULL;
}
int32_t CJBig2_Context::decodeFile(IFX_Pause* pPause)
@@ -247,9 +233,7 @@ int32_t CJBig2_Context::getFirstPage(uint8_t *pBuf, int32_t width, int32_t heigh
}
m_bFirstPage = TRUE;
m_PauseStep = 0;
- if(m_pPage) {
- delete m_pPage;
- }
+ delete m_pPage;
JBIG2_ALLOC(m_pPage, CJBig2_Image(width, height, stride, pBuf));
m_bBufSpecified = TRUE;
if(m_pPage && pPause && pPause->NeedToPauseNow()) {
@@ -316,9 +300,7 @@ int32_t CJBig2_Context::getNextPage(uint8_t *pBuf, int32_t width, int32_t height
int32_t nRet = JBIG2_ERROR_STREAM_TYPE;
m_bFirstPage = FALSE;
m_PauseStep = 0;
- if(m_pPage) {
- delete m_pPage;
- }
+ delete m_pPage;
JBIG2_ALLOC(m_pPage, CJBig2_Image(width, height, stride, pBuf));
m_bBufSpecified = TRUE;
if(m_pPage && pPause && pPause->NeedToPauseNow()) {
@@ -571,9 +553,7 @@ int32_t CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX
pPageInfo->m_bIsStriped = 1;
}
if(!m_bBufSpecified) {
- if(m_pPage) {
- delete m_pPage;
- }
+ delete m_pPage;
if(pPageInfo->m_dwHeight == 0xffffffff) {
JBIG2_ALLOC(m_pPage, CJBig2_Image(pPageInfo->m_dwWidth, pPageInfo->m_wMaxStripeSize));
} else {
@@ -860,21 +840,11 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa
if(SDINSYMS) {
m_pModule->JBig2_Free(SDINSYMS);
}
- if(Table_B1) {
- delete Table_B1;
- }
- if(Table_B2) {
- delete Table_B2;
- }
- if(Table_B3) {
- delete Table_B3;
- }
- if(Table_B4) {
- delete Table_B4;
- }
- if(Table_B5) {
- delete Table_B5;
- }
+ delete Table_B1;
+ delete Table_B2;
+ delete Table_B3;
+ delete Table_B4;
+ delete Table_B5;
if(bUsed == FALSE) {
if(gbContext) {
m_pModule->JBig2_Free(gbContext);
@@ -889,21 +859,11 @@ failed:
if(SDINSYMS) {
m_pModule->JBig2_Free(SDINSYMS);
}
- if(Table_B1) {
- delete Table_B1;
- }
- if(Table_B2) {
- delete Table_B2;
- }
- if(Table_B3) {
- delete Table_B3;
- }
- if(Table_B4) {
- delete Table_B4;
- }
- if(Table_B5) {
- delete Table_B5;
- }
+ delete Table_B1;
+ delete Table_B2;
+ delete Table_B3;
+ delete Table_B4;
+ delete Table_B5;
if(gbContext) {
m_pModule->JBig2_Free(gbContext);
}
@@ -1242,39 +1202,17 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
if(grContext) {
m_pModule->JBig2_Free(grContext);
}
- if(Table_B1) {
- delete Table_B1;
- }
- if(Table_B6) {
- delete Table_B6;
- }
- if(Table_B7) {
- delete Table_B7;
- }
- if(Table_B8) {
- delete Table_B8;
- }
- if(Table_B9) {
- delete Table_B9;
- }
- if(Table_B10) {
- delete Table_B10;
- }
- if(Table_B11) {
- delete Table_B11;
- }
- if(Table_B12) {
- delete Table_B12;
- }
- if(Table_B13) {
- delete Table_B13;
- }
- if(Table_B14) {
- delete Table_B14;
- }
- if(Table_B15) {
- delete Table_B15;
- }
+ delete Table_B1;
+ delete Table_B6;
+ delete Table_B7;
+ delete Table_B8;
+ delete Table_B9;
+ delete Table_B10;
+ delete Table_B11;
+ delete Table_B12;
+ delete Table_B13;
+ delete Table_B14;
+ delete Table_B15;
return JBIG2_SUCCESS;
failed:
delete pTRD;
@@ -1287,39 +1225,17 @@ failed:
if(grContext) {
m_pModule->JBig2_Free(grContext);
}
- if(Table_B1) {
- delete Table_B1;
- }
- if(Table_B6) {
- delete Table_B6;
- }
- if(Table_B7) {
- delete Table_B7;
- }
- if(Table_B8) {
- delete Table_B8;
- }
- if(Table_B9) {
- delete Table_B9;
- }
- if(Table_B10) {
- delete Table_B10;
- }
- if(Table_B11) {
- delete Table_B11;
- }
- if(Table_B12) {
- delete Table_B12;
- }
- if(Table_B13) {
- delete Table_B13;
- }
- if(Table_B14) {
- delete Table_B14;
- }
- if(Table_B15) {
- delete Table_B15;
- }
+ delete Table_B1;
+ delete Table_B6;
+ delete Table_B7;
+ delete Table_B8;
+ delete Table_B9;
+ delete Table_B10;
+ delete Table_B11;
+ delete Table_B12;
+ delete Table_B13;
+ delete Table_B14;
+ delete Table_B15;
return nRet;
}
diff --git a/core/src/fxcodec/jbig2/JBig2_PatternDict.cpp b/core/src/fxcodec/jbig2/JBig2_PatternDict.cpp
index 0c6e5be8ce..df45288812 100644
--- a/core/src/fxcodec/jbig2/JBig2_PatternDict.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_PatternDict.cpp
@@ -15,9 +15,7 @@ CJBig2_PatternDict::~CJBig2_PatternDict()
{
if(HDPATS) {
for(FX_DWORD i = 0; i < NUMPATS; i++) {
- if(HDPATS[i]) {
- delete HDPATS[i];
- }
+ delete HDPATS[i];
}
m_pModule->JBig2_Free(HDPATS);
}
diff --git a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp
index e9bb9c62e0..0e5b92ff5a 100644
--- a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp
@@ -41,9 +41,7 @@ CJBig2_SymbolDict::~CJBig2_SymbolDict()
{
if(SDEXSYMS) {
for(FX_DWORD i = 0; i < SDNUMEXSYMS; i++) {
- if(SDEXSYMS[i]) {
- delete SDEXSYMS[i];
- }
+ delete SDEXSYMS[i];
}
m_pModule->JBig2_Free(SDEXSYMS);
}
diff --git a/core/src/fxge/agg/src/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp
index 49556bd10b..cb01893d5b 100644
--- a/core/src/fxge/agg/src/fx_agg_driver.cpp
+++ b/core/src/fxge/agg/src/fx_agg_driver.cpp
@@ -205,9 +205,7 @@ CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits,
}
CFX_AggDeviceDriver::~CFX_AggDeviceDriver()
{
- if (m_pClipRgn) {
- delete m_pClipRgn;
- }
+ delete m_pClipRgn;
for (int i = 0; i < m_StateStack.GetSize(); i ++)
if (m_StateStack[i]) {
delete (CFX_ClipRgn*)m_StateStack[i];
@@ -277,17 +275,13 @@ void CFX_AggDeviceDriver::SaveState()
void CFX_AggDeviceDriver::RestoreState(FX_BOOL bKeepSaved)
{
if (m_StateStack.GetSize() == 0) {
- if (m_pClipRgn) {
- delete m_pClipRgn;
- m_pClipRgn = NULL;
- }
- return;
- }
- CFX_ClipRgn* pSavedClip = (CFX_ClipRgn*)m_StateStack[m_StateStack.GetSize() - 1];
- if (m_pClipRgn) {
delete m_pClipRgn;
m_pClipRgn = NULL;
+ return;
}
+ CFX_ClipRgn* pSavedClip = (CFX_ClipRgn*)m_StateStack[m_StateStack.GetSize() - 1];
+ delete m_pClipRgn;
+ m_pClipRgn = NULL;
if (bKeepSaved) {
if (pSavedClip) {
m_pClipRgn = FX_NEW CFX_ClipRgn(*pSavedClip);
@@ -1625,7 +1619,7 @@ FX_BOOL CFX_FxgeDevice::Create(int width, int height, FXDIB_Format format, int d
}
CFX_FxgeDevice::~CFX_FxgeDevice()
{
- if (m_bOwnedBitmap && GetBitmap()) {
+ if (m_bOwnedBitmap) {
delete GetBitmap();
}
}
diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp
index 2eb0529711..623e2d6f12 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.cpp
+++ b/core/src/fxge/android/fpf_skiafontmgr.cpp
@@ -245,9 +245,7 @@ CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr()
m_FamilyFonts.RemoveAll();
for (int32_t i = m_FontFaces.GetUpperBound(); i >= 0; i--) {
CFPF_SkiaFontDescriptor *pFont = (CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(i);
- if (pFont) {
- delete pFont;
- }
+ delete pFont;
}
m_FontFaces.RemoveAll();
if (m_FTLibrary) {
diff --git a/core/src/fxge/android/fpf_skiamodule.cpp b/core/src/fxge/android/fpf_skiamodule.cpp
index f1384b466c..1d365472e3 100644
--- a/core/src/fxge/android/fpf_skiamodule.cpp
+++ b/core/src/fxge/android/fpf_skiamodule.cpp
@@ -18,9 +18,7 @@ IFPF_DeviceModule* FPF_GetDeviceModule()
}
CFPF_SkiaDeviceModule::~CFPF_SkiaDeviceModule()
{
- if (m_pFontMgr) {
- delete m_pFontMgr;
- }
+ delete m_pFontMgr;
}
void CFPF_SkiaDeviceModule::Destroy()
{
diff --git a/core/src/fxge/apple/apple_int.h b/core/src/fxge/apple/apple_int.h
index 48476c39a7..715e48d6c2 100644
--- a/core/src/fxge/apple/apple_int.h
+++ b/core/src/fxge/apple/apple_int.h
@@ -71,9 +71,7 @@ public:
}
~CApplePlatform()
{
- if (m_pFontMapper) {
- delete m_pFontMapper;
- }
+ delete m_pFontMapper;
}
CQuartz2D _quartz2d;
IFX_FontMapper* m_pFontMapper;
diff --git a/core/src/fxge/apple/fx_quartz_device.cpp b/core/src/fxge/apple/fx_quartz_device.cpp
index 0b8353f4b0..c1004d69db 100644
--- a/core/src/fxge/apple/fx_quartz_device.cpp
+++ b/core/src/fxge/apple/fx_quartz_device.cpp
@@ -1082,7 +1082,7 @@ CFX_QuartzDevice::~CFX_QuartzDevice()
if (m_pContext) {
CGContextRelease(m_pContext);
}
- if (GetBitmap() && m_bOwnedBitmap) {
+ if (m_bOwnedBitmap) {
delete GetBitmap();
}
}
diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp
index 252d26d803..cb3559180f 100644
--- a/core/src/fxge/dib/fx_dib_engine.cpp
+++ b/core/src/fxge/dib/fx_dib_engine.cpp
@@ -679,9 +679,7 @@ CFX_ImageStretcher::~CFX_ImageStretcher()
if (m_pScanline) {
FX_Free(m_pScanline);
}
- if (m_pStretchEngine) {
- delete m_pStretchEngine;
- }
+ delete m_pStretchEngine;
if (m_pMaskScanline) {
FX_Free(m_pMaskScanline);
}
diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp
index bc5c340f65..74e9c3cfd5 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()
if (m_pPalette) {
FX_Free(m_pPalette);
}
- if (m_pAlphaMask) {
- delete m_pAlphaMask;
- }
+ delete m_pAlphaMask;
}
CFX_DIBitmap::CFX_DIBitmap()
{
@@ -139,9 +137,7 @@ void CFX_DIBitmap::TakeOver(CFX_DIBitmap* pSrcBitmap)
if (m_pPalette) {
FX_Free(m_pPalette);
}
- if (m_pAlphaMask) {
- delete m_pAlphaMask;
- }
+ delete m_pAlphaMask;
m_pBuffer = pSrcBitmap->m_pBuffer;
m_pPalette = pSrcBitmap->m_pPalette;
m_pAlphaMask = pSrcBitmap->m_pAlphaMask;
@@ -1497,9 +1493,7 @@ CFX_DIBExtractor::CFX_DIBExtractor(const CFX_DIBSource* pSrc)
}
CFX_DIBExtractor::~CFX_DIBExtractor()
{
- if (m_pBitmap) {
- delete m_pBitmap;
- }
+ delete m_pBitmap;
}
CFX_FilteredDIB::CFX_FilteredDIB()
{
@@ -1508,7 +1502,7 @@ CFX_FilteredDIB::CFX_FilteredDIB()
}
CFX_FilteredDIB::~CFX_FilteredDIB()
{
- if (m_pSrc && m_bAutoDropSrc) {
+ if (m_bAutoDropSrc) {
delete m_pSrc;
}
if (m_pScanline) {
@@ -1548,9 +1542,7 @@ CFX_ImageRenderer::CFX_ImageRenderer()
}
CFX_ImageRenderer::~CFX_ImageRenderer()
{
- if (m_pTransformer) {
- delete m_pTransformer;
- }
+ delete m_pTransformer;
}
extern FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, FX_BOOL bFlipX, FX_BOOL bFlipY);
FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn,
@@ -1667,9 +1659,7 @@ CFX_BitmapStorer::CFX_BitmapStorer()
}
CFX_BitmapStorer::~CFX_BitmapStorer()
{
- if (m_pBitmap) {
- delete m_pBitmap;
- }
+ delete m_pBitmap;
}
CFX_DIBitmap* CFX_BitmapStorer::Detach()
{
@@ -1679,9 +1669,7 @@ CFX_DIBitmap* CFX_BitmapStorer::Detach()
}
void CFX_BitmapStorer::Replace(CFX_DIBitmap* pBitmap)
{
- if (m_pBitmap) {
- delete m_pBitmap;
- }
+ delete m_pBitmap;
m_pBitmap = pBitmap;
}
void CFX_BitmapStorer::ComposeScanline(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha)
diff --git a/core/src/fxge/ge/fx_ge.cpp b/core/src/fxge/ge/fx_ge.cpp
index f91953c587..8c2a4378da 100644
--- a/core/src/fxge/ge/fx_ge.cpp
+++ b/core/src/fxge/ge/fx_ge.cpp
@@ -17,13 +17,9 @@ CFX_GEModule::CFX_GEModule()
}
CFX_GEModule::~CFX_GEModule()
{
- if (m_pFontCache) {
- delete m_pFontCache;
- }
+ delete m_pFontCache;
m_pFontCache = NULL;
- if (m_pFontMgr) {
- delete m_pFontMgr;
- }
+ delete m_pFontMgr;
m_pFontMgr = NULL;
DestroyPlatform();
}
@@ -47,9 +43,7 @@ void CFX_GEModule::Use(CFX_GEModule* pModule)
}
void CFX_GEModule::Destroy()
{
- if (g_pGEModule) {
- delete g_pGEModule;
- }
+ delete g_pGEModule;
g_pGEModule = NULL;
}
CFX_FontCache* CFX_GEModule::GetFontCache()
diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp
index b4a4a89595..793dfc5ee2 100644
--- a/core/src/fxge/ge/fx_ge_device.cpp
+++ b/core/src/fxge/ge/fx_ge_device.cpp
@@ -12,15 +12,11 @@ CFX_RenderDevice::CFX_RenderDevice()
}
CFX_RenderDevice::~CFX_RenderDevice()
{
- if (m_pDeviceDriver) {
- delete m_pDeviceDriver;
- }
+ delete m_pDeviceDriver;
}
void CFX_RenderDevice::SetDeviceDriver(IFX_RenderDeviceDriver* pDriver)
{
- if (m_pDeviceDriver) {
- delete m_pDeviceDriver;
- }
+ delete m_pDeviceDriver;
m_pDeviceDriver = pDriver;
InitDeviceInfo();
}
diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp
index c9e3e3fe1f..d04f4fd59d 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -64,10 +64,8 @@ FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont)
}
CFX_Font::~CFX_Font()
{
- if (m_pSubstFont) {
- delete m_pSubstFont;
- m_pSubstFont = NULL;
- }
+ delete m_pSubstFont;
+ m_pSubstFont = NULL;
if (m_bLogic) {
m_OtfFontData.DetachBuffer();
return;
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index a15f742f38..538da9ae4c 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -74,9 +74,7 @@ CFX_FontMgr::CFX_FontMgr()
}
CFX_FontMgr::~CFX_FontMgr()
{
- if (m_pBuiltinMapper) {
- delete m_pBuiltinMapper;
- }
+ delete m_pBuiltinMapper;
FreeCache();
if (m_FTLibrary) {
FXFT_Done_FreeType(m_FTLibrary);
diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp
index 9a3b021b67..6b1f691693 100644
--- a/core/src/fxge/ge/fx_ge_text.cpp
+++ b/core/src/fxge/ge/fx_ge_text.cpp
@@ -1058,9 +1058,7 @@ CFX_FaceCache::~CFX_FaceCache()
m_PathMap.GetNextAssoc(pos, key1, (void*&)pPath);
delete pPath;
}
- if (m_pBitmap) {
- delete m_pBitmap;
- }
+ delete m_pBitmap;
m_PathMap.RemoveAll();
}
#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
diff --git a/core/src/fxge/skia/fx_skia_device.cpp b/core/src/fxge/skia/fx_skia_device.cpp
index 7a8384f89c..ae6b79b686 100644
--- a/core/src/fxge/skia/fx_skia_device.cpp
+++ b/core/src/fxge/skia/fx_skia_device.cpp
@@ -241,7 +241,7 @@ CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bit
}
CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver()
{
- if (m_pAggDriver) delete m_pAggDriver;
+ delete m_pAggDriver;
}
FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont,
CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FIXFLOAT font_size, FX_DWORD color,
diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp
index a57b04688a..b6455c3570 100644
--- a/core/src/fxge/win32/fx_win32_dib.cpp
+++ b/core/src/fxge/win32/fx_win32_dib.cpp
@@ -142,9 +142,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename)
CFX_ByteString info = GetBitmapInfo(pDIBitmap);
int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
if (!ret) {
- if (pDIBitmap) {
- delete pDIBitmap;
- }
+ delete pDIBitmap;
pDIBitmap = NULL;
}
DeleteDC(hDC);
@@ -178,9 +176,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args)
CFX_ByteString info = GetBitmapInfo(pDIBitmap);
int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
if (!ret) {
- if (pDIBitmap) {
- delete pDIBitmap;
- }
+ delete pDIBitmap;
pDIBitmap = NULL;
}
DeleteDC(hDC);
@@ -255,9 +251,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pP
}
}
if (ret == 0) {
- if (pDIBitmap) {
- delete pDIBitmap;
- }
+ delete pDIBitmap;
pDIBitmap = NULL;
}
if (bCreatedDC) {
diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp
index 74d0a3cabf..163ee84a0a 100644
--- a/core/src/fxge/win32/fx_win32_print.cpp
+++ b/core/src/fxge/win32/fx_win32_print.cpp
@@ -279,9 +279,7 @@ CPSPrinterDriver::CPSPrinterDriver()
CPSPrinterDriver::~CPSPrinterDriver()
{
EndRendering();
- if (m_pPSOutput) {
- delete m_pPSOutput;
- }
+ delete m_pPSOutput;
}
FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput)
{