From bd716fcf89f38bb82eb97ae73e9af60c2232328e Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 20 Nov 2015 09:39:49 -0800 Subject: Update master fpdfsdk to match XFA R=thestig@chromium.org Review URL: https://codereview.chromium.org/1458853005 . --- fpdfsdk/src/fpdf_dataavail.cpp | 4 +--- fpdfsdk/src/fpdf_progressive.cpp | 4 ++-- fpdfsdk/src/fpdfppo.cpp | 6 ++---- fpdfsdk/src/fpdfview.cpp | 6 ++---- fpdfsdk/src/fsdk_baseform.cpp | 4 ---- fpdfsdk/src/fsdk_mgr.cpp | 4 ---- 6 files changed, 7 insertions(+), 21 deletions(-) diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp index 63f9b4cec0..9fe2fa82b1 100644 --- a/fpdfsdk/src/fpdf_dataavail.cpp +++ b/fpdfsdk/src/fpdf_dataavail.cpp @@ -141,9 +141,7 @@ FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc); - if (!doc) - return 0; - return ((CPDF_Parser*)pDoc->GetParser())->GetFirstPageNo(); + return pDoc ? pDoc->GetParser()->GetFirstPageNo() : 0; } DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, diff --git a/fpdfsdk/src/fpdf_progressive.cpp b/fpdfsdk/src/fpdf_progressive.cpp index fdb9e20555..b6fd8e071e 100644 --- a/fpdfsdk/src/fpdf_progressive.cpp +++ b/fpdfsdk/src/fpdf_progressive.cpp @@ -59,10 +59,10 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, rotate, flags, FALSE, &IPauseAdapter); - if (pContext->m_pRenderer) + if (pContext->m_pRenderer) { return CPDF_ProgressiveRenderer::ToFPDFStatus( pContext->m_pRenderer->GetStatus()); - + } return FPDF_RENDER_FAILED; } diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index fb3510c083..d5b3a8be7c 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.cpp @@ -192,12 +192,10 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( return pDict->GetElement((const char*)nSrctag); while (pp) { - if (pp->KeyExist((const char*)nSrctag)) { + if (pp->KeyExist((const char*)nSrctag)) return pp->GetElement((const char*)nSrctag); - } - if (!pp->KeyExist("Parent")) { + if (!pp->KeyExist("Parent")) break; - } pp = ToDictionary(pp->GetElement("Parent")->GetDirect()); } return nullptr; diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 795ef3fbd0..6ffb523468 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -255,8 +255,7 @@ DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document) { if (!pDoc) return 0; - CPDF_Parser* pParser = (CPDF_Parser*)pDoc->GetParser(); - CPDF_Dictionary* pDict = pParser->GetEncryptDict(); + CPDF_Dictionary* pDict = pDoc->GetParser()->GetEncryptDict(); return pDict ? pDict->GetInteger("P") : (FX_DWORD)-1; } @@ -265,8 +264,7 @@ DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) { if (!pDoc) return -1; - CPDF_Parser* pParser = (CPDF_Parser*)pDoc->GetParser(); - CPDF_Dictionary* pDict = pParser->GetEncryptDict(); + CPDF_Dictionary* pDict = pDoc->GetParser()->GetEncryptDict(); return pDict ? pDict->GetInteger("R") : -1; } diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index 7a66842c9b..9f8b35dcb1 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -207,15 +207,11 @@ FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const { int CPDFSDK_Widget::GetTopVisibleIndex() const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->GetTopVisibleIndex(); } FX_BOOL CPDFSDK_Widget::IsChecked() const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - return pFormCtrl->IsChecked(); } diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index b8d69805a0..09b0e0aa20 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -106,10 +106,6 @@ void CFX_SystemHandler::InvalidateRect(FX_HWND hWnd, FX_RECT rect) { device2page.Transform((FX_FLOAT)rect.left, (FX_FLOAT)rect.top, left, top); device2page.Transform((FX_FLOAT)rect.right, (FX_FLOAT)rect.bottom, right, bottom); - // m_pEnv->FFI_DeviceToPage(pPage, rect.left, rect.top, (double*)&left, - // (double*)&top); - // m_pEnv->FFI_DeviceToPage(pPage, rect.right, rect.bottom, (double*)&right, - // (double*)&bottom); CPDF_Rect rcPDF(left, bottom, right, top); rcPDF.Normalize(); -- cgit v1.2.3