From fcd1637d5101b9142e6808edfb77b01122857901 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 5 Nov 2013 14:39:55 +0200 Subject: convert OUString compareToAscii == 0 to equalsAscii Convert code like aStr.compareToAscii("XXX") == 0 to aStr.equalsAscii("XXX") which is both easier to read and faster. Change-Id: I448abf58f2fa0e7715dba53f8e8825ca0587c83f --- i18npool/source/breakiterator/breakiteratorImpl.cxx | 6 +++--- .../defaultnumberingprovider/defaultnumberingprovider.cxx | 2 +- i18npool/source/indexentry/indexentrysupplier.cxx | 2 +- i18npool/source/indexentry/indexentrysupplier_common.cxx | 2 +- i18npool/source/localedata/LocaleNode.cxx | 10 +++++----- i18npool/source/nativenumber/nativenumbersupplier.cxx | 2 +- i18npool/source/transliteration/transliterationImpl.cxx | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'i18npool') diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index b5e4331768cb..0123583b0ad9 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -587,9 +587,9 @@ BreakIteratorImpl::getLocaleSpecificBreakIterator(const Locale& rLocale) throw ( // load service with name __ createLocaleSpecificBreakIterator(aBuf.append(rLocale.Language).append(under).append( rLocale.Country).makeStringAndClear())) || - (l > 0 && c > 0 && rLocale.Language.compareToAscii("zh") == 0 && - (rLocale.Country.compareToAscii("HK") == 0 || - rLocale.Country.compareToAscii("MO") == 0) && + (l > 0 && c > 0 && rLocale.Language.equalsAscii("zh") && + (rLocale.Country.equalsAscii("HK") || + rLocale.Country.equalsAscii("MO") ) && // if the country code is HK or MO, one more step to try TW. createLocaleSpecificBreakIterator(aBuf.append(rLocale.Language).append(under).appendAscii( "TW").makeStringAndClear())) || diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index a4060d4c6f7e..bd926d1a8df7 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -525,7 +525,7 @@ static int should_ignore( OUString s ) { // return true if blank or null - return s.compareToAscii(" ")==0 || (!s.isEmpty() && s[0]==0); + return s.equalsAscii(" ") || (!s.isEmpty() && s[0]==0); } static diff --git a/i18npool/source/indexentry/indexentrysupplier.cxx b/i18npool/source/indexentry/indexentrysupplier.cxx index 6a4ef3b4b4ff..4f274935c2c2 100644 --- a/i18npool/source/indexentry/indexentrysupplier.cxx +++ b/i18npool/source/indexentry/indexentrysupplier.cxx @@ -184,7 +184,7 @@ IndexEntrySupplier::getImplementationName() throw( RuntimeException ) sal_Bool SAL_CALL IndexEntrySupplier::supportsService(const OUString& rServiceName) throw( RuntimeException ) { - return rServiceName.compareToAscii(implementationName) == 0; + return rServiceName.equalsAscii(implementationName); } Sequence< OUString > SAL_CALL diff --git a/i18npool/source/indexentry/indexentrysupplier_common.cxx b/i18npool/source/indexentry/indexentrysupplier_common.cxx index e4dba3822821..cdaf612ea876 100644 --- a/i18npool/source/indexentry/indexentrysupplier_common.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_common.cxx @@ -126,7 +126,7 @@ IndexEntrySupplier_Common::getImplementationName() throw( RuntimeException ) sal_Bool SAL_CALL IndexEntrySupplier_Common::supportsService(const OUString& rServiceName) throw( RuntimeException ) { - return rServiceName.compareToAscii(implementationName) == 0; + return rServiceName.equalsAscii(implementationName); } Sequence< OUString > SAL_CALL diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 46696770d5e0..ff4ce9784fdd 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -1297,7 +1297,7 @@ void LCCollationNode::generateCode (const OFileWriter &of) const for ( j = 0; j < getNumberOfChildren(); j++ ) { LocaleNode * currNode = getChildAt (j); - if( currNode->getName().compareToAscii("Collator") == 0 ) + if( currNode->getName().equalsAscii("Collator") ) { OUString str; str = currNode->getAttr().getValueByName("unoid"); @@ -1310,7 +1310,7 @@ void LCCollationNode::generateCode (const OFileWriter &of) const nbOfCollations++; } - if( currNode->getName().compareToAscii("CollationOptions") == 0 ) + if( currNode->getName().equalsAscii("CollationOptions") ) { LocaleNode* pCollationOptions = currNode; nbOfCollationOptions = sal::static_int_cast( pCollationOptions->getNumberOfChildren() ); @@ -1411,7 +1411,7 @@ void LCIndexNode::generateCode (const OFileWriter &of) const sal_Int16 i; for (i = 0; i< getNumberOfChildren();i++) { LocaleNode * currNode = getChildAt (i); - if( currNode->getName().compareToAscii("IndexKey") == 0 ) + if( currNode->getName().equalsAscii("IndexKey") ) { OUString str; str = currNode->getAttr().getValueByName("unoid"); @@ -1428,13 +1428,13 @@ void LCIndexNode::generateCode (const OFileWriter &of) const nbOfIndexs++; } - if( currNode->getName().compareToAscii("UnicodeScript") == 0 ) + if( currNode->getName().equalsAscii("UnicodeScript") ) { of.writeParameter("unicodeScript", currNode->getValue(), nbOfUnicodeScripts ); nbOfUnicodeScripts++; } - if( currNode->getName().compareToAscii("FollowPageWord") == 0 ) + if( currNode->getName().equalsAscii("FollowPageWord") ) { of.writeParameter("followPageWord", currNode->getValue(), nbOfPageWords); nbOfPageWords++; diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx index bf2ff1100b4c..38e7905031af 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -898,7 +898,7 @@ OUString SAL_CALL NativeNumberSupplier::getImplementationName() throw( RuntimeEx sal_Bool SAL_CALL NativeNumberSupplier::supportsService(const OUString& rServiceName) throw( RuntimeException ) { - return rServiceName.compareToAscii(implementationName) == 0; + return rServiceName.equalsAscii(implementationName); } Sequence< OUString > SAL_CALL diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index 2af62a742269..d700646dcfe2 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -613,7 +613,7 @@ TransliterationImpl::loadModuleByName( const OUString& implName, // if the module is ignore case/kana/width, load caseignore for equals/compareString mothed for (sal_Int16 i = 0; i < 3; i++) { - if (implName.compareToAscii(TMlist[i].implName) == 0) { + if (implName.equalsAscii(TMlist[i].implName)) { if (i == 0) // current module is caseignore body->loadModule(TMlist[0].tm, rLocale); // caseingore need to setup module name if (! caseignore.is()) { -- cgit