diff options
52 files changed, 157 insertions, 158 deletions
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 32007654544b..47002e0a73be 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -770,7 +770,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ m_aKeyIter = m_aKeyMap.emplace( aKeyIter->first + 1, OKeySetValue(aKeyRow,std::pair<sal_Int32,Reference<XRow> >(1,Reference<XRow>())) ).first; // now we set the bookmark for this row - (_rInsertRow->get())[0] = makeAny((sal_Int32)m_aKeyIter->first); + (_rInsertRow->get())[0] = makeAny(static_cast<sal_Int32>(m_aKeyIter->first)); tryRefetch(_rInsertRow,bRefetch); } } @@ -1085,7 +1085,7 @@ bool OKeySet::absolute_checked( sal_Int32 row, bool /* i_bFetchRow */ ) } else { - if(row >= (sal_Int32)m_aKeyMap.size()) + if(row >= static_cast<sal_Int32>(m_aKeyMap.size())) { // we don't have this row if(!m_bRowCountFinal) diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 9375bab42a04..d130eaac68fb 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1257,7 +1257,7 @@ void ORowSet::impl_restoreDataColumnsWriteable_throw() TDataColumns::const_iterator aIter = m_aDataColumns.begin(); for (auto const& readOnlyDataColumn : m_aReadOnlyDataColumns) { - (*aIter)->setPropertyValue(PROPERTY_ISREADONLY, makeAny( (bool) readOnlyDataColumn) ); + (*aIter)->setPropertyValue(PROPERTY_ISREADONLY, makeAny( static_cast<bool>(readOnlyDataColumn)) ); ++aIter; } m_aReadOnlyDataColumns.clear(); @@ -1476,7 +1476,7 @@ void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandl Reference<XIndexAccess> xParamsAsIndicies = xParameters.is() ? xParameters->getParameters() : Reference<XIndexAccess>(); const sal_Int32 nParamCount = xParamsAsIndicies.is() ? xParamsAsIndicies->getCount() : 0; - if ( m_aParametersSet.size() < (size_t)nParamCount ) + if ( m_aParametersSet.size() < static_cast<size_t>(nParamCount) ) m_aParametersSet.resize( nParamCount ,false); ::dbtools::askForParameters( xComposer, this, m_xActiveConnection, _rxHandler,m_aParametersSet ); @@ -1698,7 +1698,7 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues->get().size() ); for ( size_t i=1; i<=nParamCount; ++i ) { - ORowSetValue& rParamValue( getParameterStorage( (sal_Int32)i ) ); + ORowSetValue& rParamValue( getParameterStorage( static_cast<sal_Int32>(i) ) ); ::dbtools::setObjectWithInfo( xParam, i, rParamValue.makeAny(), rParamValue.getTypeKind() ); m_aParameterValueForCache->get().push_back(rParamValue); } @@ -1906,7 +1906,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey)); pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,makeAny(sal_Int32(i+1))); pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,makeAny(sal_Int32(227))); - pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,makeAny((sal_Int32)0)); + pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,makeAny(sal_Int32(0))); pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN, css::uno::Any(false)); } catch(Exception&) @@ -2470,7 +2470,7 @@ ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex) if ( parameterIndex < 1 ) throwInvalidIndexException( *this ); - if ( m_aParametersSet.size() < (size_t)parameterIndex ) + if ( m_aParametersSet.size() < static_cast<size_t>(parameterIndex) ) m_aParametersSet.resize( parameterIndex ,false); m_aParametersSet[parameterIndex - 1] = true; @@ -2482,13 +2482,13 @@ ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex) impl_disposeParametersContainer_nothrow(); if ( m_pParameters.is() ) { - if ( (size_t)parameterIndex > m_pParameters->size() ) + if ( static_cast<size_t>(parameterIndex) > m_pParameters->size() ) throwInvalidIndexException( *this ); return (*m_pParameters)[ parameterIndex - 1 ]; } } - if ( m_aPrematureParamValues->get().size() < (size_t)parameterIndex ) + if ( m_aPrematureParamValues->get().size() < static_cast<size_t>(parameterIndex) ) m_aPrematureParamValues->get().resize( parameterIndex ); return m_aPrematureParamValues->get()[ parameterIndex - 1 ]; } @@ -2662,7 +2662,7 @@ void SAL_CALL ORowSet::clearParameters( ) size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues->get().size() ); for ( size_t i=1; i<=nParamCount; ++i ) - getParameterStorage( (sal_Int32)i ).setNull(); + getParameterStorage( static_cast<sal_Int32>(i) ).setNull(); m_aParametersSet.clear(); } diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 6cfe0b756002..f7717bc77fa7 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -1188,7 +1188,7 @@ void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow) void ORowSetBase::firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetValue& _rOldValue) { - OSL_ENSURE(_nPos < (sal_Int32)m_aDataColumns.size(),"nPos is invalid!"); + OSL_ENSURE(_nPos < static_cast<sal_Int32>(m_aDataColumns.size()),"nPos is invalid!"); m_aDataColumns[_nPos]->fireValueChange(_rOldValue); } diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index cd5ad186380b..08a82c9dcb91 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -469,7 +469,7 @@ static Any lcl_getBookmark(ORowSetValue& i_aValue,OCacheSet* i_pCacheSet) case DataType::TINYINT: case DataType::SMALLINT: case DataType::INTEGER: - return makeAny((sal_Int32)i_aValue); + return makeAny(static_cast<sal_Int32>(i_aValue)); default: if ( i_pCacheSet && i_aValue.isNull()) i_aValue = i_pCacheSet->getBookmark(); @@ -669,7 +669,7 @@ bool ORowSetCache::next( ) { moveWindow(); - OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); + OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < static_cast<sal_Int32>(m_pMatrix->size()),"Position is behind end()!"); m_aMatrixIter = calcPosition(); checkPositionFlags(); } @@ -829,7 +829,7 @@ void ORowSetCache::moveWindow() if ( m_nStartPos < m_nPosition && m_nPosition <= m_nEndPos ) { // just move inside the window - OSL_ENSURE((m_nPosition - m_nStartPos) <= (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); + OSL_ENSURE((m_nPosition - m_nStartPos) <= static_cast<sal_Int32>(m_pMatrix->size()),"Position is behind end()!"); // make double plus sure that we have fetched that row m_aMatrixIter = calcPosition(); OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(), "New m_aMatrixIter is at end(), but should not."); @@ -1113,7 +1113,7 @@ bool ORowSetCache::last( ) moveWindow(); // we have to repositioning because moveWindow can modify the cache m_xCacheSet->last(); - OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); + OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < static_cast<sal_Int32>(m_pMatrix->size()),"Position is behind end()!"); m_aMatrixIter = calcPosition(); } else @@ -1161,7 +1161,7 @@ bool ORowSetCache::absolute( sal_Int32 row ) m_bBeforeFirst = false; m_bAfterLast = m_nPosition > m_nRowCount; moveWindow(); - OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); + OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < static_cast<sal_Int32>(m_pMatrix->size()),"Position is behind end()!"); m_aMatrixIter = calcPosition(); } } @@ -1231,7 +1231,7 @@ bool ORowSetCache::previous( ) m_bAfterLast = false; --m_nPosition; moveWindow(); - OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); + OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < static_cast<sal_Int32>(m_pMatrix->size()),"Position is behind end()!"); checkPositionFlags(); @@ -1371,7 +1371,7 @@ bool ORowSetCache::deleteRow( ) return false; --m_nRowCount; - OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); + OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < static_cast<sal_Int32>(m_pMatrix->size()),"Position is behind end()!"); ORowSetMatrix::iterator aPos = calcPosition(); (*aPos) = nullptr; @@ -1522,7 +1522,7 @@ void ORowSetCache::checkPositionFlags() void ORowSetCache::checkUpdateConditions(sal_Int32 columnIndex) { - if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->get().size()) + if(m_bAfterLast || columnIndex >= static_cast<sal_Int32>((*m_aInsertRow)->get().size())) throwFunctionSequenceException(m_xSet.get()); } diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 814792990c12..785f74e590ff 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -223,7 +223,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc ,m_aSqlParser( _rContext, &m_aParseContext ) ,m_aSqlIterator( _xConnection, _rxTables, m_aSqlParser ) ,m_aAdditiveIterator( _xConnection, _rxTables, m_aSqlParser ) - ,m_aElementaryParts( (size_t)SQLPartCount ) + ,m_aElementaryParts( size_t(SQLPartCount) ) ,m_xConnection(_xConnection) ,m_xMetaData(_xConnection->getMetaData()) ,m_xConnectionTables( _rxTables ) @@ -571,7 +571,7 @@ void SAL_CALL OSingleSelectQueryComposer::appendGroupByColumn( const Reference< OUString OSingleSelectQueryComposer::composeStatementFromParts( const std::vector< OUString >& _rParts ) { - OSL_ENSURE( _rParts.size() == (size_t)SQLPartCount, "OSingleSelectQueryComposer::composeStatementFromParts: invalid parts array!" ); + OSL_ENSURE( _rParts.size() == size_t(SQLPartCount), "OSingleSelectQueryComposer::composeStatementFromParts: invalid parts array!" ); OUStringBuffer aSql( m_aPureSelectSQL ); for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) ) @@ -648,7 +648,7 @@ void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const // collect the 4 single parts as they're currently set std::vector< OUString > aClauses; - aClauses.reserve( (size_t)SQLPartCount ); + aClauses.reserve( size_t(SQLPartCount) ); for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) ) aClauses.push_back( getSQLPart( eLoopParts, m_aSqlIterator, true ) ); @@ -838,7 +838,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) ::connectivity::parse::OParseColumn::StringMap aColumnNames; sal_Int32 nCount = xResultSetMeta->getColumnCount(); - OSL_ENSURE( (size_t) nCount == aSelectColumns->get().size(), "OSingleSelectQueryComposer::getColumns: inconsistent column counts, this might result in wrong columns!" ); + OSL_ENSURE( static_cast<size_t>(nCount) == aSelectColumns->get().size(), "OSingleSelectQueryComposer::getColumns: inconsistent column counts, this might result in wrong columns!" ); for(sal_Int32 i=1;i<=nCount;++i) { OUString sColumnName = xResultSetMeta->getColumnName(i); @@ -886,7 +886,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) { aSelectColumns->get().emplace_back(::connectivity::parse::OParseColumn::createColumnForResultSet( xResultSetMeta, m_xMetaData, i ,aColumnNames) ); - OSL_ENSURE( aSelectColumns->get().size() == (size_t)i, "OSingleSelectQueryComposer::getColumns: inconsistency!" ); + OSL_ENSURE( aSelectColumns->get().size() == static_cast<size_t>(i), "OSingleSelectQueryComposer::getColumns: inconsistency!" ); } else if ( aRealFind == aSelectColumns->get().end() ) { @@ -928,7 +928,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) else continue; - aUsedSelectColumns.insert( (size_t)(i - 1) ); + aUsedSelectColumns.insert( static_cast<size_t>(i - 1) ); aNames.push_back( sColumnName ); } } @@ -1616,7 +1616,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert const ::sal_Int64 nLength = xClob->length(); if ( sal_Int64(nLength + aSQL.getLength() + STR_LIKE.getLength() ) < sal_Int64(SAL_MAX_INT32) ) { - aSQL.append("'" + xClob->getSubString(1,(sal_Int32)nLength) + "'"); + aSQL.append("'" + xClob->getSubString(1,static_cast<sal_Int32>(nLength)) + "'"); } } else @@ -1641,7 +1641,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert const sal_Int8* pEnd = pBegin + aSeq.getLength(); for(;pBegin != pEnd;++pBegin) { - aSQL.append( (sal_Int32)*pBegin, 16 ); + aSQL.append( static_cast<sal_Int32>(*pBegin), 16 ); } if(nSearchable == ColumnSearch::CHAR) aSQL.append( "\'" ); diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx index 015bcce47b08..6836ceec97c2 100644 --- a/dbaccess/source/core/api/StaticSet.cxx +++ b/dbaccess/source/core/api/StaticSet.cxx @@ -189,14 +189,14 @@ bool OStaticSet::absolute( sal_Int32 row ) sal_Int32 nRow = getRow(); nRow += row; - if(nRow <= (sal_Int32)m_aSet.size()) + if(nRow <= static_cast<sal_Int32>(m_aSet.size())) m_aSetIter = m_aSet.begin() + nRow; else m_aSetIter = m_aSet.begin(); } else if(row > 0) { - if(row >= (sal_Int32)m_aSet.size()) + if(row >= static_cast<sal_Int32>(m_aSet.size())) { if(!m_bEnd) { @@ -205,7 +205,7 @@ bool OStaticSet::absolute( sal_Int32 row ) bNext = fetchRow(); } - if(row > (sal_Int32)m_aSet.size()) + if(row > static_cast<sal_Int32>(m_aSet.size())) m_aSetIter = m_aSet.end(); // check again else m_aSetIter = m_aSet.begin() + row; diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index ac9dadd77f9d..e1bde0c71386 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -999,9 +999,9 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings() AsciiPropertyValue( "IsAutoRetrievingEnabled", makeAny( false ) ), // known LDAP driver settings AsciiPropertyValue( "HostName", makeAny( OUString() ) ), - AsciiPropertyValue( "PortNumber", makeAny( (sal_Int32)389 ) ), + AsciiPropertyValue( "PortNumber", makeAny( sal_Int32(389) ) ), AsciiPropertyValue( "BaseDN", makeAny( OUString() ) ), - AsciiPropertyValue( "MaxRowCount", makeAny( (sal_Int32)100 ) ), + AsciiPropertyValue( "MaxRowCount", makeAny( sal_Int32(100) ) ), // known MySQLNative driver settings AsciiPropertyValue( "LocalSocket", makeAny( OUString() ) ), AsciiPropertyValue( "NamedPipe", makeAny( OUString() ) ), @@ -1020,7 +1020,7 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings() AsciiPropertyValue( "ColumnAliasInOrderBy", makeAny( true ) ), AsciiPropertyValue( "EnableSQL92Check", makeAny( false ) ), AsciiPropertyValue( "BooleanComparisonMode", makeAny( BooleanComparisonMode::EQUAL_INTEGER ) ), - AsciiPropertyValue( "TableTypeFilterMode", makeAny( (sal_Int32)3 ) ), + AsciiPropertyValue( "TableTypeFilterMode", makeAny( sal_Int32(3) ) ), AsciiPropertyValue( "RespectDriverResultSetType", makeAny( false ) ), AsciiPropertyValue( "UseSchemaInSelect", makeAny( true ) ), AsciiPropertyValue( "UseCatalogInSelect", makeAny( true ) ), diff --git a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx index 91050450b72e..5933753ade29 100644 --- a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx +++ b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx @@ -223,7 +223,7 @@ Any SAL_CALL OBookmarkContainer::getByIndex( sal_Int32 _nIndex ) { MutexGuard aGuard(m_rMutex); - if ((_nIndex < 0) || (_nIndex >= (sal_Int32)m_aBookmarksIndexed.size())) + if ((_nIndex < 0) || (_nIndex >= static_cast<sal_Int32>(m_aBookmarksIndexed.size()))) throw IndexOutOfBoundsException(); return makeAny(m_aBookmarksIndexed[_nIndex]->second); diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index e074f78c818f..388a95f4fe47 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -268,7 +268,7 @@ namespace try { if ( _bStart ) - xStatusIndicator->start( OUString(), (sal_Int32)1000000 ); + xStatusIndicator->start( OUString(), sal_Int32(1000000) ); else xStatusIndicator->end(); } @@ -300,7 +300,7 @@ namespace try { - _rxStatusIndicator->start( OUString(), (sal_Int32)1000000 ); + _rxStatusIndicator->start( OUString(), sal_Int32(1000000) ); sal_Int32 nLength = _rCallArgs.getLength(); _rCallArgs.realloc( nLength + 1 ); diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx index 8455a1f38c27..900aa0ae782d 100644 --- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx +++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx @@ -378,7 +378,7 @@ Any SAL_CALL ODefinitionContainer::getByIndex( sal_Int32 _nIndex ) { MutexGuard aGuard(m_aMutex); - if ((_nIndex < 0) || (_nIndex >= (sal_Int32)m_aDocuments.size())) + if ((_nIndex < 0) || (_nIndex >= static_cast<sal_Int32>(m_aDocuments.size()))) throw IndexOutOfBoundsException(); Documents::iterator aPos = m_aDocuments[_nIndex]; diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx index 7b0f8a519f00..aaa506303d5c 100644 --- a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx +++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx @@ -104,7 +104,7 @@ OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex ) { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( (size_t)nIndex < m_pImpl->m_aResults.size() ) + if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() ) { OUString aId = m_pImpl->m_aResults[ nIndex ]->aId; if ( !aId.isEmpty() ) @@ -134,7 +134,7 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex ) { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( (size_t)nIndex < m_pImpl->m_aResults.size() ) + if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() ) { Reference< XContentIdentifier > xId = m_pImpl->m_aResults[ nIndex ]->xId; if ( xId.is() ) @@ -159,7 +159,7 @@ DataSupplier::queryContent( sal_uInt32 _nIndex ) { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( (size_t)_nIndex < m_pImpl->m_aResults.size() ) + if ( static_cast<size_t>(_nIndex) < m_pImpl->m_aResults.size() ) { Reference< XContent > xContent = m_pImpl->m_aResults[ _nIndex ]->xContent.get(); if ( xContent.is() ) @@ -196,7 +196,7 @@ bool DataSupplier::getResult( sal_uInt32 nIndex ) { osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( (size_t)nIndex < m_pImpl->m_aResults.size() ) + if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() ) { // Result already present. return true; @@ -242,7 +242,7 @@ bool DataSupplier::getResult( sal_uInt32 nIndex ) // Callbacks follow! aGuard.clear(); - if ( (size_t)nOldCount < m_pImpl->m_aResults.size() ) + if ( static_cast<size_t>(nOldCount) < m_pImpl->m_aResults.size() ) xResultSet->rowCountChanged( nOldCount, m_pImpl->m_aResults.size() ); @@ -278,7 +278,7 @@ sal_uInt32 DataSupplier::totalCount() // Callbacks follow! aGuard.clear(); - if ( (size_t)nOldCount < m_pImpl->m_aResults.size() ) + if ( static_cast<size_t>(nOldCount) < m_pImpl->m_aResults.size() ) xResultSet->rowCountChanged( nOldCount, m_pImpl->m_aResults.size() ); @@ -303,7 +303,7 @@ DataSupplier::queryPropertyValues( sal_uInt32 nIndex ) { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( (size_t)nIndex < m_pImpl->m_aResults.size() ) + if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() ) { Reference< XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow; if ( xRow.is() ) @@ -330,7 +330,7 @@ void DataSupplier::releasePropertyValues( sal_uInt32 nIndex ) { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( (size_t)nIndex < m_pImpl->m_aResults.size() ) + if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() ) m_pImpl->m_aResults[ nIndex ]->xRow.clear(); } diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx index 933fc91c1e7f..fbdffabc2090 100644 --- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx +++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx @@ -66,7 +66,7 @@ namespace dbaccess SQLPartCount }; - static void incSQLPart( SQLPart& e ) { e = (SQLPart)(1 + (size_t)e); } + static void incSQLPart( SQLPart& e ) { e = (SQLPart)(1 + static_cast<size_t>(e)); } enum EColumnType { SelectColumns = 0, diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index e1df6ea4b3b1..618331c61c06 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -521,7 +521,7 @@ void SAL_CALL DatabaseDataProvider::setApplyFilter( sal_Bool the_value ) osl::MutexGuard g(m_aMutex); m_xAggregateSet->setPropertyValue( PROPERTY_APPLYFILTER, uno::makeAny( the_value ) ); } - set(PROPERTY_APPLYFILTER,(bool)the_value,m_ApplyFilter); + set(PROPERTY_APPLYFILTER,static_cast<bool>(the_value),m_ApplyFilter); } OUString SAL_CALL DatabaseDataProvider::getHavingClause() @@ -577,7 +577,7 @@ sal_Bool SAL_CALL DatabaseDataProvider::getEscapeProcessing() void SAL_CALL DatabaseDataProvider::setEscapeProcessing(sal_Bool the_value) { - set(PROPERTY_ESCAPE_PROCESSING,(bool)the_value,m_EscapeProcessing); + set(PROPERTY_ESCAPE_PROCESSING,static_cast<bool>(the_value),m_EscapeProcessing); } ::sal_Int32 SAL_CALL DatabaseDataProvider::getRowLimit() diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index fafabd715df0..194aff4717ab 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -553,20 +553,20 @@ ODsnTypeCollection::TypeIterator::~TypeIterator() OUString const & ODsnTypeCollection::TypeIterator::getDisplayName() const { - OSL_ENSURE(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size(), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!"); + OSL_ENSURE(m_nPosition < static_cast<sal_Int32>(m_pContainer->m_aDsnTypesDisplayNames.size()), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!"); return m_pContainer->m_aDsnTypesDisplayNames[m_nPosition]; } OUString const & ODsnTypeCollection::TypeIterator::getURLPrefix() const { - OSL_ENSURE(m_nPosition < (sal_Int32)m_pContainer->m_aDsnPrefixes.size(), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!"); + OSL_ENSURE(m_nPosition < static_cast<sal_Int32>(m_pContainer->m_aDsnPrefixes.size()), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!"); return m_pContainer->m_aDsnPrefixes[m_nPosition]; } const ODsnTypeCollection::TypeIterator& ODsnTypeCollection::TypeIterator::operator++() { - OSL_ENSURE(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size(), "ODsnTypeCollection::TypeIterator::operator++ : invalid position!"); - if (m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size()) + OSL_ENSURE(m_nPosition < static_cast<sal_Int32>(m_pContainer->m_aDsnTypesDisplayNames.size()), "ODsnTypeCollection::TypeIterator::operator++ : invalid position!"); + if (m_nPosition < static_cast<sal_Int32>(m_pContainer->m_aDsnTypesDisplayNames.size())) ++m_nPosition; return *this; } diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.cxx b/dbaccess/source/ext/macromigration/macromigrationpages.cxx index a82b941fea93..ea0ce74c1a5a 100644 --- a/dbaccess/source/ext/macromigration/macromigrationpages.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationpages.cxx @@ -217,7 +217,7 @@ namespace dbmm m_pCurrentObject->SetText( _rObjectName ); m_pCurrentAction->SetText( _rCurrentAction ); m_aCurrentProgress.SetRange( _nRange ); - m_aCurrentProgress.SetValue( (sal_uInt32)0 ); + m_aCurrentProgress.SetValue( sal_uInt32(0) ); // since this is currently called from the main thread, which does not have the chance // to re-schedule, we need to explicitly update the display diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx index b46894ac0a58..a046a68c6ae9 100644 --- a/dbaccess/source/ext/macromigration/migrationlog.cxx +++ b/dbaccess/source/ext/macromigration/migrationlog.cxx @@ -127,7 +127,7 @@ namespace dbmm OSL_ENSURE( !bAlreadyKnown, "MigrationLog::startedDocument: document is already known!" ); #endif - DocumentID nID = (DocumentID)( m_pData->aDocumentLogs.size() + 1 ); + DocumentID nID = static_cast<DocumentID>( m_pData->aDocumentLogs.size() + 1 ); while ( m_pData->aDocumentLogs.find( nID ) != m_pData->aDocumentLogs.end() ) ++nID; diff --git a/dbaccess/source/ext/macromigration/progressmixer.cxx b/dbaccess/source/ext/macromigration/progressmixer.cxx index 4fd482c6cb1b..60318112bdb0 100644 --- a/dbaccess/source/ext/macromigration/progressmixer.cxx +++ b/dbaccess/source/ext/macromigration/progressmixer.cxx @@ -102,10 +102,10 @@ namespace dbmm ++phase ) { - phase->second.nGlobalStart = (sal_uInt32)( nRunningWeight * _rData.nOverallStretch ); + phase->second.nGlobalStart = static_cast<sal_uInt32>( nRunningWeight * _rData.nOverallStretch ); nRunningWeight += phase->second.nWeight; - sal_uInt32 nNextPhaseStart = (sal_uInt32)( nRunningWeight * _rData.nOverallStretch ); + sal_uInt32 nNextPhaseStart = static_cast<sal_uInt32>( nRunningWeight * _rData.nOverallStretch ); phase->second.nGlobalRange = nNextPhaseStart - phase->second.nGlobalStart; } @@ -152,8 +152,7 @@ namespace dbmm const PhaseData& rPhase( m_pData->pCurrentPhase->second ); double nLocalProgress = 1.0 * _nPhaseProgress / rPhase.nRange; - sal_uInt32 nOverallProgress = (sal_uInt32) - ( rPhase.nGlobalStart + nLocalProgress * rPhase.nGlobalRange ); + sal_uInt32 nOverallProgress = static_cast<sal_uInt32>( rPhase.nGlobalStart + nLocalProgress * rPhase.nGlobalRange ); m_pData->rConsumer.advance( nOverallProgress ); } diff --git a/dbaccess/source/ext/macromigration/rangeprogressbar.hxx b/dbaccess/source/ext/macromigration/rangeprogressbar.hxx index b0c4d49fc682..c8800635c196 100644 --- a/dbaccess/source/ext/macromigration/rangeprogressbar.hxx +++ b/dbaccess/source/ext/macromigration/rangeprogressbar.hxx @@ -56,7 +56,7 @@ namespace dbmm void SetValue(sal_uInt32 _nValue) { - m_pBar->SetValue( (sal_uInt16)( 100.0 * _nValue / m_nRange ) ); + m_pBar->SetValue( static_cast<sal_uInt16>( 100.0 * _nValue / m_nRange ) ); } private: diff --git a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx index 8be9d3245d8f..354af2a76cc1 100644 --- a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx +++ b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx @@ -195,7 +195,7 @@ Any OXMLDataSourceSetting::convertString(const css::uno::Type& _rExpectedType, c "OXMLDataSourceSetting::convertString: could not convert \"" << _rReadCharacters << "\" into an integer!"); if (TypeClass_SHORT == _rExpectedType.getTypeClass()) - aReturn <<= (sal_Int16)nValue; + aReturn <<= static_cast<sal_Int16>(nValue); else aReturn <<= nValue; break; diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 099ec1bef8d1..c589a2a8803c 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -2628,7 +2628,7 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) ); if ( aLayoutInfo.has( OUString(INFO_PREVIEW) ) ) { - const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, (sal_Int32)0 ) ); + const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) ); m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode ); if ( getView() ) getContainer()->switchPreview( m_ePreviewMode ); diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index 4cd533fb2b46..940ca99e81ee 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -250,7 +250,7 @@ void OApplicationController::deleteObjects( ElementType _eType, const std::vecto // #i33353# OSL_ENSURE( aThisRound->getLength() - 1 >= 0, "OApplicationController::deleteObjects: empty name?" ); OUStringBuffer sSmallestSiblingName( *aThisRound ); - sSmallestSiblingName.append( (sal_Unicode)( '/' + 1) ); + sSmallestSiblingName.append( sal_Unicode( '/' + 1) ); std::set< OUString >::const_iterator aUpperChildrenBound = aDeleteNames.lower_bound( sSmallestSiblingName.makeStringAndClear() ); for ( std::set< OUString >::const_iterator aObsolete = aThisRound; diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 4dab814aa753..8e4d3931ecc7 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -1263,18 +1263,18 @@ bool OPreviewWindow::ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::R if( aNewSize.Width() && aNewSize.Height() ) { // scale to fit window - const double fGrfWH = (double) aNewSize.Width() / aNewSize.Height(); - const double fWinWH = (double) aWinSize.Width() / aWinSize.Height(); + const double fGrfWH = static_cast<double>(aNewSize.Width()) / aNewSize.Height(); + const double fWinWH = static_cast<double>(aWinSize.Width()) / aWinSize.Height(); if ( fGrfWH < fWinWH ) { - aNewSize.Width() = (long) ( aWinSize.Height() * fGrfWH ); + aNewSize.Width() = static_cast<long>( aWinSize.Height() * fGrfWH ); aNewSize.Height()= aWinSize.Height(); } else { aNewSize.Width() = aWinSize.Width(); - aNewSize.Height()= (long) ( aWinSize.Width() / fGrfWH); + aNewSize.Height()= static_cast<long>( aWinSize.Width() / fGrfWH); } const Point aNewPos( ( aWinSize.Width() - aNewSize.Width() ) >> 1, diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index a4d634bf97d7..d917d79333c2 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -746,7 +746,7 @@ bool SbaXDataBrowserController::Construct(vcl::Window* pParent) // we want to have a grid with a "flat" border Reference< XPropertySet > xGridSet(m_xGridModel, UNO_QUERY); if ( xGridSet.is() ) - xGridSet->setPropertyValue(PROPERTY_BORDER, makeAny((sal_Int16)2)); + xGridSet->setPropertyValue(PROPERTY_BORDER, makeAny(sal_Int16(2))); // marry them @@ -2281,7 +2281,7 @@ Reference< XPropertySet > SbaXDataBrowserController::getBoundField() const return xEmptyReturn; sal_uInt16 nViewPos = xGrid->getCurrentColumnPosition(); sal_uInt16 nCurrentCol = getBrowserView()->View2ModelPos(nViewPos); - if (nCurrentCol == (sal_uInt16)-1) + if (nCurrentCol == sal_uInt16(-1)) return xEmptyReturn; // get the according column from the model @@ -2315,7 +2315,7 @@ IMPL_LINK(SbaXDataBrowserController, OnSearchContextRequest, FmSearchContext&, r if (!IsSearchableControl(xCurrentColumn)) continue; - sal_uInt16 nModelPos = getBrowserView()->View2ModelPos((sal_uInt16)nViewPos); + sal_uInt16 nModelPos = getBrowserView()->View2ModelPos(static_cast<sal_uInt16>(nViewPos)); Reference< XPropertySet > xCurrentColModel(xModelColumns->getByIndex(nModelPos),UNO_QUERY); OUString aName = ::comphelper::getString(xCurrentColModel->getPropertyValue(PROPERTY_CONTROLSOURCE)); diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx index 4660111c2c01..52c2b944659b 100644 --- a/dbaccess/source/ui/browser/formadapter.cxx +++ b/dbaccess/source/ui/browser/formadapter.cxx @@ -1491,14 +1491,14 @@ sal_Bool SAL_CALL SbaXFormAdapter::hasElements() // css::container::XIndexContainer void SAL_CALL SbaXFormAdapter::insertByIndex(sal_Int32 _rIndex, const Any& Element) { - if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) ) + if ( ( _rIndex < 0 ) || ( static_cast<size_t>(_rIndex) >= m_aChildren.size() ) ) throw css::lang::IndexOutOfBoundsException(); implInsert(Element, _rIndex); } void SAL_CALL SbaXFormAdapter::removeByIndex(sal_Int32 _rIndex) { - if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) ) + if ( ( _rIndex < 0 ) || ( static_cast<size_t>(_rIndex) >= m_aChildren.size() ) ) throw css::lang::IndexOutOfBoundsException(); Reference< css::form::XFormComponent > xAffected = *(m_aChildren.begin() + _rIndex); @@ -1527,7 +1527,7 @@ void SAL_CALL SbaXFormAdapter::removeByIndex(sal_Int32 _rIndex) // css::container::XIndexReplace void SAL_CALL SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex, const Any& Element) { - if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) ) + if ( ( _rIndex < 0 ) || ( static_cast<size_t>(_rIndex) >= m_aChildren.size() ) ) throw css::lang::IndexOutOfBoundsException(); // extract the form component @@ -1594,7 +1594,7 @@ sal_Int32 SAL_CALL SbaXFormAdapter::getCount() Any SAL_CALL SbaXFormAdapter::getByIndex(sal_Int32 _rIndex) { - if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) ) + if ( ( _rIndex < 0 ) || ( static_cast<size_t>(_rIndex) >= m_aChildren.size() ) ) throw css::lang::IndexOutOfBoundsException(); Reference< css::form::XFormComponent > xElement = *(m_aChildren.begin() + _rIndex); diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 3d0e8a75aa46..5fe3ed5315af 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -646,7 +646,7 @@ void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rM } // prepend some new items - bool bColAttrs = (nColId != (sal_uInt16)-1) && (nColId != 0); + bool bColAttrs = (nColId != sal_uInt16(-1)) && (nColId != 0); if ( bColAttrs && !bDBIsReadOnly) { sal_uInt16 nPos = 0; @@ -785,7 +785,7 @@ void SbaGridControl::SetColWidth(sal_uInt16 nColId) sal_uInt16 nModelPos = GetModelColumnPos(nColId); Reference< XIndexAccess > xCols(GetPeer()->getColumns(), UNO_QUERY); Reference< XPropertySet > xAffectedCol; - if (xCols.is() && (nModelPos != (sal_uInt16)-1)) + if (xCols.is() && (nModelPos != sal_uInt16(-1))) xAffectedCol.set(xCols->getByIndex(nModelPos), css::uno::UNO_QUERY); if (xAffectedCol.is()) @@ -827,7 +827,7 @@ void SbaGridControl::SetRowHeight() { sal_Int32 nValue = aDlgRowHeight->GetValue(); Any aNewHeight; - if ((sal_Int16)-1 == nValue) + if (sal_Int16(-1) == nValue) { // set to default Reference< XPropertyState > xPropState(xCols, UNO_QUERY); if (xPropState.is()) @@ -864,7 +864,7 @@ void SbaGridControl::SetColAttrs(sal_uInt16 nColId) // get the (UNO) column model Reference< XIndexAccess > xCols(GetPeer()->getColumns(), UNO_QUERY); Reference< XPropertySet > xAffectedCol; - if (xCols.is() && (nModelPos != (sal_uInt16)-1)) + if (xCols.is() && (nModelPos != sal_uInt16(-1))) xAffectedCol.set(xCols->getByIndex(nModelPos), css::uno::UNO_QUERY); // get the field the column is bound to @@ -1008,10 +1008,10 @@ void SbaGridControl::MouseButtonDown( const BrowserMouseEvent& rMEvt) { long nRow = GetRowAtYPosPixel(rMEvt.GetPosPixel().Y()); sal_uInt16 nColPos = GetColumnAtXPosPixel(rMEvt.GetPosPixel().X()); - sal_uInt16 nViewPos = (nColPos == BROWSER_INVALIDID) ? (sal_uInt16)-1 : nColPos-1; + sal_uInt16 nViewPos = (nColPos == BROWSER_INVALIDID) ? sal_uInt16(-1) : nColPos-1; // 'the handle column' and 'no valid column' will both result in a view position of -1 ! - bool bHitEmptySpace = (nRow > GetRowCount()) || (nViewPos == (sal_uInt16)-1); + bool bHitEmptySpace = (nRow > GetRowCount()) || (nViewPos == sal_uInt16(-1)); if (bHitEmptySpace && (rMEvt.GetClicks() == 2) && rMEvt.IsMod1()) Control::MouseButtonDown(rMEvt); @@ -1034,7 +1034,7 @@ void SbaGridControl::StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) // my laziness says 'do it here'...) long nRow = GetRowAtYPosPixel(_rPosPixel.Y()); sal_uInt16 nColPos = GetColumnAtXPosPixel(_rPosPixel.X()); - sal_uInt16 nViewPos = (nColPos == BROWSER_INVALIDID) ? (sal_uInt16)-1 : nColPos-1; + sal_uInt16 nViewPos = (nColPos == BROWSER_INVALIDID) ? sal_uInt16(-1) : nColPos-1; // 'the handle column' and 'no valid column' will both result in a view position of -1 ! bool bCurrentRowVirtual = IsCurrentAppending() && IsModified(); @@ -1076,7 +1076,7 @@ void SbaGridControl::StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) SelectAll(); getMouseEvent().Clear(); - implTransferSelectedRows((sal_Int16)nRow, false); + implTransferSelectedRows(static_cast<sal_Int16>(nRow), false); bHandled = true; } @@ -1101,7 +1101,7 @@ void SbaGridControl::StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) GetDataWindow().ReleaseMouse(); getMouseEvent().Clear(); - DoFieldDrag(nViewPos, (sal_Int16)nRow); + DoFieldDrag(nViewPos, static_cast<sal_Int16>(nRow)); bHandled = true; } @@ -1150,7 +1150,7 @@ void SbaGridControl::DoColumnDrag(sal_uInt16 nColumnPos) void SbaGridControl::CopySelectedRowsToClipboard() { OSL_ENSURE( GetSelectRowCount() > 0, "SbaGridControl::CopySelectedRowsToClipboard: invalid call!" ); - implTransferSelectedRows( (sal_Int16)FirstSelectedRow(), true ); + implTransferSelectedRows( static_cast<sal_Int16>(FirstSelectedRow()), true ); } void SbaGridControl::implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfClipboardFalseIfDrag ) @@ -1166,7 +1166,7 @@ void SbaGridControl::implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfC if ((GetSelectRowCount() == 0) && (nRowPos >= 0)) { aSelectedRows.realloc( 1 ); - aSelectedRows[0] <<= (sal_Int32)(nRowPos + 1); + aSelectedRows[0] <<= static_cast<sal_Int32>(nRowPos + 1); bSelectionBookmarks = false; } else if ( !IsAllSelected() && GetSelectRowCount() ) diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 689c4d2fc480..a66d68ff612b 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -697,7 +697,7 @@ bool SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm makeAny( ColumnValue::NO_NULLS != nNullable ) ); if ( ColumnValue::NO_NULLS == nNullable ) - aDefault <<= (sal_Int16)TRISTATE_FALSE; + aDefault <<= sal_Int16(TRISTATE_FALSE); } break; @@ -746,9 +746,9 @@ bool SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm if ( nType == DataType::BIT || nType == DataType::BOOLEAN ) { if ( aDefault.hasValue() ) - aDefault <<= (comphelper::getString(aDefault).toInt32() == 0) ? (sal_Int16)TRISTATE_FALSE : (sal_Int16)TRISTATE_TRUE; + aDefault <<= (comphelper::getString(aDefault).toInt32() == 0) ? sal_Int16(TRISTATE_FALSE) : sal_Int16(TRISTATE_TRUE); else - aDefault <<= (sal_Int16)TRISTATE_INDET; + aDefault <<= sal_Int16(TRISTATE_INDET); } } @@ -856,7 +856,7 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) if(xProp.is()) { if(!evt.NewValue.hasValue()) - xProp->setPropertyValue(PROPERTY_WIDTH,makeAny((sal_Int32)227)); + xProp->setPropertyValue(PROPERTY_WIDTH,makeAny(sal_Int32(227))); else xProp->setPropertyValue(PROPERTY_WIDTH,evt.NewValue); } @@ -918,7 +918,7 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt) bool bDefault = !evt.NewValue.hasValue(); if (bDefault) - pData->xObjectProperties->setPropertyValue(PROPERTY_ROW_HEIGHT,makeAny((sal_Int32)45)); + pData->xObjectProperties->setPropertyValue(PROPERTY_ROW_HEIGHT,makeAny(sal_Int32(45))); else pData->xObjectProperties->setPropertyValue(PROPERTY_ROW_HEIGHT,evt.NewValue); } @@ -1935,7 +1935,7 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue Any* pSelectionNos = aSelection.getArray(); while (nIdx >= 0) { - *pSelectionNos++ <<= (sal_Int32)(nIdx + 1); + *pSelectionNos++ <<= static_cast<sal_Int32>(nIdx + 1); nIdx = pSelection->NextSelected(); } } @@ -2747,7 +2747,7 @@ void SAL_CALL SbaTableQueryBrowser::elementInserted( const ContainerEvent& _rEve } else { - if ((sal_Int32)m_pTreeView->getListBox().GetChildCount(pEntry) < ( xNames->getElementNames().getLength() - 1 ) ) + if (static_cast<sal_Int32>(m_pTreeView->getListBox().GetChildCount(pEntry)) < ( xNames->getElementNames().getLength() - 1 ) ) { // the item inserts its children on demand, but it has not been expanded yet. So ensure here and // now that it has all items diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx index 94d38e3a76f9..372a65f79598 100644 --- a/dbaccess/source/ui/dlg/CollectionView.cxx +++ b/dbaccess/source/ui/dlg/CollectionView.cxx @@ -275,9 +275,9 @@ void OCollectionView::initCurrentPath() static const char s_sReportsCID[] = "private:reports"; m_bCreateForm = s_sFormsCID == sCID; OUString sPath("/"); - if ( m_bCreateForm && sCID.getLength() != (sal_Int32)strlen(s_sFormsCID)) + if ( m_bCreateForm && sCID.getLength() != static_cast<sal_Int32>(strlen(s_sFormsCID))) sPath = sCID.copy(strlen(s_sFormsCID)); - else if ( !m_bCreateForm && sCID.getLength() != (sal_Int32)strlen(s_sReportsCID) ) + else if ( !m_bCreateForm && sCID.getLength() != static_cast<sal_Int32>(strlen(s_sReportsCID)) ) sPath = sCID.copy(strlen(s_sReportsCID) - 2); m_pFTCurrentPath->SetText(sPath); diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 78249cacf006..1ff255712dd4 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -653,7 +653,7 @@ void ODbDataSourceAdministrationHelper::translateProperties(const SfxItemSet& _r ++aDirect ) { - const SfxPoolItem* pCurrentItem = _rSource.GetItem((sal_uInt16)aDirect->first); + const SfxPoolItem* pCurrentItem = _rSource.GetItem(static_cast<sal_uInt16>(aDirect->first)); if (pCurrentItem) { sal_Int16 nAttributes = PropertyAttribute::READONLY; @@ -709,7 +709,7 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS std::vector< sal_Int32>::const_iterator aDetailsEnd = aDetailIds.end(); for (std::vector< sal_Int32>::const_iterator aIter = aDetailIds.begin();aIter != aDetailsEnd ; ++aIter) { - const SfxPoolItem* pCurrent = _rSource.GetItem((sal_uInt16)*aIter); + const SfxPoolItem* pCurrent = _rSource.GetItem(static_cast<sal_uInt16>(*aIter)); aTranslation = m_aIndirectPropTranslator.find(*aIter); if ( pCurrent && (m_aIndirectPropTranslator.end() != aTranslation) ) { diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx index 8a134b5c84f7..a05b95107716 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx @@ -34,10 +34,10 @@ namespace dbaui { - #define TC_EXTENSION ((short)0x01) // a section specifying the extension of the files to connect to - #define TC_SEPARATORS ((short)0x02) // a section specifying the various separators - #define TC_HEADER ((short)0x04) // a section containing the "Text contains header" check box only - #define TC_CHARSET ((short)0x08) // not yet implemented + #define TC_EXTENSION (short(0x01)) // a section specifying the extension of the files to connect to + #define TC_SEPARATORS (short(0x02)) // a section specifying the various separators + #define TC_HEADER (short(0x04)) // a section containing the "Text contains header" check box only + #define TC_CHARSET (short(0x08)) // not yet implemented // OTextConnectionPage class OTextConnectionHelper final : public TabPage diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 6c92062ef60e..5d55c2b1cf6a 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -189,7 +189,7 @@ void ODbAdminDialog::impl_resetPages(const Reference< XPropertySet >& _rxDatasou aIndirect != rMap.end(); ++aIndirect ) - GetInputSetImpl()->ClearItem( (sal_uInt16)aIndirect->first ); + GetInputSetImpl()->ClearItem( static_cast<sal_uInt16>(aIndirect->first) ); // extract all relevant data from the property set of the data source m_pImpl->translateProperties(_rxDatasource, *GetInputSetImpl()); diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx b/dbaccess/source/ui/dlg/dbfindex.cxx index 0a496280ba2f..0c644aab2f2d 100644 --- a/dbaccess/source/ui/dlg/dbfindex.cxx +++ b/dbaccess/source/ui/dlg/dbfindex.cxx @@ -124,10 +124,10 @@ OTableIndex ODbaseIndexDialog::implRemoveIndex(const OUString& _rName, TableInde _rDisplay.RemoveEntry( _rName ); // adjust selection if necessary - if ((sal_uInt32)nPos == _rList.size()) - _rDisplay.SelectEntryPos((sal_uInt16)nPos-1); + if (static_cast<sal_uInt32>(nPos) == _rList.size()) + _rDisplay.SelectEntryPos(static_cast<sal_uInt16>(nPos)-1); else - _rDisplay.SelectEntryPos((sal_uInt16)nPos); + _rDisplay.SelectEntryPos(static_cast<sal_uInt16>(nPos)); break; } diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 5392fc408700..b0df0e5fbbda 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -387,7 +387,7 @@ void ODbTypeWizDialogSetup::resetPages(const Reference< XPropertySet >& _rxDatas aIndirect != rMap.end(); ++aIndirect ) - getWriteOutputSet()->ClearItem( (sal_uInt16)aIndirect->first ); + getWriteOutputSet()->ClearItem( static_cast<sal_uInt16>(aIndirect->first) ); // extract all relevant data from the property set of the data source m_pImpl->translateProperties(_rxDatasource, *getWriteOutputSet()); diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx index 8ea220d90d8e..c5adf93792b2 100644 --- a/dbaccess/source/ui/dlg/directsql.cxx +++ b/dbaccess/source/ui/dlg/directsql.cxx @@ -135,7 +135,7 @@ namespace dbaui { m_aStatementHistory.pop_front(); m_aNormalizedHistory.pop_front(); - m_pSQLHistory->RemoveEntry((sal_uInt16)0); + m_pSQLHistory->RemoveEntry(sal_uInt16(0)); } } diff --git a/dbaccess/source/ui/dlg/dlgattr.cxx b/dbaccess/source/ui/dlg/dlgattr.cxx index 9562f4bab3dd..e370b53b32ec 100644 --- a/dbaccess/source/ui/dlg/dlgattr.cxx +++ b/dbaccess/source/ui/dlg/dlgattr.cxx @@ -64,7 +64,7 @@ void SbaSbAttrDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage ) SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); if (nPageId == m_nNumberFormatId) { - aSet.Put (SvxNumberInfoItem( pNumberInfoItem->GetNumberFormatter(), (sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO)); + aSet.Put (SvxNumberInfoItem( pNumberInfoItem->GetNumberFormatter(), static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO))); rTabPage.PageCreated(aSet); } } diff --git a/dbaccess/source/ui/dlg/dlgsize.cxx b/dbaccess/source/ui/dlg/dlgsize.cxx index b1b1df3b20f5..e7480552f3e3 100644 --- a/dbaccess/source/ui/dlg/dlgsize.cxx +++ b/dbaccess/source/ui/dlg/dlgsize.cxx @@ -73,7 +73,7 @@ sal_Int32 DlgSize::GetValue() { if (m_pCB_STANDARD->IsChecked()) return -1; - return (sal_Int32)m_pMF_VALUE->GetValue( FUNIT_CM ); + return static_cast<sal_Int32>(m_pMF_VALUE->GetValue( FUNIT_CM )); } IMPL_LINK( DlgSize, CbClickHdl, Button *, pButton, void ) diff --git a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx index a717e0b069cc..75119429fc9c 100644 --- a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx +++ b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx @@ -277,7 +277,7 @@ namespace dbaui bool IndexFieldsControl::implGetFieldDesc(long _nRow, IndexFields::const_iterator& _rPos) { _rPos = m_aFields.end(); - if ((_nRow < 0) || (_nRow >= (sal_Int32)m_aFields.size())) + if ((_nRow < 0) || (_nRow >= static_cast<sal_Int32>(m_aFields.size()))) return false; _rPos = m_aFields.begin() + _nRow; return true; @@ -308,7 +308,7 @@ namespace dbaui else { sal_Int32 nRow = GetCurRow(); - OSL_ENSURE(nRow < (sal_Int32)m_aFields.size(), "IndexFieldsControl::SaveModified: invalid current row!"); + OSL_ENSURE(nRow < static_cast<sal_Int32>(m_aFields.size()), "IndexFieldsControl::SaveModified: invalid current row!"); if (nRow >= 0) // may be -1 in case the control was empty { // remove the field from the selection @@ -388,7 +388,7 @@ namespace dbaui sal_Int32 nCurrentRow = GetCurRow(); sal_Int32 rowCount = GetRowCount(); - OSL_ENSURE(((sal_Int32)(m_aFields.size() + 1)) == rowCount, "IndexFieldsControl::OnListEntrySelected: inconsistence!"); + OSL_ENSURE((static_cast<sal_Int32>(m_aFields.size() + 1)) == rowCount, "IndexFieldsControl::OnListEntrySelected: inconsistence!"); if (!sSelectedEntry.isEmpty() && (nCurrentRow == rowCount - 1) /*&& (!m_nMaxColumnsInIndex || rowCount < m_nMaxColumnsInIndex )*/ ) { // in the last row, an non-empty string has been selected diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index 4e94ca5e1166..5a2a7ba3e33c 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -518,7 +518,7 @@ void DlgFilterCrit::SetLine( int nIdx, const PropertyValue& _rItem, bool _bOr ) ListSelectHdl( *pColumnListControl ); // select the appropriate condition - pPredicateListControl->SelectEntryPos( GetSelectionPos( (sal_Int32)_rItem.Handle, *pPredicateListControl ) ); + pPredicateListControl->SelectEntryPos( GetSelectionPos( static_cast<sal_Int32>(_rItem.Handle), *pPredicateListControl ) ); // initially normalize this value OUString aString( aStr ); diff --git a/dbaccess/source/ui/inc/DExport.hxx b/dbaccess/source/ui/inc/DExport.hxx index 5cc28b790f0d..0224943fbd53 100644 --- a/dbaccess/source/ui/inc/DExport.hxx +++ b/dbaccess/source/ui/inc/DExport.hxx @@ -50,7 +50,7 @@ namespace com { namespace sun { namespace star { } }}} -#define COLUMN_POSITION_NOT_FOUND ((sal_Int32)-1) +#define COLUMN_POSITION_NOT_FOUND (sal_Int32(-1)) class SvNumberFormatter; namespace dbaui diff --git a/dbaccess/source/ui/inc/indexfieldscontrol.hxx b/dbaccess/source/ui/inc/indexfieldscontrol.hxx index 4ec3f9906227..33b5ebc41c87 100644 --- a/dbaccess/source/ui/inc/indexfieldscontrol.hxx +++ b/dbaccess/source/ui/inc/indexfieldscontrol.hxx @@ -80,7 +80,7 @@ namespace dbaui OUString GetRowCellText(const IndexFields::const_iterator& _rRow,sal_uInt16 nColId) const; bool implGetFieldDesc(long _nRow, IndexFields::const_iterator& _rPos); - bool isNewField() const { return GetCurRow() >= (sal_Int32)m_aFields.size(); } + bool isNewField() const { return GetCurRow() >= static_cast<sal_Int32>(m_aFields.size()); } DECL_LINK( OnListEntrySelected, DbaMouseDownListBoxController&, void ); diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index b9c7998a8d4c..6780a35fd4cc 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -232,7 +232,7 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection, m_pTypeInfo->aCreateParams = aValue; ++nPos; aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); - m_pTypeInfo->bNullable = (sal_Int32)aValue == ColumnValue::NULLABLE; + m_pTypeInfo->bNullable = static_cast<sal_Int32>(aValue) == ColumnValue::NULLABLE; ++nPos; aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); // bCaseSensitive @@ -653,7 +653,7 @@ void ODatabaseExport::CreateDefaultColumn(const OUString& _rColumnName) OFieldDescription* pField = new OFieldDescription(); pField->SetType(m_pTypeInfo); pField->SetName(aAlias); - pField->SetPrecision(std::min<sal_Int32>((sal_Int32)255,m_pTypeInfo->nPrecision)); + pField->SetPrecision(std::min<sal_Int32>(sal_Int32(255),m_pTypeInfo->nPrecision)); pField->SetScale(0); pField->SetIsNullable(ColumnValue::NULLABLE); pField->SetAutoIncrement(false); @@ -772,7 +772,7 @@ void ODatabaseExport::adjustFormat() OSL_ENSURE((nColPos) < static_cast<sal_Int32>(m_vNumberFormat.size()),"m_vFormatKey: Illegal index for vector"); OSL_ENSURE((nColPos) < static_cast<sal_Int32>(m_vColumnSize.size()),"m_vColumnSize: Illegal index for vector"); m_vNumberFormat[nColPos] = CheckString(m_sTextToken,m_vNumberFormat[nColPos]); - m_vColumnSize[nColPos] = std::max<sal_Int32>((sal_Int32)m_vColumnSize[nColPos], m_sTextToken.getLength()); + m_vColumnSize[nColPos] = std::max<sal_Int32>(static_cast<sal_Int32>(m_vColumnSize[nColPos]), m_sTextToken.getLength()); } } eraseTokens(); @@ -831,7 +831,7 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R { ODatabaseExport::TPositions::const_iterator aFind = std::find_if(_rvColumns.begin(),_rvColumns.end(), [j] (const ODatabaseExport::TPositions::value_type& tPos) - { return tPos.second == (sal_Int32)(j+1); }); + { return tPos.second == static_cast<sal_Int32>(j+1); }); if ( _rvColumns.end() != aFind && aFind->second != COLUMN_POSITION_NOT_FOUND && aFind->first != COLUMN_POSITION_NOT_FOUND ) { OSL_ENSURE((aFind->first) < static_cast<sal_Int32>(aInsertList.size()),"aInsertList: Illegal index for vector"); diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx index 9493af953f17..2892205962e1 100644 --- a/dbaccess/source/ui/misc/HtmlReader.cxx +++ b/dbaccess/source/ui/misc/HtmlReader.cxx @@ -354,7 +354,7 @@ void OHTMLReader::TableFontOn(FontDescriptor& _rFont,sal_Int32 &_rTextColor) break; case HtmlOptionId::SIZE : { - sal_Int16 nSize = (sal_Int16) rOption.GetNumber(); + sal_Int16 nSize = static_cast<sal_Int16>(rOption.GetNumber()); if ( nSize == 0 ) nSize = 1; else if ( nSize < DBAUI_HTML_FONTSIZES ) @@ -374,7 +374,7 @@ sal_Int16 OHTMLReader::GetWidthPixel( const HTMLOption& rOption ) if ( rOptVal.indexOf('%') != -1 ) { // percentage OSL_ENSURE( m_nColumnWidth, "WIDTH Option: m_nColumnWidth==0 and Width%" ); - return (sal_Int16)((rOption.GetNumber() * m_nColumnWidth) / 100); + return static_cast<sal_Int16>((rOption.GetNumber() * m_nColumnWidth) / 100); } else { @@ -384,7 +384,7 @@ sal_Int16 OHTMLReader::GetWidthPixel( const HTMLOption& rOption ) return 0; } else - return (sal_Int16)rOption.GetNumber(); // pixel + return static_cast<sal_Int16>(rOption.GetNumber()); // pixel } } diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx index 86cc730bd126..0c0d6d6edc65 100644 --- a/dbaccess/source/ui/misc/RtfReader.cxx +++ b/dbaccess/source/ui/misc/RtfReader.cxx @@ -114,9 +114,9 @@ void ORTFReader::NextToken( int nToken ) { switch(nTmpToken2) { - case RTF_RED: aColor.SetRed((sal_uInt8)nTokenValue); break; - case RTF_BLUE: aColor.SetBlue((sal_uInt8)nTokenValue); break; - case RTF_GREEN: aColor.SetGreen((sal_uInt8)nTokenValue); break; + case RTF_RED: aColor.SetRed(static_cast<sal_uInt8>(nTokenValue)); break; + case RTF_BLUE: aColor.SetBlue(static_cast<sal_uInt8>(nTokenValue)); break; + case RTF_GREEN: aColor.SetGreen(static_cast<sal_uInt8>(nTokenValue)); break; default: break; } nTmpToken2 = GetNextToken(); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index ee94235457fb..ca8f0ef4c2fd 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -478,7 +478,7 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, pInfo->aCreateParams = aValue; ++nPos; aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); - pInfo->bNullable = (sal_Int32)aValue == ColumnValue::NULLABLE; + pInfo->bNullable = static_cast<sal_Int32>(aValue) == ColumnValue::NULLABLE; ++nPos; aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); // bCaseSensitive @@ -490,10 +490,10 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, // bUnsigned ++nPos; aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); - pInfo->bCurrency = (bool)aValue; + pInfo->bCurrency = static_cast<bool>(aValue); ++nPos; aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); - pInfo->bAutoIncrement = (bool)aValue; + pInfo->bAutoIncrement = static_cast<bool>(aValue); ++nPos; aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); pInfo->aLocalTypeName = aValue; @@ -769,7 +769,7 @@ void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol, if(callColumnFormatDialog(_pParent,_pFormatter,nDataType,nFormatKey,eJustify,bHasFormat)) { - xAffectedCol->setPropertyValue(PROPERTY_ALIGN, makeAny((sal_Int16)dbaui::mapTextAllign(eJustify))); + xAffectedCol->setPropertyValue(PROPERTY_ALIGN, makeAny(static_cast<sal_Int16>(dbaui::mapTextAllign(eJustify)))); if (bHasFormat) xAffectedCol->setPropertyValue(PROPERTY_FORMATKEY, makeAny(nFormatKey)); @@ -865,7 +865,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent, if (_bHasFormat) { const SfxUInt32Item* pFormat = pSet->GetItem<SfxUInt32Item>(SBA_DEF_FMTVALUE); - _nFormatKey = (sal_Int32)pFormat->GetValue(); + _nFormatKey = static_cast<sal_Int32>(pFormat->GetValue()); } bRet = true; } diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx index 2809c4d761e1..9c276b804bec 100644 --- a/dbaccess/source/ui/querydesign/ConnectionLine.cxx +++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx @@ -91,10 +91,10 @@ namespace if( nEntryPos >= 0 ) { _rNewConPos.Y() += nEntryPos; - _rNewConPos.Y() += (long)( 0.5 * nRowHeight ); + _rNewConPos.Y() += static_cast<long>( 0.5 * nRowHeight ); } else - _rNewConPos.Y() -= (long)( 0.5 * nRowHeight ); + _rNewConPos.Y() -= static_cast<long>( 0.5 * nRowHeight ); long nListBoxBottom = _pWin->GetPosPixel().Y() + pListBox->GetPosPixel().Y() @@ -221,8 +221,8 @@ bool OConnectionLine::RecalcLine() Point aSourceCenter( 0, 0 ); Point aDestCenter( 0, 0 ); - aSourceCenter.X() = pSourceWin->GetPosPixel().X() + (long)( 0.5*pSourceWin->GetSizePixel().Width() ); - aDestCenter.X() = pDestWin->GetPosPixel().X() + (long)( 0.5*pDestWin->GetSizePixel().Width() ); + aSourceCenter.X() = pSourceWin->GetPosPixel().X() + static_cast<long>( 0.5*pSourceWin->GetSizePixel().Width() ); + aDestCenter.X() = pDestWin->GetPosPixel().X() + static_cast<long>( 0.5*pDestWin->GetSizePixel().Width() ); const OTableWindow* pFirstWin = pDestWin; const OTableWindow* pSecondWin = pSourceWin; @@ -296,7 +296,7 @@ double dist_Euklid(const Point &p1, const Point& p2,const Point& pM, Point& q) { Point v(p2 - p1); Point w(pM - p1); - double a = sqrt((double)(v.X()*v.X() + v.Y()*v.Y())); + double a = sqrt(static_cast<double>(v.X()*v.X() + v.Y()*v.Y())); double l = (v.X() * w.Y() - v.Y() * w.X()) / a; double a2 = w.X()*v.X()+w.Y()*v.Y(); a = a2 / (a * a); diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index 26fe97d7423a..f218e2ba0c6a 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -397,7 +397,7 @@ void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin ) pTabWin->disposeOnce(); } - if ( (sal_Int32)m_vTableConnection.size() < (nCount-1) ) // if some connections could be removed + if ( static_cast<sal_Int32>(m_vTableConnection.size()) < (nCount-1) ) // if some connections could be removed modified(); } @@ -1116,7 +1116,7 @@ bool OJoinTableView::IsAddAllowed() Reference < XDatabaseMetaData > xMetaData( xConnection->getMetaData() ); sal_Int32 nMax = xMetaData.is() ? xMetaData->getMaxTablesInSelect() : 0; - if (nMax && nMax <= (sal_Int32)m_aTableMap.size()) + if (nMax && nMax <= static_cast<sal_Int32>(m_aTableMap.size())) return false; } catch(SQLException&) @@ -1335,7 +1335,7 @@ bool OJoinTableView::PreNotify(NotifyEvent& rNEvt) DeselectConn(GetSelectedConn()); else // no win for any reason -> select the next or previous conn - if (i < (sal_Int32)m_vTableConnection.size()) + if (i < static_cast<sal_Int32>(m_vTableConnection.size())) // there is a currently active conn pNextConn = m_vTableConnection[(i + (bForward ? 1 : m_vTableConnection.size() - 1)) % m_vTableConnection.size()].get(); else diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 482133b88553..d8f7489a13ca 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -721,7 +721,7 @@ namespace OTableFields::const_iterator aEnd = _rFieldList.end(); for(;aIter != aEnd;++aIter) { - nMaxCriteria = std::max<sal_uInt16>(nMaxCriteria,(sal_uInt16)(*aIter)->GetCriteria().size()); + nMaxCriteria = std::max<sal_uInt16>(nMaxCriteria,static_cast<sal_uInt16>((*aIter)->GetCriteria().size())); } try { @@ -936,7 +936,7 @@ namespace { aWorkStr += quoteTableAlias(bMulti,pEntryField->GetAlias(),aQuote) + ::dbtools::quoteName(aQuote, aColumnName); } - aWorkStr += " " + OUString( ";ASC;DESC" ).getToken( (sal_uInt16)eOrder, ';' ) + ","; + aWorkStr += " " + OUString( ";ASC;DESC" ).getToken( static_cast<sal_uInt16>(eOrder), ';' ) + ","; } } @@ -1945,7 +1945,7 @@ namespace try { sal_Int32 nMax = xMetaData->getMaxTablesInSelect(); - if ( nMax && nMax < (sal_Int32)aMap.size() ) + if ( nMax && nMax < static_cast<sal_Int32>(aMap.size()) ) { eErrorCode = eTooManyTables; break; diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 514a4bbe3f97..07d27d06147c 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1010,7 +1010,7 @@ bool OSelectionBrowseBox::SaveModified() case BROW_ORDER_ROW: { - strOldCellContents = OUString::number((sal_uInt16)pEntry->GetOrderDir()); + strOldCellContents = OUString::number(static_cast<sal_uInt16>(pEntry->GetOrderDir())); sal_Int32 nIdx = m_pOrderCell->GetSelectedEntryPos(); if (nIdx == LISTBOX_ENTRY_NOTFOUND) nIdx = 0; @@ -1021,7 +1021,7 @@ bool OSelectionBrowseBox::SaveModified() m_pVisibleCell->GetBox().Check(); RowModified(GetBrowseRow(BROW_VIS_ROW), GetCurColumnId()); } - sNewValue = OUString::number((sal_uInt16)pEntry->GetOrderDir()); + sNewValue = OUString::number(static_cast<sal_uInt16>(pEntry->GetOrderDir())); } break; case BROW_COLUMNALIAS_ROW: @@ -1280,8 +1280,8 @@ void OSelectionBrowseBox::RemoveField(sal_uInt16 nColumnId ) sal_uInt16 nPos = GetColumnPos(nColumnId); OSL_ENSURE(getFields().size() > sal_uInt16(nPos-1),"ID is to great!"); - OTableFieldDescRef pDesc = getEntry((sal_uInt32)(nPos - 1)) ; - pDesc->SetColWidth( (sal_uInt16)GetColumnWidth(nColumnId) ); // was not stored this before + OTableFieldDescRef pDesc = getEntry(static_cast<sal_uInt32>(nPos - 1)) ; + pDesc->SetColWidth( static_cast<sal_uInt16>(GetColumnWidth(nColumnId)) ); // was not stored this before // trigger UndoAction if ( !m_bInUndoMode ) @@ -1474,7 +1474,7 @@ tools::Rectangle OSelectionBrowseBox::GetInvalidRect( sal_uInt16 nColId ) void OSelectionBrowseBox::InsertColumn(const OTableFieldDescRef& pEntry, sal_uInt16& _nColumnPosition) { // the control should have exactly one more column: the HandleColumn - OSL_ENSURE(_nColumnPosition == BROWSER_INVALIDID || (_nColumnPosition <= (long)getFields().size()), "OSelectionBrowseBox::InsertColumn : invalid parameter nColId."); + OSL_ENSURE(_nColumnPosition == BROWSER_INVALIDID || (_nColumnPosition <= static_cast<long>(getFields().size())), "OSelectionBrowseBox::InsertColumn : invalid parameter nColId."); // -1 means at the end. Count means at the end, others denotes a correct position sal_uInt16 nCurCol = GetCurColumnId(); @@ -2266,7 +2266,7 @@ void OSelectionBrowseBox::SetCellContents(sal_Int32 nRow, sal_uInt16 nColId, con break; case BROW_ORDER_ROW: { - sal_uInt16 nIdx = (sal_uInt16)strNewText.toInt32(); + sal_uInt16 nIdx = static_cast<sal_uInt16>(strNewText.toInt32()); pEntry->SetOrderDir(EOrderDir(nIdx)); } break; case BROW_COLUMNALIAS_ROW: diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx index f46efb890195..9c09c4b7e076 100644 --- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx +++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx @@ -38,7 +38,7 @@ OTableFieldDesc::OTableFieldDesc() ,m_eOrderDir( ORDER_NONE ) ,m_nIndex(0) ,m_nColWidth(0) - ,m_nColumnId((sal_uInt16)-1) + ,m_nColumnId(sal_uInt16(-1)) ,m_bGroupBy(false) ,m_bVisible(false) { @@ -59,7 +59,7 @@ OTableFieldDesc::OTableFieldDesc(const OUString& rT, const OUString& rF ) ,m_eOrderDir( ORDER_NONE ) ,m_nIndex(0) ,m_nColWidth(0) - ,m_nColumnId((sal_uInt16)-1) + ,m_nColumnId(sal_uInt16(-1)) ,m_bGroupBy(false) ,m_bVisible(false) { @@ -169,8 +169,8 @@ void OTableFieldDesc::Save( ::comphelper::NamedValueCollection& o_rSettings, con o_rSettings.put( "FunctionName", m_aFunctionName ); o_rSettings.put( "DataType", m_eDataType ); o_rSettings.put( "FunctionType", m_eFunctionType ); - o_rSettings.put( "FieldType", (sal_Int32)m_eFieldType ); - o_rSettings.put( "OrderDir", (sal_Int32)m_eOrderDir ); + o_rSettings.put( "FieldType", static_cast<sal_Int32>(m_eFieldType) ); + o_rSettings.put( "OrderDir", static_cast<sal_Int32>(m_eOrderDir) ); o_rSettings.put( "ColWidth", m_nColWidth ); o_rSettings.put( "GroupBy", m_bGroupBy ); o_rSettings.put( "Visible", m_bVisible ); diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 32bf474fad65..94ffa557bcad 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -148,7 +148,7 @@ namespace dbaui if (!_pNode->isToken()) { // rule name as rule: ... - rString = "RULE_ID: " + OUString::number( (sal_Int32)_pNode->getRuleID() ) + + rString = "RULE_ID: " + OUString::number( static_cast<sal_Int32>(_pNode->getRuleID()) ) + "(" + OSQLParser::RuleIDToStr(_pNode->getRuleID()) + ")"; _pParent = _pBox->InsertEntry(rString,_pParent); @@ -1922,7 +1922,7 @@ bool OQueryController::allowQueries() const return false; const NamedValueCollection& rArguments( getInitParams() ); - sal_Int32 nCommandType = rArguments.getOrDefault( PROPERTY_COMMAND_TYPE, (sal_Int32)CommandType::QUERY ); + sal_Int32 nCommandType = rArguments.getOrDefault( PROPERTY_COMMAND_TYPE, sal_Int32(CommandType::QUERY) ); bool bCreatingView = ( nCommandType == CommandType::TABLE ); return !bCreatingView; } diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 65be68236e2d..1126b11fe4be 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -286,8 +286,8 @@ bool OTableEditorCtrl::SetDataPtr( long nRow ) if(nRow == -1) return false; - OSL_ENSURE(nRow < (long)m_pRowList->size(),"Row is greater than size!"); - if(nRow >= (long)m_pRowList->size()) + OSL_ENSURE(nRow < static_cast<long>(m_pRowList->size()),"Row is greater than size!"); + if(nRow >= static_cast<long>(m_pRowList->size())) return false; pActRow = (*m_pRowList)[nRow]; return pActRow != nullptr; diff --git a/dbaccess/source/ui/tabledesign/TableUndo.cxx b/dbaccess/source/ui/tabledesign/TableUndo.cxx index 76564b18569d..d11d53f48ad1 100644 --- a/dbaccess/source/ui/tabledesign/TableUndo.cxx +++ b/dbaccess/source/ui/tabledesign/TableUndo.cxx @@ -328,7 +328,7 @@ void OPrimKeyUndoAct::Undo() long nIndex; // delete inserted keys - for( nIndex = m_aInsKeys.FirstSelected(); nIndex != (long)SFX_ENDOFSELECTION; nIndex=m_aInsKeys.NextSelected() ) + for( nIndex = m_aInsKeys.FirstSelected(); nIndex != long(SFX_ENDOFSELECTION); nIndex=m_aInsKeys.NextSelected() ) { OSL_ENSURE(nIndex <= static_cast<long>(pRowList->size()),"Index for undo isn't valid!"); pRow = (*pRowList)[nIndex]; @@ -336,7 +336,7 @@ void OPrimKeyUndoAct::Undo() } // restore deleted keys - for( nIndex = m_aDelKeys.FirstSelected(); nIndex != (long)SFX_ENDOFSELECTION; nIndex=m_aDelKeys.NextSelected() ) + for( nIndex = m_aDelKeys.FirstSelected(); nIndex != long(SFX_ENDOFSELECTION); nIndex=m_aDelKeys.NextSelected() ) { OSL_ENSURE(nIndex <= static_cast<long>(pRowList->size()),"Index for undo isn't valid!"); pRow = (*pRowList)[nIndex]; @@ -353,11 +353,11 @@ void OPrimKeyUndoAct::Redo() long nIndex; // delete the deleted keys - for( nIndex = m_aDelKeys.FirstSelected(); nIndex != (long)SFX_ENDOFSELECTION; nIndex=m_aDelKeys.NextSelected() ) + for( nIndex = m_aDelKeys.FirstSelected(); nIndex != long(SFX_ENDOFSELECTION); nIndex=m_aDelKeys.NextSelected() ) (*pRowList)[nIndex]->SetPrimaryKey( false ); // restore the inserted keys - for( nIndex = m_aInsKeys.FirstSelected(); nIndex != (long)SFX_ENDOFSELECTION; nIndex=m_aInsKeys.NextSelected() ) + for( nIndex = m_aInsKeys.FirstSelected(); nIndex != long(SFX_ENDOFSELECTION); nIndex=m_aInsKeys.NextSelected() ) (*pRowList)[nIndex]->SetPrimaryKey( true ); m_pEditorCtrl->InvalidateHandleColumn(); diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 2cf9f2c3c2b0..caad6d6ba42e 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1195,7 +1195,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou continue; } - if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= (sal_Int32)aSourceColTypes.size() ) ) + if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= static_cast<sal_Int32>(aSourceColTypes.size()) ) ) { // ( we have to check here against 1 because the parameters are 1 based) ::dbtools::throwSQLException("Internal error: invalid column type index.", ::dbtools::StandardSQLState::INVALID_DESCRIPTOR_INDEX, *this); |