Ticket #10581: libreoffice-icu.patch

File libreoffice-icu.patch, 14.0 KB (added by Pierre Labastie, 3 years ago)
  • i18npool/inc/collator_unicode.hxx

    diff --git a/i18npool/inc/collator_unicode.hxx b/i18npool/inc/collator_unicode.hxx
    index 69d317797870..d943bc9bc2c1 100644
    a b public:  
    6363
    6464private:
    6565    const sal_Char *implementationName;
    66     RuleBasedCollator *uca_base, *collator;
     66    icu::RuleBasedCollator *uca_base, *collator;
    6767#ifndef DISABLE_DYNLOADING
    6868    oslModule hModule;
    6969#endif
  • i18npool/source/breakiterator/breakiterator_unicode.cxx

    diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx
    index a81a80e153ba..02da856a5b99 100644
    a b BreakIterator_Unicode::~BreakIterator_Unicode()  
    5656}
    5757
    5858/*
    59     Wrapper class to provide public access to the RuleBasedBreakIterator's
     59    Wrapper class to provide public access to the icu::RuleBasedBreakIterator's
    6060    setbreakType method.
    6161*/
    62 class OOoRuleBasedBreakIterator : public RuleBasedBreakIterator
     62class OOoRuleBasedBreakIterator : public icu::RuleBasedBreakIterator
    6363{
    6464    public:
    6565#if (U_ICU_VERSION_MAJOR_NUM < 58)
    66     // RuleBasedBreakIterator::setBreakType() is private as of ICU 58.
     66    // icu::RuleBasedBreakIterator::setBreakType() is private as of ICU 58.
    6767    void publicSetBreakType(int32_t type)
    6868        {
    6969            setBreakType(type);
    class OOoRuleBasedBreakIterator : public RuleBasedBreakIterator  
    7171#endif
    7272    OOoRuleBasedBreakIterator(UDataMemory* image,
    7373                              UErrorCode &status)
    74         : RuleBasedBreakIterator(image, status)
     74        : icu::RuleBasedBreakIterator(image, status)
    7575        { };
    7676
    7777};
    sal_Int32 SAL_CALL BreakIterator_Unicode::nextCharacters( const OUString& Text,  
    334334        icu::BreakIterator* pBI = character.mpValue->mpBreakIterator.get();
    335335        for (nDone = 0; nDone < nCount; nDone++) {
    336336            nStartPos = pBI->following(nStartPos);
    337             if (nStartPos == BreakIterator::DONE)
     337            if (nStartPos == icu::BreakIterator::DONE)
    338338                return Text.getLength();
    339339        }
    340340    } else { // for CHARACTER mode
    sal_Int32 SAL_CALL BreakIterator_Unicode::previousCharacters( const OUString& Te  
    353353        icu::BreakIterator* pBI = character.mpValue->mpBreakIterator.get();
    354354        for (nDone = 0; nDone < nCount; nDone++) {
    355355            nStartPos = pBI->preceding(nStartPos);
    356             if (nStartPos == BreakIterator::DONE)
     356            if (nStartPos == icu::BreakIterator::DONE)
    357357                return 0;
    358358        }
    359359    } else { // for BS to delete one char and CHARACTER mode.
    Boundary SAL_CALL BreakIterator_Unicode::nextWord( const OUString& Text, sal_Int  
    371371
    372372    Boundary rv;
    373373    rv.startPos = icuBI->mpValue->mpBreakIterator->following(nStartPos);
    374     if( rv.startPos >= Text.getLength() || rv.startPos == BreakIterator::DONE )
     374    if( rv.startPos >= Text.getLength() || rv.startPos == icu::BreakIterator::DONE )
    375375        rv.endPos = result.startPos;
    376376    else {
    377377        if ( (rWordType == WordType::ANYWORD_IGNOREWHITESPACES ||
    Boundary SAL_CALL BreakIterator_Unicode::nextWord( const OUString& Text, sal_Int  
    380380            rv.startPos = icuBI->mpValue->mpBreakIterator->following(rv.startPos);
    381381
    382382        rv.endPos = icuBI->mpValue->mpBreakIterator->following(rv.startPos);
    383         if(rv.endPos == BreakIterator::DONE)
     383        if(rv.endPos == icu::BreakIterator::DONE)
    384384            rv.endPos = rv.startPos;
    385385    }
    386386    return rv;
    Boundary SAL_CALL BreakIterator_Unicode::previousWord(const OUString& Text, sal_  
    394394
    395395    Boundary rv;
    396396    rv.startPos = icuBI->mpValue->mpBreakIterator->preceding(nStartPos);
    397     if( rv.startPos < 0 || rv.startPos == BreakIterator::DONE)
     397    if( rv.startPos < 0 || rv.startPos == icu::BreakIterator::DONE)
    398398        rv.endPos = rv.startPos;
    399399    else {
    400400        if ( (rWordType == WordType::ANYWORD_IGNOREWHITESPACES ||
    Boundary SAL_CALL BreakIterator_Unicode::previousWord(const OUString& Text, sal_  
    403403            rv.startPos = icuBI->mpValue->mpBreakIterator->preceding(rv.startPos);
    404404
    405405        rv.endPos = icuBI->mpValue->mpBreakIterator->following(rv.startPos);
    406         if(rv.endPos == BreakIterator::DONE)
     406        if(rv.endPos == icu::BreakIterator::DONE)
    407407            rv.endPos = rv.startPos;
    408408    }
    409409    return rv;
    Boundary SAL_CALL BreakIterator_Unicode::getWordBoundary( const OUString& Text,  
    435435            rv.endPos = icuBI->mpValue->mpBreakIterator->following(nPos);
    436436        }
    437437    }
    438     if (rv.startPos == BreakIterator::DONE)
     438    if (rv.startPos == icu::BreakIterator::DONE)
    439439        rv.startPos = rv.endPos;
    440     else if (rv.endPos == BreakIterator::DONE)
     440    else if (rv.endPos == icu::BreakIterator::DONE)
    441441        rv.endPos = rv.startPos;
    442442
    443443    return rv;
    LineBreakResults SAL_CALL BreakIterator_Unicode::getLineBreak(  
    502502            lbr.breakIndex = nStartPos;
    503503            lbr.breakType = BreakType::WORDBOUNDARY;
    504504        } else if (hOptions.rHyphenator.is()) { //Hyphenation break
    505             sal_Int32 boundary_with_punctuation = (pLineBI->next() != BreakIterator::DONE) ? pLineBI->current() : 0;
     505            sal_Int32 boundary_with_punctuation = (pLineBI->next() != icu::BreakIterator::DONE) ? pLineBI->current() : 0;
    506506            pLineBI->preceding(nStartPos + 1); // reset to check correct hyphenation of "word-word"
    507507
    508508            sal_Int32 nStartPosWordEnd = nStartPos;
  • i18npool/source/collator/collator_unicode.cxx

    diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx
    index 71bc4ed84d1e..37dc7eec6ea6 100644
    a b Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::  
    138138        UErrorCode status = U_ZERO_ERROR;
    139139        OUString rule = LocaleDataImpl::get()->getCollatorRuleByAlgorithm(rLocale, rAlgorithm);
    140140        if (!rule.isEmpty()) {
    141             collator = new RuleBasedCollator(reinterpret_cast<const UChar *>(rule.getStr()), status);
     141            collator = new icu::RuleBasedCollator(reinterpret_cast<const UChar *>(rule.getStr()), status);
    142142            if (! U_SUCCESS(status)) throw RuntimeException();
    143143        }
    144144        if (!collator && OUString(LOCAL_RULE_LANGS).indexOf(rLocale.Language) >= 0) {
    Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::  
    343343                size_t ruleImageSize = funclen();
    344344
    345345#if (U_ICU_VERSION_MAJOR_NUM == 4) && (U_ICU_VERSION_MINOR_NUM <= 2)
    346                 uca_base = new RuleBasedCollator(static_cast<UChar*>(NULL), status);
     346                uca_base = new icu::RuleBasedCollator(static_cast<UChar*>(NULL), status);
    347347#else
    348348                // Not only changed ICU 53.1 the API behavior that a negative
    349349                // length (ruleImageSize) now leads to failure, but also that
    Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::  
    354354                // The default collator of the en-US locale would also fulfill
    355355                // the requirement. The collator of the actual locale or the
    356356                // NULL (default) locale does not.
    357                 uca_base = static_cast<RuleBasedCollator*>(icu::Collator::createInstance(
     357                uca_base = static_cast<icu::RuleBasedCollator*>(icu::Collator::createInstance(
    358358                            icu::Locale::getRoot(), status));
    359359#endif
    360360                if (! U_SUCCESS(status)) throw RuntimeException();
    361                 collator = new RuleBasedCollator(
     361                collator = new icu::RuleBasedCollator(
    362362                        reinterpret_cast<const uint8_t*>(ruleImage), ruleImageSize, uca_base, status);
    363363                if (! U_SUCCESS(status)) throw RuntimeException();
    364364            }
    Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::  
    372372            */
    373373            icu::Locale icuLocale( LanguageTagIcu::getIcuLocale( LanguageTag( rLocale), rAlgorithm));
    374374            // load ICU collator
    375             collator = static_cast<RuleBasedCollator*>( icu::Collator::createInstance(icuLocale, status) );
     375            collator = static_cast<icu::RuleBasedCollator*>( icu::Collator::createInstance(icuLocale, status) );
    376376            if (! U_SUCCESS(status)) throw RuntimeException();
    377377        }
    378378    }
    379379
    380380    if (options & CollatorOptions::CollatorOptions_IGNORE_CASE_ACCENT)
    381         collator->setStrength(Collator::PRIMARY);
     381        collator->setStrength(icu::Collator::PRIMARY);
    382382    else if (options & CollatorOptions::CollatorOptions_IGNORE_CASE)
    383         collator->setStrength(Collator::SECONDARY);
     383        collator->setStrength(icu::Collator::SECONDARY);
    384384    else
    385         collator->setStrength(Collator::TERTIARY);
     385        collator->setStrength(icu::Collator::TERTIARY);
    386386
    387387    return 0;
    388388}
  • i18npool/source/collator/gencoll_rule.cxx

    diff --git a/i18npool/source/collator/gencoll_rule.cxx b/i18npool/source/collator/gencoll_rule.cxx
    index 7d795b5af079..3048d12bb90b 100644
    a b SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)  
    113113    //UCollator *coll = ucol_openRules(Obuf.getStr(), Obuf.getLength(), UCOL_OFF,
    114114    //        UCOL_DEFAULT_STRENGTH, &parseError, &status);
    115115
    116     auto coll = o3tl::make_unique<RuleBasedCollator>(reinterpret_cast<const UChar *>(Obuf.getStr()), status);
     116    auto coll = o3tl::make_unique<icu::RuleBasedCollator>(reinterpret_cast<const UChar *>(Obuf.getStr()), status);
    117117
    118118    if (U_SUCCESS(status)) {
    119119        std::vector<uint8_t> data;
  • i18npool/source/ordinalsuffix/ordinalsuffix.cxx

    diff --git a/i18npool/source/ordinalsuffix/ordinalsuffix.cxx b/i18npool/source/ordinalsuffix/ordinalsuffix.cxx
    index 1a63dcb2e6fd..b9efd51e1176 100644
    a b uno::Sequence< OUString > SAL_CALL OrdinalSuffixService::getOrdinalSuffix( sal_I  
    7979    if (!U_SUCCESS(nCode))
    8080        return retValue;
    8181
    82     std::unique_ptr<NumberFormat> xNumberFormat(icu::NumberFormat::createInstance(aIcuLocale, nCode));
     82    std::unique_ptr<icu::NumberFormat> xNumberFormat(icu::NumberFormat::createInstance(aIcuLocale, nCode));
    8383    if (!U_SUCCESS(nCode))
    8484        return retValue;
    8585
  • i18npool/source/transliteration/ignoreDiacritics_CTL.cxx

    diff --git a/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx b/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx
    index 0ddfe645abaa..2b5ca1ed1bdb 100644
    a b ignoreDiacritics_CTL::transliterateChar2Char(sal_Unicode nInChar)  
    3535    if (!m_transliterator)
    3636        throw css::uno::RuntimeException();
    3737
    38     UnicodeString aChar(nInChar);
     38    icu::UnicodeString aChar(nInChar);
    3939    m_transliterator->transliterate(aChar);
    4040
    4141    if (aChar.isEmpty())
    ignoreDiacritics_CTL::folding(const OUString& rInStr, sal_Int32 nStartPos,  
    6868        {
    6969            sal_Int32 nIndex = nPosition;
    7070            UChar32 nChar = rInStr.iterateCodePoints(&nIndex);
    71             UnicodeString aUStr(nChar);
     71            icu::UnicodeString aUStr(nChar);
    7272            m_transliterator->transliterate(aUStr);
    7373
    7474            if (nOffset + aUStr.length() > rOffset.getLength())
    ignoreDiacritics_CTL::folding(const OUString& rInStr, sal_Int32 nStartPos,  
    8787    }
    8888    else
    8989    {
    90         UnicodeString aUStr(reinterpret_cast<const UChar*>(rInStr.getStr()) + nStartPos, nCount);
     90        icu::UnicodeString aUStr(reinterpret_cast<const UChar*>(rInStr.getStr()) + nStartPos, nCount);
    9191        m_transliterator->transliterate(aUStr);
    9292        return OUString(reinterpret_cast<const sal_Unicode*>(aUStr.getBuffer()), aUStr.length());
    9393    }
  • i18nutil/source/utility/unicode.cxx

    diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx
    index 96c0194a9149..f225b3adc55d 100644
    a b OUString unicode::formatPercent(double dNumber,  
    750750
    751751    icu::Locale aLocale = LanguageTagIcu::getIcuLocale(aLangTag);
    752752
    753     std::unique_ptr<NumberFormat> xF(
    754         NumberFormat::createPercentInstance(aLocale, errorCode));
     753    std::unique_ptr<icu::NumberFormat> xF(
     754        icu::NumberFormat::createPercentInstance(aLocale, errorCode));
    755755    if(U_FAILURE(errorCode))
    756756    {
    757         SAL_WARN("i18n", "NumberFormat::createPercentInstance failed");
     757        SAL_WARN("i18n", "icu::NumberFormat::createPercentInstance failed");
    758758        return OUString::number(dNumber) + "%";
    759759    }
    760760
    761     UnicodeString output;
     761    icu::UnicodeString output;
    762762    xF->format(dNumber/100, output);
    763763    OUString aRet(reinterpret_cast<const sal_Unicode *>(output.getBuffer()),
    764764        output.length());
  • lotuswordpro/source/filter/localtime.cxx

    diff --git a/lotuswordpro/source/filter/localtime.cxx b/lotuswordpro/source/filter/localtime.cxx
    index 47d202412724..3805c5d6f973 100644
    a b bool LtgLocalTime(long rtime,LtTm& rtm)  
    174174
    175175    if ((rtime > 3 * DAY_SEC)&&(rtime < LONG_MAX - 3 * DAY_SEC))
    176176    {
    177         TimeZone* pLocalZone = TimeZone::createDefault();
     177        icu::TimeZone* pLocalZone = icu::TimeZone::createDefault();
    178178        long offset = (pLocalZone->getRawOffset())/1000;
    179179        delete pLocalZone;
    180180        long ltime = rtime + offset;
  • opencl/source/openclconfig.cxx

    diff --git a/opencl/source/openclconfig.cxx b/opencl/source/openclconfig.cxx
    index b81ffed22937..0ec2347fb332 100644
    a b bool match(const OUString& rPattern, const OUString& rInput)  
    119119    UErrorCode nIcuError(U_ZERO_ERROR);
    120120    icu::UnicodeString sIcuPattern(reinterpret_cast<const UChar*>(rPattern.getStr()), rPattern.getLength());
    121121    icu::UnicodeString sIcuInput(reinterpret_cast<const UChar*>(rInput.getStr()), rInput.getLength());
    122     RegexMatcher aMatcher(sIcuPattern, sIcuInput, 0, nIcuError);
     122    icu::RegexMatcher aMatcher(sIcuPattern, sIcuInput, 0, nIcuError);
    123123
    124124    return U_SUCCESS(nIcuError) && aMatcher.matches(nIcuError) && U_SUCCESS(nIcuError);
    125125}