summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_ap.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-22 09:31:44 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-22 09:31:44 -0400
commitc2bfc000e502c42c9a3017038fd9104c7997d126 (patch)
treea693dd82199e7af83fac7b7b19d023e4c5fc5e36 /core/src/fpdfdoc/doc_ap.cpp
parent69ceb6a9761b3ccb228a2405e9a493a3666e0601 (diff)
downloadpdfium-c2bfc000e502c42c9a3017038fd9104c7997d126.tar.xz
Add type cast definitions for CPDF_Array.
This Cl adds ToArray, CPDF_Object::AsArray and CPDF_Object::IsArray and updates the src to use them as needed. BUG=pdfium:201 R=thestig@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1417893003 .
Diffstat (limited to 'core/src/fpdfdoc/doc_ap.cpp')
-rw-r--r--core/src/fpdfdoc/doc_ap.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp
index 71025ec532..77a1f15306 100644
--- a/core/src/fpdfdoc/doc_ap.cpp
+++ b/core/src/fpdfdoc/doc_ap.cpp
@@ -618,12 +618,11 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
}
if (CPDF_Object* pOpt = pOpts->GetElementValue(i)) {
CFX_WideString swItem;
- if (pOpt->IsString()) {
+ if (pOpt->IsString())
swItem = pOpt->GetUnicodeText();
- } else if (pOpt->GetType() == PDFOBJ_ARRAY) {
- swItem =
- ((CPDF_Array*)pOpt)->GetElementValue(1)->GetUnicodeText();
- }
+ else if (CPDF_Array* pArray = pOpt->AsArray())
+ swItem = pArray->GetElementValue(1)->GetUnicodeText();
+
FX_BOOL bSelected = FALSE;
if (pSels) {
for (FX_DWORD s = 0, ssz = pSels->GetCount(); s < ssz; s++) {