From ab279d30de4188baa4b33688aaed96072f3b4818 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Jan 2018 20:09:15 +0100 Subject: More loplugin:cstylecast: xmlscript auto-rewrite with "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: If9a6160a75ae56f563a098a5569af64eb8fab7d7 --- xmlscript/source/xml_helper/xml_byteseq.cxx | 2 +- xmlscript/source/xml_helper/xml_element.cxx | 8 ++++---- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 2 +- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 2 +- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 6 +++--- xmlscript/source/xmllib_imexp/xmllib_import.cxx | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'xmlscript/source') diff --git a/xmlscript/source/xml_helper/xml_byteseq.cxx b/xmlscript/source/xml_helper/xml_byteseq.cxx index 5291dfbd5187..e0d5ec272466 100644 --- a/xmlscript/source/xml_helper/xml_byteseq.cxx +++ b/xmlscript/source/xml_helper/xml_byteseq.cxx @@ -56,7 +56,7 @@ public: sal_Int32 BSeqInputStream::readBytes( Sequence< sal_Int8 > & rData, sal_Int32 nBytesToRead ) { - nBytesToRead = ((nBytesToRead > (sal_Int32)_seq.size() - _nPos) + nBytesToRead = ((nBytesToRead > static_cast(_seq.size()) - _nPos) ? _seq.size() - _nPos : nBytesToRead); diff --git a/xmlscript/source/xml_helper/xml_element.cxx b/xmlscript/source/xml_helper/xml_element.cxx index 02bfdc98245e..c0f4286ab5c6 100644 --- a/xmlscript/source/xml_helper/xml_element.cxx +++ b/xmlscript/source/xml_helper/xml_element.cxx @@ -39,7 +39,7 @@ void XMLElement::addSubElement( Reference< xml::sax::XAttributeList > const & xE Reference< xml::sax::XAttributeList > const & XMLElement::getSubElement( sal_Int32 nIndex ) { - return _subElems[ (size_t)nIndex ]; + return _subElems[ static_cast(nIndex) ]; } void XMLElement::dumpSubElements( Reference< xml::sax::XDocumentHandler > const & xOut ) @@ -69,13 +69,13 @@ sal_Int16 XMLElement::getLength() OUString XMLElement::getNameByIndex( sal_Int16 nPos ) { - OSL_ASSERT( (size_t)nPos < _attrNames.size() ); + OSL_ASSERT( static_cast(nPos) < _attrNames.size() ); return _attrNames[ nPos ]; } OUString XMLElement::getTypeByIndex( sal_Int16 nPos ) { - OSL_ASSERT( (size_t)nPos < _attrNames.size() ); + OSL_ASSERT( static_cast(nPos) < _attrNames.size() ); // xxx todo return OUString(); } @@ -88,7 +88,7 @@ OUString XMLElement::getTypeByName( OUString const & /*rName*/ ) OUString XMLElement::getValueByIndex( sal_Int16 nPos ) { - OSL_ASSERT( (size_t)nPos < _attrNames.size() ); + OSL_ASSERT( static_cast(nPos) < _attrNames.size() ); return _attrValues[ nPos ]; } diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index fe4723cee238..764cdb892d77 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx @@ -569,7 +569,7 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles ) sal_Int16 nEcho = 0; if (readProp( "EchoChar" ) >>= nEcho) { - sal_Unicode cEcho = (sal_Unicode)nEcho; + sal_Unicode cEcho = static_cast(nEcho); addAttribute( XMLNS_DIALOGS_PREFIX ":echochar", OUString( &cEcho, 1 ) ); } readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" ); diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index 4bc7152f957b..b1a53e7ba9bd 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -1046,7 +1046,7 @@ void TextFieldElement::endElement() sal_Int16 nChar = 0; if(!aValue.isEmpty()) { - nChar = (sal_Int16)aValue[ 0 ]; + nChar = static_cast(aValue[ 0 ]); } xControlModel->setPropertyValue( "EchoChar", makeAny( nChar ) ); } diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index f0d6777d9534..8104ac4495ab 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -303,13 +303,13 @@ void StyleElement::importFontStyle( // dialog:font-height %numeric; #IMPLIED if (getStringAttr( &aValue, "font-height", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) { - _descr.Height = (sal_Int16)toInt32( aValue ); + _descr.Height = static_cast(toInt32( aValue )); bFontImport = true; } // dialog:font-width %numeric; #IMPLIED if (getStringAttr(&aValue, "font-width", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) { - _descr.Width = (sal_Int16)toInt32( aValue ); + _descr.Width = static_cast(toInt32( aValue )); bFontImport = true; } // dialog:font-stylename CDATA #IMPLIED @@ -763,7 +763,7 @@ bool ImportContext::importShortProperty( _pImport->XMLNS_DIALOGS_UID, rAttrName ) ); if (!aValue.isEmpty()) { - _xControlModel->setPropertyValue( rPropName, makeAny( (sal_Int16)toInt32( aValue ) ) ); + _xControlModel->setPropertyValue( rPropName, makeAny( static_cast(toInt32( aValue )) ) ); return true; } return false; diff --git a/xmlscript/source/xmllib_imexp/xmllib_import.cxx b/xmlscript/source/xmllib_imexp/xmllib_import.cxx index ea2de8523f48..2bdae2dbad18 100644 --- a/xmlscript/source/xmllib_imexp/xmllib_import.cxx +++ b/xmlscript/source/xmllib_imexp/xmllib_import.cxx @@ -181,7 +181,7 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement( void LibrariesElement::endElement() { - sal_Int32 nLibCount = mxImport->mpLibArray->mnLibCount = (sal_Int32)mLibDescriptors.size(); + sal_Int32 nLibCount = mxImport->mpLibArray->mnLibCount = static_cast(mLibDescriptors.size()); mxImport->mpLibArray->mpLibs.reset( new LibDescriptor[ nLibCount ] ); for( sal_Int32 i = 0 ; i < nLibCount ; i++ ) -- cgit