From 56ddbe04dc445c012c568083202ce433c1da7026 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 20 Jan 2024 21:28:31 +0900 Subject: [PATCH] Replace auto_ptr Signed-off-by: Michele Calgaro --- lib/kformula/kformulacommand.cpp | 4 ++-- lib/kformula/kformulacommand.h | 4 +++- lib/kformula/kformuladefs.h | 2 +- lib/kofficecore/KoDocument.cpp | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/kformula/kformulacommand.cpp b/lib/kformula/kformulacommand.cpp index 4aa311610..24ae790fb 100644 --- a/lib/kformula/kformulacommand.cpp +++ b/lib/kformula/kformulacommand.cpp @@ -458,8 +458,8 @@ void KFCAddReplacing::unexecute() // ****** Add index command -KFCAddGenericIndex::KFCAddGenericIndex(Container* document, ElementIndexPtr _index) - : KFCAdd(i18n("Add Index"), document), index(_index) +KFCAddGenericIndex::KFCAddGenericIndex(Container* document, ElementIndexPtr &_index) + : KFCAdd(i18n("Add Index"), document), index(std::move(_index)) { addElement(new SequenceElement()); } diff --git a/lib/kformula/kformulacommand.h b/lib/kformula/kformulacommand.h index bc1703bef..75a47da33 100644 --- a/lib/kformula/kformulacommand.h +++ b/lib/kformula/kformulacommand.h @@ -435,7 +435,9 @@ class KFCAddGenericIndex : public KFCAdd { public: - KFCAddGenericIndex(Container* document, ElementIndexPtr index); + KFCAddGenericIndex(Container* document, ElementIndexPtr &index); + KFCAddGenericIndex(KFCAddGenericIndex const &) = delete; + KFCAddGenericIndex& operator=(KFCAddGenericIndex const &) = delete; virtual void execute(); diff --git a/lib/kformula/kformuladefs.h b/lib/kformula/kformuladefs.h index d4a3739f8..283226086 100644 --- a/lib/kformula/kformuladefs.h +++ b/lib/kformula/kformuladefs.h @@ -276,7 +276,7 @@ public: virtual BasicElement* getElement() = 0; }; -typedef std::auto_ptr ElementIndexPtr; +typedef std::unique_ptr ElementIndexPtr; enum RequestID { req_addBracket, diff --git a/lib/kofficecore/KoDocument.cpp b/lib/kofficecore/KoDocument.cpp index 85397acc9..147b2ed1c 100644 --- a/lib/kofficecore/KoDocument.cpp +++ b/lib/kofficecore/KoDocument.cpp @@ -992,7 +992,7 @@ bool KoDocument::saveNativeFormat( const TQString & file ) TQCString mimeType = d->outputMimeType; TQCString nativeOasisMime = nativeOasisMimeType(); bool oasis = !mimeType.isEmpty() && ( mimeType == nativeOasisMime || mimeType == nativeOasisMime + "-template" ); - // TODO: use std::auto_ptr or create store on stack [needs API fixing], + // TODO: use std::unique_ptr or create store on stack [needs API fixing], // to remove all the 'delete store' in all the branches KoStore* store = KoStore::createStore( file, KoStore::Write, mimeType, backend ); if ( store->bad() )