sw/source/core/undo/unovwr.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit dc05dfde93afa45efab6c6ce5d2e41a2563e2404
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Aug 9 15:47:44 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Aug 13 08:35:46 2022 +0200

    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 <noel.gran...@collabora.co.uk>

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<SwHistory> pHistory;
-    std::unique_ptr<Sequence< sal_Int32 >> pOffsets;
+    std::optional<Sequence< sal_Int32 >> 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 <sal_Int32> ( 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 <sal_Int32> aOffsets( pOffsets ? pOffsets->getLength() : nLen );
-    if( pOffsets )
-        aOffsets = *pOffsets;
+    Sequence <sal_Int32> aOffsets( oOffsets ? oOffsets->getLength() : nLen );
+    if( oOffsets )
+        aOffsets = *oOffsets;
     else
     {
         sal_Int32* p = aOffsets.getArray();

Reply via email to