[Libreoffice-commits] core.git: i18npool/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 20 18:54:56 UTC 2020


 i18npool/source/breakiterator/breakiterator_unicode.cxx |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 65aeb5a630b5a9996ca3fdd2ab9750548dc7cc23
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Apr 20 14:41:47 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Apr 20 20:54:18 2020 +0200

    fix regression
    
    from
        commit c5424e19338a3edaec3f0459c8ac5d53ca92d9fe
        loplugin:useuniqueptr in i18npool
    which would have resulted in the block at line 245 inside
      #if (U_ICU_VERSION_MAJOR_NUM < 58)
    never doing anything
    
    spotted while doing improvements to my make_shared plugin
    
    Change-Id: I79c664c7e4a051f3c764cb49d99870b51b19ce55
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92567
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx
index b756fbbdbee2..2d2ac437b430 100644
--- a/i18npool/source/breakiterator/breakiterator_unicode.cxx
+++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx
@@ -152,7 +152,7 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal
             udata_setAppData("OpenOffice", OpenOffice_dat, &status);
             if ( !U_SUCCESS(status) ) throw uno::RuntimeException();
 
-            std::unique_ptr<OOoRuleBasedBreakIterator> rbi;
+            std::shared_ptr<OOoRuleBasedBreakIterator> rbi;
 
             if (breakRules.getLength() > breakType && !breakRules[breakType].isEmpty())
             {
@@ -168,13 +168,13 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal
                     break;  // do
                 }
 
-                rbi.reset(new OOoRuleBasedBreakIterator(udata_open("OpenOffice", "brk",
-                    OUStringToOString(breakRules[breakType], RTL_TEXTENCODING_ASCII_US).getStr(), &status), status));
+                rbi = std::make_shared<OOoRuleBasedBreakIterator>(udata_open("OpenOffice", "brk",
+                    OUStringToOString(breakRules[breakType], RTL_TEXTENCODING_ASCII_US).getStr(), &status), status);
 
                 if (U_SUCCESS(status))
                 {
                     icuBI->mpValue = std::make_shared<BI_ValueData>();
-                    icuBI->mpValue->mpBreakIterator = std::move( rbi);
+                    icuBI->mpValue->mpBreakIterator = rbi;
                     theBIMap.insert( std::make_pair( aBIMapRuleTypeKey, icuBI->mpValue));
                 }
                 else
@@ -202,11 +202,11 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal
                 OString aUDName = rtl::OStringView(rule) + "_" + aLanguage;
                 UDataMemory* pUData = udata_open("OpenOffice", "brk", aUDName.getStr(), &status);
                 if( U_SUCCESS(status) )
-                    rbi.reset(new OOoRuleBasedBreakIterator( pUData, status));
+                    rbi = std::make_shared<OOoRuleBasedBreakIterator>( pUData, status);
                 if ( U_SUCCESS(status) )
                 {
                     icuBI->mpValue = std::make_shared<BI_ValueData>();
-                    icuBI->mpValue->mpBreakIterator = std::move( rbi);
+                    icuBI->mpValue->mpBreakIterator = rbi;
                     theBIMap.insert( std::make_pair( aBIMapRuleKey, icuBI->mpValue));
                 }
                 else
@@ -228,11 +228,11 @@ 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.reset(new OOoRuleBasedBreakIterator( pUData, status));
+                        rbi = std::make_shared<OOoRuleBasedBreakIterator>( pUData, status);
                     if ( U_SUCCESS(status) )
                     {
                         icuBI->mpValue = std::make_shared<BI_ValueData>();
-                        icuBI->mpValue->mpBreakIterator = std::move( rbi);
+                        icuBI->mpValue->mpBreakIterator = rbi;
                         theBIMap.insert( std::make_pair( aBIMapRuleOnlyKey, icuBI->mpValue));
                     }
                     else


More information about the Libreoffice-commits mailing list