summaryrefslogtreecommitdiff
path: root/i18npool/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-16 14:15:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-17 08:34:42 +0000
commit7a60e90ef05c84923f83882efc01c33fef1ed305 (patch)
tree4c49f1ab14fda2a79e0d8efdb731d4d6fe924eba /i18npool/source
parenta9367c1b39600d5a5e2d0067113f06ad59cc37a1 (diff)
new loplugin: useuniqueptr: helpcompiler..io
Change-Id: I6b394163c144e6b5540cb160abb613d56fe327de Reviewed-on: https://gerrit.libreoffice.org/33165 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source')
-rw-r--r--i18npool/source/calendar/calendar_gregorian.cxx3
-rw-r--r--i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx3
-rw-r--r--i18npool/source/indexentry/indexentrysupplier_common.cxx3
-rw-r--r--i18npool/source/indexentry/indexentrysupplier_default.cxx6
-rw-r--r--i18npool/source/localedata/localedata.cxx10
-rw-r--r--i18npool/source/search/levdis.hxx12
6 files changed, 13 insertions, 24 deletions
diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx
index c7ff413d297a..e70666ea5483 100644
--- a/i18npool/source/calendar/calendar_gregorian.cxx
+++ b/i18npool/source/calendar/calendar_gregorian.cxx
@@ -168,14 +168,13 @@ Calendar_gregorian::init(const Era *_eraArray)
icu::Locale aIcuLocale( "", nullptr, nullptr, "calendar=gregorian");
UErrorCode status;
- body = icu::Calendar::createInstance( aIcuLocale, status = U_ZERO_ERROR);
+ body.reset( icu::Calendar::createInstance( aIcuLocale, status = U_ZERO_ERROR) );
if (!body || !U_SUCCESS(status)) throw ERROR;
eraArray=_eraArray;
}
Calendar_gregorian::~Calendar_gregorian()
{
- delete body;
}
Calendar_hanja::Calendar_hanja()
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 09906519fd89..f44e408bfebe 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -273,7 +273,6 @@ DefaultNumberingProvider::DefaultNumberingProvider( const Reference < XComponent
DefaultNumberingProvider::~DefaultNumberingProvider()
{
- delete translit;
}
Sequence< Reference<container::XIndexAccess> >
@@ -647,7 +646,7 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal
OUString transliteration;
getPropertyByName(aProperties, "Transliteration", true) >>= transliteration;
if ( !translit )
- translit = new TransliterationImpl(m_xContext);
+ translit.reset( new TransliterationImpl(m_xContext) );
translit->loadModuleByImplName(transliteration, aLocale);
result += translit->transliterateString2String(tmp, 0, tmp.getLength());
} catch (Exception& ) {
diff --git a/i18npool/source/indexentry/indexentrysupplier_common.cxx b/i18npool/source/indexentry/indexentrysupplier_common.cxx
index fafb3046d5b2..ee5d0d1b08c8 100644
--- a/i18npool/source/indexentry/indexentrysupplier_common.cxx
+++ b/i18npool/source/indexentry/indexentrysupplier_common.cxx
@@ -30,13 +30,12 @@ namespace com { namespace sun { namespace star { namespace i18n {
IndexEntrySupplier_Common::IndexEntrySupplier_Common(const Reference < uno::XComponentContext >& rxContext)
{
implementationName = "com.sun.star.i18n.IndexEntrySupplier_Common";
- collator = new CollatorImpl(rxContext);
+ collator.reset( new CollatorImpl(rxContext) );
usePhonetic = false;
}
IndexEntrySupplier_Common::~IndexEntrySupplier_Common()
{
- delete collator;
}
Sequence < lang::Locale > SAL_CALL IndexEntrySupplier_Common::getLocaleList() throw (RuntimeException, std::exception)
diff --git a/i18npool/source/indexentry/indexentrysupplier_default.cxx b/i18npool/source/indexentry/indexentrysupplier_default.cxx
index 2c902cf002b7..8762e9e6c65d 100644
--- a/i18npool/source/indexentry/indexentrysupplier_default.cxx
+++ b/i18npool/source/indexentry/indexentrysupplier_default.cxx
@@ -32,12 +32,11 @@ IndexEntrySupplier_Unicode::IndexEntrySupplier_Unicode(
IndexEntrySupplier_Common(rxContext)
{
implementationName = "com.sun.star.i18n.IndexEntrySupplier_Unicode";
- index = new Index(rxContext);
+ index.reset( new Index(rxContext) );
}
IndexEntrySupplier_Unicode::~IndexEntrySupplier_Unicode()
{
- delete index;
}
sal_Bool SAL_CALL IndexEntrySupplier_Unicode::loadAlgorithm( const lang::Locale& rLocale,
@@ -111,13 +110,12 @@ Index::Index(const css::uno::Reference < css::uno::XComponentContext >& rxContex
: table_count(0)
, key_count(0)
, mkey_count(0)
+ , collator( new CollatorImpl(rxContext) )
{
- collator = new CollatorImpl(rxContext);
}
Index::~Index()
{
- delete collator;
}
sal_Int16 Index::compare(sal_Unicode c1, sal_Unicode c2)
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index 3a0c0ee2eeeb..f3499f9de386 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -1323,11 +1323,10 @@ class OutlineNumbering : public cppu::WeakImplHelper < container::XIndexAccess >
{
// OutlineNumbering helper class
- const OutlineNumberingLevel_Impl* m_pOutlineLevels;
+ std::unique_ptr<const OutlineNumberingLevel_Impl[]> m_pOutlineLevels;
sal_Int16 m_nCount;
public:
OutlineNumbering(const OutlineNumberingLevel_Impl* pOutlineLevels, int nLevels);
- virtual ~OutlineNumbering() override;
//XIndexAccess
virtual sal_Int32 SAL_CALL getCount( ) throw(RuntimeException, std::exception) override;
@@ -1498,11 +1497,6 @@ OutlineNumbering::OutlineNumbering(const OutlineNumberingLevel_Impl* pOutlnLevel
{
}
-OutlineNumbering::~OutlineNumbering()
-{
- delete [] m_pOutlineLevels;
-}
-
sal_Int32 OutlineNumbering::getCount( ) throw(RuntimeException, std::exception)
{
return m_nCount;
@@ -1513,7 +1507,7 @@ Any OutlineNumbering::getByIndex( sal_Int32 nIndex )
{
if(nIndex < 0 || nIndex >= m_nCount)
throw IndexOutOfBoundsException();
- const OutlineNumberingLevel_Impl* pTemp = m_pOutlineLevels;
+ const OutlineNumberingLevel_Impl* pTemp = m_pOutlineLevels.get();
pTemp += nIndex;
Any aRet;
diff --git a/i18npool/source/search/levdis.hxx b/i18npool/source/search/levdis.hxx
index cd12628686ca..4d834bdb685c 100644
--- a/i18npool/source/search/levdis.hxx
+++ b/i18npool/source/search/levdis.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_I18NPOOL_SOURCE_SEARCH_LEVDIS_HXX
#include <rtl/ustring.hxx>
+#include <memory>
// Sensible default values for a user interface could be:
// LEVDISDEFAULT_XOTHER 2
@@ -115,19 +116,18 @@ public:
class WLevDisDistanceMem
{
- int* p;
+ std::unique_ptr<int[]> p;
public:
explicit WLevDisDistanceMem( size_t s )
- : p(nullptr)
{
NewMem(s);
}
- ~WLevDisDistanceMem() { delete [] p; }
- int* GetPtr() const { return p; }
+ ~WLevDisDistanceMem() {}
+ int* GetPtr() const { return p.get(); }
int* NewMem( size_t s )
{
- delete [] p;
- return (p = new int[ s<3 ? 3 : s ]);
+ p.reset(new int[ s<3 ? 3 : s ]);
+ return p.get();
}
};