From ff339c89b51ed571d55c762e43aa1a6ee9ada1cb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 4 Apr 2017 14:13:00 +0200 Subject: loplugin:constantparam part2 Change-Id: I7ec4c946be52a6b56aee908426f95ecacc7b0746 Reviewed-on: https://gerrit.libreoffice.org/36072 Tested-by: Jenkins Reviewed-by: Noel Grandin --- oox/source/core/binarycodec.cxx | 11 ++--------- oox/source/helper/binaryinputstream.cxx | 10 +++++----- oox/source/ole/axcontrol.cxx | 10 +++++----- oox/source/ole/olehelper.cxx | 9 ++++----- oox/source/ole/vbaproject.cxx | 14 +++++++------- 5 files changed, 23 insertions(+), 31 deletions(-) (limited to 'oox') diff --git a/oox/source/core/binarycodec.cxx b/oox/source/core/binarycodec.cxx index 545be4e452c4..30573e3c8c90 100644 --- a/oox/source/core/binarycodec.cxx +++ b/oox/source/core/binarycodec.cxx @@ -112,8 +112,7 @@ sal_uInt16 CodecHelper::getPasswordHash( const AttributeList& rAttribs, sal_Int3 return static_cast< sal_uInt16 >( ((0 <= nPasswordHash) && (nPasswordHash <= SAL_MAX_UINT16)) ? nPasswordHash : 0 ); } -BinaryCodec_XOR::BinaryCodec_XOR( CodecType eCodecType ) : - meCodecType( eCodecType ), +BinaryCodec_XOR::BinaryCodec_XOR() : mnOffset( 0 ), mnBaseKey( 0 ), mnHash( 0 ) @@ -147,13 +146,7 @@ void BinaryCodec_XOR::initKey( const sal_uInt8 pnPassData[ 16 ] ) for (sal_Int32 nIndex = nLen; nIndex < static_cast(sizeof(mpnKey)); ++nIndex, ++pnFillChar ) mpnKey[ nIndex ] = *pnFillChar; - // rotation of key values is application dependent - size_t nRotateSize = 0; - switch( meCodecType ) - { - case CodecType::Excel: nRotateSize = 2; break; - // compiler will warn, if new codec type is introduced and not handled here - } + size_t nRotateSize = 2; // use little-endian base key to create key array sal_uInt8 pnBaseKeyLE[ 2 ]; diff --git a/oox/source/helper/binaryinputstream.cxx b/oox/source/helper/binaryinputstream.cxx index 5a568dc68c49..8df3ca763149 100644 --- a/oox/source/helper/binaryinputstream.cxx +++ b/oox/source/helper/binaryinputstream.cxx @@ -52,7 +52,7 @@ OUString BinaryInputStream::readNulUnicodeArray() return aBuffer.makeStringAndClear(); } -OString BinaryInputStream::readCharArray( sal_Int32 nChars, bool bAllowNulChars ) +OString BinaryInputStream::readCharArray( sal_Int32 nChars ) { if( nChars <= 0 ) return OString(); @@ -63,15 +63,15 @@ OString BinaryInputStream::readCharArray( sal_Int32 nChars, bool bAllowNulChars return OString(); aBuffer.resize( static_cast< size_t >( nCharsRead ) ); - if( !bAllowNulChars ) - ::std::replace( aBuffer.begin(), aBuffer.end(), '\0', '?' ); + // NUL characters are replaced by question marks. + ::std::replace( aBuffer.begin(), aBuffer.end(), '\0', '?' ); return OString(reinterpret_cast(aBuffer.data()), nCharsRead); } -OUString BinaryInputStream::readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding eTextEnc, bool bAllowNulChars ) +OUString BinaryInputStream::readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding eTextEnc ) { - return OStringToOUString( readCharArray( nChars, bAllowNulChars ), eTextEnc ); + return OStringToOUString( readCharArray( nChars ), eTextEnc ); } OUString BinaryInputStream::readUnicodeArray( sal_Int32 nChars, bool bAllowNulChars ) diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 99057af10745..889c7ad7ae05 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -647,14 +647,14 @@ void ControlModelBase::convertSize( PropertyMap& rPropMap, const ControlConverte } ComCtlModelBase::ComCtlModelBase( sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6, - sal_uInt16 nVersion, bool bCommonPart, bool bComplexPart ) : + sal_uInt16 nVersion ) : maFontData( "Tahoma", 82500 ), mnFlags( 0 ), mnVersion( nVersion ), mnDataPartId5( nDataPartId5 ), mnDataPartId6( nDataPartId6 ), - mbCommonPart( bCommonPart ), - mbComplexPart( bComplexPart ) + mbCommonPart( true ), + mbComplexPart( true ) { } @@ -749,7 +749,7 @@ bool ComCtlModelBase::importComplexPart( BinaryInputStream& rInStrm ) } ComCtlScrollBarModel::ComCtlScrollBarModel( sal_uInt16 nVersion ) : - ComCtlModelBase( SAL_MAX_UINT32, COMCTL_ID_SCROLLBAR_60, nVersion, true, true ), + ComCtlModelBase( SAL_MAX_UINT32, COMCTL_ID_SCROLLBAR_60, nVersion ), mnScrollBarFlags( 0x00000011 ), mnLargeChange( 1 ), mnSmallChange( 1 ), @@ -783,7 +783,7 @@ void ComCtlScrollBarModel::importControlData( BinaryInputStream& rInStrm ) } ComCtlProgressBarModel::ComCtlProgressBarModel( sal_uInt16 nVersion ) : - ComCtlModelBase( COMCTL_ID_PROGRESSBAR_50, COMCTL_ID_PROGRESSBAR_60, nVersion, true, true ), + ComCtlModelBase( COMCTL_ID_PROGRESSBAR_50, COMCTL_ID_PROGRESSBAR_60, nVersion ), mfMin( 0.0 ), mfMax( 100.0 ), mnVertical( 0 ), diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index cfc7966eb892..285942923cc6 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -204,13 +204,12 @@ StdFontInfo::StdFontInfo() : { } -StdFontInfo::StdFontInfo( const OUString& rName, sal_uInt32 nHeight, - sal_uInt16 nWeight, sal_uInt16 nCharSet, sal_uInt8 nFlags ) : +StdFontInfo::StdFontInfo( const OUString& rName, sal_uInt32 nHeight ) : maName( rName ), mnHeight( nHeight ), - mnWeight( nWeight ), - mnCharSet( nCharSet ), - mnFlags( nFlags ) + mnWeight( OLE_STDFONT_NORMAL ), + mnCharSet( WINDOWS_CHARSET_ANSI ), + mnFlags( 0 ) { } diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx index b520d652f8d6..e915ba78ea10 100644 --- a/oox/source/ole/vbaproject.cxx +++ b/oox/source/ole/vbaproject.cxx @@ -209,34 +209,34 @@ Reference< XLibraryContainer > VbaProject::getLibraryContainer( sal_Int32 nPropI return xLibContainer; } -Reference< XNameContainer > VbaProject::openLibrary( sal_Int32 nPropId, bool bCreateMissing ) +Reference< XNameContainer > VbaProject::openLibrary( sal_Int32 nPropId ) { Reference< XNameContainer > xLibrary; try { Reference< XLibraryContainer > xLibContainer( getLibraryContainer( nPropId ), UNO_SET_THROW ); - if( bCreateMissing && !xLibContainer->hasByName( maPrjName ) ) + if( !xLibContainer->hasByName( maPrjName ) ) xLibContainer->createLibrary( maPrjName ); xLibrary.set( xLibContainer->getByName( maPrjName ), UNO_QUERY_THROW ); } catch(const Exception& ) { } - OSL_ENSURE( !bCreateMissing || xLibrary.is(), "VbaProject::openLibrary - cannot create library" ); + OSL_ENSURE( xLibrary.is(), "VbaProject::openLibrary - cannot create library" ); return xLibrary; } Reference< XNameContainer > const & VbaProject::createBasicLibrary() { if( !mxBasicLib.is() ) - mxBasicLib = openLibrary( PROP_BasicLibraries, true ); + mxBasicLib = openLibrary( PROP_BasicLibraries ); return mxBasicLib; } Reference< XNameContainer > const & VbaProject::createDialogLibrary() { if( !mxDialogLib.is() ) - mxDialogLib = openLibrary( PROP_DialogLibraries, true ); + mxDialogLib = openLibrary( PROP_DialogLibraries ); return mxDialogLib; } @@ -406,7 +406,7 @@ void VbaProject::readVbaModules( StorageBase& rVbaPrjStrg ) } } -void VbaProject::importModulesAndForms( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) +void VbaProject::importModulesAndForms( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper ) { StorageRef xVbaStrg = rVbaPrjStrg.openSubStorage( "VBA", false ); OSL_ENSURE( xVbaStrg.get(), "VbaProject::importModulesAndForms - cannot open 'VBA' substorage" ); @@ -487,7 +487,7 @@ void VbaProject::importModulesAndForms( StorageBase& rVbaPrjStrg, const GraphicH // create and import the form Reference< XNameContainer > xDialogLib( createDialogLibrary(), UNO_SET_THROW ); - VbaUserForm aForm( mxContext, mxDocModel, rGraphicHelper, bDefaultColorBgr ); + VbaUserForm aForm( mxContext, mxDocModel, rGraphicHelper, true/*bDefaultColorBgr*/ ); aForm.importForm( xDialogLib, *xSubStrg, aModuleName, eTextEnc ); } catch(const Exception& ) -- cgit