From ad39141331e5d3b6471276c6219439e5c587f7c3 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 1 Aug 2018 17:35:47 +0000 Subject: Fix sign mismatch in CPDFSDK_FormFillEnvironment::GetPageViewCount(). Also initialize members in the header when possible. Change-Id: I458bc433f79ac2f6c04d645f44db6f460fd0bdc1 Reviewed-on: https://pdfium-review.googlesource.com/39330 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- fpdfsdk/cpdfsdk_formfillenvironment.cpp | 10 ++++++---- fpdfsdk/cpdfsdk_formfillenvironment.h | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp index da342865cb..c5f9aeb133 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -19,6 +19,7 @@ #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" #include "fxjs/ijs_runtime.h" #include "third_party/base/ptr_util.h" +#include "third_party/base/stl_util.h" #ifdef PDF_ENABLE_XFA #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" @@ -37,10 +38,7 @@ CPDFSDK_FormFillEnvironment::CPDFSDK_FormFillEnvironment( FPDF_FORMFILLINFO* pFFinfo) : m_pInfo(pFFinfo), m_pCPDFDoc(pDoc), - m_pSysHandler(pdfium::MakeUnique(this)), - m_bChangeMask(false), - m_bBeingDestroyed(false), - m_SaveCalled(nullptr) {} + m_pSysHandler(pdfium::MakeUnique(this)) {} CPDFSDK_FormFillEnvironment::~CPDFSDK_FormFillEnvironment() { m_bBeingDestroyed = true; @@ -714,6 +712,10 @@ CPDFXFA_Context* CPDFSDK_FormFillEnvironment::GetXFAContext() const { return nullptr; return static_cast(m_pCPDFDoc->GetExtension()); } + +int CPDFSDK_FormFillEnvironment::GetPageViewCount() const { + return pdfium::CollectionSize(m_PageMap); +} #endif // PDF_ENABLE_XFA int CPDFSDK_FormFillEnvironment::GetPageCount() const { diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h index 1cf078e3aa..8590b34cac 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.h +++ b/fpdfsdk/cpdfsdk_formfillenvironment.h @@ -115,7 +115,7 @@ class CPDFSDK_FormFillEnvironment #ifdef PDF_ENABLE_XFA CPDFXFA_Context* GetXFAContext() const; - int GetPageViewCount() const { return m_PageMap.size(); } + int GetPageViewCount() const; void DisplayCaret(CPDFXFA_Page* page, FPDF_BOOL bVisible, @@ -224,9 +224,9 @@ class CPDFSDK_FormFillEnvironment UnownedPtr const m_pCPDFDoc; std::unique_ptr m_pFormFiller; std::unique_ptr m_pSysHandler; - bool m_bChangeMask; - bool m_bBeingDestroyed; - FORM_SAVECALLED m_SaveCalled; + bool m_bChangeMask = false; + bool m_bBeingDestroyed = false; + FORM_SAVECALLED m_SaveCalled = nullptr; }; #endif // FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ -- cgit v1.2.3