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 --- fxbarcode/cbc_upca.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'fxbarcode/cbc_upca.cpp') diff --git a/fxbarcode/cbc_upca.cpp b/fxbarcode/cbc_upca.cpp index 69cedce580..834eecf1ec 100644 --- a/fxbarcode/cbc_upca.cpp +++ b/fxbarcode/cbc_upca.cpp @@ -56,18 +56,14 @@ bool CBC_UPCA::Encode(const WideStringView& contents) { BCFORMAT format = BCFORMAT_UPC_A; int32_t outWidth = 0; int32_t outHeight = 0; - WideString encodeContents = Preprocess(contents); - ByteString byteString = encodeContents.UTF8Encode(); - m_renderContents = encodeContents; - + m_renderContents = Preprocess(contents); + ByteString byteString = m_renderContents.UTF8Encode(); CBC_OnedUPCAWriter* pWriter = GetOnedUPCAWriter(); pWriter->Init(); std::unique_ptr data( pWriter->Encode(byteString, format, outWidth, outHeight)); - if (!data) - return false; - return pWriter->RenderResult(encodeContents.AsStringView(), data.get(), - outWidth); + return data && pWriter->RenderResult(m_renderContents.AsStringView(), + data.get(), outWidth); } bool CBC_UPCA::RenderDevice(CFX_RenderDevice* device, -- cgit v1.2.3