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

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

Issue 1442753005: Fix wrong page count returned in FPDF_GetPageCount() during loading dynamic XFA files (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
« no previous file with comments | « no previous file | 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/fpdfview.h" 7 #include "public/fpdfview.h"
8 8
9 #include "../include/fpdfxfa/fpdfxfa_app.h" 9 #include "../include/fpdfxfa/fpdfxfa_app.h"
10 #include "../include/fpdfxfa/fpdfxfa_doc.h" 10 #include "../include/fpdfxfa/fpdfxfa_doc.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) { 409 DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) {
410 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); 410 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
411 if (!pDoc) 411 if (!pDoc)
412 return -1; 412 return -1;
413 413
414 CPDF_Dictionary* pDict = pDoc->GetParser()->GetEncryptDict(); 414 CPDF_Dictionary* pDict = pDoc->GetParser()->GetEncryptDict();
415 return pDict ? pDict->GetInteger("R") : -1; 415 return pDict ? pDict->GetInteger("R") : -1;
416 } 416 }
417 417
418 DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document) { 418 DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document) {
419 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); 419 CPDFXFA_Document* pDoc = static_cast<CPDFXFA_Document*>(document);
420 return pDoc ? pDoc->GetPageCount() : 0; 420 return pDoc ? pDoc->GetPageCount() : 0;
421 } 421 }
422 422
423 DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, 423 DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
424 int page_index) { 424 int page_index) {
425 if (!document) 425 if (!document)
426 return nullptr; 426 return nullptr;
427 CPDFXFA_Document* pDoc = static_cast<CPDFXFA_Document*>(document); 427 CPDFXFA_Document* pDoc = static_cast<CPDFXFA_Document*>(document);
428 if (page_index < 0 || page_index >= pDoc->GetPageCount()) 428 if (page_index < 0 || page_index >= pDoc->GetPageCount())
429 return nullptr; 429 return nullptr;
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 if (!buffer) { 1057 if (!buffer) {
1058 *buflen = len; 1058 *buflen = len;
1059 } else if (*buflen >= len) { 1059 } else if (*buflen >= len) {
1060 memcpy(buffer, utf16Name.c_str(), len); 1060 memcpy(buffer, utf16Name.c_str(), len);
1061 *buflen = len; 1061 *buflen = len;
1062 } else { 1062 } else {
1063 *buflen = -1; 1063 *buflen = -1;
1064 } 1064 }
1065 return (FPDF_DEST)pDestObj; 1065 return (FPDF_DEST)pDestObj;
1066 } 1066 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698