Clean up CPDF_AnnotList.
[pdfium.git] / core / src / fpdfdoc / doc_form.cpp
index 8078608..5cc2a66 100644 (file)
@@ -818,7 +818,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
 }
 
 CPDF_FormControl* CPDF_InterForm::GetControlByDict(
-    CPDF_Dictionary* pWidgetDict) const {
+    const CPDF_Dictionary* pWidgetDict) const {
   const auto it = m_ControlMap.find(pWidgetDict);
   return it != m_ControlMap.end() ? it->second : nullptr;
 }
@@ -1086,13 +1086,12 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
     }
     pField = new CPDF_FormField(this, pParent);
     CPDF_Object* pTObj = pDict->GetElement("T");
-    if (pTObj && pTObj->GetType() == PDFOBJ_REFERENCE) {
+    if (ToReference(pTObj)) {
       CPDF_Object* pClone = pTObj->Clone(TRUE);
-      if (pClone) {
+      if (pClone)
         pDict->SetAt("T", pClone);
-      } else {
+      else
         pDict->SetAtName("T", "");
-      }
     }
     m_pFieldTree->SetField(csWName, pField);
   }
@@ -1187,7 +1186,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path,
     } else {
       CPDF_FileSpec filespec;
       filespec.SetFileName(pdf_path);
-      pMainDict->SetAt("F", (CPDF_Object*)filespec);
+      pMainDict->SetAt("F", static_cast<CPDF_Object*>(filespec));
     }
   }
   CPDF_Array* pFields = CPDF_Array::Create();