Cleanup: Do not check pointers before deleting them.
authorLei Zhang <thestig@chromium.org>
Fri, 19 Jun 2015 21:51:10 +0000 (14:51 -0700)
committerLei Zhang <thestig@chromium.org>
Fri, 19 Jun 2015 21:51:10 +0000 (14:51 -0700)
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1192743004.

46 files changed:
core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
core/src/fpdfapi/fpdf_font/fpdf_font.cpp
core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
core/src/fpdfapi/fpdf_font/ttgsubtable.h
core/src/fpdfapi/fpdf_page/fpdf_page.cpp
core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
core/src/fpdfdoc/doc_vt.cpp
core/src/fpdfdoc/pdf_vt.h
core/src/fxcodec/codec/fx_codec_icc.cpp
core/src/fxcodec/jbig2/JBig2_Context.cpp
core/src/fxcodec/jbig2/JBig2_PatternDict.cpp
core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp
core/src/fxge/agg/src/fx_agg_driver.cpp
core/src/fxge/android/fpf_skiafontmgr.cpp
core/src/fxge/android/fpf_skiamodule.cpp
core/src/fxge/apple/apple_int.h
core/src/fxge/apple/fx_quartz_device.cpp
core/src/fxge/dib/fx_dib_engine.cpp
core/src/fxge/dib/fx_dib_main.cpp
core/src/fxge/ge/fx_ge.cpp
core/src/fxge/ge/fx_ge_device.cpp
core/src/fxge/ge/fx_ge_font.cpp
core/src/fxge/ge/fx_ge_fontmap.cpp
core/src/fxge/ge/fx_ge_text.cpp
core/src/fxge/skia/fx_skia_device.cpp
core/src/fxge/win32/fx_win32_dib.cpp
core/src/fxge/win32/fx_win32_print.cpp
fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
fpdfsdk/src/fpdf_dataavail.cpp
fpdfsdk/src/fpdfview.cpp
fpdfsdk/src/fsdk_mgr.cpp
fpdfsdk/src/fsdk_rendercontext.cpp
fpdfsdk/src/fxedit/fxet_edit.cpp
fpdfsdk/src/javascript/app.cpp
fpdfsdk/src/pdfwindow/PWL_ListBox.cpp
fpdfsdk/src/pdfwindow/PWL_Wnd.cpp

index b7eb05f..22826a3 100644 (file)
@@ -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;
     }
index 784fc01..2db8d60 100644 (file)
@@ -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);
index 14207f7..e7072e8 100644 (file)
@@ -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;
 }
index 0b4064b..7dd019d 100644 (file)
@@ -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
 {
index 69ccc3e..1b18f82 100644 (file)
@@ -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&);
index 85c785f..db3966e 100644 (file)
@@ -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();
index 1146d76..0ee7a0d 100644 (file)
@@ -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();
     }
index 6362be9..f115b67 100644 (file)
@@ -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);
     }
index e2d075e..70d0743 100644 (file)
@@ -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);
     }
index 5f4023a..fdc4a27 100644 (file)
@@ -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);
index 6f09969..ff1f6c4 100644 (file)
@@ -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) {
index bd53874..48b3a40 100644 (file)
@@ -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"));
index ac48dc6..efe085c 100644 (file)
@@ -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)
index 56df7f3..685ee04 100644 (file)
@@ -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();
 }
index 6a876a2..cdbecd6 100644 (file)
@@ -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();
index 5748e23..3ee2222 100644 (file)
@@ -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) {
index fd3cbb0..c6fdf0e 100644 (file)
@@ -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()
index 5acab96..a75490f 100644 (file)
@@ -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)
index 703d00a..da503c0 100644 (file)
@@ -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)
index f58b7f3..41a3cce 100644 (file)
@@ -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;
 }
 
index 0c6e5be..df45288 100644 (file)
@@ -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);
     }
index e9bb9c6..0e5b92f 100644 (file)
@@ -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);
     }
index 18a1fa4..8e7846a 100644 (file)
@@ -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();
     }
 }
index ec7af81..86bb052 100644 (file)
@@ -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) {
index e6fded6..37bfd9c 100644 (file)
@@ -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()
 {
index 48476c3..715e48d 100644 (file)
@@ -71,9 +71,7 @@ public:
     }
     ~CApplePlatform()
     {
-        if (m_pFontMapper) {
-            delete m_pFontMapper;
-        }
+        delete m_pFontMapper;
     }
     CQuartz2D  _quartz2d;
     IFX_FontMapper* m_pFontMapper;
index 8f0f4db..d1e4f54 100644 (file)
@@ -1082,7 +1082,7 @@ CFX_QuartzDevice::~CFX_QuartzDevice()
     if (m_pContext) {
         CGContextRelease(m_pContext);
     }
-    if (GetBitmap() && m_bOwnedBitmap) {
+    if (m_bOwnedBitmap) {
         delete GetBitmap();
     }
 }
index 54b9bd9..11e9a11 100644 (file)
@@ -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);
     }
index a148334..82a1497 100644 (file)
@@ -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)
index 5198a04..4b34a07 100644 (file)
@@ -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()
index b4a4a89..793dfc5 100644 (file)
@@ -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();
 }
index 8e4e5ac..f88cbaa 100644 (file)
@@ -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;
index 8406b3c..8956cd1 100644 (file)
@@ -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);
index 7daeecb..b55119b 100644 (file)
@@ -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_
index 3812426..41ce077 100644 (file)
@@ -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,
index 7d6fe2e..191c2dc 100644 (file)
@@ -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) {
index a8e8ce1..199ab78 100644 (file)
@@ -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)
 {
index 9969c18..464ff3c 100644 (file)
@@ -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)
index b6363a8..b26d2af 100644 (file)
@@ -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)
index 5473119..9db0554 100644 (file)
@@ -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,
index b8028aa..5d4680d 100644 (file)
@@ -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;
index 70c4a17..4b7242d 100644 (file)
@@ -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
 }
 
index 70d7b77..8e109b5 100644 (file)
@@ -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)
index 8966228..9d992d0 100644 (file)
@@ -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;
                                }
                        }
 
index 0328ee5..48fb409 100644 (file)
@@ -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)
index 8ee9967..dcc6e40 100644 (file)
@@ -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)