diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-21 11:53:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-22 08:29:29 +0200 |
commit | 4af6c0948be47d7816eb1b6f2137b70aba639f0d (patch) | |
tree | 3965a1709f531229a6faaeef2e9d4026a30332b8 /i18npool/source | |
parent | 7b45044fd14661202c658923842dd629cf52961c (diff) |
loplugin:flatten in filter..i18npool
Change-Id: I9024b8b614a4de83a4d927e1918f6d4904a7fccb
Reviewed-on: https://gerrit.libreoffice.org/42592
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source')
-rw-r--r-- | i18npool/source/breakiterator/breakiterator_unicode.cxx | 7 | ||||
-rw-r--r-- | i18npool/source/calendar/calendarImpl.cxx | 180 | ||||
-rw-r--r-- | i18npool/source/collator/collatorImpl.cxx | 5 | ||||
-rw-r--r-- | i18npool/source/indexentry/indexentrysupplier.cxx | 17 | ||||
-rw-r--r-- | i18npool/source/localedata/localedata.cxx | 5 |
5 files changed, 91 insertions, 123 deletions
diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index cf781eb414a0..5331b8366e4d 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -179,12 +179,11 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Local throw uno::RuntimeException(); } } - if (icuBI->aBreakIterator) { - icuBI->maLocale=rLocale; - bNewBreak=true; - } else { + if (!icuBI->aBreakIterator) { throw uno::RuntimeException(); } + icuBI->maLocale=rLocale; + bNewBreak=true; } if (bNewBreak || icuBI->aICUText.pData != rText.pData) diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index 94b72e2bf70d..220a3a9fde78 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -83,10 +83,9 @@ CalendarImpl::loadCalendar(const OUString& uniqueID, const Locale& rLocale ) } } - if ( xI.is() ) - xCalendar.set(xI, UNO_QUERY); - else + if ( !xI.is() ) throw ERROR; + xCalendar.set(xI, UNO_QUERY); lookupTable.push_back( new lookupTableItem(uniqueID, xCalendar) ); } @@ -111,19 +110,17 @@ CalendarImpl::loadCalendar(const OUString& uniqueID, const Locale& rLocale ) Calendar2 SAL_CALL CalendarImpl::getLoadedCalendar2() { - if (xCalendar.is()) - return xCalendar->getLoadedCalendar2(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getLoadedCalendar2(); } Calendar SAL_CALL CalendarImpl::getLoadedCalendar() { - if (xCalendar.is()) - return xCalendar->getLoadedCalendar(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getLoadedCalendar(); } Sequence< OUString > SAL_CALL @@ -140,217 +137,194 @@ CalendarImpl::getAllCalendars( const Locale& rLocale ) void SAL_CALL CalendarImpl::setDateTime( double fTimeInDays ) { - if (xCalendar.is()) - xCalendar->setDateTime( fTimeInDays ); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + xCalendar->setDateTime( fTimeInDays ); } double SAL_CALL CalendarImpl::getDateTime() { - if (xCalendar.is()) - return xCalendar->getDateTime(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getDateTime(); } void SAL_CALL CalendarImpl::setLocalDateTime( double fTimeInDays ) { - if (xCalendar.is()) - xCalendar->setLocalDateTime( fTimeInDays ); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + xCalendar->setLocalDateTime( fTimeInDays ); } double SAL_CALL CalendarImpl::getLocalDateTime() { - if (xCalendar.is()) - return xCalendar->getLocalDateTime(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getLocalDateTime(); } OUString SAL_CALL CalendarImpl::getUniqueID() { - if (xCalendar.is()) - return xCalendar->getUniqueID(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getUniqueID(); } void SAL_CALL CalendarImpl::setValue( sal_Int16 fieldIndex, sal_Int16 value ) { - if (xCalendar.is()) - xCalendar->setValue( fieldIndex, value ); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + xCalendar->setValue( fieldIndex, value ); } sal_Int16 SAL_CALL CalendarImpl::getValue( sal_Int16 fieldIndex ) { - if (xCalendar.is()) - return xCalendar->getValue( fieldIndex ); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getValue( fieldIndex ); } void SAL_CALL CalendarImpl::addValue( sal_Int16 fieldIndex, sal_Int32 amount ) { - if (xCalendar.is()) - xCalendar->addValue( fieldIndex, amount); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + xCalendar->addValue( fieldIndex, amount); } sal_Int16 SAL_CALL CalendarImpl::getFirstDayOfWeek() { - if (xCalendar.is()) - return xCalendar->getFirstDayOfWeek(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getFirstDayOfWeek(); } void SAL_CALL CalendarImpl::setFirstDayOfWeek( sal_Int16 day ) { - if (xCalendar.is()) - xCalendar->setFirstDayOfWeek(day); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR ; xCalendar->setFirstDayOfWeek(day); + } void SAL_CALL CalendarImpl::setMinimumNumberOfDaysForFirstWeek( sal_Int16 days ) { - if (xCalendar.is()) - xCalendar->setMinimumNumberOfDaysForFirstWeek(days); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + xCalendar->setMinimumNumberOfDaysForFirstWeek(days); } sal_Int16 SAL_CALL CalendarImpl::getMinimumNumberOfDaysForFirstWeek() { - if (xCalendar.is()) - return xCalendar->getMinimumNumberOfDaysForFirstWeek(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getMinimumNumberOfDaysForFirstWeek(); } OUString SAL_CALL CalendarImpl::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16 nameType ) { - if (xCalendar.is()) - return xCalendar->getDisplayName( displayIndex, idx, nameType ); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getDisplayName( displayIndex, idx, nameType ); } sal_Int16 SAL_CALL CalendarImpl::getNumberOfMonthsInYear() { - if (xCalendar.is()) - return xCalendar->getNumberOfMonthsInYear(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR ; return xCalendar->getNumberOfMonthsInYear(); + } sal_Int16 SAL_CALL CalendarImpl::getNumberOfDaysInWeek() { - if (xCalendar.is()) - return xCalendar->getNumberOfDaysInWeek(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getNumberOfDaysInWeek(); } Sequence< CalendarItem > SAL_CALL CalendarImpl::getDays() { - if (xCalendar.is()) - return xCalendar->getDays(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getDays(); } Sequence< CalendarItem > SAL_CALL CalendarImpl::getMonths() { - if (xCalendar.is()) - return xCalendar->getMonths(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR ; return xCalendar->getMonths(); + } Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getDays2() { - if (xCalendar.is()) - return xCalendar->getDays2(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getDays2(); } Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getMonths2() { - if (xCalendar.is()) - return xCalendar->getMonths2(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getMonths2(); } Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getGenitiveMonths2() { - if (xCalendar.is()) - return xCalendar->getGenitiveMonths2(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getGenitiveMonths2(); } Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getPartitiveMonths2() { - if (xCalendar.is()) - return xCalendar->getPartitiveMonths2(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getPartitiveMonths2(); } sal_Bool SAL_CALL CalendarImpl::isValid() { - if (xCalendar.is()) - return xCalendar->isValid(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->isValid(); } OUString SAL_CALL CalendarImpl::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) { - if (xCalendar.is()) - return xCalendar->getDisplayString(nCalendarDisplayCode, nNativeNumberMode); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getDisplayString(nCalendarDisplayCode, nNativeNumberMode); } OUString SAL_CALL diff --git a/i18npool/source/collator/collatorImpl.cxx b/i18npool/source/collator/collatorImpl.cxx index 38bca648f27f..022071a9b904 100644 --- a/i18npool/source/collator/collatorImpl.cxx +++ b/i18npool/source/collator/collatorImpl.cxx @@ -88,10 +88,9 @@ CollatorImpl::loadCollatorAlgorithm(const OUString& impl, const lang::Locale& rL if (! cachedItem || ! cachedItem->equals(rLocale, impl)) loadCachedCollator(rLocale, impl); - if (cachedItem) - cachedItem->xC->loadCollatorAlgorithm(cachedItem->algorithm, nLocale = rLocale, collatorOptions); - else + if (!cachedItem) throw RuntimeException(); // impl could not be loaded + cachedItem->xC->loadCollatorAlgorithm(cachedItem->algorithm, nLocale = rLocale, collatorOptions); return 0; } diff --git a/i18npool/source/indexentry/indexentrysupplier.cxx b/i18npool/source/indexentry/indexentrysupplier.cxx index cf6b633414dc..9b6d938c987b 100644 --- a/i18npool/source/indexentry/indexentrysupplier.cxx +++ b/i18npool/source/indexentry/indexentrysupplier.cxx @@ -63,30 +63,27 @@ sal_Bool SAL_CALL IndexEntrySupplier::usePhoneticEntry( const Locale& rLocale ) OUString SAL_CALL IndexEntrySupplier::getPhoneticCandidate( const OUString& rIndexEntry, const Locale& rLocale ) { - if (getLocaleSpecificIndexEntrySupplier(rLocale, OUString()).is()) - return xIES->getPhoneticCandidate(rIndexEntry, rLocale); - else + if (!getLocaleSpecificIndexEntrySupplier(rLocale, OUString()).is()) throw RuntimeException(); + return xIES->getPhoneticCandidate(rIndexEntry, rLocale); } OUString SAL_CALL IndexEntrySupplier::getIndexKey( const OUString& rIndexEntry, const OUString& rPhoneticEntry, const Locale& rLocale ) { - if (xIES.is()) - return xIES->getIndexKey(rIndexEntry, rPhoneticEntry, rLocale); - else + if (!xIES.is()) throw RuntimeException(); + return xIES->getIndexKey(rIndexEntry, rPhoneticEntry, rLocale); } sal_Int16 SAL_CALL IndexEntrySupplier::compareIndexEntry( const OUString& rIndexEntry1, const OUString& rPhoneticEntry1, const Locale& rLocale1, const OUString& rIndexEntry2, const OUString& rPhoneticEntry2, const Locale& rLocale2 ) { - if (xIES.is()) - return xIES->compareIndexEntry(rIndexEntry1, rPhoneticEntry1, rLocale1, - rIndexEntry2, rPhoneticEntry2, rLocale2); - else + if (!xIES.is()) throw RuntimeException(); + return xIES->compareIndexEntry(rIndexEntry1, rPhoneticEntry1, rLocale1, + rIndexEntry2, rPhoneticEntry2, rLocale2); } OUString SAL_CALL IndexEntrySupplier::getIndexCharacter( const OUString& rIndexEntry, diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 78a37c15308a..2660f7fae5c1 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -633,10 +633,9 @@ Sequence< CalendarItem2 > &LocaleDataImpl::getCalendarItemByName(const OUString& // Referred locale not found, return name for en_US locale. if (index == cals.getLength()) { cals = getAllCalendars2( Locale("en", "US", OUString()) ); - if (cals.getLength() > 0) - ref_cal = cals[0]; - else + if (cals.getLength() <= 0) throw RuntimeException(); + ref_cal = cals[0]; } ref_name = name; } |