From 5c500acc3380d96db0ab5e2e6c2bc448644992de Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 27 Mar 2017 12:44:20 -0700 Subject: Return arrays where appropriate in fxfa. Also, remove some default method arguments along the way. Change-Id: Ifbd157499881ed6a3777f3903dd7f0193753cf59 Reviewed-on: https://pdfium-review.googlesource.com/3219 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'xfa/fxfa/parser/xfa_document_datamerger_imp.cpp') diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 227064a73b..cfc54a11d9 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -153,17 +153,16 @@ void CreateDataBinding(CXFA_Node* pFormNode, case XFA_Element::ChoiceList: defValue.GetChildValueContent(wsValue); if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { - std::vector wsSelTextArray; - pWidgetData->GetSelectedItemsValue(wsSelTextArray); - int32_t iSize = pdfium::CollectionSize(wsSelTextArray); - if (iSize >= 1) { - CXFA_Node* pValue = nullptr; - for (int32_t i = 0; i < iSize; i++) { - pValue = pDataNode->CreateSamePacketNode(XFA_Element::DataValue); + std::vector wsSelTextArray = + pWidgetData->GetSelectedItemsValue(); + if (!wsSelTextArray.empty()) { + for (const auto& text : wsSelTextArray) { + CXFA_Node* pValue = + pDataNode->CreateSamePacketNode(XFA_Element::DataValue); pValue->SetCData(XFA_ATTRIBUTE_Name, L"value"); pValue->CreateXMLMappingNode(); pDataNode->InsertChild(pValue); - pValue->SetCData(XFA_ATTRIBUTE_Value, wsSelTextArray[i]); + pValue->SetCData(XFA_ATTRIBUTE_Value, text); } } else { CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); -- cgit v1.2.3