diff options
author | Szabolcs Dezsi <dezsiszabi@hotmail.com> | 2012-04-06 19:49:53 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2012-04-06 20:03:42 +0200 |
commit | d6bc02f8c4cd0f50f0a2631ac7634dab408efc1f (patch) | |
tree | b5a12df1fcae025715633469b75ab4c9b6f6d279 /i18npool/source | |
parent | 0e1c0587617e0a6e4295a13599e97cdf6d1d2ea9 (diff) |
Replaced equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(...)) with == operator
Diffstat (limited to 'i18npool/source')
-rw-r--r-- | i18npool/source/breakiterator/breakiteratorImpl.cxx | 2 | ||||
-rw-r--r-- | i18npool/source/breakiterator/breakiterator_unicode.cxx | 2 | ||||
-rw-r--r-- | i18npool/source/calendar/calendar_gregorian.cxx | 6 | ||||
-rw-r--r-- | i18npool/source/collator/collatorImpl.cxx | 10 | ||||
-rw-r--r-- | i18npool/source/indexentry/indexentrysupplier_asian.cxx | 4 | ||||
-rw-r--r-- | i18npool/source/localedata/LocaleNode.cxx | 28 | ||||
-rw-r--r-- | i18npool/source/localedata/filewriter.cxx | 4 | ||||
-rw-r--r-- | i18npool/source/localedata/localedata.cxx | 9 | ||||
-rw-r--r-- | i18npool/source/textconversion/textconversion_zh.cxx | 8 |
9 files changed, 32 insertions, 41 deletions
diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index 1d26968190a8..82014535c6ab 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -132,7 +132,7 @@ Boundary SAL_CALL BreakIteratorImpl::nextWord( const OUString& Text, sal_Int32 n } static inline sal_Bool SAL_CALL isCJK( const Locale& rLocale ) { - return rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("zh")) || rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ja")) || rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ko")); + return rLocale.Language == "zh" || rLocale.Language == "ja" || rLocale.Language == "ko"; } Boundary SAL_CALL BreakIteratorImpl::previousWord( const OUString& Text, sal_Int32 nStartPos, diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index aa5e1d8adf12..0d6df0f5401b 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -134,7 +134,7 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star:: rbi = new OOoRuleBasedBreakIterator(udata_open("OpenOffice", "brk", OUStringToOString(breakRules[breakType], RTL_TEXTENCODING_ASCII_US).getStr(), &status), status); } - else if (!rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("th"))) //use icu's breakiterator for Thai + else if ( rLocale.Language != "th" ) //use icu's breakiterator for Thai { status = U_ZERO_ERROR; OStringBuffer aUDName(64); diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index c912529e32a7..f726aeb0fc38 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -802,9 +802,9 @@ static sal_Int16 SAL_CALL NatNumForCalendar(const com::sun::star::lang::Locale& nCalendarDisplayCode == CalendarDisplayCode::LONG_YEAR) && value >= 100) || nCalendarDisplayCode == CalendarDisplayCode::SHORT_QUARTER || nCalendarDisplayCode == CalendarDisplayCode::LONG_QUARTER; - sal_Bool isChinese = aLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("zh")); - sal_Bool isJapanese = aLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ja")); - sal_Bool isKorean = aLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ko")); + sal_Bool isChinese = aLocale.Language == "zh"; + sal_Bool isJapanese = aLocale.Language == "ja"; + sal_Bool isKorean = aLocale.Language == "ko"; if (isChinese || isJapanese || isKorean) { switch (nNativeNumberMode) { diff --git a/i18npool/source/collator/collatorImpl.cxx b/i18npool/source/collator/collatorImpl.cxx index faf0ae965494..49f193e53328 100644 --- a/i18npool/source/collator/collatorImpl.cxx +++ b/i18npool/source/collator/collatorImpl.cxx @@ -148,9 +148,9 @@ CollatorImpl::listCollatorOptions( const OUString& /*collatorAlgorithmName*/ ) t for (sal_Int32 i = 0; i < option_str.getLength(); i++) option_int[i] = - option_str[i].equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("IGNORE_CASE")) ? CollatorOptions::CollatorOptions_IGNORE_CASE : - option_str[i].equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("IGNORE_KANA")) ? CollatorOptions::CollatorOptions_IGNORE_KANA : - option_str[i].equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("IGNORE_WIDTH")) ? CollatorOptions::CollatorOptions_IGNORE_WIDTH : 0; + option_str[i] == "IGNORE_CASE" ? CollatorOptions::CollatorOptions_IGNORE_CASE : + option_str[i] == "IGNORE_KANA" ? CollatorOptions::CollatorOptions_IGNORE_KANA : + option_str[i] == "IGNORE_WIDTH" ? CollatorOptions::CollatorOptions_IGNORE_WIDTH : 0; return option_int; } @@ -213,9 +213,7 @@ CollatorImpl::loadCachedCollator(const lang::Locale& rLocale, const OUString& rS // load service with name <base>_<lang>_<country>_<algorithm> createCollator(rLocale, aBuf.append(rLocale.Language).append(under).append(rLocale.Country).append( under).append(rSortAlgorithm).makeStringAndClear(), rSortAlgorithm)) || - (l > 0 && c > 0 && a > 0 && rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("zh")) && - (rLocale.Country.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HK")) || - rLocale.Country.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MO"))) && + (l > 0 && c > 0 && a > 0 && rLocale.Language == "zh" && (rLocale.Country == "HK" || rLocale.Country == "MO") && // if the country code is HK or MO, one more step to try TW. createCollator(rLocale, aBuf.append(rLocale.Language).append(under).append(tw).append(under).append( rSortAlgorithm).makeStringAndClear(), rSortAlgorithm)) || diff --git a/i18npool/source/indexentry/indexentrysupplier_asian.cxx b/i18npool/source/indexentry/indexentrysupplier_asian.cxx index b5ce82d80e1f..ae8c32bc7915 100644 --- a/i18npool/source/indexentry/indexentrysupplier_asian.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_asian.cxx @@ -66,7 +66,7 @@ IndexEntrySupplier_asian::getIndexCharacter( const OUString& rIndexEntry, if (hModule) { OUString get(RTL_CONSTASCII_USTRINGPARAM("get_indexdata_")); sal_uInt16** (*func)(sal_Int16*)=NULL; - if (rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("zh")) && OUString(RTL_CONSTASCII_USTRINGPARAM("TW HK MO")).indexOf(rLocale.Country) >= 0) + if ( rLocale.Language == "zh" && OUString( "TW HK MO" ).indexOf(rLocale.Country) >= 0 ) func=(sal_uInt16** (*)(sal_Int16*))osl_getFunctionSymbol(hModule, (get+rLocale.Language+OUString(RTL_CONSTASCII_USTRINGPARAM("_TW_"))+rAlgorithm).pData); if (!func) func=(sal_uInt16** (*)(sal_Int16*))osl_getFunctionSymbol(hModule, (get+rLocale.Language+OUString('_')+rAlgorithm).pData); @@ -135,7 +135,7 @@ IndexEntrySupplier_asian::getPhoneticCandidate( const OUString& rIndexEntry, sal_uInt16 address = idx[0][ch>>8]; if (address != 0xFFFF) { address = idx[1][address + (ch & 0xFF)]; - if (i > 0 && rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("zh"))) + if ( i > 0 && rLocale.Language == "zh" ) candidate.appendAscii(" "); if (idx[2]) candidate.append(&idx[2][address]); diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 840bf30529ae..cd021e9335ba 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -234,7 +234,7 @@ void print_node( const LocaleNode* p, int depth=0 ) void LocaleNode :: generateCode (const OFileWriter &of) const { ::rtl::OUString aDTD = getAttr().getValueByName("versionDTD"); - if (!aDTD.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(LOCALE_VERSION_DTD))) + if ( aDTD != LOCALE_VERSION_DTD ) { ++nError; fprintf( stderr, "Error: Locale versionDTD is not %s, see comment in locale.dtd\n", LOCALE_VERSION_DTD); @@ -661,7 +661,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const for (sal_Int16 i = 0; i< getNumberOfChildren() ; i++, formatCount++) { LocaleNode * currNode = getChildAt (i); - if (currNode->getName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DateAcceptancePattern"))) + if ( currNode->getName() == "DateAcceptancePattern" ) { if (mnSection > 0) incError( "DateAcceptancePattern only handled in LC_FORMAT, not LC_FORMAT_1"); @@ -670,7 +670,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const --formatCount; continue; // for } - if (!currNode->getName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FormatElement"))) + if ( currNode->getName() != "FormatElement" ) { incErrorStr( "Undefined element in LC_FORMAT", currNode->getName()); --formatCount; @@ -690,7 +690,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const of.writeParameter("FormatKey", str, formatCount); str = currNodeAttr.getValueByName("default"); - bool bDefault = str.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "true")); + bool bDefault = str == "true"; of.writeDefaultParameter("FormatElement", str, formatCount); aType = currNodeAttr.getValueByName("type"); @@ -1488,7 +1488,7 @@ static void lcl_writeAbbrFullNarrNames( const OFileWriter & of, const LocaleNode OUString aFullName = currNode->getChildAt(2)->getValue(); OUString aNarrName; LocaleNode* p = (currNode->getNumberOfChildren() > 3 ? currNode->getChildAt(3) : 0); - if (p && p->getName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DefaultNarrowName"))) + if ( p && p->getName() == "DefaultNarrowName" ) aNarrName = p->getValue(); else { @@ -1561,7 +1561,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const LocaleNode * calNode = getChildAt (i); OUString calendarID = calNode -> getAttr().getValueByName("unoid"); of.writeParameter( "calendarID", calendarID, i); - bool bGregorian = calendarID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "gregorian")); + bool bGregorian = calendarID == "gregorian"; if (!bHasGregorian) bHasGregorian = bGregorian; str = calNode -> getAttr().getValueByName("default"); @@ -1595,7 +1595,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const LocaleNode *currNode = daysNode -> getChildAt(j); OUString dayID( currNode->getChildAt(0)->getValue()); of.writeParameter("dayID", dayID, i, j); - if (j == 0 && bGregorian && !dayID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "sun"))) + if ( j == 0 && bGregorian && dayID != "sun" ) incError( "First day of a week of a Gregorian calendar must be <DayID>sun</DayID>"); lcl_writeAbbrFullNarrNames( of, currNode, elementTag, i, j); } @@ -1627,7 +1627,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const LocaleNode *currNode = monthsNode -> getChildAt(j); OUString monthID( currNode->getChildAt(0)->getValue()); of.writeParameter("monthID", monthID, i, j); - if (j == 0 && bGregorian && !monthID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "jan"))) + if ( j == 0 && bGregorian && monthID != "jan" ) incError( "First month of a year of a Gregorian calendar must be <MonthID>jan</MonthID>"); lcl_writeAbbrFullNarrNames( of, currNode, elementTag, i, j); } @@ -1636,7 +1636,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const // Generate genitive Months of Year // Optional, if not present fall back to month nouns. - if (!calNode->getChildAt(nChild)->getName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GenitiveMonths"))) + if ( calNode->getChildAt(nChild)->getName() != "GenitiveMonths" ) --nChild; LocaleNode * genitiveMonthsNode = NULL; ref_name = calNode->getChildAt(nChild)->getAttr().getValueByName("ref"); @@ -1662,7 +1662,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const LocaleNode *currNode = genitiveMonthsNode -> getChildAt(j); OUString genitiveMonthID( currNode->getChildAt(0)->getValue()); of.writeParameter("genitiveMonthID", genitiveMonthID, i, j); - if (j == 0 && bGregorian && !genitiveMonthID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "jan"))) + if ( j == 0 && bGregorian && genitiveMonthID != "jan" ) incError( "First genitive month of a year of a Gregorian calendar must be <MonthID>jan</MonthID>"); lcl_writeAbbrFullNarrNames( of, currNode, elementTag, i, j); } @@ -1672,7 +1672,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const // Generate partitive Months of Year // Optional, if not present fall back to genitive months, or nominative // months (nouns) if that isn't present either. - if (!calNode->getChildAt(nChild)->getName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PartitiveMonths"))) + if ( calNode->getChildAt(nChild)->getName() != "PartitiveMonths" ) --nChild; LocaleNode * partitiveMonthsNode = NULL; ref_name = calNode->getChildAt(nChild)->getAttr().getValueByName("ref"); @@ -1698,7 +1698,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const LocaleNode *currNode = partitiveMonthsNode -> getChildAt(j); OUString partitiveMonthID( currNode->getChildAt(0)->getValue()); of.writeParameter("partitiveMonthID", partitiveMonthID, i, j); - if (j == 0 && bGregorian && !partitiveMonthID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "jan"))) + if ( j == 0 && bGregorian && partitiveMonthID != "jan" ) incError( "First partitive month of a year of a Gregorian calendar must be <MonthID>jan</MonthID>"); lcl_writeAbbrFullNarrNames( of, currNode, elementTag, i, j); } @@ -1730,9 +1730,9 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const LocaleNode *currNode = erasNode -> getChildAt(j); OUString eraID( currNode->getChildAt(0)->getValue()); of.writeParameter("eraID", eraID, i, j); - if (j == 0 && bGregorian && !eraID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "bc"))) + if ( j == 0 && bGregorian && eraID != "bc" ) incError( "First era of a Gregorian calendar must be <EraID>bc</EraID>"); - if (j == 1 && bGregorian && !eraID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "ad"))) + if ( j == 1 && bGregorian && eraID != "ad" ) incError( "Second era of a Gregorian calendar must be <EraID>ad</EraID>"); of.writeAsciiString("\n"); of.writeParameter(elementTag, "DefaultAbbrvName",currNode->getChildAt(1)->getValue() ,i, j); diff --git a/i18npool/source/localedata/filewriter.cxx b/i18npool/source/localedata/filewriter.cxx index e7658de8e6f6..58a3e1ff81af 100644 --- a/i18npool/source/localedata/filewriter.cxx +++ b/i18npool/source/localedata/filewriter.cxx @@ -142,14 +142,14 @@ void OFileWriter::writeIntParameter(const sal_Char* pAsciiStr, const sal_Int16 c bool OFileWriter::writeDefaultParameter(const sal_Char* pAsciiStr, const ::rtl::OUString& str, sal_Int16 count) const { - bool bBool = (str.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("true")) ? 1 : 0); + bool bBool = (str == "true" ? 1 : 0); fprintf(m_f,"static const sal_Unicode default%s%d[] = {%d};\n", pAsciiStr, count, bBool); return bBool; } bool OFileWriter::writeDefaultParameter(const sal_Char* pAsciiStr, const ::rtl::OUString& str) const { - bool bBool = (str.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("true")) ? 1 : 0); + bool bBool = (str == "true" ? 1 : 0); fprintf(m_f,"static const sal_Unicode default%s[] = {%d};\n", pAsciiStr, bBool); return bBool; } diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index dd3f7cf5791e..a7d76fd430e0 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -557,7 +557,7 @@ Sequence< CalendarItem2 > LocaleData::getCalendarItems( throw(RuntimeException) { Sequence< CalendarItem2 > aItems; - if (OUString( allCalendars[rnOffset]).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ref"))) + if ( OUString( allCalendars[rnOffset] ) == "ref" ) { aItems = getCalendarItemByName( OUString( allCalendars[rnOffset+1]), rLocale, calendarsSeq, nWhichItem); rnOffset += 2; @@ -1428,10 +1428,7 @@ oslGenericFunction SAL_CALL LocaleData::getFunctionSymbol( const Locale& rLocale pFunction, &pCachedItem); } - if (!pSymbol && l > 0 && c > 0 && - rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("zh")) && - (rLocale.Country.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HK")) || - rLocale.Country.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MO")))) + if (!pSymbol && l > 0 && c > 0 && rLocale.Language == "zh" && (rLocale.Country == "HK" || rLocale.Country == "MO")) { // if the country code is HK or MO, one more step to try TW. pSymbol = rLookupTable.getFunctionSymbolByName( @@ -1575,7 +1572,7 @@ sal_Bool SAL_CALL LocaleData::supportsService(const OUString& rServiceName) throw( RuntimeException ) { - return rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(clocaledata)); + return rServiceName == clocaledata; } Sequence< OUString > SAL_CALL diff --git a/i18npool/source/textconversion/textconversion_zh.cxx b/i18npool/source/textconversion/textconversion_zh.cxx index efcbfaa5e5d7..2d72b8017960 100644 --- a/i18npool/source/textconversion/textconversion_zh.cxx +++ b/i18npool/source/textconversion/textconversion_zh.cxx @@ -243,9 +243,7 @@ TextConversion_zh::getConversion( const OUString& aText, sal_Int32 nStartPos, sa const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions) throw( RuntimeException, IllegalArgumentException, NoSupportException ) { - if (rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("zh")) && - ( nConversionType == TextConversionType::TO_SCHINESE || - nConversionType == TextConversionType::TO_TCHINESE) ) { + if (rLocale.Language == "zh" && ( nConversionType == TextConversionType::TO_SCHINESE || nConversionType == TextConversionType::TO_TCHINESE) ) { aLocale=rLocale; sal_Bool toSChinese = nConversionType == TextConversionType::TO_SCHINESE; @@ -267,9 +265,7 @@ TextConversion_zh::getConversionWithOffset( const OUString& aText, sal_Int32 nSt const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions, Sequence<sal_Int32>& offset) throw( RuntimeException, IllegalArgumentException, NoSupportException ) { - if (rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("zh")) && - ( nConversionType == TextConversionType::TO_SCHINESE || - nConversionType == TextConversionType::TO_TCHINESE) ) { + if (rLocale.Language == "zh" && ( nConversionType == TextConversionType::TO_SCHINESE || nConversionType == TextConversionType::TO_TCHINESE) ) { aLocale=rLocale; sal_Bool toSChinese = nConversionType == TextConversionType::TO_SCHINESE; |