diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-10 12:30:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-11 12:47:37 +0100 |
commit | e57a036939e27ecd173ace691689e26a6a33df8e (patch) | |
tree | a36d589da272c4732cddb4ca0548cdb5dcb2b2bd /include | |
parent | cb5d79b504aa8575ea15c777707c7465ea43cb07 (diff) |
loplugin:useuniqueptr in tools,stoc,unotools
Change-Id: Ia72b65577143623cedc7a40bc34f7fb897add097
Reviewed-on: https://gerrit.libreoffice.org/47726
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/tools/inetstrm.hxx | 6 | ||||
-rw-r--r-- | include/tools/multisel.hxx | 7 | ||||
-rw-r--r-- | include/tools/stream.hxx | 7 | ||||
-rw-r--r-- | include/unotools/intlwrapper.hxx | 13 | ||||
-rw-r--r-- | include/unotools/tempfile.hxx | 4 |
5 files changed, 22 insertions, 15 deletions
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 <tools/stream.hxx> #include <sal/types.h> #include <vector> +#include <memory> class INetMIMEMessage; class SvStream; @@ -36,7 +37,8 @@ class TOOLS_DLLPUBLIC INetMIMEMessageStream sal_Char *pRead; sal_Char *pWrite; - SvStream *pMsgStrm; + std::unique_ptr<SvStream> + 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<INetMIMEMessageStream> 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 <vector> #include <set> -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 <vcl/errcode.hxx> #include <rtl/string.hxx> #include <o3tl/typed_flags_set.hxx> +#include <memory> 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<sal_uInt8> + 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<StreamData> + 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 <unotools/collatorwrapper.hxx> #include <i18nlangtag/lang.h> #include <i18nlangtag/languagetag.hxx> +#include <memory> /** 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<LocaleDataWrapper> pLocaleData; + std::unique_ptr<CollatorWrapper> pCollator; + std::unique_ptr<CollatorWrapper> 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 <unotools/unotoolsdllapi.h> #include <tools/stream.hxx> +#include <memory> namespace utl { @@ -45,7 +46,8 @@ namespace utl class UNOTOOLS_DLLPUBLIC TempFile { OUString aName; - SvStream* pStream; + std::unique_ptr<SvStream> + pStream; bool bIsDirectory; bool bKillingFileEnabled; |