Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: fpdfsdk/include/fxedit/fxet_edit.h

Issue 1287863002: Remove if checks after new. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fpdfsdk/include/fxedit/fxet_edit.h
diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h
index d654ebc4513120fb24fcde327cf2c78ebd5b8ae5..9a87b96f04bdc6a7dbcc3a7870dc194b5702c31f 100644
--- a/fpdfsdk/include/fxedit/fxet_edit.h
+++ b/fpdfsdk/include/fxedit/fxet_edit.h
@@ -115,8 +115,8 @@ 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);
+ CFX_Edit_LineRect* pRect = new CFX_Edit_LineRect(wrLine, rcLine);
Tom Sepez 2015/08/12 22:20:37 nit: just m_LineRects.Add(new CFX_Edit_LineRect(wr
Lei Zhang 2015/08/13 22:23:57 Done.
+ m_LineRects.Add(pRect);
}
int32_t GetSize() const { return m_LineRects.GetSize(); }
@@ -145,14 +145,15 @@ 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;
+ }
+
+ CPDF_Rect* pNewRect = new CPDF_Rect(rect);
+ m_Rects.Add(pNewRect);
Tom Sepez 2015/08/12 22:20:37 nit: just m_Rects.Add(new CPDF_Rect(rect));
Lei Zhang 2015/08/13 22:23:57 Done.
}
int32_t GetSize() const { return m_Rects.GetSize(); }

Powered by Google App Engine
This is Rietveld 408576698