diff options
author | Lei Zhang <thestig@chromium.org> | 2015-08-13 15:24:19 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-08-13 15:24:19 -0700 |
commit | 388a3b0b8d6f75d47978c08299300f121f04884c (patch) | |
tree | fadc1a463409d762d66f3f82ea75af497b9c3268 /fpdfsdk/include | |
parent | 5312f9a6ed88e653f4cfb604d892ca18da75e721 (diff) | |
download | pdfium-388a3b0b8d6f75d47978c08299300f121f04884c.tar.xz |
Remove if checks after new.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1287863002 .
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r-- | fpdfsdk/include/fxedit/fxet_edit.h | 19 | ||||
-rw-r--r-- | fpdfsdk/include/javascript/JS_Object.h | 9 |
2 files changed, 13 insertions, 15 deletions
diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h index d654ebc451..2cb7c99720 100644 --- a/fpdfsdk/include/fxedit/fxet_edit.h +++ b/fpdfsdk/include/fxedit/fxet_edit.h @@ -115,8 +115,7 @@ class CFX_Edit_LineRectArray { } void Add(const CPVT_WordRange& wrLine, const CPDF_Rect& rcLine) { - if (CFX_Edit_LineRect* pRect = new CFX_Edit_LineRect(wrLine, rcLine)) - m_LineRects.Add(pRect); + m_LineRects.Add(new CFX_Edit_LineRect(wrLine, rcLine)); } int32_t GetSize() const { return m_LineRects.GetSize(); } @@ -145,14 +144,14 @@ class CFX_Edit_RectArray { } void Add(const CPDF_Rect& rect) { - // check for overlaped area - for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++) - if (CPDF_Rect* pRect = m_Rects.GetAt(i)) - if (pRect->Contains(rect)) - return; - - if (CPDF_Rect* pNewRect = new CPDF_Rect(rect)) - m_Rects.Add(pNewRect); + // check for overlapped area + for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++) { + CPDF_Rect* pRect = m_Rects.GetAt(i); + if (pRect && pRect->Contains(rect)) + return; + } + + m_Rects.Add(new CPDF_Rect(rect)); } int32_t GetSize() const { return m_Rects.GetSize(); } diff --git a/fpdfsdk/include/javascript/JS_Object.h b/fpdfsdk/include/javascript/JS_Object.h index fd63d98cbc..c0c3ab0c46 100644 --- a/fpdfsdk/include/javascript/JS_Object.h +++ b/fpdfsdk/include/javascript/JS_Object.h @@ -109,11 +109,10 @@ struct JS_TIMER_MAPARRAY { if (JS_TIMER_MAP* pMap = m_Array.GetAt(i)) pMap->pTimer = pTimer; } else { - if (JS_TIMER_MAP* pMap = new JS_TIMER_MAP) { - pMap->nID = nIndex; - pMap->pTimer = pTimer; - m_Array.Add(pMap); - } + JS_TIMER_MAP* pMap = new JS_TIMER_MAP; + pMap->nID = nIndex; + pMap->pTimer = pTimer; + m_Array.Add(pMap); } } |