summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-25 21:55:24 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-25 21:55:24 +0000
commitb1ec280837cc6e1932754ef40de26d12b77aa910 (patch)
treeb1af6fdc4174eaf671cbd23f8f59b9bbf2428fb7 /fpdfsdk/fpdfxfa
parentde579ab0092d43fe037c381710da998b9ff823e9 (diff)
downloadpdfium-b1ec280837cc6e1932754ef40de26d12b77aa910.tar.xz
Add proper const/non-const versions of CPDF_Dictionary::GetDictFor().
BUG=pdfium:234 Change-Id: I6fde00c976ad4bb9cab632f465cf292f5b1da3d2 Reviewed-on: https://pdfium-review.googlesource.com/32914 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index cc7a8898e8..f9f5981efb 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -462,24 +462,24 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
if (!pRoot)
return;
- CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
+ const CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
if (!pAcroForm)
return;
- CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA"));
+ const CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA"));
if (!pArray)
return;
int size = pArray->GetCount();
for (int i = 1; i < size; i += 2) {
- CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
- CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
+ const CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
+ const CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
if (!pPrePDFObj->IsString())
continue;
if (!pPDFObj->IsReference())
continue;
- CPDF_Stream* pStream = ToStream(pPDFObj->GetDirect());
+ const CPDF_Stream* pStream = ToStream(pPDFObj->GetDirect());
if (!pStream)
continue;
if (pPrePDFObj->GetString() == "form") {
@@ -761,13 +761,13 @@ bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
return false;
}
- CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
+ const CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
if (!pAcroForm) {
fileStream->Flush();
return false;
}
- CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA"));
+ const CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA"));
if (!pArray) {
fileStream->Flush();
return false;
@@ -775,32 +775,33 @@ bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
int size = pArray->GetCount();
for (int i = 1; i < size; i += 2) {
- CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
- CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
+ const CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
+ const CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
if (!pPrePDFObj->IsString())
continue;
if (!pPDFObj->IsReference())
continue;
- CPDF_Object* pDirectObj = pPDFObj->GetDirect();
+ const CPDF_Object* pDirectObj = pPDFObj->GetDirect();
if (!pDirectObj->IsStream())
continue;
- if (pPrePDFObj->GetString() == "config" && !(flag & FXFA_CONFIG))
+ ByteString bsType = pPrePDFObj->GetString();
+ if (bsType == "config" && !(flag & FXFA_CONFIG))
continue;
- if (pPrePDFObj->GetString() == "template" && !(flag & FXFA_TEMPLATE))
+ if (bsType == "template" && !(flag & FXFA_TEMPLATE))
continue;
- if (pPrePDFObj->GetString() == "localeSet" && !(flag & FXFA_LOCALESET))
+ if (bsType == "localeSet" && !(flag & FXFA_LOCALESET))
continue;
- if (pPrePDFObj->GetString() == "datasets" && !(flag & FXFA_DATASETS))
+ if (bsType == "datasets" && !(flag & FXFA_DATASETS))
continue;
- if (pPrePDFObj->GetString() == "xmpmeta" && !(flag & FXFA_XMPMETA))
+ if (bsType == "xmpmeta" && !(flag & FXFA_XMPMETA))
continue;
- if (pPrePDFObj->GetString() == "xfdf" && !(flag & FXFA_XFDF))
+ if (bsType == "xfdf" && !(flag & FXFA_XFDF))
continue;
- if (pPrePDFObj->GetString() == "form" && !(flag & FXFA_FORM))
+ if (bsType == "form" && !(flag & FXFA_FORM))
continue;
- if (pPrePDFObj->GetString() == "form") {
+ if (bsType == "form") {
ffdoc->SavePackage(
ToNode(ffdoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)),
fileStream);