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

Side by Side Diff: fpdfsdk/src/fpdftext.cpp

Issue 1235753006: Merge to XFA: Cleanup: Do not check pointers before deleting them, part 2. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 5 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 | « fpdfsdk/src/fpdf_transformpage.cpp ('k') | fpdfsdk/src/javascript/JS_Context.cpp » ('j') | 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 "../../core/include/fpdfdoc/fpdf_doc.h" 7 #include "../../core/include/fpdfdoc/fpdf_doc.h"
8 #include "../../core/include/fpdftext/fpdf_text.h" 8 #include "../../core/include/fpdftext/fpdf_text.h"
9 #include "../../public/fpdf_text.h" 9 #include "../../public/fpdf_text.h"
10 #include "../include/fpdfxfa/fpdfxfa_doc.h" 10 #include "../include/fpdfxfa/fpdfxfa_doc.h"
(...skipping 14 matching lines...) Expand all
25 if (!pPage->GetPDFPage()) return NULL; 25 if (!pPage->GetPDFPage()) return NULL;
26 CPDFXFA_Document* pDoc = pPage->GetDocument(); 26 CPDFXFA_Document* pDoc = pPage->GetDocument();
27 CPDF_ViewerPreferences viewRef(pDoc->GetPDFDoc()); 27 CPDF_ViewerPreferences viewRef(pDoc->GetPDFDoc());
28 textpage=IPDF_TextPage::CreateTextPage((CPDF_Page*)pPage->GetPDFPage(),v iewRef.IsDirectionR2L()); 28 textpage=IPDF_TextPage::CreateTextPage((CPDF_Page*)pPage->GetPDFPage(),v iewRef.IsDirectionR2L());
29 textpage->ParseTextPage(); 29 textpage->ParseTextPage();
30 30
31 return textpage; 31 return textpage;
32 } 32 }
33 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) 33 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page)
34 { 34 {
35 » if (text_page){ 35 delete (IPDF_TextPage*)text_page;
36 » » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page;
37 » » delete textpage;
38 » » text_page=NULL;
39 » }
40 } 36 }
41 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) 37 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page)
42 { 38 {
43 if (!text_page) return -1; 39 if (!text_page) return -1;
44 IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; 40 IPDF_TextPage* textpage=(IPDF_TextPage*)text_page;
45 return textpage->CountChars(); 41 return textpage->CountChars();
46 } 42 }
47 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index) 43 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index)
48 { 44 {
49 if (!text_page) return -1; 45 if (!text_page) return -1;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (rect_index >= 0 && rect_index < rectArray.GetSize()) { 241 if (rect_index >= 0 && rect_index < rectArray.GetSize()) {
246 CFX_FloatRect rect=rectArray.GetAt(rect_index); 242 CFX_FloatRect rect=rectArray.GetAt(rect_index);
247 *left=rect.left; 243 *left=rect.left;
248 *right=rect.right; 244 *right=rect.right;
249 *top=rect.top; 245 *top=rect.top;
250 *bottom=rect.bottom; 246 *bottom=rect.bottom;
251 } 247 }
252 } 248 }
253 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) 249 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page)
254 { 250 {
255 » if (!link_page) return; 251 delete (IPDF_LinkExtract*)link_page;
256 » IPDF_LinkExtract* pageLink=(IPDF_LinkExtract*)link_page;
257 » delete pageLink;
258 » pageLink =NULL;
259 } 252 }
260 253
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdf_transformpage.cpp ('k') | fpdfsdk/src/javascript/JS_Context.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698