summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-19 09:11:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-19 11:28:41 +0000
commit968f6a7f0293c08a73807603f3cb294e4b50bad8 (patch)
treeace3fb5c260c8bbdc3f97c48499b5466f660a68c
parentd3ff66999d924e832f8219c65ced0526f1a67f82 (diff)
new loplugin: useuniqueptr: unotools..xmlscript
Change-Id: I6966d44cff644112dd837adfe7d9c4f459457271 Reviewed-on: https://gerrit.libreoffice.org/33298 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/unotools/options.hxx3
-rw-r--r--include/xmloff/XMLFontAutoStylePool.hxx3
-rw-r--r--include/xmloff/xmlstyle.hxx2
-rw-r--r--include/xmlscript/xmllib_imexp.hxx4
-rw-r--r--unotools/source/config/options.cxx3
-rw-r--r--uui/source/interactionhandler.cxx13
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx18
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.hxx5
-rw-r--r--xmlhelp/source/cxxhelp/provider/db.cxx5
-rw-r--r--xmlhelp/source/cxxhelp/provider/db.hxx20
-rw-r--r--xmlhelp/source/cxxhelp/provider/provider.cxx7
-rw-r--r--xmlhelp/source/cxxhelp/provider/provider.hxx6
-rw-r--r--xmlhelp/source/cxxhelp/provider/resultset.cxx1
-rw-r--r--xmlhelp/source/cxxhelp/provider/resultset.hxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/urlparameter.cxx31
-rw-r--r--xmloff/inc/XMLFootnoteConfigurationImportContext.hxx2
-rw-r--r--xmloff/source/style/XMLFontAutoStylePool.cxx1
-rw-r--r--xmloff/source/style/xmlexppr.cxx11
-rw-r--r--xmloff/source/style/xmlstyle.cxx5
-rw-r--r--xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx5
-rw-r--r--xmlscript/source/xmllib_imexp/xmllib_import.cxx5
21 files changed, 63 insertions, 89 deletions
diff --git a/include/unotools/options.hxx b/include/unotools/options.hxx
index 552eb5106a61..08773f4f53c4 100644
--- a/include/unotools/options.hxx
+++ b/include/unotools/options.hxx
@@ -24,6 +24,7 @@
#include <unotools/unotoolsdllapi.h>
#include <o3tl/typed_flags_set.hxx>
#include <vector>
+#include <memory>
// bits for broadcasting hints of changes in ConfigurationListener::ConfigurationChanged, may be combined
enum class ConfigurationHints {
@@ -66,7 +67,7 @@ namespace utl {
// complete broadcasting implementation
class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster
{
- IMPL_ConfigurationListenerList* mpList;
+ std::unique_ptr<IMPL_ConfigurationListenerList> mpList;
sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0
ConfigurationHints m_nBlockedHint;
diff --git a/include/xmloff/XMLFontAutoStylePool.hxx b/include/xmloff/XMLFontAutoStylePool.hxx
index f508a8923db7..dabb3e5759ff 100644
--- a/include/xmloff/XMLFontAutoStylePool.hxx
+++ b/include/xmloff/XMLFontAutoStylePool.hxx
@@ -26,6 +26,7 @@
#include <tools/fontenum.hxx>
#include <salhelper/simplereferenceobject.hxx>
#include <set>
+#include <memory>
class XMLFontAutoStylePool_Impl;
class SvXMLExport;
@@ -34,7 +35,7 @@ class XMLOFF_DLLPUBLIC XMLFontAutoStylePool : public salhelper::SimpleReferenceO
{
SvXMLExport& rExport;
- XMLFontAutoStylePool_Impl *pPool;
+ std::unique_ptr<XMLFontAutoStylePool_Impl> pPool;
std::set<OUString> m_aNames;
bool tryToEmbedFonts;
diff --git a/include/xmloff/xmlstyle.hxx b/include/xmloff/xmlstyle.hxx
index 975aa0c93142..8841ec3b5cae 100644
--- a/include/xmloff/xmlstyle.hxx
+++ b/include/xmloff/xmlstyle.hxx
@@ -153,7 +153,7 @@ class XMLOFF_DLLPUBLIC SvXMLStylesContext : public SvXMLImportContext
const OUString msTextStyleServiceName;
std::unique_ptr<SvXMLStylesContext_Impl> mpImpl;
- SvXMLTokenMap *mpStyleStylesElemTokenMap;
+ std::unique_ptr<SvXMLTokenMap> mpStyleStylesElemTokenMap;
css::uno::Reference< css::container::XNameContainer > mxParaStyles;
diff --git a/include/xmlscript/xmllib_imexp.hxx b/include/xmlscript/xmllib_imexp.hxx
index 7c13f6a3d6e3..c54324219ecf 100644
--- a/include/xmlscript/xmllib_imexp.hxx
+++ b/include/xmlscript/xmllib_imexp.hxx
@@ -25,6 +25,8 @@
#include <xmlscript/xmlns.h>
#include <xmlscript/xmlscriptdllapi.h>
+#include <memory>
+
namespace xmlscript
{
@@ -46,7 +48,7 @@ struct XMLSCRIPT_DLLPUBLIC LibDescriptor
struct XMLSCRIPT_DLLPUBLIC LibDescriptorArray
{
- LibDescriptor* mpLibs;
+ std::unique_ptr<LibDescriptor[]> mpLibs;
sal_Int32 mnLibCount;
LibDescriptorArray() { mpLibs = nullptr; mnLibCount = 0; }
diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx
index c6e66c502aca..d3f70ec8cb73 100644
--- a/unotools/source/config/options.cxx
+++ b/unotools/source/config/options.cxx
@@ -34,13 +34,12 @@ ConfigurationBroadcaster::ConfigurationBroadcaster()
ConfigurationBroadcaster::~ConfigurationBroadcaster()
{
- delete mpList;
}
void ConfigurationBroadcaster::AddListener( utl::ConfigurationListener* pListener )
{
if ( !mpList )
- mpList = new IMPL_ConfigurationListenerList;
+ mpList.reset(new IMPL_ConfigurationListenerList);
mpList->push_back( pListener );
}
diff --git a/uui/source/interactionhandler.cxx b/uui/source/interactionhandler.cxx
index e85bcd4215b8..7ed463cd844b 100644
--- a/uui/source/interactionhandler.cxx
+++ b/uui/source/interactionhandler.cxx
@@ -39,13 +39,11 @@ class UUIInteractionHandler:
css::task::XInteractionHandler2 >
{
private:
- UUIInteractionHelper * m_pImpl;
+ std::unique_ptr<UUIInteractionHelper> m_pImpl;
public:
explicit UUIInteractionHandler(css::uno::Reference< css::uno::XComponentContext > const & rxContext);
- virtual ~UUIInteractionHandler() override;
-
UUIInteractionHandler(const UUIInteractionHandler&) = delete;
UUIInteractionHandler& operator=(const UUIInteractionHandler&) = delete;
@@ -80,11 +78,6 @@ UUIInteractionHandler::UUIInteractionHandler(
{
}
-UUIInteractionHandler::~UUIInteractionHandler()
-{
- delete m_pImpl;
-}
-
OUString SAL_CALL UUIInteractionHandler::getImplementationName()
throw (uno::RuntimeException, std::exception)
{
@@ -117,7 +110,7 @@ UUIInteractionHandler::initialize(
throw (uno::Exception, std::exception)
{
uno::Reference<uno::XComponentContext> xContext = m_pImpl->getORB();
- delete m_pImpl;
+ m_pImpl.reset();
// The old-style InteractionHandler service supported a sequence of
// PropertyValue, while the new-style service now uses constructors to pass
@@ -140,7 +133,7 @@ UUIInteractionHandler::initialize(
}
}
- m_pImpl = new UUIInteractionHelper(xContext, xWindow, aContext);
+ m_pImpl.reset( new UUIInteractionHelper(xContext, xWindow, aContext) );
}
void SAL_CALL
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index d0c51b27ce54..8ae846f46ae0 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -953,7 +953,7 @@ void Databases::changeCSS(const OUString& newStyleSheet)
}
void Databases::cascadingStylesheet( const OUString& Language,
- char** buffer,
+ std::unique_ptr<char[]>& buffer,
int* byteCount )
{
if( ! m_pCustomCSSDoc )
@@ -1058,16 +1058,16 @@ void Databases::cascadingStylesheet( const OUString& Language,
}
*byteCount = m_nCustomCSSDocLength;
- *buffer = new char[ 1 + *byteCount ];
- (*buffer)[*byteCount] = 0;
- memcpy( *buffer,m_pCustomCSSDoc,m_nCustomCSSDocLength );
+ buffer.reset( new char[ 1 + *byteCount ] );
+ buffer[*byteCount] = 0;
+ memcpy( buffer.get(), m_pCustomCSSDoc, m_nCustomCSSDocLength );
}
void Databases::setActiveText( const OUString& Module,
const OUString& Language,
const OUString& Id,
- char** buffer,
+ std::unique_ptr<char[]>& buffer,
int* byteCount )
{
DataBaseIterator aDbIt( m_xContext, *this, Module, Language, true );
@@ -1112,14 +1112,14 @@ void Databases::setActiveText( const OUString& Module,
}
*byteCount = nSize;
- *buffer = new char[ 1 + nSize ];
- (*buffer)[nSize] = 0;
- memcpy( *buffer, pData, nSize );
+ buffer.reset( new char[ 1 + nSize ] );
+ buffer[nSize] = 0;
+ memcpy( buffer.get(), pData, nSize );
}
else
{
*byteCount = 0;
- *buffer = new char[1]; // Initialize with 1 to avoid compiler warnings
+ buffer.reset( new char[1] ); // Initialize with 1 to avoid compiler warnings
if( !bFoundAsEmpty )
m_aEmptyActiveTextSet.insert( id );
}
diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx b/xmlhelp/source/cxxhelp/provider/databases.hxx
index f725e74765d0..0e92ecd8393b 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.hxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.hxx
@@ -22,6 +22,7 @@
#include <sal/config.h>
+#include <memory>
#include <set>
#include <unordered_map>
#include <unordered_set>
@@ -179,7 +180,7 @@ namespace chelp {
*/
void cascadingStylesheet( const OUString& Language,
- char** buffer,
+ std::unique_ptr<char[]>& buffer,
int* byteCount );
/**
@@ -195,7 +196,7 @@ namespace chelp {
void setActiveText( const OUString& Module,
const OUString& Language,
const OUString& Id,
- char** buffer,
+ std::unique_ptr<char[]>& buffer,
int* byteCount );
/**
diff --git a/xmlhelp/source/cxxhelp/provider/db.cxx b/xmlhelp/source/cxxhelp/provider/db.cxx
index c978b6e432b8..5d509f0e6d13 100644
--- a/xmlhelp/source/cxxhelp/provider/db.cxx
+++ b/xmlhelp/source/cxxhelp/provider/db.cxx
@@ -33,9 +33,8 @@ namespace helpdatafileproxy {
void HDFData::copyToBuffer( const char* pSrcData, int nSize )
{
m_nSize = nSize;
- delete [] m_pBuffer;
- m_pBuffer = new char[m_nSize+1];
- memcpy( m_pBuffer, pSrcData, m_nSize );
+ m_pBuffer.reset( new char[m_nSize+1] );
+ memcpy( m_pBuffer.get(), pSrcData, m_nSize );
m_pBuffer[m_nSize] = 0;
}
diff --git a/xmlhelp/source/cxxhelp/provider/db.hxx b/xmlhelp/source/cxxhelp/provider/db.hxx
index f21407993016..9343280b5299 100644
--- a/xmlhelp/source/cxxhelp/provider/db.hxx
+++ b/xmlhelp/source/cxxhelp/provider/db.hxx
@@ -23,6 +23,7 @@
#include <comphelper/fileurl.hxx>
#include <osl/diagnose.h>
#include <rtl/string.hxx>
+#include <memory>
#include <unordered_map>
namespace helpdatafileproxy {
@@ -31,23 +32,18 @@ namespace helpdatafileproxy {
{
friend class Hdf;
- int m_nSize;
- char* m_pBuffer;
+ int m_nSize;
+ std::unique_ptr<char[]> m_pBuffer;
void copyToBuffer( const char* pSrcData, int nSize );
public:
- HDFData()
- : m_nSize( 0 )
- , m_pBuffer( nullptr )
- {}
- ~HDFData()
- { delete [] m_pBuffer; }
-
- int getSize() const
+ HDFData() : m_nSize( 0 ) {}
+
+ int getSize() const
{ return m_nSize; }
- const char* getData() const
- { return m_pBuffer; }
+ const char* getData() const
+ { return m_pBuffer.get(); }
};
typedef std::unordered_map< OString,std::pair<int,int>,OStringHash > StringToValPosMap;
diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx
index 56a14e48226e..de116e5f41b6 100644
--- a/xmlhelp/source/cxxhelp/provider/provider.cxx
+++ b/xmlhelp/source/cxxhelp/provider/provider.cxx
@@ -54,7 +54,6 @@ ContentProvider::ContentProvider( const uno::Reference< uno::XComponentContext >
// virtual
ContentProvider::~ContentProvider()
{
- delete m_pDatabases;
}
// XInterface methods.
@@ -206,7 +205,7 @@ ContentProvider::queryContent(
if ( xContent.is() )
return xContent;
- xContent = new Content( m_xContext, this, xCanonicId, m_pDatabases );
+ xContent = new Content( m_xContext, this, xCanonicId, m_pDatabases.get() );
// register new content
registerNewContent( xContent );
@@ -283,12 +282,12 @@ void ContentProvider::init()
bool showBasic = officecfg::Office::Common::Help::ShowBasic::get(
m_xContext);
- m_pDatabases = new Databases( showBasic,
+ m_pDatabases.reset( new Databases( showBasic,
instPath,
utl::ConfigManager::getProductName(),
productversion,
stylesheet,
- m_xContext );
+ m_xContext ) );
}
void ContentProvider::subst( OUString& instpath )
diff --git a/xmlhelp/source/cxxhelp/provider/provider.hxx b/xmlhelp/source/cxxhelp/provider/provider.hxx
index febcc464345a..530f7ab349a9 100644
--- a/xmlhelp/source/cxxhelp/provider/provider.hxx
+++ b/xmlhelp/source/cxxhelp/provider/provider.hxx
@@ -144,9 +144,9 @@ namespace chelp {
// Non-interface methods.
private:
- bool isInitialized;
- OUString m_aScheme;
- Databases* m_pDatabases;
+ bool isInitialized;
+ OUString m_aScheme;
+ std::unique_ptr<Databases> m_pDatabases;
css::uno::Reference<css::container::XContainer> m_xContainer;
// private methods
diff --git a/xmlhelp/source/cxxhelp/provider/resultset.cxx b/xmlhelp/source/cxxhelp/provider/resultset.cxx
index 67ad5df99739..c6983ebcf954 100644
--- a/xmlhelp/source/cxxhelp/provider/resultset.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultset.cxx
@@ -42,7 +42,6 @@ DynamicResultSet::DynamicResultSet(
DynamicResultSet::~DynamicResultSet()
{
- delete m_pFactory;
}
// Non-interface methods.
diff --git a/xmlhelp/source/cxxhelp/provider/resultset.hxx b/xmlhelp/source/cxxhelp/provider/resultset.hxx
index f8836985d4bd..943385976e54 100644
--- a/xmlhelp/source/cxxhelp/provider/resultset.hxx
+++ b/xmlhelp/source/cxxhelp/provider/resultset.hxx
@@ -31,7 +31,7 @@ namespace chelp {
class DynamicResultSet : public ::ucbhelper::ResultSetImplHelper
{
- ResultSetFactory* m_pFactory;
+ std::unique_ptr<ResultSetFactory> m_pFactory;
private:
virtual void initStatic() override;
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index 8d9cd65c06b0..4a6f13d2c6f4 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -47,6 +47,8 @@
#include "urlparameter.hxx"
#include "databases.hxx"
+#include <memory>
+
using namespace cppu;
using namespace com::sun::star::io;
using namespace com::sun::star::uno;
@@ -303,8 +305,6 @@ public:
Databases* pDatatabases,
bool isRoot );
- virtual ~InputStreamTransformer() override;
-
virtual Any SAL_CALL queryInterface( const Type& rType ) throw( RuntimeException, std::exception ) override;
virtual void SAL_CALL acquire() throw() override;
virtual void SAL_CALL release() throw() override;
@@ -344,7 +344,7 @@ public:
void addToBuffer( const char* buffer,int len );
- sal_Int8 const * getData() const { return reinterpret_cast<sal_Int8 const *>(buffer); }
+ sal_Int8 const * getData() const { return reinterpret_cast<sal_Int8 const *>(buffer.get()); }
sal_Int32 getLen() const { return sal_Int32( len ); }
@@ -353,7 +353,7 @@ private:
osl::Mutex m_aMutex;
int len,pos;
- char *buffer;
+ std::unique_ptr<char[]> buffer;
};
@@ -739,18 +739,18 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
{
if( isRoot )
{
- delete[] buffer;
+ buffer.reset();
pDatabases->cascadingStylesheet( urlParam->get_language(),
- &buffer,
+ buffer,
&len );
}
else if( urlParam->isActive() )
{
- delete[] buffer;
+ buffer.reset();
pDatabases->setActiveText( urlParam->get_module(),
urlParam->get_language(),
urlParam->get_id(),
- &buffer,
+ buffer,
&len );
}
else
@@ -909,12 +909,6 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
}
-InputStreamTransformer::~InputStreamTransformer()
-{
- delete[] buffer;
-}
-
-
Any SAL_CALL InputStreamTransformer::queryInterface( const Type& rType ) throw( RuntimeException, std::exception )
{
Any aRet = ::cppu::queryInterface( rType,
@@ -1032,11 +1026,10 @@ void InputStreamTransformer::addToBuffer( const char* buffer_,int len_ )
{
osl::MutexGuard aGuard( m_aMutex );
- char* tmp = buffer;
- buffer = new char[ len+len_ ];
- memcpy( static_cast<void*>(buffer),static_cast<void*>(tmp),sal_uInt32( len ) );
- memcpy( static_cast<void*>(buffer+len),static_cast<void const *>(buffer_),sal_uInt32( len_ ) );
- delete[] tmp;
+ std::unique_ptr<char[]> tmp(buffer.release());
+ buffer.reset( new char[ len+len_ ] );
+ memcpy( static_cast<void*>(buffer.get()),static_cast<void*>(tmp.get()),sal_uInt32( len ) );
+ memcpy( static_cast<void*>(buffer.get()+len),static_cast<void const *>(buffer_),sal_uInt32( len_ ) );
len += len_;
}
diff --git a/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx b/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx
index 4ea1da3db1ae..fc9c894456c9 100644
--- a/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx
+++ b/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx
@@ -56,7 +56,7 @@ class XMLFootnoteConfigurationImportContext : public SvXMLStyleContext
OUString sBeginNotice;
OUString sEndNotice;
- SvXMLTokenMap* pAttrTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pAttrTokenMap;
sal_Int16 nOffset;
sal_Int16 nNumbering;
diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx b/xmloff/source/style/XMLFontAutoStylePool.cxx
index 6b4b5a4d59e5..05fa61cc6e8e 100644
--- a/xmloff/source/style/XMLFontAutoStylePool.cxx
+++ b/xmloff/source/style/XMLFontAutoStylePool.cxx
@@ -143,7 +143,6 @@ XMLFontAutoStylePool::XMLFontAutoStylePool( SvXMLExport& rExp, bool _tryToEmbedF
XMLFontAutoStylePool::~XMLFontAutoStylePool()
{
- delete pPool;
}
OUString XMLFontAutoStylePool::Add(
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index 804f788f3720..549e86312dcd 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -180,7 +180,7 @@ class FilterPropertiesInfo_Impl
FilterPropertyInfoList_Impl aPropInfos;
FilterPropertyInfoList_Impl::iterator aLastItr;
- Sequence <OUString> *pApiNames;
+ std::unique_ptr<Sequence<OUString>> pApiNames;
public:
FilterPropertiesInfo_Impl();
@@ -206,7 +206,6 @@ FilterPropertiesInfo_Impl::FilterPropertiesInfo_Impl() :
FilterPropertiesInfo_Impl::~FilterPropertiesInfo_Impl()
{
- delete pApiNames;
}
void FilterPropertiesInfo_Impl::AddProperty(
@@ -216,11 +215,7 @@ void FilterPropertiesInfo_Impl::AddProperty(
nCount++;
OSL_ENSURE( !pApiNames, "performance warning: API names already retrieved" );
- if( pApiNames )
- {
- delete pApiNames;
- pApiNames = nullptr;
- }
+ pApiNames.reset();
}
const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames()
@@ -265,7 +260,7 @@ const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames()
}
// construct sequence
- pApiNames = new Sequence < OUString >( nCount );
+ pApiNames.reset( new Sequence < OUString >( nCount ) );
OUString *pNames = pApiNames->getArray();
FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
FilterPropertyInfoList_Impl::iterator aEnd = aPropInfos.end();
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index a08bcc7fc3f5..398832de1dc2 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -87,8 +87,8 @@ static SvXMLTokenMapEntry aStyleStylesElemTokenMap[] =
const SvXMLTokenMap& SvXMLStylesContext::GetStyleStylesElemTokenMap()
{
if( !mpStyleStylesElemTokenMap )
- mpStyleStylesElemTokenMap =
- new SvXMLTokenMap( aStyleStylesElemTokenMap );
+ mpStyleStylesElemTokenMap.reset(
+ new SvXMLTokenMap( aStyleStylesElemTokenMap ) );
return *mpStyleStylesElemTokenMap;
}
@@ -754,7 +754,6 @@ SvXMLStylesContext::SvXMLStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
SvXMLStylesContext::~SvXMLStylesContext()
{
- delete mpStyleStylesElemTokenMap;
}
SvXMLImportContext *SvXMLStylesContext::CreateChildContext( sal_uInt16 nPrefix,
diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
index 786c5686309a..55f76951023f 100644
--- a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
@@ -159,7 +159,6 @@ XMLFootnoteConfigurationImportContext::XMLFootnoteConfigurationImportContext(
}
XMLFootnoteConfigurationImportContext::~XMLFootnoteConfigurationImportContext()
{
- delete pAttrTokenMap;
}
enum XMLFtnConfigToken
@@ -201,9 +200,9 @@ static const SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
const SvXMLTokenMap&
XMLFootnoteConfigurationImportContext::GetFtnConfigAttrTokenMap()
{
- if (nullptr == pAttrTokenMap)
+ if (!pAttrTokenMap)
{
- pAttrTokenMap = new SvXMLTokenMap(aTextFieldAttrTokenMap);
+ pAttrTokenMap.reset( new SvXMLTokenMap(aTextFieldAttrTokenMap) );
}
return *pAttrTokenMap;
diff --git a/xmlscript/source/xmllib_imexp/xmllib_import.cxx b/xmlscript/source/xmllib_imexp/xmllib_import.cxx
index 4dfe36501aef..2bf8b167edb6 100644
--- a/xmlscript/source/xmllib_imexp/xmllib_import.cxx
+++ b/xmlscript/source/xmllib_imexp/xmllib_import.cxx
@@ -198,7 +198,7 @@ void LibrariesElement::endElement()
throw (xml::sax::SAXException, RuntimeException, std::exception)
{
sal_Int32 nLibCount = mxImport->mpLibArray->mnLibCount = (sal_Int32)mLibDescriptors.size();
- mxImport->mpLibArray->mpLibs = new LibDescriptor[ nLibCount ];
+ mxImport->mpLibArray->mpLibs.reset( new LibDescriptor[ nLibCount ] );
for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
{
@@ -264,12 +264,11 @@ SAL_CALL importLibrary( LibDescriptor& rLib )
LibDescriptorArray::LibDescriptorArray( sal_Int32 nLibCount )
{
mnLibCount = nLibCount;
- mpLibs = new LibDescriptor[ mnLibCount ];
+ mpLibs.reset( new LibDescriptor[ mnLibCount ] );
}
LibDescriptorArray::~LibDescriptorArray()
{
- delete[] mpLibs;
}
}