summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-10 14:54:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-11 14:50:11 +0100
commitccf986a77a4b218964033e70601ae220eb2c9b13 (patch)
tree08dc4cfd477a6723e8e389046fef9af67ca753a9
parent9d6b6fc96718389d7bf5f84a9e00fc5bb275c265 (diff)
loplugin:useuniqueptr in svl
Change-Id: I2fdb63517349474d90cb17ad2bd667f30840e83d Reviewed-on: https://gerrit.libreoffice.org/47727 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/svl/adrparse.hxx4
-rw-r--r--include/svl/instrm.hxx3
-rw-r--r--include/svl/itemiter.hxx4
-rw-r--r--include/svl/itemset.hxx8
-rw-r--r--include/svl/languageoptions.hxx5
-rw-r--r--include/svl/ondemand.hxx19
-rw-r--r--include/svl/zforlist.hxx10
-rw-r--r--sc/source/core/data/patattr.cxx4
-rw-r--r--svl/source/config/languageoptions.cxx8
-rw-r--r--svl/source/fsstor/fsstorage.cxx18
-rw-r--r--svl/source/items/itemiter.cxx4
-rw-r--r--svl/source/items/itemset.cxx85
-rw-r--r--svl/source/items/stylepool.cxx46
-rw-r--r--svl/source/misc/adrparse.cxx6
-rw-r--r--svl/source/misc/strmadpt.cxx3
-rw-r--r--svl/source/numbers/zforfind.cxx6
-rw-r--r--svl/source/numbers/zforfind.hxx2
-rw-r--r--svl/source/numbers/zforlist.cxx77
-rw-r--r--svl/source/undo/undo.cxx6
19 files changed, 137 insertions, 181 deletions
diff --git a/include/svl/adrparse.hxx b/include/svl/adrparse.hxx
index 2213e26c66f5..0961158a52e7 100644
--- a/include/svl/adrparse.hxx
+++ b/include/svl/adrparse.hxx
@@ -47,7 +47,7 @@ class SVL_DLLPUBLIC SvAddressParser
friend class SvAddressParser_Impl;
SvAddressEntry_Impl m_aFirst;
- ::std::vector< SvAddressEntry_Impl* >
+ ::std::vector< SvAddressEntry_Impl >
m_aRest;
bool m_bHasFirst;
@@ -61,7 +61,7 @@ public:
const OUString& GetEmailAddress(sal_Int32 nIndex) const
{
return nIndex == 0 ? m_aFirst.m_aAddrSpec :
- m_aRest[ nIndex - 1 ]->m_aAddrSpec;
+ m_aRest[ nIndex - 1 ].m_aAddrSpec;
}
};
diff --git a/include/svl/instrm.hxx b/include/svl/instrm.hxx
index c8c914546e45..21e8ea6c3c2d 100644
--- a/include/svl/instrm.hxx
+++ b/include/svl/instrm.hxx
@@ -23,6 +23,7 @@
#include <svl/svldllapi.h>
#include <com/sun/star/uno/Reference.h>
#include <tools/stream.hxx>
+#include <memory>
namespace com { namespace sun { namespace star { namespace io {
class XInputStream;
@@ -36,7 +37,7 @@ class SVL_DLLPUBLIC SvInputStream: public SvStream
{
css::uno::Reference< css::io::XInputStream > m_xStream;
css::uno::Reference< css::io::XSeekable > m_xSeekable;
- SvDataPipe_Impl * m_pPipe;
+ std::unique_ptr<SvDataPipe_Impl> m_pPipe;
sal_uInt64 m_nSeekedFrom;
SVL_DLLPRIVATE bool open();
diff --git a/include/svl/itemiter.hxx b/include/svl/itemiter.hxx
index aba136d2aa85..08aef0ea4f66 100644
--- a/include/svl/itemiter.hxx
+++ b/include/svl/itemiter.hxx
@@ -41,11 +41,11 @@ public:
const SfxPoolItem* FirstItem()
{
m_nCurrent = m_nStart;
- return m_rSet.m_nCount ? *(m_rSet.m_pItems + m_nCurrent) : nullptr;
+ return m_rSet.m_nCount ? *(m_rSet.m_pItems.get() + m_nCurrent) : nullptr;
}
const SfxPoolItem* GetCurItem() const
{
- return m_rSet.m_nCount ? *(m_rSet.m_pItems + m_nCurrent) : nullptr;
+ return m_rSet.m_nCount ? *(m_rSet.m_pItems.get() + m_nCurrent) : nullptr;
}
const SfxPoolItem* NextItem();
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
index ca944d282ad4..d5a2b5eb5ad7 100644
--- a/include/svl/itemset.hxx
+++ b/include/svl/itemset.hxx
@@ -25,6 +25,7 @@
#include <cstddef>
#include <initializer_list>
#include <type_traits>
+#include <memory>
#include <svl/svldllapi.h>
#include <svl/poolitem.hxx>
@@ -34,8 +35,6 @@ class SfxItemPool;
class SfxPoolItem;
class SvStream;
-typedef SfxPoolItem const** SfxItemArray;
-
namespace svl {
namespace detail {
@@ -84,7 +83,8 @@ class SAL_WARN_UNUSED SVL_DLLPUBLIC SfxItemSet
SfxItemPool* m_pPool; ///< pool that stores the items
const SfxItemSet* m_pParent; ///< derivation
- SfxItemArray m_pItems; ///< array of items
+ std::unique_ptr<SfxPoolItem const*[]>
+ m_pItems; ///< array of items
sal_uInt16* m_pWhichRanges; ///< array of Which Ranges
sal_uInt16 m_nCount; ///< number of items
@@ -99,7 +99,7 @@ private:
std::size_t items);
public:
- SfxItemArray GetItems_Impl() const { return m_pItems; }
+ SfxPoolItem const** GetItems_Impl() const { return m_pItems.get(); }
private:
const SfxItemSet& operator=(const SfxItemSet &) = delete;
diff --git a/include/svl/languageoptions.hxx b/include/svl/languageoptions.hxx
index 6de8eb566c5b..fadd74f08893 100644
--- a/include/svl/languageoptions.hxx
+++ b/include/svl/languageoptions.hxx
@@ -25,6 +25,7 @@
#include <unotools/options.hxx>
#include <i18nlangtag/lang.h>
#include <o3tl/typed_flags_set.hxx>
+#include <memory>
// class SvtLanguageOptions ----------------------------------------------------
@@ -49,8 +50,8 @@ class SvtCTLOptions;
class SVL_DLLPUBLIC SvtLanguageOptions : public ::utl::detail::Options
{
private:
- SvtCJKOptions* m_pCJKOptions;
- SvtCTLOptions* m_pCTLOptions;
+ std::unique_ptr<SvtCJKOptions> m_pCJKOptions;
+ std::unique_ptr<SvtCTLOptions> m_pCTLOptions;
public:
enum EOption
diff --git a/include/svl/ondemand.hxx b/include/svl/ondemand.hxx
index a66b4aa4ef77..47fe95de4236 100644
--- a/include/svl/ondemand.hxx
+++ b/include/svl/ondemand.hxx
@@ -60,26 +60,19 @@ class OnDemandLocaleDataWrapper
LanguageType eCurrentLanguage;
LanguageType eLastAnyLanguage;
const LocaleDataWrapper* pSystem;
- const LocaleDataWrapper* pEnglish;
- LocaleDataWrapper* pAny;
+ std::unique_ptr<const LocaleDataWrapper> pEnglish;
+ std::unique_ptr< LocaleDataWrapper> pAny;
const LocaleDataWrapper* pCurrent;
bool bInitialized;
public:
OnDemandLocaleDataWrapper()
: eLastAnyLanguage( LANGUAGE_DONTKNOW )
- , pEnglish(nullptr)
- , pAny(nullptr)
, bInitialized(false)
{
pCurrent = pSystem = aSysLocale.GetLocaleDataPtr();
eCurrentLanguage = LANGUAGE_SYSTEM;
}
- ~OnDemandLocaleDataWrapper()
- {
- delete pEnglish;
- delete pAny;
- }
bool isInitialized() const { return bInitialized; }
@@ -101,14 +94,14 @@ public:
else if ( eLang == LANGUAGE_ENGLISH_US )
{
if ( !pEnglish )
- pEnglish = new LocaleDataWrapper( m_xContext, rLanguageTag );
- pCurrent = pEnglish;
+ pEnglish.reset( new LocaleDataWrapper( m_xContext, rLanguageTag ) );
+ pCurrent = pEnglish.get();
}
else
{
if ( !pAny )
{
- pAny = new LocaleDataWrapper( m_xContext, rLanguageTag );
+ pAny.reset( new LocaleDataWrapper( m_xContext, rLanguageTag ) );
eLastAnyLanguage = eLang;
}
else if ( eLastAnyLanguage != eLang )
@@ -116,7 +109,7 @@ public:
pAny->setLanguageTag( rLanguageTag );
eLastAnyLanguage = eLang;
}
- pCurrent = pAny;
+ pCurrent = pAny.get();
}
eCurrentLanguage = eLang;
}
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index 6e7d196c2a61..e82d68072c75 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -887,15 +887,15 @@ private:
std::map<sal_uInt32, std::unique_ptr<SvNumberformat>> aFTable; // Table of format keys to format entries
typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap;
DefaultFormatKeysMap aDefaultFormatKeys; // Table of default standard to format keys
- SvNumberFormatTable* pFormatTable; // For the UI dialog
- SvNumberFormatterIndexTable* pMergeTable; // List of indices for merging two formatters
- CharClass* pCharClass; // CharacterClassification
+ std::unique_ptr<SvNumberFormatTable> pFormatTable; // For the UI dialog
+ std::unique_ptr<SvNumberFormatterIndexTable> pMergeTable; // List of indices for merging two formatters
+ std::unique_ptr<CharClass> pCharClass; // CharacterClassification
OnDemandLocaleDataWrapper xLocaleData; // LocaleData switched between SYSTEM, ENGLISH and other
OnDemandTransliterationWrapper xTransliteration; // Transliteration loaded on demand
OnDemandCalendarWrapper xCalendar; // Calendar loaded on demand
OnDemandNativeNumberWrapper xNatNum; // Native number service loaded on demand
- ImpSvNumberInputScan* pStringScanner; // Input string scanner
- ImpSvNumberformatScan* pFormatScanner; // Format code string scanner
+ std::unique_ptr<ImpSvNumberInputScan> pStringScanner; // Input string scanner
+ std::unique_ptr<ImpSvNumberformatScan> pFormatScanner; // Format code string scanner
Link<sal_uInt16,Color*> aColorLink; // User defined color table CallBack
sal_uInt32 MaxCLOffset; // Max language/country offset used
sal_uInt32 nDefaultSystemCurrencyFormat; // NewCurrency matching SYSTEM locale
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 86aec0b7d450..05afb0a14c85 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -129,8 +129,8 @@ inline bool EqualPatternSets( const SfxItemSet& rSet1, const SfxItemSet& rSet2 )
if ( rSet1.Count() != rSet2.Count() )
return false;
- SfxItemArray pItems1 = rSet1.GetItems_Impl(); // inline method of SfxItemSet
- SfxItemArray pItems2 = rSet2.GetItems_Impl();
+ SfxPoolItem const ** pItems1 = rSet1.GetItems_Impl(); // inline method of SfxItemSet
+ SfxPoolItem const ** pItems2 = rSet2.GetItems_Impl();
return ( 0 == memcmp( pItems1, pItems2, (ATTR_PATTERN_END - ATTR_PATTERN_START + 1) * sizeof(pItems1[0]) ) );
}
diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx
index 74af0313c775..abf5729fd56d 100644
--- a/svl/source/config/languageoptions.cxx
+++ b/svl/source/config/languageoptions.cxx
@@ -45,8 +45,8 @@ SvtLanguageOptions::SvtLanguageOptions( bool _bDontLoad )
// Global access, must be guarded (multithreading)
::osl::MutexGuard aGuard( ALMutex::get() );
- m_pCJKOptions = new SvtCJKOptions( _bDontLoad );
- m_pCTLOptions = new SvtCTLOptions( _bDontLoad );
+ m_pCJKOptions.reset(new SvtCJKOptions( _bDontLoad ));
+ m_pCTLOptions.reset(new SvtCTLOptions( _bDontLoad ));
m_pCTLOptions->AddListener(this);
m_pCJKOptions->AddListener(this);
}
@@ -58,8 +58,8 @@ SvtLanguageOptions::~SvtLanguageOptions()
m_pCTLOptions->RemoveListener(this);
m_pCJKOptions->RemoveListener(this);
- delete m_pCJKOptions;
- delete m_pCTLOptions;
+ m_pCJKOptions.reset();
+ m_pCTLOptions.reset();
}
// CJK options
bool SvtLanguageOptions::IsCJKFontEnabled() const
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index a4bfba7d192e..c899bfe357c4 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -72,8 +72,8 @@ struct FSStorage_Impl
::ucbhelper::Content m_aContent;
sal_Int32 m_nMode;
- ::comphelper::OInterfaceContainerHelper2* m_pListenersContainer; // list of listeners
- ::cppu::OTypeCollection* m_pTypeCollection;
+ std::unique_ptr<::comphelper::OInterfaceContainerHelper2> m_pListenersContainer; // list of listeners
+ std::unique_ptr<::cppu::OTypeCollection> m_pTypeCollection;
uno::Reference< uno::XComponentContext > m_xContext;
@@ -89,19 +89,11 @@ struct FSStorage_Impl
OSL_ENSURE( !m_aURL.isEmpty(), "The URL must not be empty" );
}
- ~FSStorage_Impl();
-
// Copy assignment is forbidden and not implemented.
FSStorage_Impl (const FSStorage_Impl &) = delete;
FSStorage_Impl & operator= (const FSStorage_Impl &) = delete;
};
-FSStorage_Impl::~FSStorage_Impl()
-{
- delete m_pListenersContainer;
- delete m_pTypeCollection;
-}
-
FSStorage::FSStorage( const ::ucbhelper::Content& aContent,
sal_Int32 nMode,
uno::Reference< uno::XComponentContext > const & xContext )
@@ -276,11 +268,11 @@ uno::Sequence< uno::Type > SAL_CALL FSStorage::getTypes()
if ( m_pImpl->m_pTypeCollection == nullptr )
{
- m_pImpl->m_pTypeCollection = new ::cppu::OTypeCollection
+ m_pImpl->m_pTypeCollection.reset(new ::cppu::OTypeCollection
( cppu::UnoType<lang::XTypeProvider>::get()
, cppu::UnoType<embed::XStorage>::get()
, cppu::UnoType<embed::XHierarchicalStorageAccess>::get()
- , cppu::UnoType<beans::XPropertySet>::get());
+ , cppu::UnoType<beans::XPropertySet>::get()) );
}
}
@@ -1056,7 +1048,7 @@ void SAL_CALL FSStorage::addEventListener(
throw lang::DisposedException();
if ( !m_pImpl->m_pListenersContainer )
- m_pImpl->m_pListenersContainer = new ::comphelper::OInterfaceContainerHelper2( m_aMutex );
+ m_pImpl->m_pListenersContainer.reset(new ::comphelper::OInterfaceContainerHelper2( m_aMutex ));
m_pImpl->m_pListenersContainer->addInterface( xListener );
}
diff --git a/svl/source/items/itemiter.cxx b/svl/source/items/itemiter.cxx
index a42a90bc2358..2cc6ae36212d 100644
--- a/svl/source/items/itemiter.cxx
+++ b/svl/source/items/itemiter.cxx
@@ -32,7 +32,7 @@ SfxItemIter::SfxItemIter( const SfxItemSet& rItemSet )
}
else
{
- SfxItemArray ppFnd = m_rSet.m_pItems;
+ SfxPoolItem const** ppFnd = m_rSet.m_pItems.get();
// Find the first Item that is set
for (m_nStart = 0; !*(ppFnd + m_nStart ); ++m_nStart)
@@ -53,7 +53,7 @@ SfxItemIter::~SfxItemIter()
const SfxPoolItem* SfxItemIter::NextItem()
{
- SfxItemArray ppFnd = m_rSet.m_pItems;
+ SfxPoolItem const** ppFnd = m_rSet.m_pItems.get();
if (m_nCurrent < m_nEnd)
{
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 7e99dfa098fb..3c0bfa79aec3 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -98,7 +98,7 @@ SfxItemSet::SfxItemSet(SfxItemPool& rPool)
m_pPool->FillItemIdRanges_Impl( m_pWhichRanges );
const sal_uInt16 nSize = TotalCount();
- m_pItems = new const SfxPoolItem*[nSize]{};
+ m_pItems.reset(new const SfxPoolItem*[nSize]{});
}
void SfxItemSet::InitRanges_Impl(const sal_uInt16 *pWhichPairTable)
@@ -111,7 +111,7 @@ void SfxItemSet::InitRanges_Impl(const sal_uInt16 *pWhichPairTable)
pPtr += 2;
}
- m_pItems = new const SfxPoolItem*[nCnt]{};
+ m_pItems.reset( new const SfxPoolItem*[nCnt]{} );
std::ptrdiff_t cnt = pPtr - pWhichPairTable +1;
m_pWhichRanges = new sal_uInt16[ cnt ];
@@ -161,7 +161,7 @@ SfxItemSet::SfxItemSet(
#endif
}
m_pWhichRanges[i] = 0;
- m_pItems = new SfxPoolItem const *[size]{};
+ m_pItems.reset( new SfxPoolItem const *[size]{} );
}
SfxItemSet::SfxItemSet( SfxItemPool& rPool, const sal_uInt16* pWhichPairTable )
@@ -190,10 +190,11 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet )
pPtr += 2;
}
- m_pItems = new const SfxPoolItem* [ nCnt ];
+ m_pItems.reset( new const SfxPoolItem* [ nCnt ] );
// Copy attributes
- SfxItemArray ppDst = m_pItems, ppSrc = rASet.m_pItems;
+ SfxPoolItem const** ppDst = m_pItems.get();
+ SfxPoolItem const** ppSrc = rASet.m_pItems.get();
for( sal_uInt16 n = nCnt; n; --n, ++ppDst, ++ppSrc )
if ( nullptr == *ppSrc || // Current Default?
IsInvalidItem(*ppSrc) || // DontCare?
@@ -223,7 +224,7 @@ SfxItemSet::~SfxItemSet()
sal_uInt16 nCount = TotalCount();
if( Count() )
{
- SfxItemArray ppFnd = m_pItems;
+ SfxPoolItem const** ppFnd = m_pItems.get();
for( sal_uInt16 nCnt = nCount; nCnt; --nCnt, ++ppFnd )
if( *ppFnd && !IsInvalidItem(*ppFnd) )
{
@@ -241,7 +242,7 @@ SfxItemSet::~SfxItemSet()
}
}
- delete[] m_pItems;
+ m_pItems.reset();
if (m_pWhichRanges != m_pPool->GetFrozenIdRanges())
delete[] m_pWhichRanges;
m_pWhichRanges = nullptr; // for invariant-testing
@@ -256,7 +257,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
return 0;
sal_uInt16 nDel = 0;
- SfxItemArray ppFnd = m_pItems;
+ SfxPoolItem const** ppFnd = m_pItems.get();
if( nWhich )
{
@@ -347,7 +348,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
void SfxItemSet::ClearInvalidItems()
{
sal_uInt16* pPtr = m_pWhichRanges;
- SfxItemArray ppFnd = m_pItems;
+ SfxPoolItem const** ppFnd = m_pItems.get();
while( *pPtr )
{
for( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
@@ -364,7 +365,7 @@ void SfxItemSet::InvalidateAllItems()
{
assert( !m_nCount && "There are still Items set" );
m_nCount = TotalCount();
- memset(static_cast<void*>(m_pItems), -1, m_nCount * sizeof(SfxPoolItem*));
+ memset(static_cast<void*>(m_pItems.get()), -1, m_nCount * sizeof(SfxPoolItem*));
}
SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
@@ -376,7 +377,7 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
SfxItemState eRet = SfxItemState::UNKNOWN;
do
{
- SfxItemArray ppFnd = pAktSet->m_pItems;
+ SfxPoolItem const** ppFnd = pAktSet->m_pItems.get();
const sal_uInt16* pPtr = pAktSet->m_pWhichRanges;
if (pPtr)
{
@@ -428,7 +429,7 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
if ( !nWhich )
return nullptr; //FIXME: Only because of Outliner bug
- SfxItemArray ppFnd = m_pItems;
+ SfxPoolItem const** ppFnd = m_pItems.get();
const sal_uInt16* pPtr = m_pWhichRanges;
while( *pPtr )
{
@@ -511,7 +512,7 @@ bool SfxItemSet::Put( const SfxItemSet& rSet, bool bInvalidAsDefault )
bool bRet = false;
if( rSet.Count() )
{
- SfxItemArray ppFnd = rSet.m_pItems;
+ SfxPoolItem const** ppFnd = rSet.m_pItems.get();
const sal_uInt16* pPtr = rSet.m_pWhichRanges;
while ( *pPtr )
{
@@ -559,7 +560,7 @@ void SfxItemSet::PutExtended
)
{
// don't "optimize" with "if( rSet.Count()" because of dont-care + defaults
- SfxItemArray ppFnd = rSet.m_pItems;
+ SfxPoolItem const** ppFnd = rSet.m_pItems.get();
const sal_uInt16* pPtr = rSet.m_pWhichRanges;
while ( *pPtr )
{
@@ -709,7 +710,7 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
// create new item-array (by iterating through all new ranges)
sal_uInt16 nSize = Capacity_Impl(pNewRanges);
- SfxItemArray aNewItems = new const SfxPoolItem* [ nSize ];
+ SfxPoolItem const** aNewItems = new const SfxPoolItem* [ nSize ];
sal_uInt16 nNewCount = 0;
if (m_nCount == 0)
memset( aNewItems, 0, nSize * sizeof( SfxPoolItem* ) );
@@ -758,8 +759,7 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
}
// replace old items-array and ranges
- delete[] m_pItems;
- m_pItems = aNewItems;
+ m_pItems.reset( aNewItems );
m_nCount = nNewCount;
if( pNewRanges == GetPool()->GetFrozenIdRanges() )
@@ -857,7 +857,7 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
{
if( pAktSet->Count() )
{
- SfxItemArray ppFnd = pAktSet->m_pItems;
+ SfxPoolItem const** ppFnd = pAktSet->m_pItems.get();
const sal_uInt16* pPtr = pAktSet->m_pWhichRanges;
while( *pPtr )
{
@@ -953,8 +953,8 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
// If the Ranges are identical, we can easily process it
if( bEqual )
{
- SfxItemArray ppFnd1 = m_pItems;
- SfxItemArray ppFnd2 = rSet.m_pItems;
+ SfxPoolItem const** ppFnd1 = m_pItems.get();
+ SfxPoolItem const** ppFnd2 = rSet.m_pItems.get();
for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 )
if( *ppFnd1 && !*ppFnd2 )
@@ -1019,8 +1019,8 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
// If the Ranges are identical, we can easily process it
if( bEqual )
{
- SfxItemArray ppFnd1 = m_pItems;
- SfxItemArray ppFnd2 = rSet.m_pItems;
+ SfxPoolItem const** ppFnd1 = m_pItems.get();
+ SfxPoolItem const** ppFnd2 = rSet.m_pItems.get();
for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 )
if( *ppFnd1 && *ppFnd2 )
@@ -1229,8 +1229,8 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet )
// If the Ranges match, they are easier to process!
if( bEqual )
{
- SfxItemArray ppFnd1 = m_pItems;
- SfxItemArray ppFnd2 = rSet.m_pItems;
+ SfxPoolItem const** ppFnd1 = m_pItems.get();
+ SfxPoolItem const** ppFnd2 = rSet.m_pItems.get();
for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 )
MergeItem_Impl(m_pPool, m_nCount, ppFnd1, *ppFnd2, false/*bIgnoreDefaults*/);
@@ -1259,7 +1259,7 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet )
void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults )
{
- SfxItemArray ppFnd = m_pItems;
+ SfxPoolItem const** ppFnd = m_pItems.get();
const sal_uInt16* pPtr = m_pWhichRanges;
const sal_uInt16 nWhich = rAttr.Which();
while( *pPtr )
@@ -1278,7 +1278,7 @@ void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults )
void SfxItemSet::InvalidateItem( sal_uInt16 nWhich )
{
- SfxItemArray ppFnd = m_pItems;
+ SfxPoolItem const** ppFnd = m_pItems.get();
const sal_uInt16* pPtr = m_pWhichRanges;
while( *pPtr )
{
@@ -1374,12 +1374,12 @@ bool SfxItemSet::Equals(const SfxItemSet &rCmp, bool bComparePool) const
}
// Are all pointers the same?
- if (0 == memcmp( m_pItems, rCmp.m_pItems, nCount1 * sizeof(m_pItems[0]) ))
+ if (0 == memcmp( m_pItems.get(), rCmp.m_pItems.get(), nCount1 * sizeof(m_pItems[0]) ))
return true;
// We need to compare each one separately then
- const SfxPoolItem **ppItem1 = m_pItems;
- const SfxPoolItem **ppItem2 = rCmp.m_pItems;
+ const SfxPoolItem **ppItem1 = m_pItems.get();
+ const SfxPoolItem **ppItem2 = rCmp.m_pItems.get();
for ( sal_uInt16 nPos = 0; nPos < nCount1; ++nPos )
{
// If the pointers of the poolable Items are not the same, the Items
@@ -1425,7 +1425,7 @@ SfxItemSet *SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
void SfxItemSet::PutDirect(const SfxPoolItem &rItem)
{
- SfxItemArray ppFnd = m_pItems;
+ SfxPoolItem const** ppFnd = m_pItems.get();
const sal_uInt16* pPtr = m_pWhichRanges;
const sal_uInt16 nWhich = rItem.Which();
#ifdef DBG_UTIL
@@ -1537,31 +1537,28 @@ static sal_uInt16 *AddRanges_Impl(
*
* @returns the new ItemArray (the old 'pItems' is freed)
*/
-static SfxItemArray AddItem_Impl(SfxItemArray pItems, sal_uInt16 nOldSize, sal_uInt16 nPos)
+static void AddItem_Impl(std::unique_ptr<SfxPoolItem const*[]> & rpItems, sal_uInt16 nOldSize, sal_uInt16 nPos)
{
// Create new ItemArray
- SfxItemArray pNew = new const SfxPoolItem*[nOldSize+1];
+ SfxPoolItem const** pNew = new const SfxPoolItem*[nOldSize+1];
// Was there one before?
- if ( pItems )
+ if ( rpItems )
{
// Copy all Items before nPos
if ( nPos )
- memcpy( static_cast<void*>(pNew), pItems, nPos * sizeof(SfxPoolItem *) );
+ memcpy( static_cast<void*>(pNew), rpItems.get(), nPos * sizeof(SfxPoolItem *) );
// Copy all Items after nPos
if ( nPos < nOldSize )
- memcpy( static_cast<void*>(pNew + nPos + 1), pItems + nPos,
+ memcpy( static_cast<void*>(pNew + nPos + 1), rpItems.get() + nPos,
(nOldSize-nPos) * sizeof(SfxPoolItem *) );
}
// Initialize new Item
*(pNew + nPos) = nullptr;
- // Free old ItemArray
- delete[] pItems;
-
- return pNew;
+ rpItems.reset(pNew);
}
/**
@@ -1606,7 +1603,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
(*pPtr)--;
// Make room before first Item of this Range
- m_pItems = AddItem_Impl(m_pItems, nItemCount, nPos);
+ AddItem_Impl(m_pItems, nItemCount, nPos);
break;
}
@@ -1618,7 +1615,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
// Make room after last Item of this Range
nPos += nWhich - *pPtr;
- m_pItems = AddItem_Impl(m_pItems, nItemCount, nPos);
+ AddItem_Impl(m_pItems, nItemCount, nPos);
break;
}
@@ -1649,7 +1646,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
// Expand ItemArray
nPos = nItemCount;
- m_pItems = AddItem_Impl(m_pItems, nItemCount, nPos);
+ AddItem_Impl(m_pItems, nItemCount, nPos);
}
// Add new Item to Pool
@@ -1657,7 +1654,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
// Remember old Item
bool bIncrementCount = false;
- const SfxPoolItem* pOld = *( m_pItems + nPos );
+ const SfxPoolItem* pOld = m_pItems[nPos];
if ( IsInvalidItem(pOld) ) // state "dontcare"
pOld = nullptr;
if ( !pOld )
@@ -1671,7 +1668,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
}
// Add new Item to ItemSet
- *(m_pItems + nPos) = &rNew;
+ m_pItems[nPos] = &rNew;
// Send Changed Notification
if ( pOld )
diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx
index 04d801c3ac5b..6e52248eb82a 100644
--- a/svl/source/items/stylepool.cxx
+++ b/svl/source/items/stylepool.cxx
@@ -33,11 +33,11 @@ namespace {
*/
class Node
{
- std::vector<Node*> mChildren; // child nodes, create by findChildNode(..)
+ std::vector<std::unique_ptr<Node>> mChildren; // child nodes, create by findChildNode(..)
// container of shared pointers of inserted item sets; for non-poolable
// items more than one item set is needed
std::vector< std::shared_ptr<SfxItemSet> > maItemSet;
- const SfxPoolItem *mpItem; // my pool item
+ std::unique_ptr<const SfxPoolItem> mpItem; // my pool item
Node *mpUpper; // if I'm a child node that's my parent node
// #i86923#
const bool mbIsItemIgnorable;
@@ -57,7 +57,6 @@ namespace {
mpUpper( pParent ),
mbIsItemIgnorable( bIgnorable )
{}
- ~Node();
// #i86923#
bool hasItemSet( const bool bCheckUsage ) const;
// #i87808#
@@ -127,18 +126,15 @@ namespace {
Node* Node::findChildNode( const SfxPoolItem& rItem,
const bool bIsItemIgnorable )
{
- Node* pNextNode = this;
- std::vector<Node*>::const_iterator aIter = mChildren.begin();
- while( aIter != mChildren.end() )
+ for( auto const & rChild : mChildren )
{
- if( rItem.Which() == (*aIter)->mpItem->Which() &&
- rItem == *(*aIter)->mpItem )
- return *aIter;
- ++aIter;
+ if( rItem.Which() == rChild->mpItem->Which() &&
+ rItem == *rChild->mpItem )
+ return rChild.get();
}
// #i86923#
- pNextNode = new Node( rItem, pNextNode, bIsItemIgnorable );
- mChildren.push_back( pNextNode );
+ auto pNextNode = new Node( rItem, this, bIsItemIgnorable );
+ mChildren.emplace_back( pNextNode );
return pNextNode;
}
@@ -164,12 +160,13 @@ namespace {
const bool bSkipIgnorable )
{
// Searching downstairs
- std::vector<Node*>::const_iterator aIter = mChildren.begin();
+ auto aIter = mChildren.begin();
// For pLast == 0 and pLast == this all children are of interest
// for another pLast the search starts behind pLast...
if( pLast && pLast != this )
{
- aIter = std::find( mChildren.begin(), mChildren.end(), pLast );
+ aIter = std::find_if( mChildren.begin(), mChildren.end(),
+ [&] (std::unique_ptr<Node> const &p) { return p.get() == pLast; });
if( aIter != mChildren.end() )
++aIter;
}
@@ -182,7 +179,7 @@ namespace {
++aIter;
continue;
}
- pNext = *aIter;
+ pNext = aIter->get();
// #i86923#
if ( pNext->hasItemSet( bSkipUnusedItemSets ) )
{
@@ -212,10 +209,10 @@ namespace {
{
bool bHasIgnorableChildren( false );
- std::vector<Node*>::const_iterator aIter = mChildren.begin();
+ auto aIter = mChildren.begin();
while( aIter != mChildren.end() && !bHasIgnorableChildren )
{
- Node* pChild = *aIter;
+ Node* pChild = aIter->get();
if ( pChild->mbIsItemIgnorable )
{
bHasIgnorableChildren =
@@ -235,10 +232,10 @@ namespace {
DBG_ASSERT( hasIgnorableChildren( bSkipUnusedItemSets ),
"<Node::getItemSetOfIgnorableChild> - node has no ignorable children" );
- std::vector<Node*>::const_iterator aIter = mChildren.begin();
+ auto aIter = mChildren.begin();
while( aIter != mChildren.end() )
{
- Node* pChild = *aIter;
+ Node* pChild = aIter->get();
if ( pChild->mbIsItemIgnorable )
{
if ( pChild->hasItemSet( bSkipUnusedItemSets ) )
@@ -261,17 +258,6 @@ namespace {
return pReturn;
}
- Node::~Node()
- {
- std::vector<Node*>::const_iterator aIter = mChildren.begin();
- while( aIter != mChildren.end() )
- {
- delete *aIter;
- ++aIter;
- }
- delete mpItem;
- }
-
class Iterator : public IStylePoolIteratorAccess
{
std::map< const SfxItemSet*, Node >& mrRoot;
diff --git a/svl/source/misc/adrparse.cxx b/svl/source/misc/adrparse.cxx
index 23fa558634fc..90b43a8ea191 100644
--- a/svl/source/misc/adrparse.cxx
+++ b/svl/source/misc/adrparse.cxx
@@ -663,8 +663,7 @@ SvAddressParser_Impl::SvAddressParser_Impl(SvAddressParser * pParser,
aTheRealName = rInput.copy( (m_pRealNameContentBegin - rInput.getStr()), nLen);
}
if (pParser->m_bHasFirst)
- pParser->m_aRest.push_back(new SvAddressEntry_Impl( aTheAddrSpec,
- aTheRealName) );
+ pParser->m_aRest.emplace_back( aTheAddrSpec, aTheRealName );
else
{
pParser->m_bHasFirst = true;
@@ -729,9 +728,6 @@ SvAddressParser::SvAddressParser(const OUString& rInput)
SvAddressParser::~SvAddressParser()
{
- for ( size_t i = m_aRest.size(); i > 0; )
- delete m_aRest[ --i ];
- m_aRest.clear();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx
index 1e36c637a388..cb5852865c88 100644
--- a/svl/source/misc/strmadpt.cxx
+++ b/svl/source/misc/strmadpt.cxx
@@ -130,7 +130,7 @@ bool SvInputStream::open()
}
m_xSeekable.set(m_xStream, uno::UNO_QUERY);
if (!m_xSeekable.is())
- m_pPipe = new SvDataPipe_Impl;
+ m_pPipe.reset( new SvDataPipe_Impl );
}
return true;
}
@@ -338,7 +338,6 @@ SvInputStream::~SvInputStream()
{
}
}
- delete m_pPipe;
}
// SvOutputStream
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index c0f679e97b7a..6a2a4d9aa7e9 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -84,7 +84,7 @@ ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP )
eSetType( SvNumFormatType::UNDEFINED )
{
pFormatter = pFormatterP;
- pNullDate = new Date(30,12,1899);
+ pNullDate.reset( new Date(30,12,1899) );
nYear2000 = SvNumberFormatter::GetYear2000Default();
Reset();
ChangeIntl();
@@ -93,8 +93,6 @@ ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP )
ImpSvNumberInputScan::~ImpSvNumberInputScan()
{
- Reset();
- delete pNullDate;
}
@@ -3527,7 +3525,7 @@ void ImpSvNumberInputScan::ChangeNullDate( const sal_uInt16 Day,
}
else
{
- pNullDate = new Date(Day, Month, Year);
+ pNullDate.reset(new Date(Day, Month, Year));
}
}
diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx
index 58021ffff824..17b14edb4c2d 100644
--- a/svl/source/numbers/zforfind.hxx
+++ b/svl/source/numbers/zforfind.hxx
@@ -82,7 +82,7 @@ private:
bool bTextInitialized; //* Whether days and months are initialized
bool bScanGenitiveMonths; //* Whether to scan an input for genitive months
bool bScanPartitiveMonths; //* Whether to scan an input for partitive months
- Date* pNullDate; //* 30Dec1899
+ std::unique_ptr<Date> pNullDate; //* 30Dec1899
// Variables for provisional results:
OUString sStrArray[SV_MAX_COUNT_INPUT_STRINGS];//* Array of scanned substrings
bool IsNum[SV_MAX_COUNT_INPUT_STRINGS]; //* Whether a substring is numeric
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index cc3bda8ce139..e8f030d6c194 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -278,12 +278,7 @@ SvNumberFormatter::~SvNumberFormatter()
}
aFTable.clear();
- delete pFormatTable;
- delete pCharClass;
- delete pStringScanner;
- delete pFormatScanner;
ClearMergeTable();
- delete pMergeTable;
}
@@ -299,7 +294,7 @@ void SvNumberFormatter::ImpConstruct( LanguageType eLang )
nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
maLanguageTag.reset( eLang );
- pCharClass = new CharClass( m_xContext, maLanguageTag );
+ pCharClass.reset( new CharClass( m_xContext, maLanguageTag ) );
xLocaleData.init( m_xContext, maLanguageTag );
xCalendar.init( m_xContext, maLanguageTag.getLocale() );
xTransliteration.init( m_xContext, eLang );
@@ -312,8 +307,8 @@ void SvNumberFormatter::ImpConstruct( LanguageType eLang )
aThousandSep = pLoc->getNumThousandSep();
aDateSep = pLoc->getDateSep();
- pStringScanner = new ImpSvNumberInputScan( this );
- pFormatScanner = new ImpSvNumberformatScan( this );
+ pStringScanner.reset( new ImpSvNumberInputScan( this ) );
+ pFormatScanner.reset( new ImpSvNumberformatScan( this ) );
pFormatTable = nullptr;
MaxCLOffset = 0;
ImpGenerateFormats( 0, false ); // 0 .. 999 for initialized language formats
@@ -485,8 +480,8 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
LanguageType eLge = eOldLanguage; // ConvertMode changes this
bool bCheck = false;
sal_Int32 nCheckPos = -1;
- std::unique_ptr<SvNumberformat> pNewEntry(new SvNumberformat( aString, pFormatScanner,
- pStringScanner, nCheckPos, eLge ));
+ std::unique_ptr<SvNumberformat> pNewEntry(new SvNumberformat( aString, pFormatScanner.get(),
+ pStringScanner.get(), nCheckPos, eLge ));
if ( nCheckPos == 0 )
{
SvNumFormatType eCheckType = pNewEntry->GetType();
@@ -519,7 +514,7 @@ const css::uno::Reference<css::uno::XComponentContext>& SvNumberFormatter::GetCo
return m_xContext;
}
-const ImpSvNumberformatScan* SvNumberFormatter::GetFormatScanner() const { return pFormatScanner; }
+const ImpSvNumberformatScan* SvNumberFormatter::GetFormatScanner() const { return pFormatScanner.get(); }
const LanguageTag& SvNumberFormatter::GetLanguageTag() const { return maLanguageTag; }
@@ -528,7 +523,7 @@ const ::utl::TransliterationWrapper* SvNumberFormatter::GetTransliteration() con
return xTransliteration.get();
}
-const CharClass* SvNumberFormatter::GetCharClass() const { return pCharClass; }
+const CharClass* SvNumberFormatter::GetCharClass() const { return pCharClass.get(); }
const LocaleDataWrapper* SvNumberFormatter::GetLocaleData() const { return xLocaleData.get(); }
@@ -582,8 +577,8 @@ bool SvNumberFormatter::PutEntry(OUString& rString,
LanguageType eLge = eLnge; // non-const for ConvertMode
bool bCheck = false;
std::unique_ptr<SvNumberformat> p_Entry(new SvNumberformat(rString,
- pFormatScanner,
- pStringScanner,
+ pFormatScanner.get(),
+ pStringScanner.get(),
nCheckPos,
eLge));
@@ -1037,7 +1032,7 @@ SvNumberFormatTable& SvNumberFormatter::GetEntryTable(
}
else
{
- pFormatTable = new SvNumberFormatTable;
+ pFormatTable.reset( new SvNumberFormatTable );
}
ChangeIntl(eLnge);
sal_uInt32 CLOffset = ImpGetCLOffset(ActLnge);
@@ -1635,8 +1630,8 @@ bool SvNumberFormatter::GetPreviewString(const OUString& sFormatString,
sal_Int32 nCheckPos = -1;
OUString sTmpString = sFormatString;
std::unique_ptr<SvNumberformat> p_Entry(new SvNumberformat(sTmpString,
- pFormatScanner,
- pStringScanner,
+ pFormatScanner.get(),
+ pStringScanner.get(),
nCheckPos,
eLnge));
if (nCheckPos == 0) // String ok
@@ -1703,8 +1698,8 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
if ( bEnglish )
{
sTmpString = sFormatString;
- pEntry.reset(new SvNumberformat( sTmpString, pFormatScanner,
- pStringScanner, nCheckPos, eLnge ));
+ pEntry.reset(new SvNumberformat( sTmpString, pFormatScanner.get(),
+ pStringScanner.get(), nCheckPos, eLnge ));
}
else
{
@@ -1716,8 +1711,8 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
LanguageType eFormatLang = LANGUAGE_ENGLISH_US;
pFormatScanner->SetConvertMode( LANGUAGE_ENGLISH_US, eLnge );
sTmpString = sFormatString;
- pEntry.reset(new SvNumberformat( sTmpString, pFormatScanner,
- pStringScanner, nCheckPos, eFormatLang ));
+ pEntry.reset(new SvNumberformat( sTmpString, pFormatScanner.get(),
+ pStringScanner.get(), nCheckPos, eFormatLang ));
pFormatScanner->SetConvertMode( false );
ChangeIntl( eLnge );
@@ -1730,8 +1725,8 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
// Force locale's keywords.
pFormatScanner->ChangeIntl( ImpSvNumberformatScan::KeywordLocalization::LocaleLegacy );
sTmpString = sFormatString;
- pEntry.reset(new SvNumberformat( sTmpString, pFormatScanner,
- pStringScanner, nCheckPos, eLnge ));
+ pEntry.reset(new SvNumberformat( sTmpString, pFormatScanner.get(),
+ pStringScanner.get(), nCheckPos, eLnge ));
}
else
{
@@ -1741,8 +1736,8 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
eFormatLang = eLnge;
pFormatScanner->SetConvertMode( eLnge, LANGUAGE_ENGLISH_US );
sTmpString = sFormatString;
- std::unique_ptr<SvNumberformat> pEntry2(new SvNumberformat( sTmpString, pFormatScanner,
- pStringScanner, nCheckPos2, eFormatLang ));
+ std::unique_ptr<SvNumberformat> pEntry2(new SvNumberformat( sTmpString, pFormatScanner.get(),
+ pStringScanner.get(), nCheckPos2, eFormatLang ));
pFormatScanner->SetConvertMode( false );
ChangeIntl( eLnge );
if ( nCheckPos2 == 0 && !xTransliteration->isEqual( sFormatString,
@@ -1752,8 +1747,8 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
// Force locale's keywords.
pFormatScanner->ChangeIntl( ImpSvNumberformatScan::KeywordLocalization::LocaleLegacy );
sTmpString = sFormatString;
- pEntry.reset(new SvNumberformat( sTmpString, pFormatScanner,
- pStringScanner, nCheckPos, eLnge ));
+ pEntry.reset(new SvNumberformat( sTmpString, pFormatScanner.get(),
+ pStringScanner.get(), nCheckPos, eLnge ));
}
}
}
@@ -1789,8 +1784,8 @@ bool SvNumberFormatter::GetPreviewString( const OUString& sFormatString,
sal_Int32 nCheckPos = -1;
OUString sTmpString = sFormatString;
std::unique_ptr<SvNumberformat> p_Entry(new SvNumberformat( sTmpString,
- pFormatScanner,
- pStringScanner,
+ pFormatScanner.get(),
+ pStringScanner.get(),
nCheckPos,
eLnge));
if (nCheckPos == 0) // String ok
@@ -1843,8 +1838,8 @@ sal_uInt32 SvNumberFormatter::TestNewString(const OUString& sFormatString,
sal_Int32 nCheckPos = -1;
OUString sTmpString = sFormatString;
std::unique_ptr<SvNumberformat> pEntry(new SvNumberformat(sTmpString,
- pFormatScanner,
- pStringScanner,
+ pFormatScanner.get(),
+ pStringScanner.get(),
nCheckPos,
eLnge));
if (nCheckPos == 0) // String ok
@@ -1893,8 +1888,8 @@ SvNumberformat* SvNumberFormatter::ImpInsertFormat( const css::i18n::NumberForma
}
sal_Int32 nCheckPos = 0;
std::unique_ptr<SvNumberformat> pFormat(new SvNumberformat(aCodeStr,
- pFormatScanner,
- pStringScanner,
+ pFormatScanner.get(),
+ pStringScanner.get(),
nCheckPos,
ActLnge));
if (nCheckPos != 0)
@@ -2059,8 +2054,8 @@ sal_uInt32 SvNumberFormatter::GetFormatSpecialInfo( const OUString& rFormatStrin
eLnge = ActLnge;
OUString aTmpStr( rFormatString );
sal_Int32 nCheckPos = 0;
- std::unique_ptr<SvNumberformat> pFormat(new SvNumberformat( aTmpStr, pFormatScanner,
- pStringScanner, nCheckPos, eLnge ));
+ std::unique_ptr<SvNumberformat> pFormat(new SvNumberformat( aTmpStr, pFormatScanner.get(),
+ pStringScanner.get(), nCheckPos, eLnge ));
if ( nCheckPos == 0 )
{
pFormat->GetFormatSpecialInfo( bThousand, IsRed, nPrecision, nLeadingCnt );
@@ -2337,8 +2332,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
OUString aFormatCode = pFormatScanner->GetBooleanString();
sal_Int32 nCheckPos = 0;
- std::unique_ptr<SvNumberformat> pNewFormat(new SvNumberformat( aFormatCode, pFormatScanner,
- pStringScanner, nCheckPos, ActLnge ));
+ std::unique_ptr<SvNumberformat> pNewFormat(new SvNumberformat( aFormatCode, pFormatScanner.get(),
+ pStringScanner.get(), nCheckPos, ActLnge ));
pNewFormat->SetType(SvNumFormatType::LOGICAL);
pNewFormat->SetStandard();
if ( !aFTable.emplace(CLOffset + ZF_STANDARD_LOGICAL /* NF_BOOLEAN */,
@@ -2349,8 +2344,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
// Text
aFormatCode = "@";
- pNewFormat.reset(new SvNumberformat( aFormatCode, pFormatScanner,
- pStringScanner, nCheckPos, ActLnge ));
+ pNewFormat.reset(new SvNumberformat( aFormatCode, pFormatScanner.get(),
+ pStringScanner.get(), nCheckPos, ActLnge ));
pNewFormat->SetType(SvNumFormatType::TEXT);
pNewFormat->SetStandard();
if ( !aFTable.emplace( CLOffset + ZF_STANDARD_TEXT /* NF_TEXT */,
@@ -3119,7 +3114,7 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
}
else
{
- pMergeTable = new SvNumberFormatterIndexTable;
+ pMergeTable.reset( new SvNumberFormatterIndexTable );
}
sal_uInt32 nCLOffset = 0;
@@ -3183,7 +3178,7 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
}
++it;
}
- return pMergeTable;
+ return pMergeTable.get();
}
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 8fe198ce51f6..e0974e4e661f 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -347,7 +347,7 @@ namespace svl { namespace undo { namespace impl
{
// remember
if ( i_action )
- m_aUndoActionsCleanup.push_back( i_action );
+ m_aUndoActionsCleanup.emplace_back( i_action );
}
/** schedules the given SfxUndoListener method to be called for all registered listeners.
@@ -368,7 +368,7 @@ namespace svl { namespace undo { namespace impl
private:
SfxUndoManager_Data& m_rManagerData;
::osl::ResettableMutexGuard m_aGuard;
- ::std::vector< SfxUndoAction* > m_aUndoActionsCleanup;
+ ::std::vector< std::unique_ptr<SfxUndoAction> > m_aUndoActionsCleanup;
::std::vector< NotifyUndoListener > m_notifiers;
};
@@ -381,8 +381,6 @@ namespace svl { namespace undo { namespace impl
m_aGuard.clear();
// delete all actions
- for (auto const& undoAction : m_aUndoActionsCleanup)
- delete undoAction;
m_aUndoActionsCleanup.clear();
// handle scheduled notification