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

Side by Side Diff: core/src/fpdftext/fpdf_text_int.cpp

Issue 1085363003: Replace FX_NEW with new, remove tests from fpdftext (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « core/src/fpdftext/fpdf_text.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/fpdfapi/fpdf_resource.h" 7 #include "../../include/fpdfapi/fpdf_resource.h"
8 #include "../../include/fpdfapi/fpdf_pageobj.h" 8 #include "../../include/fpdfapi/fpdf_pageobj.h"
9 #include "../../include/fpdftext/fpdf_text.h" 9 #include "../../include/fpdftext/fpdf_text.h"
10 #include "../../include/fpdfapi/fpdf_page.h" 10 #include "../../include/fpdfapi/fpdf_page.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 } // namespace 76 } // namespace
77 77
78 CPDFText_ParseOptions::CPDFText_ParseOptions() 78 CPDFText_ParseOptions::CPDFText_ParseOptions()
79 : m_bGetCharCodeOnly(FALSE), m_bNormalizeObjs(TRUE), m_bOutputHyphen(FALSE) 79 : m_bGetCharCodeOnly(FALSE), m_bNormalizeObjs(TRUE), m_bOutputHyphen(FALSE)
80 { 80 {
81 } 81 }
82 IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_Page* pPage, CPDFText_Pa rseOptions ParserOptions) 82 IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_Page* pPage, CPDFText_Pa rseOptions ParserOptions)
83 { 83 {
84 CPDF_TextPage* pTextPageEx = FX_NEW CPDF_TextPage(pPage, ParserOptions); 84 return new CPDF_TextPage(pPage, ParserOptions);
85 return pTextPageEx;
86 } 85 }
87 IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_Page* pPage, int flags) 86 IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_Page* pPage, int flags)
88 { 87 {
89 CPDF_TextPage* pTextPage = FX_NEW CPDF_TextPage(pPage, flags); 88 return new CPDF_TextPage(pPage, flags);
90 return» pTextPage;
91 } 89 }
92 IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_PageObjects* pObjs, int flags) 90 IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_PageObjects* pObjs, int flags)
93 { 91 {
94 CPDF_TextPage* pTextPage = FX_NEW CPDF_TextPage(pObjs, flags); 92 return new CPDF_TextPage(pObjs, flags);
95 return» pTextPage;
96 } 93 }
97 IPDF_TextPageFind* IPDF_TextPageFind::CreatePageFind(const IPDF_TextPage* p TextPage) 94 IPDF_TextPageFind* IPDF_TextPageFind::CreatePageFind(const IPDF_TextPage* p TextPage)
98 { 95 {
99 if (!pTextPage) { 96 if (!pTextPage) {
100 return NULL; 97 return NULL;
101 } 98 }
102 return FX_NEW CPDF_TextPageFind(pTextPage); 99 return new CPDF_TextPageFind(pTextPage);
103 } 100 }
104 IPDF_LinkExtract* IPDF_LinkExtract::CreateLinkExtract() 101 IPDF_LinkExtract* IPDF_LinkExtract::CreateLinkExtract()
105 { 102 {
106 return FX_NEW CPDF_LinkExtract(); 103 return new CPDF_LinkExtract();
107 } 104 }
108 #define TEXT_BLANK_CHAR L' ' 105 #define TEXT_BLANK_CHAR L' '
109 #define TEXT_LINEFEED_CHAR L'\n' 106 #define TEXT_LINEFEED_CHAR L'\n'
110 #define TEXT_RETURN_CHAR L'\r' 107 #define TEXT_RETURN_CHAR L'\r'
111 #define TEXT_EMPTY L"" 108 #define TEXT_EMPTY L""
112 #define TEXT_BLANK L" " 109 #define TEXT_BLANK L" "
113 #define TEXT_RETURN_LINEFEED L"\r\n" 110 #define TEXT_RETURN_LINEFEED L"\r\n"
114 #define TEXT_LINEFEED L"\n" 111 #define TEXT_LINEFEED L"\n"
115 #define TEXT_CHARRATIO_GAPDELTA 0.070 112 #define TEXT_CHARRATIO_GAPDELTA 0.070
116 CPDF_TextPage::CPDF_TextPage(const CPDF_Page* pPage, int flags) 113 CPDF_TextPage::CPDF_TextPage(const CPDF_Page* pPage, int flags)
(...skipping 2685 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 return FALSE; 2799 return FALSE;
2803 } 2800 }
2804 } 2801 }
2805 if (str.Find(L"mailto:") == -1) { 2802 if (str.Find(L"mailto:") == -1) {
2806 str = L"mailto:" + str; 2803 str = L"mailto:" + str;
2807 } 2804 }
2808 return TRUE; 2805 return TRUE;
2809 } 2806 }
2810 FX_BOOL CPDF_LinkExtract::AppendToLinkList(int start, int count, const CFX_WideS tring& strUrl) 2807 FX_BOOL CPDF_LinkExtract::AppendToLinkList(int start, int count, const CFX_WideS tring& strUrl)
2811 { 2808 {
2812 CPDF_LinkExt* linkInfo = NULL; 2809 CPDF_LinkExt* linkInfo = new CPDF_LinkExt;
2813 linkInfo = FX_NEW CPDF_LinkExt;
2814 if (!linkInfo) {
2815 return FALSE;
2816 }
2817 linkInfo->m_strUrl = strUrl; 2810 linkInfo->m_strUrl = strUrl;
2818 linkInfo->m_Start = start; 2811 linkInfo->m_Start = start;
2819 linkInfo->m_Count = count; 2812 linkInfo->m_Count = count;
2820 m_LinkList.Add(linkInfo); 2813 m_LinkList.Add(linkInfo);
2821 return TRUE; 2814 return TRUE;
2822 } 2815 }
2823 CFX_WideString CPDF_LinkExtract::GetURL(int index) const 2816 CFX_WideString CPDF_LinkExtract::GetURL(int index) const
2824 { 2817 {
2825 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) { 2818 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) {
2826 return L""; 2819 return L"";
(...skipping 23 matching lines...) Expand all
2850 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) { 2843 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) {
2851 return; 2844 return;
2852 } 2845 }
2853 CPDF_LinkExt* link = NULL; 2846 CPDF_LinkExt* link = NULL;
2854 link = m_LinkList.GetAt(index); 2847 link = m_LinkList.GetAt(index);
2855 if (!link) { 2848 if (!link) {
2856 return ; 2849 return ;
2857 } 2850 }
2858 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); 2851 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects);
2859 } 2852 }
OLDNEW
« no previous file with comments | « core/src/fpdftext/fpdf_text.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698