From a964f2a5ab09dc01d09fad78f940ee8e0e5c0c04 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 21 Jun 2018 15:21:44 +0000 Subject: Remove WideString::c_str() calls where possible. Many of these cause a string duplication as we go from Widestring => c_str => Widestring Change-Id: I0dfa952e66f89138e719ff9200db3d9397839e28 Reviewed-on: https://pdfium-review.googlesource.com/35790 Reviewed-by: dsinclair Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_document_parser.cpp | 7 +++---- xfa/fxfa/parser/cxfa_node.cpp | 2 +- xfa/fxfa/parser/xfa_utils.cpp | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index 8bafc7f078..599662a160 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -1000,10 +1000,9 @@ void CXFA_DocumentParser::ParseDataGroup(CXFA_Node* pXFANode, pXFAMetaData->SetFlag(XFA_NodeFlag_Initialized); } - if (!bNeedValue) { - WideString wsNilName(L"xsi:nil"); - pXMLElement->RemoveAttribute(wsNilName.c_str()); - } + if (!bNeedValue) + pXMLElement->RemoveAttribute(L"xsi:nil"); + pXFANode->InsertChild(pXFAChild, nullptr); if (eNodeType == XFA_Element::DataGroup) ParseDataGroup(pXFAChild, pXMLElement, ePacketID); diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 6672e7fb29..00ea7b7a1b 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1245,7 +1245,7 @@ void CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { static_cast(pNode->xml_node_.Get()); WideString wsAttributeName = pNode->JSObject()->GetCData(XFA_Attribute::QualifiedName); - pXMLElement->RemoveAttribute(wsAttributeName.c_str()); + pXMLElement->RemoveAttribute(wsAttributeName); } WideString wsName = pNode->JSObject() diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index 9418ec8eda..b42da0b4a1 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -474,8 +474,8 @@ bool XFA_FDEExtension_ResolveNamespaceQualifier(CFX_XMLElement* pNode, continue; auto* pElement = static_cast(pParent); - if (pElement->HasAttribute(wsNSAttribute.c_str())) { - *wsNamespaceURI = pElement->GetAttribute(wsNSAttribute.c_str()); + if (pElement->HasAttribute(wsNSAttribute)) { + *wsNamespaceURI = pElement->GetAttribute(wsNSAttribute); return true; } } -- cgit v1.2.3