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

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

Issue 1412083010: Merge to XFA: Support linearized loading (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month 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
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 "public/fpdf_dataavail.h" 7 #include "public/fpdf_dataavail.h"
8 8
9 #include "../include/fsdk_define.h" 9 #include "../include/fsdk_define.h"
10 #include "../include/fpdfxfa/fpdfxfa_doc.h" 10 #include "../include/fpdfxfa/fpdfxfa_doc.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 pAvail->m_FileRead.Set(file); 83 pAvail->m_FileRead.Set(file);
84 pAvail->m_pDataAvail = 84 pAvail->m_pDataAvail =
85 IPDF_DataAvail::Create(&pAvail->m_FileAvail, &pAvail->m_FileRead); 85 IPDF_DataAvail::Create(&pAvail->m_FileAvail, &pAvail->m_FileRead);
86 return pAvail; 86 return pAvail;
87 } 87 }
88 88
89 DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail) { 89 DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail) {
90 delete (CFPDF_DataAvail*)avail; 90 delete (CFPDF_DataAvail*)avail;
91 } 91 }
92 92
93 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, 93 DLLEXPORT int STDCALL
94 FX_DOWNLOADHINTS* hints) { 94 FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints) {
95 if (avail == NULL || hints == NULL) 95 if (!avail || !hints)
96 return 0; 96 return PDF_DATA_ERROR;
97 CFPDF_DownloadHintsWrap hints_wrap(hints); 97 CFPDF_DownloadHintsWrap hints_wrap(hints);
98 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsDocAvail(&hints_wrap); 98 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsDocAvail(&hints_wrap);
99 } 99 }
100 100
101 DLLEXPORT FPDF_DOCUMENT STDCALL 101 DLLEXPORT FPDF_DOCUMENT STDCALL
102 FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { 102 FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) {
103 if (avail == NULL) 103 if (avail == NULL)
104 return NULL; 104 return NULL;
105 CPDF_Parser* pParser = new CPDF_Parser; 105 CPDF_Parser* pParser = new CPDF_Parser;
106 pParser->SetPassword(password); 106 pParser->SetPassword(password);
(...skipping 11 matching lines...) Expand all
118 } 118 }
119 119
120 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { 120 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) {
121 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc); 121 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc);
122 return pDoc ? pDoc->GetParser()->GetFirstPageNo() : 0; 122 return pDoc ? pDoc->GetParser()->GetFirstPageNo() : 0;
123 } 123 }
124 124
125 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, 125 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
126 int page_index, 126 int page_index,
127 FX_DOWNLOADHINTS* hints) { 127 FX_DOWNLOADHINTS* hints) {
128 if (avail == NULL || hints == NULL) 128 if (!avail || !hints)
129 return 0; 129 return PDF_DATA_ERROR;
130 CFPDF_DownloadHintsWrap hints_wrap(hints); 130 CFPDF_DownloadHintsWrap hints_wrap(hints);
131 return ((CFPDF_DataAvail*)avail) 131 return ((CFPDF_DataAvail*)avail)
132 ->m_pDataAvail->IsPageAvail(page_index, &hints_wrap); 132 ->m_pDataAvail->IsPageAvail(page_index, &hints_wrap);
133 } 133 }
134 134
135 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, 135 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
136 FX_DOWNLOADHINTS* hints) { 136 FX_DOWNLOADHINTS* hints) {
137 if (avail == NULL || hints == NULL) 137 if (!avail || !hints)
138 return -1; 138 return PDF_FORM_ERROR;
139 CFPDF_DownloadHintsWrap hints_wrap(hints); 139 CFPDF_DownloadHintsWrap hints_wrap(hints);
140 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); 140 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap);
141 } 141 }
142 142
143 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { 143 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) {
144 if (avail == NULL) 144 if (!avail)
145 return -1; 145 return PDF_LINEARIZATION_UNKNOWN;
146 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); 146 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF();
147 } 147 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/parser_int.h ('k') | pdfium.gyp » ('j') | samples/pdfium_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698