Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2523)

Unified Diff: core/src/fpdfdoc/doc_form.cpp

Issue 1410343003: [Merge to XFA] Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebase to origin/xfa Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfdoc/doc_basic.cpp ('k') | core/src/fpdfdoc/doc_formcontrol.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_form.cpp
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 17f180844426253861f91a9316c2641fe7c3b0b0..80786088838cfa6aa9b6f2538e443b46b264a36f 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -854,9 +854,9 @@ CPDF_FormField* CPDF_InterForm::GetFieldInCalculationOrder(int index) {
if (pArray == NULL) {
return NULL;
}
- CPDF_Object* pElement = pArray->GetElementValue(index);
- if (pElement != NULL && pElement->GetType() == PDFOBJ_DICTIONARY) {
- return GetFieldByDict((CPDF_Dictionary*)pElement);
+ if (CPDF_Dictionary* pElement =
+ ToDictionary(pArray->GetElementValue(index))) {
+ return GetFieldByDict(pElement);
}
return NULL;
}
@@ -1049,25 +1049,24 @@ void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
}
}
}
-CPDF_FormField* CPDF_InterForm::AddTerminalField(
- const CPDF_Dictionary* pFieldDict) {
+CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
if (!pFieldDict->KeyExist(FX_BSTRC("T"))) {
return NULL;
}
- CPDF_Dictionary* pDict = (CPDF_Dictionary*)pFieldDict;
- CFX_WideString csWName = GetFullName(pDict);
+ CPDF_Dictionary* pDict = pFieldDict;
+ CFX_WideString csWName = GetFullName(pFieldDict);
if (csWName.IsEmpty()) {
return NULL;
}
CPDF_FormField* pField = NULL;
pField = m_pFieldTree->GetField(csWName);
if (pField == NULL) {
- CPDF_Dictionary* pParent = (CPDF_Dictionary*)pFieldDict;
+ CPDF_Dictionary* pParent = pFieldDict;
if (!pFieldDict->KeyExist(FX_BSTRC("T")) &&
pFieldDict->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Widget")) {
pParent = pFieldDict->GetDict(FX_BSTRC("Parent"));
if (!pParent) {
- pParent = (CPDF_Dictionary*)pFieldDict;
+ pParent = pFieldDict;
}
}
if (pParent && pParent != pFieldDict &&
@@ -1116,15 +1115,14 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(
}
return pField;
}
-CPDF_FormControl* CPDF_InterForm::AddControl(
- const CPDF_FormField* pField,
- const CPDF_Dictionary* pWidgetDict) {
+CPDF_FormControl* CPDF_InterForm::AddControl(const CPDF_FormField* pField,
+ CPDF_Dictionary* pWidgetDict) {
const auto it = m_ControlMap.find(pWidgetDict);
if (it != m_ControlMap.end())
return it->second;
- CPDF_FormControl* pControl = new CPDF_FormControl(
- (CPDF_FormField*)pField, (CPDF_Dictionary*)pWidgetDict);
+ CPDF_FormControl* pControl =
+ new CPDF_FormControl((CPDF_FormField*)pField, pWidgetDict);
m_ControlMap[pWidgetDict] = pControl;
((CPDF_FormField*)pField)->m_ControlList.Add(pControl);
return pControl;
« no previous file with comments | « core/src/fpdfdoc/doc_basic.cpp ('k') | core/src/fpdfdoc/doc_formcontrol.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698