summaryrefslogtreecommitdiff
path: root/i18npool/source/breakiterator/breakiterator_unicode.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-12-12 13:35:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-12-13 07:24:48 +0100
commitc5424e19338a3edaec3f0459c8ac5d53ca92d9fe (patch)
tree8a0a1c3b5d80cd21474fcf45ab745cee03093a5d /i18npool/source/breakiterator/breakiterator_unicode.cxx
parentc908f61d722624e40f3c6985243c6cb37dabafe0 (diff)
loplugin:useuniqueptr in i18npool
Change-Id: I57c6ce2a8c48bc87404e596b8843efd67ea0872d Reviewed-on: https://gerrit.libreoffice.org/65033 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source/breakiterator/breakiterator_unicode.cxx')
-rw-r--r--i18npool/source/breakiterator/breakiterator_unicode.cxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx
index 63178f3a05da..1a6818bdae30 100644
--- a/i18npool/source/breakiterator/breakiterator_unicode.cxx
+++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx
@@ -145,7 +145,7 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal
udata_setAppData("OpenOffice", OpenOffice_dat, &status);
if ( !U_SUCCESS(status) ) throw uno::RuntimeException();
- OOoRuleBasedBreakIterator *rbi = nullptr;
+ std::unique_ptr<OOoRuleBasedBreakIterator> rbi;
if (breakRules.getLength() > breakType && !breakRules[breakType].isEmpty())
{
@@ -161,19 +161,18 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal
break; // do
}
- rbi = new OOoRuleBasedBreakIterator(udata_open("OpenOffice", "brk",
- OUStringToOString(breakRules[breakType], RTL_TEXTENCODING_ASCII_US).getStr(), &status), status);
+ rbi.reset(new OOoRuleBasedBreakIterator(udata_open("OpenOffice", "brk",
+ OUStringToOString(breakRules[breakType], RTL_TEXTENCODING_ASCII_US).getStr(), &status), status));
if (U_SUCCESS(status))
{
icuBI->mpValue.reset( new BI_ValueData);
- icuBI->mpValue->mpBreakIterator.reset( rbi);
+ icuBI->mpValue->mpBreakIterator = std::move( rbi);
theBIMap.insert( std::make_pair( aBIMapRuleTypeKey, icuBI->mpValue));
}
else
{
- delete rbi;
- rbi = nullptr;
+ rbi.reset();
}
}
//use icu's breakiterator for Thai, Tibetan and Dzongkha
@@ -199,17 +198,16 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal
aUDName.append( aLanguage);
UDataMemory* pUData = udata_open("OpenOffice", "brk", aUDName.getStr(), &status);
if( U_SUCCESS(status) )
- rbi = new OOoRuleBasedBreakIterator( pUData, status);
+ rbi.reset(new OOoRuleBasedBreakIterator( pUData, status));
if ( U_SUCCESS(status) )
{
icuBI->mpValue.reset( new BI_ValueData);
- icuBI->mpValue->mpBreakIterator.reset( rbi);
+ icuBI->mpValue->mpBreakIterator = std::move( rbi);
theBIMap.insert( std::make_pair( aBIMapRuleKey, icuBI->mpValue));
}
else
{
- delete rbi;
- rbi = nullptr;
+ rbi.reset();
// ;rule (only)
const OString aBIMapRuleOnlyKey( OString(";") + rule);
@@ -226,17 +224,16 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal
status = U_ZERO_ERROR;
pUData = udata_open("OpenOffice", "brk", rule, &status);
if( U_SUCCESS(status) )
- rbi = new OOoRuleBasedBreakIterator( pUData, status);
+ rbi.reset(new OOoRuleBasedBreakIterator( pUData, status));
if ( U_SUCCESS(status) )
{
icuBI->mpValue.reset( new BI_ValueData);
- icuBI->mpValue->mpBreakIterator.reset( rbi);
+ icuBI->mpValue->mpBreakIterator = std::move( rbi);
theBIMap.insert( std::make_pair( aBIMapRuleOnlyKey, icuBI->mpValue));
}
else
{
- delete rbi;
- rbi = nullptr;
+ rbi.reset();
}
}
}