From 7f6b6677665588a27b9d14babc6358840454ce17 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 16 Apr 2015 14:29:43 -0700 Subject: Replace FX_NEW with new, remove tests from fpdftext R=thestig@chromium.org Review URL: https://codereview.chromium.org/1085363003 --- core/src/fpdftext/fpdf_text.cpp | 22 +++++++--------------- core/src/fpdftext/fpdf_text_int.cpp | 19 ++++++------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp index d6d6de9a83..3781b2abb9 100644 --- a/core/src/fpdftext/fpdf_text.cpp +++ b/core/src/fpdftext/fpdf_text.cpp @@ -169,10 +169,7 @@ CTextBaseLine* CTextPage::InsertTextBox(CTextBaseLine* pBaseLine, FX_FLOAT basey } } if (pBaseLine == NULL) { - pBaseLine = FX_NEW CTextBaseLine; - if (NULL == pBaseLine) { - return NULL; - } + pBaseLine = new CTextBaseLine; pBaseLine->m_BaseLine = basey; m_BaseLines.InsertAt(i, pBaseLine); } @@ -453,13 +450,11 @@ void CTextPage::FindColumns() CTextBox* pTextBox = (CTextBox*)pBaseLine->m_TextList.GetAt(j); CTextColumn* pColumn = FindColumn(pTextBox->m_Right); if (pColumn == NULL) { - pColumn = FX_NEW CTextColumn; - if (pColumn) { - pColumn->m_Count = 1; - pColumn->m_AvgPos = pTextBox->m_Right; - pColumn->m_TextPos = -1; - m_TextColumns.Add(pColumn); - } + pColumn = new CTextColumn; + pColumn->m_Count = 1; + pColumn->m_AvgPos = pTextBox->m_Right; + pColumn->m_TextPos = -1; + m_TextColumns.Add(pColumn); } else { pColumn->m_AvgPos = (pColumn->m_Count * pColumn->m_AvgPos + pTextBox->m_Right) / (pColumn->m_Count + 1); @@ -532,10 +527,7 @@ void CTextBaseLine::InsertTextBox(FX_FLOAT leftx, FX_FLOAT rightx, FX_FLOAT topy break; } } - CTextBox* pText = FX_NEW CTextBox; - if (NULL == pText) { - return; - } + CTextBox* pText = new CTextBox; pText->m_Text = text; pText->m_Left = leftx; pText->m_Right = rightx; diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index 70178a54b0..2b9a079006 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -81,29 +81,26 @@ CPDFText_ParseOptions::CPDFText_ParseOptions() } IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_Page* pPage, CPDFText_ParseOptions ParserOptions) { - CPDF_TextPage* pTextPageEx = FX_NEW CPDF_TextPage(pPage, ParserOptions); - return pTextPageEx; + return new CPDF_TextPage(pPage, ParserOptions); } IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_Page* pPage, int flags) { - CPDF_TextPage* pTextPage = FX_NEW CPDF_TextPage(pPage, flags); - return pTextPage; + return new CPDF_TextPage(pPage, flags); } IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_PageObjects* pObjs, int flags) { - CPDF_TextPage* pTextPage = FX_NEW CPDF_TextPage(pObjs, flags); - return pTextPage; + return new CPDF_TextPage(pObjs, flags); } IPDF_TextPageFind* IPDF_TextPageFind::CreatePageFind(const IPDF_TextPage* pTextPage) { if (!pTextPage) { return NULL; } - return FX_NEW CPDF_TextPageFind(pTextPage); + return new CPDF_TextPageFind(pTextPage); } IPDF_LinkExtract* IPDF_LinkExtract::CreateLinkExtract() { - return FX_NEW CPDF_LinkExtract(); + return new CPDF_LinkExtract(); } #define TEXT_BLANK_CHAR L' ' #define TEXT_LINEFEED_CHAR L'\n' @@ -2809,11 +2806,7 @@ FX_BOOL CPDF_LinkExtract::CheckMailLink(CFX_WideString& str) } FX_BOOL CPDF_LinkExtract::AppendToLinkList(int start, int count, const CFX_WideString& strUrl) { - CPDF_LinkExt* linkInfo = NULL; - linkInfo = FX_NEW CPDF_LinkExt; - if (!linkInfo) { - return FALSE; - } + CPDF_LinkExt* linkInfo = new CPDF_LinkExt; linkInfo->m_strUrl = strUrl; linkInfo->m_Start = start; linkInfo->m_Count = count; -- cgit v1.2.3