From 3343d146f2d9cd2f9eaa3a40fed3a5b94f3f107e Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 2 Nov 2015 09:54:54 -0800 Subject: Fix XFA compilation noise, part 1. Mainly: volatile/override/method shadowing. unused variables. intialization list init order. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1422113003 . --- fpdfsdk/src/fpdfsave.cpp | 25 ++++++++----------------- fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp | 27 ++++++++++++--------------- fpdfsdk/src/fsdk_annothandler.cpp | 3 --- fpdfsdk/src/fsdk_baseannot.cpp | 6 +----- fpdfsdk/src/fsdk_baseform.cpp | 16 +++------------- fpdfsdk/src/javascript/JS_Runtime.h | 9 +++++---- 6 files changed, 29 insertions(+), 57 deletions(-) (limited to 'fpdfsdk/src') diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp index 2cfbb81cd0..3a85ba750c 100644 --- a/fpdfsdk/src/fpdfsave.cpp +++ b/fpdfsdk/src/fpdfsave.cpp @@ -135,7 +135,6 @@ FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument, // Get form CPDF_Stream CPDF_Object* pFormPDFObj = pArray->GetElement(iFormIndex); if (pFormPDFObj->GetType() == PDFOBJ_REFERENCE) { - CPDF_Reference* pFormRefObj = (CPDF_Reference*)pFormPDFObj; CPDF_Object* pFormDircetObj = pFormPDFObj->GetDirect(); if (NULL != pFormDircetObj && pFormDircetObj->GetType() == PDFOBJ_STREAM) { @@ -185,14 +184,10 @@ FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument, } else { CPDF_Stream* pData = new CPDF_Stream(NULL, 0, NULL); pData->InitStream(pDsfileWrite, pDataDict); - FX_DWORD AppStreamobjnum = pPDFDocument->AddIndirectObject(pData); - CPDF_Reference* pRef = - (CPDF_Reference*)pPDFDocument->GetIndirectObject(AppStreamobjnum); - { - iLast = pArray->GetCount() - 2; - pArray->InsertAt(iLast, CPDF_String::Create("datasets")); - pArray->InsertAt(iLast + 1, pData, pPDFDocument); - } + pPDFDocument->AddIndirectObject(pData); + iLast = pArray->GetCount() - 2; + pArray->InsertAt(iLast, CPDF_String::Create("datasets")); + pArray->InsertAt(iLast + 1, pData, pPDFDocument); } fileList.Add(pDsfileWrite); } @@ -216,14 +211,10 @@ FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument, } else { CPDF_Stream* pData = new CPDF_Stream(NULL, 0, NULL); pData->InitStream(pfileWrite, pDataDict); - FX_DWORD AppStreamobjnum = pPDFDocument->AddIndirectObject(pData); - CPDF_Reference* pRef = - (CPDF_Reference*)pPDFDocument->GetIndirectObject(AppStreamobjnum); - { - iLast = pArray->GetCount() - 2; - pArray->InsertAt(iLast, CPDF_String::Create("form")); - pArray->InsertAt(iLast + 1, pData, pPDFDocument); - } + pPDFDocument->AddIndirectObject(pData); + iLast = pArray->GetCount() - 2; + pArray->InsertAt(iLast, CPDF_String::Create("form")); + pArray->InsertAt(iLast + 1, pData, pPDFDocument); } fileList.Add(pfileWrite); } diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp index 3197f2a5e7..b965387cc3 100644 --- a/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp +++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp @@ -64,26 +64,23 @@ FX_BOOL CPDFXFA_Page::LoadXFAPageView() { if (!m_pDocument) return FALSE; IXFA_Doc* pXFADoc = m_pDocument->GetXFADoc(); - if (pXFADoc) { - IXFA_DocView* pXFADocView = m_pDocument->GetXFADocView(); - if (!pXFADocView) - return FALSE; - - IXFA_PageView* pPageView = pXFADocView->GetPageView(m_iPageIndex); - if (!pPageView) - return FALSE; + if (!pXFADoc) + return FALSE; - if (m_pXFAPageView) - if (m_pXFAPageView == pPageView) - return TRUE; + IXFA_DocView* pXFADocView = m_pDocument->GetXFADocView(); + if (!pXFADocView) + return FALSE; - m_pXFAPageView = pPageView; - int iStatus = m_pXFAPageView->LoadPageView(NULL); + IXFA_PageView* pPageView = pXFADocView->GetPageView(m_iPageIndex); + if (!pPageView) + return FALSE; + if (m_pXFAPageView == pPageView) return TRUE; - } - return FALSE; + m_pXFAPageView = pPageView; + (void)m_pXFAPageView->LoadPageView(nullptr); + return TRUE; } FX_BOOL CPDFXFA_Page::LoadPage() { diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp index f17ebf1270..e0c49411a9 100644 --- a/fpdfsdk/src/fsdk_annothandler.cpp +++ b/fpdfsdk/src/fsdk_annothandler.cpp @@ -782,9 +782,6 @@ void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, CFX_Matrix mt; mt = *(CFX_Matrix*)pUser2Device; - IXFA_Widget* hWidget = pAnnot->GetXFAWidget(); - ASSERT(hWidget != NULL); - FX_BOOL bIsHighlight = FALSE; if (pSDKDoc->GetFocusAnnot() != pAnnot) bIsHighlight = TRUE; diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp index 126c7a7fdb..1c96936f03 100644 --- a/fpdfsdk/src/fsdk_baseannot.cpp +++ b/fpdfsdk/src/fsdk_baseannot.cpp @@ -518,7 +518,7 @@ CPDFSDK_BAAnnot::~CPDFSDK_BAAnnot() { m_pAnnot = NULL; } -CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() { +CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const { return m_pAnnot; } @@ -571,10 +571,6 @@ CFX_ByteString CPDFSDK_BAAnnot::GetSubType() const { return ""; } -void CPDFSDK_BAAnnot::ResetAppearance() { - ASSERT(FALSE); -} - void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device, CPDF_Annot::AppearanceMode mode, diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index e486310ba2..202f77f571 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -2112,9 +2112,8 @@ FX_BOOL CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY) { CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm) - : CPDFSDK_Annot(pPageView), - m_hXFAWidget(pAnnot), - m_pInterForm(pInterForm) {} + : CPDFSDK_Annot(pPageView), m_pInterForm(pInterForm), m_hXFAWidget(pAnnot) { +} FX_BOOL CPDFSDK_XFAWidget::IsXFAField() { return TRUE; @@ -2124,21 +2123,12 @@ CFX_ByteString CPDFSDK_XFAWidget::GetType() const { return FSDK_XFAWIDGET_TYPENAME; } -CFX_FloatRect CPDFSDK_XFAWidget::GetRect() { +CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const { CPDFSDK_PageView* pPageView = GetPageView(); - ASSERT(pPageView != NULL); - CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); - ASSERT(pDocument != NULL); - CPDFXFA_Document* pDoc = pDocument->GetDocument(); - ASSERT(pDoc != NULL); - IXFA_DocView* pDocView = pDoc->GetXFADocView(); - ASSERT(pDocView != NULL); - IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); - ASSERT(pWidgetHandler != NULL); CFX_RectF rcBBox; pWidgetHandler->GetRect(GetXFAWidget(), rcBBox); diff --git a/fpdfsdk/src/javascript/JS_Runtime.h b/fpdfsdk/src/javascript/JS_Runtime.h index 4772823d7f..01a8827561 100644 --- a/fpdfsdk/src/javascript/JS_Runtime.h +++ b/fpdfsdk/src/javascript/JS_Runtime.h @@ -57,10 +57,11 @@ class CJS_Runtime : public IJS_Runtime { v8::Isolate* GetIsolate() const { return m_isolate; } v8::Local NewJSContext(); - virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, - FXJSE_HVALUE hValue); - virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, - FXJSE_HVALUE hValue); + // IJS_Runtime: + FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, + FXJSE_HVALUE hValue) override; + FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, + FXJSE_HVALUE hValue) override; void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); -- cgit v1.2.3