From e57a036939e27ecd173ace691689e26a6a33df8e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 10 Jan 2018 12:30:15 +0200 Subject: loplugin:useuniqueptr in tools,stoc,unotools Change-Id: Ia72b65577143623cedc7a40bc34f7fb897add097 Reviewed-on: https://gerrit.libreoffice.org/47726 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/tools/inetstrm.hxx | 6 ++++-- include/tools/multisel.hxx | 7 +++---- include/tools/stream.hxx | 7 +++++-- include/unotools/intlwrapper.hxx | 13 +++++++------ include/unotools/tempfile.hxx | 4 +++- 5 files changed, 22 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/tools/inetstrm.hxx b/include/tools/inetstrm.hxx index f3e7ae325c90..765474ef8248 100644 --- a/include/tools/inetstrm.hxx +++ b/include/tools/inetstrm.hxx @@ -23,6 +23,7 @@ #include #include #include +#include class INetMIMEMessage; class SvStream; @@ -36,7 +37,8 @@ class TOOLS_DLLPUBLIC INetMIMEMessageStream sal_Char *pRead; sal_Char *pWrite; - SvStream *pMsgStrm; + std::unique_ptr + pMsgStrm; SvMemoryStream maMsgBuffer; sal_Char *pMsgRead; sal_Char *pMsgWrite; @@ -44,7 +46,7 @@ class TOOLS_DLLPUBLIC INetMIMEMessageStream bool done; sal_uInt32 nChildIndex; - INetMIMEMessageStream *pChildStrm; + std::unique_ptr pChildStrm; INetMIMEMessageStream (const INetMIMEMessageStream& rStrm) = delete; INetMIMEMessageStream& operator= (const INetMIMEMessageStream& rStrm) = delete; diff --git a/include/tools/multisel.hxx b/include/tools/multisel.hxx index 854be3768afb..c26eccf221c6 100644 --- a/include/tools/multisel.hxx +++ b/include/tools/multisel.hxx @@ -26,14 +26,13 @@ #include #include -typedef ::std::vector< Range* > ImpSelList; - #define SFX_ENDOFSELECTION SAL_MAX_INT32 class SAL_WARN_UNUSED TOOLS_DLLPUBLIC MultiSelection { private: - ImpSelList aSels; // array of SV-selections + std::vector< Range > + aSels; // array of SV-selections Range aTotRange; // total range of indexes sal_Int32 nCurSubSel; // index in aSels of current selected index sal_Int32 nCurIndex; // current selected entry @@ -72,7 +71,7 @@ public: sal_Int32 NextSelected(); sal_Int32 GetRangeCount() const { return aSels.size(); } - const Range& GetRange( sal_Int32 nRange ) const { return *aSels[nRange]; } + const Range& GetRange( sal_Int32 nRange ) const { return aSels[nRange]; } }; class SAL_WARN_UNUSED TOOLS_DLLPUBLIC StringRangeEnumerator diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index 640dca026598..cb211ddba607 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -26,6 +26,7 @@ #include #include #include +#include class StreamData; @@ -143,7 +144,8 @@ private: sal_uInt64 m_nActPos; // buffer management - sal_uInt8* m_pRWBuf; ///< Points to read/write buffer + std::unique_ptr + m_pRWBuf; ///< Points to read/write buffer sal_uInt8* m_pBufPos; ///< m_pRWBuf + m_nBufActualPos sal_uInt16 m_nBufSize; ///< Allocated size of buffer sal_uInt16 m_nBufActualLen; ///< Length of used segment of puffer @@ -582,7 +584,8 @@ TOOLS_DLLPUBLIC bool checkSeek(SvStream &rSt, sal_uInt64 nOffset) SAL_WARN_UNUSE class TOOLS_DLLPUBLIC SvFileStream : public SvStream { private: - StreamData* pInstanceData; + std::unique_ptr + pInstanceData; OUString aFilename; #if defined(_WIN32) sal_uInt16 nLockCounter; diff --git a/include/unotools/intlwrapper.hxx b/include/unotools/intlwrapper.hxx index 8877a05dbd61..ffcb3313b349 100644 --- a/include/unotools/intlwrapper.hxx +++ b/include/unotools/intlwrapper.hxx @@ -27,6 +27,7 @@ #include #include #include +#include /** A wrapper of I18N wrappers. Using this is more expensive than using some @@ -50,9 +51,9 @@ private: LanguageTag maLanguageTag; css::uno::Reference< css::uno::XComponentContext > m_xContext; - LocaleDataWrapper* pLocaleData; - CollatorWrapper* pCollator; - CollatorWrapper* pCaseCollator; + std::unique_ptr pLocaleData; + std::unique_ptr pCollator; + std::unique_ptr pCaseCollator; void ImplNewLocaleData() const; void ImplNewCollator( bool bCaseSensitive ) const; @@ -65,21 +66,21 @@ public: { if ( !pLocaleData ) ImplNewLocaleData(); - return pLocaleData; + return pLocaleData.get(); } /// case insensitive collator, simple IGNORE_CASE const CollatorWrapper* getCollator() const { if ( !pCollator ) ImplNewCollator( false ); - return pCollator; + return pCollator.get(); } /// case sensitive collator const CollatorWrapper* getCaseCollator() const { if ( !pCaseCollator ) ImplNewCollator( true ); - return pCaseCollator; + return pCaseCollator.get(); } }; diff --git a/include/unotools/tempfile.hxx b/include/unotools/tempfile.hxx index 791b51573f29..a70f7d277fbf 100644 --- a/include/unotools/tempfile.hxx +++ b/include/unotools/tempfile.hxx @@ -22,6 +22,7 @@ #include #include +#include namespace utl { @@ -45,7 +46,8 @@ namespace utl class UNOTOOLS_DLLPUBLIC TempFile { OUString aName; - SvStream* pStream; + std::unique_ptr + pStream; bool bIsDirectory; bool bKillingFileEnabled; -- cgit