From e005dc33c31a2e701e1af3a0a3e5775cabbf1ddd Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 19 Jun 2018 17:33:32 +0000 Subject: Move fxcrt::{Byte,Wide}Strings with std::move(). Remove some string copies in barcode that were noticed whilst looking for moves. Change-Id: Ieda34d00f633576ba1f0dca283dcdabfb36f236c Reviewed-on: https://pdfium-review.googlesource.com/35410 Reviewed-by: dsinclair Reviewed-by: Tom Sepez Commit-Queue: Tom Sepez --- xfa/fxfa/cxfa_ffcombobox.cpp | 2 +- xfa/fxfa/cxfa_fftextedit.cpp | 2 +- xfa/fxfa/parser/cxfa_document_parser.cpp | 4 ++-- xfa/fxfa/parser/cxfa_localevalue.cpp | 3 ++- xfa/fxfa/parser/cxfa_nodehelper.cpp | 7 ++++--- 5 files changed, 10 insertions(+), 8 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp index a150101efb..893ee60aa1 100644 --- a/xfa/fxfa/cxfa_ffcombobox.cpp +++ b/xfa/fxfa/cxfa_ffcombobox.cpp @@ -120,7 +120,7 @@ bool CXFA_FFComboBox::IsDataChanged() { if (m_pNode->GetValue(XFA_VALUEPICTURE_Raw) == wsText) return false; - m_wsNewValue = wsText; + m_wsNewValue = std::move(wsText); return true; } diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index a8080d13d5..81bc9b3816 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -313,7 +313,7 @@ void CXFA_FFTextEdit::OnTextWillChange(CFWL_Widget* pWidget, // Copy the data back out of the EventParam and into the TextChanged event so // it can propagate back to the calling widget. event->cancelled = eParam.m_bCancelAction; - event->change_text = eParam.m_wsChange; + event->change_text = std::move(eParam.m_wsChange); event->selection_start = static_cast(eParam.m_iSelStart); event->selection_end = static_cast(eParam.m_iSelEnd); } diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index 6f3e56ce4c..8bafc7f078 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -138,7 +138,7 @@ bool GetAttributeLocalName(const WideStringView& wsAttributeName, WideString wsAttrName(wsAttributeName); auto pos = wsAttrName.Find(L':', 0); if (!pos.has_value()) { - wsLocalAttrName = wsAttrName; + wsLocalAttrName = std::move(wsAttrName); return false; } wsLocalAttrName = wsAttrName.Right(wsAttrName.GetLength() - pos.value() - 1); @@ -254,7 +254,7 @@ void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode, WideString& wsOutput) { if (IsStringAllWhitespace(wsText)) continue; - wsOutput = wsText; + wsOutput = std::move(wsText); break; } default: diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp index 78f6b3b5e4..3a55045905 100644 --- a/xfa/fxfa/parser/cxfa_localevalue.cpp +++ b/xfa/fxfa/parser/cxfa_localevalue.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/cxfa_localevalue.h" +#include #include #include "core/fxcrt/fx_extension.h" @@ -618,7 +619,7 @@ bool CXFA_LocaleValue::ParsePatternValue(const WideString& wsValue, WideString fNum; bRet = pFormat->ParseNum(wsValue, wsFormat, &fNum); if (bRet) - m_wsValue = fNum; + m_wsValue = std::move(fNum); break; } case FX_LOCALECATEGORY_Text: diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index eea054a169..7eddddf37b 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -6,6 +6,8 @@ #include "xfa/fxfa/parser/cxfa_nodehelper.h" +#include + #include "core/fxcrt/fx_extension.h" #include "fxjs/cfxjse_engine.h" #include "fxjs/xfa/cjx_object.h" @@ -237,14 +239,13 @@ WideString CXFA_NodeHelper::GetNameExpression(CXFA_Node* refNode, WideString wsName; if (bIsAllPath) { wsName = GetNameExpression(refNode, false, eLogicType); - WideString wsParent; CXFA_Node* parent = ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); while (parent) { - wsParent = GetNameExpression(parent, false, eLogicType); + WideString wsParent = GetNameExpression(parent, false, eLogicType); wsParent += L"."; wsParent += wsName; - wsName = wsParent; + wsName = std::move(wsParent); parent = ResolveNodes_GetParent(parent, XFA_LOGIC_NoTransparent); } return wsName; -- cgit v1.2.3