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

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

Issue 1417893003: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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
Index: core/src/fpdfdoc/doc_formcontrol.cpp
diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp
index c5f47d20cb486160ea81d5e165c7c21ec34276ec..d29ac1e55b41ae52f78b6866b10f1953391d0d5e 100644
--- a/core/src/fpdfdoc/doc_formcontrol.cpp
+++ b/core/src/fpdfdoc/doc_formcontrol.cpp
@@ -86,14 +86,13 @@ CFX_ByteString CPDF_FormControl::GetCheckedAPState() {
if (GetType() == CPDF_FormField::RadioButton ||
GetType() == CPDF_FormField::CheckBox) {
CPDF_Object* pOpt = FPDF_GetFieldAttr(m_pField->m_pDict, "Opt");
Lei Zhang 2015/10/21 22:10:12 or just if (ToArray(FPDF_GetFieldAttr(m_pField->m_
dsinclair 2015/10/22 13:31:12 Done.
- if (pOpt != NULL && pOpt->GetType() == PDFOBJ_ARRAY) {
+ if (pOpt && pOpt->IsArray()) {
int iIndex = m_pField->GetControlIndex(this);
csOn.Format("%d", iIndex);
}
}
- if (csOn.IsEmpty()) {
+ if (csOn.IsEmpty())
csOn = "Yes";
- }
return csOn;
}
CFX_WideString CPDF_FormControl::GetExportValue() {
@@ -103,9 +102,9 @@ CFX_WideString CPDF_FormControl::GetExportValue() {
if (GetType() == CPDF_FormField::RadioButton ||
GetType() == CPDF_FormField::CheckBox) {
CPDF_Object* pOpt = FPDF_GetFieldAttr(m_pField->m_pDict, "Opt");
- if (pOpt != NULL && pOpt->GetType() == PDFOBJ_ARRAY) {
+ if (CPDF_Array* pArray = ToArray(pOpt)) {
int iIndex = m_pField->GetControlIndex(this);
- csOn = ((CPDF_Array*)pOpt)->GetString(iIndex);
+ csOn = pArray->GetString(iIndex);
}
}
if (csOn.IsEmpty()) {

Powered by Google App Engine
This is Rietveld 408576698