diff options
author | Lei Zhang <thestig@chromium.org> | 2018-05-24 01:36:40 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-24 01:36:40 +0000 |
commit | dbf13f6562a902df17f6e543d3be844ca82956e2 (patch) | |
tree | 7ba195555b7534e51708fd8d26000db0700b7cfe /xfa | |
parent | 7e33dbeec78dfa051df52619672133da6a799240 (diff) | |
download | pdfium-dbf13f6562a902df17f6e543d3be844ca82956e2.tar.xz |
Improve constness for more CPDF_Objects pointers.
Most of them can be marked const. A couple are marked non-const because
eventually something inside gets modified.
Change-Id: I5415ca8d1efdac451cde340272436cd1e6ec433f
Reviewed-on: https://pdfium-review.googlesource.com/32184
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/cxfa_ffdoc.cpp | 14 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdoc.h | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index bc4a939078..330572ff9c 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -44,12 +44,12 @@ CXFA_FFDoc::~CXFA_FFDoc() { CloseDoc(); } -bool CXFA_FFDoc::ParseDoc(CPDF_Object* pElementXFA) { - std::vector<CPDF_Stream*> xfaStreams; +bool CXFA_FFDoc::ParseDoc(const CPDF_Object* pElementXFA) { + std::vector<const CPDF_Stream*> xfaStreams; if (pElementXFA->IsArray()) { - CPDF_Array* pXFAArray = pElementXFA->AsArray(); + const CPDF_Array* pXFAArray = pElementXFA->AsArray(); for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) { - if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1)) + if (const CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1)) xfaStreams.push_back(pStream); } } else if (pElementXFA->IsStream()) { @@ -99,11 +99,11 @@ bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { if (!pRoot) return false; - CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); + const CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); if (!pAcroForm) return false; - CPDF_Object* pElementXFA = pAcroForm->GetDirectObjectFor("XFA"); + const CPDF_Object* pElementXFA = pAcroForm->GetDirectObjectFor("XFA"); if (!pElementXFA) return false; @@ -183,7 +183,7 @@ RetainPtr<CFX_DIBitmap> CXFA_FFDoc::GetPDFNamedImage( return it->second.pDibSource.As<CFX_DIBitmap>(); } - const CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); + CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); if (!pRoot) return nullptr; diff --git a/xfa/fxfa/cxfa_ffdoc.h b/xfa/fxfa/cxfa_ffdoc.h index 356a157437..88becb4071 100644 --- a/xfa/fxfa/cxfa_ffdoc.h +++ b/xfa/fxfa/cxfa_ffdoc.h @@ -81,7 +81,7 @@ class CXFA_FFDoc { const RetainPtr<IFX_SeekableStream>& pFile); private: - bool ParseDoc(CPDF_Object* pElementXFA); + bool ParseDoc(const CPDF_Object* pElementXFA); UnownedPtr<IXFA_DocEnvironment> const m_pDocEnvironment; UnownedPtr<CXFA_FFApp> const m_pApp; |