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

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

Issue 1366593002: Support linearized loading (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 3 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/fpdfapi/fpdf_parser/parser_int.h ('k') | fpdfsdk/src/fpdf_dataavail_embeddertest.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 "../../public/fpdf_dataavail.h" 7 #include "../../public/fpdf_dataavail.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 9
10 class CFPDF_FileAvailWrap : public IFX_FileAvail { 10 class CFPDF_FileAvailWrap : public IFX_FileAvail {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 pAvail->m_FileRead.Set(file); 79 pAvail->m_FileRead.Set(file);
80 pAvail->m_pDataAvail = 80 pAvail->m_pDataAvail =
81 IPDF_DataAvail::Create(&pAvail->m_FileAvail, &pAvail->m_FileRead); 81 IPDF_DataAvail::Create(&pAvail->m_FileAvail, &pAvail->m_FileRead);
82 return pAvail; 82 return pAvail;
83 } 83 }
84 84
85 DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail) { 85 DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail) {
86 delete (CFPDF_DataAvail*)avail; 86 delete (CFPDF_DataAvail*)avail;
87 } 87 }
88 88
89 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, 89 DLLEXPORT FX_BOOL STDCALL
90 FX_DOWNLOADHINTS* hints) { 90 FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints) {
91 if (avail == NULL || hints == NULL) 91 if (!avail || !hints)
92 return 0; 92 return true;
93 CFPDF_DownloadHintsWrap hints_wrap(hints); 93 CFPDF_DownloadHintsWrap hints_wrap(hints);
94 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsDocAvail(&hints_wrap); 94 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsDocAvail(&hints_wrap);
95 } 95 }
96 96
97 DLLEXPORT FPDF_DOCUMENT STDCALL 97 DLLEXPORT FPDF_DOCUMENT STDCALL
98 FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { 98 FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) {
99 if (avail == NULL) 99 if (avail == NULL)
100 return NULL; 100 return NULL;
101 CPDF_Parser* pParser = new CPDF_Parser; 101 CPDF_Parser* pParser = new CPDF_Parser;
102 pParser->SetPassword(password); 102 pParser->SetPassword(password);
(...skipping 10 matching lines...) Expand all
113 return pParser->GetDocument(); 113 return pParser->GetDocument();
114 } 114 }
115 115
116 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { 116 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) {
117 if (doc == NULL) 117 if (doc == NULL)
118 return 0; 118 return 0;
119 CPDF_Document* pDoc = (CPDF_Document*)doc; 119 CPDF_Document* pDoc = (CPDF_Document*)doc;
120 return ((CPDF_Parser*)pDoc->GetParser())->GetFirstPageNo(); 120 return ((CPDF_Parser*)pDoc->GetParser())->GetFirstPageNo();
121 } 121 }
122 122
123 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, 123 DLLEXPORT FX_BOOL STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
124 int page_index, 124 int page_index,
125 FX_DOWNLOADHINTS* hints) { 125 FX_DOWNLOADHINTS* hints) {
126 if (avail == NULL || hints == NULL) 126 if (!avail || !hints)
127 return 0; 127 return true;
128 CFPDF_DownloadHintsWrap hints_wrap(hints); 128 CFPDF_DownloadHintsWrap hints_wrap(hints);
129 return ((CFPDF_DataAvail*)avail) 129 return ((CFPDF_DataAvail*)avail)
130 ->m_pDataAvail->IsPageAvail(page_index, &hints_wrap); 130 ->m_pDataAvail->IsPageAvail(page_index, &hints_wrap);
131 } 131 }
132 132
133 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, 133 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
134 FX_DOWNLOADHINTS* hints) { 134 FX_DOWNLOADHINTS* hints) {
135 if (avail == NULL || hints == NULL) 135 if (!avail || !hints)
136 return -1; 136 return PDFFORM_AVAIL;
137 CFPDF_DownloadHintsWrap hints_wrap(hints); 137 CFPDF_DownloadHintsWrap hints_wrap(hints);
138 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); 138 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap);
139 } 139 }
140 140
141 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { 141 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) {
142 if (avail == NULL) 142 if (!avail)
143 return -1; 143 return PDF_FILE_UNKNOW;
144 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); 144 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF();
145 } 145 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/parser_int.h ('k') | fpdfsdk/src/fpdf_dataavail_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698