Replace FX_NEW with new, remove tests from fpdftext
authorTom Sepez <tsepez@chromium.org>
Thu, 16 Apr 2015 21:29:43 +0000 (14:29 -0700)
committerTom Sepez <tsepez@chromium.org>
Thu, 16 Apr 2015 21:29:43 +0000 (14:29 -0700)
R=thestig@chromium.org

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

core/src/fpdftext/fpdf_text.cpp
core/src/fpdftext/fpdf_text_int.cpp

index d6d6de9..3781b2a 100644 (file)
@@ -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;
index 70178a5..2b9a079 100644 (file)
@@ -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;