From 8a6fdadccd2eedf332ae3a72f0149c1b40cb5bd9 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 9 May 2017 15:03:33 -0700 Subject: Create common CXML_Object base class for CXML_Content and CXML_Element. They should each know what they are rather than having an external ChildRecord struct to track the type. Change-Id: Ic647ba45569764073e944d30af1a96dccdc29eb3 Reviewed-on: https://pdfium-review.googlesource.com/5210 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- fpdfsdk/fpdf_ext.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'fpdfsdk/fpdf_ext.cpp') diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp index 8773d680ea..f598835e3c 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -16,6 +16,7 @@ #include "core/fpdfdoc/cpdf_metadata.h" #include "core/fxcrt/fx_basic.h" #include "core/fxcrt/fx_memory.h" +#include "core/fxcrt/xml/cxml_content.h" #include "core/fxcrt/xml/cxml_element.h" #include "fpdfsdk/fsdk_define.h" #include "third_party/base/ptr_util.h" @@ -86,12 +87,13 @@ bool CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { if (space == "xmlns" && name == "adhocwf" && value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") { CXML_Element* pVersion = - pElement->GetElement("adhocwf", cbName.AsStringC()); + pElement->GetElement("adhocwf", cbName.AsStringC(), 0); if (!pVersion) continue; - CFX_WideString wsContent = pVersion->GetContent(0); - int nType = wsContent.GetInteger(); - switch (nType) { + CXML_Content* pContent = ToContent(pVersion->GetChild(0)); + if (!pContent) + continue; + switch (pContent->m_Content.GetInteger()) { case 1: FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_ACROBAT); break; @@ -107,12 +109,9 @@ bool CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { uint32_t nCount = pElement->CountChildren(); for (i = 0; i < (int)nCount; i++) { - CXML_Element::ChildType childType = pElement->GetChildType(i); - if (childType == CXML_Element::Element) { - CXML_Element* pChild = pElement->GetElement(i); - if (CheckSharedForm(pChild, cbName)) - return true; - } + CXML_Element* pChild = ToElement(pElement->GetChild(i)); + if (pChild && CheckSharedForm(pChild, cbName)) + return true; } return false; } -- cgit v1.2.3