From 0354ccf37f05f25b1bf64fd60bb3b48efab4d7d0 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 24 Nov 2016 10:45:29 -0500 Subject: Change TxtEdtEngine to return CFX_WideString MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl updates the TxtEdtEngine and TxtEdtBuf to return CFX_WideStrings on a Get instead of taking an out param. The change is propagated out through the various Get methods that call into the edit engine. Change-Id: Iccf10a8ee06678ae3b59f3afd6e65308dacd16bd Reviewed-on: https://pdfium-review.googlesource.com/2070 Commit-Queue: ooo 11-24 -- 12-05 (dsinclair) Reviewed-by: Nicolás Peña --- xfa/fde/cfde_txtedtbuf.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'xfa/fde/cfde_txtedtbuf.cpp') diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp index b01081e3c9..94383c261c 100644 --- a/xfa/fde/cfde_txtedtbuf.cpp +++ b/xfa/fde/cfde_txtedtbuf.cpp @@ -67,8 +67,8 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { m_bChanged = true; } -void CFDE_TxtEdtBuf::GetText(CFX_WideString& wsText) const { - GetRange(wsText, 0, m_nTotal); +CFX_WideString CFDE_TxtEdtBuf::GetText() const { + return GetRange(0, m_nTotal); } FX_WCHAR CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const { @@ -88,13 +88,13 @@ FX_WCHAR CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const { return pChunkHeader->wChars[pChunkHeader->nUsed - (nTotal - nIndex)]; } -void CFDE_TxtEdtBuf::GetRange(CFX_WideString& wsText, - int32_t nBegin, - int32_t nLength) const { +CFX_WideString CFDE_TxtEdtBuf::GetRange(int32_t nBegin, int32_t nLength) const { FDE_CHUNKPLACE cp; Index2CP(nBegin, cp); int32_t nLeave = nLength; int32_t nCount = m_Chunks.GetSize(); + + CFX_WideString wsText; FX_WCHAR* lpDstBuf = wsText.GetBuffer(nLength); int32_t nChunkIndex = cp.nChunkIndex; FDE_CHUNKHEADER* lpChunkHeader = m_Chunks[nChunkIndex]; @@ -116,6 +116,8 @@ void CFDE_TxtEdtBuf::GetRange(CFX_WideString& wsText, nCopyLength = lpChunkHeader->nUsed; } wsText.ReleaseBuffer(); + + return wsText; } void CFDE_TxtEdtBuf::Insert(int32_t nPos, -- cgit v1.2.3