From dc05dfde93afa45efab6c6ce5d2e41a2563e2404 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 9 Aug 2022 15:47:44 +0200 Subject: [PATCH] unique_ptr->optional in UndoTransliterate_Data Change-Id: Ibb694d7257124a8fe4c22da45c854df3be56526e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138213 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/core/undo/unovwr.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index a4d959e1837e..9cc5ba2fbb7f 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -327,7 +327,7 @@ struct UndoTransliterate_Data { OUString sText; std::unique_ptr pHistory; - std::unique_ptr> pOffsets; + std::optional> oOffsets; SwNodeOffset nNdIdx; sal_Int32 nStart, nLen; @@ -399,8 +399,8 @@ void SwUndoTransliterate::AddChanges( SwTextNode& rTNd, if( *p != ( nStart + n )) { // create the Offset array - pNew->pOffsets.reset( new Sequence ( nLen ) ); - sal_Int32* pIdx = pNew->pOffsets->getArray(); + pNew->oOffsets.emplace( nLen ); + sal_Int32* pIdx = pNew->oOffsets->getArray(); p = pOffsets; tools::Long nMyOff, nNewVal = nStart; for( n = 0, nMyOff = nStart; n < nOffsLen; ++p, ++n, ++nMyOff ) @@ -453,9 +453,9 @@ void UndoTransliterate_Data::SetChangeAtNode( SwDoc& rDoc ) if( !pTNd ) return; - Sequence aOffsets( pOffsets ? pOffsets->getLength() : nLen ); - if( pOffsets ) - aOffsets = *pOffsets; + Sequence aOffsets( oOffsets ? oOffsets->getLength() : nLen ); + if( oOffsets ) + aOffsets = *oOffsets; else { sal_Int32* p = aOffsets.getArray();