diff options
author | Lei Zhang <thestig@chromium.org> | 2018-05-28 17:51:28 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-28 17:51:28 +0000 |
commit | fffdeebfd0ed9806d32eb5609e0fdd015c25c5ac (patch) | |
tree | 7461043e508179a7d33b850486f312c58048e4a8 /core/fpdfdoc/cpdf_interform.cpp | |
parent | 45a55241d315d25067582d29fcdc1ff8b818965f (diff) | |
download | pdfium-fffdeebfd0ed9806d32eb5609e0fdd015c25c5ac.tar.xz |
Add const/non-const versions of remaining CPDF_Dictionary methods.
GetObjectFor() and GetDirectObjectFor().
Change-Id: I588cd994dfccf0ffd4c8f91362a4806dc109251e
Reviewed-on: https://pdfium-review.googlesource.com/32991
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpdf_interform.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_interform.cpp | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp index 83df36b39b..ad7753b499 100644 --- a/core/fpdfdoc/cpdf_interform.cpp +++ b/core/fpdfdoc/cpdf_interform.cpp @@ -1142,32 +1142,33 @@ std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF( if (dwFlags & 0x04) continue; - if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) { - if ((dwFlags & 0x02) != 0 && - pField->GetDict()->GetStringFor("V").IsEmpty()) { - continue; - } + if (bIncludeOrExclude != pdfium::ContainsValue(fields, pField)) + continue; - WideString fullname = FPDF_GetFullName(pField->GetFieldDict()); - auto pFieldDict = - pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool()); - pFieldDict->SetNewFor<CPDF_String>("T", fullname); - if (pField->GetType() == CPDF_FormField::CheckBox || - pField->GetType() == CPDF_FormField::RadioButton) { - WideString csExport = pField->GetCheckValue(false); - ByteString csBExport = PDF_EncodeText(csExport); - CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->GetDict(), "Opt"); - if (pOpt) - pFieldDict->SetNewFor<CPDF_String>("V", csBExport, false); - else - pFieldDict->SetNewFor<CPDF_Name>("V", csBExport); - } else { - CPDF_Object* pV = FPDF_GetFieldAttr(pField->GetDict(), "V"); - if (pV) - pFieldDict->SetFor("V", pV->CloneDirectObject()); - } - pFields->Add(std::move(pFieldDict)); + if ((dwFlags & 0x02) != 0 && + pField->GetDict()->GetStringFor("V").IsEmpty()) { + continue; + } + + WideString fullname = FPDF_GetFullName(pField->GetFieldDict()); + auto pFieldDict = + pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool()); + pFieldDict->SetNewFor<CPDF_String>("T", fullname); + if (pField->GetType() == CPDF_FormField::CheckBox || + pField->GetType() == CPDF_FormField::RadioButton) { + WideString csExport = pField->GetCheckValue(false); + ByteString csBExport = PDF_EncodeText(csExport); + CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->GetDict(), "Opt"); + if (pOpt) + pFieldDict->SetNewFor<CPDF_String>("V", csBExport, false); + else + pFieldDict->SetNewFor<CPDF_Name>("V", csBExport); + } else { + CPDF_Object* pV = FPDF_GetFieldAttr(pField->GetDict(), "V"); + if (pV) + pFieldDict->SetFor("V", pV->CloneDirectObject()); } + pFields->Add(std::move(pFieldDict)); } return pDoc; } |