summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-19 17:33:32 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-19 17:33:32 +0000
commite005dc33c31a2e701e1af3a0a3e5775cabbf1ddd (patch)
tree6cf7623219078464910ee438311e24121c8af2a0 /xfa
parented1c58049f0c164969946b6ad0ff06d952ab1949 (diff)
downloadpdfium-e005dc33c31a2e701e1af3a0a3e5775cabbf1ddd.tar.xz
Move fxcrt::{Byte,Wide}Strings with std::move().chromium/3466
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 <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fgas/crt/cfgas_formatstring.cpp20
-rw-r--r--xfa/fwl/cfwl_listbox.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffcombobox.cpp2
-rw-r--r--xfa/fxfa/cxfa_fftextedit.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_localevalue.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_nodehelper.cpp7
7 files changed, 21 insertions, 19 deletions
diff --git a/xfa/fgas/crt/cfgas_formatstring.cpp b/xfa/fgas/crt/cfgas_formatstring.cpp
index 0162100949..e9d065d124 100644
--- a/xfa/fgas/crt/cfgas_formatstring.cpp
+++ b/xfa/fgas/crt/cfgas_formatstring.cpp
@@ -7,6 +7,7 @@
#include "xfa/fgas/crt/cfgas_formatstring.h"
#include <algorithm>
+#include <utility>
#include <vector>
#include "core/fxcrt/cfx_decimal.h"
@@ -1647,11 +1648,11 @@ FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat(
bBraceOpen = false;
if (!wsTempPattern.IsEmpty()) {
if (eCategory == FX_LOCALECATEGORY_Time)
- *wsTimePattern = wsTempPattern;
+ *wsTimePattern = std::move(wsTempPattern);
else if (eCategory == FX_LOCALECATEGORY_Date)
- *wsDatePattern = wsTempPattern;
-
- wsTempPattern.clear();
+ *wsDatePattern = std::move(wsTempPattern);
+ else
+ wsTempPattern.clear();
}
} else {
wsTempPattern += pStr[ccf];
@@ -2246,14 +2247,13 @@ bool CFGAS_FormatString::FormatDateTime(const WideString& wsSrcDateTime,
return false;
if (eCategory == FX_DATETIMETYPE_Unknown) {
- if (eDateTimeType == FX_DATETIMETYPE_Time) {
- wsTimePattern = wsDatePattern;
- wsDatePattern.clear();
- }
+ if (eDateTimeType == FX_DATETIMETYPE_Time)
+ wsTimePattern = std::move(wsDatePattern);
+
eCategory = eDateTimeType;
+ if (eCategory == FX_DATETIMETYPE_Unknown)
+ return false;
}
- if (eCategory == FX_DATETIMETYPE_Unknown)
- return false;
CFX_DateTime dt;
auto iT = wsSrcDateTime.Find(L"T");
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 0b0043b3cc..5f683d3e11 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -458,7 +458,7 @@ void CFWL_ListBox::DrawItem(CXFA_Graphics* pGraphics,
textParam.m_pGraphics = pGraphics;
textParam.m_matrix.Concat(*pMatrix);
textParam.m_rtPart = rtText;
- textParam.m_wsText = wsText;
+ textParam.m_wsText = std::move(wsText);
textParam.m_dwTTOStyles = m_dwTTOStyles;
textParam.m_iTTOAlign = m_iTTOAligns;
textParam.m_bMaximize = true;
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<size_t>(eParam.m_iSelStart);
event->selection_end = static_cast<size_t>(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 <utility>
#include <vector>
#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 <utility>
+
#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;