[Libreoffice-commits] core.git: include/svtools svtools/source
Aleksas Pantechovskis
alex.pantec at gmail.com
Thu Mar 10 08:03:40 UTC 2016
include/svtools/svparser.hxx | 5 +++--
svtools/source/svrtf/svparser.cxx | 11 +++--------
2 files changed, 6 insertions(+), 10 deletions(-)
New commits:
commit 50336412f775af154509d67b1ebbdb4b5feb147b
Author: Aleksas Pantechovskis <alex.pantec at gmail.com>
Date: Wed Mar 9 14:27:10 2016 +0200
tdf#89329 Use std::unique_ptr for pImpl in svparser
Change-Id: Ia791bade1a1f9d27a48994f8bb380ffec50e23bb
Reviewed-on: https://gerrit.libreoffice.org/23072
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/svtools/svparser.hxx b/include/svtools/svparser.hxx
index cfbd115..527c192 100644
--- a/include/svtools/svparser.hxx
+++ b/include/svtools/svparser.hxx
@@ -27,6 +27,7 @@
#include <rtl/textenc.h>
#include <rtl/ustring.hxx>
#include <vector>
+#include <memory>
struct SvParser_Impl;
class SvStream;
@@ -51,7 +52,7 @@ protected:
sal_uLong nlLineNr; // current line number
sal_uLong nlLinePos; // current column number
- SvParser_Impl *pImplData; // internal data
+ std::unique_ptr<SvParser_Impl> pImplData; // internal data
long nTokenValue; // additional value (RTF)
bool bTokenHasValue; // indicates whether nTokenValue is valid
SvParserState eState; // status also in derived classes
@@ -230,7 +231,7 @@ public:
class SVT_DLLPUBLIC SvKeyValueIterator : public SvRefBase
{
struct Impl;
- Impl* mpImpl;
+ std::unique_ptr<Impl> mpImpl;
public:
/** Construction/Destruction.
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index 3350492..a17ca8a 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -94,8 +94,6 @@ SvParser::~SvParser()
rtl_destroyTextToUnicodeConverter( pImplData->hConv );
}
- delete pImplData;
-
delete [] pTokenStack;
}
@@ -124,7 +122,7 @@ void SvParser::SetSrcEncoding( rtl_TextEncoding eEnc )
{
eSrcEnc = eEnc;
if( !pImplData )
- pImplData = new SvParser_Impl;
+ pImplData.reset(new SvParser_Impl);
pImplData->hConv = rtl_createTextToUnicodeConverter( eSrcEnc );
DBG_ASSERT( pImplData->hConv,
"SvParser::SetSrcEncoding: no converter for source encoding" );
@@ -523,7 +521,7 @@ void SvParser::SaveState( int nToken )
// save actual status
if( !pImplData )
{
- pImplData = new SvParser_Impl;
+ pImplData.reset(new SvParser_Impl);
pImplData->nSaveToken = 0;
}
@@ -672,10 +670,7 @@ struct SvKeyValueIterator::Impl
SvKeyValueIterator::SvKeyValueIterator() : mpImpl(new Impl) {}
-SvKeyValueIterator::~SvKeyValueIterator()
-{
- delete mpImpl;
-}
+SvKeyValueIterator::~SvKeyValueIterator() = default;
bool SvKeyValueIterator::GetFirst (SvKeyValue &rKeyVal)
{
More information about the Libreoffice-commits
mailing list