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

Side by Side Diff: fpdfsdk/fpdf_dataavail.cpp

Issue 2294383003: Use unsigned page indexes in CPDF_HintTables. (Closed)
Patch Set: more safe math Created 4 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/fpdfapi/fpdf_parser/include/cpdf_data_avail.h ('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 "public/fpdf_dataavail.h" 7 #include "public/fpdf_dataavail.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { 155 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) {
156 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc); 156 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc);
157 return pDoc ? pDoc->GetParser()->GetFirstPageNo() : 0; 157 return pDoc ? pDoc->GetParser()->GetFirstPageNo() : 0;
158 } 158 }
159 159
160 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, 160 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
161 int page_index, 161 int page_index,
162 FX_DOWNLOADHINTS* hints) { 162 FX_DOWNLOADHINTS* hints) {
163 if (!avail || !hints) 163 if (!avail || !hints)
164 return PDF_DATA_ERROR; 164 return PDF_DATA_ERROR;
165 if (page_index < 0)
166 return PDF_DATA_NOTAVAIL;
165 CFPDF_DownloadHintsWrap hints_wrap(hints); 167 CFPDF_DownloadHintsWrap hints_wrap(hints);
166 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsPageAvail( 168 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsPageAvail(
167 page_index, &hints_wrap); 169 page_index, &hints_wrap);
168 } 170 }
169 171
170 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, 172 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
171 FX_DOWNLOADHINTS* hints) { 173 FX_DOWNLOADHINTS* hints) {
172 if (!avail || !hints) 174 if (!avail || !hints)
173 return PDF_FORM_ERROR; 175 return PDF_FORM_ERROR;
174 CFPDF_DownloadHintsWrap hints_wrap(hints); 176 CFPDF_DownloadHintsWrap hints_wrap(hints);
175 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail( 177 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail(
176 &hints_wrap); 178 &hints_wrap);
177 } 179 }
178 180
179 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { 181 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) {
180 if (!avail) 182 if (!avail)
181 return PDF_LINEARIZATION_UNKNOWN; 183 return PDF_LINEARIZATION_UNKNOWN;
182 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF(); 184 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF();
183 } 185 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698