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/fgas/crt/cfgas_formatstring.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'xfa/fgas/crt') 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 +#include #include #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"); -- cgit v1.2.3