From fdf7d4092a5fa9c79bbb4a626a4d3d087053ae2c Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 18 Apr 2017 15:25:58 -0400 Subject: Remove IFGAS_Stream::CreateWideStringReadStream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl removes the wide string read stream and passes through a memory stream as needed. The callers were updated to pass the correct types. Change-Id: I8e2660859a85e38ed1c3f4c596ef7c8242762084 Reviewed-on: https://pdfium-review.googlesource.com/4172 Commit-Queue: dsinclair Reviewed-by: Tom Sepez Reviewed-by: Nicolás Peña --- xfa/fxfa/parser/cxfa_node.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_node.cpp') diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index d29df39e8e..90e93fbda5 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -996,8 +996,8 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = resoveNodeRS.pScriptAttribute; if (lpAttributeInfo && lpAttributeInfo->eValueType == XFA_SCRIPT_Object) { - std::unique_ptr pValue( - new CFXJSE_Value(pScriptContext->GetRuntime())); + auto pValue = + pdfium::MakeUnique(pScriptContext->GetRuntime()); (resoveNodeRS.objects.front()->*(lpAttributeInfo->lpfnCallback))( pValue.get(), false, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); pArguments->GetReturnValue()->Assign(pValue.get()); @@ -1271,25 +1271,21 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"loadXML"); return; } - CFX_WideString wsExpression; + bool bIgnoreRoot = true; bool bOverwrite = 0; - wsExpression = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); + CFX_ByteString wsExpression = pArguments->GetUTF8String(0); if (wsExpression.IsEmpty()) return; if (iLength >= 2) bIgnoreRoot = !!pArguments->GetInt32(1); if (iLength >= 3) bOverwrite = !!pArguments->GetInt32(2); - std::unique_ptr pParser( - new CXFA_SimpleParser(m_pDocument, false)); + auto pParser = pdfium::MakeUnique(m_pDocument, false); if (!pParser) return; - CFDE_XMLNode* pXMLNode = nullptr; - int32_t iParserStatus = - pParser->ParseXMLData(wsExpression, pXMLNode, nullptr); - if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode) + CFDE_XMLNode* pXMLNode = pParser->ParseXMLData(wsExpression, nullptr); + if (!pXMLNode) return; if (bIgnoreRoot && (pXMLNode->GetType() != FDE_XMLNODE_Element || -- cgit v1.2.3