summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-19 14:51:10 -0700
committerLei Zhang <thestig@chromium.org>2015-06-19 14:51:10 -0700
commitcfac954abcab7caf47d3fa3d641c553cba998271 (patch)
tree4cd546a2377e973fec54b75c1002c8c0ff321e8f
parentdf558514bf5cb5750d5a7000a843f45f4170d5a4 (diff)
downloadpdfium-cfac954abcab7caf47d3fa3d641c553cba998271.tar.xz
Cleanup: Do not check pointers before deleting them.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1192743004.
-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
-rw-r--r--fpdfsdk/src/formfiller/FFL_IFormFiller.cpp13
-rw-r--r--fpdfsdk/src/fpdf_dataavail.cpp5
-rw-r--r--fpdfsdk/src/fpdfview.cpp17
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp46
-rw-r--r--fpdfsdk/src/fsdk_rendercontext.cpp16
-rw-r--r--fpdfsdk/src/fxedit/fxet_edit.cpp24
-rw-r--r--fpdfsdk/src/javascript/app.cpp2
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_ListBox.cpp19
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Wnd.cpp2
46 files changed, 186 insertions, 454 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 56df7f3a0c..685ee047aa 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -68,7 +68,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;
}
@@ -309,11 +309,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;
}
@@ -1482,7 +1480,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;
}
@@ -2984,12 +2982,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) {
@@ -4640,10 +4634,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 fd3cbb058c..c6fdf0e3e7 100644
--- a/core/src/fpdfdoc/doc_vt.cpp
+++ b/core/src/fpdfdoc/doc_vt.cpp
@@ -822,10 +822,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 5acab96fbd..a75490fcd5 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 18a1fa43b5..8e7846abd4 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];
@@ -274,17 +272,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 = new CFX_ClipRgn(*pSavedClip);
@@ -1604,7 +1598,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 ec7af81e79..86bb052435 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 e6fded6317..37bfd9cabb 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 8f0f4db6ba..d1e4f544ba 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 54b9bd9e66..11e9a110cb 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 a148334f3c..82a14974f4 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;
@@ -1470,9 +1466,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()
{
@@ -1481,7 +1475,7 @@ CFX_FilteredDIB::CFX_FilteredDIB()
}
CFX_FilteredDIB::~CFX_FilteredDIB()
{
- if (m_pSrc && m_bAutoDropSrc) {
+ if (m_bAutoDropSrc) {
delete m_pSrc;
}
if (m_pScanline) {
@@ -1521,9 +1515,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,
@@ -1637,9 +1629,7 @@ CFX_BitmapStorer::CFX_BitmapStorer()
}
CFX_BitmapStorer::~CFX_BitmapStorer()
{
- if (m_pBitmap) {
- delete m_pBitmap;
- }
+ delete m_pBitmap;
}
CFX_DIBitmap* CFX_BitmapStorer::Detach()
{
@@ -1649,9 +1639,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 5198a042e8..4b34a079e5 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();
}
@@ -44,9 +40,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 8e4e5ac2e3..f88cbaacde 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -28,10 +28,8 @@ CFX_Font::CFX_Font()
}
CFX_Font::~CFX_Font()
{
- if (m_pSubstFont) {
- delete m_pSubstFont;
- m_pSubstFont = NULL;
- }
+ delete m_pSubstFont;
+ m_pSubstFont = NULL;
if (m_pFontDataAllocation) {
FX_Free(m_pFontDataAllocation);
m_pFontDataAllocation = NULL;
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index 8406b3c37b..8956cd1c88 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -71,9 +71,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 7daeecbb8b..b55119b915 100644
--- a/core/src/fxge/ge/fx_ge_text.cpp
+++ b/core/src/fxge/ge/fx_ge_text.cpp
@@ -1082,9 +1082,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 381242686a..41ce077976 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 7d6fe2efaa..191c2dc9cd 100644
--- a/core/src/fxge/win32/fx_win32_dib.cpp
+++ b/core/src/fxge/win32/fx_win32_dib.cpp
@@ -135,9 +135,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);
@@ -167,9 +165,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);
@@ -241,9 +237,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 a8e8ce19fe..199ab78d9f 100644
--- a/core/src/fxge/win32/fx_win32_print.cpp
+++ b/core/src/fxge/win32/fx_win32_print.cpp
@@ -273,9 +273,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)
{
diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
index 9969c18b63..464ff3ce6b 100644
--- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
@@ -704,14 +704,11 @@ void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot)
void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot)
{
- CFFL_FormFiller * pFormFiller = NULL;
-
- if (m_Maps.Lookup(pAnnot,pFormFiller))
- {
- if (pFormFiller)
- delete pFormFiller;
- m_Maps.RemoveKey(pAnnot);
- }
+ CFFL_FormFiller* pFormFiller = nullptr;
+ if (m_Maps.Lookup(pAnnot,pFormFiller)) {
+ delete pFormFiller;
+ m_Maps.RemoveKey(pAnnot);
+ }
}
void CFFL_IFormFiller::SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameField, FX_BOOL bNext)
diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp
index b6363a8827..b26d2af10a 100644
--- a/fpdfsdk/src/fpdf_dataavail.cpp
+++ b/fpdfsdk/src/fpdf_dataavail.cpp
@@ -87,7 +87,7 @@ public:
~CFPDF_DataAvail()
{
- if (m_pDataAvail) delete m_pDataAvail;
+ delete m_pDataAvail;
}
IPDF_DataAvail* m_pDataAvail;
@@ -106,8 +106,7 @@ DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_FIL
DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail)
{
- if (avail == NULL) return;
- delete (CFPDF_DataAvail*)avail;
+ delete (CFPDF_DataAvail*)avail;
}
DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints)
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 54731193dd..9db0554ab3 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -481,14 +481,12 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int
#endif
#endif
- if (bBackgroundAlphaNeeded)
- {
- if (pBitmap)
- delete pBitmap;
- pBitmap = NULL;
- }
- delete pContext;
- pPage->RemovePrivateData((void*)1);
+ if (bBackgroundAlphaNeeded) {
+ delete pBitmap;
+ pBitmap = NULL;
+ }
+ delete pContext;
+ pPage->RemovePrivateData((void*)1);
}
#endif
@@ -662,8 +660,7 @@ DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap)
DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap)
{
- if (bitmap == NULL) return;
- delete (CFX_DIBitmap*)bitmap;
+ delete (CFX_DIBitmap*)bitmap;
}
void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index b8028aad73..5d4680d978 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -239,34 +239,19 @@ CPDFDoc_Environment::CPDFDoc_Environment(CPDF_Document* pDoc) :
CPDFDoc_Environment::~CPDFDoc_Environment()
{
+ delete m_pIFormFiller;
+ m_pIFormFiller = NULL;
+ if (m_pJSRuntime && m_pJSRuntimeFactory)
+ m_pJSRuntimeFactory->DeleteJSRuntime(m_pJSRuntime);
+ m_pJSRuntimeFactory->Release();
- if ( m_pIFormFiller )
- {
- delete m_pIFormFiller;
- m_pIFormFiller = NULL;
- }
- if(m_pJSRuntime && m_pJSRuntimeFactory)
- m_pJSRuntimeFactory->DeleteJSRuntime(m_pJSRuntime);
- m_pJSRuntimeFactory->Release();
-
- if(m_pSysHandler)
- {
- delete m_pSysHandler;
- m_pSysHandler = NULL;
- }
-
- if(m_pAnnotHandlerMgr)
- {
- delete m_pAnnotHandlerMgr;
- m_pAnnotHandlerMgr = NULL;
- }
- if(m_pActionHandler)
- {
- delete m_pActionHandler;
- m_pActionHandler = NULL;
- }
-
+ delete m_pSysHandler;
+ m_pSysHandler = NULL;
+ delete m_pAnnotHandlerMgr;
+ m_pAnnotHandlerMgr = NULL;
+ delete m_pActionHandler;
+ m_pActionHandler = NULL;
}
@@ -639,11 +624,10 @@ CPDFSDK_PageView::~CPDFSDK_PageView()
pAnnotHandlerMgr->ReleaseAnnot(pAnnot);
}
m_fxAnnotArray.RemoveAll();
- if(m_pAnnotList)
- {
- delete m_pAnnotList;
- m_pAnnotList = NULL;
- }
+
+ delete m_pAnnotList;
+ m_pAnnotList = NULL;
+
m_page->RemovePrivateData((void*)m_page);
if(m_bTakeOverPage) {
delete m_page;
diff --git a/fpdfsdk/src/fsdk_rendercontext.cpp b/fpdfsdk/src/fsdk_rendercontext.cpp
index 70c4a17248..4b7242d2b9 100644
--- a/fpdfsdk/src/fsdk_rendercontext.cpp
+++ b/fpdfsdk/src/fsdk_rendercontext.cpp
@@ -21,15 +21,15 @@ void CRenderContext::Clear()
CRenderContext::~CRenderContext()
{
- if (m_pRenderer) delete m_pRenderer;
- if (m_pContext) delete m_pContext;
- if (m_pDevice) delete m_pDevice;
- if (m_pAnnots) delete m_pAnnots;
- if (m_pOptions->m_pOCContext) delete m_pOptions->m_pOCContext;
- if (m_pOptions) delete m_pOptions;
+ delete m_pRenderer;
+ delete m_pContext;
+ delete m_pDevice;
+ delete m_pAnnots;
+ delete m_pOptions->m_pOCContext;
+ delete m_pOptions;
#ifdef _WIN32_WCE
- if (m_pBitmap) delete m_pBitmap;
- if (m_hBitmap) DeleteObject(m_hBitmap);
+ delete m_pBitmap;
+ if (m_hBitmap) DeleteObject(m_hBitmap);
#endif
}
diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp
index 70d7b77553..8e109b5cf8 100644
--- a/fpdfsdk/src/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/src/fxedit/fxet_edit.cpp
@@ -971,19 +971,11 @@ CFX_Edit::CFX_Edit(IPDF_VariableText * pVT) :
CFX_Edit::~CFX_Edit()
{
- if (m_pVTProvide)
- {
- delete m_pVTProvide;
- m_pVTProvide = NULL;
- }
-
- if (m_pIterator)
- {
- delete m_pIterator;
- m_pIterator = NULL;
- }
-
- ASSERT(m_pGroupUndoItem == NULL);
+ delete m_pVTProvide;
+ m_pVTProvide = NULL;
+ delete m_pIterator;
+ m_pIterator = NULL;
+ ASSERT(m_pGroupUndoItem == NULL);
}
// public methods
@@ -997,10 +989,8 @@ void CFX_Edit::Initialize()
void CFX_Edit::SetFontMap(IFX_Edit_FontMap * pFontMap)
{
- if (m_pVTProvide)
- delete m_pVTProvide;
-
- m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap));
+ delete m_pVTProvide;
+ m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap));
}
void CFX_Edit::SetVTProvider(IPDF_VariableText_Provider* pProvider)
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp
index 896622822c..9d992d0189 100644
--- a/fpdfsdk/src/javascript/app.cpp
+++ b/fpdfsdk/src/javascript/app.cpp
@@ -360,7 +360,7 @@ FX_BOOL app::alert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& v
swMsg += L", ";
}
- if(pValue) delete pValue;
+ delete pValue;
}
}
diff --git a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp
index 0328ee55d6..48fb409b7b 100644
--- a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp
@@ -90,13 +90,9 @@ CPWL_ListBox::CPWL_ListBox() :
CPWL_ListBox::~CPWL_ListBox()
{
- IFX_List::DelList(m_pList);
-
- if (m_pListNotify)
- {
- delete m_pListNotify;
- m_pListNotify = NULL;
- }
+ IFX_List::DelList(m_pList);
+ delete m_pListNotify;
+ m_pListNotify = NULL;
}
CFX_ByteString CPWL_ListBox::GetClassName() const
@@ -108,7 +104,7 @@ void CPWL_ListBox::OnCreated()
{
if (m_pList)
{
- if (m_pListNotify) delete m_pListNotify;
+ delete m_pListNotify;
m_pList->SetFontMap(GetFontMap());
m_pList->SetNotify(m_pListNotify = new CPWL_List_Notify(this));
@@ -123,11 +119,8 @@ void CPWL_ListBox::OnCreated()
void CPWL_ListBox::OnDestroy()
{
- if (m_pListNotify)
- {
- delete m_pListNotify;
- m_pListNotify = NULL;
- }
+ delete m_pListNotify;
+ m_pListNotify = NULL;
}
void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream)
diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
index 8ee9967763..dcc6e409a4 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
@@ -71,7 +71,7 @@ CPWL_TimerHandler::CPWL_TimerHandler() : m_pTimer(NULL)
CPWL_TimerHandler::~CPWL_TimerHandler()
{
- if (m_pTimer) delete m_pTimer;
+ delete m_pTimer;
}
void CPWL_TimerHandler::BeginTimer(int32_t nElapse)