summaryrefslogtreecommitdiff
path: root/core/src/fxge
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 /core/src/fxge
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.
Diffstat (limited to 'core/src/fxge')
-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
15 files changed, 32 insertions, 82 deletions
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)
{