loplugin:sequentialassign in writerfilter..xmlsecurity

Change-Id: I41028c704eca08b71746c3c87e38926b95449775
Reviewed-on: https://gerrit.libreoffice.org/70735
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-04-15 08:38:02 +02:00
parent b52f309f2b
commit f87fab6310
23 changed files with 30 additions and 69 deletions
@@ -1652,8 +1652,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper
else
{
m_bStartedTOC = true;
uno::Reference< text::XTextCursor > xTOCTextCursor;
xTOCTextCursor = xTextAppend->getEnd()->getText( )->createTextCursor( );
uno::Reference< text::XTextCursor > xTOCTextCursor = xTextAppend->getEnd()->getText( )->createTextCursor( );
xTOCTextCursor->gotoEnd(false);
if (xTOCTextCursor.is())
{
@@ -4846,8 +4845,7 @@ void DomainMapper_Impl::CloseFieldCommand()
{
xFieldInterface = m_xTextFactory->createInstance("com.sun.star.text.Fieldmark");
const uno::Reference<text::XTextContent> xTextContent(xFieldInterface, uno::UNO_QUERY_THROW);
uno::Reference< text::XTextAppend > xTextAppend;
xTextAppend = m_aTextAppendStack.top().xTextAppend;
uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
uno::Reference< text::XTextCursor > xCrsr = xTextAppend->createTextCursorByRange(pContext->GetStartRange());
if (xTextContent.is())
{
@@ -906,8 +906,8 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
if (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
pExtHeader = nullptr;
uno::Reference<graphic::XGraphic> xGraphic;
xGraphic = m_pGraphicHelper->importGraphic(xInputStream, pExtHeader);
uno::Reference<graphic::XGraphic> xGraphic
= m_pGraphicHelper->importGraphic(xInputStream, pExtHeader);
if (m_aStates.top().aPicture.eStyle != RTFBmpStyle::NONE)
{
+1 -3
View File
@@ -41,9 +41,7 @@ std::string RTFSprm::toString() const
{
OStringBuffer aBuf("RTFSprm");
std::string sResult;
sResult = (*QNameToString::Instance())(m_nKeyword);
std::string sResult = (*QNameToString::Instance())(m_nKeyword);
aBuf.append(" ('");
if (sResult.length() == 0)
+2 -5
View File
@@ -2913,8 +2913,7 @@ void SchXMLExportHelper_Impl::exportRegressionCurve(
bool bShowRSquared = false;
bool bExportEquation = false;
OUString aService;
aService = xServiceName->getServiceName();
OUString aService = xServiceName->getServiceName();
std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xProperties );
@@ -3021,9 +3020,7 @@ void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySe
try
{
Any aAny;
aAny = xSeriesProp->getPropertyValue( bYError ? OUString("ErrorBarY") : OUString("ErrorBarX") );
Any aAny = xSeriesProp->getPropertyValue( bYError ? OUString("ErrorBarY") : OUString("ErrorBarX") );
aAny >>= xErrorBarProp;
if ( xErrorBarProp.is() )
+1 -3
View File
@@ -339,10 +339,8 @@ static void SdXMLExportDataStyleNumber( SdXMLExport& rExport, SdXMLDataStyleNumb
static void SdXMLExportStyle( SdXMLExport& rExport, const SdXMLFixedDataStyle* pStyle, const SdXMLFixedDataStyle* pStyle2 = nullptr )
{
OUString sAttrValue;
// name
sAttrValue = OUString::createFromAscii( pStyle->mpName );
OUString sAttrValue = OUString::createFromAscii( pStyle->mpName );
if( pStyle2 )
sAttrValue += OUString::createFromAscii( pStyle2->mpName );
+1 -3
View File
@@ -681,9 +681,7 @@ bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUStr
if(xPropSet.is())
{
sal_uInt16 nType = sal_uInt16();
Any aAny;
aAny = xPropSet->getPropertyValue("Layout");
Any aAny = xPropSet->getPropertyValue("Layout");
if(aAny >>= nType)
{
if(ImpXMLAutoLayoutInfo::IsCreateNecessary(nType))
+1 -2
View File
@@ -376,8 +376,7 @@ void OFormLayerXMLImport_Impl::startPage(const Reference< XDrawPage >& _rxDrawPa
return;
// add a new entry to our page map
::std::pair< MapDrawPage2Map::iterator, bool > aPagePosition;
aPagePosition = m_aControlIds.emplace(_rxDrawPage, MapString2PropertySet());
::std::pair< MapDrawPage2Map::iterator, bool > aPagePosition = m_aControlIds.emplace(_rxDrawPage, MapString2PropertySet());
OSL_ENSURE(aPagePosition.second, "OFormLayerXMLImport_Impl::startPage: already imported this page!");
m_aCurrentPageIds = aPagePosition.first;
}
+1 -2
View File
@@ -148,8 +148,7 @@ namespace xmloff
bool bIsEmptyValue = TypeClass_VOID == aValue.getValueType().getTypeClass();
if ( bIsEmptyValue )
{
css::beans::Property aPropDesc;
aPropDesc = m_xPropertyInfo->getPropertyByName( rProperty );
css::beans::Property aPropDesc = m_xPropertyInfo->getPropertyByName( rProperty );
aExportType = aPropDesc.Type;
}
token::XMLTokenEnum eValueType = implGetPropertyXMLType( aExportType );
@@ -79,12 +79,9 @@ void XMLStarBasicExportHandler::Export(
if( !sLocation.isEmpty() )
{
OUStringBuffer sTmp( sLocation.getLength() + sName.getLength() + 1 );
sTmp = sLocation;
sTmp.append( ':' );
sTmp.append( sName );
OUString sTmp = sLocation + ":" + sName;
rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME,
sTmp.makeStringAndClear());
sTmp);
}
else
{
+1 -3
View File
@@ -247,10 +247,8 @@ void XMLTransGradientStyleExport::exportXML(
rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CY, aStrValue );
}
Color aColor;
// Transparency start
aColor = Color(aGradient.StartColor);
Color aColor = Color(aGradient.StartColor);
sal_Int32 aStartValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
::sax::Converter::convertPercent( aOut, aStartValue );
aStrValue = aOut.makeStringAndClear();
+1 -2
View File
@@ -355,8 +355,7 @@ std::unordered_set<OUString> XMLFontAutoStylePool::getUsedFontList()
GetExport().collectAutoStyles();
// Check auto-styles for fonts
std::vector<xmloff::AutoStyleEntry> aAutoStyleEntries;
aAutoStyleEntries = GetExport().GetAutoStylePool()->GetAutoStyleEntries();
std::vector<xmloff::AutoStyleEntry> aAutoStyleEntries = GetExport().GetAutoStylePool()->GetAutoStyleEntries();
for (auto const & rAutoStyleEntry : aAutoStyleEntries)
{
for (auto const & rPair : rAutoStyleEntry.m_aXmlProperties)
+1 -2
View File
@@ -70,8 +70,7 @@ void XMLIndexMarkExport::ExportIndexMark(
sal_Int8 nElementNo = -1;
// get index mark
Any aAny;
aAny = rPropSet->getPropertyValue(gsDocumentIndexMark);
Any aAny = rPropSet->getPropertyValue(gsDocumentIndexMark);
Reference<XPropertySet> xIndexMarkPropSet;
aAny >>= xIndexMarkPropSet;
@@ -66,10 +66,8 @@ void XMLLineNumberingExport::Export()
if (xLineNumbering.is())
{
Any aAny;
// char style
aAny = xLineNumbering->getPropertyValue("CharStyleName");
Any aAny = xLineNumbering->getPropertyValue("CharStyleName");
OUString sTmp;
aAny >>= sTmp;
if (!sTmp.isEmpty())
+2 -4
View File
@@ -356,10 +356,9 @@ void XMLSectionExport::ExportRegularSectionStart(
// get XPropertySet for other values
Reference<XPropertySet> xPropSet(rSection, UNO_QUERY);
Any aAny;
// condition and display
aAny = xPropSet->getPropertyValue("Condition");
Any aAny = xPropSet->getPropertyValue("Condition");
OUString sCond;
aAny >>= sCond;
enum XMLTokenEnum eDisplay = XML_TOKEN_INVALID;
@@ -605,8 +604,7 @@ void XMLSectionExport::ExportAlphabeticalIndexStart(
{
// style name (if present)
Any aAny;
aAny = rPropertySet->getPropertyValue("MainEntryCharacterStyleName");
Any aAny = rPropertySet->getPropertyValue("MainEntryCharacterStyleName");
OUString sStyleName;
aAny >>= sStyleName;
if (!sStyleName.isEmpty())
+1 -2
View File
@@ -1373,8 +1373,7 @@ XMLTextFrameContext::XMLTextFrameContext(
{
rtl::Reference < XMLTextImportHelper > xTxtImport =
GetImport().GetTextImport();
XMLPropStyleContext* pStyle( nullptr );
pStyle = xTxtImport->FindAutoFrameStyle( aStyleName );
XMLPropStyleContext* pStyle = xTxtImport->FindAutoFrameStyle( aStyleName );
if ( pStyle && pStyle->GetParentName().isEmpty() )
{
m_HasAutomaticStyleWithoutParentStyle = true;
@@ -57,9 +57,7 @@ XMLTextHeaderFooterContext::XMLTextHeaderFooterContext( SvXMLImport& rImport, sa
// NOTE: if this ever handles XML_DISPLAY attr then beware of fdo#72850 !
if( bLeft || bFirst )
{
Any aAny;
aAny = xPropSet->getPropertyValue( sOn );
Any aAny = xPropSet->getPropertyValue( sOn );
bool bOn = *o3tl::doAccess<bool>(aAny);
if( bOn )
+1 -2
View File
@@ -72,8 +72,7 @@ void XMLTextParagraphExport::exportTextFootnote(
bool bAutoStyles, bool bIsProgress )
{
// get footnote and associated text
Any aAny;
aAny = rPropSet->getPropertyValue(gsFootnote);
Any aAny = rPropSet->getPropertyValue(gsFootnote);
Reference<XFootnote> xFootnote;
aAny >>= xFootnote;
Reference<XText> xText(xFootnote, UNO_QUERY);
+1 -2
View File
@@ -2075,8 +2075,7 @@ void XMLTextParagraphExport::exportParagraph(
}
Reference < XEnumerationAccess > xEA( rTextContent, UNO_QUERY );
Reference < XEnumeration > xTextEnum;
xTextEnum = xEA->createEnumeration();
Reference < XEnumeration > xTextEnum = xEA->createEnumeration();
const bool bHasPortions = xTextEnum.is();
Reference < XEnumeration> xContentEnum;
+1 -2
View File
@@ -382,8 +382,7 @@ void XMLSequenceFieldImportContext::PrepareField(
// handle reference name
if (bRefNameOK)
{
Any aAny;
aAny = xPropertySet->getPropertyValue("SequenceValue");
Any aAny = xPropertySet->getPropertyValue("SequenceValue");
sal_Int16 nValue = 0;
aAny >>= nValue;
GetImportHelper().InsertSequenceID(sRefName, GetName(), nValue);
+2 -6
View File
@@ -198,12 +198,8 @@ void XMLEventOOoTransformerContext::StartElement(
{
if( !IsXMLToken( aLocation, XML_APPLICATION ) )
aLocation = GetXMLToken( XML_DOCUMENT );
OUStringBuffer sTmp( aLocation.getLength() + aMacroName.getLength() + 1 );
sTmp = aLocation;
sTmp.append( ':' );
sTmp.append( aMacroName );
pMutableAttrList->SetValueByIndex( nMacroName,
sTmp.makeStringAndClear() );
OUString sTmp = aLocation + ":" + aMacroName;
pMutableAttrList->SetValueByIndex( nMacroName, sTmp );
}
if( m_bPersistent )
+1 -2
View File
@@ -314,10 +314,9 @@ void MacroSecurityTrustedSourcesTP::FillCertLB()
for( sal_uInt32 nEntry = 0 ; nEntry < nEntries ; ++nEntry )
{
css::uno::Sequence< OUString >& rEntry = m_aTrustedAuthors[ nEntry ];
uno::Reference< css::security::XCertificate > xCert;
// create from RawData
xCert = m_pDlg->m_xSecurityEnvironment->createCertificateFromAscii( rEntry[ 2 ] );
uno::Reference< css::security::XCertificate > xCert = m_pDlg->m_xSecurityEnvironment->createCertificateFromAscii( rEntry[ 2 ] );
m_xTrustCertLB->append(OUString::number(nEntry), xmlsec::GetContentPart(xCert->getSubjectName()));
m_xTrustCertLB->set_text(nEntry, xmlsec::GetContentPart(xCert->getIssuerName()), 1);
@@ -331,8 +331,7 @@ bool XMLSignatureHelper::ReadAndVerifySignatureStorage(const uno::Reference<embe
uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement("_rels", nOpenMode);
uno::Reference<io::XInputStream> xRelStream(xSubStorage->openStreamElement("origin.sigs.rels", nOpenMode), uno::UNO_QUERY);
uno::Sequence< uno::Sequence<beans::StringPair> > aRelationsInfo;
aRelationsInfo = comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, "origin.sigs.rels", mxCtx);
uno::Sequence< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, "origin.sigs.rels", mxCtx);
for (sal_Int32 i = 0; i < aRelationsInfo.getLength(); ++i)
{
@@ -421,8 +420,7 @@ void XMLSignatureHelper::EnsureSignaturesRelation(const css::uno::Reference<css:
sal_Int32 nOpenMode = embed::ElementModes::READWRITE;
uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement("_rels", nOpenMode);
uno::Reference<io::XInputStream> xRelStream(xSubStorage->openStreamElement(".rels", nOpenMode), uno::UNO_QUERY);
std::vector< uno::Sequence<beans::StringPair> > aRelationsInfo;
aRelationsInfo = comphelper::sequenceToContainer< std::vector< uno::Sequence<beans::StringPair> > >(comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, ".rels", mxCtx));
std::vector< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::sequenceToContainer< std::vector< uno::Sequence<beans::StringPair> > >(comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, ".rels", mxCtx));
// Do we have a relation already?
bool bHaveRelation = false;
+1 -3
View File
@@ -286,9 +286,7 @@ void SAXHelper::startElement(
*/
void SAXHelper::endElement( const OUString& aName )
{
xmlChar* fullname = nullptr ;
fullname = ous_to_xmlstr( aName ) ;
xmlChar* fullname = ous_to_xmlstr( aName ) ;
m_pSaxHandler->endElement( m_pParserCtxt , fullname ) ;
if( fullname != nullptr )