summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-09-16 14:28:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-16 20:16:50 +0200
commit922b8420071989026bf7cc2a973714788e0211dd (patch)
tree4b848254e880670f4d264f3dda2d8df999197290 /i18npool
parentc156a8c708f74dd31e1ef024edc578c3915619cb (diff)
expand out unnecessary macro
Change-Id: Id812b720413bfe9ea678910fc8d9d0a64dd32d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122195 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/calendar/calendar_gregorian.cxx60
-rw-r--r--i18npool/source/transliteration/transliterationImpl.cxx16
2 files changed, 36 insertions, 40 deletions
diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx
index 1da80995b1d1..6a1dad685309 100644
--- a/i18npool/source/calendar/calendar_gregorian.cxx
+++ b/i18npool/source/calendar/calendar_gregorian.cxx
@@ -127,8 +127,6 @@ using namespace ::com::sun::star::lang;
namespace i18npool {
-#define ERROR RuntimeException()
-
Calendar_gregorian::Calendar_gregorian()
: mxNatNum(new NativeNumberSupplierService)
{
@@ -174,7 +172,7 @@ Calendar_gregorian::init(const Era *_eraArray)
*/
UErrorCode status = U_ZERO_ERROR;
body.reset( icu::Calendar::createInstance( aIcuLocale, status) );
- if (!body || !U_SUCCESS(status)) throw ERROR;
+ if (!body || !U_SUCCESS(status)) throw RuntimeException();
eraArray=_eraArray;
}
@@ -195,7 +193,7 @@ Calendar_hanja::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16
css::lang::Locale jaLocale("ja", OUString(), OUString());
if (idx == 0) return LocaleDataImpl::get()->getLocaleItem(jaLocale).timeAM;
else if (idx == 1) return LocaleDataImpl::get()->getLocaleItem(jaLocale).timePM;
- else throw ERROR;
+ else throw RuntimeException();
}
else
return Calendar_gregorian::getDisplayName( displayIndex, idx, nameType );
@@ -215,7 +213,7 @@ Calendar_hanja_yoil::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_
css::lang::Locale jaLocale("ja", OUString(), OUString());
if (idx == 0) return LocaleDataImpl::get()->getLocaleItem(jaLocale).timeAM;
else if (idx == 1) return LocaleDataImpl::get()->getLocaleItem(jaLocale).timePM;
- else throw ERROR;
+ else throw RuntimeException();
}
else
return Calendar_gregorian::getDisplayName( displayIndex, idx, nameType );
@@ -295,7 +293,7 @@ Calendar_gregorian::loadCalendar( const OUString& uniqueID, const css::lang::Loc
}
}
// Calendar is not for the locale
- throw ERROR;
+ throw RuntimeException();
}
@@ -333,7 +331,7 @@ Calendar_gregorian::setDateTime( double fTimeInDays )
"Calendar_gregorian::setDateTime: " << std::fixed << fM << " rounded to " << fR);
UErrorCode status = U_ZERO_ERROR;
body->setTime( fR, status);
- if ( !U_SUCCESS(status) ) throw ERROR;
+ if ( !U_SUCCESS(status) ) throw RuntimeException();
getValue();
}
@@ -346,7 +344,7 @@ Calendar_gregorian::getDateTime()
}
UErrorCode status = U_ZERO_ERROR;
double fR = body->getTime(status);
- if ( !U_SUCCESS(status) ) throw ERROR;
+ if ( !U_SUCCESS(status) ) throw RuntimeException();
return fR / U_MILLIS_PER_DAY;
}
@@ -362,10 +360,10 @@ Calendar_gregorian::setLocalDateTime( double fTimeInDays )
UErrorCode status = U_ZERO_ERROR;
body->getTimeZone().getOffset( fR, true, nZoneOffset, nDSTOffset, status );
- if ( !U_SUCCESS(status) ) throw ERROR;
+ if ( !U_SUCCESS(status) ) throw RuntimeException();
status = U_ZERO_ERROR;
body->setTime( fR - (nZoneOffset + nDSTOffset), status );
- if ( !U_SUCCESS(status) ) throw ERROR;
+ if ( !U_SUCCESS(status) ) throw RuntimeException();
getValue();
}
@@ -378,13 +376,13 @@ Calendar_gregorian::getLocalDateTime()
}
UErrorCode status = U_ZERO_ERROR;
double fTime = body->getTime( status );
- if ( !U_SUCCESS(status) ) throw ERROR;
+ if ( !U_SUCCESS(status) ) throw RuntimeException();
status = U_ZERO_ERROR;
int32_t nZoneOffset = body->get( UCAL_ZONE_OFFSET, status );
- if ( !U_SUCCESS(status) ) throw ERROR;
+ if ( !U_SUCCESS(status) ) throw RuntimeException();
status = U_ZERO_ERROR;
int32_t nDSTOffset = body->get( UCAL_DST_OFFSET, status );
- if ( !U_SUCCESS(status) ) throw ERROR;
+ if ( !U_SUCCESS(status) ) throw RuntimeException();
return (fTime + (nZoneOffset + nDSTOffset)) / U_MILLIS_PER_DAY;
}
@@ -471,7 +469,7 @@ static UCalendarDateFields fieldNameConverter(sal_Int16 fieldIndex)
case CalendarFieldIndex::YEAR: f = UCAL_YEAR; break;
case CalendarFieldIndex::MONTH: f = UCAL_MONTH; break;
case CalendarFieldIndex::ERA: f = UCAL_ERA; break;
- default: throw ERROR;
+ default: throw RuntimeException();
}
return f;
}
@@ -480,7 +478,7 @@ void SAL_CALL
Calendar_gregorian::setValue( sal_Int16 fieldIndex, sal_Int16 value )
{
if (fieldIndex < 0 || FIELD_INDEX_COUNT <= fieldIndex)
- throw ERROR;
+ throw RuntimeException();
fieldSet |= (1 << fieldIndex);
fieldValue[fieldIndex] = value;
}
@@ -583,7 +581,7 @@ void Calendar_gregorian::getValue()
UErrorCode status = U_ZERO_ERROR;
sal_Int32 value = body->get( fieldNameConverter(
fieldIndex), status);
- if ( !U_SUCCESS(status) ) throw ERROR;
+ if ( !U_SUCCESS(status) ) throw RuntimeException();
// Convert millisecond to minute for ZONE and DST and set remainder in
// second field.
@@ -618,7 +616,7 @@ sal_Int16 SAL_CALL
Calendar_gregorian::getValue( sal_Int16 fieldIndex )
{
if (fieldIndex < 0 || FIELD_INDEX_COUNT <= fieldIndex)
- throw ERROR;
+ throw RuntimeException();
if (fieldSet) {
setValue();
@@ -634,7 +632,7 @@ Calendar_gregorian::addValue( sal_Int16 fieldIndex, sal_Int32 value )
// since ZONE and DST could not be add, we don't need to convert value here
UErrorCode status = U_ZERO_ERROR;
body->add(fieldNameConverter(fieldIndex), value, status);
- if ( !U_SUCCESS(status) ) throw ERROR;
+ if ( !U_SUCCESS(status) ) throw RuntimeException();
getValue();
}
@@ -831,46 +829,46 @@ Calendar_gregorian::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_I
case CalendarDisplayIndex::AM_PM:/* ==0 */
if (idx == 0) aStr = LocaleDataImpl::get()->getLocaleItem(aLocale).timeAM;
else if (idx == 1) aStr = LocaleDataImpl::get()->getLocaleItem(aLocale).timePM;
- else throw ERROR;
+ else throw RuntimeException();
break;
case CalendarDisplayIndex::DAY:
- if( idx >= aCalendar.Days.getLength() ) throw ERROR;
+ if( idx >= aCalendar.Days.getLength() ) throw RuntimeException();
if (nameType == 0) aStr = aCalendar.Days[idx].AbbrevName;
else if (nameType == 1) aStr = aCalendar.Days[idx].FullName;
else if (nameType == 2) aStr = aCalendar.Days[idx].NarrowName;
- else throw ERROR;
+ else throw RuntimeException();
break;
case CalendarDisplayIndex::MONTH:
- if( idx >= aCalendar.Months.getLength() ) throw ERROR;
+ if( idx >= aCalendar.Months.getLength() ) throw RuntimeException();
if (nameType == 0) aStr = aCalendar.Months[idx].AbbrevName;
else if (nameType == 1) aStr = aCalendar.Months[idx].FullName;
else if (nameType == 2) aStr = aCalendar.Months[idx].NarrowName;
- else throw ERROR;
+ else throw RuntimeException();
break;
case CalendarDisplayIndex::GENITIVE_MONTH:
- if( idx >= aCalendar.GenitiveMonths.getLength() ) throw ERROR;
+ if( idx >= aCalendar.GenitiveMonths.getLength() ) throw RuntimeException();
if (nameType == 0) aStr = aCalendar.GenitiveMonths[idx].AbbrevName;
else if (nameType == 1) aStr = aCalendar.GenitiveMonths[idx].FullName;
else if (nameType == 2) aStr = aCalendar.GenitiveMonths[idx].NarrowName;
- else throw ERROR;
+ else throw RuntimeException();
break;
case CalendarDisplayIndex::PARTITIVE_MONTH:
- if( idx >= aCalendar.PartitiveMonths.getLength() ) throw ERROR;
+ if( idx >= aCalendar.PartitiveMonths.getLength() ) throw RuntimeException();
if (nameType == 0) aStr = aCalendar.PartitiveMonths[idx].AbbrevName;
else if (nameType == 1) aStr = aCalendar.PartitiveMonths[idx].FullName;
else if (nameType == 2) aStr = aCalendar.PartitiveMonths[idx].NarrowName;
- else throw ERROR;
+ else throw RuntimeException();
break;
case CalendarDisplayIndex::ERA:
- if( idx >= aCalendar.Eras.getLength() ) throw ERROR;
+ if( idx >= aCalendar.Eras.getLength() ) throw RuntimeException();
if (nameType == 0) aStr = aCalendar.Eras[idx].AbbrevName;
else if (nameType == 1) aStr = aCalendar.Eras[idx].FullName;
- else throw ERROR;
+ else throw RuntimeException();
break;
case CalendarDisplayIndex::YEAR:
break;
default:
- throw ERROR;
+ throw RuntimeException();
}
return aStr;
}
@@ -985,7 +983,7 @@ Calendar_gregorian::getDisplayStringImpl( sal_Int32 nCalendarDisplayCode, sal_In
getDisplayStringImpl( CalendarDisplayCode::LONG_YEAR, nNativeNumberMode, true );
default:
- throw ERROR;
+ throw RuntimeException();
}
aOUStr = OUString::createFromAscii(aStr);
}
diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx
index 46368d88e167..8649eccfc807 100644
--- a/i18npool/source/transliteration/transliterationImpl.cxx
+++ b/i18npool/source/transliteration/transliterationImpl.cxx
@@ -40,8 +40,6 @@ using namespace com::sun::star::lang;
namespace i18npool {
-#define ERROR RuntimeException()
-
#define TmItem1( name ) \
{TransliterationModules_##name, TransliterationModulesNew_##name, #name}
@@ -162,7 +160,7 @@ TransliterationImpl::getName()
return bodyCascade[0]->getName();
if (numCascade < 1)
return ( OUString("Not Loaded"));
- throw ERROR;
+ throw RuntimeException();
}
sal_Int16 SAL_CALL
@@ -172,7 +170,7 @@ TransliterationImpl::getType()
return (TransliterationType::CASCADE|TransliterationType::IGNORE);
if (numCascade > 0 && bodyCascade[0].is())
return bodyCascade[0]->getType();
- throw ERROR;
+ throw RuntimeException();
}
static TransliterationModules operator&(TransliterationModules lhs, TransliterationModules rhs) {
@@ -189,7 +187,7 @@ TransliterationImpl::loadModule( TransliterationModules modType, const Locale& r
if (bool(modType & TransliterationModules_IGNORE_MASK) &&
bool(modType & TransliterationModules_NON_IGNORE_MASK))
{
- throw ERROR;
+ throw RuntimeException();
} else if (bool(modType & TransliterationModules_IGNORE_MASK)) {
#define TransliterationModules_IGNORE_CASE_MASK (TransliterationModules_IGNORE_CASE | \
TransliterationModules_IGNORE_WIDTH | \
@@ -230,7 +228,7 @@ TransliterationImpl::loadModuleNew( const Sequence < TransliterationModulesNew >
TransliterationModules mask = TransliterationModules_END_OF_MODULE;
sal_Int32 count = modType.getLength();
if (count > maxCascade)
- throw ERROR; // could not handle more than maxCascade
+ throw RuntimeException(); // could not handle more than maxCascade
for (sal_Int32 i = 0; i < count; i++) {
for (sal_Int16 j = 0; bool(TMlist[j].tmn); j++) {
if (TMlist[j].tmn == modType[i]) {
@@ -239,7 +237,7 @@ TransliterationImpl::loadModuleNew( const Sequence < TransliterationModulesNew >
TransliterationModules_IGNORE_MASK : TransliterationModules_NON_IGNORE_MASK;
else if (mask == TransliterationModules_IGNORE_MASK &&
(TMlist[i].tm&TransliterationModules_IGNORE_MASK) == TransliterationModules_END_OF_MODULE)
- throw ERROR; // could not mess up ignore trans. with non_ignore trans.
+ throw RuntimeException(); // could not mess up ignore trans. with non_ignore trans.
if (loadModuleByName(OUString::createFromAscii(TMlist[j].implName), bodyCascade[numCascade], rLocale))
numCascade++;
break;
@@ -261,7 +259,7 @@ void SAL_CALL
TransliterationImpl::loadModulesByImplNames(const Sequence< OUString >& implNameList, const Locale& rLocale )
{
if (implNameList.getLength() > maxCascade || implNameList.getLength() <= 0)
- throw ERROR;
+ throw RuntimeException();
clear();
for (const auto& rName : implNameList)
@@ -515,7 +513,7 @@ TransliterationImpl::getRange(const Sequence< OUString > &inStrs,
const Sequence< OUString >& temp = bodyCascade[_numCascade]->transliterateRange(inStrs[j], inStrs[j+1]);
for (const auto& rStr : temp) {
- if ( j_tmp++ >= nMaxOutputLength ) throw ERROR;
+ if ( j_tmp++ >= nMaxOutputLength ) throw RuntimeException();
ostr.push_back(rStr);
}
}