diff options
23 files changed, 94 insertions, 94 deletions
diff --git a/comphelper/qa/container/comphelper_ifcontainer.cxx b/comphelper/qa/container/comphelper_ifcontainer.cxx index 5a6cff89583d..caa54c55398f 100644 --- a/comphelper/qa/container/comphelper_ifcontainer.cxx +++ b/comphelper/qa/container/comphelper_ifcontainer.cxx @@ -112,8 +112,8 @@ namespace comphelper_ifcontainer std::vector< Reference< XInterface > > aElements = pContainer->getElements(); CPPUNIT_ASSERT_EQUAL_MESSAGE("query contents", - (int)aElements.size(), nTests); - if ((int)aElements.size() == nTests) + static_cast<int>(aElements.size()), nTests); + if (static_cast<int>(aElements.size()) == nTests) { for (i = 0; i < nTests; i++) { diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index 734828d047a6..32a3e7c45e2f 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -63,13 +63,13 @@ public: void TestString::testDecimalStringToNumber() { OUString s1("1234"); - CPPUNIT_ASSERT_EQUAL((sal_uInt32)1234, comphelper::string::decimalStringToNumber(s1)); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(1234), comphelper::string::decimalStringToNumber(s1)); s1 += OUStringLiteral1(0x07C6); - CPPUNIT_ASSERT_EQUAL((sal_uInt32)12346, comphelper::string::decimalStringToNumber(s1)); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(12346), comphelper::string::decimalStringToNumber(s1)); // Codepoints on 2 16bits words sal_uInt32 utf16String[] = { 0x1D7FE /* 8 */, 0x1D7F7 /* 1 */}; s1 = OUString(utf16String, 2); - CPPUNIT_ASSERT_EQUAL((sal_uInt32)81, comphelper::string::decimalStringToNumber(s1)); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(81), comphelper::string::decimalStringToNumber(s1)); } void TestString::testIsdigitAsciiString() diff --git a/comphelper/qa/unit/test_hash.cxx b/comphelper/qa/unit/test_hash.cxx index 6ba1ac8225df..f83f91d3286a 100644 --- a/comphelper/qa/unit/test_hash.cxx +++ b/comphelper/qa/unit/test_hash.cxx @@ -38,7 +38,7 @@ std::string tostring(const std::vector<unsigned char>& a) std::stringstream aStrm; for (auto& i:a) { - aStrm << std::setw(2) << std::setfill('0') << std::hex << (int)i; + aStrm << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(i); } return aStrm.str(); diff --git a/comphelper/qa/unit/threadpooltest.cxx b/comphelper/qa/unit/threadpooltest.cxx index 8217abda4133..8148cce941e8 100644 --- a/comphelper/qa/unit/threadpooltest.cxx +++ b/comphelper/qa/unit/threadpooltest.cxx @@ -39,7 +39,7 @@ void ThreadPoolTest::testPreferredConcurrency() { setenv("MAX_CONCURRENCY", std::to_string(nThreads).c_str(), true); nThreads = comphelper::ThreadPool::getPreferredConcurrency(); CPPUNIT_ASSERT_MESSAGE("Expected no more than hardware threads", - nThreads <= (sal_Int32)std::thread::hardware_concurrency()); + nThreads <= static_cast<sal_Int32>(std::thread::hardware_concurrency())); // Revert and check. Again, nothing should change. unsetenv("MAX_CONCURRENCY"); diff --git a/comphelper/source/container/container.cxx b/comphelper/source/container/container.cxx index a2e1833f890c..ce5c2f15f648 100644 --- a/comphelper/source/container/container.cxx +++ b/comphelper/source/container/container.cxx @@ -69,7 +69,7 @@ css::uno::Reference< css::uno::XInterface> const & IndexAccessIterator::Next() xSearchLoop = *o3tl::doAccess<css::uno::Reference<css::uno::XInterface>>(aElement); bCheckingStartingPoint = false; - m_arrChildIndizies.push_back((sal_Int32)0); + m_arrChildIndizies.push_back(sal_Int32(0)); } else { // otherwise, look above and to the right, if possible diff --git a/comphelper/source/container/interfacecontainer2.cxx b/comphelper/source/container/interfacecontainer2.cxx index 678ba70083f8..c22d1641eef0 100644 --- a/comphelper/source/container/interfacecontainer2.cxx +++ b/comphelper/source/container/interfacecontainer2.cxx @@ -105,7 +105,7 @@ void OInterfaceIteratorHelper2::remove() if( bIsList ) { OSL_ASSERT( nRemain >= 0 && - nRemain < (sal_Int32)aData.pAsVector->size() ); + nRemain < static_cast<sal_Int32>(aData.pAsVector->size()) ); rCont.removeInterface( (*aData.pAsVector)[nRemain] ); } else diff --git a/comphelper/source/misc/accessiblekeybindinghelper.cxx b/comphelper/source/misc/accessiblekeybindinghelper.cxx index cf0985966885..d0af74aec1cc 100644 --- a/comphelper/source/misc/accessiblekeybindinghelper.cxx +++ b/comphelper/source/misc/accessiblekeybindinghelper.cxx @@ -86,7 +86,7 @@ namespace comphelper { ::osl::MutexGuard aGuard( m_aMutex ); - if ( nIndex < 0 || nIndex >= (sal_Int32)m_aKeyBindings.size() ) + if ( nIndex < 0 || nIndex >= static_cast<sal_Int32>(m_aKeyBindings.size()) ) throw IndexOutOfBoundsException(); return m_aKeyBindings[nIndex]; diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index 70b8ee0c2a9f..d9452964d11e 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -90,7 +90,7 @@ namespace { while (nSize != 0) { - const sal_uInt64 nToTransfer(std::min(nSize, (sal_uInt64)BACKUP_FILE_HELPER_BLOCK_SIZE)); + const sal_uInt64 nToTransfer(std::min(nSize, sal_uInt64(BACKUP_FILE_HELPER_BLOCK_SIZE))); if (osl::File::E_None == rCandidate->read(static_cast<void*>(aArray), nToTransfer, nBytesTransfer) && nBytesTransfer == nToTransfer) { @@ -1008,7 +1008,7 @@ namespace { while (nSize != 0) { - const sal_uInt64 nToTransfer(std::min(nSize, (sal_uInt64)BACKUP_FILE_HELPER_BLOCK_SIZE)); + const sal_uInt64 nToTransfer(std::min(nSize, sal_uInt64(BACKUP_FILE_HELPER_BLOCK_SIZE))); if (osl::File::E_None != maFile->read(static_cast<void*>(aArray), nToTransfer, nBytesTransfer) || nBytesTransfer != nToTransfer) { @@ -1051,7 +1051,7 @@ namespace while (bOkay && nSize != 0) { - const sal_uInt64 nToTransfer(std::min(nSize, (sal_uInt64)BACKUP_FILE_HELPER_BLOCK_SIZE)); + const sal_uInt64 nToTransfer(std::min(nSize, sal_uInt64(BACKUP_FILE_HELPER_BLOCK_SIZE))); if (osl::File::E_None != maFile->read(static_cast<void*>(aArray), nToTransfer, nBytesTransfer) || nBytesTransfer != nToTransfer) { @@ -1134,7 +1134,7 @@ namespace while (bOkay && nSize != 0) { - const sal_uInt64 nToTransfer(std::min(nSize, (sal_uInt64)BACKUP_FILE_HELPER_BLOCK_SIZE)); + const sal_uInt64 nToTransfer(std::min(nSize, sal_uInt64(BACKUP_FILE_HELPER_BLOCK_SIZE))); if (osl::File::E_None != maFile->read(static_cast<void*>(aArray), nToTransfer, nBytesTransfer) || nBytesTransfer != nToTransfer) { diff --git a/comphelper/source/misc/base64.cxx b/comphelper/source/misc/base64.cxx index ffff98b8e892..e7f20cdfa693 100644 --- a/comphelper/source/misc/base64.cxx +++ b/comphelper/source/misc/base64.cxx @@ -76,20 +76,20 @@ void ThreeByteToFourByte(const sal_Int8* pBuffer, const sal_Int32 nStart, const { case 1: { - nBinaer = ((sal_uInt8)pBuffer[nStart + 0]) << 16; + nBinaer = static_cast<sal_uInt8>(pBuffer[nStart + 0]) << 16; } break; case 2: { - nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) + - (((sal_uInt8)pBuffer[nStart + 1]) << 8); + nBinaer = (static_cast<sal_uInt8>(pBuffer[nStart + 0]) << 16) + + (static_cast<sal_uInt8>(pBuffer[nStart + 1]) << 8); } break; default: { - nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) + - (((sal_uInt8)pBuffer[nStart + 1]) << 8) + - ((sal_uInt8)pBuffer[nStart + 2]); + nBinaer = (static_cast<sal_uInt8>(pBuffer[nStart + 0]) << 16) + + (static_cast<sal_uInt8>(pBuffer[nStart + 1]) << 8) + + static_cast<sal_uInt8>(pBuffer[nStart + 2]); } break; } @@ -171,11 +171,11 @@ sal_Int32 Base64::decodeSomeChars(uno::Sequence<sal_Int8>& rOutBuffer, const OUS (aDecodeBuffer[2] << 6) + aDecodeBuffer[3]; - *pOutBuffer++ = (sal_Int8)((nOut & 0xff0000) >> 16); + *pOutBuffer++ = static_cast<sal_Int8>((nOut & 0xff0000) >> 16); if( nBytesGotFromDecoding > 1 ) - *pOutBuffer++ = (sal_Int8)((nOut & 0xff00) >> 8); + *pOutBuffer++ = static_cast<sal_Int8>((nOut & 0xff00) >> 8); if( nBytesGotFromDecoding > 2 ) - *pOutBuffer++ = (sal_Int8)(nOut & 0xff); + *pOutBuffer++ = static_cast<sal_Int8>(nOut & 0xff); nCharsDecoded = nInBufferPos + 1; nBytesToDecode = 0; nBytesGotFromDecoding = 3; diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 8e3df262a226..9cf2fdffa0a8 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -184,8 +184,8 @@ sal_uInt32 DocPasswordHelper::GetWordHashAsUINT32( { // NO Encoding during conversion! // The specification says that the low byte should be used in case it is not NULL - char nHighChar = (char)( aUString[nInd] >> 8 ); - char nLowChar = (char)( aUString[nInd] & 0xFF ); + char nHighChar = static_cast<char>( aUString[nInd] >> 8 ); + char nLowChar = static_cast<char>( aUString[nInd] & 0xFF ); char nChar = nLowChar ? nLowChar : nHighChar; for ( int nMatrixInd = 0; nMatrixInd < 7; ++nMatrixInd ) @@ -197,7 +197,7 @@ sal_uInt32 DocPasswordHelper::GetWordHashAsUINT32( nLowResult = ( ( ( nLowResult >> 14 ) & 0x0001 ) | ( ( nLowResult << 1 ) & 0x7FFF ) ) ^ nChar; } - nLowResult = (sal_uInt16)( ( ( ( nLowResult >> 14 ) & 0x001 ) | ( ( nLowResult << 1 ) & 0x7FF ) ) ^ nLen ^ 0xCE4B ); + nLowResult = static_cast<sal_uInt16>( ( ( ( nLowResult >> 14 ) & 0x001 ) | ( ( nLowResult << 1 ) & 0x7FF ) ) ^ nLen ^ 0xCE4B ); nResult = ( nHighResult << 16 ) | nLowResult; } diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx index 0d4d6fecb778..7db54fef85a7 100644 --- a/comphelper/source/misc/mimeconfighelper.cxx +++ b/comphelper/source/misc/mimeconfighelper.cxx @@ -56,8 +56,8 @@ OUString MimeConfigurationHelper::GetStringClassIDRepresentation( const uno::Seq if ( nInd == 4 || nInd == 6 || nInd == 8 || nInd == 10 ) aResult += "-"; - sal_Int32 nDigit1 = (sal_Int32)( (sal_uInt8)aClassID[nInd] / 16 ); - sal_Int32 nDigit2 = (sal_uInt8)aClassID[nInd] % 16; + sal_Int32 nDigit1 = static_cast<sal_Int32>( static_cast<sal_uInt8>(aClassID[nInd]) / 16 ); + sal_Int32 nDigit2 = static_cast<sal_uInt8>(aClassID[nInd]) % 16; aResult += OUString::number( nDigit1, 16 ) + OUString::number( nDigit2, 16 ); } } @@ -97,7 +97,7 @@ uno::Sequence< sal_Int8 > MimeConfigurationHelper::GetSequenceClassIDRepresentat if ( nDigit1 > 15 || nDigit2 > 15 ) break; - aResult[nSeqInd++] = (sal_Int8)( nDigit1 * 16 + nDigit2 ); + aResult[nSeqInd++] = static_cast<sal_Int8>( nDigit1 * 16 + nDigit2 ); if ( nStrPointer < nLength && aCharClassID[nStrPointer] == '-' ) nStrPointer++; @@ -723,7 +723,7 @@ OUString MimeConfigurationHelper::GetDefaultFilterFromServiceName( const OUStrin if ( xFilterEnum->nextElement() >>= aProps ) { SequenceAsHashMap aPropsHM( aProps ); - SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aPropsHM.getUnpackedValueOrDefault( "Flags", (sal_Int32)0 )); + SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aPropsHM.getUnpackedValueOrDefault( "Flags", sal_Int32(0) )); // that should be import, export, own filter and not a template filter ( TemplatePath flag ) SfxFilterFlags const nRequired = (SfxFilterFlags::OWN @@ -768,7 +768,7 @@ OUString MimeConfigurationHelper::GetExportFilterFromImportFilter( const OUStrin if ( aImpFilterAny >>= aImpData ) { SequenceAsHashMap aImpFilterHM( aImpData ); - SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aImpFilterHM.getUnpackedValueOrDefault( "Flags", (sal_Int32)0 )); + SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aImpFilterHM.getUnpackedValueOrDefault( "Flags", sal_Int32(0) )); if ( !( nFlags & SfxFilterFlags::IMPORT ) ) { @@ -839,7 +839,7 @@ uno::Sequence< beans::PropertyValue > MimeConfigurationHelper::SearchForFilter( { SequenceAsHashMap aPropsHM( aProps ); SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aPropsHM.getUnpackedValueOrDefault("Flags", - (sal_Int32)0 )); + sal_Int32(0) )); if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) ) { if ( ( nFlags & SfxFilterFlags::DEFAULT ) == SfxFilterFlags::DEFAULT ) @@ -876,14 +876,14 @@ uno::Sequence< sal_Int8 > MimeConfigurationHelper::GetSequenceClassID( sal_uInt3 sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 ) { uno::Sequence< sal_Int8 > aResult( 16 ); - aResult[0] = (sal_Int8)( n1 >> 24 ); - aResult[1] = (sal_Int8)( ( n1 << 8 ) >> 24 ); - aResult[2] = (sal_Int8)( ( n1 << 16 ) >> 24 ); - aResult[3] = (sal_Int8)( ( n1 << 24 ) >> 24 ); - aResult[4] = (sal_Int8)( n2 >> 8 ); - aResult[5] = (sal_Int8)( ( n2 << 8 ) >> 8 ); - aResult[6] = (sal_Int8)( n3 >> 8 ); - aResult[7] = (sal_Int8)( ( n3 << 8 ) >> 8 ); + aResult[0] = static_cast<sal_Int8>( n1 >> 24 ); + aResult[1] = static_cast<sal_Int8>( ( n1 << 8 ) >> 24 ); + aResult[2] = static_cast<sal_Int8>( ( n1 << 16 ) >> 24 ); + aResult[3] = static_cast<sal_Int8>( ( n1 << 24 ) >> 24 ); + aResult[4] = static_cast<sal_Int8>( n2 >> 8 ); + aResult[5] = static_cast<sal_Int8>( ( n2 << 8 ) >> 8 ); + aResult[6] = static_cast<sal_Int8>( n3 >> 8 ); + aResult[7] = static_cast<sal_Int8>( ( n3 << 8 ) >> 8 ); aResult[8] = b8; aResult[9] = b9; aResult[10] = b10; diff --git a/comphelper/source/misc/numberedcollection.cxx b/comphelper/source/misc/numberedcollection.cxx index 6ebfe0c11e39..82225761b189 100644 --- a/comphelper/source/misc/numberedcollection.cxx +++ b/comphelper/source/misc/numberedcollection.cxx @@ -183,7 +183,7 @@ OUString SAL_CALL NumberedCollection::getUntitledPrefix() { // create ordered list of all possible numbers. std::vector< ::sal_Int32 > lPossibleNumbers; - ::sal_Int32 c = (::sal_Int32)m_lComponents.size (); + ::sal_Int32 c = static_cast<::sal_Int32>(m_lComponents.size ()); ::sal_Int32 i = 1; // c can't be less then 0 ... otherwise hash.size() has an error :-) diff --git a/comphelper/source/misc/numbers.cxx b/comphelper/source/misc/numbers.cxx index 977d8e8cbacd..e20b63fbfda3 100644 --- a/comphelper/source/misc/numbers.cxx +++ b/comphelper/source/misc/numbers.cxx @@ -75,7 +75,7 @@ css::uno::Any getNumberFormatDecimals(const css::uno::Reference<css::util::XNumb SAL_WARN("comphelper", "getNumberFormatDecimals : invalid key! (may be created with another formatter ?)"); } } - return css::uno::Any((sal_Int16)0); + return css::uno::Any(sal_Int16(0)); } diff --git a/comphelper/source/misc/profilezone.cxx b/comphelper/source/misc/profilezone.cxx index f2e1c07b061f..12a6172af56d 100644 --- a/comphelper/source/misc/profilezone.cxx +++ b/comphelper/source/misc/profilezone.cxx @@ -32,7 +32,7 @@ void startRecording(bool bStartRecording) { TimeValue systemTime; osl_getSystemTime( &systemTime ); - g_aStartTime = (long long) systemTime.Seconds * 1000000 + systemTime.Nanosec/1000; + g_aStartTime = static_cast<long long>(systemTime.Seconds) * 1000000 + systemTime.Nanosec/1000; g_aNesting = 0; } g_bRecording = bStartRecording; @@ -45,7 +45,7 @@ long long addRecording(const char * aProfileId, long long aCreateTime) { TimeValue systemTime; osl_getSystemTime( &systemTime ); - long long aTime = (long long) systemTime.Seconds * 1000000 + systemTime.Nanosec/1000; + long long aTime = static_cast<long long>(systemTime.Seconds) * 1000000 + systemTime.Nanosec/1000; if (!aProfileId) aProfileId = "(null)"; OUString aString(aProfileId, strlen(aProfileId), RTL_TEXTENCODING_UTF8); diff --git a/comphelper/source/misc/sequence.cxx b/comphelper/source/misc/sequence.cxx index b0b48d275380..9236ee7d9bb6 100644 --- a/comphelper/source/misc/sequence.cxx +++ b/comphelper/source/misc/sequence.cxx @@ -43,7 +43,7 @@ css::uno::Sequence<sal_Int16> findValue(const css::uno::Sequence< OUString >& _r if( nPos>-1 ) { css::uno::Sequence<sal_Int16> aRetSeq( 1 ); - aRetSeq.getArray()[0] = (sal_Int16)nPos; + aRetSeq.getArray()[0] = static_cast<sal_Int16>(nPos); return aRetSeq; } @@ -62,7 +62,7 @@ css::uno::Sequence<sal_Int16> findValue(const css::uno::Sequence< OUString >& _r { if( *pTArray == _rValue ) { - *pReturn = (sal_Int16)i; + *pReturn = static_cast<sal_Int16>(i); ++pReturn; } } diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx index 707512f42d21..3468d6731ac4 100644 --- a/comphelper/source/misc/sequenceashashmap.cxx +++ b/comphelper/source/misc/sequenceashashmap.cxx @@ -146,7 +146,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::beans::NamedVa void SequenceAsHashMap::operator>>(css::uno::Sequence< css::beans::PropertyValue >& lDestination) const { - sal_Int32 c = (sal_Int32)size(); + sal_Int32 c = static_cast<sal_Int32>(size()); lDestination.realloc(c); css::beans::PropertyValue* pDestination = lDestination.getArray(); @@ -163,7 +163,7 @@ void SequenceAsHashMap::operator>>(css::uno::Sequence< css::beans::PropertyValue void SequenceAsHashMap::operator>>(css::uno::Sequence< css::beans::NamedValue >& lDestination) const { - sal_Int32 c = (sal_Int32)size(); + sal_Int32 c = static_cast<sal_Int32>(size()); lDestination.realloc(c); css::beans::NamedValue* pDestination = lDestination.getArray(); diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 131fa704ec86..c63fdd5bf7d7 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -598,8 +598,8 @@ SyntaxHighlighter::Tokenizer::Tokenizer( HighlighterLanguage aLang ): aLanguage( aCharTypeTab[i] |= nHelpMask; for( i = 'A' ; i <= 'Z' ; i++ ) aCharTypeTab[i] |= nHelpMask; - aCharTypeTab[(int)'_'] |= nHelpMask; - aCharTypeTab[(int)'$'] |= nHelpMask; + aCharTypeTab[int('_')] |= nHelpMask; + aCharTypeTab[int('$')] |= nHelpMask; // Digit (can be identifier and number) nHelpMask = CharFlags::InIdentifier | CharFlags::StartNumber | @@ -608,10 +608,10 @@ SyntaxHighlighter::Tokenizer::Tokenizer( HighlighterLanguage aLang ): aLanguage( aCharTypeTab[i] |= nHelpMask; // Add e, E, . and & here manually - aCharTypeTab[(int)'e'] |= CharFlags::InNumber; - aCharTypeTab[(int)'E'] |= CharFlags::InNumber; - aCharTypeTab[(int)'.'] |= CharFlags::InNumber | CharFlags::StartNumber; - aCharTypeTab[(int)'&'] |= CharFlags::StartNumber; + aCharTypeTab[int('e')] |= CharFlags::InNumber; + aCharTypeTab[int('E')] |= CharFlags::InNumber; + aCharTypeTab[int('.')] |= CharFlags::InNumber | CharFlags::StartNumber; + aCharTypeTab[int('&')] |= CharFlags::StartNumber; // Hexadecimal digit for( i = 'a' ; i <= 'f' ; i++ ) @@ -624,43 +624,43 @@ SyntaxHighlighter::Tokenizer::Tokenizer( HighlighterLanguage aLang ): aLanguage( aCharTypeTab[i] |= CharFlags::InOctNumber; // String literal start/end characters - aCharTypeTab[(int)'\''] |= CharFlags::StartString; - aCharTypeTab[(int)'\"'] |= CharFlags::StartString; - aCharTypeTab[(int)'['] |= CharFlags::StartString; - aCharTypeTab[(int)'`'] |= CharFlags::StartString; + aCharTypeTab[int('\'')] |= CharFlags::StartString; + aCharTypeTab[int('\"')] |= CharFlags::StartString; + aCharTypeTab[int('[')] |= CharFlags::StartString; + aCharTypeTab[int('`')] |= CharFlags::StartString; // Operator characters - aCharTypeTab[(int)'!'] |= CharFlags::Operator; - aCharTypeTab[(int)'%'] |= CharFlags::Operator; + aCharTypeTab[int('!')] |= CharFlags::Operator; + aCharTypeTab[int('%')] |= CharFlags::Operator; // aCharTypeTab[(int)'&'] |= CharFlags::Operator; Removed because of #i14140 - aCharTypeTab[(int)'('] |= CharFlags::Operator; - aCharTypeTab[(int)')'] |= CharFlags::Operator; - aCharTypeTab[(int)'*'] |= CharFlags::Operator; - aCharTypeTab[(int)'+'] |= CharFlags::Operator; - aCharTypeTab[(int)','] |= CharFlags::Operator; - aCharTypeTab[(int)'-'] |= CharFlags::Operator; - aCharTypeTab[(int)'/'] |= CharFlags::Operator; - aCharTypeTab[(int)':'] |= CharFlags::Operator; - aCharTypeTab[(int)'<'] |= CharFlags::Operator; - aCharTypeTab[(int)'='] |= CharFlags::Operator; - aCharTypeTab[(int)'>'] |= CharFlags::Operator; - aCharTypeTab[(int)'?'] |= CharFlags::Operator; - aCharTypeTab[(int)'^'] |= CharFlags::Operator; - aCharTypeTab[(int)'|'] |= CharFlags::Operator; - aCharTypeTab[(int)'~'] |= CharFlags::Operator; - aCharTypeTab[(int)'{'] |= CharFlags::Operator; - aCharTypeTab[(int)'}'] |= CharFlags::Operator; + aCharTypeTab[int('(')] |= CharFlags::Operator; + aCharTypeTab[int(')')] |= CharFlags::Operator; + aCharTypeTab[int('*')] |= CharFlags::Operator; + aCharTypeTab[int('+')] |= CharFlags::Operator; + aCharTypeTab[int(',')] |= CharFlags::Operator; + aCharTypeTab[int('-')] |= CharFlags::Operator; + aCharTypeTab[int('/')] |= CharFlags::Operator; + aCharTypeTab[int(':')] |= CharFlags::Operator; + aCharTypeTab[int('<')] |= CharFlags::Operator; + aCharTypeTab[int('=')] |= CharFlags::Operator; + aCharTypeTab[int('>')] |= CharFlags::Operator; + aCharTypeTab[int('?')] |= CharFlags::Operator; + aCharTypeTab[int('^')] |= CharFlags::Operator; + aCharTypeTab[int('|')] |= CharFlags::Operator; + aCharTypeTab[int('~')] |= CharFlags::Operator; + aCharTypeTab[int('{')] |= CharFlags::Operator; + aCharTypeTab[int('}')] |= CharFlags::Operator; // aCharTypeTab[(int)'['] |= CharFlags::Operator; Removed because of #i17826 - aCharTypeTab[(int)']'] |= CharFlags::Operator; - aCharTypeTab[(int)';'] |= CharFlags::Operator; + aCharTypeTab[int(']')] |= CharFlags::Operator; + aCharTypeTab[int(';')] |= CharFlags::Operator; // Space - aCharTypeTab[(int)' ' ] |= CharFlags::Space; - aCharTypeTab[(int)'\t'] |= CharFlags::Space; + aCharTypeTab[int(' ') ] |= CharFlags::Space; + aCharTypeTab[int('\t')] |= CharFlags::Space; // End of line characters - aCharTypeTab[(int)'\r'] |= CharFlags::EOL; - aCharTypeTab[(int)'\n'] |= CharFlags::EOL; + aCharTypeTab[int('\r')] |= CharFlags::EOL; + aCharTypeTab[int('\n')] |= CharFlags::EOL; ppListKeyWords = nullptr; nKeyWordCount = 0; diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx index 8068d4afedb1..a6e0d3ef3982 100644 --- a/comphelper/source/property/propagg.cxx +++ b/comphelper/source/property/propagg.cxx @@ -211,7 +211,7 @@ bool OPropertyArrayAggregationHelper::fillAggregatePropertyInfoByHandle( *_pOriginalHandle = (*i).second.nOriginalHandle; if (_pPropName) { - OSL_ENSURE((*i).second.nPos < (sal_Int32)m_aProperties.size(),"Invalid index for sequence!"); + OSL_ENSURE((*i).second.nPos < static_cast<sal_Int32>(m_aProperties.size()),"Invalid index for sequence!"); const css::beans::Property& rProperty = m_aProperties[(*i).second.nPos]; *_pPropName = rProperty.Name; } diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index 1291f073c690..d70853b849f0 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.cxx @@ -82,7 +82,7 @@ void OPropertyContainerHelper::registerProperty(const OUString& _rName, sal_Int3 "OPropertyContainerHelper::registerProperty: you gave me nonsense : the pointer must be non-NULL"); PropertyDescription aNewProp; - aNewProp.aProperty = Property( _rName, _nHandle, _rMemberType, (sal_Int16)_nAttributes ); + aNewProp.aProperty = Property( _rName, _nHandle, _rMemberType, static_cast<sal_Int16>(_nAttributes) ); aNewProp.eLocated = PropertyDescription::LocationType::DerivedClassRealType; aNewProp.aLocation.pDerivedClassMember = _pPointerToMember; @@ -112,7 +112,7 @@ void OPropertyContainerHelper::registerMayBeVoidProperty(const OUString& _rName, _nAttributes |= PropertyAttribute::MAYBEVOID; PropertyDescription aNewProp; - aNewProp.aProperty = Property( _rName, _nHandle, _rExpectedType, (sal_Int16)_nAttributes ); + aNewProp.aProperty = Property( _rName, _nHandle, _rExpectedType, static_cast<sal_Int16>(_nAttributes) ); aNewProp.eLocated = PropertyDescription::LocationType::DerivedClassAnyType; aNewProp.aLocation.pDerivedClassMember = _pPointerToMember; @@ -132,7 +132,7 @@ void OPropertyContainerHelper::registerPropertyNoMember(const OUString& _rName, "bad initial value"); PropertyDescription aNewProp; - aNewProp.aProperty = Property( _rName, _nHandle, _rType, (sal_Int16)_nAttributes ); + aNewProp.aProperty = Property( _rName, _nHandle, _rType, static_cast<sal_Int16>(_nAttributes) ); aNewProp.eLocated = PropertyDescription::LocationType::HoldMyself; aNewProp.aLocation.nOwnClassVectorIndex = m_aHoldProperties.size(); m_aHoldProperties.push_back(_pInitialValue); @@ -274,7 +274,7 @@ bool OPropertyContainerHelper::convertFastPropertyValue( if (PropertyDescription::LocationType::HoldMyself == aPos->eLocated) { - OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < (sal_Int32)m_aHoldProperties.size(), + OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < static_cast<sal_Int32>(m_aHoldProperties.size()), "OPropertyContainerHelper::convertFastPropertyValue: invalid position !"); auto aIter = m_aHoldProperties.begin() + aPos->aLocation.nOwnClassVectorIndex; pPropContainer = &(*aIter); @@ -414,7 +414,7 @@ void OPropertyContainerHelper::getFastPropertyValue(Any& _rValue, sal_Int32 _nHa switch (aPos->eLocated) { case PropertyDescription::LocationType::HoldMyself: - OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < (sal_Int32)m_aHoldProperties.size(), + OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < static_cast<sal_Int32>(m_aHoldProperties.size()), "OPropertyContainerHelper::convertFastPropertyValue: invalid position !"); _rValue = m_aHoldProperties[aPos->aLocation.nOwnClassVectorIndex]; break; @@ -473,7 +473,7 @@ void OPropertyContainerHelper::describeProperties(Sequence< Property >& _rProps) { pOwnProps->Name = aLoop->aProperty.Name; pOwnProps->Handle = aLoop->aProperty.Handle; - pOwnProps->Attributes = (sal_Int16)aLoop->aProperty.Attributes; + pOwnProps->Attributes = static_cast<sal_Int16>(aLoop->aProperty.Attributes); pOwnProps->Type = aLoop->aProperty.Type; } diff --git a/comphelper/source/streaming/oslfile2streamwrap.cxx b/comphelper/source/streaming/oslfile2streamwrap.cxx index 8a97e038e89e..342c4a907e08 100644 --- a/comphelper/source/streaming/oslfile2streamwrap.cxx +++ b/comphelper/source/streaming/oslfile2streamwrap.cxx @@ -59,7 +59,7 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::readBytes(css::uno::Sequence< sal_Int8 throw css::io::BufferSizeExceededException(OUString(),static_cast<css::uno::XWeak*>(this)); // If the read character < MaxLength, adjust css::uno::Sequence - if (nRead < (sal_uInt32)nBytesToRead) + if (nRead < static_cast<sal_uInt32>(nBytesToRead)) aData.realloc( sal::static_int_cast< sal_Int32 >(nRead) ); return sal::static_int_cast< sal_Int32 >(nRead); diff --git a/comphelper/source/streaming/seqstream.cxx b/comphelper/source/streaming/seqstream.cxx index f1e397d13770..8841b1cf4548 100644 --- a/comphelper/source/streaming/seqstream.cxx +++ b/comphelper/source/streaming/seqstream.cxx @@ -121,7 +121,7 @@ void SAL_CALL SequenceInputStream::seek( sal_Int64 location ) { if ( location > m_aData.getLength() || location < 0 || location > SAL_MAX_INT32 ) throw IllegalArgumentException(); - m_nPos = (sal_Int32) location; + m_nPos = static_cast<sal_Int32>(location); } sal_Int64 SAL_CALL SequenceInputStream::getPosition() diff --git a/comphelper/source/xml/attributelist.cxx b/comphelper/source/xml/attributelist.cxx index a3a22134220a..4484424ba89f 100644 --- a/comphelper/source/xml/attributelist.cxx +++ b/comphelper/source/xml/attributelist.cxx @@ -54,7 +54,7 @@ struct AttributeList_Impl sal_Int16 SAL_CALL AttributeList::getLength() { - return (sal_Int16)(m_pImpl->vecAttribute.size()); + return static_cast<sal_Int16>(m_pImpl->vecAttribute.size()); } OUString SAL_CALL AttributeList::getNameByIndex(sal_Int16 i) diff --git a/include/comphelper/accessibleselectionhelper.hxx b/include/comphelper/accessibleselectionhelper.hxx index c4e060e2b664..f23749377281 100644 --- a/include/comphelper/accessibleselectionhelper.hxx +++ b/include/comphelper/accessibleselectionhelper.hxx @@ -26,7 +26,7 @@ #include <com/sun/star/accessibility/XAccessibleSelection.hpp> #include <comphelper/comphelperdllapi.h> -#define ACCESSIBLE_SELECTION_CHILD_ALL ((sal_Int32)-1) +#define ACCESSIBLE_SELECTION_CHILD_ALL (sal_Int32(-1)) #define ACCESSIBLE_SELECTION_CHILD_SELF ((sal_Int32)-2) |