From 8128485d0169a8dcbe14289a868ff3c27440bfcf Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 12 Jun 2018 19:26:15 +0000 Subject: CheckUnSupportError() always called with FPDF_ERR_SUCCESS. So remove the argument, and the logic dependent upon it being otherwise. Rename function to more accurately reflect its purpose. Remove needless null check while we're at it. Change-Id: I7e119429fd159334eabcc250b5dac215580882ea Reviewed-on: https://pdfium-review.googlesource.com/34950 Commit-Queue: Tom Sepez Reviewed-by: dsinclair --- fpdfsdk/cpdfsdk_helpers.cpp | 11 ++--------- fpdfsdk/cpdfsdk_helpers.h | 2 +- fpdfsdk/fpdf_dataavail.cpp | 2 +- fpdfsdk/fpdf_view.cpp | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp index 391e79758f..943e3a3153 100644 --- a/fpdfsdk/cpdfsdk_helpers.cpp +++ b/fpdfsdk/cpdfsdk_helpers.cpp @@ -199,15 +199,7 @@ void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { } } -void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) { - // Security - if (err_code == FPDF_ERR_SECURITY) { - RaiseUnSupportError(FPDF_UNSP_DOC_SECURITY); - return; - } - if (!pDoc) - return; - +void ReportUnsupportedFeatures(CPDF_Document* pDoc) { const CPDF_Dictionary* pRootDict = pDoc->GetRoot(); if (pRootDict) { // Portfolios and Packages @@ -236,6 +228,7 @@ void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) { } } } + // SharedForm const CPDF_Stream* pStream = pRootDict->GetStreamFor("Metadata"); if (pStream) { diff --git a/fpdfsdk/cpdfsdk_helpers.h b/fpdfsdk/cpdfsdk_helpers.h index 98d7e45e5f..88e05302fe 100644 --- a/fpdfsdk/cpdfsdk_helpers.h +++ b/fpdfsdk/cpdfsdk_helpers.h @@ -246,7 +246,7 @@ void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, bool bNeedToRestore, IPDFSDK_PauseAdapter* pause); -void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code); +void ReportUnsupportedFeatures(CPDF_Document* pDoc); void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot); #ifndef _WIN32 diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp index d7bcf8f5c7..1b5fbeb35d 100644 --- a/fpdfsdk/fpdf_dataavail.cpp +++ b/fpdfsdk/fpdf_dataavail.cpp @@ -162,7 +162,7 @@ FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { document->SetExtension(pdfium::MakeUnique(document.get())); #endif // PDF_ENABLE_XFA - CheckUnSupportError(document.get(), FPDF_ERR_SUCCESS); + ReportUnsupportedFeatures(document.get()); return FPDFDocumentFromCPDFDocument(document.release()); } diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp index 4f10bcb20a..bfaf537feb 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -156,7 +156,7 @@ FPDF_DOCUMENT LoadDocumentImpl( pDocument->SetExtension(pdfium::MakeUnique(pDocument.get())); #endif // PDF_ENABLE_XFA - CheckUnSupportError(pDocument.get(), error); + ReportUnsupportedFeatures(pDocument.get()); return FPDFDocumentFromCPDFDocument(pDocument.release()); } -- cgit v1.2.3