diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:22:23 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:22:23 +0100 |
commit | 726f3ed546f5b9ac24a064e7e358138ef684b062 (patch) | |
tree | f2ec66ecede60129df7427a55426a7bd57a8a1c8 /i18npool | |
parent | b6c49c46cfde21ad92cd007bdb3531ff0c4e0cb0 (diff) |
More loplugin:cstylecast: i18npool
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: I5ca5f27425c150f58e5ec3f2392dda43a857fc33
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/qa/cppunit/test_textsearch.cxx | 2 | ||||
-rw-r--r-- | i18npool/source/breakiterator/breakiteratorImpl.cxx | 16 | ||||
-rw-r--r-- | i18npool/source/breakiterator/breakiterator_unicode.cxx | 8 | ||||
-rw-r--r-- | i18npool/source/breakiterator/xdictionary.cxx | 2 | ||||
-rw-r--r-- | i18npool/source/calendar/calendar_gregorian.cxx | 6 | ||||
-rw-r--r-- | i18npool/source/calendar/calendar_hijri.cxx | 54 | ||||
-rw-r--r-- | i18npool/source/calendar/calendar_jewish.cxx | 8 | ||||
-rw-r--r-- | i18npool/source/characterclassification/cclass_unicode.cxx | 6 | ||||
-rw-r--r-- | i18npool/source/indexentry/indexentrysupplier_asian.cxx | 4 | ||||
-rw-r--r-- | i18npool/source/localedata/LocaleNode.cxx | 14 | ||||
-rw-r--r-- | i18npool/source/localedata/localedata.cxx | 6 | ||||
-rw-r--r-- | i18npool/source/ordinalsuffix/ordinalsuffix.cxx | 4 | ||||
-rw-r--r-- | i18npool/source/search/levdis.cxx | 2 | ||||
-rw-r--r-- | i18npool/source/textconversion/textconversion_ko.cxx | 2 | ||||
-rw-r--r-- | i18npool/source/textconversion/textconversion_zh.cxx | 4 |
15 files changed, 69 insertions, 69 deletions
diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index be366aa71fdc..af58b89c354b 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -128,7 +128,7 @@ void TestTextSearch::testSearches() CPPUNIT_ASSERT_EQUAL( bStartRes, aRes.startOffset[0] ); CPPUNIT_ASSERT_EQUAL( bEndRes, aRes.endOffset[0] ); - aOptions.transliterateFlags = (int) (TransliterationFlags::IGNORE_CASE + aOptions.transliterateFlags = static_cast<int>(TransliterationFlags::IGNORE_CASE | TransliterationFlags::IGNORE_WIDTH); aOptions.searchString = "([^ ]*)[ ]*([^ ]*)"; m_xSearch->setOptions(aOptions); diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index 0f5cb29dfa84..de45516ec31d 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -361,10 +361,10 @@ sal_Int32 SAL_CALL BreakIteratorImpl::beginOfCharBlock( const OUString& Text, sa { if (CharType == CharType::ANY_CHAR) return 0; if (nStartPos < 0 || nStartPos >= Text.getLength()) return -1; - if (CharType != (sal_Int16)u_charType( Text.iterateCodePoints(&nStartPos, 0))) return -1; + if (CharType != static_cast<sal_Int16>(u_charType( Text.iterateCodePoints(&nStartPos, 0)))) return -1; sal_Int32 nPos=nStartPos; - while(nStartPos > 0 && CharType == (sal_Int16)u_charType(Text.iterateCodePoints(&nPos, -1))) { nStartPos=nPos; } + while(nStartPos > 0 && CharType == static_cast<sal_Int16>(u_charType(Text.iterateCodePoints(&nPos, -1)))) { nStartPos=nPos; } return nStartPos; // begin of char block is inclusive } @@ -375,10 +375,10 @@ sal_Int32 SAL_CALL BreakIteratorImpl::endOfCharBlock( const OUString& Text, sal_ if (CharType == CharType::ANY_CHAR) return strLen; // end of char block is exclusive if (nStartPos < 0 || nStartPos >= strLen) return -1; - if (CharType != (sal_Int16)u_charType(Text.iterateCodePoints(&nStartPos, 0))) return -1; + if (CharType != static_cast<sal_Int16>(u_charType(Text.iterateCodePoints(&nStartPos, 0)))) return -1; sal_uInt32 ch=0; - while(iterateCodePoints(Text, nStartPos, 1, ch) < strLen && CharType == (sal_Int16)u_charType(ch)) {} + while(iterateCodePoints(Text, nStartPos, 1, ch) < strLen && CharType == static_cast<sal_Int16>(u_charType(ch))) {} return nStartPos; // end of char block is exclusive } @@ -388,12 +388,12 @@ sal_Int32 SAL_CALL BreakIteratorImpl::nextCharBlock( const OUString& Text, sal_I if (CharType == CharType::ANY_CHAR) return -1; if (nStartPos < 0 || nStartPos >= Text.getLength()) return -1; - sal_Int16 numberOfChange = (CharType == (sal_Int16)u_charType(Text.iterateCodePoints(&nStartPos, 0))) ? 2 : 1; + sal_Int16 numberOfChange = (CharType == static_cast<sal_Int16>(u_charType(Text.iterateCodePoints(&nStartPos, 0)))) ? 2 : 1; sal_Int32 strLen = Text.getLength(); sal_uInt32 ch=0; while (numberOfChange > 0 && iterateCodePoints(Text, nStartPos, 1, ch) < strLen) { - if ((CharType != (sal_Int16)u_charType(ch)) != (numberOfChange == 1)) + if ((CharType != static_cast<sal_Int16>(u_charType(ch))) != (numberOfChange == 1)) numberOfChange--; } return numberOfChange == 0 ? nStartPos : -1; @@ -405,11 +405,11 @@ sal_Int32 SAL_CALL BreakIteratorImpl::previousCharBlock( const OUString& Text, s if(CharType == CharType::ANY_CHAR) return -1; if (nStartPos < 0 || nStartPos >= Text.getLength()) return -1; - sal_Int16 numberOfChange = (CharType == (sal_Int16)u_charType(Text.iterateCodePoints(&nStartPos, 0))) ? 3 : 2; + sal_Int16 numberOfChange = (CharType == static_cast<sal_Int16>(u_charType(Text.iterateCodePoints(&nStartPos, 0)))) ? 3 : 2; sal_uInt32 ch=0; while (numberOfChange > 0 && iterateCodePoints(Text, nStartPos, -1, ch) >= 0) { - if (((numberOfChange % 2) == 0) != (CharType != (sal_Int16)u_charType(ch))) + if (((numberOfChange % 2) == 0) != (CharType != static_cast<sal_Int16>(u_charType(ch)))) numberOfChange--; if (nStartPos == 0 && numberOfChange > 0) { numberOfChange--; diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 02da856a5b99..6c8148fe048a 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -426,7 +426,7 @@ Boundary SAL_CALL BreakIterator_Unicode::getWordBoundary( const OUString& Text, } else { if(nPos <= 0) { rv.startPos = 0; - rv.endPos = len ? icuBI->mpValue->mpBreakIterator->following((sal_Int32)0) : 0; + rv.endPos = len ? icuBI->mpValue->mpBreakIterator->following(sal_Int32(0)) : 0; } else if(nPos >= len) { rv.startPos = icuBI->mpValue->mpBreakIterator->preceding(len); rv.endPos = len; @@ -506,14 +506,14 @@ LineBreakResults SAL_CALL BreakIterator_Unicode::getLineBreak( pLineBI->preceding(nStartPos + 1); // reset to check correct hyphenation of "word-word" sal_Int32 nStartPosWordEnd = nStartPos; - while (pLineBI->current() < nStartPosWordEnd && u_ispunct((sal_uInt32)Text[nStartPosWordEnd])) // starting punctuation + while (pLineBI->current() < nStartPosWordEnd && u_ispunct(static_cast<sal_uInt32>(Text[nStartPosWordEnd]))) // starting punctuation nStartPosWordEnd --; Boundary wBoundary = getWordBoundary( Text, nStartPosWordEnd, rLocale, WordType::DICTIONARY_WORD, false); nStartPosWordEnd = wBoundary.endPos; - while (nStartPosWordEnd < Text.getLength() && (u_ispunct((sal_uInt32)Text[nStartPosWordEnd]))) // ending punctuation + while (nStartPosWordEnd < Text.getLength() && (u_ispunct(static_cast<sal_uInt32>(Text[nStartPosWordEnd])))) // ending punctuation nStartPosWordEnd ++; nStartPosWordEnd = nStartPosWordEnd - wBoundary.endPos; if (hOptions.hyphenIndex - wBoundary.startPos < nStartPosWordEnd) nStartPosWordEnd = hOptions.hyphenIndex - wBoundary.startPos; @@ -522,7 +522,7 @@ LineBreakResults SAL_CALL BreakIterator_Unicode::getLineBreak( uno::Reference< linguistic2::XHyphenatedWord > aHyphenatedWord; aHyphenatedWord = hOptions.rHyphenator->hyphenate(Text.copy(wBoundary.startPos, wBoundary.endPos - wBoundary.startPos), rLocale, - (sal_Int16) (hOptions.hyphenIndex - wBoundary.startPos - ((hOptions.hyphenIndex == wBoundary.endPos)? nStartPosWordEnd : 0)), hOptions.aHyphenationOptions); + static_cast<sal_Int16>(hOptions.hyphenIndex - wBoundary.startPos - ((hOptions.hyphenIndex == wBoundary.endPos)? nStartPosWordEnd : 0)), hOptions.aHyphenationOptions); if (aHyphenatedWord.is()) { lbr.rHyphenatedWord = aHyphenatedWord; if(wBoundary.startPos + aHyphenatedWord->getHyphenationPos() + 1 < nMinBreakPos ) diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index 2619b350a189..5826b5cca6a8 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -364,7 +364,7 @@ WordBreakCache& xdictionary::getCache(const sal_Unicode *text, Boundary const & while (rCache.wordboundary[i] < rCache.length) { len = 0; // look the continuous white space as one word and cache it - while (u_isWhitespace((sal_uInt32)text[wordBoundary.startPos + rCache.wordboundary[i] + len])) + while (u_isWhitespace(static_cast<sal_uInt32>(text[wordBoundary.startPos + rCache.wordboundary[i] + len]))) len ++; if (len == 0) { diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index 712eeb1ff6d7..072f40b8c36b 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -551,7 +551,7 @@ void Calendar_gregorian::getValue() fieldValue[CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS] = nMillis; } else - fieldValue[fieldIndex] = (sal_Int16) value; + fieldValue[fieldIndex] = static_cast<sal_Int16>(value); // offset 1 since the value for week start day SunDay is different between Calendar and Weekdays. if ( fieldIndex == CalendarFieldIndex::DAY_OF_WEEK ) @@ -716,14 +716,14 @@ Calendar_gregorian::getMinimumNumberOfDaysForFirstWeek() sal_Int16 SAL_CALL Calendar_gregorian::getNumberOfMonthsInYear() { - return (sal_Int16) aCalendar.Months.getLength(); + return static_cast<sal_Int16>(aCalendar.Months.getLength()); } sal_Int16 SAL_CALL Calendar_gregorian::getNumberOfDaysInWeek() { - return (sal_Int16) aCalendar.Days.getLength(); + return static_cast<sal_Int16>(aCalendar.Days.getLength()); } diff --git a/i18npool/source/calendar/calendar_hijri.cxx b/i18npool/source/calendar/calendar_hijri.cxx index 292ee50ba8cd..34586a482557 100644 --- a/i18npool/source/calendar/calendar_hijri.cxx +++ b/i18npool/source/calendar/calendar_hijri.cxx @@ -68,9 +68,9 @@ Calendar_hijri::Calendar_hijri() void Calendar_hijri::mapToGregorian() { if (fieldSet & FIELDS) { - sal_Int32 day = (sal_Int32)fieldSetValue[CalendarFieldIndex::DAY_OF_MONTH]; - sal_Int32 month = (sal_Int32)fieldSetValue[CalendarFieldIndex::MONTH] + 1; - sal_Int32 year = (sal_Int32)fieldSetValue[CalendarFieldIndex::YEAR]; + sal_Int32 day = static_cast<sal_Int32>(fieldSetValue[CalendarFieldIndex::DAY_OF_MONTH]); + sal_Int32 month = static_cast<sal_Int32>(fieldSetValue[CalendarFieldIndex::MONTH]) + 1; + sal_Int32 year = static_cast<sal_Int32>(fieldSetValue[CalendarFieldIndex::YEAR]); if (fieldSetValue[CalendarFieldIndex::ERA] == 0) year *= -1; @@ -78,8 +78,8 @@ void Calendar_hijri::mapToGregorian() fieldSetValue[CalendarFieldIndex::ERA] = year <= 0 ? 0 : 1; fieldSetValue[CalendarFieldIndex::MONTH] = sal::static_int_cast<sal_Int16>(month - 1); - fieldSetValue[CalendarFieldIndex::DAY_OF_MONTH] = (sal_Int16) day; - fieldSetValue[CalendarFieldIndex::YEAR] = (sal_Int16) abs(year); + fieldSetValue[CalendarFieldIndex::DAY_OF_MONTH] = static_cast<sal_Int16>(day); + fieldSetValue[CalendarFieldIndex::YEAR] = static_cast<sal_Int16>(abs(year)); fieldSet |= FIELDS; } } @@ -89,19 +89,19 @@ void Calendar_hijri::mapFromGregorian() { sal_Int32 month, day, year; - day = (sal_Int32)fieldValue[CalendarFieldIndex::DAY_OF_MONTH]; - month = (sal_Int32)fieldValue[CalendarFieldIndex::MONTH] + 1; - year = (sal_Int32)fieldValue[CalendarFieldIndex::YEAR]; + day = static_cast<sal_Int32>(fieldValue[CalendarFieldIndex::DAY_OF_MONTH]); + month = static_cast<sal_Int32>(fieldValue[CalendarFieldIndex::MONTH]) + 1; + year = static_cast<sal_Int32>(fieldValue[CalendarFieldIndex::YEAR]); if (fieldValue[CalendarFieldIndex::ERA] == 0) year *= -1; // Get Hijri date getHijri(&day, &month, &year); - fieldValue[CalendarFieldIndex::DAY_OF_MONTH] = (sal_Int16)day; + fieldValue[CalendarFieldIndex::DAY_OF_MONTH] = static_cast<sal_Int16>(day); fieldValue[CalendarFieldIndex::MONTH] = sal::static_int_cast<sal_Int16>(month - 1); - fieldValue[CalendarFieldIndex::YEAR] = (sal_Int16) abs(year); - fieldValue[CalendarFieldIndex::ERA] = (sal_Int16) year < 1 ? 0 : 1; + fieldValue[CalendarFieldIndex::YEAR] = static_cast<sal_Int16>(abs(year)); + fieldValue[CalendarFieldIndex::ERA] = static_cast<sal_Int16>(year) < 1 ? 0 : 1; } @@ -183,10 +183,10 @@ Calendar_hijri::getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year) julday = getJulianDay(*day, *month, *year); // obtain approx. of how many Synodic months since the beginning of the year 1900 - synmonth = (sal_Int32)(0.5 + (julday - jd1900)/SynPeriod); + synmonth = static_cast<sal_Int32>(0.5 + (julday - jd1900)/SynPeriod); newsyn = synmonth; - prevday = (sal_Int32)julday - 0.5; + prevday = static_cast<sal_Int32>(julday) - 0.5; do { newjd = NewMoon(newsyn); @@ -200,12 +200,12 @@ Calendar_hijri::getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year) syndiff = newsyn - SynRef; // Round up the day - *day = (sal_Int32)(((sal_Int32)julday) - newjd + 0.5); + *day = static_cast<sal_Int32>(static_cast<sal_Int32>(julday) - newjd + 0.5); *month = (syndiff % 12) + 1; // currently not supported //dayOfYear = (sal_Int32)(month * SynPeriod + day); - *year = GregRef + (sal_Int32)(syndiff / 12); + *year = GregRef + static_cast<sal_Int32>(syndiff / 12); // If month negative, consider it previous year if (syndiff != 0 && *month <= 0) { @@ -237,10 +237,10 @@ Calendar_hijri::ToGregorian(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year) jday = NewMoon(nmonth) + *day; // Round-up - jday = (double)((sal_Int32)(jday + 0.5)); + jday = static_cast<double>(static_cast<sal_Int32>(jday + 0.5)); // Use algorithm from "Numerical Recipes in C" - getGregorianDay((sal_Int32)jday, day, month, year); + getGregorianDay(static_cast<sal_Int32>(jday), day, month, year); // Julian -> Gregorian only works for non-negative year if ( *year <= 0 ) { @@ -261,9 +261,9 @@ Calendar_hijri::getGregorianDay(sal_Int32 lJulianDay, sal_Int32 *pnDay, sal_Int3 /* test whether to adjust for the Gregorian calendar crossover */ if (lJulianDay >= GREGORIAN_CROSSOVER) { /* calculate a small adjustment */ - long lAdjust = (long) (((float) (lJulianDay - 1867216) - 0.25) / 36524.25); + long lAdjust = static_cast<long>((static_cast<float>(lJulianDay - 1867216) - 0.25) / 36524.25); - lFactorA = lJulianDay + 1 + lAdjust - ((long) (0.25 * lAdjust)); + lFactorA = lJulianDay + 1 + lAdjust - static_cast<long>(0.25 * lAdjust); } else { /* no adjustment needed */ @@ -271,12 +271,12 @@ Calendar_hijri::getGregorianDay(sal_Int32 lJulianDay, sal_Int32 *pnDay, sal_Int3 } lFactorB = lFactorA + 1524; - lFactorC = (long) (6680.0 + ((float) (lFactorB - 2439870) - 122.1) / 365.25); - lFactorD = (long) (365 * lFactorC + (0.25 * lFactorC)); - lFactorE = (long) ((lFactorB - lFactorD) / 30.6001); + lFactorC = static_cast<long>(6680.0 + (static_cast<float>(lFactorB - 2439870) - 122.1) / 365.25); + lFactorD = static_cast<long>(365 * lFactorC + (0.25 * lFactorC)); + lFactorE = static_cast<long>((lFactorB - lFactorD) / 30.6001); /* now, pull out the day number */ - *pnDay = lFactorB - lFactorD - (long) (30.6001 * lFactorE); + *pnDay = lFactorB - lFactorD - static_cast<long>(30.6001 * lFactorE); /* ...and the month, adjusting it if necessary */ *pnMonth = lFactorE - 1; @@ -314,18 +314,18 @@ Calendar_hijri::getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year) jm = month + 13; } - sal_Int32 intgr = (sal_Int32)((sal_Int32)(365.25 * jy) + (sal_Int32)(30.6001 * jm) + day + 1720995 ); + sal_Int32 intgr = static_cast<sal_Int32>(static_cast<sal_Int32>(365.25 * jy) + static_cast<sal_Int32>(30.6001 * jm) + day + 1720995 ); //check for switch to Gregorian calendar double const gregcal = 15 + 31 * ( 10 + 12 * 1582 ); if( day + 31 * (month + 12 * year) >= gregcal ) { double ja; - ja = (sal_Int32)(0.01 * jy); - intgr += (sal_Int32)(2 - ja + (sal_Int32)(0.25 * ja)); + ja = static_cast<sal_Int32>(0.01 * jy); + intgr += static_cast<sal_Int32>(2 - ja + static_cast<sal_Int32>(0.25 * ja)); } - return (double) intgr; + return static_cast<double>(intgr); } } diff --git a/i18npool/source/calendar/calendar_jewish.cxx b/i18npool/source/calendar/calendar_jewish.cxx index 3dff440e7e1b..1a36ffa5ffad 100644 --- a/i18npool/source/calendar/calendar_jewish.cxx +++ b/i18npool/source/calendar/calendar_jewish.cxx @@ -256,8 +256,8 @@ void Calendar_jewish::mapFromGregorian() fieldValue[CalendarFieldIndex::ERA] = hd.GetYear() <= 0 ? 0 : 1; fieldValue[CalendarFieldIndex::MONTH] = sal::static_int_cast<sal_Int16>( hd.GetMonth() - 1 ); - fieldValue[CalendarFieldIndex::DAY_OF_MONTH] = (sal_Int16)hd.GetDay(); - fieldValue[CalendarFieldIndex::YEAR] = (sal_Int16)(hd.GetYear() <= 0 ? 1 - hd.GetYear() : hd.GetYear()); + fieldValue[CalendarFieldIndex::DAY_OF_MONTH] = static_cast<sal_Int16>(hd.GetDay()); + fieldValue[CalendarFieldIndex::YEAR] = static_cast<sal_Int16>(hd.GetYear() <= 0 ? 1 - hd.GetYear() : hd.GetYear()); } #define FIELDS ((1 << CalendarFieldIndex::ERA) | (1 << CalendarFieldIndex::YEAR) | (1 << CalendarFieldIndex::MONTH) | (1 << CalendarFieldIndex::DAY_OF_MONTH)) @@ -273,8 +273,8 @@ void Calendar_jewish::mapToGregorian() fieldSetValue[CalendarFieldIndex::ERA] = gd.GetYear() <= 0 ? 0 : 1; fieldSetValue[CalendarFieldIndex::MONTH] = sal::static_int_cast<sal_Int16>( gd.GetMonth() - 1 ); - fieldSetValue[CalendarFieldIndex::DAY_OF_MONTH] = (sal_Int16)gd.GetDay(); - fieldSetValue[CalendarFieldIndex::YEAR] = (sal_Int16)(gd.GetYear() <= 0 ? 1 - gd.GetYear() : gd.GetYear()); + fieldSetValue[CalendarFieldIndex::DAY_OF_MONTH] = static_cast<sal_Int16>(gd.GetDay()); + fieldSetValue[CalendarFieldIndex::YEAR] = static_cast<sal_Int16>(gd.GetYear() <= 0 ? 1 - gd.GetYear() : gd.GetYear()); fieldSet |= FIELDS; } } diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx b/i18npool/source/characterclassification/cclass_unicode.cxx index 00f84d5b5472..5b000060c49b 100644 --- a/i18npool/source/characterclassification/cclass_unicode.cxx +++ b/i18npool/source/characterclassification/cclass_unicode.cxx @@ -125,13 +125,13 @@ cclass_Unicode::toTitle( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount, sal_Int16 SAL_CALL cclass_Unicode::getType( const OUString& Text, sal_Int32 nPos ) { if ( nPos < 0 || Text.getLength() <= nPos ) return 0; - return (sal_Int16) u_charType(Text.iterateCodePoints(&nPos, 0)); + return static_cast<sal_Int16>(u_charType(Text.iterateCodePoints(&nPos, 0))); } sal_Int16 SAL_CALL cclass_Unicode::getCharacterDirection( const OUString& Text, sal_Int32 nPos ) { if ( nPos < 0 || Text.getLength() <= nPos ) return 0; - return (sal_Int16) u_charDirection(Text.iterateCodePoints(&nPos, 0)); + return static_cast<sal_Int16>(u_charDirection(Text.iterateCodePoints(&nPos, 0))); } @@ -141,7 +141,7 @@ cclass_Unicode::getScript( const OUString& Text, sal_Int32 nPos ) { // ICU Unicode script type UBlockCode starts from 1 for Basic Latin, // while OO.o enum UnicideScript starts from 0. // To map ICU UBlockCode to OO.o UnicodeScript, it needs to shift 1. - return (sal_Int16) ublock_getCode(Text.iterateCodePoints(&nPos, 0))-1; + return static_cast<sal_Int16>(ublock_getCode(Text.iterateCodePoints(&nPos, 0)))-1; } diff --git a/i18npool/source/indexentry/indexentrysupplier_asian.cxx b/i18npool/source/indexentry/indexentrysupplier_asian.cxx index b535fd934884..e49e64f805a1 100644 --- a/i18npool/source/indexentry/indexentrysupplier_asian.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_asian.cxx @@ -117,7 +117,7 @@ IndexEntrySupplier_asian::getIndexCharacter( const OUString& rIndexEntry, if (func) { sal_Int16 max_index; sal_uInt16** idx=func(&max_index); - if (((sal_Int16)(ch >> 8)) <= max_index) { + if (static_cast<sal_Int16>(ch >> 8) <= max_index) { sal_uInt16 address=idx[0][ch >> 8]; if (address != 0xFFFF) { address=idx[1][address+(ch & 0xFF)]; @@ -185,7 +185,7 @@ IndexEntrySupplier_asian::getPhoneticCandidate( const OUString& rIndexEntry, sal_uInt16** idx=func(&max_index); for (sal_Int32 i=0,j=0; i < rIndexEntry.getLength(); i=j) { sal_uInt32 ch = rIndexEntry.iterateCodePoints(&j); - if (((sal_Int16)(ch>>8)) <= max_index) { + if (static_cast<sal_Int16>(ch>>8) <= max_index) { sal_uInt16 address = idx[0][ch>>8]; if (address != 0xFFFF) { address = idx[1][address + (ch & 0xFF)]; diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 611a8f926a3d..57eab24382da 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -686,7 +686,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const of.writeParameter("FormatUsage", aUsage, formatCount); aFormatIndex = currNodeAttr.getValueByName("formatindex"); - sal_Int16 formatindex = (sal_Int16)aFormatIndex.toInt32(); + sal_Int16 formatindex = static_cast<sal_Int16>(aFormatIndex.toInt32()); // Ensure the new reserved range is not used anymore, free usage start // was up'ed from 50 to 60. if (50 <= formatindex && formatindex < nFirstFreeFormatIndex) @@ -907,7 +907,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const } while (++it != aFormatIndexSet.end() && *it == nNext); } - fprintf( stderr, "Hint: Next free formatindex is %d.\n", (int)nNext); + fprintf( stderr, "Hint: Next free formatindex is %d.\n", static_cast<int>(nNext)); } // Check presence of all required format codes only in first section @@ -1221,13 +1221,13 @@ void LCFormatNode::generateCode (const OFileWriter &of) const incErrorStr( "Error: failed to extract full date acceptance pattern: %s\n", aPattern); fprintf( stderr, " with DateSeparator '%s' from FormatCode '%s' (formatindex=\"%d\")\n", OSTR( OUString(&cDateSep, 1)), OSTR( sTheDateEditFormat), - (int)cssi::NumberFormatIndex::DATE_SYS_DDMMYYYY); + int(cssi::NumberFormatIndex::DATE_SYS_DDMMYYYY)); } else { fprintf( stderr, "Generated date acceptance pattern: '%s' from '%s' (formatindex=\"%d\" and defined DateSeparator '%s')\n", OSTR( aPattern), OSTR( sTheDateEditFormat), - (int)cssi::NumberFormatIndex::DATE_SYS_DDMMYYYY, + int(cssi::NumberFormatIndex::DATE_SYS_DDMMYYYY), OSTR( OUString(&cDateSep, 1))); // Insert at front so full date pattern is first in checks. theDateAcceptancePatterns.insert( theDateAcceptancePatterns.begin(), aPattern); @@ -1240,13 +1240,13 @@ void LCFormatNode::generateCode (const OFileWriter &of) const incErrorStr( "Error: failed to extract 2nd date acceptance pattern: %s\n", aPattern2); fprintf( stderr, " with DateSeparator '%s' from FormatCode '%s' (formatindex=\"%d\")\n", OSTR( OUString(&cDateSep2, 1)), OSTR( sTheDateEditFormat), - (int)cssi::NumberFormatIndex::DATE_SYS_DDMMYYYY); + int(cssi::NumberFormatIndex::DATE_SYS_DDMMYYYY)); } else { fprintf( stderr, "Generated 2nd acceptance pattern: '%s' from '%s' (formatindex=\"%d\")\n", OSTR( aPattern2), OSTR( sTheDateEditFormat), - (int)cssi::NumberFormatIndex::DATE_SYS_DDMMYYYY); + int(cssi::NumberFormatIndex::DATE_SYS_DDMMYYYY)); theDateAcceptancePatterns.insert( theDateAcceptancePatterns.begin(), aPattern2); } } @@ -1961,7 +1961,7 @@ void LCCurrencyNode::generateCode (const OFileWriter &of) const str = currencyNode -> findNode ("CurrencyName") -> getValue(); of.writeParameter("currencyName", str, nbOfCurrencies); str = currencyNode -> findNode ("DecimalPlaces") -> getValue(); - sal_Int16 nDecimalPlaces = (sal_Int16)str.toInt32(); + sal_Int16 nDecimalPlaces = static_cast<sal_Int16>(str.toInt32()); of.writeIntParameter("currencyDecimalPlaces", nbOfCurrencies, nDecimalPlaces); of.writeAsciiString("\n"); }; diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 6347b9a54353..c057f84d2027 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -1305,7 +1305,7 @@ LocaleDataImpl::getContinuousNumberingLevels( const lang::Locale& rLocale ) break; case 1: rVal.Name = "NumberingType"; - rVal.Value <<= (sal_Int16) sVal.toInt32(); + rVal.Value <<= static_cast<sal_Int16>(sVal.toInt32()); break; case 2: rVal.Name = "Suffix"; @@ -1317,7 +1317,7 @@ LocaleDataImpl::getContinuousNumberingLevels( const lang::Locale& rLocale ) break; case 4: rVal.Name = "NatNum"; - rVal.Value <<= (sal_Int16) sVal.toInt32(); + rVal.Value <<= static_cast<sal_Int16>(sVal.toInt32()); break; default: OSL_ASSERT(false); @@ -1561,7 +1561,7 @@ Any OutlineNumbering::getByIndex( sal_Int32 nIndex ) pValues[8].Name = "FirstLineOffset"; pValues[8].Value <<= pTemp->nFirstLineOffset; pValues[9].Name = "Adjust"; - pValues[9].Value <<= (sal_Int16)HoriOrientation::LEFT; + pValues[9].Value <<= sal_Int16(HoriOrientation::LEFT); pValues[10].Name = "Transliteration"; pValues[10].Value <<= pTemp->sTransliteration; pValues[11].Name = "NatNum"; diff --git a/i18npool/source/ordinalsuffix/ordinalsuffix.cxx b/i18npool/source/ordinalsuffix/ordinalsuffix.cxx index b9efd51e1176..1f50ff107d19 100644 --- a/i18npool/source/ordinalsuffix/ordinalsuffix.cxx +++ b/i18npool/source/ordinalsuffix/ordinalsuffix.cxx @@ -84,7 +84,7 @@ uno::Sequence< OUString > SAL_CALL OrdinalSuffixService::getOrdinalSuffix( sal_I return retValue; icu::UnicodeString sFormatWithNoOrdinal; - icu::Formattable ftmNumber((int32_t)nNumber); + icu::Formattable ftmNumber(static_cast<int32_t>(nNumber)); icu::FieldPosition icuPosA; xNumberFormat->format(ftmNumber, sFormatWithNoOrdinal, icuPosA, nCode); if (!U_SUCCESS(nCode)) @@ -102,7 +102,7 @@ uno::Sequence< OUString > SAL_CALL OrdinalSuffixService::getOrdinalSuffix( sal_I // format the string icu::UnicodeString sFormatWithOrdinal; icu::FieldPosition icuPosB; - formatter.format((int32_t)nNumber, ruleSet, sFormatWithOrdinal, icuPosB, nCode); + formatter.format(static_cast<int32_t>(nNumber), ruleSet, sFormatWithOrdinal, icuPosB, nCode); if (!U_SUCCESS(nCode)) continue; diff --git a/i18npool/source/search/levdis.cxx b/i18npool/source/search/levdis.cxx index 6d8330af3852..7795cf7bc168 100644 --- a/i18npool/source/search/levdis.cxx +++ b/i18npool/source/search/levdis.cxx @@ -72,7 +72,7 @@ static sal_Int32 Impl_WLD_StringLen( const sal_Unicode* pStr ) const sal_Unicode* pTempStr = pStr; while( *pTempStr ) pTempStr++; - return (sal_Int32)(pTempStr-pStr); + return static_cast<sal_Int32>(pTempStr-pStr); } // Distance from string to pattern diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx index eb2be10f8cb9..b1dfe5d28cb7 100644 --- a/i18npool/source/textconversion/textconversion_ko.cxx +++ b/i18npool/source/textconversion/textconversion_ko.cxx @@ -98,7 +98,7 @@ sal_Int16 checkScriptType(sal_Unicode c) {UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS, UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS, SCRIPT_HANJA}, }; - UBlockCode block=ublock_getCode((sal_uInt32) c); + UBlockCode block=ublock_getCode(static_cast<sal_uInt32>(c)); sal_uInt16 i; for ( i = 0; i < SAL_N_ELEMENTS(scriptList); i++) { if (block <= scriptList[i].to) break; diff --git a/i18npool/source/textconversion/textconversion_zh.cxx b/i18npool/source/textconversion/textconversion_zh.cxx index 192b0996b765..82f0a0ffaf47 100644 --- a/i18npool/source/textconversion/textconversion_zh.cxx +++ b/i18npool/source/textconversion/textconversion_zh.cxx @@ -215,8 +215,8 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos, } if (!found && index[len+1] - index[len] > 0) { - sal_Int32 bottom = (sal_Int32) index[len]; - sal_Int32 top = (sal_Int32) index[len+1] - 1; + sal_Int32 bottom = static_cast<sal_Int32>(index[len]); + sal_Int32 top = static_cast<sal_Int32>(index[len+1]) - 1; while (bottom <= top && !found) { current = (top + bottom) / 2; |